diff --git a/.codecov.yml b/.codecov.yml deleted file mode 100644 index 0aa829d1d..000000000 --- a/.codecov.yml +++ /dev/null @@ -1,2 +0,0 @@ -codecov: - token: b3275f76-a606-4c63-9b5c-1c58ef7acba0 diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..b10574073 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +[*.{kt,kts}] +indent_size=4 +insert_final_newline=false +max_line_length=150 \ No newline at end of file diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index 3bbc7439c..000000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,89 +0,0 @@ -# Contributing to FastHub - -**Updated: 19 Jan 2018** - -## Table of contents - -1. [Submitting Issues](#submitting-issues) -1. [How to contribute. Importing and assembling](#how-to-contribute-importing-and-assembling) - 1. [Custom keys *(optional)*](#custom-keys-optional) - 1. [Before importing into Android Studio](#before-importing-into-android-studio) - 1. [Before import](#before-importation) - 1. [Importing Android Studio project](#importing-android-studio-project) - 1. [Submitting Pull Request](#submitting-pull-request) -1. [Working with translations](#working-with-translations) -1. [Translations Contributors](#translations-contributors) - -## Submitting Issues - -- Let's keep everything clean and tidy here :) - - Make sure that similar Issues are not exist. Reopen an Issue if exists but closed. - - If things you want to submit are related to each other, submit them in one Issue. -- None of the forked Repositories' Issues will be accepted! - - Forks are developed separately from the origin Repository. -- Make sure you are running latest version (to check it out withing the FastHub head to About and tap on the section with application's version). -- Make sure the included template is filled in (submitting an Issue within FastHub will do it automatically). - -## How to contribute. Importing and assembling - -If you have any questions, feel free to join our public [Slack](http://rebrand.ly/fasthub) channel. - -### Custom keys *(optional)* - -- Please update `debug_gradle.properties` file if you want to use your own keys: - - `github_client_id=` -- your GitHub clientId; - - `github_secret=` -- your GitHub secret; - - `redirect_url=` -- the url defined in `AndroidManifest` under `LoginView`. - -### Before importation - -- Make sure you are running *Android Studio 3.0 C4* or above; -- Import *Android Studio Settings* (to follow project's code style) from [this file](https://raw.githubusercontent.com/k0shk0sh/FastHub/master/fasthub_as_settings.jar); -- Install *Lombok Plugin* from Android Studio Plugins and enable Annotations Processors in Android Studio Preferences. - -### Importing Android Studio project - -- Fork the Repository. -- Clone it to your workstation. -- Open the project in Android Studio. -- Compile the project for the first time. Then you can start coding. - -### Submitting Pull Request - -> Please use meaningful commit messages. - -- Create a new Branch with the changes you made. -- Submit your Pull Request with an explanation of what have you done and why. - -> I really appreciate your efforts on contributing to this project. - -## Working with translations - -1. Firstly, you have to fork the repository by clicking the **Fork** button. -1. Clone your own forked repository to your workstation. -1. Create and switch Branch by typing `git checkout -b ` where `` is the name of the Branch you want to work with. We recommend you to name it into the language you want to translate in. -1. Create a new directory named like `values-`, where `` is a 2 letter ISO code of the language. For example `values-es` for Spanish, `values-fr` for French. -1. Copy `values/strings.xml` into the directory you have created (`values-??`). -1. Open `values-??/strings.xml` in your editor of choice. -1. Translate and keep in mind these important things. - 1. Obey the XML format. So, `ONLY TRANSLATE HERE`. - 1. Don't translate lines which contain `translatable="false"`. - 1. Don't translate Git and GitHub terms, such as *Pull Request*, *Push*, *Commit*, *Branch*, etc. - 1. There are some escape sequences used in translations (e.g. `\n` as a line feed (new line), `\t` as a tabulator. Don't delete them! - *For the full list you can see this [Wiki article](https://en.wikipedia.org/wiki/Control_character#In_ASCII).* - 1. There are some characters which **must be escaped** in translations. - - | `"` | `"` | - |-----|----------| - | `'` | `'` | - | `&` | `&` | - | `>` | `>` | - | `<` | `<` | - 1. Don't add extra spaces or periods. Don't delete existent ones. -1. Once you finished translating, add new files to the Git index using `git add values-??/strings.xml` command and commit the changes using `git commit -m ''`, where `` is a short description of changes you made. -1. Push your local changes into your forked repository by typing `git push origin `. -1. Finally, create a Pull Request from your Branch to our main Branch *development*. - -## Translations Contributors - -- *See [README.md](https://github.com/k0shk0sh/FastHub#language-contributors)* diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 6a07e933d..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: "[BUG]" -labels: '' -assignees: '' - ---- - - - -**FastHub Version:** -**Android Version:** -**Device Information:** -- MANUFACTURER: -- BRAND: -- MODEL: ---- diff --git a/.github/assets/direct-apk-download.png b/.github/assets/direct-apk-download.png deleted file mode 100644 index 4de1b2942..000000000 Binary files a/.github/assets/direct-apk-download.png and /dev/null differ diff --git a/.github/assets/feature_graphic.png b/.github/assets/feature_graphic.png deleted file mode 100644 index a699d288d..000000000 Binary files a/.github/assets/feature_graphic.png and /dev/null differ diff --git a/.github/assets/first.png b/.github/assets/first.png deleted file mode 100644 index f5680b7a6..000000000 Binary files a/.github/assets/first.png and /dev/null differ diff --git a/.github/assets/fourth.png b/.github/assets/fourth.png deleted file mode 100644 index 9465ff803..000000000 Binary files a/.github/assets/fourth.png and /dev/null differ diff --git a/.github/assets/sec.png b/.github/assets/sec.png deleted file mode 100644 index b47c18f92..000000000 Binary files a/.github/assets/sec.png and /dev/null differ diff --git a/.github/assets/third.png b/.github/assets/third.png deleted file mode 100644 index e25104829..000000000 Binary files a/.github/assets/third.png and /dev/null differ diff --git a/.github_changelog_generator b/.github_changelog_generator deleted file mode 100644 index 6873c8f7b..000000000 --- a/.github_changelog_generator +++ /dev/null @@ -1,7 +0,0 @@ -since-tag=4.5.6 -issues-wo-labels=false -issue-line-labels=true -exclude-labels=Type: Invalid,Type: Duplicate,Type: Unknown,Type: Question,Type: No API,Type: Work as Intended,Type: Can't Reproduce,Status: Won't Fix -include-labels=Status: Completed -bug-labels=Type: Bug -enhancement-labels=Type: Enhancement,Type: Feature Request \ No newline at end of file diff --git a/.gitignore b/.gitignore index 26049c9bb..9b5d55c30 100644 --- a/.gitignore +++ b/.gitignore @@ -3,10 +3,10 @@ /local.properties .DS_Store /build -/release_gradle.properties /.idea/ /app/google-services.json /app/build/ -/app/src/main/res/values/secrets.xml +/resources/src/main/res/values/secrets.xml /app/fastaccess-key /changelog_generator +build-dependecies/secret_keys.properties \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index 3baf58318..000000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,46 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at kosh20111@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 9cecc1d46..000000000 --- a/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - {one line to give the program's name and a brief idea of what it does.} - Copyright (C) {year} {name of author} - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - {project} Copyright (C) {year} {fullname} - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/app/build.gradle b/app/build.gradle index 5f5db43c7..8e0911571 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,20 +2,30 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' -apply plugin: 'com.apollographql.android' -apply plugin: 'com.novoda.build-properties' +apply plugin: 'androidx.navigation.safeargs' apply plugin: 'io.fabric' -apply plugin: 'com.google.firebase.firebase-perf' +apply plugin: 'com.novoda.build-properties' +apply plugin: "org.jlleitschuh.gradle.ktlint" +apply plugin: "com.github.ben-manes.versions" buildProperties { notThere { - using rootProject.file('debug_gradle.properties') + using rootProject.file('build-dependecies/debug_keys.properties') } secrets { - using rootProject.file('release_gradle.properties') + using rootProject.file('build-dependecies/secret_keys.properties') } } +ktlint { + version = "0.28.0" + debug = true + verbose = true + android = true + reporter = "checkstyle" + ignoreFailures = true +} + android { signingConfigs { signing { @@ -25,35 +35,36 @@ android { storePassword((buildProperties.secrets['android_store_password'] | buildProperties.notThere['android_store_password']).string) } } - compileSdkVersion 29 + + def conf = rootProject.ext.android + compileSdkVersion conf.compileSdkVersion + defaultConfig { - applicationId "com.fastaccess.github" - minSdkVersion 21 - targetSdkVersion 29 - versionCode 473 - versionName "4.7.3" - buildConfigString "GITHUB_CLIENT_ID", (buildProperties.secrets['github_client_id'] | buildProperties.notThere['github_client_id']).string - buildConfigString "GITHUB_SECRET", (buildProperties.secrets['github_secret'] | buildProperties.notThere['github_secret']).string - buildConfigString "IMGUR_CLIENT_ID", (buildProperties.secrets['imgur_client_id'] | buildProperties.notThere['imgur_client_id']).string - buildConfigString "IMGUR_SECRET", (buildProperties.secrets['imgur_secret'] | buildProperties.notThere['imgur_secret']).string - buildConfigField "String", "REST_URL", '"https://api.github.com/"' - buildConfigField "String", "IMGUR_URL", '"https://api.imgur.com/3/"' + applicationId conf.applicationId + minSdkVersion conf.minSdkVersion + targetSdkVersion conf.targetSdkVersion + versionCode conf.versionCode + versionName conf.versionName multiDexEnabled true + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" javaCompileOptions { annotationProcessorOptions { - includeCompileClasspath true + includeCompileClasspath = true } } + } buildTypes { release { + signingConfig signingConfigs.signing minifyEnabled true shrinkResources true - signingConfig signingConfigs.signing proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } + debug { + signingConfig signingConfigs.signing applicationIdSuffix ".debug" versionNameSuffix "-debug" ext.alwaysUpdateBuildId = false @@ -67,7 +78,6 @@ android { "src/main/res/layouts/main_layouts", "src/main/res/layouts/row_layouts", "src/main/res/layouts/other_layouts", - "src/main/res/translations", "src/main/res" ] } @@ -78,103 +88,65 @@ android { htmlReport true xmlReport true disable 'InvalidPackage' + check 'Interoperability' } + compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility 1.8 + targetCompatibility 1.8 } - configurations { - all*.exclude module: 'javax.annotation' - all*.exclude group: 'org.jetbrains', module: 'annotations-java5' + kotlinOptions { + jvmTarget = "1.8" } - packagingOptions { exclude 'META-INF/rxjava.properties' } - dexOptions { jumboMode true javaMaxHeapSize "4g" } -} -repositories { - maven { url "https://clojars.org/repo/" } - maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } - maven { url "https://jitpack.io" } - maven { url 'https://maven.fabric.io/public' } + testOptions { + unitTests.returnDefaultValues = true + } + + configurations { + all*.exclude module: 'javax.annotation' + all*.exclude group: 'org.jetbrains', module: 'annotations-java5' + } } dependencies { - implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'com.google.android.material:material:1.0.0' - implementation 'androidx.cardview:cardview:1.0.0' - implementation 'androidx.recyclerview:recyclerview:1.1.0' - implementation 'androidx.legacy:legacy-preference-v14:1.0.0' - implementation 'androidx.browser:browser:1.2.0' - implementation 'androidx.palette:palette:1.0.0' - implementation 'androidx.annotation:annotation:1.1.0' - implementation 'androidx.core:core:1.1.0' - implementation "net.grandcentrix.thirtyinch:thirtyinch:${thirtyinchVersion}" - implementation "net.grandcentrix.thirtyinch:thirtyinch-rx2:${thirtyinchVersion}" - implementation "com.squareup.retrofit2:retrofit:${retrofit}" - implementation "com.squareup.retrofit2:converter-gson:${retrofit}" - implementation "com.squareup.retrofit2:adapter-rxjava2:${retrofit}" - implementation "com.squareup.retrofit2:converter-scalars:${retrofit}" - implementation "com.github.bumptech.glide:glide:${glideVersion}" - implementation 'cn.gavinliu:ShapedImageView:0.8.7' - implementation "com.jakewharton:butterknife:${butterKnifeVersion}" - implementation 'it.sephiroth.android.library.bottomnavigation:bottom-navigation:2.0.2' - implementation 'io.reactivex.rxjava2:rxjava:2.2.15' - implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' - implementation 'com.squareup.okhttp3:logging-interceptor:4.2.2' - implementation 'com.annimon:stream:1.1.9' - implementation 'com.github.GrenderG:Toasty:1.1.3' - implementation 'com.github.k0shk0sh:RetainedDateTimePickers:1.0.2' - implementation 'com.github.daniel-stoneuk:material-about-library:2.1.0' - implementation "io.requery:requery:${requery}" - implementation "io.requery:requery-android:${requery}" - implementation('com.mikepenz:aboutlibraries:5.9.7@aar') { transitive = true } - implementation 'com.github.nightwhistler:HtmlSpanner:0.4' - implementation 'net.sourceforge.htmlcleaner:htmlcleaner:2.2' - implementation 'com.github.matthiasrobbers:shortbread:1.0.1' - implementation "com.atlassian.commonmark:commonmark:${commonmark}" - implementation "com.atlassian.commonmark:commonmark-ext-autolink:${commonmark}" - implementation "com.atlassian.commonmark:commonmark-ext-gfm-strikethrough:${commonmark}" - implementation "com.atlassian.commonmark:commonmark-ext-gfm-tables:${commonmark}" - implementation "com.atlassian.commonmark:commonmark-ext-ins:${commonmark}" - implementation "com.atlassian.commonmark:commonmark-ext-yaml-front-matter:${commonmark}" - implementation "com.google.firebase:firebase-analytics:17.2.1" - implementation "com.google.firebase:firebase-inappmessaging:19.0.2" - implementation "com.google.firebase:firebase-messaging:20.1.0" - implementation "com.google.firebase:firebase-database:19.2.0" - implementation 'com.google.firebase:firebase-perf:19.0.4' - implementation "com.google.android.gms:play-services-base:17.1.0" - implementation('com.github.b3er.rxfirebase:firebase-database-kotlin:11.2.0') { transitive = false } - implementation('com.github.b3er.rxfirebase:firebase-database:11.2.0') { transitive = false } - implementation('com.crashlytics.sdk.android:crashlytics:2.9.0@aar') { transitive = true } - implementation "com.github.miguelbcr:RxBillingService:0.0.3" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}" - implementation 'org.jsoup:jsoup:1.12.1' - implementation "com.evernote:android-state:${state_version}" - implementation "petrov.kristiyan:colorpicker-library:1.1.4" - implementation 'com.apollographql.apollo:apollo-rx2-support:1.2.2' - implementation("com.apollographql.apollo:apollo-runtime:1.2.2") - implementation 'com.jaredrummler:android-device-names:1.1.9' - implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0' - implementation 'com.firebase:firebase-jobdispatcher:0.8.2' - implementation 'com.google.guava:guava:27.0.1-android' /*to be removed*/ - debugImplementation 'com.github.whataa:pandora:2.0.6' - releaseImplementation 'com.github.whataa:pandora-no-op:2.0.3' - - compileOnly "org.projectlombok:lombok:${lombokVersion}" - - kapt "org.projectlombok:lombok:${lombokVersion}" - kapt "com.evernote:android-state-processor:${state_version}" - kapt "com.jakewharton:butterknife-compiler:${butterKnifeVersion}" - kapt 'com.github.matthiasrobbers:shortbread-compiler:1.0.1' - kapt "io.requery:requery-processor:${requery}" - kapt "com.github.bumptech.glide:compiler:$glideVersion" + + def dependency = rootProject.ext + + implementation project(':base') + implementation project(':dagger') + implementation project(':reactions') + implementation project(':data') + implementation project(':network') + implementation project(':resources') + implementation project(':extensions') + implementation project(':markdown') + implementation project(':editor') + implementation project(':commits') + implementation project(':diff') + implementation project(':reviews') + implementation dependency.kotlin + implementation dependency.supportLibraries + implementation dependency.extrasLibraries + implementation dependency.networking + implementation dependency.rxJava + implementation dependency.extrasLibraries + implementation dependency.dagger + implementation dependency.archs + implementation dependency.firebase + api 'com.google.guava:guava:28.2-jre' // for the sake of listenablefuture + debugImplementation dependency.developmentDependencies + releaseImplementation dependency.releaseDevelopmentDependencies + + testImplementation dependency.testing + + kapt dependency.processing } apply plugin: 'com.google.gms.google-services' \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 2ce4dd23d..f1b424510 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,140 +1,21 @@ --keepattributes SourceFile,LineNumberTable --dontobfuscate --optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable --keepattributes *Annotation*,Signature --keepclassmembers class * implements java.io.Serializable { - static final long serialVersionUID; - private static final java.io.ObjectStreamField[] serialPersistentFields; - private void writeObject(java.io.ObjectOutputStream); - private void readObject(java.io.ObjectInputStream); - java.lang.Object writeReplace(); - java.lang.Object readResolve(); -} --keepclassmembers class **.R$* { - public static ; -} --keep class * implements android.os.Parcelable { - public static final android.os.Parcelable$Creator *; -} --keep public class * implements butterknife.Unbinder { public (**, android.view.View); } --keep class butterknife.* --keepclasseswithmembernames class * { @butterknife.* ; } --keepclasseswithmembernames class * { @butterknife.* ; } --keep class retrofit.** { *; } --keepattributes Signature --keepattributes Exceptions --keepclasseswithmembers class * { - @retrofit.http.* ; -} --keep class com.google.gson.** { *; } --keep class com.google.inject.** { *; } --keep class org.apache.** { *; } --keep class javax.inject.** { *; } --keep class retrofit.** { *; } --keep class com.squareup.okhttp.** { *; } --keep interface com.squareup.okhttp.** { *; } --keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* { - long producerIndex; - long consumerIndex; -} --keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef { - long producerNode; - long consumerNode; -} --keepclasseswithmembernames class * { - native ; -} --keepclassmembers enum * { *; } --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} --keep class **$$Icepick { *; } --keepclasseswithmembernames class * { - @icepick.* ; -} --keep class com.fastaccess.data.** { *; } --keep class com.fastaccess.provider.rest.** { *; } --keepclassmembers class com.prettifier.pretty.callback.MarkDownInterceptorInterface { - public *; -} --keepclassmembers enum io.requery.** { - public static **[] values(); - public static ** valueOf(java.lang.String); -} --keep class .R --keep class **.R$* { - ; -} --keep class net.nightwhistler.** { *; } --keep class org.htmlcleaner.** { *; } --keeppackagenames org.jsoup.nodes --keep class com.github.b3er.** { *; } --keep class com.memoizrlabs.** { *; } --keep public class * implements com.bumptech.glide.module.GlideModule --keep public class * extends com.bumptech.glide.AppGlideModule --keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** { - **[] $VALUES; - public *; -} +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html --keep class com.google.android.gms.** { *; } +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} --dontwarn com.github.b3er.** --dontwarn com.memoizrlabs.** --dontwarn java.lang.FunctionalInterface --dontwarn java.util.** --dontwarn java.time.** --dontwarn javax.annotation.** --dontwarn org.jetbrains.annotations.** --dontwarn javax.cache.** --dontwarn javax.naming.** --dontwarn javax.transaction.** --dontwarn java.sql.** --dontwarn android.support.** --dontwarn io.requery.cache.** --dontwarn io.requery.rx.** --dontwarn io.requery.reactivex.** --dontwarn io.requery.reactor.** --dontwarn io.requery.query.** --dontwarn io.requery.android.sqlcipher.** --dontwarn io.requery.android.sqlitex.** --dontwarn org.jaxen.** --dontwarn org.jdom.** --dontwarn com.google.android.gms.** --dontwarn android.animation.** --dontwarn java.io.** --dontwarn android.content.** --dontwarn org.jdom.** --dontwarn kotlin.reflect.jvm.internal.impl.descriptors.CallableDescriptor --dontwarn kotlin.reflect.jvm.internal.impl.descriptors.ClassDescriptor --dontwarn kotlin.reflect.jvm.internal.impl.descriptors.ClassifierDescriptorWithTypeParameters --dontwarn kotlin.reflect.jvm.internal.impl.descriptors.annotations.AnnotationDescriptor --dontwarn kotlin.reflect.jvm.internal.impl.descriptors.impl.PropertyDescriptorImpl --dontwarn kotlin.reflect.jvm.internal.impl.load.java.JavaClassFinder --dontwarn kotlin.reflect.jvm.internal.impl.resolve.OverridingUtil --dontwarn kotlin.reflect.jvm.internal.impl.types.DescriptorSubstitutor --dontwarn kotlin.reflect.jvm.internal.impl.types.DescriptorSubstitutor --dontwarn kotlin.reflect.jvm.internal.impl.types.TypeConstructor --dontwarn java.beans.** --dontwarn javax.** --dontwarn lombok.** --dontwarn java.lang.invoke.* --dontwarn rx.** --dontwarn com.squareup.okhttp.** --dontwarn okio.** --dontwarn org.apache.** --dontwarn android.net.http.AndroidHttpClient --dontwarn retrofit.** --dontwarn retrofit2.adapter.rxjava.CompletableHelper$** --dontwarn retrofit2.Platform$Java8 --dontwarn sun.misc.** --dontwarn sun.misc.Unsafe --dontwarn com.octo.android.robospice.retrofit.RetrofitJackson** --dontwarn retrofit.appengine.UrlFetchClient --dontwarn icepick.** --dontwarn com.fastaccess.ui.modules.repos.** --dontwarn org.apache.xerces.parsers.** --dontwarn oracle.xml.** --dontwarn org.jdom.** --dontwarn okhttp3.internal.** \ No newline at end of file +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/debug/google-services.json b/app/src/debug/google-services.json index 0ad69152c..41f5fcba8 100644 --- a/app/src/debug/google-services.json +++ b/app/src/debug/google-services.json @@ -14,6 +14,14 @@ } }, "oauth_client": [ + { + "client_id": "535903042804-49851187acpc331j0b2vn5lug2gf0pfs.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.fastaccess.github.debug", + "certificate_hash": "5c41a4f35fd13d8d3338cb2d86d9ae6a37cdbfc9" + } + }, { "client_id": "535903042804-14481m7poceb7ojv5roddqm28pg4ch5n.apps.googleusercontent.com", "client_type": 3 diff --git a/app/src/debug/res/values/strings.xml b/app/src/debug/res/values/strings.xml index 08ae5c309..40c9caa5a 100644 --- a/app/src/debug/res/values/strings.xml +++ b/app/src/debug/res/values/strings.xml @@ -1,4 +1,4 @@ - FastHub Debug + FastHub \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a85fbae7e..c88790571 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,8 +1,7 @@ + package="com.fastaccess.github"> @@ -10,42 +9,30 @@ - - - + + + - + @@ -58,213 +45,46 @@ android:scheme="fasthub" /> + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:name=".ui.modules.profile.ProfileActivity" + android:parentActivityName=".ui.modules.main.MainActivity" /> + - - - - - - - - + android:parentActivityName=".ui.modules.main.MainActivity" /> + + android:name="com.fastaccess.github.ui.modules.multipurpose.MultiPurposeActivity" + android:parentActivityName=".ui.modules.main.MainActivity" /> + + + - - - - - - - - - - - - - - - + + + + + @@ -283,6 +103,7 @@ + @@ -297,31 +118,48 @@ - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/assets/colors.json b/app/src/main/assets/colors.json deleted file mode 100644 index feea8cf8f..000000000 --- a/app/src/main/assets/colors.json +++ /dev/null @@ -1,1394 +0,0 @@ -{ - "1C Enterprise": { - "color": "#814CCC", - "url": "https://github.com/trending?l=1C-Enterprise" - }, - "ABAP": { - "color": "#E8274B", - "url": "https://github.com/trending?l=ABAP" - }, - "ActionScript": { - "color": "#882B0F", - "url": "https://github.com/trending?l=ActionScript" - }, - "Ada": { - "color": "#02f88c", - "url": "https://github.com/trending?l=Ada" - }, - "Agda": { - "color": "#315665", - "url": "https://github.com/trending?l=Agda" - }, - "AGS Script": { - "color": "#B9D9FF", - "url": "https://github.com/trending?l=AGS-Script" - }, - "Alloy": { - "color": "#64C800", - "url": "https://github.com/trending?l=Alloy" - }, - "Alpine Abuild": { - "color": null, - "url": "https://github.com/trending?l=Alpine-Abuild" - }, - "AMPL": { - "color": "#E6EFBB", - "url": "https://github.com/trending?l=AMPL" - }, - "ANTLR": { - "color": "#9DC3FF", - "url": "https://github.com/trending?l=ANTLR" - }, - "Apex": { - "color": null, - "url": "https://github.com/trending?l=Apex" - }, - "API Blueprint": { - "color": "#2ACCA8", - "url": "https://github.com/trending?l=API-Blueprint" - }, - "APL": { - "color": "#5A8164", - "url": "https://github.com/trending?l=APL" - }, - "Apollo Guidance Computer": { - "color": null, - "url": "https://github.com/trending?l=Apollo-Guidance-Computer" - }, - "AppleScript": { - "color": "#101F1F", - "url": "https://github.com/trending?l=AppleScript" - }, - "Arc": { - "color": "#aa2afe", - "url": "https://github.com/trending?l=Arc" - }, - "Arduino": { - "color": "#bd79d1", - "url": "https://github.com/trending?l=Arduino" - }, - "ASP": { - "color": "#6a40fd", - "url": "https://github.com/trending?l=ASP" - }, - "AspectJ": { - "color": "#a957b0", - "url": "https://github.com/trending?l=AspectJ" - }, - "Assembly": { - "color": "#6E4C13", - "url": "https://github.com/trending?l=Assembly" - }, - "ATS": { - "color": "#1ac620", - "url": "https://github.com/trending?l=ATS" - }, - "Augeas": { - "color": null, - "url": "https://github.com/trending?l=Augeas" - }, - "AutoHotkey": { - "color": "#6594b9", - "url": "https://github.com/trending?l=AutoHotkey" - }, - "AutoIt": { - "color": "#1C3552", - "url": "https://github.com/trending?l=AutoIt" - }, - "Awk": { - "color": null, - "url": "https://github.com/trending?l=Awk" - }, - "Batchfile": { - "color": "#C1F12E", - "url": "https://github.com/trending?l=Batchfile" - }, - "Befunge": { - "color": null, - "url": "https://github.com/trending?l=Befunge" - }, - "Bison": { - "color": null, - "url": "https://github.com/trending?l=Bison" - }, - "BitBake": { - "color": null, - "url": "https://github.com/trending?l=BitBake" - }, - "BlitzBasic": { - "color": null, - "url": "https://github.com/trending?l=BlitzBasic" - }, - "BlitzMax": { - "color": "#cd6400", - "url": "https://github.com/trending?l=BlitzMax" - }, - "Bluespec": { - "color": null, - "url": "https://github.com/trending?l=Bluespec" - }, - "Boo": { - "color": "#d4bec1", - "url": "https://github.com/trending?l=Boo" - }, - "Brainfuck": { - "color": "#2F2530", - "url": "https://github.com/trending?l=Brainfuck" - }, - "Brightscript": { - "color": null, - "url": "https://github.com/trending?l=Brightscript" - }, - "Bro": { - "color": null, - "url": "https://github.com/trending?l=Bro" - }, - "C": { - "color": "#555555", - "url": "https://github.com/trending?l=C" - }, - "C#": { - "color": "#178600", - "url": "https://github.com/trending?l=C#" - }, - "C++": { - "color": "#f34b7d", - "url": "https://github.com/trending?l=C++" - }, - "C2hs Haskell": { - "color": null, - "url": "https://github.com/trending?l=C2hs-Haskell" - }, - "Cap'n Proto": { - "color": null, - "url": "https://github.com/trending?l=Cap'n-Proto" - }, - "CartoCSS": { - "color": null, - "url": "https://github.com/trending?l=CartoCSS" - }, - "Ceylon": { - "color": null, - "url": "https://github.com/trending?l=Ceylon" - }, - "Chapel": { - "color": "#8dc63f", - "url": "https://github.com/trending?l=Chapel" - }, - "Charity": { - "color": null, - "url": "https://github.com/trending?l=Charity" - }, - "ChucK": { - "color": null, - "url": "https://github.com/trending?l=ChucK" - }, - "Cirru": { - "color": "#ccccff", - "url": "https://github.com/trending?l=Cirru" - }, - "Clarion": { - "color": "#db901e", - "url": "https://github.com/trending?l=Clarion" - }, - "Clean": { - "color": "#3F85AF", - "url": "https://github.com/trending?l=Clean" - }, - "Click": { - "color": "#E4E6F3", - "url": "https://github.com/trending?l=Click" - }, - "CLIPS": { - "color": null, - "url": "https://github.com/trending?l=CLIPS" - }, - "Clojure": { - "color": "#db5855", - "url": "https://github.com/trending?l=Clojure" - }, - "CMake": { - "color": null, - "url": "https://github.com/trending?l=CMake" - }, - "COBOL": { - "color": null, - "url": "https://github.com/trending?l=COBOL" - }, - "CoffeeScript": { - "color": "#244776", - "url": "https://github.com/trending?l=CoffeeScript" - }, - "ColdFusion": { - "color": "#ed2cd6", - "url": "https://github.com/trending?l=ColdFusion" - }, - "ColdFusion CFC": { - "color": null, - "url": "https://github.com/trending?l=ColdFusion-CFC" - }, - "Common Lisp": { - "color": "#3fb68b", - "url": "https://github.com/trending?l=Common-Lisp" - }, - "Component Pascal": { - "color": "#B0CE4E", - "url": "https://github.com/trending?l=Component-Pascal" - }, - "Cool": { - "color": null, - "url": "https://github.com/trending?l=Cool" - }, - "Coq": { - "color": null, - "url": "https://github.com/trending?l=Coq" - }, - "Crystal": { - "color": "#776791", - "url": "https://github.com/trending?l=Crystal" - }, - "Csound": { - "color": null, - "url": "https://github.com/trending?l=Csound" - }, - "Csound Document": { - "color": null, - "url": "https://github.com/trending?l=Csound-Document" - }, - "Csound Score": { - "color": null, - "url": "https://github.com/trending?l=Csound-Score" - }, - "CSS": { - "color": "#563d7c", - "url": "https://github.com/trending?l=CSS" - }, - "Cuda": { - "color": "#3A4E3A", - "url": "https://github.com/trending?l=Cuda" - }, - "Cycript": { - "color": null, - "url": "https://github.com/trending?l=Cycript" - }, - "Cython": { - "color": null, - "url": "https://github.com/trending?l=Cython" - }, - "D": { - "color": "#ba595e", - "url": "https://github.com/trending?l=D" - }, - "Dart": { - "color": "#00B4AB", - "url": "https://github.com/trending?l=Dart" - }, - "DIGITAL Command Language": { - "color": null, - "url": "https://github.com/trending?l=DIGITAL-Command-Language" - }, - "DM": { - "color": "#447265", - "url": "https://github.com/trending?l=DM" - }, - "Dogescript": { - "color": "#cca760", - "url": "https://github.com/trending?l=Dogescript" - }, - "DTrace": { - "color": null, - "url": "https://github.com/trending?l=DTrace" - }, - "Dylan": { - "color": "#6c616e", - "url": "https://github.com/trending?l=Dylan" - }, - "E": { - "color": "#ccce35", - "url": "https://github.com/trending?l=E" - }, - "Eagle": { - "color": "#814C05", - "url": "https://github.com/trending?l=Eagle" - }, - "eC": { - "color": "#913960", - "url": "https://github.com/trending?l=eC" - }, - "ECL": { - "color": "#8a1267", - "url": "https://github.com/trending?l=ECL" - }, - "ECLiPSe": { - "color": null, - "url": "https://github.com/trending?l=ECLiPSe" - }, - "Eiffel": { - "color": "#946d57", - "url": "https://github.com/trending?l=Eiffel" - }, - "Elixir": { - "color": "#6e4a7e", - "url": "https://github.com/trending?l=Elixir" - }, - "Elm": { - "color": "#60B5CC", - "url": "https://github.com/trending?l=Elm" - }, - "Emacs Lisp": { - "color": "#c065db", - "url": "https://github.com/trending?l=Emacs-Lisp" - }, - "EmberScript": { - "color": "#FFF4F3", - "url": "https://github.com/trending?l=EmberScript" - }, - "EQ": { - "color": "#a78649", - "url": "https://github.com/trending?l=EQ" - }, - "Erlang": { - "color": "#B83998", - "url": "https://github.com/trending?l=Erlang" - }, - "F#": { - "color": "#b845fc", - "url": "https://github.com/trending?l=F#" - }, - "Factor": { - "color": "#636746", - "url": "https://github.com/trending?l=Factor" - }, - "Fancy": { - "color": "#7b9db4", - "url": "https://github.com/trending?l=Fancy" - }, - "Fantom": { - "color": "#14253c", - "url": "https://github.com/trending?l=Fantom" - }, - "Filebench WML": { - "color": null, - "url": "https://github.com/trending?l=Filebench-WML" - }, - "Filterscript": { - "color": null, - "url": "https://github.com/trending?l=Filterscript" - }, - "fish": { - "color": null, - "url": "https://github.com/trending?l=fish" - }, - "FLUX": { - "color": "#88ccff", - "url": "https://github.com/trending?l=FLUX" - }, - "Forth": { - "color": "#341708", - "url": "https://github.com/trending?l=Forth" - }, - "Fortran": { - "color": "#4d41b1", - "url": "https://github.com/trending?l=Fortran" - }, - "FreeMarker": { - "color": "#0050b2", - "url": "https://github.com/trending?l=FreeMarker" - }, - "Frege": { - "color": "#00cafe", - "url": "https://github.com/trending?l=Frege" - }, - "Game Maker Language": { - "color": "#8fb200", - "url": "https://github.com/trending?l=Game-Maker-Language" - }, - "GAMS": { - "color": null, - "url": "https://github.com/trending?l=GAMS" - }, - "GAP": { - "color": null, - "url": "https://github.com/trending?l=GAP" - }, - "GCC Machine Description": { - "color": null, - "url": "https://github.com/trending?l=GCC-Machine-Description" - }, - "GDB": { - "color": null, - "url": "https://github.com/trending?l=GDB" - }, - "GDScript": { - "color": null, - "url": "https://github.com/trending?l=GDScript" - }, - "Genie": { - "color": "#fb855d", - "url": "https://github.com/trending?l=Genie" - }, - "Genshi": { - "color": null, - "url": "https://github.com/trending?l=Genshi" - }, - "Gentoo Ebuild": { - "color": null, - "url": "https://github.com/trending?l=Gentoo-Ebuild" - }, - "Gentoo Eclass": { - "color": null, - "url": "https://github.com/trending?l=Gentoo-Eclass" - }, - "Gherkin": { - "color": "#5B2063", - "url": "https://github.com/trending?l=Gherkin" - }, - "GLSL": { - "color": null, - "url": "https://github.com/trending?l=GLSL" - }, - "Glyph": { - "color": "#e4cc98", - "url": "https://github.com/trending?l=Glyph" - }, - "Gnuplot": { - "color": "#f0a9f0", - "url": "https://github.com/trending?l=Gnuplot" - }, - "Go": { - "color": "#375eab", - "url": "https://github.com/trending?l=Go" - }, - "Golo": { - "color": "#88562A", - "url": "https://github.com/trending?l=Golo" - }, - "Gosu": { - "color": "#82937f", - "url": "https://github.com/trending?l=Gosu" - }, - "Grace": { - "color": null, - "url": "https://github.com/trending?l=Grace" - }, - "Grammatical Framework": { - "color": "#79aa7a", - "url": "https://github.com/trending?l=Grammatical-Framework" - }, - "Groovy": { - "color": "#e69f56", - "url": "https://github.com/trending?l=Groovy" - }, - "Groovy Server Pages": { - "color": null, - "url": "https://github.com/trending?l=Groovy-Server-Pages" - }, - "Hack": { - "color": "#878787", - "url": "https://github.com/trending?l=Hack" - }, - "Harbour": { - "color": "#0e60e3", - "url": "https://github.com/trending?l=Harbour" - }, - "Haskell": { - "color": "#5e5086", - "url": "https://github.com/trending?l=Haskell" - }, - "Haxe": { - "color": "#df7900", - "url": "https://github.com/trending?l=Haxe" - }, - "HCL": { - "color": null, - "url": "https://github.com/trending?l=HCL" - }, - "HLSL": { - "color": null, - "url": "https://github.com/trending?l=HLSL" - }, - "HTML": { - "color": "#e34c26", - "url": "https://github.com/trending?l=HTML" - }, - "Hy": { - "color": "#7790B2", - "url": "https://github.com/trending?l=Hy" - }, - "HyPhy": { - "color": null, - "url": "https://github.com/trending?l=HyPhy" - }, - "IDL": { - "color": "#a3522f", - "url": "https://github.com/trending?l=IDL" - }, - "Idris": { - "color": null, - "url": "https://github.com/trending?l=Idris" - }, - "IGOR Pro": { - "color": null, - "url": "https://github.com/trending?l=IGOR-Pro" - }, - "Inform 7": { - "color": null, - "url": "https://github.com/trending?l=Inform-7" - }, - "Inno Setup": { - "color": null, - "url": "https://github.com/trending?l=Inno-Setup" - }, - "Io": { - "color": "#a9188d", - "url": "https://github.com/trending?l=Io" - }, - "Ioke": { - "color": "#078193", - "url": "https://github.com/trending?l=Ioke" - }, - "Isabelle": { - "color": "#FEFE00", - "url": "https://github.com/trending?l=Isabelle" - }, - "Isabelle ROOT": { - "color": null, - "url": "https://github.com/trending?l=Isabelle-ROOT" - }, - "J": { - "color": "#9EEDFF", - "url": "https://github.com/trending?l=J" - }, - "Jasmin": { - "color": null, - "url": "https://github.com/trending?l=Jasmin" - }, - "Java": { - "color": "#b07219", - "url": "https://github.com/trending?l=Java" - }, - "Java Server Pages": { - "color": null, - "url": "https://github.com/trending?l=Java-Server-Pages" - }, - "JavaScript": { - "color": "#f1e05a", - "url": "https://github.com/trending?l=JavaScript" - }, - "JFlex": { - "color": null, - "url": "https://github.com/trending?l=JFlex" - }, - "Jison": { - "color": null, - "url": "https://github.com/trending?l=Jison" - }, - "Jison Lex": { - "color": null, - "url": "https://github.com/trending?l=Jison-Lex" - }, - "Jolie": { - "color": "#843179", - "url": "https://github.com/trending?l=Jolie" - }, - "JSONiq": { - "color": "#40d47e", - "url": "https://github.com/trending?l=JSONiq" - }, - "JSX": { - "color": null, - "url": "https://github.com/trending?l=JSX" - }, - "Julia": { - "color": "#a270ba", - "url": "https://github.com/trending?l=Julia" - }, - "Jupyter Notebook": { - "color": "#DA5B0B", - "url": "https://github.com/trending?l=Jupyter-Notebook" - }, - "KiCad": { - "color": null, - "url": "https://github.com/trending?l=KiCad" - }, - "Kotlin": { - "color": "#F18E33", - "url": "https://github.com/trending?l=Kotlin" - }, - "KRL": { - "color": "#28431f", - "url": "https://github.com/trending?l=KRL" - }, - "LabVIEW": { - "color": null, - "url": "https://github.com/trending?l=LabVIEW" - }, - "Lasso": { - "color": "#999999", - "url": "https://github.com/trending?l=Lasso" - }, - "Lean": { - "color": null, - "url": "https://github.com/trending?l=Lean" - }, - "Lex": { - "color": "#DBCA00", - "url": "https://github.com/trending?l=Lex" - }, - "LFE": { - "color": null, - "url": "https://github.com/trending?l=LFE" - }, - "LilyPond": { - "color": null, - "url": "https://github.com/trending?l=LilyPond" - }, - "Limbo": { - "color": null, - "url": "https://github.com/trending?l=Limbo" - }, - "Literate Agda": { - "color": null, - "url": "https://github.com/trending?l=Literate-Agda" - }, - "Literate CoffeeScript": { - "color": null, - "url": "https://github.com/trending?l=Literate-CoffeeScript" - }, - "Literate Haskell": { - "color": null, - "url": "https://github.com/trending?l=Literate-Haskell" - }, - "LiveScript": { - "color": "#499886", - "url": "https://github.com/trending?l=LiveScript" - }, - "LLVM": { - "color": "#185619", - "url": "https://github.com/trending?l=LLVM" - }, - "Logos": { - "color": null, - "url": "https://github.com/trending?l=Logos" - }, - "Logtalk": { - "color": null, - "url": "https://github.com/trending?l=Logtalk" - }, - "LOLCODE": { - "color": "#cc9900", - "url": "https://github.com/trending?l=LOLCODE" - }, - "LookML": { - "color": "#652B81", - "url": "https://github.com/trending?l=LookML" - }, - "LoomScript": { - "color": null, - "url": "https://github.com/trending?l=LoomScript" - }, - "LSL": { - "color": "#3d9970", - "url": "https://github.com/trending?l=LSL" - }, - "Lua": { - "color": "#000080", - "url": "https://github.com/trending?l=Lua" - }, - "M": { - "color": null, - "url": "https://github.com/trending?l=M" - }, - "M4": { - "color": null, - "url": "https://github.com/trending?l=M4" - }, - "M4Sugar": { - "color": null, - "url": "https://github.com/trending?l=M4Sugar" - }, - "Makefile": { - "color": "#427819", - "url": "https://github.com/trending?l=Makefile" - }, - "Mako": { - "color": null, - "url": "https://github.com/trending?l=Mako" - }, - "Mask": { - "color": "#f97732", - "url": "https://github.com/trending?l=Mask" - }, - "Mathematica": { - "color": null, - "url": "https://github.com/trending?l=Mathematica" - }, - "Matlab": { - "color": "#bb92ac", - "url": "https://github.com/trending?l=Matlab" - }, - "Max": { - "color": "#c4a79c", - "url": "https://github.com/trending?l=Max" - }, - "MAXScript": { - "color": "#00a6a6", - "url": "https://github.com/trending?l=MAXScript" - }, - "Mercury": { - "color": "#ff2b2b", - "url": "https://github.com/trending?l=Mercury" - }, - "Meson": { - "color": "#007800", - "url": "https://github.com/trending?l=Meson" - }, - "Metal": { - "color": "#8f14e9", - "url": "https://github.com/trending?l=Metal" - }, - "MiniD": { - "color": null, - "url": "https://github.com/trending?l=MiniD" - }, - "Mirah": { - "color": "#c7a938", - "url": "https://github.com/trending?l=Mirah" - }, - "Modelica": { - "color": null, - "url": "https://github.com/trending?l=Modelica" - }, - "Modula-2": { - "color": null, - "url": "https://github.com/trending?l=Modula-2" - }, - "Module Management System": { - "color": null, - "url": "https://github.com/trending?l=Module-Management-System" - }, - "Monkey": { - "color": null, - "url": "https://github.com/trending?l=Monkey" - }, - "Moocode": { - "color": null, - "url": "https://github.com/trending?l=Moocode" - }, - "MoonScript": { - "color": null, - "url": "https://github.com/trending?l=MoonScript" - }, - "MQL4": { - "color": "#62A8D6", - "url": "https://github.com/trending?l=MQL4" - }, - "MQL5": { - "color": "#4A76B8", - "url": "https://github.com/trending?l=MQL5" - }, - "MTML": { - "color": "#b7e1f4", - "url": "https://github.com/trending?l=MTML" - }, - "MUF": { - "color": null, - "url": "https://github.com/trending?l=MUF" - }, - "mupad": { - "color": null, - "url": "https://github.com/trending?l=mupad" - }, - "Myghty": { - "color": null, - "url": "https://github.com/trending?l=Myghty" - }, - "NCL": { - "color": "#28431f", - "url": "https://github.com/trending?l=NCL" - }, - "Nemerle": { - "color": "#3d3c6e", - "url": "https://github.com/trending?l=Nemerle" - }, - "nesC": { - "color": "#94B0C7", - "url": "https://github.com/trending?l=nesC" - }, - "NetLinx": { - "color": "#0aa0ff", - "url": "https://github.com/trending?l=NetLinx" - }, - "NetLinx+ERB": { - "color": "#747faa", - "url": "https://github.com/trending?l=NetLinx+ERB" - }, - "NetLogo": { - "color": "#ff6375", - "url": "https://github.com/trending?l=NetLogo" - }, - "NewLisp": { - "color": "#87AED7", - "url": "https://github.com/trending?l=NewLisp" - }, - "Nginx": { - "color": "#9469E9", - "url": "https://github.com/trending?l=Nginx" - }, - "Nim": { - "color": "#37775b", - "url": "https://github.com/trending?l=Nim" - }, - "Nit": { - "color": "#009917", - "url": "https://github.com/trending?l=Nit" - }, - "Nix": { - "color": "#7e7eff", - "url": "https://github.com/trending?l=Nix" - }, - "NSIS": { - "color": null, - "url": "https://github.com/trending?l=NSIS" - }, - "Nu": { - "color": "#c9df40", - "url": "https://github.com/trending?l=Nu" - }, - "NumPy": { - "color": null, - "url": "https://github.com/trending?l=NumPy" - }, - "Objective-C": { - "color": "#438eff", - "url": "https://github.com/trending?l=Objective-C" - }, - "Objective-C++": { - "color": "#6866fb", - "url": "https://github.com/trending?l=Objective-C++" - }, - "Objective-J": { - "color": "#ff0c5a", - "url": "https://github.com/trending?l=Objective-J" - }, - "OCaml": { - "color": "#3be133", - "url": "https://github.com/trending?l=OCaml" - }, - "Omgrofl": { - "color": "#cabbff", - "url": "https://github.com/trending?l=Omgrofl" - }, - "ooc": { - "color": "#b0b77e", - "url": "https://github.com/trending?l=ooc" - }, - "Opa": { - "color": null, - "url": "https://github.com/trending?l=Opa" - }, - "Opal": { - "color": "#f7ede0", - "url": "https://github.com/trending?l=Opal" - }, - "OpenCL": { - "color": null, - "url": "https://github.com/trending?l=OpenCL" - }, - "OpenEdge ABL": { - "color": null, - "url": "https://github.com/trending?l=OpenEdge-ABL" - }, - "OpenRC runscript": { - "color": null, - "url": "https://github.com/trending?l=OpenRC-runscript" - }, - "OpenSCAD": { - "color": null, - "url": "https://github.com/trending?l=OpenSCAD" - }, - "Ox": { - "color": null, - "url": "https://github.com/trending?l=Ox" - }, - "Oxygene": { - "color": "#cdd0e3", - "url": "https://github.com/trending?l=Oxygene" - }, - "Oz": { - "color": "#fab738", - "url": "https://github.com/trending?l=Oz" - }, - "P4": { - "color": "#7055b5", - "url": "https://github.com/trending?l=P4" - }, - "Pan": { - "color": "#cc0000", - "url": "https://github.com/trending?l=Pan" - }, - "Papyrus": { - "color": "#6600cc", - "url": "https://github.com/trending?l=Papyrus" - }, - "Parrot": { - "color": "#f3ca0a", - "url": "https://github.com/trending?l=Parrot" - }, - "Parrot Assembly": { - "color": null, - "url": "https://github.com/trending?l=Parrot-Assembly" - }, - "Parrot Internal Representation": { - "color": null, - "url": "https://github.com/trending?l=Parrot-Internal-Representation" - }, - "Pascal": { - "color": "#E3F171", - "url": "https://github.com/trending?l=Pascal" - }, - "PAWN": { - "color": "#dbb284", - "url": "https://github.com/trending?l=PAWN" - }, - "Perl": { - "color": "#0298c3", - "url": "https://github.com/trending?l=Perl" - }, - "Perl6": { - "color": "#0000fb", - "url": "https://github.com/trending?l=Perl6" - }, - "PHP": { - "color": "#4F5D95", - "url": "https://github.com/trending?l=PHP" - }, - "PicoLisp": { - "color": null, - "url": "https://github.com/trending?l=PicoLisp" - }, - "PigLatin": { - "color": "#fcd7de", - "url": "https://github.com/trending?l=PigLatin" - }, - "Pike": { - "color": "#005390", - "url": "https://github.com/trending?l=Pike" - }, - "PLpgSQL": { - "color": null, - "url": "https://github.com/trending?l=PLpgSQL" - }, - "PLSQL": { - "color": "#dad8d8", - "url": "https://github.com/trending?l=PLSQL" - }, - "PogoScript": { - "color": "#d80074", - "url": "https://github.com/trending?l=PogoScript" - }, - "Pony": { - "color": null, - "url": "https://github.com/trending?l=Pony" - }, - "PostScript": { - "color": "#da291c", - "url": "https://github.com/trending?l=PostScript" - }, - "POV-Ray SDL": { - "color": null, - "url": "https://github.com/trending?l=POV-Ray-SDL" - }, - "PowerBuilder": { - "color": "#8f0f8d", - "url": "https://github.com/trending?l=PowerBuilder" - }, - "PowerShell": { - "color": "#012456", - "url": "https://github.com/trending?l=PowerShell" - }, - "Processing": { - "color": "#0096D8", - "url": "https://github.com/trending?l=Processing" - }, - "Prolog": { - "color": "#74283c", - "url": "https://github.com/trending?l=Prolog" - }, - "Propeller Spin": { - "color": "#7fa2a7", - "url": "https://github.com/trending?l=Propeller-Spin" - }, - "Puppet": { - "color": "#302B6D", - "url": "https://github.com/trending?l=Puppet" - }, - "Pure Data": { - "color": "#91de79", - "url": "https://github.com/trending?l=Pure-Data" - }, - "PureBasic": { - "color": "#5a6986", - "url": "https://github.com/trending?l=PureBasic" - }, - "PureScript": { - "color": "#1D222D", - "url": "https://github.com/trending?l=PureScript" - }, - "Python": { - "color": "#3572A5", - "url": "https://github.com/trending?l=Python" - }, - "Python console": { - "color": null, - "url": "https://github.com/trending?l=Python-console" - }, - "QMake": { - "color": null, - "url": "https://github.com/trending?l=QMake" - }, - "QML": { - "color": "#44a51c", - "url": "https://github.com/trending?l=QML" - }, - "R": { - "color": "#198CE7", - "url": "https://github.com/trending?l=R" - }, - "Racket": { - "color": "#22228f", - "url": "https://github.com/trending?l=Racket" - }, - "Ragel": { - "color": "#9d5200", - "url": "https://github.com/trending?l=Ragel" - }, - "RAML": { - "color": "#77d9fb", - "url": "https://github.com/trending?l=RAML" - }, - "Rascal": { - "color": "#fffaa0", - "url": "https://github.com/trending?l=Rascal" - }, - "REALbasic": { - "color": null, - "url": "https://github.com/trending?l=REALbasic" - }, - "Reason": { - "color": null, - "url": "https://github.com/trending?l=Reason" - }, - "Rebol": { - "color": "#358a5b", - "url": "https://github.com/trending?l=Rebol" - }, - "Red": { - "color": "#f50000", - "url": "https://github.com/trending?l=Red" - }, - "Redcode": { - "color": null, - "url": "https://github.com/trending?l=Redcode" - }, - "Ren'Py": { - "color": "#ff7f7f", - "url": "https://github.com/trending?l=Ren'Py" - }, - "RenderScript": { - "color": null, - "url": "https://github.com/trending?l=RenderScript" - }, - "REXX": { - "color": null, - "url": "https://github.com/trending?l=REXX" - }, - "RobotFramework": { - "color": null, - "url": "https://github.com/trending?l=RobotFramework" - }, - "Roff": { - "color": "#ecdebe", - "url": "https://github.com/trending?l=Roff" - }, - "Rouge": { - "color": "#cc0088", - "url": "https://github.com/trending?l=Rouge" - }, - "Ruby": { - "color": "#701516", - "url": "https://github.com/trending?l=Ruby" - }, - "RUNOFF": { - "color": "#665a4e", - "url": "https://github.com/trending?l=RUNOFF" - }, - "Rust": { - "color": "#dea584", - "url": "https://github.com/trending?l=Rust" - }, - "Sage": { - "color": null, - "url": "https://github.com/trending?l=Sage" - }, - "SaltStack": { - "color": "#646464", - "url": "https://github.com/trending?l=SaltStack" - }, - "SAS": { - "color": "#B34936", - "url": "https://github.com/trending?l=SAS" - }, - "Scala": { - "color": "#c22d40", - "url": "https://github.com/trending?l=Scala" - }, - "Scheme": { - "color": "#1e4aec", - "url": "https://github.com/trending?l=Scheme" - }, - "Scilab": { - "color": null, - "url": "https://github.com/trending?l=Scilab" - }, - "Self": { - "color": "#0579aa", - "url": "https://github.com/trending?l=Self" - }, - "ShaderLab": { - "color": null, - "url": "https://github.com/trending?l=ShaderLab" - }, - "Shell": { - "color": "#89e051", - "url": "https://github.com/trending?l=Shell" - }, - "ShellSession": { - "color": null, - "url": "https://github.com/trending?l=ShellSession" - }, - "Shen": { - "color": "#120F14", - "url": "https://github.com/trending?l=Shen" - }, - "Slash": { - "color": "#007eff", - "url": "https://github.com/trending?l=Slash" - }, - "Smali": { - "color": null, - "url": "https://github.com/trending?l=Smali" - }, - "Smalltalk": { - "color": "#596706", - "url": "https://github.com/trending?l=Smalltalk" - }, - "Smarty": { - "color": null, - "url": "https://github.com/trending?l=Smarty" - }, - "SMT": { - "color": null, - "url": "https://github.com/trending?l=SMT" - }, - "SourcePawn": { - "color": "#5c7611", - "url": "https://github.com/trending?l=SourcePawn" - }, - "SQF": { - "color": "#3F3F3F", - "url": "https://github.com/trending?l=SQF" - }, - "SQLPL": { - "color": null, - "url": "https://github.com/trending?l=SQLPL" - }, - "Squirrel": { - "color": "#800000", - "url": "https://github.com/trending?l=Squirrel" - }, - "SRecode Template": { - "color": "#348a34", - "url": "https://github.com/trending?l=SRecode-Template" - }, - "Stan": { - "color": "#b2011d", - "url": "https://github.com/trending?l=Stan" - }, - "Standard ML": { - "color": "#dc566d", - "url": "https://github.com/trending?l=Standard-ML" - }, - "Stata": { - "color": null, - "url": "https://github.com/trending?l=Stata" - }, - "SuperCollider": { - "color": "#46390b", - "url": "https://github.com/trending?l=SuperCollider" - }, - "Swift": { - "color": "#ffac45", - "url": "https://github.com/trending?l=Swift" - }, - "SystemVerilog": { - "color": "#DAE1C2", - "url": "https://github.com/trending?l=SystemVerilog" - }, - "Tcl": { - "color": "#e4cc98", - "url": "https://github.com/trending?l=Tcl" - }, - "Tcsh": { - "color": null, - "url": "https://github.com/trending?l=Tcsh" - }, - "Terra": { - "color": "#00004c", - "url": "https://github.com/trending?l=Terra" - }, - "TeX": { - "color": "#3D6117", - "url": "https://github.com/trending?l=TeX" - }, - "Thrift": { - "color": null, - "url": "https://github.com/trending?l=Thrift" - }, - "TI Program": { - "color": "#A0AA87", - "url": "https://github.com/trending?l=TI-Program" - }, - "TLA": { - "color": null, - "url": "https://github.com/trending?l=TLA" - }, - "Turing": { - "color": "#cf142b", - "url": "https://github.com/trending?l=Turing" - }, - "TXL": { - "color": null, - "url": "https://github.com/trending?l=TXL" - }, - "TypeScript": { - "color": "#2b7489", - "url": "https://github.com/trending?l=TypeScript" - }, - "Unified Parallel C": { - "color": null, - "url": "https://github.com/trending?l=Unified-Parallel-C" - }, - "Unix Assembly": { - "color": null, - "url": "https://github.com/trending?l=Unix-Assembly" - }, - "Uno": { - "color": null, - "url": "https://github.com/trending?l=Uno" - }, - "UnrealScript": { - "color": "#a54c4d", - "url": "https://github.com/trending?l=UnrealScript" - }, - "UrWeb": { - "color": null, - "url": "https://github.com/trending?l=UrWeb" - }, - "Vala": { - "color": "#fbe5cd", - "url": "https://github.com/trending?l=Vala" - }, - "VCL": { - "color": null, - "url": "https://github.com/trending?l=VCL" - }, - "Verilog": { - "color": "#b2b7f8", - "url": "https://github.com/trending?l=Verilog" - }, - "VHDL": { - "color": "#adb2cb", - "url": "https://github.com/trending?l=VHDL" - }, - "Vim script": { - "color": "#199f4b", - "url": "https://github.com/trending?l=Vim-script" - }, - "Visual Basic": { - "color": "#945db7", - "url": "https://github.com/trending?l=Visual-Basic" - }, - "Volt": { - "color": "#1F1F1F", - "url": "https://github.com/trending?l=Volt" - }, - "Vue": { - "color": "#2c3e50", - "url": "https://github.com/trending?l=Vue" - }, - "Web Ontology Language": { - "color": "#9cc9dd", - "url": "https://github.com/trending?l=Web-Ontology-Language" - }, - "WebIDL": { - "color": null, - "url": "https://github.com/trending?l=WebIDL" - }, - "wisp": { - "color": "#7582D1", - "url": "https://github.com/trending?l=wisp" - }, - "X10": { - "color": "#4B6BEF", - "url": "https://github.com/trending?l=X10" - }, - "xBase": { - "color": "#403a40", - "url": "https://github.com/trending?l=xBase" - }, - "XC": { - "color": "#99DA07", - "url": "https://github.com/trending?l=XC" - }, - "Xojo": { - "color": null, - "url": "https://github.com/trending?l=Xojo" - }, - "XPages": { - "color": null, - "url": "https://github.com/trending?l=XPages" - }, - "XProc": { - "color": null, - "url": "https://github.com/trending?l=XProc" - }, - "XQuery": { - "color": "#5232e7", - "url": "https://github.com/trending?l=XQuery" - }, - "XS": { - "color": null, - "url": "https://github.com/trending?l=XS" - }, - "XSLT": { - "color": "#EB8CEB", - "url": "https://github.com/trending?l=XSLT" - }, - "Xtend": { - "color": null, - "url": "https://github.com/trending?l=Xtend" - }, - "Yacc": { - "color": "#4B6C4B", - "url": "https://github.com/trending?l=Yacc" - }, - "Zephir": { - "color": "#118f9e", - "url": "https://github.com/trending?l=Zephir" - }, - "Zimpl": { - "color": null, - "url": "https://github.com/trending?l=Zimpl" - } -} diff --git a/app/src/main/assets/fonts/app_font.ttf b/app/src/main/assets/fonts/app_font.ttf deleted file mode 100644 index 8c082c8de..000000000 Binary files a/app/src/main/assets/fonts/app_font.ttf and /dev/null differ diff --git a/app/src/main/assets/highlight/js/prettify.js b/app/src/main/assets/highlight/js/prettify.js deleted file mode 100644 index d9ae44f07..000000000 --- a/app/src/main/assets/highlight/js/prettify.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! highlight.js v9.10.0 | BSD3 License | git.io/hljslicense */ -!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/[&<>]/gm,function(e){return j[e]})}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0===t.index}function a(e){return k.test(e)}function i(e){var n,t,r,i,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",t=B.exec(o))return w(t[1])?t[1]:"no-highlight";for(o=o.split(/\s+/),n=0,r=o.length;r>n;n++)if(i=o[n],a(i)||w(i))return i}function o(e){var n,t={},r=Array.prototype.slice.call(arguments,1);for(n in e)t[n]=e[n];return r.forEach(function(e){for(n in e)t[n]=e[n]}),t}function u(e){var n=[];return function r(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3===i.nodeType?a+=i.nodeValue.length:1===i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=r(i,a),t(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n}function c(e,r,a){function i(){return e.length&&r.length?e[0].offset!==r[0].offset?e[0].offset"}function u(e){l+=""}function c(e){("start"===e.event?o:u)(e.node)}for(var s=0,l="",f=[];e.length||r.length;){var g=i();if(l+=n(a.substring(s,g[0].offset)),s=g[0].offset,g===e){f.reverse().forEach(u);do c(g.splice(0,1)[0]),g=i();while(g===e&&g.length&&g[0].offset===s);f.reverse().forEach(o)}else"start"===g[0].event?f.push(g[0].node):f.pop(),c(g.splice(0,1)[0])}return l+n(a.substr(s))}function s(e){return e.v&&!e.cached_variants&&(e.cached_variants=e.v.map(function(n){return o(e,{v:null},n)})),e.cached_variants||e.eW&&[o(e)]||[e]}function l(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(a,i){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var o={},u=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");o[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof a.k?u("keyword",a.k):x(a.k).forEach(function(e){u(e,a.k[e])}),a.k=o}a.lR=t(a.l||/\w+/,!0),i&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=t(a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=t(a.e)),a.tE=n(a.e)||"",a.eW&&i.tE&&(a.tE+=(a.e?"|":"")+i.tE)),a.i&&(a.iR=t(a.i)),null==a.r&&(a.r=1),a.c||(a.c=[]),a.c=Array.prototype.concat.apply([],a.c.map(function(e){return s("self"===e?a:e)})),a.c.forEach(function(e){r(e,a)}),a.starts&&r(a.starts,i);var c=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(n).filter(Boolean);a.t=c.length?t(c.join("|"),!0):{exec:function(){return null}}}}r(e)}function f(e,t,a,i){function o(e,n){var t,a;for(t=0,a=n.c.length;a>t;t++)if(r(n.c[t].bR,e))return n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function c(e,n){return!a&&r(n.iR,e)}function s(e,n){var t=N.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function p(e,n,t,r){var a=r?"":I.classPrefix,i='',i+n+o}function h(){var e,t,r,a;if(!E.k)return n(k);for(a="",t=0,E.lR.lastIndex=0,r=E.lR.exec(k);r;)a+=n(k.substring(t,r.index)),e=s(E,r),e?(B+=e[1],a+=p(e[0],n(r[0]))):a+=n(r[0]),t=E.lR.lastIndex,r=E.lR.exec(k);return a+n(k.substr(t))}function d(){var e="string"==typeof E.sL;if(e&&!L[E.sL])return n(k);var t=e?f(E.sL,k,!0,x[E.sL]):g(k,E.sL.length?E.sL:void 0);return E.r>0&&(B+=t.r),e&&(x[E.sL]=t.top),p(t.language,t.value,!1,!0)}function b(){y+=null!=E.sL?d():h(),k=""}function v(e){y+=e.cN?p(e.cN,"",!0):"",E=Object.create(e,{parent:{value:E}})}function m(e,n){if(k+=e,null==n)return b(),0;var t=o(n,E);if(t)return t.skip?k+=n:(t.eB&&(k+=n),b(),t.rB||t.eB||(k=n)),v(t,n),t.rB?0:n.length;var r=u(E,n);if(r){var a=E;a.skip?k+=n:(a.rE||a.eE||(k+=n),b(),a.eE&&(k=n));do E.cN&&(y+=C),E.skip||(B+=E.r),E=E.parent;while(E!==r.parent);return r.starts&&v(r.starts,""),a.rE?0:n.length}if(c(n,E))throw new Error('Illegal lexeme "'+n+'" for mode "'+(E.cN||"")+'"');return k+=n,n.length||1}var N=w(e);if(!N)throw new Error('Unknown language: "'+e+'"');l(N);var R,E=i||N,x={},y="";for(R=E;R!==N;R=R.parent)R.cN&&(y=p(R.cN,"",!0)+y);var k="",B=0;try{for(var M,j,O=0;;){if(E.t.lastIndex=O,M=E.t.exec(t),!M)break;j=m(t.substring(O,M.index),M[0]),O=M.index+j}for(m(t.substr(O)),R=E;R.parent;R=R.parent)R.cN&&(y+=C);return{r:B,value:y,language:e,top:E}}catch(T){if(T.message&&-1!==T.message.indexOf("Illegal"))return{r:0,value:n(t)};throw T}}function g(e,t){t=t||I.languages||x(L);var r={r:0,value:n(e)},a=r;return t.filter(w).forEach(function(n){var t=f(n,e,!1);t.language=n,t.r>a.r&&(a=t),t.r>r.r&&(a=r,r=t)}),a.language&&(r.second_best=a),r}function p(e){return I.tabReplace||I.useBR?e.replace(M,function(e,n){return I.useBR&&"\n"===e?"
":I.tabReplace?n.replace(/\t/g,I.tabReplace):""}):e}function h(e,n,t){var r=n?y[n]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(r)&&a.push(r),a.join(" ").trim()}function d(e){var n,t,r,o,s,l=i(e);a(l)||(I.useBR?(n=document.createElementNS("http://www.w3.org/1999/xhtml","div"),n.innerHTML=e.innerHTML.replace(/\n/g,"").replace(//g,"\n")):n=e,s=n.textContent,r=l?f(l,s,!0):g(s),t=u(n),t.length&&(o=document.createElementNS("http://www.w3.org/1999/xhtml","div"),o.innerHTML=r.value,r.value=c(t,u(o),s)),r.value=p(r.value),e.innerHTML=r.value,e.className=h(e.className,l,r.language),e.result={language:r.language,re:r.r},r.second_best&&(e.second_best={language:r.second_best.language,re:r.second_best.r}))}function b(e){I=o(I,e)}function v(){if(!v.called){v.called=!0;var e=document.querySelectorAll("pre code");E.forEach.call(e,d)}}function m(){addEventListener("DOMContentLoaded",v,!1),addEventListener("load",v,!1)}function N(n,t){var r=L[n]=t(e);r.aliases&&r.aliases.forEach(function(e){y[e]=n})}function R(){return x(L)}function w(e){return e=(e||"").toLowerCase(),L[e]||L[y[e]]}var E=[],x=Object.keys,L={},y={},k=/^(no-?highlight|plain|text)$/i,B=/\blang(?:uage)?-([\w-]+)\b/i,M=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,C="
",I={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},j={"&":"&","<":"<",">":">"};return e.highlight=f,e.highlightAuto=g,e.fixMarkup=p,e.highlightBlock=d,e.configure=b,e.initHighlighting=v,e.initHighlightingOnLoad=m,e.registerLanguage=N,e.listLanguages=R,e.getLanguage=w,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(n,t,r){var a=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return a.c.push(e.PWM),a.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),a},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("avrasm",function(r){return{cI:!0,l:"\\.?"+r.IR,k:{keyword:"adc add adiw and andi asr bclr bld brbc brbs brcc brcs break breq brge brhc brhs brid brie brlo brlt brmi brne brpl brsh brtc brts brvc brvs bset bst call cbi cbr clc clh cli cln clr cls clt clv clz com cp cpc cpi cpse dec eicall eijmp elpm eor fmul fmuls fmulsu icall ijmp in inc jmp ld ldd ldi lds lpm lsl lsr mov movw mul muls mulsu neg nop or ori out pop push rcall ret reti rjmp rol ror sbc sbr sbrc sbrs sec seh sbi sbci sbic sbis sbiw sei sen ser ses set sev sez sleep spm st std sts sub subi swap tst wdr",built_in:"r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31 x|0 xh xl y|0 yh yl z|0 zh zl ucsr1c udr1 ucsr1a ucsr1b ubrr1l ubrr1h ucsr0c ubrr0h tccr3c tccr3a tccr3b tcnt3h tcnt3l ocr3ah ocr3al ocr3bh ocr3bl ocr3ch ocr3cl icr3h icr3l etimsk etifr tccr1c ocr1ch ocr1cl twcr twdr twar twsr twbr osccal xmcra xmcrb eicra spmcsr spmcr portg ddrg ping portf ddrf sreg sph spl xdiv rampz eicrb eimsk gimsk gicr eifr gifr timsk tifr mcucr mcucsr tccr0 tcnt0 ocr0 assr tccr1a tccr1b tcnt1h tcnt1l ocr1ah ocr1al ocr1bh ocr1bl icr1h icr1l tccr2 tcnt2 ocr2 ocdr wdtcr sfior eearh eearl eedr eecr porta ddra pina portb ddrb pinb portc ddrc pinc portd ddrd pind spdr spsr spcr udr0 ucsr0a ucsr0b ubrr0l acsr admux adcsr adch adcl porte ddre pine pinf",meta:".byte .cseg .db .def .device .dseg .dw .endmacro .equ .eseg .exit .include .list .listmac .macro .nolist .org .set"},c:[r.CBCM,r.C(";","$",{r:0}),r.CNM,r.BNM,{cN:"number",b:"\\b(\\$[a-zA-Z0-9]+|0o[0-7]+)"},r.QSM,{cN:"string",b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"},{cN:"symbol",b:"^[A-Za-z0-9_.$]+:"},{cN:"meta",b:"#",e:"$"},{cN:"subst",b:"@[0-9]+"}]}});hljs.registerLanguage("xml",function(s){var e="[A-Za-z0-9\\._:-]+",t={eW:!0,i:/`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},s.C("",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0}]},{cN:"tag",b:"|$)",e:">",k:{name:"style"},c:[t],starts:{e:"",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"|$)",e:">",k:{name:"script"},c:[t],starts:{e:"",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"",c:[{cN:"name",b:/[^\/><\s]+/,r:0},t]}]}});hljs.registerLanguage("vbscript",function(e){return{aliases:["vbs"],cI:!0,k:{keyword:"call class const dim do loop erase execute executeglobal exit for each next function if then else on error option explicit new private property let get public randomize redim rem select case set stop sub while wend with end to elseif is or xor and not class_initialize class_terminate default preserve in me byval byref step resume goto",built_in:"lcase month vartype instrrev ubound setlocale getobject rgb getref string weekdayname rnd dateadd monthname now day minute isarray cbool round formatcurrency conversions csng timevalue second year space abs clng timeserial fixs len asc isempty maths dateserial atn timer isobject filter weekday datevalue ccur isdate instr datediff formatdatetime replace isnull right sgn array snumeric log cdbl hex chr lbound msgbox ucase getlocale cos cdate cbyte rtrim join hour oct typename trim strcomp int createobject loadpicture tan formatnumber mid scriptenginebuildversion scriptengine split scriptengineminorversion cint sin datepart ltrim sqr scriptenginemajorversion time derived eval date formatpercent exp inputbox left ascw chrw regexp server response request cstr err",literal:"true false null nothing empty"},i:"//",c:[e.inherit(e.QSM,{c:[{b:'""'}]}),e.C(/'/,/$/,{r:0}),e.CNM]}});hljs.registerLanguage("vbscript-html",function(r){return{sL:"xml",c:[{b:"<%",e:"%>",sL:"vbscript"}]}});hljs.registerLanguage("aspectj",function(e){var t="false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else extends implements break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws privileged aspectOf adviceexecution proceed cflowbelow cflow initialization preinitialization staticinitialization withincode target within execution getWithinTypeName handler thisJoinPoint thisJoinPointStaticPart thisEnclosingJoinPointStaticPart declare parents warning error soft precedence thisAspectInstance",i="get set args call";return{k:t,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"aspect",e:/[{;=]/,eE:!0,i:/[:;"\[\]]/,c:[{bK:"extends implements pertypewithin perthis pertarget percflowbelow percflow issingleton"},e.UTM,{b:/\([^\)]*/,e:/[)]+/,k:t+" "+i,eE:!1}]},{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,r:0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"pointcut after before around throwing returning",e:/[)]/,eE:!1,i:/["\[\]]/,c:[{b:e.UIR+"\\s*\\(",rB:!0,c:[e.UTM]}]},{b:/[:]/,rB:!0,e:/[{;]/,r:0,eE:!1,k:t,i:/["\[\]]/,c:[{b:e.UIR+"\\s*\\(",k:t+" "+i},e.QSM]},{bK:"new throw",r:0},{cN:"function",b:/\w+ +\w+(\.)?\w+\s*\([^\)]*\)\s*((throws)[\w\s,]+)?[\{;]/,rB:!0,e:/[{;=]/,k:t,eE:!0,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,r:0,k:t,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},e.CNM,{cN:"meta",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("r",function(e){var r="([a-zA-Z]|\\.[a-zA-Z.])[a-zA-Z0-9._]*";return{c:[e.HCM,{b:r,l:r,k:{keyword:"function if in break next repeat else for return switch while try tryCatch stop warning require library attach detach source setMethod setGeneric setGroupGeneric setClass ...",literal:"NULL NA TRUE FALSE T F Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10"},r:0},{cN:"number",b:"0[xX][0-9a-fA-F]+[Li]?\\b",r:0},{cN:"number",b:"\\d+(?:[eE][+\\-]?\\d*)?L\\b",r:0},{cN:"number",b:"\\d+\\.(?!\\d)(?:i\\b)?",r:0},{cN:"number",b:"\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b",r:0},{cN:"number",b:"\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b",r:0},{b:"`",e:"`",r:0},{cN:"string",c:[e.BE],v:[{b:'"',e:'"'},{b:"'",e:"'"}]}]}});hljs.registerLanguage("ceylon",function(e){var a="assembly module package import alias class interface object given value assign void function new of extends satisfies abstracts in out return break continue throw assert dynamic if else switch case for while try catch finally then let this outer super is exists nonempty",t="shared abstract formal default actual variable late native deprecatedfinal sealed annotation suppressWarnings small",s="doc by license see throws tagged",n={cN:"subst",eB:!0,eE:!0,b:/``/,e:/``/,k:a,r:10},r=[{cN:"string",b:'"""',e:'"""',r:10},{cN:"string",b:'"',e:'"',c:[n]},{cN:"string",b:"'",e:"'"},{cN:"number",b:"#[0-9a-fA-F_]+|\\$[01_]+|[0-9_]+(?:\\.[0-9_](?:[eE][+-]?\\d+)?)?[kMGTPmunpf]?",r:0}];return n.c=r,{k:{keyword:a+" "+t,meta:s},i:"\\$[^01]|#[^0-9a-fA-F]",c:[e.CLCM,e.C("/\\*","\\*/",{c:["self"]}),{cN:"meta",b:'@[a-z]\\w*(?:\\:"[^"]*")?'}].concat(r)}});hljs.registerLanguage("scilab",function(e){var s=[e.CNM,{cN:"string",b:"'|\"",e:"'|\"",c:[e.BE,{b:"''"}]}];return{aliases:["sci"],l:/%?\w+/,k:{keyword:"abort break case clear catch continue do elseif else endfunction end for function global if pause return resume select try then while",literal:"%f %F %t %T %pi %eps %inf %nan %e %i %z %s",built_in:"abs and acos asin atan ceil cd chdir clearglobal cosh cos cumprod deff disp error exec execstr exists exp eye gettext floor fprintf fread fsolve imag isdef isempty isinfisnan isvector lasterror length load linspace list listfiles log10 log2 log max min msprintf mclose mopen ones or pathconvert poly printf prod pwd rand real round sinh sin size gsort sprintf sqrt strcat strcmps tring sum system tanh tan type typename warning zeros matrix"},i:'("|#|/\\*|\\s+/\\w+)',c:[{cN:"function",bK:"function",e:"$",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)"}]},{b:"[a-zA-Z_][a-zA-Z_0-9]*('+[\\.']*|[\\.']+)",e:"",r:0},{b:"\\[",e:"\\]'*[\\.']*",r:0,c:s},e.C("//","$")].concat(s)}});hljs.registerLanguage("fsharp",function(e){var t={b:"<",e:">",c:[e.inherit(e.TM,{b:/'[a-zA-Z0-9_]+/})]};return{aliases:["fs"],k:"abstract and as assert base begin class default delegate do done downcast downto elif else end exception extern false finally for fun function global if in inherit inline interface internal lazy let match member module mutable namespace new null of open or override private public rec return sig static struct then to true try type upcast use val void when while with yield",i:/\/\*/,c:[{cN:"keyword",b:/\b(yield|return|let|do)!/},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},{cN:"string",b:'"""',e:'"""'},e.C("\\(\\*","\\*\\)"),{cN:"class",bK:"type",e:"\\(|=|$",eE:!0,c:[e.UTM,t]},{cN:"meta",b:"\\[<",e:">\\]",r:10},{cN:"symbol",b:"\\B('[A-Za-z])\\b",c:[e.BE]},e.CLCM,e.inherit(e.QSM,{i:null}),e.CNM]}});hljs.registerLanguage("csp",function(r){return{cI:!1,l:"[a-zA-Z][a-zA-Z0-9_-]*",k:{keyword:"base-uri child-src connect-src default-src font-src form-action frame-ancestors frame-src img-src media-src object-src plugin-types report-uri sandbox script-src style-src"},c:[{cN:"string",b:"'",e:"'"},{cN:"attribute",b:"^Content",e:":",eE:!0}]}});hljs.registerLanguage("matlab",function(e){var a=[e.CNM,{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]}],s={r:0,c:[{b:/'['\.]*/}]};return{k:{keyword:"break case catch classdef continue else elseif end enumerated events for function global if methods otherwise parfor persistent properties return spmd switch try while",built_in:"sin sind sinh asin asind asinh cos cosd cosh acos acosd acosh tan tand tanh atan atand atan2 atanh sec secd sech asec asecd asech csc cscd csch acsc acscd acsch cot cotd coth acot acotd acoth hypot exp expm1 log log1p log10 log2 pow2 realpow reallog realsqrt sqrt nthroot nextpow2 abs angle complex conj imag real unwrap isreal cplxpair fix floor ceil round mod rem sign airy besselj bessely besselh besseli besselk beta betainc betaln ellipj ellipke erf erfc erfcx erfinv expint gamma gammainc gammaln psi legendre cross dot factor isprime primes gcd lcm rat rats perms nchoosek factorial cart2sph cart2pol pol2cart sph2cart hsv2rgb rgb2hsv zeros ones eye repmat rand randn linspace logspace freqspace meshgrid accumarray size length ndims numel disp isempty isequal isequalwithequalnans cat reshape diag blkdiag tril triu fliplr flipud flipdim rot90 find sub2ind ind2sub bsxfun ndgrid permute ipermute shiftdim circshift squeeze isscalar isvector ans eps realmax realmin pi i inf nan isnan isinf isfinite j why compan gallery hadamard hankel hilb invhilb magic pascal rosser toeplitz vander wilkinson"},i:'(//|"|#|/\\*|\\s+/\\w+)',c:[{cN:"function",bK:"function",e:"$",c:[e.UTM,{cN:"params",v:[{b:"\\(",e:"\\)"},{b:"\\[",e:"\\]"}]}]},{b:/[a-zA-Z_][a-zA-Z_0-9]*'['\.]*/,rB:!0,r:0,c:[{b:/[a-zA-Z_][a-zA-Z_0-9]*/,r:0},s.c[0]]},{b:"\\[",e:"\\]",c:a,r:0,starts:s},{b:"\\{",e:/}/,c:a,r:0,starts:s},{b:/\)/,r:0,starts:s},e.C("^\\s*\\%\\{\\s*$","^\\s*\\%\\}\\s*$"),e.C("\\%","$")].concat(a)}});hljs.registerLanguage("bash",function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},s={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]},a={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/-?[a-z\._]+/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"meta",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,s,a,t]}});hljs.registerLanguage("dns",function(d){return{aliases:["bind","zone"],k:{keyword:"IN A AAAA AFSDB APL CAA CDNSKEY CDS CERT CNAME DHCID DLV DNAME DNSKEY DS HIP IPSECKEY KEY KX LOC MX NAPTR NS NSEC NSEC3 NSEC3PARAM PTR RRSIG RP SIG SOA SRV SSHFP TA TKEY TLSA TSIG TXT"},c:[d.C(";","$",{r:0}),{cN:"meta",b:/^\$(TTL|GENERATE|INCLUDE|ORIGIN)\b/},{cN:"number",b:"((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))\\b"},{cN:"number",b:"((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\b"},d.inherit(d.NM,{b:/\b\d+[dhwm]?/})]}});hljs.registerLanguage("clojure",function(e){var t={"builtin-name":"def defonce cond apply if-not if-let if not not= = < > <= >= == + / * - rem quot neg? pos? delay? symbol? keyword? true? false? integer? empty? coll? list? set? ifn? fn? associative? sequential? sorted? counted? reversible? number? decimal? class? distinct? isa? float? rational? reduced? ratio? odd? even? char? seq? vector? string? map? nil? contains? zero? instance? not-every? not-any? libspec? -> ->> .. . inc compare do dotimes mapcat take remove take-while drop letfn drop-last take-last drop-while while intern condp case reduced cycle split-at split-with repeat replicate iterate range merge zipmap declare line-seq sort comparator sort-by dorun doall nthnext nthrest partition eval doseq await await-for let agent atom send send-off release-pending-sends add-watch mapv filterv remove-watch agent-error restart-agent set-error-handler error-handler set-error-mode! error-mode shutdown-agents quote var fn loop recur throw try monitor-enter monitor-exit defmacro defn defn- macroexpand macroexpand-1 for dosync and or when when-not when-let comp juxt partial sequence memoize constantly complement identity assert peek pop doto proxy defstruct first rest cons defprotocol cast coll deftype defrecord last butlast sigs reify second ffirst fnext nfirst nnext defmulti defmethod meta with-meta ns in-ns create-ns import refer keys select-keys vals key val rseq name namespace promise into transient persistent! conj! assoc! dissoc! pop! disj! use class type num float double short byte boolean bigint biginteger bigdec print-method print-dup throw-if printf format load compile get-in update-in pr pr-on newline flush read slurp read-line subvec with-open memfn time re-find re-groups rand-int rand mod locking assert-valid-fdecl alias resolve ref deref refset swap! reset! set-validator! compare-and-set! alter-meta! reset-meta! commute get-validator alter ref-set ref-history-count ref-min-history ref-max-history ensure sync io! new next conj set! to-array future future-call into-array aset gen-class reduce map filter find empty hash-map hash-set sorted-map sorted-map-by sorted-set sorted-set-by vec vector seq flatten reverse assoc dissoc list disj get union difference intersection extend extend-type extend-protocol int nth delay count concat chunk chunk-buffer chunk-append chunk-first chunk-rest max min dec unchecked-inc-int unchecked-inc unchecked-dec-inc unchecked-dec unchecked-negate unchecked-add-int unchecked-add unchecked-subtract-int unchecked-subtract chunk-next chunk-cons chunked-seq? prn vary-meta lazy-seq spread list* str find-keyword keyword symbol gensym force rationalize"},r="a-zA-Z_\\-!.?+*=<>&#'",n="["+r+"]["+r+"0-9/;:]*",a="[-+]?\\d+(\\.\\d+)?",o={b:n,r:0},s={cN:"number",b:a,r:0},i=e.inherit(e.QSM,{i:null}),c=e.C(";","$",{r:0}),d={cN:"literal",b:/\b(true|false|nil)\b/},l={b:"[\\[\\{]",e:"[\\]\\}]"},m={cN:"comment",b:"\\^"+n},p=e.C("\\^\\{","\\}"),u={cN:"symbol",b:"[:]{1,2}"+n},f={b:"\\(",e:"\\)"},h={eW:!0,r:0},y={k:t,l:n,cN:"name",b:n,starts:h},b=[f,i,m,p,c,u,l,s,d,o];return f.c=[e.C("comment",""),y,h],h.c=b,l.c=b,{aliases:["clj"],i:/\S/,c:[f,i,m,p,c,u,l,s,d]}});hljs.registerLanguage("clojure-repl",function(e){return{c:[{cN:"meta",b:/^([\w.-]+|\s*#_)=>/,starts:{e:/$/,sL:"clojure"}}]}});hljs.registerLanguage("rsl",function(e){return{k:{keyword:"float color point normal vector matrix while for if do return else break extern continue",built_in:"abs acos ambient area asin atan atmosphere attribute calculatenormal ceil cellnoise clamp comp concat cos degrees depth Deriv diffuse distance Du Dv environment exp faceforward filterstep floor format fresnel incident length lightsource log match max min mod noise normalize ntransform opposite option phong pnoise pow printf ptlined radians random reflect refract renderinfo round setcomp setxcomp setycomp setzcomp shadow sign sin smoothstep specular specularbrdf spline sqrt step tan texture textureinfo trace transform vtransform xcomp ycomp zcomp"},i:"",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:r},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,c:s}]}]},{b://,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:r}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:s}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}});hljs.registerLanguage("gams",function(e){var a={keyword:"abort acronym acronyms alias all and assign binary card diag display else eq file files for free ge gt if integer le loop lt maximizing minimizing model models ne negative no not option options or ord positive prod put putpage puttl repeat sameas semicont semiint smax smin solve sos1 sos2 sum system table then until using while xor yes",literal:"eps inf na","built-in":"abs arccos arcsin arctan arctan2 Beta betaReg binomial ceil centropy cos cosh cvPower div div0 eDist entropy errorf execSeed exp fact floor frac gamma gammaReg log logBeta logGamma log10 log2 mapVal max min mod ncpCM ncpF ncpVUpow ncpVUsin normal pi poly power randBinomial randLinear randTriangle round rPower sigmoid sign signPower sin sinh slexp sllog10 slrec sqexp sqlog10 sqr sqrec sqrt tan tanh trunc uniform uniformInt vcPower bool_and bool_eqv bool_imp bool_not bool_or bool_xor ifThen rel_eq rel_ge rel_gt rel_le rel_lt rel_ne gday gdow ghour gleap gmillisec gminute gmonth gsecond gyear jdate jnow jstart jtime errorLevel execError gamsRelease gamsVersion handleCollect handleDelete handleStatus handleSubmit heapFree heapLimit heapSize jobHandle jobKill jobStatus jobTerminate licenseLevel licenseStatus maxExecError sleep timeClose timeComp timeElapsed timeExec timeStart"},o={cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0},r={cN:"symbol",v:[{b:/\=[lgenxc]=/},{b:/\$/}]},t={cN:"comment",v:[{b:"'",e:"'"},{b:'"',e:'"'}],i:"\\n",c:[e.BE]},i={b:"/",e:"/",k:a,c:[t,e.CLCM,e.CBCM,e.QSM,e.ASM,e.CNM]},l={b:/[a-z][a-z0-9_]*(\([a-z0-9_, ]*\))?[ \t]+/,eB:!0,e:"$",eW:!0,c:[t,i,{cN:"comment",b:/([ ]*[a-z0-9&#*=?@>\\<:\-,()$\[\]_.{}!+%^]+)+/,r:0}]};return{aliases:["gms"],cI:!0,k:a,c:[e.C(/^\$ontext/,/^\$offtext/),{cN:"meta",b:"^\\$[a-z0-9]+",e:"$",rB:!0,c:[{cN:"meta-keyword",b:"^\\$[a-z0-9]+"}]},e.C("^\\*","$"),e.CLCM,e.CBCM,e.QSM,e.ASM,{bK:"set sets parameter parameters variable variables scalar scalars equation equations",e:";",c:[e.C("^\\*","$"),e.CLCM,e.CBCM,e.QSM,e.ASM,i,l]},{bK:"table",e:";",rB:!0,c:[{bK:"table",e:"$",c:[l]},e.C("^\\*","$"),e.CLCM,e.CBCM,e.QSM,e.ASM,e.CNM]},{cN:"function",b:/^[a-z][a-z0-9_,\-+' ()$]+\.{2}/,rB:!0,c:[{cN:"title",b:/^[a-z][a-z0-9_]+/},o,r]},e.CNM,r]}});hljs.registerLanguage("scala",function(e){var t={cN:"meta",b:"@[A-Za-z]+"},a={cN:"subst",v:[{b:"\\$[A-Za-z0-9_]+"},{b:"\\${",e:"}"}]},r={cN:"string",v:[{b:'"',e:'"',i:"\\n",c:[e.BE]},{b:'"""',e:'"""',r:10},{b:'[a-z]+"',e:'"',i:"\\n",c:[e.BE,a]},{cN:"string",b:'[a-z]+"""',e:'"""',c:[a],r:10}]},c={cN:"symbol",b:"'\\w[\\w\\d_]*(?!')"},i={cN:"type",b:"\\b[A-Z][A-Za-z0-9_]*",r:0},s={cN:"title",b:/[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/,r:0},n={cN:"class",bK:"class object trait type",e:/[:={\[\n;]/,eE:!0,c:[{bK:"extends with",r:10},{b:/\[/,e:/\]/,eB:!0,eE:!0,r:0,c:[i]},{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,r:0,c:[i]},s]},l={cN:"function",bK:"def",e:/[:={\[(\n;]/,eE:!0,c:[s]};return{k:{literal:"true false null",keyword:"type yield lazy override def with val var sealed abstract private trait object if forSome for while throw finally protected extends import final return else break new catch super class case package default try this match continue throws implicit"},c:[e.CLCM,e.CBCM,r,c,i,l,n,e.CNM,t]}});hljs.registerLanguage("maxima",function(e){var t="if then else elseif for thru do while unless step in and or not",a="true false unknown inf minf ind und %e %i %pi %phi %gamma",r=" abasep abs absint absolute_real_time acos acosh acot acoth acsc acsch activate addcol add_edge add_edges addmatrices addrow add_vertex add_vertices adjacency_matrix adjoin adjoint af agd airy airy_ai airy_bi airy_dai airy_dbi algsys alg_type alias allroots alphacharp alphanumericp amortization %and annuity_fv annuity_pv antid antidiff AntiDifference append appendfile apply apply1 apply2 applyb1 apropos args arit_amortization arithmetic arithsum array arrayapply arrayinfo arraymake arraysetapply ascii asec asech asin asinh askinteger asksign assoc assoc_legendre_p assoc_legendre_q assume assume_external_byte_order asympa at atan atan2 atanh atensimp atom atvalue augcoefmatrix augmented_lagrangian_method av average_degree backtrace bars barsplot barsplot_description base64 base64_decode bashindices batch batchload bc2 bdvac belln benefit_cost bern bernpoly bernstein_approx bernstein_expand bernstein_poly bessel bessel_i bessel_j bessel_k bessel_simplify bessel_y beta beta_incomplete beta_incomplete_generalized beta_incomplete_regularized bezout bfallroots bffac bf_find_root bf_fmin_cobyla bfhzeta bfloat bfloatp bfpsi bfpsi0 bfzeta biconnected_components bimetric binomial bipartition block blockmatrixp bode_gain bode_phase bothcoef box boxplot boxplot_description break bug_report build_info|10 buildq build_sample burn cabs canform canten cardinality carg cartan cartesian_product catch cauchy_matrix cbffac cdf_bernoulli cdf_beta cdf_binomial cdf_cauchy cdf_chi2 cdf_continuous_uniform cdf_discrete_uniform cdf_exp cdf_f cdf_gamma cdf_general_finite_discrete cdf_geometric cdf_gumbel cdf_hypergeometric cdf_laplace cdf_logistic cdf_lognormal cdf_negative_binomial cdf_noncentral_chi2 cdf_noncentral_student_t cdf_normal cdf_pareto cdf_poisson cdf_rank_sum cdf_rayleigh cdf_signed_rank cdf_student_t cdf_weibull cdisplay ceiling central_moment cequal cequalignore cf cfdisrep cfexpand cgeodesic cgreaterp cgreaterpignore changename changevar chaosgame charat charfun charfun2 charlist charp charpoly chdir chebyshev_t chebyshev_u checkdiv check_overlaps chinese cholesky christof chromatic_index chromatic_number cint circulant_graph clear_edge_weight clear_rules clear_vertex_label clebsch_gordan clebsch_graph clessp clesspignore close closefile cmetric coeff coefmatrix cograd col collapse collectterms columnop columnspace columnswap columnvector combination combine comp2pui compare compfile compile compile_file complement_graph complete_bipartite_graph complete_graph complex_number_p components compose_functions concan concat conjugate conmetderiv connected_components connect_vertices cons constant constantp constituent constvalue cont2part content continuous_freq contortion contour_plot contract contract_edge contragrad contrib_ode convert coord copy copy_file copy_graph copylist copymatrix cor cos cosh cot coth cov cov1 covdiff covect covers crc24sum create_graph create_list csc csch csetup cspline ctaylor ct_coordsys ctransform ctranspose cube_graph cuboctahedron_graph cunlisp cv cycle_digraph cycle_graph cylindrical days360 dblint deactivate declare declare_constvalue declare_dimensions declare_fundamental_dimensions declare_fundamental_units declare_qty declare_translated declare_unit_conversion declare_units declare_weights decsym defcon define define_alt_display define_variable defint defmatch defrule defstruct deftaylor degree_sequence del delete deleten delta demo demoivre denom depends derivdegree derivlist describe desolve determinant dfloat dgauss_a dgauss_b dgeev dgemm dgeqrf dgesv dgesvd diag diagmatrix diag_matrix diagmatrixp diameter diff digitcharp dimacs_export dimacs_import dimension dimensionless dimensions dimensions_as_list direct directory discrete_freq disjoin disjointp disolate disp dispcon dispform dispfun dispJordan display disprule dispterms distrib divide divisors divsum dkummer_m dkummer_u dlange dodecahedron_graph dotproduct dotsimp dpart draw draw2d draw3d drawdf draw_file draw_graph dscalar echelon edge_coloring edge_connectivity edges eigens_by_jacobi eigenvalues eigenvectors eighth einstein eivals eivects elapsed_real_time elapsed_run_time ele2comp ele2polynome ele2pui elem elementp elevation_grid elim elim_allbut eliminate eliminate_using ellipse elliptic_e elliptic_ec elliptic_eu elliptic_f elliptic_kc elliptic_pi ematrix empty_graph emptyp endcons entermatrix entertensor entier equal equalp equiv_classes erf erfc erf_generalized erfi errcatch error errormsg errors euler ev eval_string evenp every evolution evolution2d evundiff example exp expand expandwrt expandwrt_factored expint expintegral_chi expintegral_ci expintegral_e expintegral_e1 expintegral_ei expintegral_e_simplify expintegral_li expintegral_shi expintegral_si explicit explose exponentialize express expt exsec extdiff extract_linear_equations extremal_subset ezgcd %f f90 facsum factcomb factor factorfacsum factorial factorout factorsum facts fast_central_elements fast_linsolve fasttimes featurep fernfale fft fib fibtophi fifth filename_merge file_search file_type fillarray findde find_root find_root_abs find_root_error find_root_rel first fix flatten flength float floatnump floor flower_snark flush flush1deriv flushd flushnd flush_output fmin_cobyla forget fortran fourcos fourexpand fourier fourier_elim fourint fourintcos fourintsin foursimp foursin fourth fposition frame_bracket freeof freshline fresnel_c fresnel_s from_adjacency_matrix frucht_graph full_listify fullmap fullmapl fullratsimp fullratsubst fullsetify funcsolve fundamental_dimensions fundamental_units fundef funmake funp fv g0 g1 gamma gamma_greek gamma_incomplete gamma_incomplete_generalized gamma_incomplete_regularized gauss gauss_a gauss_b gaussprob gcd gcdex gcdivide gcfac gcfactor gd generalized_lambert_w genfact gen_laguerre genmatrix gensym geo_amortization geo_annuity_fv geo_annuity_pv geomap geometric geometric_mean geosum get getcurrentdirectory get_edge_weight getenv get_lu_factors get_output_stream_string get_pixel get_plot_option get_tex_environment get_tex_environment_default get_vertex_label gfactor gfactorsum ggf girth global_variances gn gnuplot_close gnuplot_replot gnuplot_reset gnuplot_restart gnuplot_start go Gosper GosperSum gr2d gr3d gradef gramschmidt graph6_decode graph6_encode graph6_export graph6_import graph_center graph_charpoly graph_eigenvalues graph_flow graph_order graph_periphery graph_product graph_size graph_union great_rhombicosidodecahedron_graph great_rhombicuboctahedron_graph grid_graph grind grobner_basis grotzch_graph hamilton_cycle hamilton_path hankel hankel_1 hankel_2 harmonic harmonic_mean hav heawood_graph hermite hessian hgfred hilbertmap hilbert_matrix hipow histogram histogram_description hodge horner hypergeometric i0 i1 %ibes ic1 ic2 ic_convert ichr1 ichr2 icosahedron_graph icosidodecahedron_graph icurvature ident identfor identity idiff idim idummy ieqn %if ifactors iframes ifs igcdex igeodesic_coords ilt image imagpart imetric implicit implicit_derivative implicit_plot indexed_tensor indices induced_subgraph inferencep inference_result infix info_display init_atensor init_ctensor in_neighbors innerproduct inpart inprod inrt integerp integer_partitions integrate intersect intersection intervalp intopois intosum invariant1 invariant2 inverse_fft inverse_jacobi_cd inverse_jacobi_cn inverse_jacobi_cs inverse_jacobi_dc inverse_jacobi_dn inverse_jacobi_ds inverse_jacobi_nc inverse_jacobi_nd inverse_jacobi_ns inverse_jacobi_sc inverse_jacobi_sd inverse_jacobi_sn invert invert_by_adjoint invert_by_lu inv_mod irr is is_biconnected is_bipartite is_connected is_digraph is_edge_in_graph is_graph is_graph_or_digraph ishow is_isomorphic isolate isomorphism is_planar isqrt isreal_p is_sconnected is_tree is_vertex_in_graph items_inference %j j0 j1 jacobi jacobian jacobi_cd jacobi_cn jacobi_cs jacobi_dc jacobi_dn jacobi_ds jacobi_nc jacobi_nd jacobi_ns jacobi_p jacobi_sc jacobi_sd jacobi_sn JF jn join jordan julia julia_set julia_sin %k kdels kdelta kill killcontext kostka kron_delta kronecker_product kummer_m kummer_u kurtosis kurtosis_bernoulli kurtosis_beta kurtosis_binomial kurtosis_chi2 kurtosis_continuous_uniform kurtosis_discrete_uniform kurtosis_exp kurtosis_f kurtosis_gamma kurtosis_general_finite_discrete kurtosis_geometric kurtosis_gumbel kurtosis_hypergeometric kurtosis_laplace kurtosis_logistic kurtosis_lognormal kurtosis_negative_binomial kurtosis_noncentral_chi2 kurtosis_noncentral_student_t kurtosis_normal kurtosis_pareto kurtosis_poisson kurtosis_rayleigh kurtosis_student_t kurtosis_weibull label labels lagrange laguerre lambda lambert_w laplace laplacian_matrix last lbfgs lc2kdt lcharp lc_l lcm lc_u ldefint ldisp ldisplay legendre_p legendre_q leinstein length let letrules letsimp levi_civita lfreeof lgtreillis lhs li liediff limit Lindstedt linear linearinterpol linear_program linear_regression line_graph linsolve listarray list_correlations listify list_matrix_entries list_nc_monomials listoftens listofvars listp lmax lmin load loadfile local locate_matrix_entry log logcontract log_gamma lopow lorentz_gauge lowercasep lpart lratsubst lreduce lriemann lsquares_estimates lsquares_estimates_approximate lsquares_estimates_exact lsquares_mse lsquares_residual_mse lsquares_residuals lsum ltreillis lu_backsub lucas lu_factor %m macroexpand macroexpand1 make_array makebox makefact makegamma make_graph make_level_picture makelist makeOrders make_poly_continent make_poly_country make_polygon make_random_state make_rgb_picture makeset make_string_input_stream make_string_output_stream make_transform mandelbrot mandelbrot_set map mapatom maplist matchdeclare matchfix mat_cond mat_fullunblocker mat_function mathml_display mat_norm matrix matrixmap matrixp matrix_size mattrace mat_trace mat_unblocker max max_clique max_degree max_flow maximize_lp max_independent_set max_matching maybe md5sum mean mean_bernoulli mean_beta mean_binomial mean_chi2 mean_continuous_uniform mean_deviation mean_discrete_uniform mean_exp mean_f mean_gamma mean_general_finite_discrete mean_geometric mean_gumbel mean_hypergeometric mean_laplace mean_logistic mean_lognormal mean_negative_binomial mean_noncentral_chi2 mean_noncentral_student_t mean_normal mean_pareto mean_poisson mean_rayleigh mean_student_t mean_weibull median median_deviation member mesh metricexpandall mgf1_sha1 min min_degree min_edge_cut minfactorial minimalPoly minimize_lp minimum_spanning_tree minor minpack_lsquares minpack_solve min_vertex_cover min_vertex_cut mkdir mnewton mod mode_declare mode_identity ModeMatrix moebius mon2schur mono monomial_dimensions multibernstein_poly multi_display_for_texinfo multi_elem multinomial multinomial_coeff multi_orbit multiplot_mode multi_pui multsym multthru mycielski_graph nary natural_unit nc_degree ncexpt ncharpoly negative_picture neighbors new newcontext newdet new_graph newline newton new_variable next_prime nicedummies niceindices ninth nofix nonarray noncentral_moment nonmetricity nonnegintegerp nonscalarp nonzeroandfreeof notequal nounify nptetrad npv nroots nterms ntermst nthroot nullity nullspace num numbered_boundaries numberp number_to_octets num_distinct_partitions numerval numfactor num_partitions nusum nzeta nzetai nzetar octets_to_number octets_to_oid odd_girth oddp ode2 ode_check odelin oid_to_octets op opena opena_binary openr openr_binary openw openw_binary operatorp opsubst optimize %or orbit orbits ordergreat ordergreatp orderless orderlessp orthogonal_complement orthopoly_recur orthopoly_weight outermap out_neighbors outofpois pade parabolic_cylinder_d parametric parametric_surface parg parGosper parse_string parse_timedate part part2cont partfrac partition partition_set partpol path_digraph path_graph pathname_directory pathname_name pathname_type pdf_bernoulli pdf_beta pdf_binomial pdf_cauchy pdf_chi2 pdf_continuous_uniform pdf_discrete_uniform pdf_exp pdf_f pdf_gamma pdf_general_finite_discrete pdf_geometric pdf_gumbel pdf_hypergeometric pdf_laplace pdf_logistic pdf_lognormal pdf_negative_binomial pdf_noncentral_chi2 pdf_noncentral_student_t pdf_normal pdf_pareto pdf_poisson pdf_rank_sum pdf_rayleigh pdf_signed_rank pdf_student_t pdf_weibull pearson_skewness permanent permut permutation permutations petersen_graph petrov pickapart picture_equalp picturep piechart piechart_description planar_embedding playback plog plot2d plot3d plotdf ploteq plsquares pochhammer points poisdiff poisexpt poisint poismap poisplus poissimp poissubst poistimes poistrim polar polarform polartorect polar_to_xy poly_add poly_buchberger poly_buchberger_criterion poly_colon_ideal poly_content polydecomp poly_depends_p poly_elimination_ideal poly_exact_divide poly_expand poly_expt poly_gcd polygon poly_grobner poly_grobner_equal poly_grobner_member poly_grobner_subsetp poly_ideal_intersection poly_ideal_polysaturation poly_ideal_polysaturation1 poly_ideal_saturation poly_ideal_saturation1 poly_lcm poly_minimization polymod poly_multiply polynome2ele polynomialp poly_normal_form poly_normalize poly_normalize_list poly_polysaturation_extension poly_primitive_part poly_pseudo_divide poly_reduced_grobner poly_reduction poly_saturation_extension poly_s_polynomial poly_subtract polytocompanion pop postfix potential power_mod powerseries powerset prefix prev_prime primep primes principal_components print printf printfile print_graph printpois printprops prodrac product properties propvars psi psubst ptriangularize pui pui2comp pui2ele pui2polynome pui_direct puireduc push put pv qput qrange qty quad_control quad_qag quad_qagi quad_qagp quad_qags quad_qawc quad_qawf quad_qawo quad_qaws quadrilateral quantile quantile_bernoulli quantile_beta quantile_binomial quantile_cauchy quantile_chi2 quantile_continuous_uniform quantile_discrete_uniform quantile_exp quantile_f quantile_gamma quantile_general_finite_discrete quantile_geometric quantile_gumbel quantile_hypergeometric quantile_laplace quantile_logistic quantile_lognormal quantile_negative_binomial quantile_noncentral_chi2 quantile_noncentral_student_t quantile_normal quantile_pareto quantile_poisson quantile_rayleigh quantile_student_t quantile_weibull quartile_skewness quit qunit quotient racah_v racah_w radcan radius random random_bernoulli random_beta random_binomial random_bipartite_graph random_cauchy random_chi2 random_continuous_uniform random_digraph random_discrete_uniform random_exp random_f random_gamma random_general_finite_discrete random_geometric random_graph random_graph1 random_gumbel random_hypergeometric random_laplace random_logistic random_lognormal random_negative_binomial random_network random_noncentral_chi2 random_noncentral_student_t random_normal random_pareto random_permutation random_poisson random_rayleigh random_regular_graph random_student_t random_tournament random_tree random_weibull range rank rat ratcoef ratdenom ratdiff ratdisrep ratexpand ratinterpol rational rationalize ratnumer ratnump ratp ratsimp ratsubst ratvars ratweight read read_array read_binary_array read_binary_list read_binary_matrix readbyte readchar read_hashed_array readline read_list read_matrix read_nested_list readonly read_xpm real_imagpart_to_conjugate realpart realroots rearray rectangle rectform rectform_log_if_constant recttopolar rediff reduce_consts reduce_order region region_boundaries region_boundaries_plus rem remainder remarray rembox remcomps remcon remcoord remfun remfunction remlet remove remove_constvalue remove_dimensions remove_edge remove_fundamental_dimensions remove_fundamental_units remove_plot_option remove_vertex rempart remrule remsym remvalue rename rename_file reset reset_displays residue resolvante resolvante_alternee1 resolvante_bipartite resolvante_diedrale resolvante_klein resolvante_klein3 resolvante_produit_sym resolvante_unitaire resolvante_vierer rest resultant return reveal reverse revert revert2 rgb2level rhs ricci riemann rinvariant risch rk rmdir rncombine romberg room rootscontract round row rowop rowswap rreduce run_testsuite %s save saving scalarp scaled_bessel_i scaled_bessel_i0 scaled_bessel_i1 scalefactors scanmap scatterplot scatterplot_description scene schur2comp sconcat scopy scsimp scurvature sdowncase sec sech second sequal sequalignore set_alt_display setdifference set_draw_defaults set_edge_weight setelmx setequalp setify setp set_partitions set_plot_option set_prompt set_random_state set_tex_environment set_tex_environment_default setunits setup_autoload set_up_dot_simplifications set_vertex_label seventh sexplode sf sha1sum sha256sum shortest_path shortest_weighted_path show showcomps showratvars sierpinskiale sierpinskimap sign signum similaritytransform simp_inequality simplify_sum simplode simpmetderiv simtran sin sinh sinsert sinvertcase sixth skewness skewness_bernoulli skewness_beta skewness_binomial skewness_chi2 skewness_continuous_uniform skewness_discrete_uniform skewness_exp skewness_f skewness_gamma skewness_general_finite_discrete skewness_geometric skewness_gumbel skewness_hypergeometric skewness_laplace skewness_logistic skewness_lognormal skewness_negative_binomial skewness_noncentral_chi2 skewness_noncentral_student_t skewness_normal skewness_pareto skewness_poisson skewness_rayleigh skewness_student_t skewness_weibull slength smake small_rhombicosidodecahedron_graph small_rhombicuboctahedron_graph smax smin smismatch snowmap snub_cube_graph snub_dodecahedron_graph solve solve_rec solve_rec_rat some somrac sort sparse6_decode sparse6_encode sparse6_export sparse6_import specint spherical spherical_bessel_j spherical_bessel_y spherical_hankel1 spherical_hankel2 spherical_harmonic spherical_to_xyz splice split sposition sprint sqfr sqrt sqrtdenest sremove sremovefirst sreverse ssearch ssort sstatus ssubst ssubstfirst staircase standardize standardize_inverse_trig starplot starplot_description status std std1 std_bernoulli std_beta std_binomial std_chi2 std_continuous_uniform std_discrete_uniform std_exp std_f std_gamma std_general_finite_discrete std_geometric std_gumbel std_hypergeometric std_laplace std_logistic std_lognormal std_negative_binomial std_noncentral_chi2 std_noncentral_student_t std_normal std_pareto std_poisson std_rayleigh std_student_t std_weibull stemplot stirling stirling1 stirling2 strim striml strimr string stringout stringp strong_components struve_h struve_l sublis sublist sublist_indices submatrix subsample subset subsetp subst substinpart subst_parallel substpart substring subvar subvarp sum sumcontract summand_to_rec supcase supcontext symbolp symmdifference symmetricp system take_channel take_inference tan tanh taylor taylorinfo taylorp taylor_simplifier taytorat tcl_output tcontract tellrat tellsimp tellsimpafter tentex tenth test_mean test_means_difference test_normality test_proportion test_proportions_difference test_rank_sum test_sign test_signed_rank test_variance test_variance_ratio tex tex1 tex_display texput %th third throw time timedate timer timer_info tldefint tlimit todd_coxeter toeplitz tokens to_lisp topological_sort to_poly to_poly_solve totaldisrep totalfourier totient tpartpol trace tracematrix trace_options transform_sample translate translate_file transpose treefale tree_reduce treillis treinat triangle triangularize trigexpand trigrat trigreduce trigsimp trunc truncate truncated_cube_graph truncated_dodecahedron_graph truncated_icosahedron_graph truncated_tetrahedron_graph tr_warnings_get tube tutte_graph ueivects uforget ultraspherical underlying_graph undiff union unique uniteigenvectors unitp units unit_step unitvector unorder unsum untellrat untimer untrace uppercasep uricci uriemann uvect vandermonde_matrix var var1 var_bernoulli var_beta var_binomial var_chi2 var_continuous_uniform var_discrete_uniform var_exp var_f var_gamma var_general_finite_discrete var_geometric var_gumbel var_hypergeometric var_laplace var_logistic var_lognormal var_negative_binomial var_noncentral_chi2 var_noncentral_student_t var_normal var_pareto var_poisson var_rayleigh var_student_t var_weibull vector vectorpotential vectorsimp verbify vers vertex_coloring vertex_connectivity vertex_degree vertex_distance vertex_eccentricity vertex_in_degree vertex_out_degree vertices vertices_to_cycle vertices_to_path %w weyl wheel_graph wiener_index wigner_3j wigner_6j wigner_9j with_stdout write_binary_data writebyte write_data writefile wronskian xreduce xthru %y Zeilberger zeroequiv zerofor zeromatrix zeromatrixp zeta zgeev zheev zlange zn_add_table zn_carmichael_lambda zn_characteristic_factors zn_determinant zn_factor_generators zn_invert_by_lu zn_log zn_mult_table absboxchar activecontexts adapt_depth additive adim aform algebraic algepsilon algexact aliases allbut all_dotsimp_denoms allocation allsym alphabetic animation antisymmetric arrays askexp assume_pos assume_pos_pred assumescalar asymbol atomgrad atrig1 axes axis_3d axis_bottom axis_left axis_right axis_top azimuth background background_color backsubst berlefact bernstein_explicit besselexpand beta_args_sum_to_integer beta_expand bftorat bftrunc bindtest border boundaries_array box boxchar breakup %c capping cauchysum cbrange cbtics center cflength cframe_flag cnonmet_flag color color_bar color_bar_tics colorbox columns commutative complex cone context contexts contour contour_levels cosnpiflag ctaypov ctaypt ctayswitch ctayvar ct_coords ctorsion_flag ctrgsimp cube current_let_rule_package cylinder data_file_name debugmode decreasing default_let_rule_package delay dependencies derivabbrev derivsubst detout diagmetric diff dim dimensions dispflag display2d|10 display_format_internal distribute_over doallmxops domain domxexpt domxmxops domxnctimes dontfactor doscmxops doscmxplus dot0nscsimp dot0simp dot1simp dotassoc dotconstrules dotdistrib dotexptsimp dotident dotscrules draw_graph_program draw_realpart edge_color edge_coloring edge_partition edge_type edge_width %edispflag elevation %emode endphi endtheta engineering_format_floats enhanced3d %enumer epsilon_lp erfflag erf_representation errormsg error_size error_syms error_type %e_to_numlog eval even evenfun evflag evfun ev_point expandwrt_denom expintexpand expintrep expon expop exptdispflag exptisolate exptsubst facexpand facsum_combine factlim factorflag factorial_expand factors_only fb feature features file_name file_output_append file_search_demo file_search_lisp file_search_maxima|10 file_search_tests file_search_usage file_type_lisp file_type_maxima|10 fill_color fill_density filled_func fixed_vertices flipflag float2bf font font_size fortindent fortspaces fpprec fpprintprec functions gamma_expand gammalim gdet genindex gensumnum GGFCFMAX GGFINFINITY globalsolve gnuplot_command gnuplot_curve_styles gnuplot_curve_titles gnuplot_default_term_command gnuplot_dumb_term_command gnuplot_file_args gnuplot_file_name gnuplot_out_file gnuplot_pdf_term_command gnuplot_pm3d gnuplot_png_term_command gnuplot_postamble gnuplot_preamble gnuplot_ps_term_command gnuplot_svg_term_command gnuplot_term gnuplot_view_args Gosper_in_Zeilberger gradefs grid grid2d grind halfangles head_angle head_both head_length head_type height hypergeometric_representation %iargs ibase icc1 icc2 icounter idummyx ieqnprint ifb ifc1 ifc2 ifg ifgi ifr iframe_bracket_form ifri igeowedge_flag ikt1 ikt2 imaginary inchar increasing infeval infinity inflag infolists inm inmc1 inmc2 intanalysis integer integervalued integrate_use_rootsof integration_constant integration_constant_counter interpolate_color intfaclim ip_grid ip_grid_in irrational isolate_wrt_times iterations itr julia_parameter %k1 %k2 keepfloat key key_pos kinvariant kt label label_alignment label_orientation labels lassociative lbfgs_ncorrections lbfgs_nfeval_max leftjust legend letrat let_rule_packages lfg lg lhospitallim limsubst linear linear_solver linechar linel|10 linenum line_type linewidth line_width linsolve_params linsolvewarn lispdisp listarith listconstvars listdummyvars lmxchar load_pathname loadprint logabs logarc logcb logconcoeffp logexpand lognegint logsimp logx logx_secondary logy logy_secondary logz lriem m1pbranch macroexpansion macros mainvar manual_demo maperror mapprint matrix_element_add matrix_element_mult matrix_element_transpose maxapplydepth maxapplyheight maxima_tempdir|10 maxima_userdir|10 maxnegex MAX_ORD maxposex maxpsifracdenom maxpsifracnum maxpsinegint maxpsiposint maxtayorder mesh_lines_color method mod_big_prime mode_check_errorp mode_checkp mode_check_warnp mod_test mod_threshold modular_linear_solver modulus multiplicative multiplicities myoptions nary negdistrib negsumdispflag newline newtonepsilon newtonmaxiter nextlayerfactor niceindicespref nm nmc noeval nolabels nonegative_lp noninteger nonscalar noun noundisp nouns np npi nticks ntrig numer numer_pbranch obase odd oddfun opacity opproperties opsubst optimprefix optionset orientation origin orthopoly_returns_intervals outative outchar packagefile palette partswitch pdf_file pfeformat phiresolution %piargs piece pivot_count_sx pivot_max_sx plot_format plot_options plot_realpart png_file pochhammer_max_index points pointsize point_size points_joined point_type poislim poisson poly_coefficient_ring poly_elimination_order polyfactor poly_grobner_algorithm poly_grobner_debug poly_monomial_order poly_primary_elimination_order poly_return_term_list poly_secondary_elimination_order poly_top_reduction_only posfun position powerdisp pred prederror primep_number_of_tests product_use_gamma program programmode promote_float_to_bigfloat prompt proportional_axes props psexpand ps_file radexpand radius radsubstflag rassociative ratalgdenom ratchristof ratdenomdivide rateinstein ratepsilon ratfac rational ratmx ratprint ratriemann ratsimpexpons ratvarswitch ratweights ratweyl ratwtlvl real realonly redraw refcheck resolution restart resultant ric riem rmxchar %rnum_list rombergabs rombergit rombergmin rombergtol rootsconmode rootsepsilon run_viewer same_xy same_xyz savedef savefactors scalar scalarmatrixp scale scale_lp setcheck setcheckbreak setval show_edge_color show_edges show_edge_type show_edge_width show_id show_label showtime show_vertex_color show_vertex_size show_vertex_type show_vertices show_weight simp simplified_output simplify_products simpproduct simpsum sinnpiflag solvedecomposes solveexplicit solvefactors solvenullwarn solveradcan solvetrigwarn space sparse sphere spring_embedding_depth sqrtdispflag stardisp startphi starttheta stats_numer stringdisp structures style sublis_apply_lambda subnumsimp sumexpand sumsplitfact surface surface_hide svg_file symmetric tab taylordepth taylor_logexpand taylor_order_coefficients taylor_truncate_polynomials tensorkill terminal testsuite_files thetaresolution timer_devalue title tlimswitch tr track transcompile transform transform_xy translate_fast_arrays transparent transrun tr_array_as_ref tr_bound_function_applyp tr_file_tty_messagesp tr_float_can_branch_complex tr_function_call_default trigexpandplus trigexpandtimes triginverses trigsign trivial_solutions tr_numer tr_optimize_max_loop tr_semicompile tr_state_vars tr_warn_bad_function_calls tr_warn_fexpr tr_warn_meval tr_warn_mode tr_warn_undeclared tr_warn_undefined_variable tstep ttyoff tube_extremes ufg ug %unitexpand unit_vectors uric uriem use_fast_arrays user_preamble usersetunits values vect_cross verbose vertex_color vertex_coloring vertex_partition vertex_size vertex_type view warnings weyl width windowname windowtitle wired_surface wireframe xaxis xaxis_color xaxis_secondary xaxis_type xaxis_width xlabel xlabel_secondary xlength xrange xrange_secondary xtics xtics_axis xtics_rotate xtics_rotate_secondary xtics_secondary xtics_secondary_axis xu_grid x_voxel xy_file xyplane xy_scale yaxis yaxis_color yaxis_secondary yaxis_type yaxis_width ylabel ylabel_secondary ylength yrange yrange_secondary ytics ytics_axis ytics_rotate ytics_rotate_secondary ytics_secondary ytics_secondary_axis yv_grid y_voxel yx_ratio zaxis zaxis_color zaxis_type zaxis_width zeroa zerob zerobern zeta%pi zlabel zlabel_rotate zlength zmin zn_primroot_limit zn_primroot_pretest",i="_ __ %|0 %%|0";return{l:"[A-Za-z_%][0-9A-Za-z_%]*",k:{keyword:t,literal:a,built_in:r,symbol:i},c:[{cN:"comment",b:"/\\*",e:"\\*/",c:["self"]},e.QSM,{cN:"number",r:0,v:[{b:"\\b(\\d+|\\d+\\.|\\.\\d+|\\d+\\.\\d+)[Ee][-+]?\\d+\\b"},{b:"\\b(\\d+|\\d+\\.|\\.\\d+|\\d+\\.\\d+)[Bb][-+]?\\d+\\b",r:10},{b:"\\b(\\.\\d+|\\d+\\.\\d+)\\b"},{b:"\\b(\\d+|0[0-9A-Za-z]+)\\.?\\b"}]}],i:/@/}});hljs.registerLanguage("python",function(e){var r={keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda async await nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},b={cN:"meta",b:/^(>>>|\.\.\.) /},c={cN:"subst",b:/\{/,e:/\}/,k:r,i:/#/},a={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[b],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[b],r:10},{b:/(fr|rf|f)'''/,e:/'''/,c:[b,c]},{b:/(fr|rf|f)"""/,e:/"""/,c:[b,c]},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},{b:/(fr|rf|f)'/,e:/'/,c:[c]},{b:/(fr|rf|f)"/,e:/"/,c:[c]},e.ASM,e.QSM]},s={cN:"number",r:0,v:[{b:e.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:e.CNR+"[lLjJ]?"}]},i={cN:"params",b:/\(/,e:/\)/,c:["self",b,s,a]};return c.c=[a,s,b],{aliases:["py","gyp"],k:r,i:/(<\/|->|\?)|=>/,c:[b,s,a,e.HCM,{v:[{cN:"function",bK:"def"},{cN:"class",bK:"class"}],e:/:/,i:/[${=;\n,]/,c:[e.UTM,i,{b:/->/,eW:!0,k:"None"}]},{cN:"meta",b:/^[\t ]*@/,e:/$/},{b:/\b(print|exec)\(/}]}});hljs.registerLanguage("erlang",function(e){var r="[a-z'][a-zA-Z0-9_']*",c="("+r+":"+r+"|"+r+")",b={keyword:"after and andalso|10 band begin bnot bor bsl bzr bxor case catch cond div end fun if let not of orelse|10 query receive rem try when xor",literal:"false true"},i=e.C("%","$"),n={cN:"number",b:"\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)",r:0},a={b:"fun\\s+"+r+"/\\d+"},d={b:c+"\\(",e:"\\)",rB:!0,r:0,c:[{b:c,r:0},{b:"\\(",e:"\\)",eW:!0,rE:!0,r:0}]},o={b:"{",e:"}",r:0},t={b:"\\b_([A-Z][A-Za-z0-9_]*)?",r:0},f={b:"[A-Z][a-zA-Z0-9_]*",r:0},l={b:"#"+e.UIR,r:0,rB:!0,c:[{b:"#"+e.UIR,r:0},{b:"{",e:"}",r:0}]},s={bK:"fun receive if try case",e:"end",k:b};s.c=[i,a,e.inherit(e.ASM,{cN:""}),s,d,e.QSM,n,o,t,f,l];var u=[i,a,s,d,e.QSM,n,o,t,f,l];d.c[1].c=u,o.c=u,l.c[1].c=u;var h={cN:"params",b:"\\(",e:"\\)",c:u};return{aliases:["erl"],k:b,i:"(",rB:!0,i:"\\(|#|//|/\\*|\\\\|:|;",c:[h,e.inherit(e.TM,{b:r})],starts:{e:";|\\.",k:b,c:u}},i,{b:"^-",e:"\\.",r:0,eE:!0,rB:!0,l:"-"+e.IR,k:"-module -record -undef -export -ifdef -ifndef -author -copyright -doc -vsn -import -include -include_lib -compile -define -else -endif -file -behaviour -behavior -spec",c:[h]},n,e.QSM,l,t,f,o,{b:/\.$/}]}});hljs.registerLanguage("dsconfig",function(e){var i={cN:"string",b:/"/,e:/"/},r={cN:"string",b:/'/,e:/'/},s={cN:"string",b:"[\\w-?]+:\\w+",e:"\\W",r:0},t={cN:"string",b:"\\w+-?\\w+",e:"\\W",r:0};return{k:"dsconfig",c:[{cN:"keyword",b:"^dsconfig",e:"\\s",eE:!0,r:10},{cN:"built_in",b:"(list|create|get|set|delete)-(\\w+)",e:"\\s",eE:!0,i:"!@#$%^&*()",r:10},{cN:"built_in",b:"--(\\w+)",e:"\\s",eE:!0},i,r,s,t,e.HCM]}});hljs.registerLanguage("hy",function(e){var t={"builtin-name":"!= % %= & &= * ** **= *= *map + += , --build-class-- --import-- -= . / // //= /= < << <<= <= = > >= >> >>= @ @= ^ ^= abs accumulate all and any ap-compose ap-dotimes ap-each ap-each-while ap-filter ap-first ap-if ap-last ap-map ap-map-when ap-pipe ap-reduce ap-reject apply as-> ascii assert assoc bin break butlast callable calling-module-name car case cdr chain chr coll? combinations compile compress cond cons cons? continue count curry cut cycle dec def default-method defclass defmacro defmacro-alias defmacro/g! defmain defmethod defmulti defn defn-alias defnc defnr defreader defseq del delattr delete-route dict-comp dir disassemble dispatch-reader-macro distinct divmod do doto drop drop-last drop-while empty? end-sequence eval eval-and-compile eval-when-compile even? every? except exec filter first flatten float? fn fnc fnr for for* format fraction genexpr gensym get getattr global globals group-by hasattr hash hex id identity if if* if-not if-python2 import in inc input instance? integer integer-char? integer? interleave interpose is is-coll is-cons is-empty is-even is-every is-float is-instance is-integer is-integer-char is-iterable is-iterator is-keyword is-neg is-none is-not is-numeric is-odd is-pos is-string is-symbol is-zero isinstance islice issubclass iter iterable? iterate iterator? keyword keyword? lambda last len let lif lif-not list* list-comp locals loop macro-error macroexpand macroexpand-1 macroexpand-all map max merge-with method-decorator min multi-decorator multicombinations name neg? next none? nonlocal not not-in not? nth numeric? oct odd? open or ord partition permutations pos? post-route postwalk pow prewalk print product profile/calls profile/cpu put-route quasiquote quote raise range read read-str recursive-replace reduce remove repeat repeatedly repr require rest round route route-with-methods rwm second seq set-comp setattr setv some sorted string string? sum switch symbol? take take-nth take-while tee try unless unquote unquote-splicing vars walk when while with with* with-decorator with-gensyms xi xor yield yield-from zero? zip zip-longest | |= ~"},i="a-zA-Z_\\-!.?+*=<>&#'",a="["+i+"]["+i+"0-9/;:]*",r="[-+]?\\d+(\\.\\d+)?",o={cN:"meta",b:"^#!",e:"$"},s={b:a,r:0},n={cN:"number",b:r,r:0},l=e.inherit(e.QSM,{i:null}),c=e.C(";","$",{r:0}),d={cN:"literal",b:/\b([Tt]rue|[Ff]alse|nil|None)\b/},p={b:"[\\[\\{]",e:"[\\]\\}]"},m={cN:"comment",b:"\\^"+a},u=e.C("\\^\\{","\\}"),f={cN:"symbol",b:"[:]{1,2}"+a},h={b:"\\(",e:"\\)"},b={eW:!0,r:0},g={k:t,l:a,cN:"name",b:a,starts:b},y=[h,l,m,u,c,f,p,n,d,s];return h.c=[e.C("comment",""),g,b],b.c=y,p.c=y,{aliases:["hylang"],i:/\S/,c:[o,h,l,m,u,c,f,p,n,d]}});hljs.registerLanguage("nix",function(e){var r={keyword:"rec with let in inherit assert if else then",literal:"true false or and null",built_in:"import abort baseNameOf dirOf isNull builtins map removeAttrs throw toString derivation"},t={cN:"subst",b:/\$\{/,e:/}/,k:r},i={b:/[a-zA-Z0-9-_]+(\s*=)/,rB:!0,r:0,c:[{cN:"attr",b:/\S+/}]},s={cN:"string",c:[t],v:[{b:"''",e:"''"},{b:'"',e:'"'}]},a=[e.NM,e.HCM,e.CBCM,s,i];return t.c=a,{aliases:["nixos"],k:r,c:a}});hljs.registerLanguage("d",function(e){var t={keyword:"abstract alias align asm assert auto body break byte case cast catch class const continue debug default delete deprecated do else enum export extern final finally for foreach foreach_reverse|10 goto if immutable import in inout int interface invariant is lazy macro mixin module new nothrow out override package pragma private protected public pure ref return scope shared static struct super switch synchronized template this throw try typedef typeid typeof union unittest version void volatile while with __FILE__ __LINE__ __gshared|10 __thread __traits __DATE__ __EOF__ __TIME__ __TIMESTAMP__ __VENDOR__ __VERSION__",built_in:"bool cdouble cent cfloat char creal dchar delegate double dstring float function idouble ifloat ireal long real short string ubyte ucent uint ulong ushort wchar wstring",literal:"false null true"},r="(0|[1-9][\\d_]*)",a="(0|[1-9][\\d_]*|\\d[\\d_]*|[\\d_]+?\\d)",i="0[bB][01_]+",n="([\\da-fA-F][\\da-fA-F_]*|_[\\da-fA-F][\\da-fA-F_]*)",_="0[xX]"+n,c="([eE][+-]?"+a+")",d="("+a+"(\\.\\d*|"+c+")|\\d+\\."+a+a+"|\\."+r+c+"?)",o="(0[xX]("+n+"\\."+n+"|\\.?"+n+")[pP][+-]?"+a+")",s="("+r+"|"+i+"|"+_+")",l="("+o+"|"+d+")",u="\\\\(['\"\\?\\\\abfnrtv]|u[\\dA-Fa-f]{4}|[0-7]{1,3}|x[\\dA-Fa-f]{2}|U[\\dA-Fa-f]{8})|&[a-zA-Z\\d]{2,};",b={cN:"number",b:"\\b"+s+"(L|u|U|Lu|LU|uL|UL)?",r:0},f={cN:"number",b:"\\b("+l+"([fF]|L|i|[fF]i|Li)?|"+s+"(i|[fF]i|Li))",r:0},g={cN:"string",b:"'("+u+"|.)",e:"'",i:"."},h={b:u,r:0},p={cN:"string",b:'"',c:[h],e:'"[cwd]?'},m={cN:"string",b:'[rq]"',e:'"[cwd]?',r:5},w={cN:"string",b:"`",e:"`[cwd]?"},N={cN:"string",b:'x"[\\da-fA-F\\s\\n\\r]*"[cwd]?',r:10},A={cN:"string",b:'q"\\{',e:'\\}"'},F={cN:"meta",b:"^#!",e:"$",r:5},y={cN:"meta",b:"#(line)",e:"$",r:5},L={cN:"keyword",b:"@[a-zA-Z_][a-zA-Z_\\d]*"},v=e.C("\\/\\+","\\+\\/",{c:["self"],r:10});return{l:e.UIR,k:t,c:[e.CLCM,e.CBCM,v,N,p,m,w,A,f,b,g,F,y,L]}});hljs.registerLanguage("ldif",function(e){return{c:[{cN:"attribute",b:"^dn",e:": ",eE:!0,starts:{e:"$",r:0},r:10},{cN:"attribute",b:"^\\w",e:": ",eE:!0,starts:{e:"$",r:0}},{cN:"literal",b:"^-",e:"$"},e.HCM]}});hljs.registerLanguage("parser3",function(r){var e=r.C("{","}",{c:["self"]});return{sL:"xml",r:0,c:[r.C("^#","$"),r.C("\\^rem{","}",{r:10,c:[e]}),{cN:"meta",b:"^@(?:BASE|USE|CLASS|OPTIONS)$",r:10},{cN:"title",b:"@[\\w\\-]+\\[[\\w^;\\-]*\\](?:\\[[\\w^;\\-]*\\])?(?:.*)$"},{cN:"variable",b:"\\$\\{?[\\w\\-\\.\\:]+\\}?"},{cN:"keyword",b:"\\^[\\w\\-\\.\\:]+"},{cN:"number",b:"\\^#[0-9a-fA-F]+"},r.CNM]}});hljs.registerLanguage("stata",function(e){return{aliases:["do","ado"],cI:!0,k:"if else in foreach for forv forva forval forvalu forvalue forvalues by bys bysort xi quietly qui capture about ac ac_7 acprplot acprplot_7 adjust ado adopath adoupdate alpha ameans an ano anov anova anova_estat anova_terms anovadef aorder ap app appe appen append arch arch_dr arch_estat arch_p archlm areg areg_p args arima arima_dr arima_estat arima_p as asmprobit asmprobit_estat asmprobit_lf asmprobit_mfx__dlg asmprobit_p ass asse asser assert avplot avplot_7 avplots avplots_7 bcskew0 bgodfrey binreg bip0_lf biplot bipp_lf bipr_lf bipr_p biprobit bitest bitesti bitowt blogit bmemsize boot bootsamp bootstrap bootstrap_8 boxco_l boxco_p boxcox boxcox_6 boxcox_p bprobit br break brier bro brow brows browse brr brrstat bs bs_7 bsampl_w bsample bsample_7 bsqreg bstat bstat_7 bstat_8 bstrap bstrap_7 ca ca_estat ca_p cabiplot camat canon canon_8 canon_8_p canon_estat canon_p cap caprojection capt captu captur capture cat cc cchart cchart_7 cci cd censobs_table centile cf char chdir checkdlgfiles checkestimationsample checkhlpfiles checksum chelp ci cii cl class classutil clear cli clis clist clo clog clog_lf clog_p clogi clogi_sw clogit clogit_lf clogit_p clogitp clogl_sw cloglog clonevar clslistarray cluster cluster_measures cluster_stop cluster_tree cluster_tree_8 clustermat cmdlog cnr cnre cnreg cnreg_p cnreg_sw cnsreg codebook collaps4 collapse colormult_nb colormult_nw compare compress conf confi confir confirm conren cons const constr constra constrai constrain constraint continue contract copy copyright copysource cor corc corr corr2data corr_anti corr_kmo corr_smc corre correl correla correlat correlate corrgram cou coun count cox cox_p cox_sw coxbase coxhaz coxvar cprplot cprplot_7 crc cret cretu cretur creturn cross cs cscript cscript_log csi ct ct_is ctset ctst_5 ctst_st cttost cumsp cumsp_7 cumul cusum cusum_7 cutil d|0 datasig datasign datasigna datasignat datasignatu datasignatur datasignature datetof db dbeta de dec deco decod decode deff des desc descr descri describ describe destring dfbeta dfgls dfuller di di_g dir dirstats dis discard disp disp_res disp_s displ displa display distinct do doe doed doedi doedit dotplot dotplot_7 dprobit drawnorm drop ds ds_util dstdize duplicates durbina dwstat dydx e|0 ed edi edit egen eivreg emdef en enc enco encod encode eq erase ereg ereg_lf ereg_p ereg_sw ereghet ereghet_glf ereghet_glf_sh ereghet_gp ereghet_ilf ereghet_ilf_sh ereghet_ip eret eretu eretur ereturn err erro error est est_cfexist est_cfname est_clickable est_expand est_hold est_table est_unhold est_unholdok estat estat_default estat_summ estat_vce_only esti estimates etodow etof etomdy ex exi exit expand expandcl fac fact facto factor factor_estat factor_p factor_pca_rotated factor_rotate factormat fcast fcast_compute fcast_graph fdades fdadesc fdadescr fdadescri fdadescrib fdadescribe fdasav fdasave fdause fh_st file open file read file close file filefilter fillin find_hlp_file findfile findit findit_7 fit fl fli flis flist for5_0 form forma format fpredict frac_154 frac_adj frac_chk frac_cox frac_ddp frac_dis frac_dv frac_in frac_mun frac_pp frac_pq frac_pv frac_wgt frac_xo fracgen fracplot fracplot_7 fracpoly fracpred fron_ex fron_hn fron_p fron_tn fron_tn2 frontier ftodate ftoe ftomdy ftowdate g|0 gamhet_glf gamhet_gp gamhet_ilf gamhet_ip gamma gamma_d2 gamma_p gamma_sw gammahet gdi_hexagon gdi_spokes ge gen gene gener genera generat generate genrank genstd genvmean gettoken gl gladder gladder_7 glim_l01 glim_l02 glim_l03 glim_l04 glim_l05 glim_l06 glim_l07 glim_l08 glim_l09 glim_l10 glim_l11 glim_l12 glim_lf glim_mu glim_nw1 glim_nw2 glim_nw3 glim_p glim_v1 glim_v2 glim_v3 glim_v4 glim_v5 glim_v6 glim_v7 glm glm_6 glm_p glm_sw glmpred glo glob globa global glogit glogit_8 glogit_p gmeans gnbre_lf gnbreg gnbreg_5 gnbreg_p gomp_lf gompe_sw gomper_p gompertz gompertzhet gomphet_glf gomphet_glf_sh gomphet_gp gomphet_ilf gomphet_ilf_sh gomphet_ip gphdot gphpen gphprint gprefs gprobi_p gprobit gprobit_8 gr gr7 gr_copy gr_current gr_db gr_describe gr_dir gr_draw gr_draw_replay gr_drop gr_edit gr_editviewopts gr_example gr_example2 gr_export gr_print gr_qscheme gr_query gr_read gr_rename gr_replay gr_save gr_set gr_setscheme gr_table gr_undo gr_use graph graph7 grebar greigen greigen_7 greigen_8 grmeanby grmeanby_7 gs_fileinfo gs_filetype gs_graphinfo gs_stat gsort gwood h|0 hadimvo hareg hausman haver he heck_d2 heckma_p heckman heckp_lf heckpr_p heckprob hel help hereg hetpr_lf hetpr_p hetprob hettest hexdump hilite hist hist_7 histogram hlogit hlu hmeans hotel hotelling hprobit hreg hsearch icd9 icd9_ff icd9p iis impute imtest inbase include inf infi infil infile infix inp inpu input ins insheet insp inspe inspec inspect integ inten intreg intreg_7 intreg_p intrg2_ll intrg_ll intrg_ll2 ipolate iqreg ir irf irf_create irfm iri is_svy is_svysum isid istdize ivprob_1_lf ivprob_lf ivprobit ivprobit_p ivreg ivreg_footnote ivtob_1_lf ivtob_lf ivtobit ivtobit_p jackknife jacknife jknife jknife_6 jknife_8 jkstat joinby kalarma1 kap kap_3 kapmeier kappa kapwgt kdensity kdensity_7 keep ksm ksmirnov ktau kwallis l|0 la lab labe label labelbook ladder levels levelsof leverage lfit lfit_p li lincom line linktest lis list lloghet_glf lloghet_glf_sh lloghet_gp lloghet_ilf lloghet_ilf_sh lloghet_ip llogi_sw llogis_p llogist llogistic llogistichet lnorm_lf lnorm_sw lnorma_p lnormal lnormalhet lnormhet_glf lnormhet_glf_sh lnormhet_gp lnormhet_ilf lnormhet_ilf_sh lnormhet_ip lnskew0 loadingplot loc loca local log logi logis_lf logistic logistic_p logit logit_estat logit_p loglogs logrank loneway lookfor lookup lowess lowess_7 lpredict lrecomp lroc lroc_7 lrtest ls lsens lsens_7 lsens_x lstat ltable ltable_7 ltriang lv lvr2plot lvr2plot_7 m|0 ma mac macr macro makecns man manova manova_estat manova_p manovatest mantel mark markin markout marksample mat mat_capp mat_order mat_put_rr mat_rapp mata mata_clear mata_describe mata_drop mata_matdescribe mata_matsave mata_matuse mata_memory mata_mlib mata_mosave mata_rename mata_which matalabel matcproc matlist matname matr matri matrix matrix_input__dlg matstrik mcc mcci md0_ md1_ md1debug_ md2_ md2debug_ mds mds_estat mds_p mdsconfig mdslong mdsmat mdsshepard mdytoe mdytof me_derd mean means median memory memsize meqparse mer merg merge mfp mfx mhelp mhodds minbound mixed_ll mixed_ll_reparm mkassert mkdir mkmat mkspline ml ml_5 ml_adjs ml_bhhhs ml_c_d ml_check ml_clear ml_cnt ml_debug ml_defd ml_e0 ml_e0_bfgs ml_e0_cycle ml_e0_dfp ml_e0i ml_e1 ml_e1_bfgs ml_e1_bhhh ml_e1_cycle ml_e1_dfp ml_e2 ml_e2_cycle ml_ebfg0 ml_ebfr0 ml_ebfr1 ml_ebh0q ml_ebhh0 ml_ebhr0 ml_ebr0i ml_ecr0i ml_edfp0 ml_edfr0 ml_edfr1 ml_edr0i ml_eds ml_eer0i ml_egr0i ml_elf ml_elf_bfgs ml_elf_bhhh ml_elf_cycle ml_elf_dfp ml_elfi ml_elfs ml_enr0i ml_enrr0 ml_erdu0 ml_erdu0_bfgs ml_erdu0_bhhh ml_erdu0_bhhhq ml_erdu0_cycle ml_erdu0_dfp ml_erdu0_nrbfgs ml_exde ml_footnote ml_geqnr ml_grad0 ml_graph ml_hbhhh ml_hd0 ml_hold ml_init ml_inv ml_log ml_max ml_mlout ml_mlout_8 ml_model ml_nb0 ml_opt ml_p ml_plot ml_query ml_rdgrd ml_repor ml_s_e ml_score ml_searc ml_technique ml_unhold mleval mlf_ mlmatbysum mlmatsum mlog mlogi mlogit mlogit_footnote mlogit_p mlopts mlsum mlvecsum mnl0_ mor more mov move mprobit mprobit_lf mprobit_p mrdu0_ mrdu1_ mvdecode mvencode mvreg mvreg_estat n|0 nbreg nbreg_al nbreg_lf nbreg_p nbreg_sw nestreg net newey newey_7 newey_p news nl nl_7 nl_9 nl_9_p nl_p nl_p_7 nlcom nlcom_p nlexp2 nlexp2_7 nlexp2a nlexp2a_7 nlexp3 nlexp3_7 nlgom3 nlgom3_7 nlgom4 nlgom4_7 nlinit nllog3 nllog3_7 nllog4 nllog4_7 nlog_rd nlogit nlogit_p nlogitgen nlogittree nlpred no nobreak noi nois noisi noisil noisily note notes notes_dlg nptrend numlabel numlist odbc old_ver olo olog ologi ologi_sw ologit ologit_p ologitp on one onew onewa oneway op_colnm op_comp op_diff op_inv op_str opr opro oprob oprob_sw oprobi oprobi_p oprobit oprobitp opts_exclusive order orthog orthpoly ou out outf outfi outfil outfile outs outsh outshe outshee outsheet ovtest pac pac_7 palette parse parse_dissim pause pca pca_8 pca_display pca_estat pca_p pca_rotate pcamat pchart pchart_7 pchi pchi_7 pcorr pctile pentium pergram pergram_7 permute permute_8 personal peto_st pkcollapse pkcross pkequiv pkexamine pkexamine_7 pkshape pksumm pksumm_7 pl plo plot plugin pnorm pnorm_7 poisgof poiss_lf poiss_sw poisso_p poisson poisson_estat post postclose postfile postutil pperron pr prais prais_e prais_e2 prais_p predict predictnl preserve print pro prob probi probit probit_estat probit_p proc_time procoverlay procrustes procrustes_estat procrustes_p profiler prog progr progra program prop proportion prtest prtesti pwcorr pwd q\\s qby qbys qchi qchi_7 qladder qladder_7 qnorm qnorm_7 qqplot qqplot_7 qreg qreg_c qreg_p qreg_sw qu quadchk quantile quantile_7 que quer query range ranksum ratio rchart rchart_7 rcof recast reclink recode reg reg3 reg3_p regdw regr regre regre_p2 regres regres_p regress regress_estat regriv_p remap ren rena renam rename renpfix repeat replace report reshape restore ret retu retur return rm rmdir robvar roccomp roccomp_7 roccomp_8 rocf_lf rocfit rocfit_8 rocgold rocplot rocplot_7 roctab roctab_7 rolling rologit rologit_p rot rota rotat rotate rotatemat rreg rreg_p ru run runtest rvfplot rvfplot_7 rvpplot rvpplot_7 sa safesum sample sampsi sav save savedresults saveold sc sca scal scala scalar scatter scm_mine sco scob_lf scob_p scobi_sw scobit scor score scoreplot scoreplot_help scree screeplot screeplot_help sdtest sdtesti se search separate seperate serrbar serrbar_7 serset set set_defaults sfrancia sh she shel shell shewhart shewhart_7 signestimationsample signrank signtest simul simul_7 simulate simulate_8 sktest sleep slogit slogit_d2 slogit_p smooth snapspan so sor sort spearman spikeplot spikeplot_7 spikeplt spline_x split sqreg sqreg_p sret sretu sretur sreturn ssc st st_ct st_hc st_hcd st_hcd_sh st_is st_issys st_note st_promo st_set st_show st_smpl st_subid stack statsby statsby_8 stbase stci stci_7 stcox stcox_estat stcox_fr stcox_fr_ll stcox_p stcox_sw stcoxkm stcoxkm_7 stcstat stcurv stcurve stcurve_7 stdes stem stepwise stereg stfill stgen stir stjoin stmc stmh stphplot stphplot_7 stphtest stphtest_7 stptime strate strate_7 streg streg_sw streset sts sts_7 stset stsplit stsum sttocc sttoct stvary stweib su suest suest_8 sum summ summa summar summari summariz summarize sunflower sureg survcurv survsum svar svar_p svmat svy svy_disp svy_dreg svy_est svy_est_7 svy_estat svy_get svy_gnbreg_p svy_head svy_header svy_heckman_p svy_heckprob_p svy_intreg_p svy_ivreg_p svy_logistic_p svy_logit_p svy_mlogit_p svy_nbreg_p svy_ologit_p svy_oprobit_p svy_poisson_p svy_probit_p svy_regress_p svy_sub svy_sub_7 svy_x svy_x_7 svy_x_p svydes svydes_8 svygen svygnbreg svyheckman svyheckprob svyintreg svyintreg_7 svyintrg svyivreg svylc svylog_p svylogit svymarkout svymarkout_8 svymean svymlog svymlogit svynbreg svyolog svyologit svyoprob svyoprobit svyopts svypois svypois_7 svypoisson svyprobit svyprobt svyprop svyprop_7 svyratio svyreg svyreg_p svyregress svyset svyset_7 svyset_8 svytab svytab_7 svytest svytotal sw sw_8 swcnreg swcox swereg swilk swlogis swlogit swologit swoprbt swpois swprobit swqreg swtobit swweib symmetry symmi symplot symplot_7 syntax sysdescribe sysdir sysuse szroeter ta tab tab1 tab2 tab_or tabd tabdi tabdis tabdisp tabi table tabodds tabodds_7 tabstat tabu tabul tabula tabulat tabulate te tempfile tempname tempvar tes test testnl testparm teststd tetrachoric time_it timer tis tob tobi tobit tobit_p tobit_sw token tokeni tokeniz tokenize tostring total translate translator transmap treat_ll treatr_p treatreg trim trnb_cons trnb_mean trpoiss_d2 trunc_ll truncr_p truncreg tsappend tset tsfill tsline tsline_ex tsreport tsrevar tsrline tsset tssmooth tsunab ttest ttesti tut_chk tut_wait tutorial tw tware_st two twoway twoway__fpfit_serset twoway__function_gen twoway__histogram_gen twoway__ipoint_serset twoway__ipoints_serset twoway__kdensity_gen twoway__lfit_serset twoway__normgen_gen twoway__pci_serset twoway__qfit_serset twoway__scatteri_serset twoway__sunflower_gen twoway_ksm_serset ty typ type typeof u|0 unab unabbrev unabcmd update us use uselabel var var_mkcompanion var_p varbasic varfcast vargranger varirf varirf_add varirf_cgraph varirf_create varirf_ctable varirf_describe varirf_dir varirf_drop varirf_erase varirf_graph varirf_ograph varirf_rename varirf_set varirf_table varlist varlmar varnorm varsoc varstable varstable_w varstable_w2 varwle vce vec vec_fevd vec_mkphi vec_p vec_p_w vecirf_create veclmar veclmar_w vecnorm vecnorm_w vecrank vecstable verinst vers versi versio version view viewsource vif vwls wdatetof webdescribe webseek webuse weib1_lf weib2_lf weib_lf weib_lf0 weibhet_glf weibhet_glf_sh weibhet_glfa weibhet_glfa_sh weibhet_gp weibhet_ilf weibhet_ilf_sh weibhet_ilfa weibhet_ilfa_sh weibhet_ip weibu_sw weibul_p weibull weibull_c weibull_s weibullhet wh whelp whi which whil while wilc_st wilcoxon win wind windo window winexec wntestb wntestb_7 wntestq xchart xchart_7 xcorr xcorr_7 xi xi_6 xmlsav xmlsave xmluse xpose xsh xshe xshel xshell xt_iis xt_tis xtab_p xtabond xtbin_p xtclog xtcloglog xtcloglog_8 xtcloglog_d2 xtcloglog_pa_p xtcloglog_re_p xtcnt_p xtcorr xtdata xtdes xtfront_p xtfrontier xtgee xtgee_elink xtgee_estat xtgee_makeivar xtgee_p xtgee_plink xtgls xtgls_p xthaus xthausman xtht_p xthtaylor xtile xtint_p xtintreg xtintreg_8 xtintreg_d2 xtintreg_p xtivp_1 xtivp_2 xtivreg xtline xtline_ex xtlogit xtlogit_8 xtlogit_d2 xtlogit_fe_p xtlogit_pa_p xtlogit_re_p xtmixed xtmixed_estat xtmixed_p xtnb_fe xtnb_lf xtnbreg xtnbreg_pa_p xtnbreg_refe_p xtpcse xtpcse_p xtpois xtpoisson xtpoisson_d2 xtpoisson_pa_p xtpoisson_refe_p xtpred xtprobit xtprobit_8 xtprobit_d2 xtprobit_re_p xtps_fe xtps_lf xtps_ren xtps_ren_8 xtrar_p xtrc xtrc_p xtrchh xtrefe_p xtreg xtreg_be xtreg_fe xtreg_ml xtreg_pa_p xtreg_re xtregar xtrere_p xtset xtsf_ll xtsf_llti xtsum xttab xttest0 xttobit xttobit_8 xttobit_p xttrans yx yxview__barlike_draw yxview_area_draw yxview_bar_draw yxview_dot_draw yxview_dropline_draw yxview_function_draw yxview_iarrow_draw yxview_ilabels_draw yxview_normal_draw yxview_pcarrow_draw yxview_pcbarrow_draw yxview_pccapsym_draw yxview_pcscatter_draw yxview_pcspike_draw yxview_rarea_draw yxview_rbar_draw yxview_rbarm_draw yxview_rcap_draw yxview_rcapsym_draw yxview_rconnected_draw yxview_rline_draw yxview_rscatter_draw yxview_rspike_draw yxview_spike_draw yxview_sunflower_draw zap_s zinb zinb_llf zinb_plf zip zip_llf zip_p zip_plf zt_ct_5 zt_hc_5 zt_hcd_5 zt_is_5 zt_iss_5 zt_sho_5 zt_smp_5 ztbase_5 ztcox_5 ztdes_5 ztereg_5 ztfill_5 ztgen_5 ztir_5 ztjoin_5 ztnb ztnb_p ztp ztp_p zts_5 ztset_5 ztspli_5 ztsum_5 zttoct_5 ztvary_5 ztweib_5",c:[{cN:"symbol",b:/`[a-zA-Z0-9_]+'/},{cN:"variable",b:/\$\{?[a-zA-Z0-9_]+\}?/},{cN:"string",v:[{b:'`"[^\r\n]*?"\''},{b:'"[^\r\n"]*"'}]},{cN:"built_in",v:[{b:"\\b(abs|acos|asin|atan|atan2|atanh|ceil|cloglog|comb|cos|digamma|exp|floor|invcloglog|invlogit|ln|lnfact|lnfactorial|lngamma|log|log10|max|min|mod|reldif|round|sign|sin|sqrt|sum|tan|tanh|trigamma|trunc|betaden|Binomial|binorm|binormal|chi2|chi2tail|dgammapda|dgammapdada|dgammapdadx|dgammapdx|dgammapdxdx|F|Fden|Ftail|gammaden|gammap|ibeta|invbinomial|invchi2|invchi2tail|invF|invFtail|invgammap|invibeta|invnchi2|invnFtail|invnibeta|invnorm|invnormal|invttail|nbetaden|nchi2|nFden|nFtail|nibeta|norm|normal|normalden|normd|npnchi2|tden|ttail|uniform|abbrev|char|index|indexnot|length|lower|ltrim|match|plural|proper|real|regexm|regexr|regexs|reverse|rtrim|string|strlen|strlower|strltrim|strmatch|strofreal|strpos|strproper|strreverse|strrtrim|strtrim|strupper|subinstr|subinword|substr|trim|upper|word|wordcount|_caller|autocode|byteorder|chop|clip|cond|e|epsdouble|epsfloat|group|inlist|inrange|irecode|matrix|maxbyte|maxdouble|maxfloat|maxint|maxlong|mi|minbyte|mindouble|minfloat|minint|minlong|missing|r|recode|replay|return|s|scalar|d|date|day|dow|doy|halfyear|mdy|month|quarter|week|year|d|daily|dofd|dofh|dofm|dofq|dofw|dofy|h|halfyearly|hofd|m|mofd|monthly|q|qofd|quarterly|tin|twithin|w|weekly|wofd|y|yearly|yh|ym|yofd|yq|yw|cholesky|colnumb|colsof|corr|det|diag|diag0cnt|el|get|hadamard|I|inv|invsym|issym|issymmetric|J|matmissing|matuniform|mreldif|nullmat|rownumb|rowsof|sweep|syminv|trace|vec|vecdiag)(?=\\(|$)"}]},e.C("^[ ]*\\*.*$",!1),e.CLCM,e.CBCM]}});hljs.registerLanguage("qml",function(r){var e={keyword:"in of on if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await import",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Behavior bool color coordinate date double enumeration font geocircle georectangle geoshape int list matrix4x4 parent point quaternion real rect size string url var variant vector2d vector3d vector4dPromise"},t="[a-zA-Z_][a-zA-Z0-9\\._]*",a={cN:"keyword",b:"\\bproperty\\b",starts:{cN:"string",e:"(:|=|;|,|//|/\\*|$)",rE:!0}},n={cN:"keyword",b:"\\bsignal\\b",starts:{cN:"string",e:"(\\(|:|=|;|,|//|/\\*|$)",rE:!0}},o={cN:"attribute",b:"\\bid\\s*:",starts:{cN:"string",e:t,rE:!1}},i={b:t+"\\s*:",rB:!0,c:[{cN:"attribute",b:t,e:"\\s*:",eE:!0,r:0}],r:0},c={b:t+"\\s*{",e:"{",rB:!0,r:0,c:[r.inherit(r.TM,{b:t})]};return{aliases:["qt"],cI:!1,k:e,c:[{cN:"meta",b:/^\s*['"]use (strict|asm)['"]/},r.ASM,r.QSM,{cN:"string",b:"`",e:"`",c:[r.BE,{cN:"subst",b:"\\$\\{",e:"\\}"}]},r.CLCM,r.CBCM,{cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:r.CNR}],r:0},{b:"("+r.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[r.CLCM,r.CBCM,r.RM,{b:/\s*[);\]]/,r:0,sL:"xml"}],r:0},n,a,{cN:"function",bK:"function",e:/\{/,eE:!0,c:[r.inherit(r.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:[r.CLCM,r.CBCM]}],i:/\[|%/},{b:"\\."+r.IR,r:0},o,i,c],i:/#/}});hljs.registerLanguage("irpf90",function(e){var t={cN:"params",b:"\\(",e:"\\)"},n={literal:".False. .True.",keyword:"kind do while private call intrinsic where elsewhere type endtype endmodule endselect endinterface end enddo endif if forall endforall only contains default return stop then public subroutine|10 function program .and. .or. .not. .le. .eq. .ge. .gt. .lt. goto save else use module select case access blank direct exist file fmt form formatted iostat name named nextrec number opened rec recl sequential status unformatted unit continue format pause cycle exit c_null_char c_alert c_backspace c_form_feed flush wait decimal round iomsg synchronous nopass non_overridable pass protected volatile abstract extends import non_intrinsic value deferred generic final enumerator class associate bind enum c_int c_short c_long c_long_long c_signed_char c_size_t c_int8_t c_int16_t c_int32_t c_int64_t c_int_least8_t c_int_least16_t c_int_least32_t c_int_least64_t c_int_fast8_t c_int_fast16_t c_int_fast32_t c_int_fast64_t c_intmax_t C_intptr_t c_float c_double c_long_double c_float_complex c_double_complex c_long_double_complex c_bool c_char c_null_ptr c_null_funptr c_new_line c_carriage_return c_horizontal_tab c_vertical_tab iso_c_binding c_loc c_funloc c_associated c_f_pointer c_ptr c_funptr iso_fortran_env character_storage_size error_unit file_storage_size input_unit iostat_end iostat_eor numeric_storage_size output_unit c_f_procpointer ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode newunit contiguous recursive pad position action delim readwrite eor advance nml interface procedure namelist include sequence elemental pure integer real character complex logical dimension allocatable|10 parameter external implicit|10 none double precision assign intent optional pointer target in out common equivalence data begin_provider &begin_provider end_provider begin_shell end_shell begin_template end_template subst assert touch soft_touch provide no_dep free irp_if irp_else irp_endif irp_write irp_read",built_in:"alog alog10 amax0 amax1 amin0 amin1 amod cabs ccos cexp clog csin csqrt dabs dacos dasin datan datan2 dcos dcosh ddim dexp dint dlog dlog10 dmax1 dmin1 dmod dnint dsign dsin dsinh dsqrt dtan dtanh float iabs idim idint idnint ifix isign max0 max1 min0 min1 sngl algama cdabs cdcos cdexp cdlog cdsin cdsqrt cqabs cqcos cqexp cqlog cqsin cqsqrt dcmplx dconjg derf derfc dfloat dgamma dimag dlgama iqint qabs qacos qasin qatan qatan2 qcmplx qconjg qcos qcosh qdim qerf qerfc qexp qgamma qimag qlgama qlog qlog10 qmax1 qmin1 qmod qnint qsign qsin qsinh qsqrt qtan qtanh abs acos aimag aint anint asin atan atan2 char cmplx conjg cos cosh exp ichar index int log log10 max min nint sign sin sinh sqrt tan tanh print write dim lge lgt lle llt mod nullify allocate deallocate adjustl adjustr all allocated any associated bit_size btest ceiling count cshift date_and_time digits dot_product eoshift epsilon exponent floor fraction huge iand ibclr ibits ibset ieor ior ishft ishftc lbound len_trim matmul maxexponent maxloc maxval merge minexponent minloc minval modulo mvbits nearest pack present product radix random_number random_seed range repeat reshape rrspacing scale scan selected_int_kind selected_real_kind set_exponent shape size spacing spread sum system_clock tiny transpose trim ubound unpack verify achar iachar transfer dble entry dprod cpu_time command_argument_count get_command get_command_argument get_environment_variable is_iostat_end ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode is_iostat_eor move_alloc new_line selected_char_kind same_type_as extends_type_ofacosh asinh atanh bessel_j0 bessel_j1 bessel_jn bessel_y0 bessel_y1 bessel_yn erf erfc erfc_scaled gamma log_gamma hypot norm2 atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr num_images parity popcnt poppar shifta shiftl shiftr this_image IRP_ALIGN irp_here"};return{cI:!0,k:n,i:/\/\*/,c:[e.inherit(e.ASM,{cN:"string",r:0}),e.inherit(e.QSM,{cN:"string",r:0}),{cN:"function",bK:"subroutine function program",i:"[${=\\n]",c:[e.UTM,t]},e.C("!","$",{r:0}),e.C("begin_doc","end_doc",{r:10}),{cN:"number",b:"(?=\\b|\\+|\\-|\\.)(?=\\.\\d|\\d)(?:\\d+)?(?:\\.?\\d*)(?:[de][+-]?\\d+)?\\b\\.?",r:0}]}});hljs.registerLanguage("ruleslanguage",function(T){return{k:{keyword:"BILL_PERIOD BILL_START BILL_STOP RS_EFFECTIVE_START RS_EFFECTIVE_STOP RS_JURIS_CODE RS_OPCO_CODE INTDADDATTRIBUTE|5 INTDADDVMSG|5 INTDBLOCKOP|5 INTDBLOCKOPNA|5 INTDCLOSE|5 INTDCOUNT|5 INTDCOUNTSTATUSCODE|5 INTDCREATEMASK|5 INTDCREATEDAYMASK|5 INTDCREATEFACTORMASK|5 INTDCREATEHANDLE|5 INTDCREATEOVERRIDEDAYMASK|5 INTDCREATEOVERRIDEMASK|5 INTDCREATESTATUSCODEMASK|5 INTDCREATETOUPERIOD|5 INTDDELETE|5 INTDDIPTEST|5 INTDEXPORT|5 INTDGETERRORCODE|5 INTDGETERRORMESSAGE|5 INTDISEQUAL|5 INTDJOIN|5 INTDLOAD|5 INTDLOADACTUALCUT|5 INTDLOADDATES|5 INTDLOADHIST|5 INTDLOADLIST|5 INTDLOADLISTDATES|5 INTDLOADLISTENERGY|5 INTDLOADLISTHIST|5 INTDLOADRELATEDCHANNEL|5 INTDLOADSP|5 INTDLOADSTAGING|5 INTDLOADUOM|5 INTDLOADUOMDATES|5 INTDLOADUOMHIST|5 INTDLOADVERSION|5 INTDOPEN|5 INTDREADFIRST|5 INTDREADNEXT|5 INTDRECCOUNT|5 INTDRELEASE|5 INTDREPLACE|5 INTDROLLAVG|5 INTDROLLPEAK|5 INTDSCALAROP|5 INTDSCALE|5 INTDSETATTRIBUTE|5 INTDSETDSTPARTICIPANT|5 INTDSETSTRING|5 INTDSETVALUE|5 INTDSETVALUESTATUS|5 INTDSHIFTSTARTTIME|5 INTDSMOOTH|5 INTDSORT|5 INTDSPIKETEST|5 INTDSUBSET|5 INTDTOU|5 INTDTOURELEASE|5 INTDTOUVALUE|5 INTDUPDATESTATS|5 INTDVALUE|5 STDEV INTDDELETEEX|5 INTDLOADEXACTUAL|5 INTDLOADEXCUT|5 INTDLOADEXDATES|5 INTDLOADEX|5 INTDLOADEXRELATEDCHANNEL|5 INTDSAVEEX|5 MVLOAD|5 MVLOADACCT|5 MVLOADACCTDATES|5 MVLOADACCTHIST|5 MVLOADDATES|5 MVLOADHIST|5 MVLOADLIST|5 MVLOADLISTDATES|5 MVLOADLISTHIST|5 IF FOR NEXT DONE SELECT END CALL ABORT CLEAR CHANNEL FACTOR LIST NUMBER OVERRIDE SET WEEK DISTRIBUTIONNODE ELSE WHEN THEN OTHERWISE IENUM CSV INCLUDE LEAVE RIDER SAVE DELETE NOVALUE SECTION WARN SAVE_UPDATE DETERMINANT LABEL REPORT REVENUE EACH IN FROM TOTAL CHARGE BLOCK AND OR CSV_FILE RATE_CODE AUXILIARY_DEMAND UIDACCOUNT RS BILL_PERIOD_SELECT HOURS_PER_MONTH INTD_ERROR_STOP SEASON_SCHEDULE_NAME ACCOUNTFACTOR ARRAYUPPERBOUND CALLSTOREDPROC GETADOCONNECTION GETCONNECT GETDATASOURCE GETQUALIFIER GETUSERID HASVALUE LISTCOUNT LISTOP LISTUPDATE LISTVALUE PRORATEFACTOR RSPRORATE SETBINPATH SETDBMONITOR WQ_OPEN BILLINGHOURS DATE DATEFROMFLOAT DATETIMEFROMSTRING DATETIMETOSTRING DATETOFLOAT DAY DAYDIFF DAYNAME DBDATETIME HOUR MINUTE MONTH MONTHDIFF MONTHHOURS MONTHNAME ROUNDDATE SAMEWEEKDAYLASTYEAR SECOND WEEKDAY WEEKDIFF YEAR YEARDAY YEARSTR COMPSUM HISTCOUNT HISTMAX HISTMIN HISTMINNZ HISTVALUE MAXNRANGE MAXRANGE MINRANGE COMPIKVA COMPKVA COMPKVARFROMKQKW COMPLF IDATTR FLAG LF2KW LF2KWH MAXKW POWERFACTOR READING2USAGE AVGSEASON MAXSEASON MONTHLYMERGE SEASONVALUE SUMSEASON ACCTREADDATES ACCTTABLELOAD CONFIGADD CONFIGGET CREATEOBJECT CREATEREPORT EMAILCLIENT EXPBLKMDMUSAGE EXPMDMUSAGE EXPORT_USAGE FACTORINEFFECT GETUSERSPECIFIEDSTOP INEFFECT ISHOLIDAY RUNRATE SAVE_PROFILE SETREPORTTITLE USEREXIT WATFORRUNRATE TO TABLE ACOS ASIN ATAN ATAN2 BITAND CEIL COS COSECANT COSH COTANGENT DIVQUOT DIVREM EXP FABS FLOOR FMOD FREPM FREXPN LOG LOG10 MAX MAXN MIN MINNZ MODF POW ROUND ROUND2VALUE ROUNDINT SECANT SIN SINH SQROOT TAN TANH FLOAT2STRING FLOAT2STRINGNC INSTR LEFT LEN LTRIM MID RIGHT RTRIM STRING STRINGNC TOLOWER TOUPPER TRIM NUMDAYS READ_DATE STAGING",built_in:"IDENTIFIER OPTIONS XML_ELEMENT XML_OP XML_ELEMENT_OF DOMDOCCREATE DOMDOCLOADFILE DOMDOCLOADXML DOMDOCSAVEFILE DOMDOCGETROOT DOMDOCADDPI DOMNODEGETNAME DOMNODEGETTYPE DOMNODEGETVALUE DOMNODEGETCHILDCT DOMNODEGETFIRSTCHILD DOMNODEGETSIBLING DOMNODECREATECHILDELEMENT DOMNODESETATTRIBUTE DOMNODEGETCHILDELEMENTCT DOMNODEGETFIRSTCHILDELEMENT DOMNODEGETSIBLINGELEMENT DOMNODEGETATTRIBUTECT DOMNODEGETATTRIBUTEI DOMNODEGETATTRIBUTEBYNAME DOMNODEGETBYNAME"},c:[T.CLCM,T.CBCM,T.ASM,T.QSM,T.CNM,{cN:"literal",v:[{b:"#\\s+[a-zA-Z\\ \\.]*",r:0},{b:"#[a-zA-Z\\ \\.]+"}]}]}});hljs.registerLanguage("inform7",function(e){var r="\\[",o="\\]";return{aliases:["i7"],cI:!0,k:{keyword:"thing room person man woman animal container supporter backdrop door scenery open closed locked inside gender is are say understand kind of rule"},c:[{cN:"string",b:'"',e:'"',r:0,c:[{cN:"subst",b:r,e:o}]},{cN:"section",b:/^(Volume|Book|Part|Chapter|Section|Table)\b/,e:"$"},{b:/^(Check|Carry out|Report|Instead of|To|Rule|When|Before|After)\b/,e:":",c:[{b:"\\(This",e:"\\)"}]},{cN:"comment",b:r,e:o,c:["self"]}]}});hljs.registerLanguage("elixir",function(e){var r="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?",n="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",b="and false then defined module in return redo retry end for true self when next until do begin unless nil break not case cond alias while ensure or include use alias fn quote",c={cN:"subst",b:"#\\{",e:"}",l:r,k:b},a={cN:"string",c:[e.BE,c],v:[{b:/'/,e:/'/},{b:/"/,e:/"/}]},i={cN:"function",bK:"def defp defmacro",e:/\B\b/,c:[e.inherit(e.TM,{b:r,endsParent:!0})]},l=e.inherit(i,{cN:"class",bK:"defimpl defmodule defprotocol defrecord",e:/\bdo\b|$|;/}),s=[a,e.HCM,l,i,{cN:"symbol",b:":(?!\\s)",c:[a,{b:n}],r:0},{cN:"symbol",b:r+":",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"->"},{b:"("+e.RSR+")\\s*",c:[e.HCM,{cN:"regexp",i:"\\n",c:[e.BE,c],v:[{b:"/",e:"/[a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}],r:0}];return c.c=s,{l:r,k:b,c:s}});hljs.registerLanguage("ebnf",function(a){var e=a.C(/\(\*/,/\*\)/),t={cN:"attribute",b:/^[ ]*[a-zA-Z][a-zA-Z-]*([\s-]+[a-zA-Z][a-zA-Z]*)*/},r={cN:"meta",b:/\?.*\?/},b={b:/=/,e:/;/,c:[e,r,a.ASM,a.QSM]};return{i:/\S/,c:[e,t,b]}});hljs.registerLanguage("objectivec",function(e){var t={cN:"built_in",b:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},_={keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign readwrite self @synchronized id typeof nonatomic super unichar IBOutlet IBAction strong weak copy in out inout bycopy byref oneway __strong __weak __block __autoreleasing @private @protected @public @try @property @end @throw @catch @finally @autoreleasepool @synthesize @dynamic @selector @optional @required @encode @package @import @defs @compatibility_alias __bridge __bridge_transfer __bridge_retained __bridge_retain __covariant __contravariant __kindof _Nonnull _Nullable _Null_unspecified __FUNCTION__ __PRETTY_FUNCTION__ __attribute__ getter setter retain unsafe_unretained nonnull nullable null_unspecified null_resettable class instancetype NS_DESIGNATED_INITIALIZER NS_UNAVAILABLE NS_REQUIRES_SUPER NS_RETURNS_INNER_POINTER NS_INLINE NS_AVAILABLE NS_DEPRECATED NS_ENUM NS_OPTIONS NS_SWIFT_UNAVAILABLE NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_REFINED_FOR_SWIFT NS_SWIFT_NAME NS_SWIFT_NOTHROW NS_DURING NS_HANDLER NS_ENDHANDLER NS_VALUERETURN NS_VOIDRETURN",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"BOOL dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"},i=/[a-zA-Z@][a-zA-Z0-9_]*/,n="@interface @class @protocol @implementation";return{aliases:["mm","objc","obj-c"],k:_,l:i,i:""}]}]},{cN:"class",b:"("+n.split(" ").join("|")+")\\b",e:"({|$)",eE:!0,k:n,l:i,c:[e.UTM]},{b:"\\."+e.UIR,r:0}]}});hljs.registerLanguage("thrift",function(e){var t="bool byte i16 i32 i64 double string binary";return{k:{keyword:"namespace const typedef struct enum service exception void oneway set list map required optional",built_in:t,literal:"true false"},c:[e.QSM,e.NM,e.CLCM,e.CBCM,{cN:"class",bK:"struct enum service exception",e:/\{/,i:/\n/,c:[e.inherit(e.TM,{starts:{eW:!0,eE:!0}})]},{b:"\\b(set|list|map)\\s*<",e:">",k:t,c:["self"]}]}});hljs.registerLanguage("haskell",function(e){var i={v:[e.C("--","$"),e.C("{-","-}",{c:["self"]})]},a={cN:"meta",b:"{-#",e:"#-}"},l={cN:"meta",b:"^#",e:"$"},c={cN:"type",b:"\\b[A-Z][\\w']*",r:0},n={b:"\\(",e:"\\)",i:'"',c:[a,l,{cN:"type",b:"\\b[A-Z][\\w]*(\\((\\.\\.|,|\\w+)\\))?"},e.inherit(e.TM,{b:"[_a-z][\\w']*"}),i]},s={b:"{",e:"}",c:n.c};return{aliases:["hs"],k:"let in if then else case of where do module import hiding qualified type data newtype deriving class instance as default infix infixl infixr foreign export ccall stdcall cplusplus jvm dotnet safe unsafe family forall mdo proc rec",c:[{bK:"module",e:"where",k:"module where",c:[n,i],i:"\\W\\.|;"},{b:"\\bimport\\b",e:"$",k:"import qualified as hiding",c:[n,i],i:"\\W\\.|;"},{cN:"class",b:"^(\\s*)?(class|instance)\\b",e:"where",k:"class family instance where",c:[c,n,i]},{cN:"class",b:"\\b(data|(new)?type)\\b",e:"$",k:"data family type newtype deriving",c:[a,c,n,s,i]},{bK:"default",e:"$",c:[c,n,i]},{bK:"infix infixl infixr",e:"$",c:[e.CNM,i]},{b:"\\bforeign\\b",e:"$",k:"foreign import export ccall stdcall cplusplus jvm dotnet safe unsafe",c:[c,e.QSM,i]},{cN:"meta",b:"#!\\/usr\\/bin\\/env runhaskell",e:"$"},a,l,e.QSM,e.CNM,c,e.inherit(e.TM,{b:"^[_a-z][\\w']*"}),i,{b:"->|<-"}]}});hljs.registerLanguage("css",function(e){var c="[a-zA-Z-][a-zA-Z0-9_-]*",t={b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\w-]+\(/,rB:!0,c:[{cN:"built_in",b:/[\w-]+/},{b:/\(/,e:/\)/,c:[e.ASM,e.QSM]}]},e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"number",b:"#[0-9A-Fa-f]+"},{cN:"meta",b:"!important"}]}}]};return{cI:!0,i:/[=\/|'\$]/,c:[e.CBCM,{cN:"selector-id",b:/#[A-Za-z0-9_-]+/},{cN:"selector-class",b:/\.[A-Za-z0-9_-]+/},{cN:"selector-attr",b:/\[/,e:/\]/,i:"$"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{b:"@",e:"[{;]",i:/:/,c:[{cN:"keyword",b:/\w+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[e.ASM,e.QSM,e.CSSNM]}]},{cN:"selector-tag",b:c,r:0},{b:"{",e:"}",i:/\S/,c:[e.CBCM,t]}]}});hljs.registerLanguage("basic",function(E){return{cI:!0,i:"^.",l:"[a-zA-Z][a-zA-Z0-9_$%!#]*",k:{keyword:"ABS ASC AND ATN AUTO|0 BEEP BLOAD|10 BSAVE|10 CALL CALLS CDBL CHAIN CHDIR CHR$|10 CINT CIRCLE CLEAR CLOSE CLS COLOR COM COMMON CONT COS CSNG CSRLIN CVD CVI CVS DATA DATE$ DEFDBL DEFINT DEFSNG DEFSTR DEF|0 SEG USR DELETE DIM DRAW EDIT END ENVIRON ENVIRON$ EOF EQV ERASE ERDEV ERDEV$ ERL ERR ERROR EXP FIELD FILES FIX FOR|0 FRE GET GOSUB|10 GOTO HEX$ IF|0 THEN ELSE|0 INKEY$ INP INPUT INPUT# INPUT$ INSTR IMP INT IOCTL IOCTL$ KEY ON OFF LIST KILL LEFT$ LEN LET LINE LLIST LOAD LOC LOCATE LOF LOG LPRINT USING LSET MERGE MID$ MKDIR MKD$ MKI$ MKS$ MOD NAME NEW NEXT NOISE NOT OCT$ ON OR PEN PLAY STRIG OPEN OPTION BASE OUT PAINT PALETTE PCOPY PEEK PMAP POINT POKE POS PRINT PRINT] PSET PRESET PUT RANDOMIZE READ REM RENUM RESET|0 RESTORE RESUME RETURN|0 RIGHT$ RMDIR RND RSET RUN SAVE SCREEN SGN SHELL SIN SOUND SPACE$ SPC SQR STEP STICK STOP STR$ STRING$ SWAP SYSTEM TAB TAN TIME$ TIMER TROFF TRON TO USR VAL VARPTR VARPTR$ VIEW WAIT WHILE WEND WIDTH WINDOW WRITE XOR"},c:[E.QSM,E.C("REM","$",{r:10}),E.C("'","$",{r:0}),{cN:"symbol",b:"^[0-9]+ ",r:10},{cN:"number",b:"\\b([0-9]+[0-9edED.]*[#!]?)",r:0},{cN:"number",b:"(&[hH][0-9a-fA-F]{1,4})"},{cN:"number",b:"(&[oO][0-7]{1,6})"}]}});hljs.registerLanguage("makefile",function(e){var a={cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]};return{aliases:["mk","mak"],c:[e.HCM,{b:/^\w+\s*\W*=/,rB:!0,r:0,starts:{e:/\s*\W*=/,eE:!0,starts:{e:/$/,r:0,c:[a]}}},{cN:"section",b:/^[\w]+:\s*$/},{cN:"meta",b:/^\.PHONY:/,e:/$/,k:{"meta-keyword":".PHONY"},l:/[\.\w]+/},{b:/^\t+/,e:/$/,r:0,c:[e.QSM,a]}]}});hljs.registerLanguage("glsl",function(e){return{k:{keyword:"break continue discard do else for if return while switch case default attribute binding buffer ccw centroid centroid varying coherent column_major const cw depth_any depth_greater depth_less depth_unchanged early_fragment_tests equal_spacing flat fractional_even_spacing fractional_odd_spacing highp in index inout invariant invocations isolines layout line_strip lines lines_adjacency local_size_x local_size_y local_size_z location lowp max_vertices mediump noperspective offset origin_upper_left out packed patch pixel_center_integer point_mode points precise precision quads r11f_g11f_b10f r16 r16_snorm r16f r16i r16ui r32f r32i r32ui r8 r8_snorm r8i r8ui readonly restrict rg16 rg16_snorm rg16f rg16i rg16ui rg32f rg32i rg32ui rg8 rg8_snorm rg8i rg8ui rgb10_a2 rgb10_a2ui rgba16 rgba16_snorm rgba16f rgba16i rgba16ui rgba32f rgba32i rgba32ui rgba8 rgba8_snorm rgba8i rgba8ui row_major sample shared smooth std140 std430 stream triangle_strip triangles triangles_adjacency uniform varying vertices volatile writeonly",type:"atomic_uint bool bvec2 bvec3 bvec4 dmat2 dmat2x2 dmat2x3 dmat2x4 dmat3 dmat3x2 dmat3x3 dmat3x4 dmat4 dmat4x2 dmat4x3 dmat4x4 double dvec2 dvec3 dvec4 float iimage1D iimage1DArray iimage2D iimage2DArray iimage2DMS iimage2DMSArray iimage2DRect iimage3D iimageBufferiimageCube iimageCubeArray image1D image1DArray image2D image2DArray image2DMS image2DMSArray image2DRect image3D imageBuffer imageCube imageCubeArray int isampler1D isampler1DArray isampler2D isampler2DArray isampler2DMS isampler2DMSArray isampler2DRect isampler3D isamplerBuffer isamplerCube isamplerCubeArray ivec2 ivec3 ivec4 mat2 mat2x2 mat2x3 mat2x4 mat3 mat3x2 mat3x3 mat3x4 mat4 mat4x2 mat4x3 mat4x4 sampler1D sampler1DArray sampler1DArrayShadow sampler1DShadow sampler2D sampler2DArray sampler2DArrayShadow sampler2DMS sampler2DMSArray sampler2DRect sampler2DRectShadow sampler2DShadow sampler3D samplerBuffer samplerCube samplerCubeArray samplerCubeArrayShadow samplerCubeShadow image1D uimage1DArray uimage2D uimage2DArray uimage2DMS uimage2DMSArray uimage2DRect uimage3D uimageBuffer uimageCube uimageCubeArray uint usampler1D usampler1DArray usampler2D usampler2DArray usampler2DMS usampler2DMSArray usampler2DRect usampler3D samplerBuffer usamplerCube usamplerCubeArray uvec2 uvec3 uvec4 vec2 vec3 vec4 void",built_in:"gl_MaxAtomicCounterBindings gl_MaxAtomicCounterBufferSize gl_MaxClipDistances gl_MaxClipPlanes gl_MaxCombinedAtomicCounterBuffers gl_MaxCombinedAtomicCounters gl_MaxCombinedImageUniforms gl_MaxCombinedImageUnitsAndFragmentOutputs gl_MaxCombinedTextureImageUnits gl_MaxComputeAtomicCounterBuffers gl_MaxComputeAtomicCounters gl_MaxComputeImageUniforms gl_MaxComputeTextureImageUnits gl_MaxComputeUniformComponents gl_MaxComputeWorkGroupCount gl_MaxComputeWorkGroupSize gl_MaxDrawBuffers gl_MaxFragmentAtomicCounterBuffers gl_MaxFragmentAtomicCounters gl_MaxFragmentImageUniforms gl_MaxFragmentInputComponents gl_MaxFragmentInputVectors gl_MaxFragmentUniformComponents gl_MaxFragmentUniformVectors gl_MaxGeometryAtomicCounterBuffers gl_MaxGeometryAtomicCounters gl_MaxGeometryImageUniforms gl_MaxGeometryInputComponents gl_MaxGeometryOutputComponents gl_MaxGeometryOutputVertices gl_MaxGeometryTextureImageUnits gl_MaxGeometryTotalOutputComponents gl_MaxGeometryUniformComponents gl_MaxGeometryVaryingComponents gl_MaxImageSamples gl_MaxImageUnits gl_MaxLights gl_MaxPatchVertices gl_MaxProgramTexelOffset gl_MaxTessControlAtomicCounterBuffers gl_MaxTessControlAtomicCounters gl_MaxTessControlImageUniforms gl_MaxTessControlInputComponents gl_MaxTessControlOutputComponents gl_MaxTessControlTextureImageUnits gl_MaxTessControlTotalOutputComponents gl_MaxTessControlUniformComponents gl_MaxTessEvaluationAtomicCounterBuffers gl_MaxTessEvaluationAtomicCounters gl_MaxTessEvaluationImageUniforms gl_MaxTessEvaluationInputComponents gl_MaxTessEvaluationOutputComponents gl_MaxTessEvaluationTextureImageUnits gl_MaxTessEvaluationUniformComponents gl_MaxTessGenLevel gl_MaxTessPatchComponents gl_MaxTextureCoords gl_MaxTextureImageUnits gl_MaxTextureUnits gl_MaxVaryingComponents gl_MaxVaryingFloats gl_MaxVaryingVectors gl_MaxVertexAtomicCounterBuffers gl_MaxVertexAtomicCounters gl_MaxVertexAttribs gl_MaxVertexImageUniforms gl_MaxVertexOutputComponents gl_MaxVertexOutputVectors gl_MaxVertexTextureImageUnits gl_MaxVertexUniformComponents gl_MaxVertexUniformVectors gl_MaxViewports gl_MinProgramTexelOffset gl_BackColor gl_BackLightModelProduct gl_BackLightProduct gl_BackMaterial gl_BackSecondaryColor gl_ClipDistance gl_ClipPlane gl_ClipVertex gl_Color gl_DepthRange gl_EyePlaneQ gl_EyePlaneR gl_EyePlaneS gl_EyePlaneT gl_Fog gl_FogCoord gl_FogFragCoord gl_FragColor gl_FragCoord gl_FragData gl_FragDepth gl_FrontColor gl_FrontFacing gl_FrontLightModelProduct gl_FrontLightProduct gl_FrontMaterial gl_FrontSecondaryColor gl_GlobalInvocationID gl_InstanceID gl_InvocationID gl_Layer gl_LightModel gl_LightSource gl_LocalInvocationID gl_LocalInvocationIndex gl_ModelViewMatrix gl_ModelViewMatrixInverse gl_ModelViewMatrixInverseTranspose gl_ModelViewMatrixTranspose gl_ModelViewProjectionMatrix gl_ModelViewProjectionMatrixInverse gl_ModelViewProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixTranspose gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_Normal gl_NormalMatrix gl_NormalScale gl_NumSamples gl_NumWorkGroups gl_ObjectPlaneQ gl_ObjectPlaneR gl_ObjectPlaneS gl_ObjectPlaneT gl_PatchVerticesIn gl_Point gl_PointCoord gl_PointSize gl_Position gl_PrimitiveID gl_PrimitiveIDIn gl_ProjectionMatrix gl_ProjectionMatrixInverse gl_ProjectionMatrixInverseTranspose gl_ProjectionMatrixTranspose gl_SampleID gl_SampleMask gl_SampleMaskIn gl_SamplePosition gl_SecondaryColor gl_TessCoord gl_TessLevelInner gl_TessLevelOuter gl_TexCoord gl_TextureEnvColor gl_TextureMatrix gl_TextureMatrixInverse gl_TextureMatrixInverseTranspose gl_TextureMatrixTranspose gl_Vertex gl_VertexID gl_ViewportIndex gl_WorkGroupID gl_WorkGroupSize gl_in gl_out EmitStreamVertex EmitVertex EndPrimitive EndStreamPrimitive abs acos acosh all any asin asinh atan atanh atomicAdd atomicAnd atomicCompSwap atomicCounter atomicCounterDecrement atomicCounterIncrement atomicExchange atomicMax atomicMin atomicOr atomicXor barrier bitCount bitfieldExtract bitfieldInsert bitfieldReverse ceil clamp cos cosh cross dFdx dFdy degrees determinant distance dot equal exp exp2 faceforward findLSB findMSB floatBitsToInt floatBitsToUint floor fma fract frexp ftransform fwidth greaterThan greaterThanEqual groupMemoryBarrier imageAtomicAdd imageAtomicAnd imageAtomicCompSwap imageAtomicExchange imageAtomicMax imageAtomicMin imageAtomicOr imageAtomicXor imageLoad imageSize imageStore imulExtended intBitsToFloat interpolateAtCentroid interpolateAtOffset interpolateAtSample inverse inversesqrt isinf isnan ldexp length lessThan lessThanEqual log log2 matrixCompMult max memoryBarrier memoryBarrierAtomicCounter memoryBarrierBuffer memoryBarrierImage memoryBarrierShared min mix mod modf noise1 noise2 noise3 noise4 normalize not notEqual outerProduct packDouble2x32 packHalf2x16 packSnorm2x16 packSnorm4x8 packUnorm2x16 packUnorm4x8 pow radians reflect refract round roundEven shadow1D shadow1DLod shadow1DProj shadow1DProjLod shadow2D shadow2DLod shadow2DProj shadow2DProjLod sign sin sinh smoothstep sqrt step tan tanh texelFetch texelFetchOffset texture texture1D texture1DLod texture1DProj texture1DProjLod texture2D texture2DLod texture2DProj texture2DProjLod texture3D texture3DLod texture3DProj texture3DProjLod textureCube textureCubeLod textureGather textureGatherOffset textureGatherOffsets textureGrad textureGradOffset textureLod textureLodOffset textureOffset textureProj textureProjGrad textureProjGradOffset textureProjLod textureProjLodOffset textureProjOffset textureQueryLevels textureQueryLod textureSize transpose trunc uaddCarry uintBitsToFloat umulExtended unpackDouble2x32 unpackHalf2x16 unpackSnorm2x16 unpackSnorm4x8 unpackUnorm2x16 unpackUnorm4x8 usubBorrow",literal:"true false"},i:'"',c:[e.CLCM,e.CBCM,e.CNM,{cN:"meta",b:"#",e:"$"}]}});hljs.registerLanguage("nginx",function(e){var r={cN:"variable",v:[{b:/\$\d+/},{b:/\$\{/,e:/}/},{b:"[\\$\\@]"+e.UIR}]},b={eW:!0,l:"[a-z/_]+",k:{literal:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[e.HCM,{cN:"string",c:[e.BE,r],v:[{b:/"/,e:/"/},{b:/'/,e:/'/}]},{b:"([a-z]+):/",e:"\\s",eW:!0,eE:!0,c:[r]},{cN:"regexp",c:[e.BE,r],v:[{b:"\\s\\^",e:"\\s|{|;",rE:!0},{b:"~\\*?\\s+",e:"\\s|{|;",rE:!0},{b:"\\*(\\.[a-z\\-]+)+"},{b:"([a-z\\-]+\\.)+\\*"}]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0},r]};return{aliases:["nginxconf"],c:[e.HCM,{b:e.UIR+"\\s+{",rB:!0,e:"{",c:[{cN:"section",b:e.UIR}],r:0},{b:e.UIR+"\\s",e:";|{",rB:!0,c:[{cN:"attribute",b:e.UIR,starts:b}],r:0}],i:"[^\\s\\}]"}});hljs.registerLanguage("accesslog",function(T){return{c:[{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+\\b",r:0},{cN:"string",b:'"(GET|POST|HEAD|PUT|DELETE|CONNECT|OPTIONS|PATCH|TRACE)',e:'"',k:"GET POST HEAD PUT DELETE CONNECT OPTIONS PATCH TRACE",i:"\\n",r:10},{cN:"string",b:/\[/,e:/\]/,i:"\\n"},{cN:"string",b:'"',e:'"',i:"\\n"}]}});hljs.registerLanguage("moonscript",function(e){var t={keyword:"if then not for in while do return else elseif break continue switch and or unless when class extends super local import export from using",literal:"true false nil",built_in:"_G _VERSION assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall coroutine debug io math os package string table"},r="[A-Za-z$_][0-9A-Za-z$_]*",s={cN:"subst",b:/#\{/,e:/}/,k:t},a=[e.inherit(e.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'/,e:/'/,c:[e.BE]},{b:/"/,e:/"/,c:[e.BE,s]}]},{cN:"built_in",b:"@__"+e.IR},{b:"@"+e.IR},{b:e.IR+"\\\\"+e.IR}];s.c=a;var c=e.inherit(e.TM,{b:r}),n="(\\(.*\\))?\\s*\\B[-=]>",i={cN:"params",b:"\\([^\\(]",rB:!0,c:[{b:/\(/,e:/\)/,k:t,c:["self"].concat(a)}]};return{aliases:["moon"],k:t,i:/\/\*/,c:a.concat([e.C("--","$"),{cN:"function",b:"^\\s*"+r+"\\s*=\\s*"+n,e:"[-=]>",rB:!0,c:[c,i]},{b:/[\(,:=]\s*/,r:0,c:[{cN:"function",b:n,e:"[-=]>",rB:!0,c:[i]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[c]},c]},{cN:"name",b:r+":",e:":",rB:!0,rE:!0,r:0}])}});hljs.registerLanguage("cos",function(e){var t={cN:"string",v:[{b:'"',e:'"',c:[{b:'""',r:0}]}]},r={cN:"number",b:"\\b(\\d+(\\.\\d*)?|\\.\\d+)",r:0},s="property parameter class classmethod clientmethod extends as break catch close continue do d|0 else elseif for goto halt hang h|0 if job j|0 kill k|0 lock l|0 merge new open quit q|0 read r|0 return set s|0 tcommit throw trollback try tstart use view while write w|0 xecute x|0 zkill znspace zn ztrap zwrite zw zzdump zzwrite print zbreak zinsert zload zprint zremove zsave zzprint mv mvcall mvcrt mvdim mvprint zquit zsync ascii";return{cI:!0,aliases:["cos","cls"],k:s,c:[r,t,e.CLCM,e.CBCM,{cN:"comment",b:/;/,e:"$",r:0},{cN:"built_in",b:/(?:\$\$?|\.\.)\^?[a-zA-Z]+/},{cN:"built_in",b:/\$\$\$[a-zA-Z]+/},{cN:"built_in",b:/%[a-z]+(?:\.[a-z]+)*/},{cN:"symbol",b:/\^%?[a-zA-Z][\w]*/},{cN:"keyword",b:/##class|##super|#define|#dim/},{b:/&sql\(/,e:/\)/,eB:!0,eE:!0,sL:"sql"},{b:/&(js|jscript|javascript)/,eB:!0,eE:!0,sL:"javascript"},{b:/&html<\s*\s*>/,sL:"xml"}]}});hljs.registerLanguage("sml",function(e){return{aliases:["ml"],k:{keyword:"abstype and andalso as case datatype do else end eqtype exception fn fun functor handle if in include infix infixr let local nonfix of op open orelse raise rec sharing sig signature struct structure then type val with withtype where while",built_in:"array bool char exn int list option order real ref string substring vector unit word",literal:"true false NONE SOME LESS EQUAL GREATER nil"},i:/\/\/|>>/,l:"[a-z_]\\w*!?",c:[{cN:"literal",b:/\[(\|\|)?\]|\(\)/,r:0},e.C("\\(\\*","\\*\\)",{c:["self"]}),{cN:"symbol",b:"'[A-Za-z_](?!')[\\w']*"},{cN:"type",b:"`[A-Z][\\w']*"},{cN:"type",b:"\\b[A-Z][\\w']*",r:0},{b:"[a-z_]\\w*'[\\w']*"},e.inherit(e.ASM,{cN:"string",r:0}),e.inherit(e.QSM,{i:null}),{cN:"number",b:"\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",r:0},{b:/[-=]>/}]}});hljs.registerLanguage("protobuf",function(e){return{k:{keyword:"package import option optional required repeated group",built_in:"double float int32 int64 uint32 uint64 sint32 sint64 fixed32 fixed64 sfixed32 sfixed64 bool string bytes",literal:"true false"},c:[e.QSM,e.NM,e.CLCM,{cN:"class",bK:"message enum service",e:/\{/,i:/\n/,c:[e.inherit(e.TM,{starts:{eW:!0,eE:!0}})]},{cN:"function",bK:"rpc",e:/;/,eE:!0,k:"rpc returns"},{b:/^\s*[A-Z_]+/,e:/\s*=/,eE:!0}]}});hljs.registerLanguage("php",function(e){var c={b:"\\$+[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*"},i={cN:"meta",b:/<\?(php)?|\?>/},t={cN:"string",c:[e.BE,i],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},a={v:[e.BNM,e.CNM]};return{aliases:["php3","php4","php5","php6"],cI:!0,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[e.HCM,e.C("//","$",{c:[i]}),e.C("/\\*","\\*/",{c:[{cN:"doctag",b:"@[A-Za-z]+"}]}),e.C("__halt_compiler.+?;",!1,{eW:!0,k:"__halt_compiler",l:e.UIR}),{cN:"string",b:/<<<['"]?\w+['"]?$/,e:/^\w+;?$/,c:[e.BE,{cN:"subst",v:[{b:/\$\w+/},{b:/\{\$/,e:/\}/}]}]},i,{cN:"keyword",b:/\$this\b/},c,{b:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{cN:"function",bK:"function",e:/[;{]/,eE:!0,i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",c,e.CBCM,t,a]}]},{cN:"class",bK:"class interface",e:"{",eE:!0,i:/[:\(\$"]/,c:[{bK:"extends implements"},e.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[e.UTM]},{bK:"use",e:";",c:[e.UTM]},{b:"=>"},t,a]}});hljs.registerLanguage("gcode",function(N){var e="[A-Z_][A-Z0-9_.]*",c="\\%",E="IF DO WHILE ENDWHILE CALL ENDIF SUB ENDSUB GOTO REPEAT ENDREPEAT EQ LT GT NE GE LE OR XOR",i={cN:"meta",b:"([O])([0-9]+)"},n=[N.CLCM,N.CBCM,N.C(/\(/,/\)/),N.inherit(N.CNM,{b:"([-+]?([0-9]*\\.?[0-9]+\\.?))|"+N.CNR}),N.inherit(N.ASM,{i:null}),N.inherit(N.QSM,{i:null}),{cN:"name",b:"([G])([0-9]+\\.?[0-9]?)"},{cN:"name",b:"([M])([0-9]+\\.?[0-9]?)"},{cN:"attr",b:"(VC|VS|#)",e:"(\\d+)"},{cN:"attr",b:"(VZOFX|VZOFY|VZOFZ)"},{cN:"built_in",b:"(ATAN|ABS|ACOS|ASIN|SIN|COS|EXP|FIX|FUP|ROUND|LN|TAN)(\\[)",e:"([-+]?([0-9]*\\.?[0-9]+\\.?))(\\])"},{cN:"symbol",v:[{b:"N",e:"\\d+",i:"\\W"}]}];return{aliases:["nc"],cI:!0,l:e,k:E,c:[{cN:"meta",b:c},i].concat(n)}});hljs.registerLanguage("fortran",function(e){var t={cN:"params",b:"\\(",e:"\\)"},n={literal:".False. .True.",keyword:"kind do while private call intrinsic where elsewhere type endtype endmodule endselect endinterface end enddo endif if forall endforall only contains default return stop then public subroutine|10 function program .and. .or. .not. .le. .eq. .ge. .gt. .lt. goto save else use module select case access blank direct exist file fmt form formatted iostat name named nextrec number opened rec recl sequential status unformatted unit continue format pause cycle exit c_null_char c_alert c_backspace c_form_feed flush wait decimal round iomsg synchronous nopass non_overridable pass protected volatile abstract extends import non_intrinsic value deferred generic final enumerator class associate bind enum c_int c_short c_long c_long_long c_signed_char c_size_t c_int8_t c_int16_t c_int32_t c_int64_t c_int_least8_t c_int_least16_t c_int_least32_t c_int_least64_t c_int_fast8_t c_int_fast16_t c_int_fast32_t c_int_fast64_t c_intmax_t C_intptr_t c_float c_double c_long_double c_float_complex c_double_complex c_long_double_complex c_bool c_char c_null_ptr c_null_funptr c_new_line c_carriage_return c_horizontal_tab c_vertical_tab iso_c_binding c_loc c_funloc c_associated c_f_pointer c_ptr c_funptr iso_fortran_env character_storage_size error_unit file_storage_size input_unit iostat_end iostat_eor numeric_storage_size output_unit c_f_procpointer ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode newunit contiguous recursive pad position action delim readwrite eor advance nml interface procedure namelist include sequence elemental pure integer real character complex logical dimension allocatable|10 parameter external implicit|10 none double precision assign intent optional pointer target in out common equivalence data",built_in:"alog alog10 amax0 amax1 amin0 amin1 amod cabs ccos cexp clog csin csqrt dabs dacos dasin datan datan2 dcos dcosh ddim dexp dint dlog dlog10 dmax1 dmin1 dmod dnint dsign dsin dsinh dsqrt dtan dtanh float iabs idim idint idnint ifix isign max0 max1 min0 min1 sngl algama cdabs cdcos cdexp cdlog cdsin cdsqrt cqabs cqcos cqexp cqlog cqsin cqsqrt dcmplx dconjg derf derfc dfloat dgamma dimag dlgama iqint qabs qacos qasin qatan qatan2 qcmplx qconjg qcos qcosh qdim qerf qerfc qexp qgamma qimag qlgama qlog qlog10 qmax1 qmin1 qmod qnint qsign qsin qsinh qsqrt qtan qtanh abs acos aimag aint anint asin atan atan2 char cmplx conjg cos cosh exp ichar index int log log10 max min nint sign sin sinh sqrt tan tanh print write dim lge lgt lle llt mod nullify allocate deallocate adjustl adjustr all allocated any associated bit_size btest ceiling count cshift date_and_time digits dot_product eoshift epsilon exponent floor fraction huge iand ibclr ibits ibset ieor ior ishft ishftc lbound len_trim matmul maxexponent maxloc maxval merge minexponent minloc minval modulo mvbits nearest pack present product radix random_number random_seed range repeat reshape rrspacing scale scan selected_int_kind selected_real_kind set_exponent shape size spacing spread sum system_clock tiny transpose trim ubound unpack verify achar iachar transfer dble entry dprod cpu_time command_argument_count get_command get_command_argument get_environment_variable is_iostat_end ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode is_iostat_eor move_alloc new_line selected_char_kind same_type_as extends_type_ofacosh asinh atanh bessel_j0 bessel_j1 bessel_jn bessel_y0 bessel_y1 bessel_yn erf erfc erfc_scaled gamma log_gamma hypot norm2 atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr num_images parity popcnt poppar shifta shiftl shiftr this_image"};return{cI:!0,aliases:["f90","f95"],k:n,i:/\/\*/,c:[e.inherit(e.ASM,{cN:"string",r:0}),e.inherit(e.QSM,{cN:"string",r:0}),{cN:"function",bK:"subroutine function program",i:"[${=\\n]",c:[e.UTM,t]},e.C("!","$",{r:0}),{cN:"number",b:"(?=\\b|\\+|\\-|\\.)(?=\\.\\d|\\d)(?:\\d+)?(?:\\.?\\d*)(?:[de][+-]?\\d+)?\\b\\.?",r:0}]}});hljs.registerLanguage("q",function(e){var s={keyword:"do while select delete by update from",literal:"0b 1b",built_in:"neg not null string reciprocal floor ceiling signum mod xbar xlog and or each scan over prior mmu lsq inv md5 ltime gtime count first var dev med cov cor all any rand sums prds mins maxs fills deltas ratios avgs differ prev next rank reverse iasc idesc asc desc msum mcount mavg mdev xrank mmin mmax xprev rotate distinct group where flip type key til get value attr cut set upsert raze union inter except cross sv vs sublist enlist read0 read1 hopen hclose hdel hsym hcount peach system ltrim rtrim trim lower upper ssr view tables views cols xcols keys xkey xcol xasc xdesc fkeys meta lj aj aj0 ij pj asof uj ww wj wj1 fby xgroup ungroup ej save load rsave rload show csv parse eval min max avg wavg wsum sin cos tan sum",type:"`float `double int `timestamp `timespan `datetime `time `boolean `symbol `char `byte `short `long `real `month `date `minute `second `guid"};return{aliases:["k","kdb"],k:s,l:/(`?)[A-Za-z0-9_]+\b/,c:[e.CLCM,e.QSM,e.CNM]}});hljs.registerLanguage("ada",function(e){var r="\\d(_|\\d)*",t="[eE][-+]?"+r,s=r+"(\\."+r+")?("+t+")?",n="\\w+",a=r+"#"+n+"(\\."+n+")?#("+t+")?",i="\\b("+a+"|"+s+")",c="[A-Za-z](_?[A-Za-z0-9.])*",o="[]{}%#'\"",b=e.C("--","$"),d={b:"\\s+:\\s+",e:"\\s*(:=|;|\\)|=>|$)",i:o,c:[{bK:"loop for declare others",endsParent:!0},{cN:"keyword",bK:"not null constant access function procedure in out aliased exception"},{cN:"type",b:c,endsParent:!0,r:0}]};return{cI:!0,k:{keyword:"abort else new return abs elsif not reverse abstract end accept entry select access exception of separate aliased exit or some all others subtype and for out synchronized array function overriding at tagged generic package task begin goto pragma terminate body private then if procedure type case in protected constant interface is raise use declare range delay limited record when delta loop rem while digits renames with do mod requeue xor",literal:"True False"},c:[b,{cN:"string",b:/"/,e:/"/,c:[{b:/""/,r:0}]},{cN:"string",b:/'.'/},{cN:"number",b:i,r:0},{cN:"symbol",b:"'"+c},{cN:"title",b:"(\\bwith\\s+)?(\\bprivate\\s+)?\\bpackage\\s+(\\bbody\\s+)?",e:"(is|$)",k:"package body",eB:!0,eE:!0,i:o},{b:"(\\b(with|overriding)\\s+)?\\b(function|procedure)\\s+",e:"(\\bis|\\bwith|\\brenames|\\)\\s*;)",k:"overriding function procedure with is renames return",rB:!0,c:[b,{cN:"title",b:"(\\bwith\\s+)?\\b(function|procedure)\\s+",e:"(\\(|\\s+|$)",eB:!0,eE:!0,i:o},d,{cN:"type",b:"\\breturn\\s+",e:"(\\s+|;|$)",k:"return",eB:!0,eE:!0,endsParent:!0,i:o}]},{cN:"type",b:"\\b(sub)?type\\s+",e:"\\s+",k:"type",eB:!0,i:o},d]}});hljs.registerLanguage("verilog",function(e){var n={keyword:"accept_on alias always always_comb always_ff always_latch and assert assign assume automatic before begin bind bins binsof bit break buf|0 bufif0 bufif1 byte case casex casez cell chandle checker class clocking cmos config const constraint context continue cover covergroup coverpoint cross deassign default defparam design disable dist do edge else end endcase endchecker endclass endclocking endconfig endfunction endgenerate endgroup endinterface endmodule endpackage endprimitive endprogram endproperty endspecify endsequence endtable endtask enum event eventually expect export extends extern final first_match for force foreach forever fork forkjoin function generate|5 genvar global highz0 highz1 if iff ifnone ignore_bins illegal_bins implements implies import incdir include initial inout input inside instance int integer interconnect interface intersect join join_any join_none large let liblist library local localparam logic longint macromodule matches medium modport module nand negedge nettype new nexttime nmos nor noshowcancelled not notif0 notif1 or output package packed parameter pmos posedge primitive priority program property protected pull0 pull1 pulldown pullup pulsestyle_ondetect pulsestyle_onevent pure rand randc randcase randsequence rcmos real realtime ref reg reject_on release repeat restrict return rnmos rpmos rtran rtranif0 rtranif1 s_always s_eventually s_nexttime s_until s_until_with scalared sequence shortint shortreal showcancelled signed small soft solve specify specparam static string strong strong0 strong1 struct super supply0 supply1 sync_accept_on sync_reject_on table tagged task this throughout time timeprecision timeunit tran tranif0 tranif1 tri tri0 tri1 triand trior trireg type typedef union unique unique0 unsigned until until_with untyped use uwire var vectored virtual void wait wait_order wand weak weak0 weak1 while wildcard wire with within wor xnor xor",literal:"null",built_in:"$finish $stop $exit $fatal $error $warning $info $realtime $time $printtimescale $bitstoreal $bitstoshortreal $itor $signed $cast $bits $stime $timeformat $realtobits $shortrealtobits $rtoi $unsigned $asserton $assertkill $assertpasson $assertfailon $assertnonvacuouson $assertoff $assertcontrol $assertpassoff $assertfailoff $assertvacuousoff $isunbounded $sampled $fell $changed $past_gclk $fell_gclk $changed_gclk $rising_gclk $steady_gclk $coverage_control $coverage_get $coverage_save $set_coverage_db_name $rose $stable $past $rose_gclk $stable_gclk $future_gclk $falling_gclk $changing_gclk $display $coverage_get_max $coverage_merge $get_coverage $load_coverage_db $typename $unpacked_dimensions $left $low $increment $clog2 $ln $log10 $exp $sqrt $pow $floor $ceil $sin $cos $tan $countbits $onehot $isunknown $fatal $warning $dimensions $right $high $size $asin $acos $atan $atan2 $hypot $sinh $cosh $tanh $asinh $acosh $atanh $countones $onehot0 $error $info $random $dist_chi_square $dist_erlang $dist_exponential $dist_normal $dist_poisson $dist_t $dist_uniform $q_initialize $q_remove $q_exam $async$and$array $async$nand$array $async$or$array $async$nor$array $sync$and$array $sync$nand$array $sync$or$array $sync$nor$array $q_add $q_full $psprintf $async$and$plane $async$nand$plane $async$or$plane $async$nor$plane $sync$and$plane $sync$nand$plane $sync$or$plane $sync$nor$plane $system $display $displayb $displayh $displayo $strobe $strobeb $strobeh $strobeo $write $readmemb $readmemh $writememh $value$plusargs $dumpvars $dumpon $dumplimit $dumpports $dumpportson $dumpportslimit $writeb $writeh $writeo $monitor $monitorb $monitorh $monitoro $writememb $dumpfile $dumpoff $dumpall $dumpflush $dumpportsoff $dumpportsall $dumpportsflush $fclose $fdisplay $fdisplayb $fdisplayh $fdisplayo $fstrobe $fstrobeb $fstrobeh $fstrobeo $swrite $swriteb $swriteh $swriteo $fscanf $fread $fseek $fflush $feof $fopen $fwrite $fwriteb $fwriteh $fwriteo $fmonitor $fmonitorb $fmonitorh $fmonitoro $sformat $sformatf $fgetc $ungetc $fgets $sscanf $rewind $ftell $ferror"};return{aliases:["v","sv","svh"],cI:!1,k:n,l:/[\w\$]+/,c:[e.CBCM,e.CLCM,e.QSM,{cN:"number",c:[e.BE],v:[{b:"\\b((\\d+'(b|h|o|d|B|H|O|D))[0-9xzXZa-fA-F_]+)"},{b:"\\B(('(b|h|o|d|B|H|O|D))[0-9xzXZa-fA-F_]+)"},{b:"\\b([0-9_])+",r:0}]},{cN:"variable",v:[{b:"#\\((?!parameter).+\\)"},{b:"\\.\\w+",r:0}]},{cN:"meta",b:"`",e:"$",k:{"meta-keyword":"define __FILE__ __LINE__ begin_keywords celldefine default_nettype define else elsif end_keywords endcelldefine endif ifdef ifndef include line nounconnected_drive pragma resetall timescale unconnected_drive undef undefineall"},r:0}]}});hljs.registerLanguage("elm",function(e){var i={v:[e.C("--","$"),e.C("{-","-}",{c:["self"]})]},t={cN:"type",b:"\\b[A-Z][\\w']*",r:0},c={b:"\\(",e:"\\)",i:'"',c:[{cN:"type",b:"\\b[A-Z][\\w]*(\\((\\.\\.|,|\\w+)\\))?"},i]},n={b:"{",e:"}",c:c.c};return{k:"let in if then else case of where module import exposing type alias as infix infixl infixr port effect command subscription",c:[{bK:"port effect module",e:"exposing",k:"port effect module where command subscription exposing",c:[c,i],i:"\\W\\.|;"},{b:"import",e:"$",k:"import as exposing",c:[c,i],i:"\\W\\.|;"},{b:"type",e:"$",k:"type alias",c:[t,c,n,i]},{bK:"infix infixl infixr",e:"$",c:[e.CNM,i]},{b:"port",e:"$",k:"port",c:[i]},e.QSM,e.CNM,t,e.inherit(e.TM,{b:"^[_a-z][\\w']*"}),i,{b:"->|<-"}]}});hljs.registerLanguage("xl",function(e){var t="ObjectLoader Animate MovieCredits Slides Filters Shading Materials LensFlare Mapping VLCAudioVideo StereoDecoder PointCloud NetworkAccess RemoteControl RegExp ChromaKey Snowfall NodeJS Speech Charts",o={keyword:"if then else do while until for loop import with is as where when by data constant integer real text name boolean symbol infix prefix postfix block tree",literal:"true false nil",built_in:"in mod rem and or xor not abs sign floor ceil sqrt sin cos tan asin acos atan exp expm1 log log2 log10 log1p pi at text_length text_range text_find text_replace contains page slide basic_slide title_slide title subtitle fade_in fade_out fade_at clear_color color line_color line_width texture_wrap texture_transform texture scale_?x scale_?y scale_?z? translate_?x translate_?y translate_?z? rotate_?x rotate_?y rotate_?z? rectangle circle ellipse sphere path line_to move_to quad_to curve_to theme background contents locally time mouse_?x mouse_?y mouse_buttons "+t},a={cN:"string",b:'"',e:'"',i:"\\n"},r={cN:"string",b:"'",e:"'",i:"\\n"},i={cN:"string",b:"<<",e:">>"},l={cN:"number",b:"[0-9]+#[0-9A-Z_]+(\\.[0-9-A-Z_]+)?#?([Ee][+-]?[0-9]+)?"},n={bK:"import",e:"$",k:o,c:[a]},s={cN:"function",b:/[a-z][^\n]*->/,rB:!0,e:/->/,c:[e.inherit(e.TM,{starts:{eW:!0,k:o}})]};return{aliases:["tao"],l:/[a-zA-Z][a-zA-Z0-9_?]*/,k:o,c:[e.CLCM,e.CBCM,a,r,i,s,n,l,e.NM]}});hljs.registerLanguage("nsis",function(e){var t={cN:"variable",b:/\$(ADMINTOOLS|APPDATA|CDBURN_AREA|CMDLINE|COMMONFILES32|COMMONFILES64|COMMONFILES|COOKIES|DESKTOP|DOCUMENTS|EXEDIR|EXEFILE|EXEPATH|FAVORITES|FONTS|HISTORY|HWNDPARENT|INSTDIR|INTERNET_CACHE|LANGUAGE|LOCALAPPDATA|MUSIC|NETHOOD|OUTDIR|PICTURES|PLUGINSDIR|PRINTHOOD|PROFILE|PROGRAMFILES32|PROGRAMFILES64|PROGRAMFILES|QUICKLAUNCH|RECENT|RESOURCES_LOCALIZED|RESOURCES|SENDTO|SMPROGRAMS|SMSTARTUP|STARTMENU|SYSDIR|TEMP|TEMPLATES|VIDEOS|WINDIR)/},i={cN:"variable",b:/\$+{[\w\.:-]+}/},n={cN:"variable",b:/\$+\w+/,i:/\(\){}/},r={cN:"variable",b:/\$+\([\w\^\.:-]+\)/},o={cN:"params",b:"(ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HKCR|HKCU|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM|HKPD|HKU|IDABORT|IDCANCEL|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SYSTEM|TEMPORARY)"},l={cN:"keyword",b:/\!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|else|endif|error|execute|finalize|getdllversionsystem|ifdef|ifmacrodef|ifmacrondef|ifndef|if|include|insertmacro|macroend|macro|makensis|packhdr|searchparse|searchreplace|tempfile|undef|verbose|warning)/},s={cN:"subst",b:/\$(\\[nrt]|\$)/},a={cN:"class",b:/\w+\:\:\w+/},S={cN:"string",v:[{b:'"',e:'"'},{b:"'",e:"'"},{b:"`",e:"`"}],i:/\n/,c:[s,t,i,n,r]};return{cI:!1,k:{keyword:"Abort AddBrandingImage AddSize AllowRootDirInstall AllowSkipFiles AutoCloseWindow BGFont BGGradient BrandingText BringToFront Call CallInstDLL Caption ChangeUI CheckBitmap ClearErrors CompletedText ComponentText CopyFiles CRCCheck CreateDirectory CreateFont CreateShortCut Delete DeleteINISec DeleteINIStr DeleteRegKey DeleteRegValue DetailPrint DetailsButtonText DirText DirVar DirVerify EnableWindow EnumRegKey EnumRegValue Exch Exec ExecShell ExecWait ExpandEnvStrings File FileBufSize FileClose FileErrorText FileOpen FileRead FileReadByte FileReadUTF16LE FileReadWord FileSeek FileWrite FileWriteByte FileWriteUTF16LE FileWriteWord FindClose FindFirst FindNext FindWindow FlushINI FunctionEnd GetCurInstType GetCurrentAddress GetDlgItem GetDLLVersion GetDLLVersionLocal GetErrorLevel GetFileTime GetFileTimeLocal GetFullPathName GetFunctionAddress GetInstDirError GetLabelAddress GetTempFileName Goto HideWindow Icon IfAbort IfErrors IfFileExists IfRebootFlag IfSilent InitPluginsDir InstallButtonText InstallColors InstallDir InstallDirRegKey InstProgressFlags InstType InstTypeGetText InstTypeSetText IntCmp IntCmpU IntFmt IntOp IsWindow LangString LicenseBkColor LicenseData LicenseForceSelection LicenseLangString LicenseText LoadLanguageFile LockWindow LogSet LogText ManifestDPIAware ManifestSupportedOS MessageBox MiscButtonText Name Nop OutFile Page PageCallbacks PageExEnd Pop Push Quit ReadEnvStr ReadINIStr ReadRegDWORD ReadRegStr Reboot RegDLL Rename RequestExecutionLevel ReserveFile Return RMDir SearchPath SectionEnd SectionGetFlags SectionGetInstTypes SectionGetSize SectionGetText SectionGroupEnd SectionIn SectionSetFlags SectionSetInstTypes SectionSetSize SectionSetText SendMessage SetAutoClose SetBrandingImage SetCompress SetCompressor SetCompressorDictSize SetCtlColors SetCurInstType SetDatablockOptimize SetDateSave SetDetailsPrint SetDetailsView SetErrorLevel SetErrors SetFileAttributes SetFont SetOutPath SetOverwrite SetRebootFlag SetRegView SetShellVarContext SetSilent ShowInstDetails ShowUninstDetails ShowWindow SilentInstall SilentUnInstall Sleep SpaceTexts StrCmp StrCmpS StrCpy StrLen SubCaption Unicode UninstallButtonText UninstallCaption UninstallIcon UninstallSubCaption UninstallText UninstPage UnRegDLL Var VIAddVersionKey VIFileVersion VIProductVersion WindowIcon WriteINIStr WriteRegBin WriteRegDWORD WriteRegExpandStr WriteRegStr WriteUninstaller XPStyle",literal:"admin all auto both bottom bzip2 colored components current custom directory false force hide highest ifdiff ifnewer instfiles lastused leave left license listonly lzma nevershow none normal notset off on open print right show silent silentlog smooth textonly top true try un.components un.custom un.directory un.instfiles un.license uninstConfirm user Win10 Win7 Win8 WinVista zlib"},c:[e.HCM,e.CBCM,e.C(";","$",{r:0}),{cN:"function",bK:"Function PageEx Section SectionGroup",e:"$"},S,l,i,n,r,o,a,e.NM]}});hljs.registerLanguage("x86asm",function(s){return{cI:!0,l:"[.%]?"+s.IR,k:{keyword:"lock rep repe repz repne repnz xaquire xrelease bnd nobnd aaa aad aam aas adc add and arpl bb0_reset bb1_reset bound bsf bsr bswap bt btc btr bts call cbw cdq cdqe clc cld cli clts cmc cmp cmpsb cmpsd cmpsq cmpsw cmpxchg cmpxchg486 cmpxchg8b cmpxchg16b cpuid cpu_read cpu_write cqo cwd cwde daa das dec div dmint emms enter equ f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcmovb fcmovbe fcmove fcmovnb fcmovnbe fcmovne fcmovnu fcmovu fcom fcomi fcomip fcomp fcompp fcos fdecstp fdisi fdiv fdivp fdivr fdivrp femms feni ffree ffreep fiadd ficom ficomp fidiv fidivr fild fimul fincstp finit fist fistp fisttp fisub fisubr fld fld1 fldcw fldenv fldl2e fldl2t fldlg2 fldln2 fldpi fldz fmul fmulp fnclex fndisi fneni fninit fnop fnsave fnstcw fnstenv fnstsw fpatan fprem fprem1 fptan frndint frstor fsave fscale fsetpm fsin fsincos fsqrt fst fstcw fstenv fstp fstsw fsub fsubp fsubr fsubrp ftst fucom fucomi fucomip fucomp fucompp fxam fxch fxtract fyl2x fyl2xp1 hlt ibts icebp idiv imul in inc incbin insb insd insw int int01 int1 int03 int3 into invd invpcid invlpg invlpga iret iretd iretq iretw jcxz jecxz jrcxz jmp jmpe lahf lar lds lea leave les lfence lfs lgdt lgs lidt lldt lmsw loadall loadall286 lodsb lodsd lodsq lodsw loop loope loopne loopnz loopz lsl lss ltr mfence monitor mov movd movq movsb movsd movsq movsw movsx movsxd movzx mul mwait neg nop not or out outsb outsd outsw packssdw packsswb packuswb paddb paddd paddsb paddsiw paddsw paddusb paddusw paddw pand pandn pause paveb pavgusb pcmpeqb pcmpeqd pcmpeqw pcmpgtb pcmpgtd pcmpgtw pdistib pf2id pfacc pfadd pfcmpeq pfcmpge pfcmpgt pfmax pfmin pfmul pfrcp pfrcpit1 pfrcpit2 pfrsqit1 pfrsqrt pfsub pfsubr pi2fd pmachriw pmaddwd pmagw pmulhriw pmulhrwa pmulhrwc pmulhw pmullw pmvgezb pmvlzb pmvnzb pmvzb pop popa popad popaw popf popfd popfq popfw por prefetch prefetchw pslld psllq psllw psrad psraw psrld psrlq psrlw psubb psubd psubsb psubsiw psubsw psubusb psubusw psubw punpckhbw punpckhdq punpckhwd punpcklbw punpckldq punpcklwd push pusha pushad pushaw pushf pushfd pushfq pushfw pxor rcl rcr rdshr rdmsr rdpmc rdtsc rdtscp ret retf retn rol ror rdm rsdc rsldt rsm rsts sahf sal salc sar sbb scasb scasd scasq scasw sfence sgdt shl shld shr shrd sidt sldt skinit smi smint smintold smsw stc std sti stosb stosd stosq stosw str sub svdc svldt svts swapgs syscall sysenter sysexit sysret test ud0 ud1 ud2b ud2 ud2a umov verr verw fwait wbinvd wrshr wrmsr xadd xbts xchg xlatb xlat xor cmove cmovz cmovne cmovnz cmova cmovnbe cmovae cmovnb cmovb cmovnae cmovbe cmovna cmovg cmovnle cmovge cmovnl cmovl cmovnge cmovle cmovng cmovc cmovnc cmovo cmovno cmovs cmovns cmovp cmovpe cmovnp cmovpo je jz jne jnz ja jnbe jae jnb jb jnae jbe jna jg jnle jge jnl jl jnge jle jng jc jnc jo jno js jns jpo jnp jpe jp sete setz setne setnz seta setnbe setae setnb setnc setb setnae setcset setbe setna setg setnle setge setnl setl setnge setle setng sets setns seto setno setpe setp setpo setnp addps addss andnps andps cmpeqps cmpeqss cmpleps cmpless cmpltps cmpltss cmpneqps cmpneqss cmpnleps cmpnless cmpnltps cmpnltss cmpordps cmpordss cmpunordps cmpunordss cmpps cmpss comiss cvtpi2ps cvtps2pi cvtsi2ss cvtss2si cvttps2pi cvttss2si divps divss ldmxcsr maxps maxss minps minss movaps movhps movlhps movlps movhlps movmskps movntps movss movups mulps mulss orps rcpps rcpss rsqrtps rsqrtss shufps sqrtps sqrtss stmxcsr subps subss ucomiss unpckhps unpcklps xorps fxrstor fxrstor64 fxsave fxsave64 xgetbv xsetbv xsave xsave64 xsaveopt xsaveopt64 xrstor xrstor64 prefetchnta prefetcht0 prefetcht1 prefetcht2 maskmovq movntq pavgb pavgw pextrw pinsrw pmaxsw pmaxub pminsw pminub pmovmskb pmulhuw psadbw pshufw pf2iw pfnacc pfpnacc pi2fw pswapd maskmovdqu clflush movntdq movnti movntpd movdqa movdqu movdq2q movq2dq paddq pmuludq pshufd pshufhw pshuflw pslldq psrldq psubq punpckhqdq punpcklqdq addpd addsd andnpd andpd cmpeqpd cmpeqsd cmplepd cmplesd cmpltpd cmpltsd cmpneqpd cmpneqsd cmpnlepd cmpnlesd cmpnltpd cmpnltsd cmpordpd cmpordsd cmpunordpd cmpunordsd cmppd comisd cvtdq2pd cvtdq2ps cvtpd2dq cvtpd2pi cvtpd2ps cvtpi2pd cvtps2dq cvtps2pd cvtsd2si cvtsd2ss cvtsi2sd cvtss2sd cvttpd2pi cvttpd2dq cvttps2dq cvttsd2si divpd divsd maxpd maxsd minpd minsd movapd movhpd movlpd movmskpd movupd mulpd mulsd orpd shufpd sqrtpd sqrtsd subpd subsd ucomisd unpckhpd unpcklpd xorpd addsubpd addsubps haddpd haddps hsubpd hsubps lddqu movddup movshdup movsldup clgi stgi vmcall vmclear vmfunc vmlaunch vmload vmmcall vmptrld vmptrst vmread vmresume vmrun vmsave vmwrite vmxoff vmxon invept invvpid pabsb pabsw pabsd palignr phaddw phaddd phaddsw phsubw phsubd phsubsw pmaddubsw pmulhrsw pshufb psignb psignw psignd extrq insertq movntsd movntss lzcnt blendpd blendps blendvpd blendvps dppd dpps extractps insertps movntdqa mpsadbw packusdw pblendvb pblendw pcmpeqq pextrb pextrd pextrq phminposuw pinsrb pinsrd pinsrq pmaxsb pmaxsd pmaxud pmaxuw pminsb pminsd pminud pminuw pmovsxbw pmovsxbd pmovsxbq pmovsxwd pmovsxwq pmovsxdq pmovzxbw pmovzxbd pmovzxbq pmovzxwd pmovzxwq pmovzxdq pmuldq pmulld ptest roundpd roundps roundsd roundss crc32 pcmpestri pcmpestrm pcmpistri pcmpistrm pcmpgtq popcnt getsec pfrcpv pfrsqrtv movbe aesenc aesenclast aesdec aesdeclast aesimc aeskeygenassist vaesenc vaesenclast vaesdec vaesdeclast vaesimc vaeskeygenassist vaddpd vaddps vaddsd vaddss vaddsubpd vaddsubps vandpd vandps vandnpd vandnps vblendpd vblendps vblendvpd vblendvps vbroadcastss vbroadcastsd vbroadcastf128 vcmpeq_ospd vcmpeqpd vcmplt_ospd vcmpltpd vcmple_ospd vcmplepd vcmpunord_qpd vcmpunordpd vcmpneq_uqpd vcmpneqpd vcmpnlt_uspd vcmpnltpd vcmpnle_uspd vcmpnlepd vcmpord_qpd vcmpordpd vcmpeq_uqpd vcmpnge_uspd vcmpngepd vcmpngt_uspd vcmpngtpd vcmpfalse_oqpd vcmpfalsepd vcmpneq_oqpd vcmpge_ospd vcmpgepd vcmpgt_ospd vcmpgtpd vcmptrue_uqpd vcmptruepd vcmplt_oqpd vcmple_oqpd vcmpunord_spd vcmpneq_uspd vcmpnlt_uqpd vcmpnle_uqpd vcmpord_spd vcmpeq_uspd vcmpnge_uqpd vcmpngt_uqpd vcmpfalse_ospd vcmpneq_ospd vcmpge_oqpd vcmpgt_oqpd vcmptrue_uspd vcmppd vcmpeq_osps vcmpeqps vcmplt_osps vcmpltps vcmple_osps vcmpleps vcmpunord_qps vcmpunordps vcmpneq_uqps vcmpneqps vcmpnlt_usps vcmpnltps vcmpnle_usps vcmpnleps vcmpord_qps vcmpordps vcmpeq_uqps vcmpnge_usps vcmpngeps vcmpngt_usps vcmpngtps vcmpfalse_oqps vcmpfalseps vcmpneq_oqps vcmpge_osps vcmpgeps vcmpgt_osps vcmpgtps vcmptrue_uqps vcmptrueps vcmplt_oqps vcmple_oqps vcmpunord_sps vcmpneq_usps vcmpnlt_uqps vcmpnle_uqps vcmpord_sps vcmpeq_usps vcmpnge_uqps vcmpngt_uqps vcmpfalse_osps vcmpneq_osps vcmpge_oqps vcmpgt_oqps vcmptrue_usps vcmpps vcmpeq_ossd vcmpeqsd vcmplt_ossd vcmpltsd vcmple_ossd vcmplesd vcmpunord_qsd vcmpunordsd vcmpneq_uqsd vcmpneqsd vcmpnlt_ussd vcmpnltsd vcmpnle_ussd vcmpnlesd vcmpord_qsd vcmpordsd vcmpeq_uqsd vcmpnge_ussd vcmpngesd vcmpngt_ussd vcmpngtsd vcmpfalse_oqsd vcmpfalsesd vcmpneq_oqsd vcmpge_ossd vcmpgesd vcmpgt_ossd vcmpgtsd vcmptrue_uqsd vcmptruesd vcmplt_oqsd vcmple_oqsd vcmpunord_ssd vcmpneq_ussd vcmpnlt_uqsd vcmpnle_uqsd vcmpord_ssd vcmpeq_ussd vcmpnge_uqsd vcmpngt_uqsd vcmpfalse_ossd vcmpneq_ossd vcmpge_oqsd vcmpgt_oqsd vcmptrue_ussd vcmpsd vcmpeq_osss vcmpeqss vcmplt_osss vcmpltss vcmple_osss vcmpless vcmpunord_qss vcmpunordss vcmpneq_uqss vcmpneqss vcmpnlt_usss vcmpnltss vcmpnle_usss vcmpnless vcmpord_qss vcmpordss vcmpeq_uqss vcmpnge_usss vcmpngess vcmpngt_usss vcmpngtss vcmpfalse_oqss vcmpfalsess vcmpneq_oqss vcmpge_osss vcmpgess vcmpgt_osss vcmpgtss vcmptrue_uqss vcmptruess vcmplt_oqss vcmple_oqss vcmpunord_sss vcmpneq_usss vcmpnlt_uqss vcmpnle_uqss vcmpord_sss vcmpeq_usss vcmpnge_uqss vcmpngt_uqss vcmpfalse_osss vcmpneq_osss vcmpge_oqss vcmpgt_oqss vcmptrue_usss vcmpss vcomisd vcomiss vcvtdq2pd vcvtdq2ps vcvtpd2dq vcvtpd2ps vcvtps2dq vcvtps2pd vcvtsd2si vcvtsd2ss vcvtsi2sd vcvtsi2ss vcvtss2sd vcvtss2si vcvttpd2dq vcvttps2dq vcvttsd2si vcvttss2si vdivpd vdivps vdivsd vdivss vdppd vdpps vextractf128 vextractps vhaddpd vhaddps vhsubpd vhsubps vinsertf128 vinsertps vlddqu vldqqu vldmxcsr vmaskmovdqu vmaskmovps vmaskmovpd vmaxpd vmaxps vmaxsd vmaxss vminpd vminps vminsd vminss vmovapd vmovaps vmovd vmovq vmovddup vmovdqa vmovqqa vmovdqu vmovqqu vmovhlps vmovhpd vmovhps vmovlhps vmovlpd vmovlps vmovmskpd vmovmskps vmovntdq vmovntqq vmovntdqa vmovntpd vmovntps vmovsd vmovshdup vmovsldup vmovss vmovupd vmovups vmpsadbw vmulpd vmulps vmulsd vmulss vorpd vorps vpabsb vpabsw vpabsd vpacksswb vpackssdw vpackuswb vpackusdw vpaddb vpaddw vpaddd vpaddq vpaddsb vpaddsw vpaddusb vpaddusw vpalignr vpand vpandn vpavgb vpavgw vpblendvb vpblendw vpcmpestri vpcmpestrm vpcmpistri vpcmpistrm vpcmpeqb vpcmpeqw vpcmpeqd vpcmpeqq vpcmpgtb vpcmpgtw vpcmpgtd vpcmpgtq vpermilpd vpermilps vperm2f128 vpextrb vpextrw vpextrd vpextrq vphaddw vphaddd vphaddsw vphminposuw vphsubw vphsubd vphsubsw vpinsrb vpinsrw vpinsrd vpinsrq vpmaddwd vpmaddubsw vpmaxsb vpmaxsw vpmaxsd vpmaxub vpmaxuw vpmaxud vpminsb vpminsw vpminsd vpminub vpminuw vpminud vpmovmskb vpmovsxbw vpmovsxbd vpmovsxbq vpmovsxwd vpmovsxwq vpmovsxdq vpmovzxbw vpmovzxbd vpmovzxbq vpmovzxwd vpmovzxwq vpmovzxdq vpmulhuw vpmulhrsw vpmulhw vpmullw vpmulld vpmuludq vpmuldq vpor vpsadbw vpshufb vpshufd vpshufhw vpshuflw vpsignb vpsignw vpsignd vpslldq vpsrldq vpsllw vpslld vpsllq vpsraw vpsrad vpsrlw vpsrld vpsrlq vptest vpsubb vpsubw vpsubd vpsubq vpsubsb vpsubsw vpsubusb vpsubusw vpunpckhbw vpunpckhwd vpunpckhdq vpunpckhqdq vpunpcklbw vpunpcklwd vpunpckldq vpunpcklqdq vpxor vrcpps vrcpss vrsqrtps vrsqrtss vroundpd vroundps vroundsd vroundss vshufpd vshufps vsqrtpd vsqrtps vsqrtsd vsqrtss vstmxcsr vsubpd vsubps vsubsd vsubss vtestps vtestpd vucomisd vucomiss vunpckhpd vunpckhps vunpcklpd vunpcklps vxorpd vxorps vzeroall vzeroupper pclmullqlqdq pclmulhqlqdq pclmullqhqdq pclmulhqhqdq pclmulqdq vpclmullqlqdq vpclmulhqlqdq vpclmullqhqdq vpclmulhqhqdq vpclmulqdq vfmadd132ps vfmadd132pd vfmadd312ps vfmadd312pd vfmadd213ps vfmadd213pd vfmadd123ps vfmadd123pd vfmadd231ps vfmadd231pd vfmadd321ps vfmadd321pd vfmaddsub132ps vfmaddsub132pd vfmaddsub312ps vfmaddsub312pd vfmaddsub213ps vfmaddsub213pd vfmaddsub123ps vfmaddsub123pd vfmaddsub231ps vfmaddsub231pd vfmaddsub321ps vfmaddsub321pd vfmsub132ps vfmsub132pd vfmsub312ps vfmsub312pd vfmsub213ps vfmsub213pd vfmsub123ps vfmsub123pd vfmsub231ps vfmsub231pd vfmsub321ps vfmsub321pd vfmsubadd132ps vfmsubadd132pd vfmsubadd312ps vfmsubadd312pd vfmsubadd213ps vfmsubadd213pd vfmsubadd123ps vfmsubadd123pd vfmsubadd231ps vfmsubadd231pd vfmsubadd321ps vfmsubadd321pd vfnmadd132ps vfnmadd132pd vfnmadd312ps vfnmadd312pd vfnmadd213ps vfnmadd213pd vfnmadd123ps vfnmadd123pd vfnmadd231ps vfnmadd231pd vfnmadd321ps vfnmadd321pd vfnmsub132ps vfnmsub132pd vfnmsub312ps vfnmsub312pd vfnmsub213ps vfnmsub213pd vfnmsub123ps vfnmsub123pd vfnmsub231ps vfnmsub231pd vfnmsub321ps vfnmsub321pd vfmadd132ss vfmadd132sd vfmadd312ss vfmadd312sd vfmadd213ss vfmadd213sd vfmadd123ss vfmadd123sd vfmadd231ss vfmadd231sd vfmadd321ss vfmadd321sd vfmsub132ss vfmsub132sd vfmsub312ss vfmsub312sd vfmsub213ss vfmsub213sd vfmsub123ss vfmsub123sd vfmsub231ss vfmsub231sd vfmsub321ss vfmsub321sd vfnmadd132ss vfnmadd132sd vfnmadd312ss vfnmadd312sd vfnmadd213ss vfnmadd213sd vfnmadd123ss vfnmadd123sd vfnmadd231ss vfnmadd231sd vfnmadd321ss vfnmadd321sd vfnmsub132ss vfnmsub132sd vfnmsub312ss vfnmsub312sd vfnmsub213ss vfnmsub213sd vfnmsub123ss vfnmsub123sd vfnmsub231ss vfnmsub231sd vfnmsub321ss vfnmsub321sd rdfsbase rdgsbase rdrand wrfsbase wrgsbase vcvtph2ps vcvtps2ph adcx adox rdseed clac stac xstore xcryptecb xcryptcbc xcryptctr xcryptcfb xcryptofb montmul xsha1 xsha256 llwpcb slwpcb lwpval lwpins vfmaddpd vfmaddps vfmaddsd vfmaddss vfmaddsubpd vfmaddsubps vfmsubaddpd vfmsubaddps vfmsubpd vfmsubps vfmsubsd vfmsubss vfnmaddpd vfnmaddps vfnmaddsd vfnmaddss vfnmsubpd vfnmsubps vfnmsubsd vfnmsubss vfrczpd vfrczps vfrczsd vfrczss vpcmov vpcomb vpcomd vpcomq vpcomub vpcomud vpcomuq vpcomuw vpcomw vphaddbd vphaddbq vphaddbw vphadddq vphaddubd vphaddubq vphaddubw vphaddudq vphadduwd vphadduwq vphaddwd vphaddwq vphsubbw vphsubdq vphsubwd vpmacsdd vpmacsdqh vpmacsdql vpmacssdd vpmacssdqh vpmacssdql vpmacsswd vpmacssww vpmacswd vpmacsww vpmadcsswd vpmadcswd vpperm vprotb vprotd vprotq vprotw vpshab vpshad vpshaq vpshaw vpshlb vpshld vpshlq vpshlw vbroadcasti128 vpblendd vpbroadcastb vpbroadcastw vpbroadcastd vpbroadcastq vpermd vpermpd vpermps vpermq vperm2i128 vextracti128 vinserti128 vpmaskmovd vpmaskmovq vpsllvd vpsllvq vpsravd vpsrlvd vpsrlvq vgatherdpd vgatherqpd vgatherdps vgatherqps vpgatherdd vpgatherqd vpgatherdq vpgatherqq xabort xbegin xend xtest andn bextr blci blcic blsi blsic blcfill blsfill blcmsk blsmsk blsr blcs bzhi mulx pdep pext rorx sarx shlx shrx tzcnt tzmsk t1mskc valignd valignq vblendmpd vblendmps vbroadcastf32x4 vbroadcastf64x4 vbroadcasti32x4 vbroadcasti64x4 vcompresspd vcompressps vcvtpd2udq vcvtps2udq vcvtsd2usi vcvtss2usi vcvttpd2udq vcvttps2udq vcvttsd2usi vcvttss2usi vcvtudq2pd vcvtudq2ps vcvtusi2sd vcvtusi2ss vexpandpd vexpandps vextractf32x4 vextractf64x4 vextracti32x4 vextracti64x4 vfixupimmpd vfixupimmps vfixupimmsd vfixupimmss vgetexppd vgetexpps vgetexpsd vgetexpss vgetmantpd vgetmantps vgetmantsd vgetmantss vinsertf32x4 vinsertf64x4 vinserti32x4 vinserti64x4 vmovdqa32 vmovdqa64 vmovdqu32 vmovdqu64 vpabsq vpandd vpandnd vpandnq vpandq vpblendmd vpblendmq vpcmpltd vpcmpled vpcmpneqd vpcmpnltd vpcmpnled vpcmpd vpcmpltq vpcmpleq vpcmpneqq vpcmpnltq vpcmpnleq vpcmpq vpcmpequd vpcmpltud vpcmpleud vpcmpnequd vpcmpnltud vpcmpnleud vpcmpud vpcmpequq vpcmpltuq vpcmpleuq vpcmpnequq vpcmpnltuq vpcmpnleuq vpcmpuq vpcompressd vpcompressq vpermi2d vpermi2pd vpermi2ps vpermi2q vpermt2d vpermt2pd vpermt2ps vpermt2q vpexpandd vpexpandq vpmaxsq vpmaxuq vpminsq vpminuq vpmovdb vpmovdw vpmovqb vpmovqd vpmovqw vpmovsdb vpmovsdw vpmovsqb vpmovsqd vpmovsqw vpmovusdb vpmovusdw vpmovusqb vpmovusqd vpmovusqw vpord vporq vprold vprolq vprolvd vprolvq vprord vprorq vprorvd vprorvq vpscatterdd vpscatterdq vpscatterqd vpscatterqq vpsraq vpsravq vpternlogd vpternlogq vptestmd vptestmq vptestnmd vptestnmq vpxord vpxorq vrcp14pd vrcp14ps vrcp14sd vrcp14ss vrndscalepd vrndscaleps vrndscalesd vrndscaless vrsqrt14pd vrsqrt14ps vrsqrt14sd vrsqrt14ss vscalefpd vscalefps vscalefsd vscalefss vscatterdpd vscatterdps vscatterqpd vscatterqps vshuff32x4 vshuff64x2 vshufi32x4 vshufi64x2 kandnw kandw kmovw knotw kortestw korw kshiftlw kshiftrw kunpckbw kxnorw kxorw vpbroadcastmb2q vpbroadcastmw2d vpconflictd vpconflictq vplzcntd vplzcntq vexp2pd vexp2ps vrcp28pd vrcp28ps vrcp28sd vrcp28ss vrsqrt28pd vrsqrt28ps vrsqrt28sd vrsqrt28ss vgatherpf0dpd vgatherpf0dps vgatherpf0qpd vgatherpf0qps vgatherpf1dpd vgatherpf1dps vgatherpf1qpd vgatherpf1qps vscatterpf0dpd vscatterpf0dps vscatterpf0qpd vscatterpf0qps vscatterpf1dpd vscatterpf1dps vscatterpf1qpd vscatterpf1qps prefetchwt1 bndmk bndcl bndcu bndcn bndmov bndldx bndstx sha1rnds4 sha1nexte sha1msg1 sha1msg2 sha256rnds2 sha256msg1 sha256msg2 hint_nop0 hint_nop1 hint_nop2 hint_nop3 hint_nop4 hint_nop5 hint_nop6 hint_nop7 hint_nop8 hint_nop9 hint_nop10 hint_nop11 hint_nop12 hint_nop13 hint_nop14 hint_nop15 hint_nop16 hint_nop17 hint_nop18 hint_nop19 hint_nop20 hint_nop21 hint_nop22 hint_nop23 hint_nop24 hint_nop25 hint_nop26 hint_nop27 hint_nop28 hint_nop29 hint_nop30 hint_nop31 hint_nop32 hint_nop33 hint_nop34 hint_nop35 hint_nop36 hint_nop37 hint_nop38 hint_nop39 hint_nop40 hint_nop41 hint_nop42 hint_nop43 hint_nop44 hint_nop45 hint_nop46 hint_nop47 hint_nop48 hint_nop49 hint_nop50 hint_nop51 hint_nop52 hint_nop53 hint_nop54 hint_nop55 hint_nop56 hint_nop57 hint_nop58 hint_nop59 hint_nop60 hint_nop61 hint_nop62 hint_nop63",built_in:"ip eip rip al ah bl bh cl ch dl dh sil dil bpl spl r8b r9b r10b r11b r12b r13b r14b r15b ax bx cx dx si di bp sp r8w r9w r10w r11w r12w r13w r14w r15w eax ebx ecx edx esi edi ebp esp eip r8d r9d r10d r11d r12d r13d r14d r15d rax rbx rcx rdx rsi rdi rbp rsp r8 r9 r10 r11 r12 r13 r14 r15 cs ds es fs gs ss st st0 st1 st2 st3 st4 st5 st6 st7 mm0 mm1 mm2 mm3 mm4 mm5 mm6 mm7 xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 xmm8 xmm9 xmm10 xmm11 xmm12 xmm13 xmm14 xmm15 xmm16 xmm17 xmm18 xmm19 xmm20 xmm21 xmm22 xmm23 xmm24 xmm25 xmm26 xmm27 xmm28 xmm29 xmm30 xmm31 ymm0 ymm1 ymm2 ymm3 ymm4 ymm5 ymm6 ymm7 ymm8 ymm9 ymm10 ymm11 ymm12 ymm13 ymm14 ymm15 ymm16 ymm17 ymm18 ymm19 ymm20 ymm21 ymm22 ymm23 ymm24 ymm25 ymm26 ymm27 ymm28 ymm29 ymm30 ymm31 zmm0 zmm1 zmm2 zmm3 zmm4 zmm5 zmm6 zmm7 zmm8 zmm9 zmm10 zmm11 zmm12 zmm13 zmm14 zmm15 zmm16 zmm17 zmm18 zmm19 zmm20 zmm21 zmm22 zmm23 zmm24 zmm25 zmm26 zmm27 zmm28 zmm29 zmm30 zmm31 k0 k1 k2 k3 k4 k5 k6 k7 bnd0 bnd1 bnd2 bnd3 cr0 cr1 cr2 cr3 cr4 cr8 dr0 dr1 dr2 dr3 dr8 tr3 tr4 tr5 tr6 tr7 r0 r1 r2 r3 r4 r5 r6 r7 r0b r1b r2b r3b r4b r5b r6b r7b r0w r1w r2w r3w r4w r5w r6w r7w r0d r1d r2d r3d r4d r5d r6d r7d r0h r1h r2h r3h r0l r1l r2l r3l r4l r5l r6l r7l r8l r9l r10l r11l r12l r13l r14l r15l db dw dd dq dt ddq do dy dz resb resw resd resq rest resdq reso resy resz incbin equ times byte word dword qword nosplit rel abs seg wrt strict near far a32 ptr",meta:"%define %xdefine %+ %undef %defstr %deftok %assign %strcat %strlen %substr %rotate %elif %else %endif %if %ifmacro %ifctx %ifidn %ifidni %ifid %ifnum %ifstr %iftoken %ifempty %ifenv %error %warning %fatal %rep %endrep %include %push %pop %repl %pathsearch %depend %use %arg %stacksize %local %line %comment %endcomment .nolist __FILE__ __LINE__ __SECT__ __BITS__ __OUTPUT_FORMAT__ __DATE__ __TIME__ __DATE_NUM__ __TIME_NUM__ __UTC_DATE__ __UTC_TIME__ __UTC_DATE_NUM__ __UTC_TIME_NUM__ __PASS__ struc endstruc istruc at iend align alignb sectalign daz nodaz up down zero default option assume public bits use16 use32 use64 default section segment absolute extern global common cpu float __utf16__ __utf16le__ __utf16be__ __utf32__ __utf32le__ __utf32be__ __float8__ __float16__ __float32__ __float64__ __float80m__ __float80e__ __float128l__ __float128h__ __Infinity__ __QNaN__ __SNaN__ Inf NaN QNaN SNaN float8 float16 float32 float64 float80m float80e float128l float128h __FLOAT_DAZ__ __FLOAT_ROUND__ __FLOAT__"},c:[s.C(";","$",{r:0}),{cN:"number",v:[{b:"\\b(?:([0-9][0-9_]*)?\\.[0-9_]*(?:[eE][+-]?[0-9_]+)?|(0[Xx])?[0-9][0-9_]*\\.?[0-9_]*(?:[pP](?:[+-]?[0-9_]+)?)?)\\b",r:0},{b:"\\$[0-9][0-9A-Fa-f]*",r:0},{b:"\\b(?:[0-9A-Fa-f][0-9A-Fa-f_]*[Hh]|[0-9][0-9_]*[DdTt]?|[0-7][0-7_]*[QqOo]|[0-1][0-1_]*[BbYy])\\b"},{b:"\\b(?:0[Xx][0-9A-Fa-f_]+|0[DdTt][0-9_]+|0[QqOo][0-7_]+|0[BbYy][0-1_]+)\\b"}]},s.QSM,{cN:"string",v:[{b:"'",e:"[^\\\\]'"},{b:"`",e:"[^\\\\]`"}],r:0},{cN:"symbol",v:[{b:"^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)"},{b:"^\\s*%%[A-Za-z0-9_$#@~.?]*:"}],r:0},{cN:"subst",b:"%[0-9]+",r:0},{cN:"subst",b:"%!S+",r:0},{cN:"meta",b:/^\s*\.[\w_-]+/}]}});hljs.registerLanguage("hsp",function(e){return{cI:!0,l:/[\w\._]+/,k:"goto gosub return break repeat loop continue wait await dim sdim foreach dimtype dup dupptr end stop newmod delmod mref run exgoto on mcall assert logmes newlab resume yield onexit onerror onkey onclick oncmd exist delete mkdir chdir dirlist bload bsave bcopy memfile if else poke wpoke lpoke getstr chdpm memexpand memcpy memset notesel noteadd notedel noteload notesave randomize noteunsel noteget split strrep setease button chgdisp exec dialog mmload mmplay mmstop mci pset pget syscolor mes print title pos circle cls font sysfont objsize picload color palcolor palette redraw width gsel gcopy gzoom gmode bmpsave hsvcolor getkey listbox chkbox combox input mesbox buffer screen bgscr mouse objsel groll line clrobj boxf objprm objmode stick grect grotate gsquare gradf objimage objskip objenable celload celdiv celput newcom querycom delcom cnvstow comres axobj winobj sendmsg comevent comevarg sarrayconv callfunc cnvwtos comevdisp libptr system hspstat hspver stat cnt err strsize looplev sublev iparam wparam lparam refstr refdval int rnd strlen length length2 length3 length4 vartype gettime peek wpeek lpeek varptr varuse noteinfo instr abs limit getease str strmid strf getpath strtrim sin cos tan atan sqrt double absf expf logf limitf powf geteasef mousex mousey mousew hwnd hinstance hdc ginfo objinfo dirinfo sysinfo thismod __hspver__ __hsp30__ __date__ __time__ __line__ __file__ _debug __hspdef__ and or xor not screen_normal screen_palette screen_hide screen_fixedsize screen_tool screen_frame gmode_gdi gmode_mem gmode_rgb0 gmode_alpha gmode_rgb0alpha gmode_add gmode_sub gmode_pixela ginfo_mx ginfo_my ginfo_act ginfo_sel ginfo_wx1 ginfo_wy1 ginfo_wx2 ginfo_wy2 ginfo_vx ginfo_vy ginfo_sizex ginfo_sizey ginfo_winx ginfo_winy ginfo_mesx ginfo_mesy ginfo_r ginfo_g ginfo_b ginfo_paluse ginfo_dispx ginfo_dispy ginfo_cx ginfo_cy ginfo_intid ginfo_newid ginfo_sx ginfo_sy objinfo_mode objinfo_bmscr objinfo_hwnd notemax notesize dir_cur dir_exe dir_win dir_sys dir_cmdline dir_desktop dir_mydoc dir_tv font_normal font_bold font_italic font_underline font_strikeout font_antialias objmode_normal objmode_guifont objmode_usefont gsquare_grad msgothic msmincho do until while wend for next _break _continue switch case default swbreak swend ddim ldim alloc m_pi rad2deg deg2rad ease_linear ease_quad_in ease_quad_out ease_quad_inout ease_cubic_in ease_cubic_out ease_cubic_inout ease_quartic_in ease_quartic_out ease_quartic_inout ease_bounce_in ease_bounce_out ease_bounce_inout ease_shake_in ease_shake_out ease_shake_inout ease_loop",c:[e.CLCM,e.CBCM,e.QSM,e.ASM,{cN:"string",b:'{"',e:'"}',c:[e.BE]},e.C(";","$",{r:0}),{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"addion cfunc cmd cmpopt comfunc const defcfunc deffunc define else endif enum epack func global if ifdef ifndef include modcfunc modfunc modinit modterm module pack packopt regcmd runtime undef usecom uselib"},c:[e.inherit(e.QSM,{cN:"meta-string"}),e.NM,e.CNM,e.CLCM,e.CBCM]},{cN:"symbol",b:"^\\*(\\w+|@)"},e.NM,e.CNM]}});hljs.registerLanguage("lasso",function(e){var r="[a-zA-Z_][\\w.]*",a="<\\?(lasso(script)?|=)",t="\\]|\\?>",n={literal:"true false none minimal full all void and or not bw nbw ew new cn ncn lt lte gt gte eq neq rx nrx ft",built_in:"array date decimal duration integer map pair string tag xml null boolean bytes keyword list locale queue set stack staticarray local var variable global data self inherited currentcapture givenblock",keyword:"cache database_names database_schemanames database_tablenames define_tag define_type email_batch encode_set html_comment handle handle_error header if inline iterate ljax_target link link_currentaction link_currentgroup link_currentrecord link_detail link_firstgroup link_firstrecord link_lastgroup link_lastrecord link_nextgroup link_nextrecord link_prevgroup link_prevrecord log loop namespace_using output_none portal private protect records referer referrer repeating resultset rows search_args search_arguments select sort_args sort_arguments thread_atomic value_list while abort case else fail_if fail_ifnot fail if_empty if_false if_null if_true loop_abort loop_continue loop_count params params_up return return_value run_children soap_definetag soap_lastrequest soap_lastresponse tag_name ascending average by define descending do equals frozen group handle_failure import in into join let match max min on order parent protected provide public require returnhome skip split_thread sum take thread to trait type where with yield yieldhome"},i=e.C("",{r:0}),s={cN:"meta",b:"\\[noprocess\\]",starts:{e:"\\[/noprocess\\]",rE:!0,c:[i]}},l={cN:"meta",b:"\\[/noprocess|"+a},o={cN:"symbol",b:"'"+r+"'"},c=[e.CLCM,e.CBCM,e.inherit(e.CNM,{b:e.CNR+"|(-?infinity|NaN)\\b"}),e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null}),{cN:"string",b:"`",e:"`"},{v:[{b:"[#$]"+r},{b:"#",e:"\\d+",i:"\\W"}]},{cN:"type",b:"::\\s*",e:r,i:"\\W"},{cN:"params",v:[{b:"-(?!infinity)"+r,r:0},{b:"(\\.\\.\\.)"}]},{b:/(->|\.)\s*/,r:0,c:[o]},{cN:"class",bK:"define",rE:!0,e:"\\(|=>",c:[e.inherit(e.TM,{b:r+"(=(?!>))?|[-+*/%](?!>)"})]}];return{aliases:["ls","lassoscript"],cI:!0,l:r+"|&[lg]t;",k:n,c:[{cN:"meta",b:t,r:0,starts:{e:"\\[|"+a,rE:!0,r:0,c:[i]}},s,l,{cN:"meta",b:"\\[no_square_brackets",starts:{e:"\\[/no_square_brackets\\]",l:r+"|&[lg]t;",k:n,c:[{cN:"meta",b:t,r:0,starts:{e:"\\[noprocess\\]|"+a,rE:!0,c:[i]}},s,l].concat(c)}},{cN:"meta",b:"\\[",r:0},{cN:"meta",b:"^#!",e:"lasso9$",r:10}].concat(c)}});hljs.registerLanguage("profile",function(e){return{c:[e.CNM,{b:"[a-zA-Z_][\\da-zA-Z_]+\\.[\\da-zA-Z_]{1,3}",e:":",eE:!0},{b:"(ncalls|tottime|cumtime)",e:"$",k:"ncalls tottime|10 cumtime|10 filename",r:10},{b:"function calls",e:"$",c:[e.CNM],r:10},e.ASM,e.QSM,{cN:"string",b:"\\(",e:"\\)$",eB:!0,eE:!0,r:0}]}});hljs.registerLanguage("tcl",function(e){return{aliases:["tk"],k:"after append apply array auto_execok auto_import auto_load auto_mkindex auto_mkindex_old auto_qualify auto_reset bgerror binary break catch cd chan clock close concat continue dde dict encoding eof error eval exec exit expr fblocked fconfigure fcopy file fileevent filename flush for foreach format gets glob global history http if incr info interp join lappend|10 lassign|10 lindex|10 linsert|10 list llength|10 load lrange|10 lrepeat|10 lreplace|10 lreverse|10 lsearch|10 lset|10 lsort|10 mathfunc mathop memory msgcat namespace open package parray pid pkg::create pkg_mkIndex platform platform::shell proc puts pwd read refchan regexp registry regsub|10 rename return safe scan seek set socket source split string subst switch tcl_endOfWord tcl_findLibrary tcl_startOfNextWord tcl_startOfPreviousWord tcl_wordBreakAfter tcl_wordBreakBefore tcltest tclvars tell time tm trace unknown unload unset update uplevel upvar variable vwait while",c:[e.C(";[ \\t]*#","$"),e.C("^[ \\t]*#","$"),{bK:"proc",e:"[\\{]",eE:!0,c:[{cN:"title",b:"[ \\t\\n\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*",e:"[ \\t\\n\\r]",eW:!0,eE:!0}]},{eE:!0,v:[{b:"\\$(\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*\\(([a-zA-Z0-9_])*\\)",e:"[^a-zA-Z0-9_\\}\\$]"},{b:"\\$(\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*",e:"(\\))?[^a-zA-Z0-9_\\}\\$]"}]},{cN:"string",c:[e.BE],v:[e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},{cN:"number",v:[e.BNM,e.CNM]}]}});hljs.registerLanguage("ocaml",function(e){return{aliases:["ml"],k:{keyword:"and as assert asr begin class constraint do done downto else end exception external for fun function functor if in include inherit! inherit initializer land lazy let lor lsl lsr lxor match method!|10 method mod module mutable new object of open! open or private rec sig struct then to try type val! val virtual when while with parser value",built_in:"array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 string unit in_channel out_channel ref",literal:"true false"},i:/\/\/|>>/,l:"[a-z_]\\w*!?",c:[{cN:"literal",b:"\\[(\\|\\|)?\\]|\\(\\)",r:0},e.C("\\(\\*","\\*\\)",{c:["self"]}),{cN:"symbol",b:"'[A-Za-z_](?!')[\\w']*"},{cN:"type",b:"`[A-Z][\\w']*"},{cN:"type",b:"\\b[A-Z][\\w']*",r:0},{b:"[a-z_]\\w*'[\\w']*",r:0},e.inherit(e.ASM,{cN:"string",r:0}),e.inherit(e.QSM,{i:null}),{cN:"number",b:"\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",r:0},{b:/[-=]>/}]}});hljs.registerLanguage("leaf",function(e){return{c:[{cN:"function",b:"#+[A-Za-z_0-9]*\\(",e:" {",rB:!0,eE:!0,c:[{cN:"keyword",b:"#+"},{cN:"title",b:"[A-Za-z_][A-Za-z_0-9]*"},{cN:"params",b:"\\(",e:"\\)",endsParent:!0,c:[{cN:"string",b:'"',e:'"'},{cN:"variable",b:"[A-Za-z_][A-Za-z_0-9]*"}]}]}]}});hljs.registerLanguage("monkey",function(e){var n={cN:"number",r:0,v:[{b:"[$][a-fA-F0-9]+"},e.NM]};return{cI:!0,k:{keyword:"public private property continue exit extern new try catch eachin not abstract final select case default const local global field end if then else elseif endif while wend repeat until forever for to step next return module inline throw import",built_in:"DebugLog DebugStop Error Print ACos ACosr ASin ASinr ATan ATan2 ATan2r ATanr Abs Abs Ceil Clamp Clamp Cos Cosr Exp Floor Log Max Max Min Min Pow Sgn Sgn Sin Sinr Sqrt Tan Tanr Seed PI HALFPI TWOPI",literal:"true false null and or shl shr mod"},i:/\/\*/,c:[e.C("#rem","#end"),e.C("'","$",{r:0}),{cN:"function",bK:"function method",e:"[(=:]|$",i:/\n/,c:[e.UTM]},{cN:"class",bK:"class interface",e:"$",c:[{bK:"extends implements"},e.UTM]},{cN:"built_in",b:"\\b(self|super)\\b"},{cN:"meta",b:"\\s*#",e:"$",k:{"meta-keyword":"if else elseif endif end then"}},{cN:"meta",b:"^\\s*strict\\b"},{bK:"alias",e:"=",c:[e.UTM]},e.QSM,n]}});hljs.registerLanguage("groovy",function(e){return{k:{literal:"true false null",keyword:"byte short char int long boolean float double void def as in assert trait super this abstract static volatile transient public private protected synchronized final class interface enum if else for while switch case break default continue throw throws try catch finally implements extends new import package return instanceof"},c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,{cN:"string",b:'"""',e:'"""'},{cN:"string",b:"'''",e:"'''"},{cN:"string",b:"\\$/",e:"/\\$",r:10},e.ASM,{cN:"regexp",b:/~?\/[^\/\n]+\//,c:[e.BE]},e.QSM,{cN:"meta",b:"^#!/usr/bin/env",e:"$",i:"\n"},e.BNM,{cN:"class",bK:"class interface trait enum",e:"{",i:":",c:[{bK:"extends implements"},e.UTM]},e.CNM,{cN:"meta",b:"@[A-Za-z]+"},{cN:"string",b:/[^\?]{0}[A-Za-z0-9_$]+ *:/},{b:/\?/,e:/\:/},{cN:"symbol",b:"^\\s*[A-Za-z0-9_$]+:",r:0}],i:/#|<\//}});hljs.registerLanguage("cpp",function(t){var e={cN:"keyword",b:"\\b[a-z\\d_]*_t\\b"},r={cN:"string",v:[{b:'(u8?|U)?L?"',e:'"',i:"\\n",c:[t.BE]},{b:'(u8?|U)?R"',e:'"',c:[t.BE]},{b:"'\\\\?.",e:"'",i:"."}]},s={cN:"number",v:[{b:"\\b(0b[01']+)"},{b:"\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{b:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],r:0},i={cN:"meta",b:/#\s*[a-z]+\b/,e:/$/,k:{"meta-keyword":"if else elif endif define undef warning error line pragma ifdef ifndef include"},c:[{b:/\\\n/,r:0},t.inherit(r,{cN:"meta-string"}),{cN:"meta-string",b:/<[^\n>]*>/,e:/$/,i:"\\n"},t.CLCM,t.CBCM]},a=t.IR+"\\s*\\(",c={keyword:"int float while private char catch import module export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue inline delete alignof constexpr decltype noexcept static_assert thread_local restrict _Bool complex _Complex _Imaginary atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong new throw return",built_in:"std string cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr",literal:"true false nullptr NULL"},n=[e,t.CLCM,t.CBCM,s,r];return{aliases:["c","cc","h","c++","h++","hpp"],k:c,i:"",k:c,c:["self",e]},{b:t.IR+"::",k:c},{v:[{b:/=/,e:/;/},{b:/\(/,e:/\)/},{bK:"new throw return else",e:/;/}],k:c,c:n.concat([{b:/\(/,e:/\)/,k:c,c:n.concat(["self"]),r:0}]),r:0},{cN:"function",b:"("+t.IR+"[\\*&\\s]+)+"+a,rB:!0,e:/[{;=]/,eE:!0,k:c,i:/[^\w\s\*&]/,c:[{b:a,rB:!0,c:[t.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:c,r:0,c:[t.CLCM,t.CBCM,r,s,e]},t.CLCM,t.CBCM,i]}]),exports:{preprocessor:i,strings:r,k:c}}});hljs.registerLanguage("sqf",function(e){var t=e.getLanguage("cpp").exports,a={cN:"variable",b:/\b_+[a-zA-Z_]\w*/},o={cN:"title",b:/[a-zA-Z][a-zA-Z0-9]+_fnc_\w*/},r={cN:"string",v:[{b:'"',e:'"',c:[{b:'""',r:0}]},{b:"'",e:"'",c:[{b:"''",r:0}]}]};return{aliases:["sqf"],cI:!0,k:{keyword:"case catch default do else exit exitWith for forEach from if switch then throw to try waitUntil while with",built_in:"abs accTime acos action actionIDs actionKeys actionKeysImages actionKeysNames actionKeysNamesArray actionName actionParams activateAddons activatedAddons activateKey add3DENConnection add3DENEventHandler add3DENLayer addAction addBackpack addBackpackCargo addBackpackCargoGlobal addBackpackGlobal addCamShake addCuratorAddons addCuratorCameraArea addCuratorEditableObjects addCuratorEditingArea addCuratorPoints addEditorObject addEventHandler addGoggles addGroupIcon addHandgunItem addHeadgear addItem addItemCargo addItemCargoGlobal addItemPool addItemToBackpack addItemToUniform addItemToVest addLiveStats addMagazine addMagazineAmmoCargo addMagazineCargo addMagazineCargoGlobal addMagazineGlobal addMagazinePool addMagazines addMagazineTurret addMenu addMenuItem addMissionEventHandler addMPEventHandler addMusicEventHandler addOwnedMine addPlayerScores addPrimaryWeaponItem addPublicVariableEventHandler addRating addResources addScore addScoreSide addSecondaryWeaponItem addSwitchableUnit addTeamMember addToRemainsCollector addUniform addVehicle addVest addWaypoint addWeapon addWeaponCargo addWeaponCargoGlobal addWeaponGlobal addWeaponItem addWeaponPool addWeaponTurret agent agents AGLToASL aimedAtTarget aimPos airDensityRTD airportSide AISFinishHeal alive all3DENEntities allControls allCurators allCutLayers allDead allDeadMen allDisplays allGroups allMapMarkers allMines allMissionObjects allow3DMode allowCrewInImmobile allowCuratorLogicIgnoreAreas allowDamage allowDammage allowFileOperations allowFleeing allowGetIn allowSprint allPlayers allSites allTurrets allUnits allUnitsUAV allVariables ammo and animate animateDoor animateSource animationNames animationPhase animationSourcePhase animationState append apply armoryPoints arrayIntersect asin ASLToAGL ASLToATL assert assignAsCargo assignAsCargoIndex assignAsCommander assignAsDriver assignAsGunner assignAsTurret assignCurator assignedCargo assignedCommander assignedDriver assignedGunner assignedItems assignedTarget assignedTeam assignedVehicle assignedVehicleRole assignItem assignTeam assignToAirport atan atan2 atg ATLToASL attachedObject attachedObjects attachedTo attachObject attachTo attackEnabled backpack backpackCargo backpackContainer backpackItems backpackMagazines backpackSpaceFor behaviour benchmark binocular blufor boundingBox boundingBoxReal boundingCenter breakOut breakTo briefingName buildingExit buildingPos buttonAction buttonSetAction cadetMode call callExtension camCommand camCommit camCommitPrepared camCommitted camConstuctionSetParams camCreate camDestroy cameraEffect cameraEffectEnableHUD cameraInterest cameraOn cameraView campaignConfigFile camPreload camPreloaded camPrepareBank camPrepareDir camPrepareDive camPrepareFocus camPrepareFov camPrepareFovRange camPreparePos camPrepareRelPos camPrepareTarget camSetBank camSetDir camSetDive camSetFocus camSetFov camSetFovRange camSetPos camSetRelPos camSetTarget camTarget camUseNVG canAdd canAddItemToBackpack canAddItemToUniform canAddItemToVest cancelSimpleTaskDestination canFire canMove canSlingLoad canStand canSuspend canUnloadInCombat canVehicleCargo captive captiveNum cbChecked cbSetChecked ceil channelEnabled cheatsEnabled checkAIFeature checkVisibility civilian className clearAllItemsFromBackpack clearBackpackCargo clearBackpackCargoGlobal clearGroupIcons clearItemCargo clearItemCargoGlobal clearItemPool clearMagazineCargo clearMagazineCargoGlobal clearMagazinePool clearOverlay clearRadio clearWeaponCargo clearWeaponCargoGlobal clearWeaponPool clientOwner closeDialog closeDisplay closeOverlay collapseObjectTree collect3DENHistory combatMode commandArtilleryFire commandChat commander commandFire commandFollow commandFSM commandGetOut commandingMenu commandMove commandRadio commandStop commandSuppressiveFire commandTarget commandWatch comment commitOverlay compile compileFinal completedFSM composeText configClasses configFile configHierarchy configName configNull configProperties configSourceAddonList configSourceMod configSourceModList connectTerminalToUAV controlNull controlsGroupCtrl copyFromClipboard copyToClipboard copyWaypoints cos count countEnemy countFriendly countSide countType countUnknown create3DENComposition create3DENEntity createAgent createCenter createDialog createDiaryLink createDiaryRecord createDiarySubject createDisplay createGearDialog createGroup createGuardedPoint createLocation createMarker createMarkerLocal createMenu createMine createMissionDisplay createMPCampaignDisplay createSimpleObject createSimpleTask createSite createSoundSource createTask createTeam createTrigger createUnit createVehicle createVehicleCrew createVehicleLocal crew ctrlActivate ctrlAddEventHandler ctrlAngle ctrlAutoScrollDelay ctrlAutoScrollRewind ctrlAutoScrollSpeed ctrlChecked ctrlClassName ctrlCommit ctrlCommitted ctrlCreate ctrlDelete ctrlEnable ctrlEnabled ctrlFade ctrlHTMLLoaded ctrlIDC ctrlIDD ctrlMapAnimAdd ctrlMapAnimClear ctrlMapAnimCommit ctrlMapAnimDone ctrlMapCursor ctrlMapMouseOver ctrlMapScale ctrlMapScreenToWorld ctrlMapWorldToScreen ctrlModel ctrlModelDirAndUp ctrlModelScale ctrlParent ctrlParentControlsGroup ctrlPosition ctrlRemoveAllEventHandlers ctrlRemoveEventHandler ctrlScale ctrlSetActiveColor ctrlSetAngle ctrlSetAutoScrollDelay ctrlSetAutoScrollRewind ctrlSetAutoScrollSpeed ctrlSetBackgroundColor ctrlSetChecked ctrlSetEventHandler ctrlSetFade ctrlSetFocus ctrlSetFont ctrlSetFontH1 ctrlSetFontH1B ctrlSetFontH2 ctrlSetFontH2B ctrlSetFontH3 ctrlSetFontH3B ctrlSetFontH4 ctrlSetFontH4B ctrlSetFontH5 ctrlSetFontH5B ctrlSetFontH6 ctrlSetFontH6B ctrlSetFontHeight ctrlSetFontHeightH1 ctrlSetFontHeightH2 ctrlSetFontHeightH3 ctrlSetFontHeightH4 ctrlSetFontHeightH5 ctrlSetFontHeightH6 ctrlSetFontHeightSecondary ctrlSetFontP ctrlSetFontPB ctrlSetFontSecondary ctrlSetForegroundColor ctrlSetModel ctrlSetModelDirAndUp ctrlSetModelScale ctrlSetPosition ctrlSetScale ctrlSetStructuredText ctrlSetText ctrlSetTextColor ctrlSetTooltip ctrlSetTooltipColorBox ctrlSetTooltipColorShade ctrlSetTooltipColorText ctrlShow ctrlShown ctrlText ctrlTextHeight ctrlType ctrlVisible curatorAddons curatorCamera curatorCameraArea curatorCameraAreaCeiling curatorCoef curatorEditableObjects curatorEditingArea curatorEditingAreaType curatorMouseOver curatorPoints curatorRegisteredObjects curatorSelected curatorWaypointCost current3DENOperation currentChannel currentCommand currentMagazine currentMagazineDetail currentMagazineDetailTurret currentMagazineTurret currentMuzzle currentNamespace currentTask currentTasks currentThrowable currentVisionMode currentWaypoint currentWeapon currentWeaponMode currentWeaponTurret currentZeroing cursorObject cursorTarget customChat customRadio cutFadeOut cutObj cutRsc cutText damage date dateToNumber daytime deActivateKey debriefingText debugFSM debugLog deg delete3DENEntities deleteAt deleteCenter deleteCollection deleteEditorObject deleteGroup deleteIdentity deleteLocation deleteMarker deleteMarkerLocal deleteRange deleteResources deleteSite deleteStatus deleteTeam deleteVehicle deleteVehicleCrew deleteWaypoint detach detectedMines diag_activeMissionFSMs diag_activeScripts diag_activeSQFScripts diag_activeSQSScripts diag_captureFrame diag_captureSlowFrame diag_codePerformance diag_drawMode diag_enable diag_enabled diag_fps diag_fpsMin diag_frameNo diag_list diag_log diag_logSlowFrame diag_mergeConfigFile diag_recordTurretLimits diag_tickTime diag_toggle dialog diarySubjectExists didJIP didJIPOwner difficulty difficultyEnabled difficultyEnabledRTD difficultyOption direction directSay disableAI disableCollisionWith disableConversation disableDebriefingStats disableNVGEquipment disableRemoteSensors disableSerialization disableTIEquipment disableUAVConnectability disableUserInput displayAddEventHandler displayCtrl displayNull displayParent displayRemoveAllEventHandlers displayRemoveEventHandler displaySetEventHandler dissolveTeam distance distance2D distanceSqr distributionRegion do3DENAction doArtilleryFire doFire doFollow doFSM doGetOut doMove doorPhase doStop doSuppressiveFire doTarget doWatch drawArrow drawEllipse drawIcon drawIcon3D drawLine drawLine3D drawLink drawLocation drawPolygon drawRectangle driver drop east echo edit3DENMissionAttributes editObject editorSetEventHandler effectiveCommander emptyPositions enableAI enableAIFeature enableAimPrecision enableAttack enableAudioFeature enableCamShake enableCaustics enableChannel enableCollisionWith enableCopilot enableDebriefingStats enableDiagLegend enableEndDialog enableEngineArtillery enableEnvironment enableFatigue enableGunLights enableIRLasers enableMimics enablePersonTurret enableRadio enableReload enableRopeAttach enableSatNormalOnDetail enableSaving enableSentences enableSimulation enableSimulationGlobal enableStamina enableTeamSwitch enableUAVConnectability enableUAVWaypoints enableVehicleCargo endLoadingScreen endMission engineOn enginesIsOnRTD enginesRpmRTD enginesTorqueRTD entities estimatedEndServerTime estimatedTimeLeft evalObjectArgument everyBackpack everyContainer exec execEditorScript execFSM execVM exp expectedDestination exportJIPMessages eyeDirection eyePos face faction fadeMusic fadeRadio fadeSound fadeSpeech failMission fillWeaponsFromPool find findCover findDisplay findEditorObject findEmptyPosition findEmptyPositionReady findNearestEnemy finishMissionInit finite fire fireAtTarget firstBackpack flag flagOwner flagSide flagTexture fleeing floor flyInHeight flyInHeightASL fog fogForecast fogParams forceAddUniform forcedMap forceEnd forceMap forceRespawn forceSpeed forceWalk forceWeaponFire forceWeatherChange forEachMember forEachMemberAgent forEachMemberTeam format formation formationDirection formationLeader formationMembers formationPosition formationTask formatText formLeader freeLook fromEditor fuel fullCrew gearIDCAmmoCount gearSlotAmmoCount gearSlotData get3DENActionState get3DENAttribute get3DENCamera get3DENConnections get3DENEntity get3DENEntityID get3DENGrid get3DENIconsVisible get3DENLayerEntities get3DENLinesVisible get3DENMissionAttribute get3DENMouseOver get3DENSelected getAimingCoef getAllHitPointsDamage getAllOwnedMines getAmmoCargo getAnimAimPrecision getAnimSpeedCoef getArray getArtilleryAmmo getArtilleryComputerSettings getArtilleryETA getAssignedCuratorLogic getAssignedCuratorUnit getBackpackCargo getBleedingRemaining getBurningValue getCameraViewDirection getCargoIndex getCenterOfMass getClientState getClientStateNumber getConnectedUAV getCustomAimingCoef getDammage getDescription getDir getDirVisual getDLCs getEditorCamera getEditorMode getEditorObjectScope getElevationOffset getFatigue getFriend getFSMVariable getFuelCargo getGroupIcon getGroupIconParams getGroupIcons getHideFrom getHit getHitIndex getHitPointDamage getItemCargo getMagazineCargo getMarkerColor getMarkerPos getMarkerSize getMarkerType getMass getMissionConfig getMissionConfigValue getMissionDLCs getMissionLayerEntities getModelInfo getMousePosition getNumber getObjectArgument getObjectChildren getObjectDLC getObjectMaterials getObjectProxy getObjectTextures getObjectType getObjectViewDistance getOxygenRemaining getPersonUsedDLCs getPilotCameraDirection getPilotCameraPosition getPilotCameraRotation getPilotCameraTarget getPlayerChannel getPlayerScores getPlayerUID getPos getPosASL getPosASLVisual getPosASLW getPosATL getPosATLVisual getPosVisual getPosWorld getRelDir getRelPos getRemoteSensorsDisabled getRepairCargo getResolution getShadowDistance getShotParents getSlingLoad getSpeed getStamina getStatValue getSuppression getTerrainHeightASL getText getUnitLoadout getUnitTrait getVariable getVehicleCargo getWeaponCargo getWeaponSway getWPPos glanceAt globalChat globalRadio goggles goto group groupChat groupFromNetId groupIconSelectable groupIconsVisible groupId groupOwner groupRadio groupSelectedUnits groupSelectUnit grpNull gunner gusts halt handgunItems handgunMagazine handgunWeapon handsHit hasInterface hasPilotCamera hasWeapon hcAllGroups hcGroupParams hcLeader hcRemoveAllGroups hcRemoveGroup hcSelected hcSelectGroup hcSetGroup hcShowBar hcShownBar headgear hideBody hideObject hideObjectGlobal hideSelection hint hintC hintCadet hintSilent hmd hostMission htmlLoad HUDMovementLevels humidity image importAllGroups importance in inArea inAreaArray incapacitatedState independent inflame inflamed inGameUISetEventHandler inheritsFrom initAmbientLife inPolygon inputAction inRangeOfArtillery insertEditorObject intersect is3DEN is3DENMultiplayer isAbleToBreathe isAgent isArray isAutoHoverOn isAutonomous isAutotest isBleeding isBurning isClass isCollisionLightOn isCopilotEnabled isDedicated isDLCAvailable isEngineOn isEqualTo isEqualType isEqualTypeAll isEqualTypeAny isEqualTypeArray isEqualTypeParams isFilePatchingEnabled isFlashlightOn isFlatEmpty isForcedWalk isFormationLeader isHidden isInRemainsCollector isInstructorFigureEnabled isIRLaserOn isKeyActive isKindOf isLightOn isLocalized isManualFire isMarkedForCollection isMultiplayer isMultiplayerSolo isNil isNull isNumber isObjectHidden isObjectRTD isOnRoad isPipEnabled isPlayer isRealTime isRemoteExecuted isRemoteExecutedJIP isServer isShowing3DIcons isSprintAllowed isStaminaEnabled isSteamMission isStreamFriendlyUIEnabled isText isTouchingGround isTurnedOut isTutHintsEnabled isUAVConnectable isUAVConnected isUniformAllowed isVehicleCargo isWalking isWeaponDeployed isWeaponRested itemCargo items itemsWithMagazines join joinAs joinAsSilent joinSilent joinString kbAddDatabase kbAddDatabaseTargets kbAddTopic kbHasTopic kbReact kbRemoveTopic kbTell kbWasSaid keyImage keyName knowsAbout land landAt landResult language laserTarget lbAdd lbClear lbColor lbCurSel lbData lbDelete lbIsSelected lbPicture lbSelection lbSetColor lbSetCurSel lbSetData lbSetPicture lbSetPictureColor lbSetPictureColorDisabled lbSetPictureColorSelected lbSetSelectColor lbSetSelectColorRight lbSetSelected lbSetTooltip lbSetValue lbSize lbSort lbSortByValue lbText lbValue leader leaderboardDeInit leaderboardGetRows leaderboardInit leaveVehicle libraryCredits libraryDisclaimers lifeState lightAttachObject lightDetachObject lightIsOn lightnings limitSpeed linearConversion lineBreak lineIntersects lineIntersectsObjs lineIntersectsSurfaces lineIntersectsWith linkItem list listObjects ln lnbAddArray lnbAddColumn lnbAddRow lnbClear lnbColor lnbCurSelRow lnbData lnbDeleteColumn lnbDeleteRow lnbGetColumnsPosition lnbPicture lnbSetColor lnbSetColumnsPos lnbSetCurSelRow lnbSetData lnbSetPicture lnbSetText lnbSetValue lnbSize lnbText lnbValue load loadAbs loadBackpack loadFile loadGame loadIdentity loadMagazine loadOverlay loadStatus loadUniform loadVest local localize locationNull locationPosition lock lockCameraTo lockCargo lockDriver locked lockedCargo lockedDriver lockedTurret lockIdentity lockTurret lockWP log logEntities logNetwork logNetworkTerminate lookAt lookAtPos magazineCargo magazines magazinesAllTurrets magazinesAmmo magazinesAmmoCargo magazinesAmmoFull magazinesDetail magazinesDetailBackpack magazinesDetailUniform magazinesDetailVest magazinesTurret magazineTurretAmmo mapAnimAdd mapAnimClear mapAnimCommit mapAnimDone mapCenterOnCamera mapGridPosition markAsFinishedOnSteam markerAlpha markerBrush markerColor markerDir markerPos markerShape markerSize markerText markerType max members menuAction menuAdd menuChecked menuClear menuCollapse menuData menuDelete menuEnable menuEnabled menuExpand menuHover menuPicture menuSetAction menuSetCheck menuSetData menuSetPicture menuSetValue menuShortcut menuShortcutText menuSize menuSort menuText menuURL menuValue min mineActive mineDetectedBy missionConfigFile missionDifficulty missionName missionNamespace missionStart missionVersion mod modelToWorld modelToWorldVisual modParams moonIntensity moonPhase morale move move3DENCamera moveInAny moveInCargo moveInCommander moveInDriver moveInGunner moveInTurret moveObjectToEnd moveOut moveTime moveTo moveToCompleted moveToFailed musicVolume name nameSound nearEntities nearestBuilding nearestLocation nearestLocations nearestLocationWithDubbing nearestObject nearestObjects nearestTerrainObjects nearObjects nearObjectsReady nearRoads nearSupplies nearTargets needReload netId netObjNull newOverlay nextMenuItemIndex nextWeatherChange nMenuItems not numberToDate objectCurators objectFromNetId objectParent objNull objStatus onBriefingGroup onBriefingNotes onBriefingPlan onBriefingTeamSwitch onCommandModeChanged onDoubleClick onEachFrame onGroupIconClick onGroupIconOverEnter onGroupIconOverLeave onHCGroupSelectionChanged onMapSingleClick onPlayerConnected onPlayerDisconnected onPreloadFinished onPreloadStarted onShowNewObject onTeamSwitch openCuratorInterface openDLCPage openMap openYoutubeVideo opfor or orderGetIn overcast overcastForecast owner param params parseNumber parseText parsingNamespace particlesQuality pi pickWeaponPool pitch pixelGrid pixelGridBase pixelGridNoUIScale pixelH pixelW playableSlotsNumber playableUnits playAction playActionNow player playerRespawnTime playerSide playersNumber playGesture playMission playMove playMoveNow playMusic playScriptedMission playSound playSound3D position positionCameraToWorld posScreenToWorld posWorldToScreen ppEffectAdjust ppEffectCommit ppEffectCommitted ppEffectCreate ppEffectDestroy ppEffectEnable ppEffectEnabled ppEffectForceInNVG precision preloadCamera preloadObject preloadSound preloadTitleObj preloadTitleRsc preprocessFile preprocessFileLineNumbers primaryWeapon primaryWeaponItems primaryWeaponMagazine priority private processDiaryLink productVersion profileName profileNamespace profileNameSteam progressLoadingScreen progressPosition progressSetPosition publicVariable publicVariableClient publicVariableServer pushBack pushBackUnique putWeaponPool queryItemsPool queryMagazinePool queryWeaponPool rad radioChannelAdd radioChannelCreate radioChannelRemove radioChannelSetCallSign radioChannelSetLabel radioVolume rain rainbow random rank rankId rating rectangular registeredTasks registerTask reload reloadEnabled remoteControl remoteExec remoteExecCall remove3DENConnection remove3DENEventHandler remove3DENLayer removeAction removeAll3DENEventHandlers removeAllActions removeAllAssignedItems removeAllContainers removeAllCuratorAddons removeAllCuratorCameraAreas removeAllCuratorEditingAreas removeAllEventHandlers removeAllHandgunItems removeAllItems removeAllItemsWithMagazines removeAllMissionEventHandlers removeAllMPEventHandlers removeAllMusicEventHandlers removeAllOwnedMines removeAllPrimaryWeaponItems removeAllWeapons removeBackpack removeBackpackGlobal removeCuratorAddons removeCuratorCameraArea removeCuratorEditableObjects removeCuratorEditingArea removeDrawIcon removeDrawLinks removeEventHandler removeFromRemainsCollector removeGoggles removeGroupIcon removeHandgunItem removeHeadgear removeItem removeItemFromBackpack removeItemFromUniform removeItemFromVest removeItems removeMagazine removeMagazineGlobal removeMagazines removeMagazinesTurret removeMagazineTurret removeMenuItem removeMissionEventHandler removeMPEventHandler removeMusicEventHandler removeOwnedMine removePrimaryWeaponItem removeSecondaryWeaponItem removeSimpleTask removeSwitchableUnit removeTeamMember removeUniform removeVest removeWeapon removeWeaponGlobal removeWeaponTurret requiredVersion resetCamShake resetSubgroupDirection resistance resize resources respawnVehicle restartEditorCamera reveal revealMine reverse reversedMouseY roadAt roadsConnectedTo roleDescription ropeAttachedObjects ropeAttachedTo ropeAttachEnabled ropeAttachTo ropeCreate ropeCut ropeDestroy ropeDetach ropeEndPosition ropeLength ropes ropeUnwind ropeUnwound rotorsForcesRTD rotorsRpmRTD round runInitScript safeZoneH safeZoneW safeZoneWAbs safeZoneX safeZoneXAbs safeZoneY save3DENInventory saveGame saveIdentity saveJoysticks saveOverlay saveProfileNamespace saveStatus saveVar savingEnabled say say2D say3D scopeName score scoreSide screenshot screenToWorld scriptDone scriptName scriptNull scudState secondaryWeapon secondaryWeaponItems secondaryWeaponMagazine select selectBestPlaces selectDiarySubject selectedEditorObjects selectEditorObject selectionNames selectionPosition selectLeader selectMax selectMin selectNoPlayer selectPlayer selectRandom selectWeapon selectWeaponTurret sendAUMessage sendSimpleCommand sendTask sendTaskResult sendUDPMessage serverCommand serverCommandAvailable serverCommandExecutable serverName serverTime set set3DENAttribute set3DENAttributes set3DENGrid set3DENIconsVisible set3DENLayer set3DENLinesVisible set3DENMissionAttributes set3DENModelsVisible set3DENObjectType set3DENSelected setAccTime setAirportSide setAmmo setAmmoCargo setAnimSpeedCoef setAperture setApertureNew setArmoryPoints setAttributes setAutonomous setBehaviour setBleedingRemaining setCameraInterest setCamShakeDefParams setCamShakeParams setCamUseTi setCaptive setCenterOfMass setCollisionLight setCombatMode setCompassOscillation setCuratorCameraAreaCeiling setCuratorCoef setCuratorEditingAreaType setCuratorWaypointCost setCurrentChannel setCurrentTask setCurrentWaypoint setCustomAimCoef setDamage setDammage setDate setDebriefingText setDefaultCamera setDestination setDetailMapBlendPars setDir setDirection setDrawIcon setDropInterval setEditorMode setEditorObjectScope setEffectCondition setFace setFaceAnimation setFatigue setFlagOwner setFlagSide setFlagTexture setFog setFormation setFormationTask setFormDir setFriend setFromEditor setFSMVariable setFuel setFuelCargo setGroupIcon setGroupIconParams setGroupIconsSelectable setGroupIconsVisible setGroupId setGroupIdGlobal setGroupOwner setGusts setHideBehind setHit setHitIndex setHitPointDamage setHorizonParallaxCoef setHUDMovementLevels setIdentity setImportance setLeader setLightAmbient setLightAttenuation setLightBrightness setLightColor setLightDayLight setLightFlareMaxDistance setLightFlareSize setLightIntensity setLightnings setLightUseFlare setLocalWindParams setMagazineTurretAmmo setMarkerAlpha setMarkerAlphaLocal setMarkerBrush setMarkerBrushLocal setMarkerColor setMarkerColorLocal setMarkerDir setMarkerDirLocal setMarkerPos setMarkerPosLocal setMarkerShape setMarkerShapeLocal setMarkerSize setMarkerSizeLocal setMarkerText setMarkerTextLocal setMarkerType setMarkerTypeLocal setMass setMimic setMousePosition setMusicEffect setMusicEventHandler setName setNameSound setObjectArguments setObjectMaterial setObjectMaterialGlobal setObjectProxy setObjectTexture setObjectTextureGlobal setObjectViewDistance setOvercast setOwner setOxygenRemaining setParticleCircle setParticleClass setParticleFire setParticleParams setParticleRandom setPilotCameraDirection setPilotCameraRotation setPilotCameraTarget setPilotLight setPiPEffect setPitch setPlayable setPlayerRespawnTime setPos setPosASL setPosASL2 setPosASLW setPosATL setPosition setPosWorld setRadioMsg setRain setRainbow setRandomLip setRank setRectangular setRepairCargo setShadowDistance setShotParents setSide setSimpleTaskAlwaysVisible setSimpleTaskCustomData setSimpleTaskDescription setSimpleTaskDestination setSimpleTaskTarget setSimpleTaskType setSimulWeatherLayers setSize setSkill setSlingLoad setSoundEffect setSpeaker setSpeech setSpeedMode setStamina setStaminaScheme setStatValue setSuppression setSystemOfUnits setTargetAge setTaskResult setTaskState setTerrainGrid setText setTimeMultiplier setTitleEffect setTriggerActivation setTriggerArea setTriggerStatements setTriggerText setTriggerTimeout setTriggerType setType setUnconscious setUnitAbility setUnitLoadout setUnitPos setUnitPosWeak setUnitRank setUnitRecoilCoefficient setUnitTrait setUnloadInCombat setUserActionText setVariable setVectorDir setVectorDirAndUp setVectorUp setVehicleAmmo setVehicleAmmoDef setVehicleArmor setVehicleCargo setVehicleId setVehicleLock setVehiclePosition setVehicleTiPars setVehicleVarName setVelocity setVelocityTransformation setViewDistance setVisibleIfTreeCollapsed setWaves setWaypointBehaviour setWaypointCombatMode setWaypointCompletionRadius setWaypointDescription setWaypointForceBehaviour setWaypointFormation setWaypointHousePosition setWaypointLoiterRadius setWaypointLoiterType setWaypointName setWaypointPosition setWaypointScript setWaypointSpeed setWaypointStatements setWaypointTimeout setWaypointType setWaypointVisible setWeaponReloadingTime setWind setWindDir setWindForce setWindStr setWPPos show3DIcons showChat showCinemaBorder showCommandingMenu showCompass showCuratorCompass showGPS showHUD showLegend showMap shownArtilleryComputer shownChat shownCompass shownCuratorCompass showNewEditorObject shownGPS shownHUD shownMap shownPad shownRadio shownScoretable shownUAVFeed shownWarrant shownWatch showPad showRadio showScoretable showSubtitles showUAVFeed showWarrant showWatch showWaypoint showWaypoints side sideAmbientLife sideChat sideEmpty sideEnemy sideFriendly sideLogic sideRadio sideUnknown simpleTasks simulationEnabled simulCloudDensity simulCloudOcclusion simulInClouds simulWeatherSync sin size sizeOf skill skillFinal skipTime sleep sliderPosition sliderRange sliderSetPosition sliderSetRange sliderSetSpeed sliderSpeed slingLoadAssistantShown soldierMagazines someAmmo sort soundVolume spawn speaker speed speedMode splitString sqrt squadParams stance startLoadingScreen step stop stopEngineRTD stopped str sunOrMoon supportInfo suppressFor surfaceIsWater surfaceNormal surfaceType swimInDepth switchableUnits switchAction switchCamera switchGesture switchLight switchMove synchronizedObjects synchronizedTriggers synchronizedWaypoints synchronizeObjectsAdd synchronizeObjectsRemove synchronizeTrigger synchronizeWaypoint systemChat systemOfUnits tan targetKnowledge targetsAggregate targetsQuery taskAlwaysVisible taskChildren taskCompleted taskCustomData taskDescription taskDestination taskHint taskMarkerOffset taskNull taskParent taskResult taskState taskType teamMember teamMemberNull teamName teams teamSwitch teamSwitchEnabled teamType terminate terrainIntersect terrainIntersectASL text textLog textLogFormat tg time timeMultiplier titleCut titleFadeOut titleObj titleRsc titleText toArray toFixed toLower toString toUpper triggerActivated triggerActivation triggerArea triggerAttachedVehicle triggerAttachObject triggerAttachVehicle triggerStatements triggerText triggerTimeout triggerTimeoutCurrent triggerType turretLocal turretOwner turretUnit tvAdd tvClear tvCollapse tvCount tvCurSel tvData tvDelete tvExpand tvPicture tvSetCurSel tvSetData tvSetPicture tvSetPictureColor tvSetPictureColorDisabled tvSetPictureColorSelected tvSetPictureRight tvSetPictureRightColor tvSetPictureRightColorDisabled tvSetPictureRightColorSelected tvSetText tvSetTooltip tvSetValue tvSort tvSortByValue tvText tvTooltip tvValue type typeName typeOf UAVControl uiNamespace uiSleep unassignCurator unassignItem unassignTeam unassignVehicle underwater uniform uniformContainer uniformItems uniformMagazines unitAddons unitAimPosition unitAimPositionVisual unitBackpack unitIsUAV unitPos unitReady unitRecoilCoefficient units unitsBelowHeight unlinkItem unlockAchievement unregisterTask updateDrawIcon updateMenuItem updateObjectTree useAISteeringComponent useAudioTimeForMoves vectorAdd vectorCos vectorCrossProduct vectorDiff vectorDir vectorDirVisual vectorDistance vectorDistanceSqr vectorDotProduct vectorFromTo vectorMagnitude vectorMagnitudeSqr vectorMultiply vectorNormalized vectorUp vectorUpVisual vehicle vehicleCargoEnabled vehicleChat vehicleRadio vehicles vehicleVarName velocity velocityModelSpace verifySignature vest vestContainer vestItems vestMagazines viewDistance visibleCompass visibleGPS visibleMap visiblePosition visiblePositionASL visibleScoretable visibleWatch waves waypointAttachedObject waypointAttachedVehicle waypointAttachObject waypointAttachVehicle waypointBehaviour waypointCombatMode waypointCompletionRadius waypointDescription waypointForceBehaviour waypointFormation waypointHousePosition waypointLoiterRadius waypointLoiterType waypointName waypointPosition waypoints waypointScript waypointsEnabledUAV waypointShow waypointSpeed waypointStatements waypointTimeout waypointTimeoutCurrent waypointType waypointVisible weaponAccessories weaponAccessoriesCargo weaponCargo weaponDirection weaponInertia weaponLowered weapons weaponsItems weaponsItemsCargo weaponState weaponsTurret weightRTD west WFSideText wind",literal:"true false nil"},c:[e.CLCM,e.CBCM,e.NM,a,o,r,t.preprocessor],i:/#/}});hljs.registerLanguage("java",function(e){var a="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",t=a+"(<"+a+"(\\s*,\\s*"+a+")*>)?",r="false synchronized int abstract float private char boolean static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private module requires exports do",s="\\b(0[bB]([01]+[01_]+[01]+|[01]+)|0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)|(([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?|\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))([eE][-+]?\\d+)?)[lLfF]?",c={cN:"number",b:s,r:0};return{aliases:["jsp"],k:r,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return else",r:0},{cN:"function",b:"("+t+"\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:r,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:r,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},c,{cN:"meta",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("mel",function(e){return{k:"int float string vector matrix if else switch case default while do for in break continue global proc return about abs addAttr addAttributeEditorNodeHelp addDynamic addNewShelfTab addPP addPanelCategory addPrefixToName advanceToNextDrivenKey affectedNet affects aimConstraint air alias aliasAttr align alignCtx alignCurve alignSurface allViewFit ambientLight angle angleBetween animCone animCurveEditor animDisplay animView annotate appendStringArray applicationName applyAttrPreset applyTake arcLenDimContext arcLengthDimension arclen arrayMapper art3dPaintCtx artAttrCtx artAttrPaintVertexCtx artAttrSkinPaintCtx artAttrTool artBuildPaintMenu artFluidAttrCtx artPuttyCtx artSelectCtx artSetPaintCtx artUserPaintCtx assignCommand assignInputDevice assignViewportFactories attachCurve attachDeviceAttr attachSurface attrColorSliderGrp attrCompatibility attrControlGrp attrEnumOptionMenu attrEnumOptionMenuGrp attrFieldGrp attrFieldSliderGrp attrNavigationControlGrp attrPresetEditWin attributeExists attributeInfo attributeMenu attributeQuery autoKeyframe autoPlace bakeClip bakeFluidShading bakePartialHistory bakeResults bakeSimulation basename basenameEx batchRender bessel bevel bevelPlus binMembership bindSkin blend2 blendShape blendShapeEditor blendShapePanel blendTwoAttr blindDataType boneLattice boundary boxDollyCtx boxZoomCtx bufferCurve buildBookmarkMenu buildKeyframeMenu button buttonManip CBG cacheFile cacheFileCombine cacheFileMerge cacheFileTrack camera cameraView canCreateManip canvas capitalizeString catch catchQuiet ceil changeSubdivComponentDisplayLevel changeSubdivRegion channelBox character characterMap characterOutlineEditor characterize chdir checkBox checkBoxGrp checkDefaultRenderGlobals choice circle circularFillet clamp clear clearCache clip clipEditor clipEditorCurrentTimeCtx clipSchedule clipSchedulerOutliner clipTrimBefore closeCurve closeSurface cluster cmdFileOutput cmdScrollFieldExecuter cmdScrollFieldReporter cmdShell coarsenSubdivSelectionList collision color colorAtPoint colorEditor colorIndex colorIndexSliderGrp colorSliderButtonGrp colorSliderGrp columnLayout commandEcho commandLine commandPort compactHairSystem componentEditor compositingInterop computePolysetVolume condition cone confirmDialog connectAttr connectControl connectDynamic connectJoint connectionInfo constrain constrainValue constructionHistory container containsMultibyte contextInfo control convertFromOldLayers convertIffToPsd convertLightmap convertSolidTx convertTessellation convertUnit copyArray copyFlexor copyKey copySkinWeights cos cpButton cpCache cpClothSet cpCollision cpConstraint cpConvClothToMesh cpForces cpGetSolverAttr cpPanel cpProperty cpRigidCollisionFilter cpSeam cpSetEdit cpSetSolverAttr cpSolver cpSolverTypes cpTool cpUpdateClothUVs createDisplayLayer createDrawCtx createEditor createLayeredPsdFile createMotionField createNewShelf createNode createRenderLayer createSubdivRegion cross crossProduct ctxAbort ctxCompletion ctxEditMode ctxTraverse currentCtx currentTime currentTimeCtx currentUnit curve curveAddPtCtx curveCVCtx curveEPCtx curveEditorCtx curveIntersect curveMoveEPCtx curveOnSurface curveSketchCtx cutKey cycleCheck cylinder dagPose date defaultLightListCheckBox defaultNavigation defineDataServer defineVirtualDevice deformer deg_to_rad delete deleteAttr deleteShadingGroupsAndMaterials deleteShelfTab deleteUI deleteUnusedBrushes delrandstr detachCurve detachDeviceAttr detachSurface deviceEditor devicePanel dgInfo dgdirty dgeval dgtimer dimWhen directKeyCtx directionalLight dirmap dirname disable disconnectAttr disconnectJoint diskCache displacementToPoly displayAffected displayColor displayCull displayLevelOfDetail displayPref displayRGBColor displaySmoothness displayStats displayString displaySurface distanceDimContext distanceDimension doBlur dolly dollyCtx dopeSheetEditor dot dotProduct doubleProfileBirailSurface drag dragAttrContext draggerContext dropoffLocator duplicate duplicateCurve duplicateSurface dynCache dynControl dynExport dynExpression dynGlobals dynPaintEditor dynParticleCtx dynPref dynRelEdPanel dynRelEditor dynamicLoad editAttrLimits editDisplayLayerGlobals editDisplayLayerMembers editRenderLayerAdjustment editRenderLayerGlobals editRenderLayerMembers editor editorTemplate effector emit emitter enableDevice encodeString endString endsWith env equivalent equivalentTol erf error eval evalDeferred evalEcho event exactWorldBoundingBox exclusiveLightCheckBox exec executeForEachObject exists exp expression expressionEditorListen extendCurve extendSurface extrude fcheck fclose feof fflush fgetline fgetword file fileBrowserDialog fileDialog fileExtension fileInfo filetest filletCurve filter filterCurve filterExpand filterStudioImport findAllIntersections findAnimCurves findKeyframe findMenuItem findRelatedSkinCluster finder firstParentOf fitBspline flexor floatEq floatField floatFieldGrp floatScrollBar floatSlider floatSlider2 floatSliderButtonGrp floatSliderGrp floor flow fluidCacheInfo fluidEmitter fluidVoxelInfo flushUndo fmod fontDialog fopen formLayout format fprint frameLayout fread freeFormFillet frewind fromNativePath fwrite gamma gauss geometryConstraint getApplicationVersionAsFloat getAttr getClassification getDefaultBrush getFileList getFluidAttr getInputDeviceRange getMayaPanelTypes getModifiers getPanel getParticleAttr getPluginResource getenv getpid glRender glRenderEditor globalStitch gmatch goal gotoBindPose grabColor gradientControl gradientControlNoAttr graphDollyCtx graphSelectContext graphTrackCtx gravity grid gridLayout group groupObjectsByName HfAddAttractorToAS HfAssignAS HfBuildEqualMap HfBuildFurFiles HfBuildFurImages HfCancelAFR HfConnectASToHF HfCreateAttractor HfDeleteAS HfEditAS HfPerformCreateAS HfRemoveAttractorFromAS HfSelectAttached HfSelectAttractors HfUnAssignAS hardenPointCurve hardware hardwareRenderPanel headsUpDisplay headsUpMessage help helpLine hermite hide hilite hitTest hotBox hotkey hotkeyCheck hsv_to_rgb hudButton hudSlider hudSliderButton hwReflectionMap hwRender hwRenderLoad hyperGraph hyperPanel hyperShade hypot iconTextButton iconTextCheckBox iconTextRadioButton iconTextRadioCollection iconTextScrollList iconTextStaticLabel ikHandle ikHandleCtx ikHandleDisplayScale ikSolver ikSplineHandleCtx ikSystem ikSystemInfo ikfkDisplayMethod illustratorCurves image imfPlugins inheritTransform insertJoint insertJointCtx insertKeyCtx insertKnotCurve insertKnotSurface instance instanceable instancer intField intFieldGrp intScrollBar intSlider intSliderGrp interToUI internalVar intersect iprEngine isAnimCurve isConnected isDirty isParentOf isSameObject isTrue isValidObjectName isValidString isValidUiName isolateSelect itemFilter itemFilterAttr itemFilterRender itemFilterType joint jointCluster jointCtx jointDisplayScale jointLattice keyTangent keyframe keyframeOutliner keyframeRegionCurrentTimeCtx keyframeRegionDirectKeyCtx keyframeRegionDollyCtx keyframeRegionInsertKeyCtx keyframeRegionMoveKeyCtx keyframeRegionScaleKeyCtx keyframeRegionSelectKeyCtx keyframeRegionSetKeyCtx keyframeRegionTrackCtx keyframeStats lassoContext lattice latticeDeformKeyCtx launch launchImageEditor layerButton layeredShaderPort layeredTexturePort layout layoutDialog lightList lightListEditor lightListPanel lightlink lineIntersection linearPrecision linstep listAnimatable listAttr listCameras listConnections listDeviceAttachments listHistory listInputDeviceAxes listInputDeviceButtons listInputDevices listMenuAnnotation listNodeTypes listPanelCategories listRelatives listSets listTransforms listUnselected listerEditor loadFluid loadNewShelf loadPlugin loadPluginLanguageResources loadPrefObjects localizedPanelLabel lockNode loft log longNameOf lookThru ls lsThroughFilter lsType lsUI Mayatomr mag makeIdentity makeLive makePaintable makeRoll makeSingleSurface makeTubeOn makebot manipMoveContext manipMoveLimitsCtx manipOptions manipRotateContext manipRotateLimitsCtx manipScaleContext manipScaleLimitsCtx marker match max memory menu menuBarLayout menuEditor menuItem menuItemToShelf menuSet menuSetPref messageLine min minimizeApp mirrorJoint modelCurrentTimeCtx modelEditor modelPanel mouse movIn movOut move moveIKtoFK moveKeyCtx moveVertexAlongDirection multiProfileBirailSurface mute nParticle nameCommand nameField namespace namespaceInfo newPanelItems newton nodeCast nodeIconButton nodeOutliner nodePreset nodeType noise nonLinear normalConstraint normalize nurbsBoolean nurbsCopyUVSet nurbsCube nurbsEditUV nurbsPlane nurbsSelect nurbsSquare nurbsToPoly nurbsToPolygonsPref nurbsToSubdiv nurbsToSubdivPref nurbsUVSet nurbsViewDirectionVector objExists objectCenter objectLayer objectType objectTypeUI obsoleteProc oceanNurbsPreviewPlane offsetCurve offsetCurveOnSurface offsetSurface openGLExtension openMayaPref optionMenu optionMenuGrp optionVar orbit orbitCtx orientConstraint outlinerEditor outlinerPanel overrideModifier paintEffectsDisplay pairBlend palettePort paneLayout panel panelConfiguration panelHistory paramDimContext paramDimension paramLocator parent parentConstraint particle particleExists particleInstancer particleRenderInfo partition pasteKey pathAnimation pause pclose percent performanceOptions pfxstrokes pickWalk picture pixelMove planarSrf plane play playbackOptions playblast plugAttr plugNode pluginInfo pluginResourceUtil pointConstraint pointCurveConstraint pointLight pointMatrixMult pointOnCurve pointOnSurface pointPosition poleVectorConstraint polyAppend polyAppendFacetCtx polyAppendVertex polyAutoProjection polyAverageNormal polyAverageVertex polyBevel polyBlendColor polyBlindData polyBoolOp polyBridgeEdge polyCacheMonitor polyCheck polyChipOff polyClipboard polyCloseBorder polyCollapseEdge polyCollapseFacet polyColorBlindData polyColorDel polyColorPerVertex polyColorSet polyCompare polyCone polyCopyUV polyCrease polyCreaseCtx polyCreateFacet polyCreateFacetCtx polyCube polyCut polyCutCtx polyCylinder polyCylindricalProjection polyDelEdge polyDelFacet polyDelVertex polyDuplicateAndConnect polyDuplicateEdge polyEditUV polyEditUVShell polyEvaluate polyExtrudeEdge polyExtrudeFacet polyExtrudeVertex polyFlipEdge polyFlipUV polyForceUV polyGeoSampler polyHelix polyInfo polyInstallAction polyLayoutUV polyListComponentConversion polyMapCut polyMapDel polyMapSew polyMapSewMove polyMergeEdge polyMergeEdgeCtx polyMergeFacet polyMergeFacetCtx polyMergeUV polyMergeVertex polyMirrorFace polyMoveEdge polyMoveFacet polyMoveFacetUV polyMoveUV polyMoveVertex polyNormal polyNormalPerVertex polyNormalizeUV polyOptUvs polyOptions polyOutput polyPipe polyPlanarProjection polyPlane polyPlatonicSolid polyPoke polyPrimitive polyPrism polyProjection polyPyramid polyQuad polyQueryBlindData polyReduce polySelect polySelectConstraint polySelectConstraintMonitor polySelectCtx polySelectEditCtx polySeparate polySetToFaceNormal polySewEdge polyShortestPathCtx polySmooth polySoftEdge polySphere polySphericalProjection polySplit polySplitCtx polySplitEdge polySplitRing polySplitVertex polyStraightenUVBorder polySubdivideEdge polySubdivideFacet polyToSubdiv polyTorus polyTransfer polyTriangulate polyUVSet polyUnite polyWedgeFace popen popupMenu pose pow preloadRefEd print progressBar progressWindow projFileViewer projectCurve projectTangent projectionContext projectionManip promptDialog propModCtx propMove psdChannelOutliner psdEditTextureFile psdExport psdTextureFile putenv pwd python querySubdiv quit rad_to_deg radial radioButton radioButtonGrp radioCollection radioMenuItemCollection rampColorPort rand randomizeFollicles randstate rangeControl readTake rebuildCurve rebuildSurface recordAttr recordDevice redo reference referenceEdit referenceQuery refineSubdivSelectionList refresh refreshAE registerPluginResource rehash reloadImage removeJoint removeMultiInstance removePanelCategory rename renameAttr renameSelectionList renameUI render renderGlobalsNode renderInfo renderLayerButton renderLayerParent renderLayerPostProcess renderLayerUnparent renderManip renderPartition renderQualityNode renderSettings renderThumbnailUpdate renderWindowEditor renderWindowSelectContext renderer reorder reorderDeformers requires reroot resampleFluid resetAE resetPfxToPolyCamera resetTool resolutionNode retarget reverseCurve reverseSurface revolve rgb_to_hsv rigidBody rigidSolver roll rollCtx rootOf rot rotate rotationInterpolation roundConstantRadius rowColumnLayout rowLayout runTimeCommand runup sampleImage saveAllShelves saveAttrPreset saveFluid saveImage saveInitialState saveMenu savePrefObjects savePrefs saveShelf saveToolSettings scale scaleBrushBrightness scaleComponents scaleConstraint scaleKey scaleKeyCtx sceneEditor sceneUIReplacement scmh scriptCtx scriptEditorInfo scriptJob scriptNode scriptTable scriptToShelf scriptedPanel scriptedPanelType scrollField scrollLayout sculpt searchPathArray seed selLoadSettings select selectContext selectCurveCV selectKey selectKeyCtx selectKeyframeRegionCtx selectMode selectPref selectPriority selectType selectedNodes selectionConnection separator setAttr setAttrEnumResource setAttrMapping setAttrNiceNameResource setConstraintRestPosition setDefaultShadingGroup setDrivenKeyframe setDynamic setEditCtx setEditor setFluidAttr setFocus setInfinity setInputDeviceMapping setKeyCtx setKeyPath setKeyframe setKeyframeBlendshapeTargetWts setMenuMode setNodeNiceNameResource setNodeTypeFlag setParent setParticleAttr setPfxToPolyCamera setPluginResource setProject setStampDensity setStartupMessage setState setToolTo setUITemplate setXformManip sets shadingConnection shadingGeometryRelCtx shadingLightRelCtx shadingNetworkCompare shadingNode shapeCompare shelfButton shelfLayout shelfTabLayout shellField shortNameOf showHelp showHidden showManipCtx showSelectionInTitle showShadingGroupAttrEditor showWindow sign simplify sin singleProfileBirailSurface size sizeBytes skinCluster skinPercent smoothCurve smoothTangentSurface smoothstep snap2to2 snapKey snapMode snapTogetherCtx snapshot soft softMod softModCtx sort sound soundControl source spaceLocator sphere sphrand spotLight spotLightPreviewPort spreadSheetEditor spring sqrt squareSurface srtContext stackTrace startString startsWith stitchAndExplodeShell stitchSurface stitchSurfacePoints strcmp stringArrayCatenate stringArrayContains stringArrayCount stringArrayInsertAtIndex stringArrayIntersector stringArrayRemove stringArrayRemoveAtIndex stringArrayRemoveDuplicates stringArrayRemoveExact stringArrayToString stringToStringArray strip stripPrefixFromName stroke subdAutoProjection subdCleanTopology subdCollapse subdDuplicateAndConnect subdEditUV subdListComponentConversion subdMapCut subdMapSewMove subdMatchTopology subdMirror subdToBlind subdToPoly subdTransferUVsToCache subdiv subdivCrease subdivDisplaySmoothness substitute substituteAllString substituteGeometry substring surface surfaceSampler surfaceShaderList swatchDisplayPort switchTable symbolButton symbolCheckBox sysFile system tabLayout tan tangentConstraint texLatticeDeformContext texManipContext texMoveContext texMoveUVShellContext texRotateContext texScaleContext texSelectContext texSelectShortestPathCtx texSmudgeUVContext texWinToolCtx text textCurves textField textFieldButtonGrp textFieldGrp textManip textScrollList textToShelf textureDisplacePlane textureHairColor texturePlacementContext textureWindow threadCount threePointArcCtx timeControl timePort timerX toNativePath toggle toggleAxis toggleWindowVisibility tokenize tokenizeList tolerance tolower toolButton toolCollection toolDropped toolHasOptions toolPropertyWindow torus toupper trace track trackCtx transferAttributes transformCompare transformLimits translator trim trunc truncateFluidCache truncateHairCache tumble tumbleCtx turbulence twoPointArcCtx uiRes uiTemplate unassignInputDevice undo undoInfo ungroup uniform unit unloadPlugin untangleUV untitledFileName untrim upAxis updateAE userCtx uvLink uvSnapshot validateShelfName vectorize view2dToolCtx viewCamera viewClipPlane viewFit viewHeadOn viewLookAt viewManip viewPlace viewSet visor volumeAxis vortex waitCursor warning webBrowser webBrowserPrefs whatIs window windowPref wire wireContext workspace wrinkle wrinkleContext writeTake xbmLangPathList xform",i:")?(\\[\\])?";return{aliases:["csharp"],k:i,i:/::/,c:[e.C("///","$",{rB:!0,c:[{cN:"doctag",v:[{b:"///",r:0},{b:""},{b:""}]}]}),e.CLCM,e.CBCM,{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef warning error line region endregion pragma checksum"}},l,e.CNM,{bK:"class interface",e:/[{;=]/,i:/[^\s:]/,c:[e.TM,e.CLCM,e.CBCM]},{bK:"namespace",e:/[{;=]/,i:/[^\s:]/,c:[e.inherit(e.TM,{b:"[a-zA-Z](\\.?\\w)*"}),e.CLCM,e.CBCM]},{bK:"new return throw await",r:0},{cN:"function",b:"("+b+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:i,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:i,r:0,c:[l,e.CNM,e.CBCM]},e.CLCM,e.CBCM]}]}});hljs.registerLanguage("julia",function(e){var r={keyword:"in abstract baremodule begin bitstype break catch ccall const continue do else elseif end export finally for function global if immutable import importall let local macro module quote return try type typealias using while",literal:"true false ARGS CPU_CORES C_NULL DL_LOAD_PATH DevNull ENDIAN_BOM ENV I|0 Inf Inf16 Inf32 InsertionSort JULIA_HOME LOAD_PATH MS_ASYNC MS_INVALIDATE MS_SYNC MergeSort NaN NaN16 NaN32 OS_NAME QuickSort RTLD_DEEPBIND RTLD_FIRST RTLD_GLOBAL RTLD_LAZY RTLD_LOCAL RTLD_NODELETE RTLD_NOLOAD RTLD_NOW RoundDown RoundFromZero RoundNearest RoundToZero RoundUp STDERR STDIN STDOUT VERSION WORD_SIZE catalan cglobal e|0 eu|0 eulergamma golden im nothing pi γ π φ Inf64 NaN64 RoundNearestTiesAway RoundNearestTiesUp ",built_in:"ANY ASCIIString AbstractArray AbstractRNG AbstractSparseArray Any ArgumentError Array Associative Base64Pipe Bidiagonal BigFloat BigInt BitArray BitMatrix BitVector Bool BoundsError Box CFILE Cchar Cdouble Cfloat Char CharString Cint Clong Clonglong ClusterManager Cmd Coff_t Colon Complex Complex128 Complex32 Complex64 Condition Cptrdiff_t Cshort Csize_t Cssize_t Cuchar Cuint Culong Culonglong Cushort Cwchar_t DArray DataType DenseArray Diagonal Dict DimensionMismatch DirectIndexString Display DivideError DomainError EOFError EachLine Enumerate ErrorException Exception Expr Factorization FileMonitor FileOffset Filter Float16 Float32 Float64 FloatRange FloatingPoint Function GetfieldNode GotoNode Hermitian IO IOBuffer IOStream IPv4 IPv6 InexactError Int Int128 Int16 Int32 Int64 Int8 IntSet Integer InterruptException IntrinsicFunction KeyError LabelNode LambdaStaticData LineNumberNode LoadError LocalProcess MIME MathConst MemoryError MersenneTwister Method MethodError MethodTable Module NTuple NewvarNode Nothing Number ObjectIdDict OrdinalRange OverflowError ParseError PollingFileWatcher ProcessExitedException ProcessGroup Ptr QuoteNode Range Range1 Ranges Rational RawFD Real Regex RegexMatch RemoteRef RepString RevString RopeString RoundingMode Set SharedArray Signed SparseMatrixCSC StackOverflowError Stat StatStruct StepRange String SubArray SubString SymTridiagonal Symbol SymbolNode Symmetric SystemError Task TextDisplay Timer TmStruct TopNode Triangular Tridiagonal Type TypeConstructor TypeError TypeName TypeVar UTF16String UTF32String UTF8String UdpSocket Uint Uint128 Uint16 Uint32 Uint64 Uint8 UndefRefError UndefVarError UniformScaling UnionType UnitRange Unsigned Vararg VersionNumber WString WeakKeyDict WeakRef Woodbury Zip AbstractChannel AbstractFloat AbstractString AssertionError Base64DecodePipe Base64EncodePipe BufferStream CapturedException CartesianIndex CartesianRange Channel Cintmax_t CompositeException Cstring Cuintmax_t Cwstring Date DateTime Dims Enum GenSym GlobalRef HTML InitError InvalidStateException Irrational LinSpace LowerTriangular NullException Nullable OutOfMemoryError Pair PartialQuickSort Pipe RandomDevice ReadOnlyMemoryError ReentrantLock Ref RemoteException SegmentationFault SerializationState SimpleVector TCPSocket Text Tuple UDPSocket UInt UInt128 UInt16 UInt32 UInt64 UInt8 UnicodeError Union UpperTriangular Val Void WorkerConfig AbstractMatrix AbstractSparseMatrix AbstractSparseVector AbstractVecOrMat AbstractVector DenseMatrix DenseVecOrMat DenseVector Matrix SharedMatrix SharedVector StridedArray StridedMatrix StridedVecOrMat StridedVector VecOrMat Vector "},t="[A-Za-z_\\u00A1-\\uFFFF][A-Za-z_0-9\\u00A1-\\uFFFF]*",a={l:t,k:r,i:/<\//},n={cN:"type",b:/::/},o={cN:"type",b:/<:/},i={cN:"number",b:/(\b0x[\d_]*(\.[\d_]*)?|0x\.\d[\d_]*)p[-+]?\d+|\b0[box][a-fA-F0-9][a-fA-F0-9_]*|(\b\d[\d_]*(\.[\d_]*)?|\.\d[\d_]*)([eEfF][-+]?\d+)?/,r:0},l={cN:"string",b:/'(.|\\[xXuU][a-zA-Z0-9]+)'/},c={cN:"subst",b:/\$\(/,e:/\)/,k:r},s={cN:"variable",b:"\\$"+t},d={cN:"string",c:[e.BE,c,s],v:[{b:/\w*"""/,e:/"""\w*/,r:10},{b:/\w*"/,e:/"\w*/}]},S={cN:"string",c:[e.BE,c,s],b:"`",e:"`"},u={cN:"meta",b:"@"+t},g={cN:"comment",v:[{b:"#=",e:"=#",r:10},{b:"#",e:"$"}]};return a.c=[i,l,n,o,d,S,u,g,e.HCM],c.c=a.c,a});hljs.registerLanguage("golo",function(e){return{k:{keyword:"println readln print import module function local return let var while for foreach times in case when match with break continue augment augmentation each find filter reduce if then else otherwise try catch finally raise throw orIfNull DynamicObject|10 DynamicVariable struct Observable map set vector list array",literal:"true false null"},c:[e.HCM,e.QSM,e.CNM,{cN:"meta",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("vim",function(e){return{l:/[!#@\w]+/,k:{keyword:"N|0 P|0 X|0 a|0 ab abc abo al am an|0 ar arga argd arge argdo argg argl argu as au aug aun b|0 bN ba bad bd be bel bf bl bm bn bo bp br brea breaka breakd breakl bro bufdo buffers bun bw c|0 cN cNf ca cabc caddb cad caddf cal cat cb cc ccl cd ce cex cf cfir cgetb cgete cg changes chd che checkt cl cla clo cm cmapc cme cn cnew cnf cno cnorea cnoreme co col colo com comc comp con conf cope cp cpf cq cr cs cst cu cuna cunme cw delm deb debugg delc delf dif diffg diffo diffp diffpu diffs diffthis dig di dl dell dj dli do doautoa dp dr ds dsp e|0 ea ec echoe echoh echom echon el elsei em en endfo endf endt endw ene ex exe exi exu f|0 files filet fin fina fini fir fix fo foldc foldd folddoc foldo for fu go gr grepa gu gv ha helpf helpg helpt hi hid his ia iabc if ij il im imapc ime ino inorea inoreme int is isp iu iuna iunme j|0 ju k|0 keepa kee keepj lN lNf l|0 lad laddb laddf la lan lat lb lc lch lcl lcs le lefta let lex lf lfir lgetb lgete lg lgr lgrepa lh ll lla lli lmak lm lmapc lne lnew lnf ln loadk lo loc lockv lol lope lp lpf lr ls lt lu lua luad luaf lv lvimgrepa lw m|0 ma mak map mapc marks mat me menut mes mk mks mksp mkv mkvie mod mz mzf nbc nb nbs new nm nmapc nme nn nnoreme noa no noh norea noreme norm nu nun nunme ol o|0 om omapc ome on ono onoreme opt ou ounme ow p|0 profd prof pro promptr pc ped pe perld po popu pp pre prev ps pt ptN ptf ptj ptl ptn ptp ptr pts pu pw py3 python3 py3d py3f py pyd pyf quita qa rec red redi redr redraws reg res ret retu rew ri rightb rub rubyd rubyf rund ru rv sN san sa sal sav sb sbN sba sbf sbl sbm sbn sbp sbr scrip scripte scs se setf setg setl sf sfir sh sim sig sil sl sla sm smap smapc sme sn sni sno snor snoreme sor so spelld spe spelli spellr spellu spellw sp spr sre st sta startg startr star stopi stj sts sun sunm sunme sus sv sw sy synti sync tN tabN tabc tabdo tabe tabf tabfir tabl tabm tabnew tabn tabo tabp tabr tabs tab ta tags tc tcld tclf te tf th tj tl tm tn to tp tr try ts tu u|0 undoj undol una unh unl unlo unm unme uns up ve verb vert vim vimgrepa vi viu vie vm vmapc vme vne vn vnoreme vs vu vunme windo w|0 wN wa wh wi winc winp wn wp wq wqa ws wu wv x|0 xa xmapc xm xme xn xnoreme xu xunme y|0 z|0 ~ Next Print append abbreviate abclear aboveleft all amenu anoremenu args argadd argdelete argedit argglobal arglocal argument ascii autocmd augroup aunmenu buffer bNext ball badd bdelete behave belowright bfirst blast bmodified bnext botright bprevious brewind break breakadd breakdel breaklist browse bunload bwipeout change cNext cNfile cabbrev cabclear caddbuffer caddexpr caddfile call catch cbuffer cclose center cexpr cfile cfirst cgetbuffer cgetexpr cgetfile chdir checkpath checktime clist clast close cmap cmapclear cmenu cnext cnewer cnfile cnoremap cnoreabbrev cnoremenu copy colder colorscheme command comclear compiler continue confirm copen cprevious cpfile cquit crewind cscope cstag cunmap cunabbrev cunmenu cwindow delete delmarks debug debuggreedy delcommand delfunction diffupdate diffget diffoff diffpatch diffput diffsplit digraphs display deletel djump dlist doautocmd doautoall deletep drop dsearch dsplit edit earlier echo echoerr echohl echomsg else elseif emenu endif endfor endfunction endtry endwhile enew execute exit exusage file filetype find finally finish first fixdel fold foldclose folddoopen folddoclosed foldopen function global goto grep grepadd gui gvim hardcopy help helpfind helpgrep helptags highlight hide history insert iabbrev iabclear ijump ilist imap imapclear imenu inoremap inoreabbrev inoremenu intro isearch isplit iunmap iunabbrev iunmenu join jumps keepalt keepmarks keepjumps lNext lNfile list laddexpr laddbuffer laddfile last language later lbuffer lcd lchdir lclose lcscope left leftabove lexpr lfile lfirst lgetbuffer lgetexpr lgetfile lgrep lgrepadd lhelpgrep llast llist lmake lmap lmapclear lnext lnewer lnfile lnoremap loadkeymap loadview lockmarks lockvar lolder lopen lprevious lpfile lrewind ltag lunmap luado luafile lvimgrep lvimgrepadd lwindow move mark make mapclear match menu menutranslate messages mkexrc mksession mkspell mkvimrc mkview mode mzscheme mzfile nbclose nbkey nbsart next nmap nmapclear nmenu nnoremap nnoremenu noautocmd noremap nohlsearch noreabbrev noremenu normal number nunmap nunmenu oldfiles open omap omapclear omenu only onoremap onoremenu options ounmap ounmenu ownsyntax print profdel profile promptfind promptrepl pclose pedit perl perldo pop popup ppop preserve previous psearch ptag ptNext ptfirst ptjump ptlast ptnext ptprevious ptrewind ptselect put pwd py3do py3file python pydo pyfile quit quitall qall read recover redo redir redraw redrawstatus registers resize retab return rewind right rightbelow ruby rubydo rubyfile rundo runtime rviminfo substitute sNext sandbox sargument sall saveas sbuffer sbNext sball sbfirst sblast sbmodified sbnext sbprevious sbrewind scriptnames scriptencoding scscope set setfiletype setglobal setlocal sfind sfirst shell simalt sign silent sleep slast smagic smapclear smenu snext sniff snomagic snoremap snoremenu sort source spelldump spellgood spellinfo spellrepall spellundo spellwrong split sprevious srewind stop stag startgreplace startreplace startinsert stopinsert stjump stselect sunhide sunmap sunmenu suspend sview swapname syntax syntime syncbind tNext tabNext tabclose tabedit tabfind tabfirst tablast tabmove tabnext tabonly tabprevious tabrewind tag tcl tcldo tclfile tearoff tfirst throw tjump tlast tmenu tnext topleft tprevious trewind tselect tunmenu undo undojoin undolist unabbreviate unhide unlet unlockvar unmap unmenu unsilent update vglobal version verbose vertical vimgrep vimgrepadd visual viusage view vmap vmapclear vmenu vnew vnoremap vnoremenu vsplit vunmap vunmenu write wNext wall while winsize wincmd winpos wnext wprevious wqall wsverb wundo wviminfo xit xall xmapclear xmap xmenu xnoremap xnoremenu xunmap xunmenu yank",built_in:"synIDtrans atan2 range matcharg did_filetype asin feedkeys xor argv complete_check add getwinposx getqflist getwinposy screencol clearmatches empty extend getcmdpos mzeval garbagecollect setreg ceil sqrt diff_hlID inputsecret get getfperm getpid filewritable shiftwidth max sinh isdirectory synID system inputrestore winline atan visualmode inputlist tabpagewinnr round getregtype mapcheck hasmapto histdel argidx findfile sha256 exists toupper getcmdline taglist string getmatches bufnr strftime winwidth bufexists strtrans tabpagebuflist setcmdpos remote_read printf setloclist getpos getline bufwinnr float2nr len getcmdtype diff_filler luaeval resolve libcallnr foldclosedend reverse filter has_key bufname str2float strlen setline getcharmod setbufvar index searchpos shellescape undofile foldclosed setqflist buflisted strchars str2nr virtcol floor remove undotree remote_expr winheight gettabwinvar reltime cursor tabpagenr finddir localtime acos getloclist search tanh matchend rename gettabvar strdisplaywidth type abs py3eval setwinvar tolower wildmenumode log10 spellsuggest bufloaded synconcealed nextnonblank server2client complete settabwinvar executable input wincol setmatches getftype hlID inputsave searchpair or screenrow line settabvar histadd deepcopy strpart remote_peek and eval getftime submatch screenchar winsaveview matchadd mkdir screenattr getfontname libcall reltimestr getfsize winnr invert pow getbufline byte2line soundfold repeat fnameescape tagfiles sin strwidth spellbadword trunc maparg log lispindent hostname setpos globpath remote_foreground getchar synIDattr fnamemodify cscope_connection stridx winbufnr indent min complete_add nr2char searchpairpos inputdialog values matchlist items hlexists strridx browsedir expand fmod pathshorten line2byte argc count getwinvar glob foldtextresult getreg foreground cosh matchdelete has char2nr simplify histget searchdecl iconv winrestcmd pumvisible writefile foldlevel haslocaldir keys cos matchstr foldtext histnr tan tempname getcwd byteidx getbufvar islocked escape eventhandler remote_send serverlist winrestview synstack pyeval prevnonblank readfile cindent filereadable changenr exp"},i:/;/,c:[e.NM,e.ASM,{cN:"string",b:/"(\\"|\n\\|[^"\n])*"/},e.C('"',"$"),{cN:"variable",b:/[bwtglsav]:[\w\d_]*/},{cN:"function",bK:"function function!",e:"$",r:0,c:[e.TM,{cN:"params",b:"\\(",e:"\\)"}]},{cN:"symbol",b:/<[\w-]+>/}]}});hljs.registerLanguage("perl",function(e){var t="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when",r={cN:"subst",b:"[$@]\\{",e:"\\}",k:t},s={b:"->{",e:"}"},n={v:[{b:/\$\d/},{b:/[\$%@](\^\w\b|#\w+(::\w+)*|{\w+}|\w+(::\w*)*)/},{b:/[\$%@][^\s\w{]/,r:0}]},i=[e.BE,r,n],o=[n,e.HCM,e.C("^\\=\\w","\\=cut",{eW:!0}),s,{cN:"string",c:i,v:[{b:"q[qwxr]?\\s*\\(",e:"\\)",r:5},{b:"q[qwxr]?\\s*\\[",e:"\\]",r:5},{b:"q[qwxr]?\\s*\\{",e:"\\}",r:5},{b:"q[qwxr]?\\s*\\|",e:"\\|",r:5},{b:"q[qwxr]?\\s*\\<",e:"\\>",r:5},{b:"qw\\s+q",e:"q",r:5},{b:"'",e:"'",c:[e.BE]},{b:'"',e:'"'},{b:"`",e:"`",c:[e.BE]},{b:"{\\w+}",c:[],r:0},{b:"-?\\w+\\s*\\=\\>",c:[],r:0}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\/\\/|"+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"function",bK:"sub",e:"(\\s*\\(.*?\\))?[;{]",eE:!0,r:5,c:[e.TM]},{b:"-\\w\\b",r:0},{b:"^__DATA__$",e:"^__END__$",sL:"mojolicious",c:[{b:"^@@.*",e:"$",cN:"comment"}]}];return r.c=o,s.c=o,{aliases:["pl","pm"],l:/[\w\.]+/,k:t,c:o}});hljs.registerLanguage("ruby",function(e){var b="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",r={keyword:"and then defined module in return redo if BEGIN retry end for self when next until do begin unless END rescue else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor",literal:"true false nil"},c={cN:"doctag",b:"@[A-Za-z]+"},a={b:"#<",e:">"},s=[e.C("#","$",{c:[c]}),e.C("^\\=begin","^\\=end",{c:[c],r:10}),e.C("^__END__","\\n$")],n={cN:"subst",b:"#\\{",e:"}",k:r},t={cN:"string",c:[e.BE,n],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/`/,e:/`/},{b:"%[qQwWx]?\\(",e:"\\)"},{b:"%[qQwWx]?\\[",e:"\\]"},{b:"%[qQwWx]?{",e:"}"},{b:"%[qQwWx]?<",e:">"},{b:"%[qQwWx]?/",e:"/"},{b:"%[qQwWx]?%",e:"%"},{b:"%[qQwWx]?-",e:"-"},{b:"%[qQwWx]?\\|",e:"\\|"},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/},{b:/<<(-?)\w+$/,e:/^\s*\w+$/}]},i={cN:"params",b:"\\(",e:"\\)",endsParent:!0,k:r},d=[t,a,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{b:"<\\s*",c:[{b:"("+e.IR+"::)?"+e.IR}]}].concat(s)},{cN:"function",bK:"def",e:"$|;",c:[e.inherit(e.TM,{b:b}),i].concat(s)},{b:e.IR+"::"},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":(?!\\s)",c:[t,{b:b}],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{cN:"params",b:/\|/,e:/\|/,k:r},{b:"("+e.RSR+"|unless)\\s*",c:[a,{cN:"regexp",c:[e.BE,n],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}].concat(s),r:0}].concat(s);n.c=d,i.c=d;var l="[>?]>",o="[\\w#]+\\(\\w+\\):\\d+:\\d+>",u="(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>",w=[{b:/^\s*=>/,starts:{e:"$",c:d}},{cN:"meta",b:"^("+l+"|"+o+"|"+u+")",starts:{e:"$",c:d}}];return{aliases:["rb","gemspec","podspec","thor","irb"],k:r,i:/\/\*/,c:s.concat(w).concat(d)}});hljs.registerLanguage("yaml",function(e){var b="true false yes no null",a="^[ \\-]*",r="[a-zA-Z_][\\w\\-]*",t={cN:"attr",v:[{b:a+r+":"},{b:a+'"'+r+'":'},{b:a+"'"+r+"':"}]},c={cN:"template-variable",v:[{b:"{{",e:"}}"},{b:"%{",e:"}"}]},l={cN:"string",r:0,v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/\S+/}],c:[e.BE,c]};return{cI:!0,aliases:["yml","YAML","yaml"],c:[t,{cN:"meta",b:"^---s*$",r:10},{cN:"string",b:"[\\|>] *$",rE:!0,c:l.c,e:t.v[0].b},{b:"<%[%=-]?",e:"[%-]?%>",sL:"ruby",eB:!0,eE:!0,r:0},{cN:"type",b:"!!"+e.UIR},{cN:"meta",b:"&"+e.UIR+"$"},{cN:"meta",b:"\\*"+e.UIR+"$"},{cN:"bullet",b:"^ *-",r:0},e.HCM,{bK:b,k:{literal:b}},e.CNM,l]}});hljs.registerLanguage("bnf",function(e){return{c:[{cN:"attribute",b://},{b:/::=/,starts:{e:/$/,c:[{b://},e.CLCM,e.CBCM,e.ASM,e.QSM]}}]}});hljs.registerLanguage("applescript",function(e){var t=e.inherit(e.QSM,{i:""}),r={cN:"params",b:"\\(",e:"\\)",c:["self",e.CNM,t]},i=e.C("--","$"),o=e.C("\\(\\*","\\*\\)",{c:["self",i]}),n=[i,o,e.HCM];return{aliases:["osascript"],k:{keyword:"about above after against and around as at back before beginning behind below beneath beside between but by considering contain contains continue copy div does eighth else end equal equals error every exit fifth first for fourth from front get given global if ignoring in into is it its last local me middle mod my ninth not of on onto or over prop property put ref reference repeat returning script second set seventh since sixth some tell tenth that the|0 then third through thru timeout times to transaction try until where while whose with without",literal:"AppleScript false linefeed return pi quote result space tab true",built_in:"alias application boolean class constant date file integer list number real record string text activate beep count delay launch log offset read round run say summarize write character characters contents day frontmost id item length month name paragraph paragraphs rest reverse running time version weekday word words year"},c:[t,e.CNM,{cN:"built_in",b:"\\b(clipboard info|the clipboard|info for|list (disks|folder)|mount volume|path to|(close|open for) access|(get|set) eof|current date|do shell script|get volume settings|random number|set volume|system attribute|system info|time to GMT|(load|run|store) script|scripting components|ASCII (character|number)|localized string|choose (application|color|file|file name|folder|from list|remote application|URL)|display (alert|dialog))\\b|^\\s*return\\b"},{cN:"literal",b:"\\b(text item delimiters|current application|missing value)\\b"},{cN:"keyword",b:"\\b(apart from|aside from|instead of|out of|greater than|isn't|(doesn't|does not) (equal|come before|come after|contain)|(greater|less) than( or equal)?|(starts?|ends|begins?) with|contained by|comes (before|after)|a (ref|reference)|POSIX file|POSIX path|(date|time) string|quoted form)\\b"},{bK:"on",i:"[${=;\\n]",c:[e.UTM,r]}].concat(n),i:"//|->|=>|\\[\\["}});hljs.registerLanguage("vhdl",function(e){var r="\\d(_|\\d)*",t="[eE][-+]?"+r,n=r+"(\\."+r+")?("+t+")?",o="\\w+",i=r+"#"+o+"(\\."+o+")?#("+t+")?",a="\\b("+i+"|"+n+")";return{cI:!0,k:{keyword:"abs access after alias all and architecture array assert assume assume_guarantee attribute begin block body buffer bus case component configuration constant context cover disconnect downto default else elsif end entity exit fairness file for force function generate generic group guarded if impure in inertial inout is label library linkage literal loop map mod nand new next nor not null of on open or others out package port postponed procedure process property protected pure range record register reject release rem report restrict restrict_guarantee return rol ror select sequence severity shared signal sla sll sra srl strong subtype then to transport type unaffected units until use variable vmode vprop vunit wait when while with xnor xor",built_in:"boolean bit character integer time delay_length natural positive string bit_vector file_open_kind file_open_status std_logic std_logic_vector unsigned signed boolean_vector integer_vector std_ulogic std_ulogic_vector unresolved_unsigned u_unsigned unresolved_signed u_signedreal_vector time_vector",literal:"false true note warning error failure line text side width"},i:"{",c:[e.CBCM,e.C("--","$"),e.QSM,{cN:"number",b:a,r:0},{cN:"string",b:"'(U|X|0|1|Z|W|L|H|-)'",c:[e.BE]},{cN:"symbol",b:"'[A-Za-z](_?[A-Za-z0-9])*",c:[e.BE]}]}});hljs.registerLanguage("lisp",function(b){var e="[a-zA-Z_\\-\\+\\*\\/\\<\\=\\>\\&\\#][a-zA-Z0-9_\\-\\+\\*\\/\\<\\=\\>\\&\\#!]*",c="\\|[^]*?\\|",r="(\\-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s|D|E|F|L|S)(\\+|\\-)?\\d+)?",a={cN:"meta",b:"^#!",e:"$"},l={cN:"literal",b:"\\b(t{1}|nil)\\b"},n={cN:"number",v:[{b:r,r:0},{b:"#(b|B)[0-1]+(/[0-1]+)?"},{b:"#(o|O)[0-7]+(/[0-7]+)?"},{b:"#(x|X)[0-9a-fA-F]+(/[0-9a-fA-F]+)?"},{b:"#(c|C)\\("+r+" +"+r,e:"\\)"}]},i=b.inherit(b.QSM,{i:null}),t=b.C(";","$",{r:0}),s={b:"\\*",e:"\\*"},u={cN:"symbol",b:"[:&]"+e},d={b:e,r:0},f={b:c},m={b:"\\(",e:"\\)",c:["self",l,i,n,d]},o={c:[n,i,s,u,m,d],v:[{b:"['`]\\(",e:"\\)"},{b:"\\(quote ",e:"\\)",k:{name:"quote"}},{b:"'"+c}]},v={v:[{b:"'"+e},{b:"#'"+e+"(::"+e+")*"}]},N={b:"\\(\\s*",e:"\\)"},A={eW:!0,r:0};return N.c=[{cN:"name",v:[{b:e},{b:c}]},A],A.c=[o,v,N,l,n,i,t,s,u,f,d],{i:/\S/,c:[n,a,l,i,t,o,v,N,d]}});hljs.registerLanguage("mathematica",function(e){return{aliases:["mma"],l:"(\\$|\\b)"+e.IR+"\\b",k:"AbelianGroup Abort AbortKernels AbortProtect Above Abs Absolute AbsoluteCorrelation AbsoluteCorrelationFunction AbsoluteCurrentValue AbsoluteDashing AbsoluteFileName AbsoluteOptions AbsolutePointSize AbsoluteThickness AbsoluteTime AbsoluteTiming AccountingForm Accumulate Accuracy AccuracyGoal ActionDelay ActionMenu ActionMenuBox ActionMenuBoxOptions Active ActiveItem ActiveStyle AcyclicGraphQ AddOnHelpPath AddTo AdjacencyGraph AdjacencyList AdjacencyMatrix AdjustmentBox AdjustmentBoxOptions AdjustTimeSeriesForecast AffineTransform After AiryAi AiryAiPrime AiryAiZero AiryBi AiryBiPrime AiryBiZero AlgebraicIntegerQ AlgebraicNumber AlgebraicNumberDenominator AlgebraicNumberNorm AlgebraicNumberPolynomial AlgebraicNumberTrace AlgebraicRules AlgebraicRulesData Algebraics AlgebraicUnitQ Alignment AlignmentMarker AlignmentPoint All AllowedDimensions AllowGroupClose AllowInlineCells AllowKernelInitialization AllowReverseGroupClose AllowScriptLevelChange AlphaChannel AlternatingGroup AlternativeHypothesis Alternatives AmbientLight Analytic AnchoredSearch And AndersonDarlingTest AngerJ AngleBracket AngularGauge Animate AnimationCycleOffset AnimationCycleRepetitions AnimationDirection AnimationDisplayTime AnimationRate AnimationRepetitions AnimationRunning Animator AnimatorBox AnimatorBoxOptions AnimatorElements Annotation Annuity AnnuityDue Antialiasing Antisymmetric Apart ApartSquareFree Appearance AppearanceElements AppellF1 Append AppendTo Apply ArcCos ArcCosh ArcCot ArcCoth ArcCsc ArcCsch ArcSec ArcSech ArcSin ArcSinDistribution ArcSinh ArcTan ArcTanh Arg ArgMax ArgMin ArgumentCountQ ARIMAProcess ArithmeticGeometricMean ARMAProcess ARProcess Array ArrayComponents ArrayDepth ArrayFlatten ArrayPad ArrayPlot ArrayQ ArrayReshape ArrayRules Arrays Arrow Arrow3DBox ArrowBox Arrowheads AspectRatio AspectRatioFixed Assert Assuming Assumptions AstronomicalData Asynchronous AsynchronousTaskObject AsynchronousTasks AtomQ Attributes AugmentedSymmetricPolynomial AutoAction AutoDelete AutoEvaluateEvents AutoGeneratedPackage AutoIndent AutoIndentSpacings AutoItalicWords AutoloadPath AutoMatch Automatic AutomaticImageSize AutoMultiplicationSymbol AutoNumberFormatting AutoOpenNotebooks AutoOpenPalettes AutorunSequencing AutoScaling AutoScroll AutoSpacing AutoStyleOptions AutoStyleWords Axes AxesEdge AxesLabel AxesOrigin AxesStyle Axis BabyMonsterGroupB Back Background BackgroundTasksSettings Backslash Backsubstitution Backward Band BandpassFilter BandstopFilter BarabasiAlbertGraphDistribution BarChart BarChart3D BarLegend BarlowProschanImportance BarnesG BarOrigin BarSpacing BartlettHannWindow BartlettWindow BaseForm Baseline BaselinePosition BaseStyle BatesDistribution BattleLemarieWavelet Because BeckmannDistribution Beep Before Begin BeginDialogPacket BeginFrontEndInteractionPacket BeginPackage BellB BellY Below BenfordDistribution BeniniDistribution BenktanderGibratDistribution BenktanderWeibullDistribution BernoulliB BernoulliDistribution BernoulliGraphDistribution BernoulliProcess BernsteinBasis BesselFilterModel BesselI BesselJ BesselJZero BesselK BesselY BesselYZero Beta BetaBinomialDistribution BetaDistribution BetaNegativeBinomialDistribution BetaPrimeDistribution BetaRegularized BetweennessCentrality BezierCurve BezierCurve3DBox BezierCurve3DBoxOptions BezierCurveBox BezierCurveBoxOptions BezierFunction BilateralFilter Binarize BinaryFormat BinaryImageQ BinaryRead BinaryReadList BinaryWrite BinCounts BinLists Binomial BinomialDistribution BinomialProcess BinormalDistribution BiorthogonalSplineWavelet BipartiteGraphQ BirnbaumImportance BirnbaumSaundersDistribution BitAnd BitClear BitGet BitLength BitNot BitOr BitSet BitShiftLeft BitShiftRight BitXor Black BlackmanHarrisWindow BlackmanNuttallWindow BlackmanWindow Blank BlankForm BlankNullSequence BlankSequence Blend Block BlockRandom BlomqvistBeta BlomqvistBetaTest Blue Blur BodePlot BohmanWindow Bold Bookmarks Boole BooleanConsecutiveFunction BooleanConvert BooleanCountingFunction BooleanFunction BooleanGraph BooleanMaxterms BooleanMinimize BooleanMinterms Booleans BooleanTable BooleanVariables BorderDimensions BorelTannerDistribution Bottom BottomHatTransform BoundaryStyle Bounds Box BoxBaselineShift BoxData BoxDimensions Boxed Boxes BoxForm BoxFormFormatTypes BoxFrame BoxID BoxMargins BoxMatrix BoxRatios BoxRotation BoxRotationPoint BoxStyle BoxWhiskerChart Bra BracketingBar BraKet BrayCurtisDistance BreadthFirstScan Break Brown BrownForsytheTest BrownianBridgeProcess BrowserCategory BSplineBasis BSplineCurve BSplineCurve3DBox BSplineCurveBox BSplineCurveBoxOptions BSplineFunction BSplineSurface BSplineSurface3DBox BubbleChart BubbleChart3D BubbleScale BubbleSizes BulletGauge BusinessDayQ ButterflyGraph ButterworthFilterModel Button ButtonBar ButtonBox ButtonBoxOptions ButtonCell ButtonContents ButtonData ButtonEvaluator ButtonExpandable ButtonFrame ButtonFunction ButtonMargins ButtonMinHeight ButtonNote ButtonNotebook ButtonSource ButtonStyle ButtonStyleMenuListing Byte ByteCount ByteOrdering C CachedValue CacheGraphics CalendarData CalendarType CallPacket CanberraDistance Cancel CancelButton CandlestickChart Cap CapForm CapitalDifferentialD CardinalBSplineBasis CarmichaelLambda Cases Cashflow Casoratian Catalan CatalanNumber Catch CauchyDistribution CauchyWindow CayleyGraph CDF CDFDeploy CDFInformation CDFWavelet Ceiling Cell CellAutoOverwrite CellBaseline CellBoundingBox CellBracketOptions CellChangeTimes CellContents CellContext CellDingbat CellDynamicExpression CellEditDuplicate CellElementsBoundingBox CellElementSpacings CellEpilog CellEvaluationDuplicate CellEvaluationFunction CellEventActions CellFrame CellFrameColor CellFrameLabelMargins CellFrameLabels CellFrameMargins CellGroup CellGroupData CellGrouping CellGroupingRules CellHorizontalScrolling CellID CellLabel CellLabelAutoDelete CellLabelMargins CellLabelPositioning CellMargins CellObject CellOpen CellPrint CellProlog Cells CellSize CellStyle CellTags CellularAutomaton CensoredDistribution Censoring Center CenterDot CentralMoment CentralMomentGeneratingFunction CForm ChampernowneNumber ChanVeseBinarize Character CharacterEncoding CharacterEncodingsPath CharacteristicFunction CharacteristicPolynomial CharacterRange Characters ChartBaseStyle ChartElementData ChartElementDataFunction ChartElementFunction ChartElements ChartLabels ChartLayout ChartLegends ChartStyle Chebyshev1FilterModel Chebyshev2FilterModel ChebyshevDistance ChebyshevT ChebyshevU Check CheckAbort CheckAll Checkbox CheckboxBar CheckboxBox CheckboxBoxOptions ChemicalData ChessboardDistance ChiDistribution ChineseRemainder ChiSquareDistribution ChoiceButtons ChoiceDialog CholeskyDecomposition Chop Circle CircleBox CircleDot CircleMinus CirclePlus CircleTimes CirculantGraph CityData Clear ClearAll ClearAttributes ClearSystemCache ClebschGordan ClickPane Clip ClipboardNotebook ClipFill ClippingStyle ClipPlanes ClipRange Clock ClockGauge ClockwiseContourIntegral Close Closed CloseKernels ClosenessCentrality Closing ClosingAutoSave ClosingEvent ClusteringComponents CMYKColor Coarse Coefficient CoefficientArrays CoefficientDomain CoefficientList CoefficientRules CoifletWavelet Collect Colon ColonForm ColorCombine ColorConvert ColorData ColorDataFunction ColorFunction ColorFunctionScaling Colorize ColorNegate ColorOutput ColorProfileData ColorQuantize ColorReplace ColorRules ColorSelectorSettings ColorSeparate ColorSetter ColorSetterBox ColorSetterBoxOptions ColorSlider ColorSpace Column ColumnAlignments ColumnBackgrounds ColumnForm ColumnLines ColumnsEqual ColumnSpacings ColumnWidths CommonDefaultFormatTypes Commonest CommonestFilter CommonUnits CommunityBoundaryStyle CommunityGraphPlot CommunityLabels CommunityRegionStyle CompatibleUnitQ CompilationOptions CompilationTarget Compile Compiled CompiledFunction Complement CompleteGraph CompleteGraphQ CompleteKaryTree CompletionsListPacket Complex Complexes ComplexExpand ComplexInfinity ComplexityFunction ComponentMeasurements ComponentwiseContextMenu Compose ComposeList ComposeSeries Composition CompoundExpression CompoundPoissonDistribution CompoundPoissonProcess CompoundRenewalProcess Compress CompressedData Condition ConditionalExpression Conditioned Cone ConeBox ConfidenceLevel ConfidenceRange ConfidenceTransform ConfigurationPath Congruent Conjugate ConjugateTranspose Conjunction Connect ConnectedComponents ConnectedGraphQ ConnesWindow ConoverTest ConsoleMessage ConsoleMessagePacket ConsolePrint Constant ConstantArray Constants ConstrainedMax ConstrainedMin ContentPadding ContentsBoundingBox ContentSelectable ContentSize Context ContextMenu Contexts ContextToFilename ContextToFileName Continuation Continue ContinuedFraction ContinuedFractionK ContinuousAction ContinuousMarkovProcess ContinuousTimeModelQ ContinuousWaveletData ContinuousWaveletTransform ContourDetect ContourGraphics ContourIntegral ContourLabels ContourLines ContourPlot ContourPlot3D Contours ContourShading ContourSmoothing ContourStyle ContraharmonicMean Control ControlActive ControlAlignment ControllabilityGramian ControllabilityMatrix ControllableDecomposition ControllableModelQ ControllerDuration ControllerInformation ControllerInformationData ControllerLinking ControllerManipulate ControllerMethod ControllerPath ControllerState ControlPlacement ControlsRendering ControlType Convergents ConversionOptions ConversionRules ConvertToBitmapPacket ConvertToPostScript ConvertToPostScriptPacket Convolve ConwayGroupCo1 ConwayGroupCo2 ConwayGroupCo3 CoordinateChartData CoordinatesToolOptions CoordinateTransform CoordinateTransformData CoprimeQ Coproduct CopulaDistribution Copyable CopyDirectory CopyFile CopyTag CopyToClipboard CornerFilter CornerNeighbors Correlation CorrelationDistance CorrelationFunction CorrelationTest Cos Cosh CoshIntegral CosineDistance CosineWindow CosIntegral Cot Coth Count CounterAssignments CounterBox CounterBoxOptions CounterClockwiseContourIntegral CounterEvaluator CounterFunction CounterIncrements CounterStyle CounterStyleMenuListing CountRoots CountryData Covariance CovarianceEstimatorFunction CovarianceFunction CoxianDistribution CoxIngersollRossProcess CoxModel CoxModelFit CramerVonMisesTest CreateArchive CreateDialog CreateDirectory CreateDocument CreateIntermediateDirectories CreatePalette CreatePalettePacket CreateScheduledTask CreateTemporary CreateWindow CriticalityFailureImportance CriticalitySuccessImportance CriticalSection Cross CrossingDetect CrossMatrix Csc Csch CubeRoot Cubics Cuboid CuboidBox Cumulant CumulantGeneratingFunction Cup CupCap Curl CurlyDoubleQuote CurlyQuote CurrentImage CurrentlySpeakingPacket CurrentValue CurvatureFlowFilter CurveClosed Cyan CycleGraph CycleIndexPolynomial Cycles CyclicGroup Cyclotomic Cylinder CylinderBox CylindricalDecomposition D DagumDistribution DamerauLevenshteinDistance DampingFactor Darker Dashed Dashing DataCompression DataDistribution DataRange DataReversed Date DateDelimiters DateDifference DateFunction DateList DateListLogPlot DateListPlot DatePattern DatePlus DateRange DateString DateTicksFormat DaubechiesWavelet DavisDistribution DawsonF DayCount DayCountConvention DayMatchQ DayName DayPlus DayRange DayRound DeBruijnGraph Debug DebugTag Decimal DeclareKnownSymbols DeclarePackage Decompose Decrement DedekindEta Default DefaultAxesStyle DefaultBaseStyle DefaultBoxStyle DefaultButton DefaultColor DefaultControlPlacement DefaultDuplicateCellStyle DefaultDuration DefaultElement DefaultFaceGridsStyle DefaultFieldHintStyle DefaultFont DefaultFontProperties DefaultFormatType DefaultFormatTypeForStyle DefaultFrameStyle DefaultFrameTicksStyle DefaultGridLinesStyle DefaultInlineFormatType DefaultInputFormatType DefaultLabelStyle DefaultMenuStyle DefaultNaturalLanguage DefaultNewCellStyle DefaultNewInlineCellStyle DefaultNotebook DefaultOptions DefaultOutputFormatType DefaultStyle DefaultStyleDefinitions DefaultTextFormatType DefaultTextInlineFormatType DefaultTicksStyle DefaultTooltipStyle DefaultValues Defer DefineExternal DefineInputStreamMethod DefineOutputStreamMethod Definition Degree DegreeCentrality DegreeGraphDistribution DegreeLexicographic DegreeReverseLexicographic Deinitialization Del Deletable Delete DeleteBorderComponents DeleteCases DeleteContents DeleteDirectory DeleteDuplicates DeleteFile DeleteSmallComponents DeleteWithContents DeletionWarning Delimiter DelimiterFlashTime DelimiterMatching Delimiters Denominator DensityGraphics DensityHistogram DensityPlot DependentVariables Deploy Deployed Depth DepthFirstScan Derivative DerivativeFilter DescriptorStateSpace DesignMatrix Det DGaussianWavelet DiacriticalPositioning Diagonal DiagonalMatrix Dialog DialogIndent DialogInput DialogLevel DialogNotebook DialogProlog DialogReturn DialogSymbols Diamond DiamondMatrix DiceDissimilarity DictionaryLookup DifferenceDelta DifferenceOrder DifferenceRoot DifferenceRootReduce Differences DifferentialD DifferentialRoot DifferentialRootReduce DifferentiatorFilter DigitBlock DigitBlockMinimum DigitCharacter DigitCount DigitQ DihedralGroup Dilation Dimensions DiracComb DiracDelta DirectedEdge DirectedEdges DirectedGraph DirectedGraphQ DirectedInfinity Direction Directive Directory DirectoryName DirectoryQ DirectoryStack DirichletCharacter DirichletConvolve DirichletDistribution DirichletL DirichletTransform DirichletWindow DisableConsolePrintPacket DiscreteChirpZTransform DiscreteConvolve DiscreteDelta DiscreteHadamardTransform DiscreteIndicator DiscreteLQEstimatorGains DiscreteLQRegulatorGains DiscreteLyapunovSolve DiscreteMarkovProcess DiscretePlot DiscretePlot3D DiscreteRatio DiscreteRiccatiSolve DiscreteShift DiscreteTimeModelQ DiscreteUniformDistribution DiscreteVariables DiscreteWaveletData DiscreteWaveletPacketTransform DiscreteWaveletTransform Discriminant Disjunction Disk DiskBox DiskMatrix Dispatch DispersionEstimatorFunction Display DisplayAllSteps DisplayEndPacket DisplayFlushImagePacket DisplayForm DisplayFunction DisplayPacket DisplayRules DisplaySetSizePacket DisplayString DisplayTemporary DisplayWith DisplayWithRef DisplayWithVariable DistanceFunction DistanceTransform Distribute Distributed DistributedContexts DistributeDefinitions DistributionChart DistributionDomain DistributionFitTest DistributionParameterAssumptions DistributionParameterQ Dithering Div Divergence Divide DivideBy Dividers Divisible Divisors DivisorSigma DivisorSum DMSList DMSString Do DockedCells DocumentNotebook DominantColors DOSTextFormat Dot DotDashed DotEqual Dotted DoubleBracketingBar DoubleContourIntegral DoubleDownArrow DoubleLeftArrow DoubleLeftRightArrow DoubleLeftTee DoubleLongLeftArrow DoubleLongLeftRightArrow DoubleLongRightArrow DoubleRightArrow DoubleRightTee DoubleUpArrow DoubleUpDownArrow DoubleVerticalBar DoublyInfinite Down DownArrow DownArrowBar DownArrowUpArrow DownLeftRightVector DownLeftTeeVector DownLeftVector DownLeftVectorBar DownRightTeeVector DownRightVector DownRightVectorBar Downsample DownTee DownTeeArrow DownValues DragAndDrop DrawEdges DrawFrontFaces DrawHighlighted Drop DSolve Dt DualLinearProgramming DualSystemsModel DumpGet DumpSave DuplicateFreeQ Dynamic DynamicBox DynamicBoxOptions DynamicEvaluationTimeout DynamicLocation DynamicModule DynamicModuleBox DynamicModuleBoxOptions DynamicModuleParent DynamicModuleValues DynamicName DynamicNamespace DynamicReference DynamicSetting DynamicUpdating DynamicWrapper DynamicWrapperBox DynamicWrapperBoxOptions E EccentricityCentrality EdgeAdd EdgeBetweennessCentrality EdgeCapacity EdgeCapForm EdgeColor EdgeConnectivity EdgeCost EdgeCount EdgeCoverQ EdgeDashing EdgeDelete EdgeDetect EdgeForm EdgeIndex EdgeJoinForm EdgeLabeling EdgeLabels EdgeLabelStyle EdgeList EdgeOpacity EdgeQ EdgeRenderingFunction EdgeRules EdgeShapeFunction EdgeStyle EdgeThickness EdgeWeight Editable EditButtonSettings EditCellTagsSettings EditDistance EffectiveInterest Eigensystem Eigenvalues EigenvectorCentrality Eigenvectors Element ElementData Eliminate EliminationOrder EllipticE EllipticExp EllipticExpPrime EllipticF EllipticFilterModel EllipticK EllipticLog EllipticNomeQ EllipticPi EllipticReducedHalfPeriods EllipticTheta EllipticThetaPrime EmitSound EmphasizeSyntaxErrors EmpiricalDistribution Empty EmptyGraphQ EnableConsolePrintPacket Enabled Encode End EndAdd EndDialogPacket EndFrontEndInteractionPacket EndOfFile EndOfLine EndOfString EndPackage EngineeringForm Enter EnterExpressionPacket EnterTextPacket Entropy EntropyFilter Environment Epilog Equal EqualColumns EqualRows EqualTilde EquatedTo Equilibrium EquirippleFilterKernel Equivalent Erf Erfc Erfi ErlangB ErlangC ErlangDistribution Erosion ErrorBox ErrorBoxOptions ErrorNorm ErrorPacket ErrorsDialogSettings EstimatedDistribution EstimatedProcess EstimatorGains EstimatorRegulator EuclideanDistance EulerE EulerGamma EulerianGraphQ EulerPhi Evaluatable Evaluate Evaluated EvaluatePacket EvaluationCell EvaluationCompletionAction EvaluationElements EvaluationMode EvaluationMonitor EvaluationNotebook EvaluationObject EvaluationOrder Evaluator EvaluatorNames EvenQ EventData EventEvaluator EventHandler EventHandlerTag EventLabels ExactBlackmanWindow ExactNumberQ ExactRootIsolation ExampleData Except ExcludedForms ExcludePods Exclusions ExclusionsStyle Exists Exit ExitDialog Exp Expand ExpandAll ExpandDenominator ExpandFileName ExpandNumerator Expectation ExpectationE ExpectedValue ExpGammaDistribution ExpIntegralE ExpIntegralEi Exponent ExponentFunction ExponentialDistribution ExponentialFamily ExponentialGeneratingFunction ExponentialMovingAverage ExponentialPowerDistribution ExponentPosition ExponentStep Export ExportAutoReplacements ExportPacket ExportString Expression ExpressionCell ExpressionPacket ExpToTrig ExtendedGCD Extension ExtentElementFunction ExtentMarkers ExtentSize ExternalCall ExternalDataCharacterEncoding Extract ExtractArchive ExtremeValueDistribution FaceForm FaceGrids FaceGridsStyle Factor FactorComplete Factorial Factorial2 FactorialMoment FactorialMomentGeneratingFunction FactorialPower FactorInteger FactorList FactorSquareFree FactorSquareFreeList FactorTerms FactorTermsList Fail FailureDistribution False FARIMAProcess FEDisableConsolePrintPacket FeedbackSector FeedbackSectorStyle FeedbackType FEEnableConsolePrintPacket Fibonacci FieldHint FieldHintStyle FieldMasked FieldSize File FileBaseName FileByteCount FileDate FileExistsQ FileExtension FileFormat FileHash FileInformation FileName FileNameDepth FileNameDialogSettings FileNameDrop FileNameJoin FileNames FileNameSetter FileNameSplit FileNameTake FilePrint FileType FilledCurve FilledCurveBox Filling FillingStyle FillingTransform FilterRules FinancialBond FinancialData FinancialDerivative FinancialIndicator Find FindArgMax FindArgMin FindClique FindClusters FindCurvePath FindDistributionParameters FindDivisions FindEdgeCover FindEdgeCut FindEulerianCycle FindFaces FindFile FindFit FindGeneratingFunction FindGeoLocation FindGeometricTransform FindGraphCommunities FindGraphIsomorphism FindGraphPartition FindHamiltonianCycle FindIndependentEdgeSet FindIndependentVertexSet FindInstance FindIntegerNullVector FindKClan FindKClique FindKClub FindKPlex FindLibrary FindLinearRecurrence FindList FindMaximum FindMaximumFlow FindMaxValue FindMinimum FindMinimumCostFlow FindMinimumCut FindMinValue FindPermutation FindPostmanTour FindProcessParameters FindRoot FindSequenceFunction FindSettings FindShortestPath FindShortestTour FindThreshold FindVertexCover FindVertexCut Fine FinishDynamic FiniteAbelianGroupCount FiniteGroupCount FiniteGroupData First FirstPassageTimeDistribution FischerGroupFi22 FischerGroupFi23 FischerGroupFi24Prime FisherHypergeometricDistribution FisherRatioTest FisherZDistribution Fit FitAll FittedModel FixedPoint FixedPointList FlashSelection Flat Flatten FlattenAt FlatTopWindow FlipView Floor FlushPrintOutputPacket Fold FoldList Font FontColor FontFamily FontForm FontName FontOpacity FontPostScriptName FontProperties FontReencoding FontSize FontSlant FontSubstitutions FontTracking FontVariations FontWeight For ForAll Format FormatRules FormatType FormatTypeAutoConvert FormatValues FormBox FormBoxOptions FortranForm Forward ForwardBackward Fourier FourierCoefficient FourierCosCoefficient FourierCosSeries FourierCosTransform FourierDCT FourierDCTFilter FourierDCTMatrix FourierDST FourierDSTMatrix FourierMatrix FourierParameters FourierSequenceTransform FourierSeries FourierSinCoefficient FourierSinSeries FourierSinTransform FourierTransform FourierTrigSeries FractionalBrownianMotionProcess FractionalPart FractionBox FractionBoxOptions FractionLine Frame FrameBox FrameBoxOptions Framed FrameInset FrameLabel Frameless FrameMargins FrameStyle FrameTicks FrameTicksStyle FRatioDistribution FrechetDistribution FreeQ FrequencySamplingFilterKernel FresnelC FresnelS Friday FrobeniusNumber FrobeniusSolve FromCharacterCode FromCoefficientRules FromContinuedFraction FromDate FromDigits FromDMS Front FrontEndDynamicExpression FrontEndEventActions FrontEndExecute FrontEndObject FrontEndResource FrontEndResourceString FrontEndStackSize FrontEndToken FrontEndTokenExecute FrontEndValueCache FrontEndVersion FrontFaceColor FrontFaceOpacity Full FullAxes FullDefinition FullForm FullGraphics FullOptions FullSimplify Function FunctionExpand FunctionInterpolation FunctionSpace FussellVeselyImportance GaborFilter GaborMatrix GaborWavelet GainMargins GainPhaseMargins Gamma GammaDistribution GammaRegularized GapPenalty Gather GatherBy GaugeFaceElementFunction GaugeFaceStyle GaugeFrameElementFunction GaugeFrameSize GaugeFrameStyle GaugeLabels GaugeMarkers GaugeStyle GaussianFilter GaussianIntegers GaussianMatrix GaussianWindow GCD GegenbauerC General GeneralizedLinearModelFit GenerateConditions GeneratedCell GeneratedParameters GeneratingFunction Generic GenericCylindricalDecomposition GenomeData GenomeLookup GeodesicClosing GeodesicDilation GeodesicErosion GeodesicOpening GeoDestination GeodesyData GeoDirection GeoDistance GeoGridPosition GeometricBrownianMotionProcess GeometricDistribution GeometricMean GeometricMeanFilter GeometricTransformation GeometricTransformation3DBox GeometricTransformation3DBoxOptions GeometricTransformationBox GeometricTransformationBoxOptions GeoPosition GeoPositionENU GeoPositionXYZ GeoProjectionData GestureHandler GestureHandlerTag Get GetBoundingBoxSizePacket GetContext GetEnvironment GetFileName GetFrontEndOptionsDataPacket GetLinebreakInformationPacket GetMenusPacket GetPageBreakInformationPacket Glaisher GlobalClusteringCoefficient GlobalPreferences GlobalSession Glow GoldenRatio GompertzMakehamDistribution GoodmanKruskalGamma GoodmanKruskalGammaTest Goto Grad Gradient GradientFilter GradientOrientationFilter Graph GraphAssortativity GraphCenter GraphComplement GraphData GraphDensity GraphDiameter GraphDifference GraphDisjointUnion GraphDistance GraphDistanceMatrix GraphElementData GraphEmbedding GraphHighlight GraphHighlightStyle GraphHub Graphics Graphics3D Graphics3DBox Graphics3DBoxOptions GraphicsArray GraphicsBaseline GraphicsBox GraphicsBoxOptions GraphicsColor GraphicsColumn GraphicsComplex GraphicsComplex3DBox GraphicsComplex3DBoxOptions GraphicsComplexBox GraphicsComplexBoxOptions GraphicsContents GraphicsData GraphicsGrid GraphicsGridBox GraphicsGroup GraphicsGroup3DBox GraphicsGroup3DBoxOptions GraphicsGroupBox GraphicsGroupBoxOptions GraphicsGrouping GraphicsHighlightColor GraphicsRow GraphicsSpacing GraphicsStyle GraphIntersection GraphLayout GraphLinkEfficiency GraphPeriphery GraphPlot GraphPlot3D GraphPower GraphPropertyDistribution GraphQ GraphRadius GraphReciprocity GraphRoot GraphStyle GraphUnion Gray GrayLevel GreatCircleDistance Greater GreaterEqual GreaterEqualLess GreaterFullEqual GreaterGreater GreaterLess GreaterSlantEqual GreaterTilde Green Grid GridBaseline GridBox GridBoxAlignment GridBoxBackground GridBoxDividers GridBoxFrame GridBoxItemSize GridBoxItemStyle GridBoxOptions GridBoxSpacings GridCreationSettings GridDefaultElement GridElementStyleOptions GridFrame GridFrameMargins GridGraph GridLines GridLinesStyle GroebnerBasis GroupActionBase GroupCentralizer GroupElementFromWord GroupElementPosition GroupElementQ GroupElements GroupElementToWord GroupGenerators GroupMultiplicationTable GroupOrbits GroupOrder GroupPageBreakWithin GroupSetwiseStabilizer GroupStabilizer GroupStabilizerChain Gudermannian GumbelDistribution HaarWavelet HadamardMatrix HalfNormalDistribution HamiltonianGraphQ HammingDistance HammingWindow HankelH1 HankelH2 HankelMatrix HannPoissonWindow HannWindow HaradaNortonGroupHN HararyGraph HarmonicMean HarmonicMeanFilter HarmonicNumber Hash HashTable Haversine HazardFunction Head HeadCompose Heads HeavisideLambda HeavisidePi HeavisideTheta HeldGroupHe HeldPart HelpBrowserLookup HelpBrowserNotebook HelpBrowserSettings HermiteDecomposition HermiteH HermitianMatrixQ HessenbergDecomposition Hessian HexadecimalCharacter Hexahedron HexahedronBox HexahedronBoxOptions HiddenSurface HighlightGraph HighlightImage HighpassFilter HigmanSimsGroupHS HilbertFilter HilbertMatrix Histogram Histogram3D HistogramDistribution HistogramList HistogramTransform HistogramTransformInterpolation HitMissTransform HITSCentrality HodgeDual HoeffdingD HoeffdingDTest Hold HoldAll HoldAllComplete HoldComplete HoldFirst HoldForm HoldPattern HoldRest HolidayCalendar HomeDirectory HomePage Horizontal HorizontalForm HorizontalGauge HorizontalScrollPosition HornerForm HotellingTSquareDistribution HoytDistribution HTMLSave Hue HumpDownHump HumpEqual HurwitzLerchPhi HurwitzZeta HyperbolicDistribution HypercubeGraph HyperexponentialDistribution Hyperfactorial Hypergeometric0F1 Hypergeometric0F1Regularized Hypergeometric1F1 Hypergeometric1F1Regularized Hypergeometric2F1 Hypergeometric2F1Regularized HypergeometricDistribution HypergeometricPFQ HypergeometricPFQRegularized HypergeometricU Hyperlink HyperlinkCreationSettings Hyphenation HyphenationOptions HypoexponentialDistribution HypothesisTestData I Identity IdentityMatrix If IgnoreCase Im Image Image3D Image3DSlices ImageAccumulate ImageAdd ImageAdjust ImageAlign ImageApply ImageAspectRatio ImageAssemble ImageCache ImageCacheValid ImageCapture ImageChannels ImageClip ImageColorSpace ImageCompose ImageConvolve ImageCooccurrence ImageCorners ImageCorrelate ImageCorrespondingPoints ImageCrop ImageData ImageDataPacket ImageDeconvolve ImageDemosaic ImageDifference ImageDimensions ImageDistance ImageEffect ImageFeatureTrack ImageFileApply ImageFileFilter ImageFileScan ImageFilter ImageForestingComponents ImageForwardTransformation ImageHistogram ImageKeypoints ImageLevels ImageLines ImageMargins ImageMarkers ImageMeasurements ImageMultiply ImageOffset ImagePad ImagePadding ImagePartition ImagePeriodogram ImagePerspectiveTransformation ImageQ ImageRangeCache ImageReflect ImageRegion ImageResize ImageResolution ImageRotate ImageRotated ImageScaled ImageScan ImageSize ImageSizeAction ImageSizeCache ImageSizeMultipliers ImageSizeRaw ImageSubtract ImageTake ImageTransformation ImageTrim ImageType ImageValue ImageValuePositions Implies Import ImportAutoReplacements ImportString ImprovementImportance In IncidenceGraph IncidenceList IncidenceMatrix IncludeConstantBasis IncludeFileExtension IncludePods IncludeSingularTerm Increment Indent IndentingNewlineSpacings IndentMaxFraction IndependenceTest IndependentEdgeSetQ IndependentUnit IndependentVertexSetQ Indeterminate IndexCreationOptions Indexed IndexGraph IndexTag Inequality InexactNumberQ InexactNumbers Infinity Infix Information Inherited InheritScope Initialization InitializationCell InitializationCellEvaluation InitializationCellWarning InlineCounterAssignments InlineCounterIncrements InlineRules Inner Inpaint Input InputAliases InputAssumptions InputAutoReplacements InputField InputFieldBox InputFieldBoxOptions InputForm InputGrouping InputNamePacket InputNotebook InputPacket InputSettings InputStream InputString InputStringPacket InputToBoxFormPacket Insert InsertionPointObject InsertResults Inset Inset3DBox Inset3DBoxOptions InsetBox InsetBoxOptions Install InstallService InString Integer IntegerDigits IntegerExponent IntegerLength IntegerPart IntegerPartitions IntegerQ Integers IntegerString Integral Integrate Interactive InteractiveTradingChart Interlaced Interleaving InternallyBalancedDecomposition InterpolatingFunction InterpolatingPolynomial Interpolation InterpolationOrder InterpolationPoints InterpolationPrecision Interpretation InterpretationBox InterpretationBoxOptions InterpretationFunction InterpretTemplate InterquartileRange Interrupt InterruptSettings Intersection Interval IntervalIntersection IntervalMemberQ IntervalUnion Inverse InverseBetaRegularized InverseCDF InverseChiSquareDistribution InverseContinuousWaveletTransform InverseDistanceTransform InverseEllipticNomeQ InverseErf InverseErfc InverseFourier InverseFourierCosTransform InverseFourierSequenceTransform InverseFourierSinTransform InverseFourierTransform InverseFunction InverseFunctions InverseGammaDistribution InverseGammaRegularized InverseGaussianDistribution InverseGudermannian InverseHaversine InverseJacobiCD InverseJacobiCN InverseJacobiCS InverseJacobiDC InverseJacobiDN InverseJacobiDS InverseJacobiNC InverseJacobiND InverseJacobiNS InverseJacobiSC InverseJacobiSD InverseJacobiSN InverseLaplaceTransform InversePermutation InverseRadon InverseSeries InverseSurvivalFunction InverseWaveletTransform InverseWeierstrassP InverseZTransform Invisible InvisibleApplication InvisibleTimes IrreduciblePolynomialQ IsolatingInterval IsomorphicGraphQ IsotopeData Italic Item ItemBox ItemBoxOptions ItemSize ItemStyle ItoProcess JaccardDissimilarity JacobiAmplitude Jacobian JacobiCD JacobiCN JacobiCS JacobiDC JacobiDN JacobiDS JacobiNC JacobiND JacobiNS JacobiP JacobiSC JacobiSD JacobiSN JacobiSymbol JacobiZeta JankoGroupJ1 JankoGroupJ2 JankoGroupJ3 JankoGroupJ4 JarqueBeraALMTest JohnsonDistribution Join Joined JoinedCurve JoinedCurveBox JoinForm JordanDecomposition JordanModelDecomposition K KagiChart KaiserBesselWindow KaiserWindow KalmanEstimator KalmanFilter KarhunenLoeveDecomposition KaryTree KatzCentrality KCoreComponents KDistribution KelvinBei KelvinBer KelvinKei KelvinKer KendallTau KendallTauTest KernelExecute KernelMixtureDistribution KernelObject Kernels Ket Khinchin KirchhoffGraph KirchhoffMatrix KleinInvariantJ KnightTourGraph KnotData KnownUnitQ KolmogorovSmirnovTest KroneckerDelta KroneckerModelDecomposition KroneckerProduct KroneckerSymbol KuiperTest KumaraswamyDistribution Kurtosis KuwaharaFilter Label Labeled LabeledSlider LabelingFunction LabelStyle LaguerreL LambdaComponents LambertW LanczosWindow LandauDistribution Language LanguageCategory LaplaceDistribution LaplaceTransform Laplacian LaplacianFilter LaplacianGaussianFilter Large Larger Last Latitude LatitudeLongitude LatticeData LatticeReduce Launch LaunchKernels LayeredGraphPlot LayerSizeFunction LayoutInformation LCM LeafCount LeapYearQ LeastSquares LeastSquaresFilterKernel Left LeftArrow LeftArrowBar LeftArrowRightArrow LeftDownTeeVector LeftDownVector LeftDownVectorBar LeftRightArrow LeftRightVector LeftTee LeftTeeArrow LeftTeeVector LeftTriangle LeftTriangleBar LeftTriangleEqual LeftUpDownVector LeftUpTeeVector LeftUpVector LeftUpVectorBar LeftVector LeftVectorBar LegendAppearance Legended LegendFunction LegendLabel LegendLayout LegendMargins LegendMarkers LegendMarkerSize LegendreP LegendreQ LegendreType Length LengthWhile LerchPhi Less LessEqual LessEqualGreater LessFullEqual LessGreater LessLess LessSlantEqual LessTilde LetterCharacter LetterQ Level LeveneTest LeviCivitaTensor LevyDistribution Lexicographic LibraryFunction LibraryFunctionError LibraryFunctionInformation LibraryFunctionLoad LibraryFunctionUnload LibraryLoad LibraryUnload LicenseID LiftingFilterData LiftingWaveletTransform LightBlue LightBrown LightCyan Lighter LightGray LightGreen Lighting LightingAngle LightMagenta LightOrange LightPink LightPurple LightRed LightSources LightYellow Likelihood Limit LimitsPositioning LimitsPositioningTokens LindleyDistribution Line Line3DBox LinearFilter LinearFractionalTransform LinearModelFit LinearOffsetFunction LinearProgramming LinearRecurrence LinearSolve LinearSolveFunction LineBox LineBreak LinebreakAdjustments LineBreakChart LineBreakWithin LineColor LineForm LineGraph LineIndent LineIndentMaxFraction LineIntegralConvolutionPlot LineIntegralConvolutionScale LineLegend LineOpacity LineSpacing LineWrapParts LinkActivate LinkClose LinkConnect LinkConnectedQ LinkCreate LinkError LinkFlush LinkFunction LinkHost LinkInterrupt LinkLaunch LinkMode LinkObject LinkOpen LinkOptions LinkPatterns LinkProtocol LinkRead LinkReadHeld LinkReadyQ Links LinkWrite LinkWriteHeld LiouvilleLambda List Listable ListAnimate ListContourPlot ListContourPlot3D ListConvolve ListCorrelate ListCurvePathPlot ListDeconvolve ListDensityPlot Listen ListFourierSequenceTransform ListInterpolation ListLineIntegralConvolutionPlot ListLinePlot ListLogLinearPlot ListLogLogPlot ListLogPlot ListPicker ListPickerBox ListPickerBoxBackground ListPickerBoxOptions ListPlay ListPlot ListPlot3D ListPointPlot3D ListPolarPlot ListQ ListStreamDensityPlot ListStreamPlot ListSurfacePlot3D ListVectorDensityPlot ListVectorPlot ListVectorPlot3D ListZTransform Literal LiteralSearch LocalClusteringCoefficient LocalizeVariables LocationEquivalenceTest LocationTest Locator LocatorAutoCreate LocatorBox LocatorBoxOptions LocatorCentering LocatorPane LocatorPaneBox LocatorPaneBoxOptions LocatorRegion Locked Log Log10 Log2 LogBarnesG LogGamma LogGammaDistribution LogicalExpand LogIntegral LogisticDistribution LogitModelFit LogLikelihood LogLinearPlot LogLogisticDistribution LogLogPlot LogMultinormalDistribution LogNormalDistribution LogPlot LogRankTest LogSeriesDistribution LongEqual Longest LongestAscendingSequence LongestCommonSequence LongestCommonSequencePositions LongestCommonSubsequence LongestCommonSubsequencePositions LongestMatch LongForm Longitude LongLeftArrow LongLeftRightArrow LongRightArrow Loopback LoopFreeGraphQ LowerCaseQ LowerLeftArrow LowerRightArrow LowerTriangularize LowpassFilter LQEstimatorGains LQGRegulator LQOutputRegulatorGains LQRegulatorGains LUBackSubstitution LucasL LuccioSamiComponents LUDecomposition LyapunovSolve LyonsGroupLy MachineID MachineName MachineNumberQ MachinePrecision MacintoshSystemPageSetup Magenta Magnification Magnify MainSolve MaintainDynamicCaches Majority MakeBoxes MakeExpression MakeRules MangoldtLambda ManhattanDistance Manipulate Manipulator MannWhitneyTest MantissaExponent Manual Map MapAll MapAt MapIndexed MAProcess MapThread MarcumQ MardiaCombinedTest MardiaKurtosisTest MardiaSkewnessTest MarginalDistribution MarkovProcessProperties Masking MatchingDissimilarity MatchLocalNameQ MatchLocalNames MatchQ Material MathematicaNotation MathieuC MathieuCharacteristicA MathieuCharacteristicB MathieuCharacteristicExponent MathieuCPrime MathieuGroupM11 MathieuGroupM12 MathieuGroupM22 MathieuGroupM23 MathieuGroupM24 MathieuS MathieuSPrime MathMLForm MathMLText Matrices MatrixExp MatrixForm MatrixFunction MatrixLog MatrixPlot MatrixPower MatrixQ MatrixRank Max MaxBend MaxDetect MaxExtraBandwidths MaxExtraConditions MaxFeatures MaxFilter Maximize MaxIterations MaxMemoryUsed MaxMixtureKernels MaxPlotPoints MaxPoints MaxRecursion MaxStableDistribution MaxStepFraction MaxSteps MaxStepSize MaxValue MaxwellDistribution McLaughlinGroupMcL Mean MeanClusteringCoefficient MeanDegreeConnectivity MeanDeviation MeanFilter MeanGraphDistance MeanNeighborDegree MeanShift MeanShiftFilter Median MedianDeviation MedianFilter Medium MeijerG MeixnerDistribution MemberQ MemoryConstrained MemoryInUse Menu MenuAppearance MenuCommandKey MenuEvaluator MenuItem MenuPacket MenuSortingValue MenuStyle MenuView MergeDifferences Mesh MeshFunctions MeshRange MeshShading MeshStyle Message MessageDialog MessageList MessageName MessageOptions MessagePacket Messages MessagesNotebook MetaCharacters MetaInformation Method MethodOptions MexicanHatWavelet MeyerWavelet Min MinDetect MinFilter MinimalPolynomial MinimalStateSpaceModel Minimize Minors MinRecursion MinSize MinStableDistribution Minus MinusPlus MinValue Missing MissingDataMethod MittagLefflerE MixedRadix MixedRadixQuantity MixtureDistribution Mod Modal Mode Modular ModularLambda Module Modulus MoebiusMu Moment Momentary MomentConvert MomentEvaluate MomentGeneratingFunction Monday Monitor MonomialList MonomialOrder MonsterGroupM MorletWavelet MorphologicalBinarize MorphologicalBranchPoints MorphologicalComponents MorphologicalEulerNumber MorphologicalGraph MorphologicalPerimeter MorphologicalTransform Most MouseAnnotation MouseAppearance MouseAppearanceTag MouseButtons Mouseover MousePointerNote MousePosition MovingAverage MovingMedian MoyalDistribution MultiedgeStyle MultilaunchWarning MultiLetterItalics MultiLetterStyle MultilineFunction Multinomial MultinomialDistribution MultinormalDistribution MultiplicativeOrder Multiplicity Multiselection MultivariateHypergeometricDistribution MultivariatePoissonDistribution MultivariateTDistribution N NakagamiDistribution NameQ Names NamespaceBox Nand NArgMax NArgMin NBernoulliB NCache NDSolve NDSolveValue Nearest NearestFunction NeedCurrentFrontEndPackagePacket NeedCurrentFrontEndSymbolsPacket NeedlemanWunschSimilarity Needs Negative NegativeBinomialDistribution NegativeMultinomialDistribution NeighborhoodGraph Nest NestedGreaterGreater NestedLessLess NestedScriptRules NestList NestWhile NestWhileList NevilleThetaC NevilleThetaD NevilleThetaN NevilleThetaS NewPrimitiveStyle NExpectation Next NextPrime NHoldAll NHoldFirst NHoldRest NicholsGridLines NicholsPlot NIntegrate NMaximize NMaxValue NMinimize NMinValue NominalVariables NonAssociative NoncentralBetaDistribution NoncentralChiSquareDistribution NoncentralFRatioDistribution NoncentralStudentTDistribution NonCommutativeMultiply NonConstants None NonlinearModelFit NonlocalMeansFilter NonNegative NonPositive Nor NorlundB Norm Normal NormalDistribution NormalGrouping Normalize NormalizedSquaredEuclideanDistance NormalsFunction NormFunction Not NotCongruent NotCupCap NotDoubleVerticalBar Notebook NotebookApply NotebookAutoSave NotebookClose NotebookConvertSettings NotebookCreate NotebookCreateReturnObject NotebookDefault NotebookDelete NotebookDirectory NotebookDynamicExpression NotebookEvaluate NotebookEventActions NotebookFileName NotebookFind NotebookFindReturnObject NotebookGet NotebookGetLayoutInformationPacket NotebookGetMisspellingsPacket NotebookInformation NotebookInterfaceObject NotebookLocate NotebookObject NotebookOpen NotebookOpenReturnObject NotebookPath NotebookPrint NotebookPut NotebookPutReturnObject NotebookRead NotebookResetGeneratedCells Notebooks NotebookSave NotebookSaveAs NotebookSelection NotebookSetupLayoutInformationPacket NotebooksMenu NotebookWrite NotElement NotEqualTilde NotExists NotGreater NotGreaterEqual NotGreaterFullEqual NotGreaterGreater NotGreaterLess NotGreaterSlantEqual NotGreaterTilde NotHumpDownHump NotHumpEqual NotLeftTriangle NotLeftTriangleBar NotLeftTriangleEqual NotLess NotLessEqual NotLessFullEqual NotLessGreater NotLessLess NotLessSlantEqual NotLessTilde NotNestedGreaterGreater NotNestedLessLess NotPrecedes NotPrecedesEqual NotPrecedesSlantEqual NotPrecedesTilde NotReverseElement NotRightTriangle NotRightTriangleBar NotRightTriangleEqual NotSquareSubset NotSquareSubsetEqual NotSquareSuperset NotSquareSupersetEqual NotSubset NotSubsetEqual NotSucceeds NotSucceedsEqual NotSucceedsSlantEqual NotSucceedsTilde NotSuperset NotSupersetEqual NotTilde NotTildeEqual NotTildeFullEqual NotTildeTilde NotVerticalBar NProbability NProduct NProductFactors NRoots NSolve NSum NSumTerms Null NullRecords NullSpace NullWords Number NumberFieldClassNumber NumberFieldDiscriminant NumberFieldFundamentalUnits NumberFieldIntegralBasis NumberFieldNormRepresentatives NumberFieldRegulator NumberFieldRootsOfUnity NumberFieldSignature NumberForm NumberFormat NumberMarks NumberMultiplier NumberPadding NumberPoint NumberQ NumberSeparator NumberSigns NumberString Numerator NumericFunction NumericQ NuttallWindow NValues NyquistGridLines NyquistPlot O ObservabilityGramian ObservabilityMatrix ObservableDecomposition ObservableModelQ OddQ Off Offset OLEData On ONanGroupON OneIdentity Opacity Open OpenAppend Opener OpenerBox OpenerBoxOptions OpenerView OpenFunctionInspectorPacket Opening OpenRead OpenSpecialOptions OpenTemporary OpenWrite Operate OperatingSystem OptimumFlowData Optional OptionInspectorSettings OptionQ Options OptionsPacket OptionsPattern OptionValue OptionValueBox OptionValueBoxOptions Or Orange Order OrderDistribution OrderedQ Ordering Orderless OrnsteinUhlenbeckProcess Orthogonalize Out Outer OutputAutoOverwrite OutputControllabilityMatrix OutputControllableModelQ OutputForm OutputFormData OutputGrouping OutputMathEditExpression OutputNamePacket OutputResponse OutputSizeLimit OutputStream Over OverBar OverDot Overflow OverHat Overlaps Overlay OverlayBox OverlayBoxOptions Overscript OverscriptBox OverscriptBoxOptions OverTilde OverVector OwenT OwnValues PackingMethod PaddedForm Padding PadeApproximant PadLeft PadRight PageBreakAbove PageBreakBelow PageBreakWithin PageFooterLines PageFooters PageHeaderLines PageHeaders PageHeight PageRankCentrality PageWidth PairedBarChart PairedHistogram PairedSmoothHistogram PairedTTest PairedZTest PaletteNotebook PalettePath Pane PaneBox PaneBoxOptions Panel PanelBox PanelBoxOptions Paneled PaneSelector PaneSelectorBox PaneSelectorBoxOptions PaperWidth ParabolicCylinderD ParagraphIndent ParagraphSpacing ParallelArray ParallelCombine ParallelDo ParallelEvaluate Parallelization Parallelize ParallelMap ParallelNeeds ParallelProduct ParallelSubmit ParallelSum ParallelTable ParallelTry Parameter ParameterEstimator ParameterMixtureDistribution ParameterVariables ParametricFunction ParametricNDSolve ParametricNDSolveValue ParametricPlot ParametricPlot3D ParentConnect ParentDirectory ParentForm Parenthesize ParentList ParetoDistribution Part PartialCorrelationFunction PartialD ParticleData Partition PartitionsP PartitionsQ ParzenWindow PascalDistribution PassEventsDown PassEventsUp Paste PasteBoxFormInlineCells PasteButton Path PathGraph PathGraphQ Pattern PatternSequence PatternTest PauliMatrix PaulWavelet Pause PausedTime PDF PearsonChiSquareTest PearsonCorrelationTest PearsonDistribution PerformanceGoal PeriodicInterpolation Periodogram PeriodogramArray PermutationCycles PermutationCyclesQ PermutationGroup PermutationLength PermutationList PermutationListQ PermutationMax PermutationMin PermutationOrder PermutationPower PermutationProduct PermutationReplace Permutations PermutationSupport Permute PeronaMalikFilter Perpendicular PERTDistribution PetersenGraph PhaseMargins Pi Pick PIDData PIDDerivativeFilter PIDFeedforward PIDTune Piecewise PiecewiseExpand PieChart PieChart3D PillaiTrace PillaiTraceTest Pink Pivoting PixelConstrained PixelValue PixelValuePositions Placed Placeholder PlaceholderReplace Plain PlanarGraphQ Play PlayRange Plot Plot3D Plot3Matrix PlotDivision PlotJoined PlotLabel PlotLayout PlotLegends PlotMarkers PlotPoints PlotRange PlotRangeClipping PlotRangePadding PlotRegion PlotStyle Plus PlusMinus Pochhammer PodStates PodWidth Point Point3DBox PointBox PointFigureChart PointForm PointLegend PointSize PoissonConsulDistribution PoissonDistribution PoissonProcess PoissonWindow PolarAxes PolarAxesOrigin PolarGridLines PolarPlot PolarTicks PoleZeroMarkers PolyaAeppliDistribution PolyGamma Polygon Polygon3DBox Polygon3DBoxOptions PolygonBox PolygonBoxOptions PolygonHoleScale PolygonIntersections PolygonScale PolyhedronData PolyLog PolynomialExtendedGCD PolynomialForm PolynomialGCD PolynomialLCM PolynomialMod PolynomialQ PolynomialQuotient PolynomialQuotientRemainder PolynomialReduce PolynomialRemainder Polynomials PopupMenu PopupMenuBox PopupMenuBoxOptions PopupView PopupWindow Position Positive PositiveDefiniteMatrixQ PossibleZeroQ Postfix PostScript Power PowerDistribution PowerExpand PowerMod PowerModList PowerSpectralDensity PowersRepresentations PowerSymmetricPolynomial Precedence PrecedenceForm Precedes PrecedesEqual PrecedesSlantEqual PrecedesTilde Precision PrecisionGoal PreDecrement PredictionRoot PreemptProtect PreferencesPath Prefix PreIncrement Prepend PrependTo PreserveImageOptions Previous PriceGraphDistribution PrimaryPlaceholder Prime PrimeNu PrimeOmega PrimePi PrimePowerQ PrimeQ Primes PrimeZetaP PrimitiveRoot PrincipalComponents PrincipalValue Print PrintAction PrintForm PrintingCopies PrintingOptions PrintingPageRange PrintingStartingPageNumber PrintingStyleEnvironment PrintPrecision PrintTemporary Prism PrismBox PrismBoxOptions PrivateCellOptions PrivateEvaluationOptions PrivateFontOptions PrivateFrontEndOptions PrivateNotebookOptions PrivatePaths Probability ProbabilityDistribution ProbabilityPlot ProbabilityPr ProbabilityScalePlot ProbitModelFit ProcessEstimator ProcessParameterAssumptions ProcessParameterQ ProcessStateDomain ProcessTimeDomain Product ProductDistribution ProductLog ProgressIndicator ProgressIndicatorBox ProgressIndicatorBoxOptions Projection Prolog PromptForm Properties Property PropertyList PropertyValue Proportion Proportional Protect Protected ProteinData Pruning PseudoInverse Purple Put PutAppend Pyramid PyramidBox PyramidBoxOptions QBinomial QFactorial QGamma QHypergeometricPFQ QPochhammer QPolyGamma QRDecomposition QuadraticIrrationalQ Quantile QuantilePlot Quantity QuantityForm QuantityMagnitude QuantityQ QuantityUnit Quartics QuartileDeviation Quartiles QuartileSkewness QueueingNetworkProcess QueueingProcess QueueProperties Quiet Quit Quotient QuotientRemainder RadialityCentrality RadicalBox RadicalBoxOptions RadioButton RadioButtonBar RadioButtonBox RadioButtonBoxOptions Radon RamanujanTau RamanujanTauL RamanujanTauTheta RamanujanTauZ Random RandomChoice RandomComplex RandomFunction RandomGraph RandomImage RandomInteger RandomPermutation RandomPrime RandomReal RandomSample RandomSeed RandomVariate RandomWalkProcess Range RangeFilter RangeSpecification RankedMax RankedMin Raster Raster3D Raster3DBox Raster3DBoxOptions RasterArray RasterBox RasterBoxOptions Rasterize RasterSize Rational RationalFunctions Rationalize Rationals Ratios Raw RawArray RawBoxes RawData RawMedium RayleighDistribution Re Read ReadList ReadProtected Real RealBlockDiagonalForm RealDigits RealExponent Reals Reap Record RecordLists RecordSeparators Rectangle RectangleBox RectangleBoxOptions RectangleChart RectangleChart3D RecurrenceFilter RecurrenceTable RecurringDigitsForm Red Reduce RefBox ReferenceLineStyle ReferenceMarkers ReferenceMarkerStyle Refine ReflectionMatrix ReflectionTransform Refresh RefreshRate RegionBinarize RegionFunction RegionPlot RegionPlot3D RegularExpression Regularization Reinstall Release ReleaseHold ReliabilityDistribution ReliefImage ReliefPlot Remove RemoveAlphaChannel RemoveAsynchronousTask Removed RemoveInputStreamMethod RemoveOutputStreamMethod RemoveProperty RemoveScheduledTask RenameDirectory RenameFile RenderAll RenderingOptions RenewalProcess RenkoChart Repeated RepeatedNull RepeatedString Replace ReplaceAll ReplaceHeldPart ReplaceImageValue ReplaceList ReplacePart ReplacePixelValue ReplaceRepeated Resampling Rescale RescalingTransform ResetDirectory ResetMenusPacket ResetScheduledTask Residue Resolve Rest Resultant ResumePacket Return ReturnExpressionPacket ReturnInputFormPacket ReturnPacket ReturnTextPacket Reverse ReverseBiorthogonalSplineWavelet ReverseElement ReverseEquilibrium ReverseGraph ReverseUpEquilibrium RevolutionAxis RevolutionPlot3D RGBColor RiccatiSolve RiceDistribution RidgeFilter RiemannR RiemannSiegelTheta RiemannSiegelZ Riffle Right RightArrow RightArrowBar RightArrowLeftArrow RightCosetRepresentative RightDownTeeVector RightDownVector RightDownVectorBar RightTee RightTeeArrow RightTeeVector RightTriangle RightTriangleBar RightTriangleEqual RightUpDownVector RightUpTeeVector RightUpVector RightUpVectorBar RightVector RightVectorBar RiskAchievementImportance RiskReductionImportance RogersTanimotoDissimilarity Root RootApproximant RootIntervals RootLocusPlot RootMeanSquare RootOfUnityQ RootReduce Roots RootSum Rotate RotateLabel RotateLeft RotateRight RotationAction RotationBox RotationBoxOptions RotationMatrix RotationTransform Round RoundImplies RoundingRadius Row RowAlignments RowBackgrounds RowBox RowHeights RowLines RowMinHeight RowReduce RowsEqual RowSpacings RSolve RudvalisGroupRu Rule RuleCondition RuleDelayed RuleForm RulerUnits Run RunScheduledTask RunThrough RuntimeAttributes RuntimeOptions RussellRaoDissimilarity SameQ SameTest SampleDepth SampledSoundFunction SampledSoundList SampleRate SamplingPeriod SARIMAProcess SARMAProcess SatisfiabilityCount SatisfiabilityInstances SatisfiableQ Saturday Save Saveable SaveAutoDelete SaveDefinitions SawtoothWave Scale Scaled ScaleDivisions ScaledMousePosition ScaleOrigin ScalePadding ScaleRanges ScaleRangeStyle ScalingFunctions ScalingMatrix ScalingTransform Scan ScheduledTaskActiveQ ScheduledTaskData ScheduledTaskObject ScheduledTasks SchurDecomposition ScientificForm ScreenRectangle ScreenStyleEnvironment ScriptBaselineShifts ScriptLevel ScriptMinSize ScriptRules ScriptSizeMultipliers Scrollbars ScrollingOptions ScrollPosition Sec Sech SechDistribution SectionGrouping SectorChart SectorChart3D SectorOrigin SectorSpacing SeedRandom Select Selectable SelectComponents SelectedCells SelectedNotebook Selection SelectionAnimate SelectionCell SelectionCellCreateCell SelectionCellDefaultStyle SelectionCellParentStyle SelectionCreateCell SelectionDebuggerTag SelectionDuplicateCell SelectionEvaluate SelectionEvaluateCreateCell SelectionMove SelectionPlaceholder SelectionSetStyle SelectWithContents SelfLoops SelfLoopStyle SemialgebraicComponentInstances SendMail Sequence SequenceAlignment SequenceForm SequenceHold SequenceLimit Series SeriesCoefficient SeriesData SessionTime Set SetAccuracy SetAlphaChannel SetAttributes Setbacks SetBoxFormNamesPacket SetDelayed SetDirectory SetEnvironment SetEvaluationNotebook SetFileDate SetFileLoadingContext SetNotebookStatusLine SetOptions SetOptionsPacket SetPrecision SetProperty SetSelectedNotebook SetSharedFunction SetSharedVariable SetSpeechParametersPacket SetStreamPosition SetSystemOptions Setter SetterBar SetterBox SetterBoxOptions Setting SetValue Shading Shallow ShannonWavelet ShapiroWilkTest Share Sharpen ShearingMatrix ShearingTransform ShenCastanMatrix Short ShortDownArrow Shortest ShortestMatch ShortestPathFunction ShortLeftArrow ShortRightArrow ShortUpArrow Show ShowAutoStyles ShowCellBracket ShowCellLabel ShowCellTags ShowClosedCellArea ShowContents ShowControls ShowCursorTracker ShowGroupOpenCloseIcon ShowGroupOpener ShowInvisibleCharacters ShowPageBreaks ShowPredictiveInterface ShowSelection ShowShortBoxForm ShowSpecialCharacters ShowStringCharacters ShowSyntaxStyles ShrinkingDelay ShrinkWrapBoundingBox SiegelTheta SiegelTukeyTest Sign Signature SignedRankTest SignificanceLevel SignPadding SignTest SimilarityRules SimpleGraph SimpleGraphQ Simplify Sin Sinc SinghMaddalaDistribution SingleEvaluation SingleLetterItalics SingleLetterStyle SingularValueDecomposition SingularValueList SingularValuePlot SingularValues Sinh SinhIntegral SinIntegral SixJSymbol Skeleton SkeletonTransform SkellamDistribution Skewness SkewNormalDistribution Skip SliceDistribution Slider Slider2D Slider2DBox Slider2DBoxOptions SliderBox SliderBoxOptions SlideView Slot SlotSequence Small SmallCircle Smaller SmithDelayCompensator SmithWatermanSimilarity SmoothDensityHistogram SmoothHistogram SmoothHistogram3D SmoothKernelDistribution SocialMediaData Socket SokalSneathDissimilarity Solve SolveAlways SolveDelayed Sort SortBy Sound SoundAndGraphics SoundNote SoundVolume Sow Space SpaceForm Spacer Spacings Span SpanAdjustments SpanCharacterRounding SpanFromAbove SpanFromBoth SpanFromLeft SpanLineThickness SpanMaxSize SpanMinSize SpanningCharacters SpanSymmetric SparseArray SpatialGraphDistribution Speak SpeakTextPacket SpearmanRankTest SpearmanRho Spectrogram SpectrogramArray Specularity SpellingCorrection SpellingDictionaries SpellingDictionariesPath SpellingOptions SpellingSuggestionsPacket Sphere SphereBox SphericalBesselJ SphericalBesselY SphericalHankelH1 SphericalHankelH2 SphericalHarmonicY SphericalPlot3D SphericalRegion SpheroidalEigenvalue SpheroidalJoiningFactor SpheroidalPS SpheroidalPSPrime SpheroidalQS SpheroidalQSPrime SpheroidalRadialFactor SpheroidalS1 SpheroidalS1Prime SpheroidalS2 SpheroidalS2Prime Splice SplicedDistribution SplineClosed SplineDegree SplineKnots SplineWeights Split SplitBy SpokenString Sqrt SqrtBox SqrtBoxOptions Square SquaredEuclideanDistance SquareFreeQ SquareIntersection SquaresR SquareSubset SquareSubsetEqual SquareSuperset SquareSupersetEqual SquareUnion SquareWave StabilityMargins StabilityMarginsStyle StableDistribution Stack StackBegin StackComplete StackInhibit StandardDeviation StandardDeviationFilter StandardForm Standardize StandbyDistribution Star StarGraph StartAsynchronousTask StartingStepSize StartOfLine StartOfString StartScheduledTask StartupSound StateDimensions StateFeedbackGains StateOutputEstimator StateResponse StateSpaceModel StateSpaceRealization StateSpaceTransform StationaryDistribution StationaryWaveletPacketTransform StationaryWaveletTransform StatusArea StatusCentrality StepMonitor StieltjesGamma StirlingS1 StirlingS2 StopAsynchronousTask StopScheduledTask StrataVariables StratonovichProcess StreamColorFunction StreamColorFunctionScaling StreamDensityPlot StreamPlot StreamPoints StreamPosition Streams StreamScale StreamStyle String StringBreak StringByteCount StringCases StringCount StringDrop StringExpression StringForm StringFormat StringFreeQ StringInsert StringJoin StringLength StringMatchQ StringPosition StringQ StringReplace StringReplaceList StringReplacePart StringReverse StringRotateLeft StringRotateRight StringSkeleton StringSplit StringTake StringToStream StringTrim StripBoxes StripOnInput StripWrapperBoxes StrokeForm StructuralImportance StructuredArray StructuredSelection StruveH StruveL Stub StudentTDistribution Style StyleBox StyleBoxAutoDelete StyleBoxOptions StyleData StyleDefinitions StyleForm StyleKeyMapping StyleMenuListing StyleNameDialogSettings StyleNames StylePrint StyleSheetPath Subfactorial Subgraph SubMinus SubPlus SubresultantPolynomialRemainders SubresultantPolynomials Subresultants Subscript SubscriptBox SubscriptBoxOptions Subscripted Subset SubsetEqual Subsets SubStar Subsuperscript SubsuperscriptBox SubsuperscriptBoxOptions Subtract SubtractFrom SubValues Succeeds SucceedsEqual SucceedsSlantEqual SucceedsTilde SuchThat Sum SumConvergence Sunday SuperDagger SuperMinus SuperPlus Superscript SuperscriptBox SuperscriptBoxOptions Superset SupersetEqual SuperStar Surd SurdForm SurfaceColor SurfaceGraphics SurvivalDistribution SurvivalFunction SurvivalModel SurvivalModelFit SuspendPacket SuzukiDistribution SuzukiGroupSuz SwatchLegend Switch Symbol SymbolName SymletWavelet Symmetric SymmetricGroup SymmetricMatrixQ SymmetricPolynomial SymmetricReduction Symmetrize SymmetrizedArray SymmetrizedArrayRules SymmetrizedDependentComponents SymmetrizedIndependentComponents SymmetrizedReplacePart SynchronousInitialization SynchronousUpdating Syntax SyntaxForm SyntaxInformation SyntaxLength SyntaxPacket SyntaxQ SystemDialogInput SystemException SystemHelpPath SystemInformation SystemInformationData SystemOpen SystemOptions SystemsModelDelay SystemsModelDelayApproximate SystemsModelDelete SystemsModelDimensions SystemsModelExtract SystemsModelFeedbackConnect SystemsModelLabels SystemsModelOrder SystemsModelParallelConnect SystemsModelSeriesConnect SystemsModelStateFeedbackConnect SystemStub Tab TabFilling Table TableAlignments TableDepth TableDirections TableForm TableHeadings TableSpacing TableView TableViewBox TabSpacings TabView TabViewBox TabViewBoxOptions TagBox TagBoxNote TagBoxOptions TaggingRules TagSet TagSetDelayed TagStyle TagUnset Take TakeWhile Tally Tan Tanh TargetFunctions TargetUnits TautologyQ TelegraphProcess TemplateBox TemplateBoxOptions TemplateSlotSequence TemporalData Temporary TemporaryVariable TensorContract TensorDimensions TensorExpand TensorProduct TensorQ TensorRank TensorReduce TensorSymmetry TensorTranspose TensorWedge Tetrahedron TetrahedronBox TetrahedronBoxOptions TeXForm TeXSave Text Text3DBox Text3DBoxOptions TextAlignment TextBand TextBoundingBox TextBox TextCell TextClipboardType TextData TextForm TextJustification TextLine TextPacket TextParagraph TextRecognize TextRendering TextStyle Texture TextureCoordinateFunction TextureCoordinateScaling Therefore ThermometerGauge Thick Thickness Thin Thinning ThisLink ThompsonGroupTh Thread ThreeJSymbol Threshold Through Throw Thumbnail Thursday Ticks TicksStyle Tilde TildeEqual TildeFullEqual TildeTilde TimeConstrained TimeConstraint Times TimesBy TimeSeriesForecast TimeSeriesInvertibility TimeUsed TimeValue TimeZone Timing Tiny TitleGrouping TitsGroupT ToBoxes ToCharacterCode ToColor ToContinuousTimeModel ToDate ToDiscreteTimeModel ToeplitzMatrix ToExpression ToFileName Together Toggle ToggleFalse Toggler TogglerBar TogglerBox TogglerBoxOptions ToHeldExpression ToInvertibleTimeSeries TokenWords Tolerance ToLowerCase ToNumberField TooBig Tooltip TooltipBox TooltipBoxOptions TooltipDelay TooltipStyle Top TopHatTransform TopologicalSort ToRadicals ToRules ToString Total TotalHeight TotalVariationFilter TotalWidth TouchscreenAutoZoom TouchscreenControlPlacement ToUpperCase Tr Trace TraceAbove TraceAction TraceBackward TraceDepth TraceDialog TraceForward TraceInternal TraceLevel TraceOff TraceOn TraceOriginal TracePrint TraceScan TrackedSymbols TradingChart TraditionalForm TraditionalFunctionNotation TraditionalNotation TraditionalOrder TransferFunctionCancel TransferFunctionExpand TransferFunctionFactor TransferFunctionModel TransferFunctionPoles TransferFunctionTransform TransferFunctionZeros TransformationFunction TransformationFunctions TransformationMatrix TransformedDistribution TransformedField Translate TranslationTransform TransparentColor Transpose TreeForm TreeGraph TreeGraphQ TreePlot TrendStyle TriangleWave TriangularDistribution Trig TrigExpand TrigFactor TrigFactorList Trigger TrigReduce TrigToExp TrimmedMean True TrueQ TruncatedDistribution TsallisQExponentialDistribution TsallisQGaussianDistribution TTest Tube TubeBezierCurveBox TubeBezierCurveBoxOptions TubeBox TubeBSplineCurveBox TubeBSplineCurveBoxOptions Tuesday TukeyLambdaDistribution TukeyWindow Tuples TuranGraph TuringMachine Transparent UnateQ Uncompress Undefined UnderBar Underflow Underlined Underoverscript UnderoverscriptBox UnderoverscriptBoxOptions Underscript UnderscriptBox UnderscriptBoxOptions UndirectedEdge UndirectedGraph UndirectedGraphQ UndocumentedTestFEParserPacket UndocumentedTestGetSelectionPacket Unequal Unevaluated UniformDistribution UniformGraphDistribution UniformSumDistribution Uninstall Union UnionPlus Unique UnitBox UnitConvert UnitDimensions Unitize UnitRootTest UnitSimplify UnitStep UnitTriangle UnitVector Unprotect UnsameQ UnsavedVariables Unset UnsetShared UntrackedVariables Up UpArrow UpArrowBar UpArrowDownArrow Update UpdateDynamicObjects UpdateDynamicObjectsSynchronous UpdateInterval UpDownArrow UpEquilibrium UpperCaseQ UpperLeftArrow UpperRightArrow UpperTriangularize Upsample UpSet UpSetDelayed UpTee UpTeeArrow UpValues URL URLFetch URLFetchAsynchronous URLSave URLSaveAsynchronous UseGraphicsRange Using UsingFrontEnd V2Get ValidationLength Value ValueBox ValueBoxOptions ValueForm ValueQ ValuesData Variables Variance VarianceEquivalenceTest VarianceEstimatorFunction VarianceGammaDistribution VarianceTest VectorAngle VectorColorFunction VectorColorFunctionScaling VectorDensityPlot VectorGlyphData VectorPlot VectorPlot3D VectorPoints VectorQ Vectors VectorScale VectorStyle Vee Verbatim Verbose VerboseConvertToPostScriptPacket VerifyConvergence VerifySolutions VerifyTestAssumptions Version VersionNumber VertexAdd VertexCapacity VertexColors VertexComponent VertexConnectivity VertexCoordinateRules VertexCoordinates VertexCorrelationSimilarity VertexCosineSimilarity VertexCount VertexCoverQ VertexDataCoordinates VertexDegree VertexDelete VertexDiceSimilarity VertexEccentricity VertexInComponent VertexInDegree VertexIndex VertexJaccardSimilarity VertexLabeling VertexLabels VertexLabelStyle VertexList VertexNormals VertexOutComponent VertexOutDegree VertexQ VertexRenderingFunction VertexReplace VertexShape VertexShapeFunction VertexSize VertexStyle VertexTextureCoordinates VertexWeight Vertical VerticalBar VerticalForm VerticalGauge VerticalSeparator VerticalSlider VerticalTilde ViewAngle ViewCenter ViewMatrix ViewPoint ViewPointSelectorSettings ViewPort ViewRange ViewVector ViewVertical VirtualGroupData Visible VisibleCell VoigtDistribution VonMisesDistribution WaitAll WaitAsynchronousTask WaitNext WaitUntil WakebyDistribution WalleniusHypergeometricDistribution WaringYuleDistribution WatershedComponents WatsonUSquareTest WattsStrogatzGraphDistribution WaveletBestBasis WaveletFilterCoefficients WaveletImagePlot WaveletListPlot WaveletMapIndexed WaveletMatrixPlot WaveletPhi WaveletPsi WaveletScale WaveletScalogram WaveletThreshold WeaklyConnectedComponents WeaklyConnectedGraphQ WeakStationarity WeatherData WeberE Wedge Wednesday WeibullDistribution WeierstrassHalfPeriods WeierstrassInvariants WeierstrassP WeierstrassPPrime WeierstrassSigma WeierstrassZeta WeightedAdjacencyGraph WeightedAdjacencyMatrix WeightedData WeightedGraphQ Weights WelchWindow WheelGraph WhenEvent Which While White Whitespace WhitespaceCharacter WhittakerM WhittakerW WienerFilter WienerProcess WignerD WignerSemicircleDistribution WilksW WilksWTest WindowClickSelect WindowElements WindowFloating WindowFrame WindowFrameElements WindowMargins WindowMovable WindowOpacity WindowSelected WindowSize WindowStatusArea WindowTitle WindowToolbars WindowWidth With WolframAlpha WolframAlphaDate WolframAlphaQuantity WolframAlphaResult Word WordBoundary WordCharacter WordData WordSearch WordSeparators WorkingPrecision Write WriteString Wronskian XMLElement XMLObject Xnor Xor Yellow YuleDissimilarity ZernikeR ZeroSymmetric ZeroTest ZeroWidthTimes Zeta ZetaZero ZipfDistribution ZTest ZTransform $Aborted $ActivationGroupID $ActivationKey $ActivationUserRegistered $AddOnsDirectory $AssertFunction $Assumptions $AsynchronousTask $BaseDirectory $BatchInput $BatchOutput $BoxForms $ByteOrdering $Canceled $CharacterEncoding $CharacterEncodings $CommandLine $CompilationTarget $ConditionHold $ConfiguredKernels $Context $ContextPath $ControlActiveSetting $CreationDate $CurrentLink $DateStringFormat $DefaultFont $DefaultFrontEnd $DefaultImagingDevice $DefaultPath $Display $DisplayFunction $DistributedContexts $DynamicEvaluation $Echo $Epilog $ExportFormats $Failed $FinancialDataSource $FormatType $FrontEnd $FrontEndSession $GeoLocation $HistoryLength $HomeDirectory $HTTPCookies $IgnoreEOF $ImagingDevices $ImportFormats $InitialDirectory $Input $InputFileName $InputStreamMethods $Inspector $InstallationDate $InstallationDirectory $InterfaceEnvironment $IterationLimit $KernelCount $KernelID $Language $LaunchDirectory $LibraryPath $LicenseExpirationDate $LicenseID $LicenseProcesses $LicenseServer $LicenseSubprocesses $LicenseType $Line $Linked $LinkSupported $LoadedFiles $MachineAddresses $MachineDomain $MachineDomains $MachineEpsilon $MachineID $MachineName $MachinePrecision $MachineType $MaxExtraPrecision $MaxLicenseProcesses $MaxLicenseSubprocesses $MaxMachineNumber $MaxNumber $MaxPiecewiseCases $MaxPrecision $MaxRootDegree $MessageGroups $MessageList $MessagePrePrint $Messages $MinMachineNumber $MinNumber $MinorReleaseNumber $MinPrecision $ModuleNumber $NetworkLicense $NewMessage $NewSymbol $Notebooks $NumberMarks $Off $OperatingSystem $Output $OutputForms $OutputSizeLimit $OutputStreamMethods $Packages $ParentLink $ParentProcessID $PasswordFile $PatchLevelID $Path $PathnameSeparator $PerformanceGoal $PipeSupported $Post $Pre $PreferencesDirectory $PrePrint $PreRead $PrintForms $PrintLiteral $ProcessID $ProcessorCount $ProcessorType $ProductInformation $ProgramName $RandomState $RecursionLimit $ReleaseNumber $RootDirectory $ScheduledTask $ScriptCommandLine $SessionID $SetParentLink $SharedFunctions $SharedVariables $SoundDisplay $SoundDisplayFunction $SuppressInputFormHeads $SynchronousEvaluation $SyntaxHandler $System $SystemCharacterEncoding $SystemID $SystemWordLength $TemporaryDirectory $TemporaryPrefix $TextStyle $TimedOut $TimeUnit $TimeZone $TopDirectory $TraceOff $TraceOn $TracePattern $TracePostAction $TracePreAction $Urgent $UserAddOnsDirectory $UserBaseDirectory $UserDocumentsDirectory $UserName $Version $VersionNumber", -c:[{cN:"comment",b:/\(\*/,e:/\*\)/},e.ASM,e.QSM,e.CNM,{b:/\{/,e:/\}/,i:/:/}]}});hljs.registerLanguage("tp",function(O){var R={cN:"number",b:"[1-9][0-9]*",r:0},E={cN:"symbol",b:":[^\\]]+"},T={cN:"built_in",b:"(AR|P|PAYLOAD|PR|R|SR|RSR|LBL|VR|UALM|MESSAGE|UTOOL|UFRAME|TIMER| TIMER_OVERFLOW|JOINT_MAX_SPEED|RESUME_PROG|DIAG_REC)\\[",e:"\\]",c:["self",R,E]},N={cN:"built_in",b:"(AI|AO|DI|DO|F|RI|RO|UI|UO|GI|GO|SI|SO)\\[",e:"\\]",c:["self",R,O.QSM,E]};return{k:{keyword:"ABORT ACC ADJUST AND AP_LD BREAK CALL CNT COL CONDITION CONFIG DA DB DIV DETECT ELSE END ENDFOR ERR_NUM ERROR_PROG FINE FOR GP GUARD INC IF JMP LINEAR_MAX_SPEED LOCK MOD MONITOR OFFSET Offset OR OVERRIDE PAUSE PREG PTH RT_LD RUN SELECT SKIP Skip TA TB TO TOOL_OFFSET Tool_Offset UF UT UFRAME_NUM UTOOL_NUM UNLOCK WAIT X Y Z W P R STRLEN SUBSTR FINDSTR VOFFSET PROG ATTR MN POS",literal:"ON OFF max_speed LPOS JPOS ENABLE DISABLE START STOP RESET"},c:[T,N,{cN:"keyword",b:"/(PROG|ATTR|MN|POS|END)\\b"},{cN:"keyword",b:"(CALL|RUN|POINT_LOGIC|LBL)\\b"},{cN:"keyword",b:"\\b(ACC|CNT|Skip|Offset|PSPD|RT_LD|AP_LD|Tool_Offset)"},{cN:"number",b:"\\d+(sec|msec|mm/sec|cm/min|inch/min|deg/sec|mm|in|cm)?\\b",r:0},O.C("//","[;$]"),O.C("!","[;$]"),O.C("--eg:","$"),O.QSM,{cN:"string",b:"'",e:"'"},O.CNM,{cN:"variable",b:"\\$[A-Za-z0-9_]+"}]}});hljs.registerLanguage("nimrod",function(t){return{aliases:["nim"],k:{keyword:"addr and as asm bind block break case cast const continue converter discard distinct div do elif else end enum except export finally for from generic if import in include interface is isnot iterator let macro method mixin mod nil not notin object of or out proc ptr raise ref return shl shr static template try tuple type using var when while with without xor yield",literal:"shared guarded stdin stdout stderr result true false",built_in:"int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float float32 float64 bool char string cstring pointer expr stmt void auto any range array openarray varargs seq set clong culong cchar cschar cshort cint csize clonglong cfloat cdouble clongdouble cuchar cushort cuint culonglong cstringarray semistatic"},c:[{cN:"meta",b:/{\./,e:/\.}/,r:10},{cN:"string",b:/[a-zA-Z]\w*"/,e:/"/,c:[{b:/""/}]},{cN:"string",b:/([a-zA-Z]\w*)?"""/,e:/"""/},t.QSM,{cN:"type",b:/\b[A-Z]\w+\b/,r:0},{cN:"number",r:0,v:[{b:/\b(0[xX][0-9a-fA-F][_0-9a-fA-F]*)('?[iIuU](8|16|32|64))?/},{b:/\b(0o[0-7][_0-7]*)('?[iIuUfF](8|16|32|64))?/},{b:/\b(0(b|B)[01][_01]*)('?[iIuUfF](8|16|32|64))?/},{b:/\b(\d[_\d]*)('?[iIuUfF](8|16|32|64))?/}]},t.HCM]}});hljs.registerLanguage("1c",function(c){var e="[a-zA-Zа-яА-Я][a-zA-Z0-9_а-яА-Я]*",n="возврат дата для если и или иначе иначеесли исключение конецесли конецпопытки конецпроцедуры конецфункции конеццикла константа не перейти перем перечисление по пока попытка прервать продолжить процедура строка тогда фс функция цикл число экспорт",b="ansitooem oemtoansi ввестивидсубконто ввестидату ввестизначение ввестиперечисление ввестипериод ввестиплансчетов ввестистроку ввестичисло вопрос восстановитьзначение врег выбранныйплансчетов вызватьисключение датагод датамесяц датачисло добавитьмесяц завершитьработусистемы заголовоксистемы записьжурналарегистрации запуститьприложение зафиксироватьтранзакцию значениевстроку значениевстрокувнутр значениевфайл значениеизстроки значениеизстрокивнутр значениеизфайла имякомпьютера имяпользователя каталогвременныхфайлов каталогиб каталогпользователя каталогпрограммы кодсимв командасистемы конгода конецпериодаби конецрассчитанногопериодаби конецстандартногоинтервала конквартала конмесяца коннедели лев лог лог10 макс максимальноеколичествосубконто мин монопольныйрежим названиеинтерфейса названиенабораправ назначитьвид назначитьсчет найти найтипомеченныенаудаление найтиссылки началопериодаби началостандартногоинтервала начатьтранзакцию начгода начквартала начмесяца начнедели номерднягода номерднянедели номернеделигода нрег обработкаожидания окр описаниеошибки основнойжурналрасчетов основнойплансчетов основнойязык открытьформу открытьформумодально отменитьтранзакцию очиститьокносообщений периодстр полноеимяпользователя получитьвремята получитьдатута получитьдокументта получитьзначенияотбора получитьпозициюта получитьпустоезначение получитьта прав праводоступа предупреждение префиксавтонумерации пустаястрока пустоезначение рабочаядаттьпустоезначение рабочаядата разделительстраниц разделительстрок разм разобратьпозициюдокумента рассчитатьрегистрына рассчитатьрегистрыпо сигнал симв символтабуляции создатьобъект сокрл сокрлп сокрп сообщить состояние сохранитьзначение сред статусвозврата стрдлина стрзаменить стрколичествострок стрполучитьстроку стрчисловхождений сформироватьпозициюдокумента счетпокоду текущаядата текущеевремя типзначения типзначениястр удалитьобъекты установитьтана установитьтапо фиксшаблон формат цел шаблон",i={b:'""'},r={cN:"string",b:'"',e:'"|$',c:[i]},t={cN:"string",b:"\\|",e:'"|$',c:[i]};return{cI:!0,l:e,k:{keyword:n,built_in:b},c:[c.CLCM,c.NM,r,t,{cN:"function",b:"(процедура|функция)",e:"$",l:e,k:"процедура функция",c:[{b:"экспорт",eW:!0,l:e,k:"экспорт",c:[c.CLCM]},{cN:"params",b:"\\(",e:"\\)",l:e,k:"знач",c:[r,t]},c.CLCM,c.inherit(c.TM,{b:e})]},{cN:"meta",b:"#",e:"$"},{cN:"number",b:"'\\d{2}\\.\\d{2}\\.(\\d{2}|\\d{4})'"}]}});hljs.registerLanguage("twig",function(e){var t={cN:"params",b:"\\(",e:"\\)"},a="attribute block constant cycle date dump include max min parent random range source template_from_string",r={bK:a,k:{name:a},r:0,c:[t]},c={b:/\|[A-Za-z_]+:?/,k:"abs batch capitalize convert_encoding date date_modify default escape first format join json_encode keys last length lower merge nl2br number_format raw replace reverse round slice sort split striptags title trim upper url_encode",c:[r]},s="autoescape block do embed extends filter flush for if import include macro sandbox set spaceless use verbatim";return s=s+" "+s.split(" ").map(function(e){return"end"+e}).join(" "),{aliases:["craftcms"],cI:!0,sL:"xml",c:[e.C(/\{#/,/#}/),{cN:"template-tag",b:/\{%/,e:/%}/,c:[{cN:"name",b:/\w+/,k:s,starts:{eW:!0,c:[c,r],r:0}}]},{cN:"template-variable",b:/\{\{/,e:/}}/,c:["self",c,r]}]}});hljs.registerLanguage("dts",function(e){var a={cN:"string",v:[e.inherit(e.QSM,{b:'((u8?|U)|L)?"'}),{b:'(u8?|U)?R"',e:'"',c:[e.BE]},{b:"'\\\\?.",e:"'",i:"."}]},c={cN:"number",v:[{b:"\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)"},{b:e.CNR}],r:0},b={cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef ifdef ifndef"},c:[{b:/\\\n/,r:0},{bK:"include",e:"$",k:{"meta-keyword":"include"},c:[e.inherit(a,{cN:"meta-string"}),{cN:"meta-string",b:"<",e:">",i:"\\n"}]},a,e.CLCM,e.CBCM]},i={cN:"variable",b:"\\&[a-z\\d_]*\\b"},r={cN:"meta-keyword",b:"/[a-z][a-z\\d-]*/"},d={cN:"symbol",b:"^\\s*[a-zA-Z_][a-zA-Z\\d_]*:"},n={cN:"params",b:"<",e:">",c:[c,i]},s={cN:"class",b:/[a-zA-Z_][a-zA-Z\d_@]*\s{/,e:/[{;=]/,rB:!0,eE:!0},t={cN:"class",b:"/\\s*{",e:"};",r:10,c:[i,r,d,s,n,e.CLCM,e.CBCM,c,a]};return{k:"",c:[t,i,r,d,s,n,e.CLCM,e.CBCM,c,a,b,{b:e.IR+"::",k:""}]}});hljs.registerLanguage("scss",function(e){var t="[a-zA-Z-][a-zA-Z0-9_-]*",i={cN:"variable",b:"(\\$"+t+")\\b"},r={cN:"number",b:"#[0-9A-Fa-f]+"};({cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:!0,i:"[^\\s]",starts:{eW:!0,eE:!0,c:[r,e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"meta",b:"!important"}]}});return{cI:!0,i:"[=/|']",c:[e.CLCM,e.CBCM,{cN:"selector-id",b:"\\#[A-Za-z0-9_-]+",r:0},{cN:"selector-class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"selector-attr",b:"\\[",e:"\\]",i:"$"},{cN:"selector-tag",b:"\\b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\\b",r:0},{b:":(visited|valid|root|right|required|read-write|read-only|out-range|optional|only-of-type|only-child|nth-of-type|nth-last-of-type|nth-last-child|nth-child|not|link|left|last-of-type|last-child|lang|invalid|indeterminate|in-range|hover|focus|first-of-type|first-line|first-letter|first-child|first|enabled|empty|disabled|default|checked|before|after|active)"},{b:"::(after|before|choices|first-letter|first-line|repeat-index|repeat-item|selection|value)"},i,{cN:"attribute",b:"\\b(z-index|word-wrap|word-spacing|word-break|width|widows|white-space|visibility|vertical-align|unicode-bidi|transition-timing-function|transition-property|transition-duration|transition-delay|transition|transform-style|transform-origin|transform|top|text-underline-position|text-transform|text-shadow|text-rendering|text-overflow|text-indent|text-decoration-style|text-decoration-line|text-decoration-color|text-decoration|text-align-last|text-align|tab-size|table-layout|right|resize|quotes|position|pointer-events|perspective-origin|perspective|page-break-inside|page-break-before|page-break-after|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-y|overflow-x|overflow-wrap|overflow|outline-width|outline-style|outline-offset|outline-color|outline|orphans|order|opacity|object-position|object-fit|normal|none|nav-up|nav-right|nav-left|nav-index|nav-down|min-width|min-height|max-width|max-height|mask|marks|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|letter-spacing|left|justify-content|initial|inherit|ime-mode|image-orientation|image-resolution|image-rendering|icon|hyphens|height|font-weight|font-variant-ligatures|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-language-override|font-kerning|font-feature-settings|font-family|font|float|flex-wrap|flex-shrink|flex-grow|flex-flow|flex-direction|flex-basis|flex|filter|empty-cells|display|direction|cursor|counter-reset|counter-increment|content|column-width|column-span|column-rule-width|column-rule-style|column-rule-color|column-rule|column-gap|column-fill|column-count|columns|color|clip-path|clip|clear|caption-side|break-inside|break-before|break-after|box-sizing|box-shadow|box-decoration-break|bottom|border-width|border-top-width|border-top-style|border-top-right-radius|border-top-left-radius|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-radius|border-left-width|border-left-style|border-left-color|border-left|border-image-width|border-image-source|border-image-slice|border-image-repeat|border-image-outset|border-image|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-right-radius|border-bottom-left-radius|border-bottom-color|border-bottom|border|background-size|background-repeat|background-position|background-origin|background-image|background-color|background-clip|background-attachment|background-blend-mode|background|backface-visibility|auto|animation-timing-function|animation-play-state|animation-name|animation-iteration-count|animation-fill-mode|animation-duration|animation-direction|animation-delay|animation|align-self|align-items|align-content)\\b",i:"[^\\s]"},{b:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{b:":",e:";",c:[i,r,e.CSSNM,e.QSM,e.ASM,{cN:"meta",b:"!important"}]},{b:"@",e:"[{;]",k:"mixin include extend for if else each while charset import debug media page content font-face namespace warn",c:[i,e.QSM,e.ASM,r,e.CSSNM,{b:"\\s[A-Za-z0-9_.-]+",r:0}]}]}});hljs.registerLanguage("haml",function(s){return{cI:!0,c:[{cN:"meta",b:"^!!!( (5|1\\.1|Strict|Frameset|Basic|Mobile|RDFa|XML\\b.*))?$",r:10},s.C("^\\s*(!=#|=#|-#|/).*$",!1,{r:0}),{b:"^\\s*(-|=|!=)(?!#)",starts:{e:"\\n",sL:"ruby"}},{cN:"tag",b:"^\\s*%",c:[{cN:"selector-tag",b:"\\w+"},{cN:"selector-id",b:"#[\\w-]+"},{cN:"selector-class",b:"\\.[\\w-]+"},{b:"{\\s*",e:"\\s*}",c:[{b:":\\w+\\s*=>",e:",\\s+",rB:!0,eW:!0,c:[{cN:"attr",b:":\\w+"},s.ASM,s.QSM,{b:"\\w+",r:0}]}]},{b:"\\(\\s*",e:"\\s*\\)",eE:!0,c:[{b:"\\w+\\s*=",e:"\\s+",rB:!0,eW:!0,c:[{cN:"attr",b:"\\w+",r:0},s.ASM,s.QSM,{b:"\\w+",r:0}]}]}]},{b:"^\\s*[=~]\\s*"},{b:"#{",starts:{e:"}",sL:"ruby"}}]}});hljs.registerLanguage("openscad",function(e){var r={cN:"keyword",b:"\\$(f[asn]|t|vp[rtd]|children)"},n={cN:"literal",b:"false|true|PI|undef"},o={cN:"number",b:"\\b\\d+(\\.\\d+)?(e-?\\d+)?",r:0},i=e.inherit(e.QSM,{i:null}),t={cN:"meta",k:{"meta-keyword":"include use"},b:"include|use <",e:">"},s={cN:"params",b:"\\(",e:"\\)",c:["self",o,i,r,n]},c={b:"[*!#%]",r:0},a={cN:"function",bK:"module function",e:"\\=|\\{",c:[s,e.UTM]};return{aliases:["scad"],k:{keyword:"function module include use for intersection_for if else \\%",literal:"false true PI undef",built_in:"circle square polygon text sphere cube cylinder polyhedron translate rotate scale resize mirror multmatrix color offset hull minkowski union difference intersection abs sign sin cos tan acos asin atan atan2 floor round ceil ln log pow sqrt exp rands min max concat lookup str chr search version version_num norm cross parent_module echo import import_dxf dxf_linear_extrude linear_extrude rotate_extrude surface projection render children dxf_cross dxf_dim let assign"},c:[e.CLCM,e.CBCM,o,t,i,r,c,a]}});hljs.registerLanguage("gherkin",function(e){return{aliases:["feature"],k:"Feature Background Ability Business Need Scenario Scenarios Scenario Outline Scenario Template Examples Given And Then But When",c:[{cN:"symbol",b:"\\*",r:0},{cN:"meta",b:"@[^@\\s]+"},{b:"\\|",e:"\\|\\w*$",c:[{cN:"string",b:"[^|]+"}]},{cN:"variable",b:"<",e:">"},e.HCM,{cN:"string",b:'"""',e:'"""'},e.QSM]}});hljs.registerLanguage("cal",function(e){var r="div mod in and or not xor asserterror begin case do downto else end exit for if of repeat then to until while with var",t="false true",c=[e.CLCM,e.C(/\{/,/\}/,{r:0}),e.C(/\(\*/,/\*\)/,{r:10})],n={cN:"string",b:/'/,e:/'/,c:[{b:/''/}]},o={cN:"string",b:/(#\d+)+/},a={cN:"number",b:"\\b\\d+(\\.\\d+)?(DT|D|T)",r:0},i={cN:"string",b:'"',e:'"'},d={cN:"function",bK:"procedure",e:/[:;]/,k:"procedure|10",c:[e.TM,{cN:"params",b:/\(/,e:/\)/,k:r,c:[n,o]}].concat(c)},s={cN:"class",b:"OBJECT (Table|Form|Report|Dataport|Codeunit|XMLport|MenuSuite|Page|Query) (\\d+) ([^\\r\\n]+)",rB:!0,c:[e.TM,d]};return{cI:!0,k:{keyword:r,literal:t},i:/\/\*/,c:[n,o,a,i,e.NM,s,d]}});hljs.registerLanguage("autohotkey",function(e){var r={b:/`[\s\S]/};return{cI:!0,k:{keyword:"Break Continue Else Gosub If Loop Return While",literal:"A|0 true false NOT AND OR",built_in:"ComSpec Clipboard ClipboardAll ErrorLevel"},c:[{cN:"built_in",b:"A_[a-zA-Z0-9]+"},r,e.inherit(e.QSM,{c:[r]}),e.C(";","$",{r:0}),{cN:"number",b:e.NR,r:0},{cN:"variable",b:"%",e:"%",i:"\\n",c:[r]},{cN:"symbol",c:[r],v:[{b:'^[^\\n";]+::(?!=)'},{b:'^[^\\n";]+:(?!=)',r:0}]},{b:",\\s*,"}]}});hljs.registerLanguage("flix",function(e){var t={cN:"string",b:/'(.|\\[xXuU][a-zA-Z0-9]+)'/},i={cN:"string",v:[{b:'"',e:'"'}]},n={cN:"title",b:/[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/},c={cN:"function",bK:"def",e:/[:={\[(\n;]/,eE:!0,c:[n]};return{k:{literal:"true false",keyword:"case class def else enum if impl import in lat rel index let match namespace switch type yield with"},c:[e.CLCM,e.CBCM,t,i,c,e.CNM]}});hljs.registerLanguage("crmsh",function(t){var e="primitive rsc_template",r="group clone ms master location colocation order fencing_topology rsc_ticket acl_target acl_group user role tag xml",s="property rsc_defaults op_defaults",a="params meta operations op rule attributes utilization",i="read write deny defined not_defined in_range date spec in ref reference attribute type xpath version and or lt gt tag lte gte eq ne \\",o="number string",n="Master Started Slave Stopped start promote demote stop monitor true false";return{aliases:["crm","pcmk"],cI:!0,k:{keyword:a+" "+i+" "+o,literal:n},c:[t.HCM,{bK:"node",starts:{e:"\\s*([\\w_-]+:)?",starts:{cN:"title",e:"\\s*[\\$\\w_][\\w_-]*"}}},{bK:e,starts:{cN:"title",e:"\\s*[\\$\\w_][\\w_-]*",starts:{e:"\\s*@?[\\w_][\\w_\\.:-]*"}}},{b:"\\b("+r.split(" ").join("|")+")\\s+",k:r,starts:{cN:"title",e:"[\\$\\w_][\\w_-]*"}},{bK:s,starts:{cN:"title",e:"\\s*([\\w_-]+:)?"}},t.QSM,{cN:"meta",b:"(ocf|systemd|service|lsb):[\\w_:-]+",r:0},{cN:"number",b:"\\b\\d+(\\.\\d+)?(ms|s|h|m)?",r:0},{cN:"literal",b:"[-]?(infinity|inf)",r:0},{cN:"attr",b:/([A-Za-z\$_\#][\w_-]+)=/,r:0},{cN:"tag",b:"",r:0}]}});hljs.registerLanguage("json",function(e){var i={literal:"true false null"},n=[e.QSM,e.CNM],r={e:",",eW:!0,eE:!0,c:n,k:i},t={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(r,{b:/:/})],i:"\\S"},c={b:"\\[",e:"\\]",c:[e.inherit(r)],i:"\\S"};return n.splice(n.length,0,t,c),{c:n,k:i,i:"\\S"}});hljs.registerLanguage("dust",function(e){var t="if eq ne lt lte gt gte select default math sep";return{aliases:["dst"],cI:!0,sL:"xml",c:[{cN:"template-tag",b:/\{[#\/]/,e:/\}/,i:/;/,c:[{cN:"name",b:/[a-zA-Z\.-]+/,starts:{eW:!0,r:0,c:[e.QSM]}}]},{cN:"template-variable",b:/\{/,e:/\}/,i:/;/,k:t}]}});hljs.registerLanguage("tex",function(c){var e={cN:"tag",b:/\\/,r:0,c:[{cN:"name",v:[{b:/[a-zA-Zа-яА-я]+[*]?/},{b:/[^a-zA-Zа-яА-я0-9]/}],starts:{eW:!0,r:0,c:[{cN:"string",v:[{b:/\[/,e:/\]/},{b:/\{/,e:/\}/}]},{b:/\s*=\s*/,eW:!0,r:0,c:[{cN:"number",b:/-?\d*\.?\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?/}]}]}}]};return{c:[e,{cN:"formula",c:[e],r:0,v:[{b:/\$\$/,e:/\$\$/},{b:/\$/,e:/\$/}]},c.C("%","$",{r:0})]}});hljs.registerLanguage("pf",function(t){var o={cN:"variable",b:/\$[\w\d#@][\w\d_]*/},e={cN:"variable",b:/<(?!\/)/,e:/>/};return{aliases:["pf.conf"],l:/[a-z0-9_<>-]+/,k:{built_in:"block match pass load anchor|5 antispoof|10 set table",keyword:"in out log quick on rdomain inet inet6 proto from port os to routeallow-opts divert-packet divert-reply divert-to flags group icmp-typeicmp6-type label once probability recieved-on rtable prio queuetos tag tagged user keep fragment for os dropaf-to|10 binat-to|10 nat-to|10 rdr-to|10 bitmask least-stats random round-robinsource-hash static-portdup-to reply-to route-toparent bandwidth default min max qlimitblock-policy debug fingerprints hostid limit loginterface optimizationreassemble ruleset-optimization basic none profile skip state-defaultsstate-policy timeoutconst counters persistno modulate synproxy state|5 floating if-bound no-sync pflow|10 sloppysource-track global rule max-src-nodes max-src-states max-src-connmax-src-conn-rate overload flushscrub|5 max-mss min-ttl no-df|10 random-id",literal:"all any no-route self urpf-failed egress|5 unknown"},c:[t.HCM,t.NM,t.QSM,o,e]}});hljs.registerLanguage("fix",function(u){return{c:[{b:/[^\u2401\u0001]+/,e:/[\u2401\u0001]/,eE:!0,rB:!0,rE:!1,c:[{b:/([^\u2401\u0001=]+)/,e:/=([^\u2401\u0001=]+)/,rE:!0,rB:!1,cN:"attr"},{b:/=/,e:/([\u2401\u0001])/,eE:!0,eB:!0,cN:"string"}]}],cI:!0}});hljs.registerLanguage("swift",function(e){var t={keyword:"__COLUMN__ __FILE__ __FUNCTION__ __LINE__ as as! as? associativity break case catch class continue convenience default defer deinit didSet do dynamic dynamicType else enum extension fallthrough false final for func get guard if import in indirect infix init inout internal is lazy left let mutating nil none nonmutating operator optional override postfix precedence prefix private protocol Protocol public repeat required rethrows return right self Self set static struct subscript super switch throw throws true try try! try? Type typealias unowned var weak where while willSet",literal:"true false nil",built_in:"abs advance alignof alignofValue anyGenerator assert assertionFailure bridgeFromObjectiveC bridgeFromObjectiveCUnconditional bridgeToObjectiveC bridgeToObjectiveCUnconditional c contains count countElements countLeadingZeros debugPrint debugPrintln distance dropFirst dropLast dump encodeBitsAsWords enumerate equal fatalError filter find getBridgedObjectiveCType getVaList indices insertionSort isBridgedToObjectiveC isBridgedVerbatimToObjectiveC isUniquelyReferenced isUniquelyReferencedNonObjC join lazy lexicographicalCompare map max maxElement min minElement numericCast overlaps partition posix precondition preconditionFailure print println quickSort readLine reduce reflect reinterpretCast reverse roundUpToAlignment sizeof sizeofValue sort split startsWith stride strideof strideofValue swap toString transcode underestimateCount unsafeAddressOf unsafeBitCast unsafeDowncast unsafeUnwrap unsafeReflect withExtendedLifetime withObjectAtPlusZero withUnsafePointer withUnsafePointerToObject withUnsafeMutablePointer withUnsafeMutablePointers withUnsafePointer withUnsafePointers withVaList zip"},i={cN:"type",b:"\\b[A-Z][\\wÀ-ʸ']*",r:0},n=e.C("/\\*","\\*/",{c:["self"]}),r={cN:"subst",b:/\\\(/,e:"\\)",k:t,c:[]},a={cN:"number",b:"\\b([\\d_]+(\\.[\\deE_]+)?|0x[a-fA-F0-9_]+(\\.[a-fA-F0-9p_]+)?|0b[01_]+|0o[0-7_]+)\\b",r:0},o=e.inherit(e.QSM,{c:[r,e.BE]});return r.c=[a],{k:t,c:[o,e.CLCM,n,i,a,{cN:"function",bK:"func",e:"{",eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{b://},{cN:"params",b:/\(/,e:/\)/,endsParent:!0,k:t,c:["self",a,o,e.CBCM,{b:":"}],i:/["']/}],i:/\[|%/},{cN:"class",bK:"struct protocol class extension enum",k:t,e:"\\{",eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/})]},{cN:"meta",b:"(@warn_unused_result|@exported|@lazy|@noescape|@NSCopying|@NSManaged|@objc|@convention|@required|@noreturn|@IBAction|@IBDesignable|@IBInspectable|@IBOutlet|@infix|@prefix|@postfix|@autoclosure|@testable|@available|@nonobjc|@NSApplicationMain|@UIApplicationMain)"},{bK:"import",e:/$/,c:[e.CLCM,n]}]}});hljs.registerLanguage("livecodeserver",function(e){var r={b:"\\b[gtps][A-Z]+[A-Za-z0-9_\\-]*\\b|\\$_[A-Z]+",r:0},t=[e.CBCM,e.HCM,e.C("--","$"),e.C("[^:]//","$")],a=e.inherit(e.TM,{v:[{b:"\\b_*rig[A-Z]+[A-Za-z0-9_\\-]*"},{b:"\\b_[a-z0-9\\-]+"}]}),o=e.inherit(e.TM,{b:"\\b([A-Za-z0-9_\\-]+)\\b"});return{cI:!1,k:{keyword:"$_COOKIE $_FILES $_GET $_GET_BINARY $_GET_RAW $_POST $_POST_BINARY $_POST_RAW $_SESSION $_SERVER codepoint codepoints segment segments codeunit codeunits sentence sentences trueWord trueWords paragraph after byte bytes english the until http forever descending using line real8 with seventh for stdout finally element word words fourth before black ninth sixth characters chars stderr uInt1 uInt1s uInt2 uInt2s stdin string lines relative rel any fifth items from middle mid at else of catch then third it file milliseconds seconds second secs sec int1 int1s int4 int4s internet int2 int2s normal text item last long detailed effective uInt4 uInt4s repeat end repeat URL in try into switch to words https token binfile each tenth as ticks tick system real4 by dateItems without char character ascending eighth whole dateTime numeric short first ftp integer abbreviated abbr abbrev private case while if div mod wrap and or bitAnd bitNot bitOr bitXor among not in a an within contains ends with begins the keys of keys",literal:"SIX TEN FORMFEED NINE ZERO NONE SPACE FOUR FALSE COLON CRLF PI COMMA ENDOFFILE EOF EIGHT FIVE QUOTE EMPTY ONE TRUE RETURN CR LINEFEED RIGHT BACKSLASH NULL SEVEN TAB THREE TWO six ten formfeed nine zero none space four false colon crlf pi comma endoffile eof eight five quote empty one true return cr linefeed right backslash null seven tab three two RIVERSION RISTATE FILE_READ_MODE FILE_WRITE_MODE FILE_WRITE_MODE DIR_WRITE_MODE FILE_READ_UMASK FILE_WRITE_UMASK DIR_READ_UMASK DIR_WRITE_UMASK",built_in:"put abs acos aliasReference annuity arrayDecode arrayEncode asin atan atan2 average avg avgDev base64Decode base64Encode baseConvert binaryDecode binaryEncode byteOffset byteToNum cachedURL cachedURLs charToNum cipherNames codepointOffset codepointProperty codepointToNum codeunitOffset commandNames compound compress constantNames cos date dateFormat decompress directories diskSpace DNSServers exp exp1 exp2 exp10 extents files flushEvents folders format functionNames geometricMean global globals hasMemory harmonicMean hostAddress hostAddressToName hostName hostNameToAddress isNumber ISOToMac itemOffset keys len length libURLErrorData libUrlFormData libURLftpCommand libURLLastHTTPHeaders libURLLastRHHeaders libUrlMultipartFormAddPart libUrlMultipartFormData libURLVersion lineOffset ln ln1 localNames log log2 log10 longFilePath lower macToISO matchChunk matchText matrixMultiply max md5Digest median merge millisec millisecs millisecond milliseconds min monthNames nativeCharToNum normalizeText num number numToByte numToChar numToCodepoint numToNativeChar offset open openfiles openProcesses openProcessIDs openSockets paragraphOffset paramCount param params peerAddress pendingMessages platform popStdDev populationStandardDeviation populationVariance popVariance processID random randomBytes replaceText result revCreateXMLTree revCreateXMLTreeFromFile revCurrentRecord revCurrentRecordIsFirst revCurrentRecordIsLast revDatabaseColumnCount revDatabaseColumnIsNull revDatabaseColumnLengths revDatabaseColumnNames revDatabaseColumnNamed revDatabaseColumnNumbered revDatabaseColumnTypes revDatabaseConnectResult revDatabaseCursors revDatabaseID revDatabaseTableNames revDatabaseType revDataFromQuery revdb_closeCursor revdb_columnbynumber revdb_columncount revdb_columnisnull revdb_columnlengths revdb_columnnames revdb_columntypes revdb_commit revdb_connect revdb_connections revdb_connectionerr revdb_currentrecord revdb_cursorconnection revdb_cursorerr revdb_cursors revdb_dbtype revdb_disconnect revdb_execute revdb_iseof revdb_isbof revdb_movefirst revdb_movelast revdb_movenext revdb_moveprev revdb_query revdb_querylist revdb_recordcount revdb_rollback revdb_tablenames revGetDatabaseDriverPath revNumberOfRecords revOpenDatabase revOpenDatabases revQueryDatabase revQueryDatabaseBlob revQueryResult revQueryIsAtStart revQueryIsAtEnd revUnixFromMacPath revXMLAttribute revXMLAttributes revXMLAttributeValues revXMLChildContents revXMLChildNames revXMLCreateTreeFromFileWithNamespaces revXMLCreateTreeWithNamespaces revXMLDataFromXPathQuery revXMLEvaluateXPath revXMLFirstChild revXMLMatchingNode revXMLNextSibling revXMLNodeContents revXMLNumberOfChildren revXMLParent revXMLPreviousSibling revXMLRootNode revXMLRPC_CreateRequest revXMLRPC_Documents revXMLRPC_Error revXMLRPC_GetHost revXMLRPC_GetMethod revXMLRPC_GetParam revXMLText revXMLRPC_Execute revXMLRPC_GetParamCount revXMLRPC_GetParamNode revXMLRPC_GetParamType revXMLRPC_GetPath revXMLRPC_GetPort revXMLRPC_GetProtocol revXMLRPC_GetRequest revXMLRPC_GetResponse revXMLRPC_GetSocket revXMLTree revXMLTrees revXMLValidateDTD revZipDescribeItem revZipEnumerateItems revZipOpenArchives round sampVariance sec secs seconds sentenceOffset sha1Digest shell shortFilePath sin specialFolderPath sqrt standardDeviation statRound stdDev sum sysError systemVersion tan tempName textDecode textEncode tick ticks time to tokenOffset toLower toUpper transpose truewordOffset trunc uniDecode uniEncode upper URLDecode URLEncode URLStatus uuid value variableNames variance version waitDepth weekdayNames wordOffset xsltApplyStylesheet xsltApplyStylesheetFromFile xsltLoadStylesheet xsltLoadStylesheetFromFile add breakpoint cancel clear local variable file word line folder directory URL close socket process combine constant convert create new alias folder directory decrypt delete variable word line folder directory URL dispatch divide do encrypt filter get include intersect kill libURLDownloadToFile libURLFollowHttpRedirects libURLftpUpload libURLftpUploadFile libURLresetAll libUrlSetAuthCallback libURLSetCustomHTTPHeaders libUrlSetExpect100 libURLSetFTPListCommand libURLSetFTPMode libURLSetFTPStopTime libURLSetStatusCallback load multiply socket prepare process post seek rel relative read from process rename replace require resetAll resolve revAddXMLNode revAppendXML revCloseCursor revCloseDatabase revCommitDatabase revCopyFile revCopyFolder revCopyXMLNode revDeleteFolder revDeleteXMLNode revDeleteAllXMLTrees revDeleteXMLTree revExecuteSQL revGoURL revInsertXMLNode revMoveFolder revMoveToFirstRecord revMoveToLastRecord revMoveToNextRecord revMoveToPreviousRecord revMoveToRecord revMoveXMLNode revPutIntoXMLNode revRollBackDatabase revSetDatabaseDriverPath revSetXMLAttribute revXMLRPC_AddParam revXMLRPC_DeleteAllDocuments revXMLAddDTD revXMLRPC_Free revXMLRPC_FreeAll revXMLRPC_DeleteDocument revXMLRPC_DeleteParam revXMLRPC_SetHost revXMLRPC_SetMethod revXMLRPC_SetPort revXMLRPC_SetProtocol revXMLRPC_SetSocket revZipAddItemWithData revZipAddItemWithFile revZipAddUncompressedItemWithData revZipAddUncompressedItemWithFile revZipCancel revZipCloseArchive revZipDeleteItem revZipExtractItemToFile revZipExtractItemToVariable revZipSetProgressCallback revZipRenameItem revZipReplaceItemWithData revZipReplaceItemWithFile revZipOpenArchive send set sort split start stop subtract union unload wait write"},c:[r,{cN:"keyword",b:"\\bend\\sif\\b"},{cN:"function",bK:"function",e:"$",c:[r,o,e.ASM,e.QSM,e.BNM,e.CNM,a]},{cN:"function",b:"\\bend\\s+",e:"$",k:"end",c:[o,a],r:0},{bK:"command on",e:"$",c:[r,o,e.ASM,e.QSM,e.BNM,e.CNM,a]},{cN:"meta",v:[{b:"<\\?(rev|lc|livecode)",r:10},{b:"<\\?"},{b:"\\?>"}]},e.ASM,e.QSM,e.BNM,e.CNM,a].concat(t),i:";$|^\\[|^=|&|{"}});hljs.registerLanguage("armasm",function(s){return{cI:!0,aliases:["arm"],l:"\\.?"+s.IR,k:{meta:".2byte .4byte .align .ascii .asciz .balign .byte .code .data .else .end .endif .endm .endr .equ .err .exitm .extern .global .hword .if .ifdef .ifndef .include .irp .long .macro .rept .req .section .set .skip .space .text .word .arm .thumb .code16 .code32 .force_thumb .thumb_func .ltorg ALIAS ALIGN ARM AREA ASSERT ATTR CN CODE CODE16 CODE32 COMMON CP DATA DCB DCD DCDU DCDO DCFD DCFDU DCI DCQ DCQU DCW DCWU DN ELIF ELSE END ENDFUNC ENDIF ENDP ENTRY EQU EXPORT EXPORTAS EXTERN FIELD FILL FUNCTION GBLA GBLL GBLS GET GLOBAL IF IMPORT INCBIN INCLUDE INFO KEEP LCLA LCLL LCLS LTORG MACRO MAP MEND MEXIT NOFP OPT PRESERVE8 PROC QN READONLY RELOC REQUIRE REQUIRE8 RLIST FN ROUT SETA SETL SETS SN SPACE SUBT THUMB THUMBX TTL WHILE WEND ",built_in:"r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 pc lr sp ip sl sb fp a1 a2 a3 a4 v1 v2 v3 v4 v5 v6 v7 v8 f0 f1 f2 f3 f4 f5 f6 f7 p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 q0 q1 q2 q3 q4 q5 q6 q7 q8 q9 q10 q11 q12 q13 q14 q15 cpsr_c cpsr_x cpsr_s cpsr_f cpsr_cx cpsr_cxs cpsr_xs cpsr_xsf cpsr_sf cpsr_cxsf spsr_c spsr_x spsr_s spsr_f spsr_cx spsr_cxs spsr_xs spsr_xsf spsr_sf spsr_cxsf s0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s12 s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 s30 s31 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 d16 d17 d18 d19 d20 d21 d22 d23 d24 d25 d26 d27 d28 d29 d30 d31 {PC} {VAR} {TRUE} {FALSE} {OPT} {CONFIG} {ENDIAN} {CODESIZE} {CPU} {FPU} {ARCHITECTURE} {PCSTOREOFFSET} {ARMASM_VERSION} {INTER} {ROPI} {RWPI} {SWST} {NOSWST} . @"},c:[{cN:"keyword",b:"\\b(adc|(qd?|sh?|u[qh]?)?add(8|16)?|usada?8|(q|sh?|u[qh]?)?(as|sa)x|and|adrl?|sbc|rs[bc]|asr|b[lx]?|blx|bxj|cbn?z|tb[bh]|bic|bfc|bfi|[su]bfx|bkpt|cdp2?|clz|clrex|cmp|cmn|cpsi[ed]|cps|setend|dbg|dmb|dsb|eor|isb|it[te]{0,3}|lsl|lsr|ror|rrx|ldm(([id][ab])|f[ds])?|ldr((s|ex)?[bhd])?|movt?|mvn|mra|mar|mul|[us]mull|smul[bwt][bt]|smu[as]d|smmul|smmla|mla|umlaal|smlal?([wbt][bt]|d)|mls|smlsl?[ds]|smc|svc|sev|mia([bt]{2}|ph)?|mrr?c2?|mcrr2?|mrs|msr|orr|orn|pkh(tb|bt)|rbit|rev(16|sh)?|sel|[su]sat(16)?|nop|pop|push|rfe([id][ab])?|stm([id][ab])?|str(ex)?[bhd]?|(qd?)?sub|(sh?|q|u[qh]?)?sub(8|16)|[su]xt(a?h|a?b(16)?)|srs([id][ab])?|swpb?|swi|smi|tst|teq|wfe|wfi|yield)(eq|ne|cs|cc|mi|pl|vs|vc|hi|ls|ge|lt|gt|le|al|hs|lo)?[sptrx]?",e:"\\s"},s.C("[;@]","$",{r:0}),s.CBCM,s.QSM,{cN:"string",b:"'",e:"[^\\\\]'",r:0},{cN:"title",b:"\\|",e:"\\|",i:"\\n",r:0},{cN:"number",v:[{b:"[#$=]?0x[0-9a-f]+"},{b:"[#$=]?0b[01]+"},{b:"[#$=]\\d+"},{b:"\\b\\d+"}],r:0},{cN:"symbol",v:[{b:"^[a-z_\\.\\$][a-z0-9_\\.\\$]+"},{b:"^\\s*[a-z_\\.\\$][a-z0-9_\\.\\$]+:"},{b:"[=#]\\w+"}],r:0}]}});hljs.registerLanguage("go",function(e){var t={keyword:"break default func interface select case map struct chan else goto package switch const fallthrough if range type continue for import return var go defer bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 uint16 uint32 uint64 int uint uintptr rune",literal:"true false iota nil",built_in:"append cap close complex copy imag len make new panic print println real recover delete"};return{aliases:["golang"],k:t,i:"{}*#]/,c:[{bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke comment",e:/;/,eW:!0,l:/[\w\.]+/,k:{keyword:"abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text varchar varying void"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t]},e.CBCM,t]}});hljs.registerLanguage("cmake",function(e){return{aliases:["cmake.in"],cI:!0,k:{keyword:"add_custom_command add_custom_target add_definitions add_dependencies add_executable add_library add_subdirectory add_test aux_source_directory break build_command cmake_minimum_required cmake_policy configure_file create_test_sourcelist define_property else elseif enable_language enable_testing endforeach endfunction endif endmacro endwhile execute_process export find_file find_library find_package find_path find_program fltk_wrap_ui foreach function get_cmake_property get_directory_property get_filename_component get_property get_source_file_property get_target_property get_test_property if include include_directories include_external_msproject include_regular_expression install link_directories load_cache load_command macro mark_as_advanced message option output_required_files project qt_wrap_cpp qt_wrap_ui remove_definitions return separate_arguments set set_directory_properties set_property set_source_files_properties set_target_properties set_tests_properties site_name source_group string target_link_libraries try_compile try_run unset variable_watch while build_name exec_program export_library_dependencies install_files install_programs install_targets link_libraries make_directory remove subdir_depends subdirs use_mangled_mesa utility_source variable_requires write_file qt5_use_modules qt5_use_package qt5_wrap_cpp on off true false and or equal less greater strless strgreater strequal matches"},c:[{cN:"variable",b:"\\${",e:"}"},e.HCM,e.QSM,e.NM]}});hljs.registerLanguage("erb",function(e){return{sL:"xml",c:[e.C("<%#","%>"),{b:"<%[%=-]?",e:"[%-]?%>",sL:"ruby",eB:!0,eE:!0}]}});hljs.registerLanguage("gradle",function(e){return{cI:!0,k:{keyword:"task project allprojects subprojects artifacts buildscript configurations dependencies repositories sourceSets description delete from into include exclude source classpath destinationDir includes options sourceCompatibility targetCompatibility group flatDir doLast doFirst flatten todir fromdir ant def abstract break case catch continue default do else extends final finally for if implements instanceof native new private protected public return static switch synchronized throw throws transient try volatile while strictfp package import false null super this true antlrtask checkstyle codenarc copy boolean byte char class double float int interface long short void compile runTime file fileTree abs any append asList asWritable call collect compareTo count div dump each eachByte eachFile eachLine every find findAll flatten getAt getErr getIn getOut getText grep immutable inject inspect intersect invokeMethods isCase join leftShift minus multiply newInputStream newOutputStream newPrintWriter newReader newWriter next plus pop power previous print println push putAt read readBytes readLines reverse reverseEach round size sort splitEachLine step subMap times toInteger toList tokenize upto waitForOrKill withPrintWriter withReader withStream withWriter withWriterAppend write writeLine"},c:[e.CLCM,e.CBCM,e.ASM,e.QSM,e.NM,e.RM]}});hljs.registerLanguage("lua",function(e){var t="\\[=*\\[",a="\\]=*\\]",r={b:t,e:a,c:["self"]},n=[e.C("--(?!"+t+")","$"),e.C("--"+t,a,{c:[r],r:10})];return{l:e.UIR,k:{literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstringmodule next pairs pcall print rawequal rawget rawset require select setfenvsetmetatable tonumber tostring type unpack xpcall arg selfcoroutine resume yield status wrap create running debug getupvaluedebug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenvio lines write close flush open output type read stderr stdin input stdout popen tmpfilemath, log, max, acos, huge, ldexp, pi, cos, tanh, pow, deg, tan, cosh, sinh, random, randomseed, frexp, ceil, floor, rad, abs, sqrt, modf, asin, min, mod, fmod, log10, atan2, exp, sin, atanos, exit, setlocale, date, getenv, difftime, remove, time, clock, tmpname, rename, execute, package, preload, loadlib, loaded, loaders, cpath, config path, seeallstring, sub, upper, len, gfind, rep, find, match, char, dump, gmatch, reverse, byte, format, gsub, lowertable, setn, insert, getn, foreachi, maxn, foreach, concat, sort, remove"},c:n.concat([{cN:"function",bK:"function",e:"\\)",c:[e.inherit(e.TM,{b:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{cN:"params",b:"\\(",eW:!0,c:n}].concat(n)},e.CNM,e.ASM,e.QSM,{cN:"string",b:t,e:a,c:[r],r:5}])}});hljs.registerLanguage("mipsasm",function(s){return{cI:!0,aliases:["mips"],l:"\\.?"+s.IR,k:{meta:".2byte .4byte .align .ascii .asciz .balign .byte .code .data .else .end .endif .endm .endr .equ .err .exitm .extern .global .hword .if .ifdef .ifndef .include .irp .long .macro .rept .req .section .set .skip .space .text .word .ltorg ",built_in:"$0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 $20 $21 $22 $23 $24 $25 $26 $27 $28 $29 $30 $31 zero at v0 v1 a0 a1 a2 a3 a4 a5 a6 a7 t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 s0 s1 s2 s3 s4 s5 s6 s7 s8 k0 k1 gp sp fp ra $f0 $f1 $f2 $f2 $f4 $f5 $f6 $f7 $f8 $f9 $f10 $f11 $f12 $f13 $f14 $f15 $f16 $f17 $f18 $f19 $f20 $f21 $f22 $f23 $f24 $f25 $f26 $f27 $f28 $f29 $f30 $f31 Context Random EntryLo0 EntryLo1 Context PageMask Wired EntryHi HWREna BadVAddr Count Compare SR IntCtl SRSCtl SRSMap Cause EPC PRId EBase Config Config1 Config2 Config3 LLAddr Debug DEPC DESAVE CacheErr ECC ErrorEPC TagLo DataLo TagHi DataHi WatchLo WatchHi PerfCtl PerfCnt "},c:[{cN:"keyword",b:"\\b(addi?u?|andi?|b(al)?|beql?|bgez(al)?l?|bgtzl?|blezl?|bltz(al)?l?|bnel?|cl[oz]|divu?|ext|ins|j(al)?|jalr(.hb)?|jr(.hb)?|lbu?|lhu?|ll|lui|lw[lr]?|maddu?|mfhi|mflo|movn|movz|move|msubu?|mthi|mtlo|mul|multu?|nop|nor|ori?|rotrv?|sb|sc|se[bh]|sh|sllv?|slti?u?|srav?|srlv?|subu?|sw[lr]?|xori?|wsbh|abs.[sd]|add.[sd]|alnv.ps|bc1[ft]l?|c.(s?f|un|u?eq|[ou]lt|[ou]le|ngle?|seq|l[et]|ng[et]).[sd]|(ceil|floor|round|trunc).[lw].[sd]|cfc1|cvt.d.[lsw]|cvt.l.[dsw]|cvt.ps.s|cvt.s.[dlw]|cvt.s.p[lu]|cvt.w.[dls]|div.[ds]|ldx?c1|luxc1|lwx?c1|madd.[sd]|mfc1|mov[fntz]?.[ds]|msub.[sd]|mth?c1|mul.[ds]|neg.[ds]|nmadd.[ds]|nmsub.[ds]|p[lu][lu].ps|recip.fmt|r?sqrt.[ds]|sdx?c1|sub.[ds]|suxc1|swx?c1|break|cache|d?eret|[de]i|ehb|mfc0|mtc0|pause|prefx?|rdhwr|rdpgpr|sdbbp|ssnop|synci?|syscall|teqi?|tgei?u?|tlb(p|r|w[ir])|tlti?u?|tnei?|wait|wrpgpr)",e:"\\s"},s.C("[;#]","$"),s.CBCM,s.QSM,{cN:"string",b:"'",e:"[^\\\\]'",r:0},{cN:"title",b:"\\|",e:"\\|",i:"\\n",r:0},{cN:"number",v:[{b:"0x[0-9a-f]+"},{b:"\\b-?\\d+"}],r:0},{cN:"symbol",v:[{b:"^\\s*[a-z_\\.\\$][a-z0-9_\\.\\$]+:"},{b:"^\\s*[0-9]+:"},{b:"[0-9]+[bf]"}],r:0}],i:"/"}});hljs.registerLanguage("arduino",function(e){var t=e.getLanguage("cpp").exports;return{k:{keyword:"boolean byte word string String array "+t.k.keyword,built_in:"setup loop while catch for if do goto try switch case else default break continue return KeyboardController MouseController SoftwareSerial EthernetServer EthernetClient LiquidCrystal RobotControl GSMVoiceCall EthernetUDP EsploraTFT HttpClient RobotMotor WiFiClient GSMScanner FileSystem Scheduler GSMServer YunClient YunServer IPAddress GSMClient GSMModem Keyboard Ethernet Console GSMBand Esplora Stepper Process WiFiUDP GSM_SMS Mailbox USBHost Firmata PImage Client Server GSMPIN FileIO Bridge Serial EEPROM Stream Mouse Audio Servo File Task GPRS WiFi Wire TFT GSM SPI SD runShellCommandAsynchronously analogWriteResolution retrieveCallingNumber printFirmwareVersion analogReadResolution sendDigitalPortPair noListenOnLocalhost readJoystickButton setFirmwareVersion readJoystickSwitch scrollDisplayRight getVoiceCallStatus scrollDisplayLeft writeMicroseconds delayMicroseconds beginTransmission getSignalStrength runAsynchronously getAsynchronously listenOnLocalhost getCurrentCarrier readAccelerometer messageAvailable sendDigitalPorts lineFollowConfig countryNameWrite runShellCommand readStringUntil rewindDirectory readTemperature setClockDivider readLightSensor endTransmission analogReference detachInterrupt countryNameRead attachInterrupt encryptionType readBytesUntil robotNameWrite readMicrophone robotNameRead cityNameWrite userNameWrite readJoystickY readJoystickX mouseReleased openNextFile scanNetworks noInterrupts digitalWrite beginSpeaker mousePressed isActionDone mouseDragged displayLogos noAutoscroll addParameter remoteNumber getModifiers keyboardRead userNameRead waitContinue processInput parseCommand printVersion readNetworks writeMessage blinkVersion cityNameRead readMessage setDataMode parsePacket isListening setBitOrder beginPacket isDirectory motorsWrite drawCompass digitalRead clearScreen serialEvent rightToLeft setTextSize leftToRight requestFrom keyReleased compassRead analogWrite interrupts WiFiServer disconnect playMelody parseFloat autoscroll getPINUsed setPINUsed setTimeout sendAnalog readSlider analogRead beginWrite createChar motorsStop keyPressed tempoWrite readButton subnetMask debugPrint macAddress writeGreen randomSeed attachGPRS readString sendString remotePort releaseAll mouseMoved background getXChange getYChange answerCall getResult voiceCall endPacket constrain getSocket writeJSON getButton available connected findUntil readBytes exitValue readGreen writeBlue startLoop IPAddress isPressed sendSysex pauseMode gatewayIP setCursor getOemKey tuneWrite noDisplay loadImage switchPIN onRequest onReceive changePIN playFile noBuffer parseInt overflow checkPIN knobRead beginTFT bitClear updateIR bitWrite position writeRGB highByte writeRed setSpeed readBlue noStroke remoteIP transfer shutdown hangCall beginSMS endWrite attached maintain noCursor checkReg checkPUK shiftOut isValid shiftIn pulseIn connect println localIP pinMode getIMEI display noBlink process getBand running beginSD drawBMP lowByte setBand release bitRead prepare pointTo readRed setMode noFill remove listen stroke detach attach noTone exists buffer height bitSet circle config cursor random IRread setDNS endSMS getKey micros millis begin print write ready flush width isPIN blink clear press mkdir rmdir close point yield image BSSID click delay read text move peek beep rect line open seek fill size turn stop home find step tone sqrt RSSI SSID end bit tan cos sin pow map abs max min get run put",literal:"DIGITAL_MESSAGE FIRMATA_STRING ANALOG_MESSAGE REPORT_DIGITAL REPORT_ANALOG INPUT_PULLUP SET_PIN_MODE INTERNAL2V56 SYSTEM_RESET LED_BUILTIN INTERNAL1V1 SYSEX_START INTERNAL EXTERNAL DEFAULT OUTPUT INPUT HIGH LOW"},c:[t.preprocessor,e.CLCM,e.CBCM,e.ASM,e.QSM,e.CNM]}});hljs.registerLanguage("excel",function(E){return{aliases:["xlsx","xls"],cI:!0,l:/[a-zA-Z][\w\.]*/,k:{built_in:"ABS ACCRINT ACCRINTM ACOS ACOSH ACOT ACOTH AGGREGATE ADDRESS AMORDEGRC AMORLINC AND ARABIC AREAS ASC ASIN ASINH ATAN ATAN2 ATANH AVEDEV AVERAGE AVERAGEA AVERAGEIF AVERAGEIFS BAHTTEXT BASE BESSELI BESSELJ BESSELK BESSELY BETADIST BETA.DIST BETAINV BETA.INV BIN2DEC BIN2HEX BIN2OCT BINOMDIST BINOM.DIST BINOM.DIST.RANGE BINOM.INV BITAND BITLSHIFT BITOR BITRSHIFT BITXOR CALL CEILING CEILING.MATH CEILING.PRECISE CELL CHAR CHIDIST CHIINV CHITEST CHISQ.DIST CHISQ.DIST.RT CHISQ.INV CHISQ.INV.RT CHISQ.TEST CHOOSE CLEAN CODE COLUMN COLUMNS COMBIN COMBINA COMPLEX CONCAT CONCATENATE CONFIDENCE CONFIDENCE.NORM CONFIDENCE.T CONVERT CORREL COS COSH COT COTH COUNT COUNTA COUNTBLANK COUNTIF COUNTIFS COUPDAYBS COUPDAYS COUPDAYSNC COUPNCD COUPNUM COUPPCD COVAR COVARIANCE.P COVARIANCE.S CRITBINOM CSC CSCH CUBEKPIMEMBER CUBEMEMBER CUBEMEMBERPROPERTY CUBERANKEDMEMBER CUBESET CUBESETCOUNT CUBEVALUE CUMIPMT CUMPRINC DATE DATEDIF DATEVALUE DAVERAGE DAY DAYS DAYS360 DB DBCS DCOUNT DCOUNTA DDB DEC2BIN DEC2HEX DEC2OCT DECIMAL DEGREES DELTA DEVSQ DGET DISC DMAX DMIN DOLLAR DOLLARDE DOLLARFR DPRODUCT DSTDEV DSTDEVP DSUM DURATION DVAR DVARP EDATE EFFECT ENCODEURL EOMONTH ERF ERF.PRECISE ERFC ERFC.PRECISE ERROR.TYPE EUROCONVERT EVEN EXACT EXP EXPON.DIST EXPONDIST FACT FACTDOUBLE FALSE|0 F.DIST FDIST F.DIST.RT FILTERXML FIND FINDB F.INV F.INV.RT FINV FISHER FISHERINV FIXED FLOOR FLOOR.MATH FLOOR.PRECISE FORECAST FORECAST.ETS FORECAST.ETS.CONFINT FORECAST.ETS.SEASONALITY FORECAST.ETS.STAT FORECAST.LINEAR FORMULATEXT FREQUENCY F.TEST FTEST FV FVSCHEDULE GAMMA GAMMA.DIST GAMMADIST GAMMA.INV GAMMAINV GAMMALN GAMMALN.PRECISE GAUSS GCD GEOMEAN GESTEP GETPIVOTDATA GROWTH HARMEAN HEX2BIN HEX2DEC HEX2OCT HLOOKUP HOUR HYPERLINK HYPGEOM.DIST HYPGEOMDIST IF|0 IFERROR IFNA IFS IMABS IMAGINARY IMARGUMENT IMCONJUGATE IMCOS IMCOSH IMCOT IMCSC IMCSCH IMDIV IMEXP IMLN IMLOG10 IMLOG2 IMPOWER IMPRODUCT IMREAL IMSEC IMSECH IMSIN IMSINH IMSQRT IMSUB IMSUM IMTAN INDEX INDIRECT INFO INT INTERCEPT INTRATE IPMT IRR ISBLANK ISERR ISERROR ISEVEN ISFORMULA ISLOGICAL ISNA ISNONTEXT ISNUMBER ISODD ISREF ISTEXT ISO.CEILING ISOWEEKNUM ISPMT JIS KURT LARGE LCM LEFT LEFTB LEN LENB LINEST LN LOG LOG10 LOGEST LOGINV LOGNORM.DIST LOGNORMDIST LOGNORM.INV LOOKUP LOWER MATCH MAX MAXA MAXIFS MDETERM MDURATION MEDIAN MID MIDBs MIN MINIFS MINA MINUTE MINVERSE MIRR MMULT MOD MODE MODE.MULT MODE.SNGL MONTH MROUND MULTINOMIAL MUNIT N NA NEGBINOM.DIST NEGBINOMDIST NETWORKDAYS NETWORKDAYS.INTL NOMINAL NORM.DIST NORMDIST NORMINV NORM.INV NORM.S.DIST NORMSDIST NORM.S.INV NORMSINV NOT NOW NPER NPV NUMBERVALUE OCT2BIN OCT2DEC OCT2HEX ODD ODDFPRICE ODDFYIELD ODDLPRICE ODDLYIELD OFFSET OR PDURATION PEARSON PERCENTILE.EXC PERCENTILE.INC PERCENTILE PERCENTRANK.EXC PERCENTRANK.INC PERCENTRANK PERMUT PERMUTATIONA PHI PHONETIC PI PMT POISSON.DIST POISSON POWER PPMT PRICE PRICEDISC PRICEMAT PROB PRODUCT PROPER PV QUARTILE QUARTILE.EXC QUARTILE.INC QUOTIENT RADIANS RAND RANDBETWEEN RANK.AVG RANK.EQ RANK RATE RECEIVED REGISTER.ID REPLACE REPLACEB REPT RIGHT RIGHTB ROMAN ROUND ROUNDDOWN ROUNDUP ROW ROWS RRI RSQ RTD SEARCH SEARCHB SEC SECH SECOND SERIESSUM SHEET SHEETS SIGN SIN SINH SKEW SKEW.P SLN SLOPE SMALL SQL.REQUEST SQRT SQRTPI STANDARDIZE STDEV STDEV.P STDEV.S STDEVA STDEVP STDEVPA STEYX SUBSTITUTE SUBTOTAL SUM SUMIF SUMIFS SUMPRODUCT SUMSQ SUMX2MY2 SUMX2PY2 SUMXMY2 SWITCH SYD T TAN TANH TBILLEQ TBILLPRICE TBILLYIELD T.DIST T.DIST.2T T.DIST.RT TDIST TEXT TEXTJOIN TIME TIMEVALUE T.INV T.INV.2T TINV TODAY TRANSPOSE TREND TRIM TRIMMEAN TRUE|0 TRUNC T.TEST TTEST TYPE UNICHAR UNICODE UPPER VALUE VAR VAR.P VAR.S VARA VARP VARPA VDB VLOOKUP WEBSERVICE WEEKDAY WEEKNUM WEIBULL WEIBULL.DIST WORKDAY WORKDAY.INTL XIRR XNPV XOR YEAR YEARFRAC YIELD YIELDDISC YIELDMAT Z.TEST ZTEST"},c:[{b:/^=/,e:/[^=]/,rE:!0,i:/=/,r:10},{cN:"symbol",b:/\b[A-Z]{1,2}\d+\b/,e:/[^\d]/,eE:!0,r:0},{cN:"symbol",b:/[A-Z]{0,2}\d*:[A-Z]{0,2}\d*/,r:0},E.BE,E.QSM,{cN:"number",b:E.NR+"(%)?",r:0},E.C(/\bN\(/,/\)/,{eB:!0,eE:!0,i:/\n/})]}});hljs.registerLanguage("rust",function(e){var t="([ui](8|16|32|64|128|size)|f(32|64))?",r="alignof as be box break const continue crate do else enum extern false fn for if impl in let loop match mod mut offsetof once priv proc pub pure ref return self Self sizeof static struct super trait true type typeof unsafe unsized use virtual while where yield move default",n="drop i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize f32 f64 str char bool Box Option Result String Vec Copy Send Sized Sync Drop Fn FnMut FnOnce ToOwned Clone Debug PartialEq PartialOrd Eq Ord AsRef AsMut Into From Default Iterator Extend IntoIterator DoubleEndedIterator ExactSizeIterator SliceConcatExt ToString assert! assert_eq! bitflags! bytes! cfg! col! concat! concat_idents! debug_assert! debug_assert_eq! env! panic! file! format! format_args! include_bin! include_str! line! local_data_key! module_path! option_env! print! println! select! stringify! try! unimplemented! unreachable! vec! write! writeln! macro_rules! assert_ne! debug_assert_ne!";return{aliases:["rs"],k:{keyword:r,literal:"true false Some None Ok Err",built_in:n},l:e.IR+"!?",i:""}]}});hljs.registerLanguage("actionscript",function(e){var a="[a-zA-Z_$][a-zA-Z0-9_$]*",t="([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)",c={cN:"rest_arg",b:"[.]{3}",e:a,r:10};return{aliases:["as"],k:{keyword:"as break case catch class const continue default delete do dynamic each else extends final finally for function get if implements import in include instanceof interface internal is namespace native new override package private protected public return set static super switch this throw try typeof use var void while with",literal:"true false null undefined"},c:[e.ASM,e.QSM,e.CLCM,e.CBCM,e.CNM,{cN:"class",bK:"package",e:"{",c:[e.TM]},{cN:"class",bK:"class interface",e:"{",eE:!0,c:[{bK:"extends implements"},e.TM]},{cN:"meta",bK:"import include",e:";",k:{"meta-keyword":"import include"}},{cN:"function",bK:"function",e:"[{;]",eE:!0,i:"\\S",c:[e.TM,{cN:"params",b:"\\(",e:"\\)",c:[e.ASM,e.QSM,e.CLCM,e.CBCM,c]},{b:":\\s*"+t}]},e.METHOD_GUARD],i:/#/}});hljs.registerLanguage("prolog",function(c){var b={b:/[a-z][A-Za-z0-9_]*/,r:0},r={cN:"symbol",v:[{b:/[A-Z][a-zA-Z0-9_]*/},{b:/_[A-Za-z0-9_]*/}],r:0},e={b:/\(/,e:/\)/,r:0},n={b:/\[/,e:/\]/},a={cN:"comment",b:/%/,e:/$/,c:[c.PWM]},t={cN:"string",b:/`/,e:/`/,c:[c.BE]},g={cN:"string",b:/0\'(\\\'|.)/},s={cN:"string",b:/0\'\\s/},o={b:/:-/},N=[b,r,e,o,n,a,c.CBCM,c.QSM,c.ASM,t,g,s,c.CNM];return e.c=N,n.c=N,{c:N.concat([{b:/\.$/}])}});hljs.registerLanguage("taggerscript",function(e){var c={cN:"comment",b:/\$noop\(/,e:/\)/,c:[{b:/\(/,e:/\)/,c:["self",{b:/\\./}]}],r:10},r={cN:"keyword",b:/\$(?!noop)[a-zA-Z][_a-zA-Z0-9]*/,e:/\(/,eE:!0},a={cN:"variable",b:/%[_a-zA-Z0-9:]*/,e:"%"},b={cN:"symbol",b:/\\./};return{c:[c,r,a,b]}});hljs.registerLanguage("llvm",function(e){var n="([-a-zA-Z$._][\\w\\-$.]*)";return{k:"begin end true false declare define global constant private linker_private internal available_externally linkonce linkonce_odr weak weak_odr appending dllimport dllexport common default hidden protected extern_weak external thread_local zeroinitializer undef null to tail target triple datalayout volatile nuw nsw nnan ninf nsz arcp fast exact inbounds align addrspace section alias module asm sideeffect gc dbg linker_private_weak attributes blockaddress initialexec localdynamic localexec prefix unnamed_addr ccc fastcc coldcc x86_stdcallcc x86_fastcallcc arm_apcscc arm_aapcscc arm_aapcs_vfpcc ptx_device ptx_kernel intel_ocl_bicc msp430_intrcc spir_func spir_kernel x86_64_sysvcc x86_64_win64cc x86_thiscallcc cc c signext zeroext inreg sret nounwind noreturn noalias nocapture byval nest readnone readonly inlinehint noinline alwaysinline optsize ssp sspreq noredzone noimplicitfloat naked builtin cold nobuiltin noduplicate nonlazybind optnone returns_twice sanitize_address sanitize_memory sanitize_thread sspstrong uwtable returned type opaque eq ne slt sgt sle sge ult ugt ule uge oeq one olt ogt ole oge ord uno ueq une x acq_rel acquire alignstack atomic catch cleanup filter inteldialect max min monotonic nand personality release seq_cst singlethread umax umin unordered xchg add fadd sub fsub mul fmul udiv sdiv fdiv urem srem frem shl lshr ashr and or xor icmp fcmp phi call trunc zext sext fptrunc fpext uitofp sitofp fptoui fptosi inttoptr ptrtoint bitcast addrspacecast select va_arg ret br switch invoke unwind unreachable indirectbr landingpad resume malloc alloca free load store getelementptr extractelement insertelement shufflevector getresult extractvalue insertvalue atomicrmw cmpxchg fence argmemonly double",c:[{cN:"keyword",b:"i\\d+"},e.C(";","\\n",{r:0}),e.QSM,{cN:"string",v:[{b:'"',e:'[^\\\\]"'}],r:0},{cN:"title",v:[{b:"@"+n},{b:"@\\d+"},{b:"!"+n},{b:"!\\d+"+n}]},{cN:"symbol",v:[{b:"%"+n},{b:"%\\d+"},{b:"#\\d+"}]},{cN:"number",v:[{b:"0[xX][a-fA-F0-9]+"},{b:"-?\\d+(?:[.]\\d+)?(?:[eE][-+]?\\d+(?:[.]\\d+)?)?"}],r:0}]}});hljs.registerLanguage("axapta",function(e){return{k:"false int abstract private char boolean static null if for true while long throw finally protected final return void enum else break new catch byte super case short default double public try this switch continue reverse firstfast firstonly forupdate nofetch sum avg minof maxof count order group by asc desc index hint like dispaly edit client server ttsbegin ttscommit str real date container anytype common div mod",c:[e.CLCM,e.CBCM,e.ASM,e.QSM,e.CNM,{cN:"meta",b:"#",e:"$"},{cN:"class",bK:"class interface",e:"{",eE:!0,i:":",c:[{bK:"extends implements"},e.UTM]}]}});hljs.registerLanguage("clean",function(e){return{aliases:["clean","icl","dcl"],k:{keyword:"if let in with where case of class instance otherwise implementation definition system module from import qualified as special code inline foreign export ccall stdcall generic derive infix infixl infixr",literal:"True False"},c:[e.CLCM,e.CBCM,e.ASM,e.QSM,e.CNM,{b:"->|<-[|:]?|::|#!?|>>=|\\{\\||\\|\\}|:==|=:|\\.\\.|<>|`"}]}});hljs.registerLanguage("kotlin",function(e){var t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit initinterface annotation data sealed internal infix operator out by constructor super trait volatile transient native default",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},r={cN:"keyword",b:/\b(break|continue|return|this)\b/,starts:{c:[{cN:"symbol",b:/@\w+/}]}},i={cN:"symbol",b:e.UIR+"@"},n={cN:"subst",v:[{b:"\\$"+e.UIR},{b:"\\${",e:"}",c:[e.ASM,e.CNM]}]},a={cN:"string",v:[{b:'"""',e:'"""',c:[n]},{b:"'",e:"'",i:/\n/,c:[e.BE]},{b:'"',e:'"',i:/\n/,c:[e.BE,n]}]},c={cN:"meta",b:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UIR+")?"},s={cN:"meta",b:"@"+e.UIR,c:[{b:/\(/,e:/\)/,c:[e.inherit(a,{cN:"meta-string"})]}]};return{k:t,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,r,i,c,s,{cN:"function",bK:"fun",e:"[(]|$",rB:!0,eE:!0,k:t,i:/fun\s+(<.*>)?[^\s\(]+(\s+[^\s\(]+)\s*=/,r:5,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"type",b://,k:"reified",r:0},{cN:"params",b:/\(/,e:/\)/,endsParent:!0,k:t,r:0,c:[{b:/:/,e:/[=,\/]/,eW:!0,c:[{cN:"type",b:e.UIR},e.CLCM,e.CBCM],r:0},e.CLCM,e.CBCM,c,s,a,e.CNM]},e.CBCM]},{cN:"class",bK:"class interface trait",e:/[:\{(]|$/,eE:!0,i:"extends implements",c:[{bK:"public protected internal private constructor"},e.UTM,{cN:"type",b://,eB:!0,eE:!0,r:0},{cN:"type",b:/[,:]\s*/,e:/[<\(,]|$/,eB:!0,rE:!0},c,s]},a,{cN:"meta",b:"^#!/usr/bin/env",e:"$",i:"\n"},e.CNM]}});hljs.registerLanguage("stylus",function(e){var t={cN:"variable",b:"\\$"+e.IR},o={cN:"number",b:"#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})"},i=["charset","css","debug","extend","font-face","for","import","include","media","mixin","page","warn","while"],r=["after","before","first-letter","first-line","active","first-child","focus","hover","lang","link","visited"],n=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],a="[\\.\\s\\n\\[\\:,]",l=["align-content","align-items","align-self","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","auto","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","clip-path","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","font","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-variant-ligatures","font-weight","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inherit","initial","justify-content","left","letter-spacing","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","mask","max-height","max-width","min-height","min-width","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","perspective","perspective-origin","pointer-events","position","quotes","resize","right","tab-size","table-layout","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-indent","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","white-space","widows","width","word-break","word-spacing","word-wrap","z-index"],d=["\\?","(\\bReturn\\b)","(\\bEnd\\b)","(\\bend\\b)","(\\bdef\\b)",";","#\\s","\\*\\s","===\\s","\\|","%"];return{aliases:["styl"],cI:!1,k:"if else for in",i:"("+d.join("|")+")",c:[e.QSM,e.ASM,e.CLCM,e.CBCM,o,{b:"\\.[a-zA-Z][a-zA-Z0-9_-]*"+a,rB:!0,c:[{cN:"selector-class",b:"\\.[a-zA-Z][a-zA-Z0-9_-]*"}]},{b:"\\#[a-zA-Z][a-zA-Z0-9_-]*"+a,rB:!0,c:[{cN:"selector-id",b:"\\#[a-zA-Z][a-zA-Z0-9_-]*"}]},{b:"\\b("+n.join("|")+")"+a,rB:!0,c:[{cN:"selector-tag",b:"\\b[a-zA-Z][a-zA-Z0-9_-]*"}]},{b:"&?:?:\\b("+r.join("|")+")"+a},{b:"@("+i.join("|")+")\\b"},t,e.CSSNM,e.NM,{cN:"function",b:"^[a-zA-Z][a-zA-Z0-9_-]*\\(.*\\)",i:"[\\n]",rB:!0,c:[{cN:"title",b:"\\b[a-zA-Z][a-zA-Z0-9_-]*"},{cN:"params",b:/\(/,e:/\)/,c:[o,t,e.ASM,e.CSSNM,e.NM,e.QSM]}]},{cN:"attribute",b:"\\b("+l.reverse().join("|")+")\\b",starts:{e:/;|$/,c:[o,t,e.ASM,e.QSM,e.CSSNM,e.NM,e.CBCM],i:/\./,r:0}}]}});hljs.registerLanguage("markdown",function(e){return{aliases:["md","mkdown","mkd"],c:[{cN:"section",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"quote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"^```w*s*$",e:"^```s*$"},{b:"`.+?`"},{b:"^( {4}| )",e:"$",r:0}]},{b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"string",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"symbol",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:/^\[[^\n]+\]:/,rB:!0,c:[{cN:"symbol",b:/\[/,e:/\]/,eB:!0,eE:!0},{cN:"link",b:/:\s*/,e:/$/,eB:!0}]}]}});hljs.registerLanguage("zephir",function(e){var i={cN:"string",c:[e.BE],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},n={v:[e.BNM,e.CNM]};return{aliases:["zep"],cI:!0,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var let while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally int uint long ulong char uchar double float bool boolean stringlikely unlikely",c:[e.CLCM,e.HCM,e.C("/\\*","\\*/",{c:[{cN:"doctag",b:"@[A-Za-z]+"}]}),e.C("__halt_compiler.+?;",!1,{eW:!0,k:"__halt_compiler",l:e.UIR}),{cN:"string",b:"<<<['\"]?\\w+['\"]?$",e:"^\\w+;",c:[e.BE]},{b:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{cN:"function",bK:"function",e:/[;{]/,eE:!0,i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",e.CBCM,i,n]}]},{cN:"class",bK:"class interface",e:"{",eE:!0,i:/[:\(\$"]/,c:[{bK:"extends implements"},e.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[e.UTM]},{bK:"use",e:";",c:[e.UTM]},{b:"=>"},i,n]}});hljs.registerLanguage("mercury",function(e){var i={keyword:"module use_module import_module include_module end_module initialise mutable initialize finalize finalise interface implementation pred mode func type inst solver any_pred any_func is semidet det nondet multi erroneous failure cc_nondet cc_multi typeclass instance where pragma promise external trace atomic or_else require_complete_switch require_det require_semidet require_multi require_nondet require_cc_multi require_cc_nondet require_erroneous require_failure",meta:"inline no_inline type_spec source_file fact_table obsolete memo loop_check minimal_model terminates does_not_terminate check_termination promise_equivalent_clauses foreign_proc foreign_decl foreign_code foreign_type foreign_import_module foreign_export_enum foreign_export foreign_enum may_call_mercury will_not_call_mercury thread_safe not_thread_safe maybe_thread_safe promise_pure promise_semipure tabled_for_io local untrailed trailed attach_to_io_state can_pass_as_mercury_type stable will_not_throw_exception may_modify_trail will_not_modify_trail may_duplicate may_not_duplicate affects_liveness does_not_affect_liveness doesnt_affect_liveness no_sharing unknown_sharing sharing",built_in:"some all not if then else true fail false try catch catch_any semidet_true semidet_false semidet_fail impure_true impure semipure"},r=e.C("%","$"),t={cN:"number",b:"0'.\\|0[box][0-9a-fA-F]*"},_=e.inherit(e.ASM,{r:0}),n=e.inherit(e.QSM,{r:0}),a={cN:"subst",b:"\\\\[abfnrtv]\\|\\\\x[0-9a-fA-F]*\\\\\\|%[-+# *.0-9]*[dioxXucsfeEgGp]",r:0};n.c.push(a);var o={cN:"built_in",v:[{b:"<=>"},{b:"<=",r:0},{b:"=>",r:0},{b:"/\\\\"},{b:"\\\\/"}]},l={cN:"built_in",v:[{b:":-\\|-->"},{b:"=",r:0}]};return{aliases:["m","moo"],k:i,c:[o,l,r,e.CBCM,t,e.NM,_,n,{b:/:-/}]}});hljs.registerLanguage("diff",function(e){return{aliases:["patch"],c:[{cN:"meta",r:10,v:[{b:/^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"comment",v:[{b:/Index: /,e:/$/},{b:/={3,}/,e:/$/},{b:/^\-{3}/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+{3}/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"addition",b:"^\\!",e:"$"}]}});hljs.registerLanguage("delphi",function(e){var r="exports register file shl array record property for mod while set ally label uses raise not stored class safecall var interface or private static exit index inherited to else stdcall override shr asm far resourcestring finalization packed virtual out and protected library do xorwrite goto near function end div overload object unit begin string on inline repeat until destructor write message program with read initialization except default nil if case cdecl in downto threadvar of try pascal const external constructor type public then implementation finally published procedure absolute reintroduce operator as is abstract alias assembler bitpacked break continue cppdecl cvar enumerator experimental platform deprecated unimplemented dynamic export far16 forward generic helper implements interrupt iochecks local name nodefault noreturn nostackframe oldfpccall otherwise saveregisters softfloat specialize strict unaligned varargs ",t=[e.CLCM,e.C(/\{/,/\}/,{r:0}),e.C(/\(\*/,/\*\)/,{r:10})],a={cN:"meta",v:[{b:/\{\$/,e:/\}/},{b:/\(\*\$/,e:/\*\)/}]},c={cN:"string",b:/'/,e:/'/,c:[{b:/''/}]},i={cN:"string",b:/(#\d+)+/},o={b:e.IR+"\\s*=\\s*class\\s*\\(",rB:!0,c:[e.TM]},n={cN:"function",bK:"function constructor destructor procedure",e:/[:;]/,k:"function constructor|10 destructor|10 procedure|10",c:[e.TM,{cN:"params",b:/\(/,e:/\)/,k:r,c:[c,i,a].concat(t)},a].concat(t)};return{aliases:["dpr","dfm","pas","pascal","freepascal","lazarus","lpr","lfm"],cI:!0,k:r,i:/"|\$[G-Zg-z]|\/\*|<\/|\|/,c:[c,i,e.NM,o,n,a].concat(t)}});hljs.registerLanguage("awk",function(e){var r={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},b="BEGIN END if else while do for in break continue delete next nextfile function func exit|10",n={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,r:10},{b:/(u|b)?r?"""/,e:/"""/,r:10},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},e.ASM,e.QSM]};return{k:{keyword:b},c:[r,n,e.RM,e.HCM,e.NM]}});hljs.registerLanguage("htmlbars",function(e){var a="action collection component concat debugger each each-in else get hash if input link-to loc log mut outlet partial query-params render textarea unbound unless with yield view",t={i:/\}\}/,b:/[a-zA-Z0-9_]+=/,rB:!0,r:0,c:[{cN:"attr",b:/[a-zA-Z0-9_]+/}]},i=({i:/\}\}/,b:/\)/,e:/\)/,c:[{b:/[a-zA-Z\.\-]+/,k:{built_in:a},starts:{eW:!0,r:0,c:[e.QSM]}}]},{eW:!0,r:0,k:{keyword:"as",built_in:a},c:[e.QSM,t,e.NM]});return{cI:!0,sL:"xml",c:[e.C("{{!(--)?","(--)?}}"),{cN:"template-tag",b:/\{\{[#\/]/,e:/\}\}/,c:[{cN:"name",b:/[a-zA-Z\.\-]+/,k:{"builtin-name":a},starts:i}]},{cN:"template-variable",b:/\{\{[a-zA-Z][a-zA-Z\-]+/,e:/\}\}/,k:{keyword:"as",built_in:a},c:[e.QSM]}]}});hljs.registerLanguage("subunit",function(s){var r={cN:"string",b:"\\[\n(multipart)?",e:"\\]\n"},t={cN:"string",b:"\\d{4}-\\d{2}-\\d{2}(\\s+)\\d{2}:\\d{2}:\\d{2}.\\d+Z"},e={cN:"string",b:"(\\+|-)\\d+"},c={cN:"keyword",r:10,v:[{b:"^(test|testing|success|successful|failure|error|skip|xfail|uxsuccess)(:?)\\s+(test)?"},{b:"^progress(:?)(\\s+)?(pop|push)?"},{b:"^tags:"},{b:"^time:"}]};return{cI:!0,c:[r,t,e,c]}});hljs.registerLanguage("haxe",function(e){var t="Int Float String Bool Dynamic Void Array ";return{aliases:["hx"],k:{keyword:"break callback case cast catch continue default do dynamic else enum extern for function here if import in inline never new override package private get set public return static super switch this throw trace try typedef untyped using var while "+t,built_in:"trace this",literal:"true false null _"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{cN:"subst",b:"\\$\\{",e:"\\}"},{cN:"subst",b:"\\$",e:"\\W}"}]},e.QSM,e.CLCM,e.CBCM,e.CNM,{cN:"meta",b:"@:",e:"$"},{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elseif end error"}},{cN:"type",b:":[ ]*",e:"[^A-Za-z0-9_ \\->]",eB:!0,eE:!0,r:0},{cN:"type",b:":[ ]*",e:"\\W",eB:!0,eE:!0},{cN:"type",b:"new *",e:"\\W",eB:!0,eE:!0},{cN:"class",bK:"enum",e:"\\{",c:[e.TM]},{cN:"class",bK:"abstract",e:"[\\{$]",c:[{cN:"type",b:"\\(",e:"\\)",eB:!0,eE:!0},{cN:"type",b:"from +",e:"\\W",eB:!0,eE:!0},{cN:"type",b:"to +",e:"\\W",eB:!0,eE:!0},e.TM],k:{keyword:"abstract from to"}},{cN:"class",b:"\\b(class|interface) +",e:"[\\{$]",eE:!0,k:"class interface",c:[{cN:"keyword",b:"\\b(extends|implements) +",k:"extends implements",c:[{cN:"type",b:e.IR,r:0}]},e.TM]},{cN:"function",bK:"function",e:"\\(",eE:!0,i:"\\S",c:[e.TM]}],i:/<\//}});hljs.registerLanguage("n1ql",function(e){return{cI:!0,c:[{bK:"build create index delete drop explain infer|10 insert merge prepare select update upsert|10",e:/;/,eW:!0,k:{keyword:"all alter analyze and any array as asc begin between binary boolean break bucket build by call case cast cluster collate collection commit connect continue correlate cover create database dataset datastore declare decrement delete derived desc describe distinct do drop each element else end every except exclude execute exists explain fetch first flatten for force from function grant group gsi having if ignore ilike in include increment index infer inline inner insert intersect into is join key keys keyspace known last left let letting like limit lsm map mapping matched materialized merge minus namespace nest not number object offset on option or order outer over parse partition password path pool prepare primary private privilege procedure public raw realm reduce rename return returning revoke right role rollback satisfies schema select self semi set show some start statistics string system then to transaction trigger truncate under union unique unknown unnest unset update upsert use user using validate value valued values via view when where while with within work xor",literal:"true false null missing|5",built_in:"array_agg array_append array_concat array_contains array_count array_distinct array_ifnull array_length array_max array_min array_position array_prepend array_put array_range array_remove array_repeat array_replace array_reverse array_sort array_sum avg count max min sum greatest least ifmissing ifmissingornull ifnull missingif nullif ifinf ifnan ifnanorinf naninf neginfif posinfif clock_millis clock_str date_add_millis date_add_str date_diff_millis date_diff_str date_part_millis date_part_str date_trunc_millis date_trunc_str duration_to_str millis str_to_millis millis_to_str millis_to_utc millis_to_zone_name now_millis now_str str_to_duration str_to_utc str_to_zone_name decode_json encode_json encoded_size poly_length base64 base64_encode base64_decode meta uuid abs acos asin atan atan2 ceil cos degrees e exp ln log floor pi power radians random round sign sin sqrt tan trunc object_length object_names object_pairs object_inner_pairs object_values object_inner_values object_add object_put object_remove object_unwrap regexp_contains regexp_like regexp_position regexp_replace contains initcap length lower ltrim position repeat replace rtrim split substr title trim upper isarray isatom isboolean isnumber isobject isstring type toarray toatom toboolean tonumber toobject tostring"},c:[{cN:"string",b:"'",e:"'",c:[e.BE],r:0},{cN:"string",b:'"',e:'"',c:[e.BE],r:0},{cN:"symbol",b:"`",e:"`",c:[e.BE],r:2},e.CNM,e.CBCM]},e.CBCM]}});hljs.registerLanguage("django",function(e){var t={b:/\|[A-Za-z]+:?/,k:{name:"truncatewords removetags linebreaksbr yesno get_digit timesince random striptags filesizeformat escape linebreaks length_is ljust rjust cut urlize fix_ampersands title floatformat capfirst pprint divisibleby add make_list unordered_list urlencode timeuntil urlizetrunc wordcount stringformat linenumbers slice date dictsort dictsortreversed default_if_none pluralize lower join center default truncatewords_html upper length phone2numeric wordwrap time addslashes slugify first escapejs force_escape iriencode last safe safeseq truncatechars localize unlocalize localtime utc timezone"},c:[e.QSM,e.ASM]};return{aliases:["jinja"],cI:!0,sL:"xml",c:[e.C(/\{%\s*comment\s*%}/,/\{%\s*endcomment\s*%}/),e.C(/\{#/,/#}/),{cN:"template-tag",b:/\{%/,e:/%}/,c:[{cN:"name",b:/\w+/,k:{name:"comment endcomment load templatetag ifchanged endifchanged if endif firstof for endfor ifnotequal endifnotequal widthratio extends include spaceless endspaceless regroup ifequal endifequal ssi now with cycle url filter endfilter debug block endblock else autoescape endautoescape csrf_token empty elif endwith static trans blocktrans endblocktrans get_static_prefix get_media_prefix plural get_current_language language get_available_languages get_current_language_bidi get_language_info get_language_info_list localize endlocalize localtime endlocaltime timezone endtimezone get_current_timezone verbatim"},starts:{eW:!0,k:"in by as",c:[t],r:0}}]},{cN:"template-variable",b:/\{\{/,e:/}}/,c:[t]}]}});hljs.registerLanguage("handlebars",function(e){var a={"builtin-name":"each in with if else unless bindattr action collection debugger log outlet template unbound view yield"};return{aliases:["hbs","html.hbs","html.handlebars"],cI:!0,sL:"xml",c:[e.C("{{!(--)?","(--)?}}"),{cN:"template-tag",b:/\{\{[#\/]/,e:/\}\}/,c:[{cN:"name",b:/[a-zA-Z\.-]+/,k:a,starts:{eW:!0,r:0,c:[e.QSM]}}]},{cN:"template-variable",b:/\{\{/,e:/\}\}/,k:a}]}});hljs.registerLanguage("roboconf",function(a){var e="[a-zA-Z-_][^\\n{]+\\{",n={cN:"attribute",b:/[a-zA-Z-_]+/,e:/\s*:/,eE:!0,starts:{e:";",r:0,c:[{cN:"variable",b:/\.[a-zA-Z-_]+/},{cN:"keyword",b:/\(optional\)/}]}};return{aliases:["graph","instances"],cI:!0,k:"import",c:[{b:"^facet "+e,e:"}",k:"facet",c:[n,a.HCM]},{b:"^\\s*instance of "+e,e:"}",k:"name count channels instance-data instance-state instance of",i:/\S/,c:["self",n,a.HCM]},{b:"^"+e,e:"}",c:[n,a.HCM]},a.HCM]}});hljs.registerLanguage("autoit",function(e){var t="ByRef Case Const ContinueCase ContinueLoop Default Dim Do Else ElseIf EndFunc EndIf EndSelect EndSwitch EndWith Enum Exit ExitLoop For Func Global If In Local Next ReDim Return Select Static Step Switch Then To Until Volatile WEnd While With",r="True False And Null Not Or",i="Abs ACos AdlibRegister AdlibUnRegister Asc AscW ASin Assign ATan AutoItSetOption AutoItWinGetTitle AutoItWinSetTitle Beep Binary BinaryLen BinaryMid BinaryToString BitAND BitNOT BitOR BitRotate BitShift BitXOR BlockInput Break Call CDTray Ceiling Chr ChrW ClipGet ClipPut ConsoleRead ConsoleWrite ConsoleWriteError ControlClick ControlCommand ControlDisable ControlEnable ControlFocus ControlGetFocus ControlGetHandle ControlGetPos ControlGetText ControlHide ControlListView ControlMove ControlSend ControlSetText ControlShow ControlTreeView Cos Dec DirCopy DirCreate DirGetSize DirMove DirRemove DllCall DllCallAddress DllCallbackFree DllCallbackGetPtr DllCallbackRegister DllClose DllOpen DllStructCreate DllStructGetData DllStructGetPtr DllStructGetSize DllStructSetData DriveGetDrive DriveGetFileSystem DriveGetLabel DriveGetSerial DriveGetType DriveMapAdd DriveMapDel DriveMapGet DriveSetLabel DriveSpaceFree DriveSpaceTotal DriveStatus EnvGet EnvSet EnvUpdate Eval Execute Exp FileChangeDir FileClose FileCopy FileCreateNTFSLink FileCreateShortcut FileDelete FileExists FileFindFirstFile FileFindNextFile FileFlush FileGetAttrib FileGetEncoding FileGetLongName FileGetPos FileGetShortcut FileGetShortName FileGetSize FileGetTime FileGetVersion FileInstall FileMove FileOpen FileOpenDialog FileRead FileReadLine FileReadToArray FileRecycle FileRecycleEmpty FileSaveDialog FileSelectFolder FileSetAttrib FileSetEnd FileSetPos FileSetTime FileWrite FileWriteLine Floor FtpSetProxy FuncName GUICreate GUICtrlCreateAvi GUICtrlCreateButton GUICtrlCreateCheckbox GUICtrlCreateCombo GUICtrlCreateContextMenu GUICtrlCreateDate GUICtrlCreateDummy GUICtrlCreateEdit GUICtrlCreateGraphic GUICtrlCreateGroup GUICtrlCreateIcon GUICtrlCreateInput GUICtrlCreateLabel GUICtrlCreateList GUICtrlCreateListView GUICtrlCreateListViewItem GUICtrlCreateMenu GUICtrlCreateMenuItem GUICtrlCreateMonthCal GUICtrlCreateObj GUICtrlCreatePic GUICtrlCreateProgress GUICtrlCreateRadio GUICtrlCreateSlider GUICtrlCreateTab GUICtrlCreateTabItem GUICtrlCreateTreeView GUICtrlCreateTreeViewItem GUICtrlCreateUpdown GUICtrlDelete GUICtrlGetHandle GUICtrlGetState GUICtrlRead GUICtrlRecvMsg GUICtrlRegisterListViewSort GUICtrlSendMsg GUICtrlSendToDummy GUICtrlSetBkColor GUICtrlSetColor GUICtrlSetCursor GUICtrlSetData GUICtrlSetDefBkColor GUICtrlSetDefColor GUICtrlSetFont GUICtrlSetGraphic GUICtrlSetImage GUICtrlSetLimit GUICtrlSetOnEvent GUICtrlSetPos GUICtrlSetResizing GUICtrlSetState GUICtrlSetStyle GUICtrlSetTip GUIDelete GUIGetCursorInfo GUIGetMsg GUIGetStyle GUIRegisterMsg GUISetAccelerators GUISetBkColor GUISetCoord GUISetCursor GUISetFont GUISetHelp GUISetIcon GUISetOnEvent GUISetState GUISetStyle GUIStartGroup GUISwitch Hex HotKeySet HttpSetProxy HttpSetUserAgent HWnd InetClose InetGet InetGetInfo InetGetSize InetRead IniDelete IniRead IniReadSection IniReadSectionNames IniRenameSection IniWrite IniWriteSection InputBox Int IsAdmin IsArray IsBinary IsBool IsDeclared IsDllStruct IsFloat IsFunc IsHWnd IsInt IsKeyword IsNumber IsObj IsPtr IsString Log MemGetStats Mod MouseClick MouseClickDrag MouseDown MouseGetCursor MouseGetPos MouseMove MouseUp MouseWheel MsgBox Number ObjCreate ObjCreateInterface ObjEvent ObjGet ObjName OnAutoItExitRegister OnAutoItExitUnRegister Ping PixelChecksum PixelGetColor PixelSearch ProcessClose ProcessExists ProcessGetStats ProcessList ProcessSetPriority ProcessWait ProcessWaitClose ProgressOff ProgressOn ProgressSet Ptr Random RegDelete RegEnumKey RegEnumVal RegRead RegWrite Round Run RunAs RunAsWait RunWait Send SendKeepActive SetError SetExtended ShellExecute ShellExecuteWait Shutdown Sin Sleep SoundPlay SoundSetWaveVolume SplashImageOn SplashOff SplashTextOn Sqrt SRandom StatusbarGetText StderrRead StdinWrite StdioClose StdoutRead String StringAddCR StringCompare StringFormat StringFromASCIIArray StringInStr StringIsAlNum StringIsAlpha StringIsASCII StringIsDigit StringIsFloat StringIsInt StringIsLower StringIsSpace StringIsUpper StringIsXDigit StringLeft StringLen StringLower StringMid StringRegExp StringRegExpReplace StringReplace StringReverse StringRight StringSplit StringStripCR StringStripWS StringToASCIIArray StringToBinary StringTrimLeft StringTrimRight StringUpper Tan TCPAccept TCPCloseSocket TCPConnect TCPListen TCPNameToIP TCPRecv TCPSend TCPShutdown, UDPShutdown TCPStartup, UDPStartup TimerDiff TimerInit ToolTip TrayCreateItem TrayCreateMenu TrayGetMsg TrayItemDelete TrayItemGetHandle TrayItemGetState TrayItemGetText TrayItemSetOnEvent TrayItemSetState TrayItemSetText TraySetClick TraySetIcon TraySetOnEvent TraySetPauseIcon TraySetState TraySetToolTip TrayTip UBound UDPBind UDPCloseSocket UDPOpen UDPRecv UDPSend VarGetType WinActivate WinActive WinClose WinExists WinFlash WinGetCaretPos WinGetClassList WinGetClientSize WinGetHandle WinGetPos WinGetProcess WinGetState WinGetText WinGetTitle WinKill WinList WinMenuSelectItem WinMinimizeAll WinMinimizeAllUndo WinMove WinSetOnTop WinSetState WinSetTitle WinSetTrans WinWait",l={v:[e.C(";","$",{r:0}),e.C("#cs","#ce"),e.C("#comments-start","#comments-end")]},n={b:"\\$[A-z0-9_]+"},o={cN:"string",v:[{b:/"/,e:/"/,c:[{b:/""/,r:0}]},{b:/'/,e:/'/,c:[{b:/''/,r:0}]}]},a={v:[e.BNM,e.CNM]},S={cN:"meta",b:"#",e:"$",k:{"meta-keyword":"comments include include-once NoTrayIcon OnAutoItStartRegister pragma compile RequireAdmin"},c:[{b:/\\\n/,r:0},{bK:"include",k:{"meta-keyword":"include"},e:"$",c:[o,{cN:"meta-string",v:[{b:"<",e:">"},{b:/"/,e:/"/,c:[{b:/""/,r:0}]},{b:/'/,e:/'/,c:[{b:/''/,r:0}]}]}]},o,l]},C={cN:"symbol",b:"@[A-z0-9_]+"},s={cN:"function",bK:"Func",e:"$",i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:[n,o,a]}]};return{cI:!0,i:/\/\*/,k:{keyword:t,built_in:i,literal:r},c:[l,n,o,a,S,C,s]}});hljs.registerLanguage("apache",function(e){var r={cN:"number",b:"[\\$%]\\d+"};return{aliases:["apacheconf"],cI:!0,c:[e.HCM,{cN:"section",b:""},{cN:"attribute",b:/\w+/,r:0,k:{nomarkup:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"meta",b:"\\s\\[",e:"\\]$"},{cN:"variable",b:"[\\$%]\\{",e:"\\}",c:["self",r]},r,e.QSM]}}],i:/\S/}});hljs.registerLanguage("abnf",function(e){var r={ruleDeclaration:"^[a-zA-Z][a-zA-Z0-9-]*",unexpectedChars:"[!@#$^&',?+~`|:]"},a=["ALPHA","BIT","CHAR","CR","CRLF","CTL","DIGIT","DQUOTE","HEXDIG","HTAB","LF","LWSP","OCTET","SP","VCHAR","WSP"],b=e.C(";","$"),c={cN:"symbol",b:/%b[0-1]+(-[0-1]+|(\.[0-1]+)+){0,1}/},l={cN:"symbol",b:/%d[0-9]+(-[0-9]+|(\.[0-9]+)+){0,1}/},n={cN:"symbol",b:/%x[0-9A-F]+(-[0-9A-F]+|(\.[0-9A-F]+)+){0,1}/},t={cN:"symbol",b:/%[si]/},s={b:r.ruleDeclaration+"\\s*=",rB:!0,e:/=/,r:0,c:[{cN:"attribute",b:r.ruleDeclaration}]};return{i:r.unexpectedChars,k:a.join(" "),c:[s,b,c,l,n,t,e.QSM,e.NM]}});hljs.registerLanguage("mojolicious",function(e){return{sL:"xml",c:[{cN:"meta",b:"^__(END|DATA)__$"},{b:"^\\s*%{1,2}={0,2}",e:"$",sL:"perl"},{b:"<%{1,2}={0,2}",e:"={0,1}%>",sL:"perl",eB:!0,eE:!0}]}});hljs.registerLanguage("typescript",function(e){var r={keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class public private protected get set super static implements enum export import declare type namespace abstract as from extends async await",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document any number boolean string void Promise"};return{aliases:["ts"],k:r,c:[{cN:"meta",b:/^\s*['"]use strict['"]/},e.ASM,e.QSM,{cN:"string",b:"`",e:"`",c:[e.BE,{cN:"subst",b:"\\$\\{",e:"\\}"}]},e.CLCM,e.CBCM,{cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{cN:"function",b:"(\\(.*?\\)|"+e.IR+")\\s*=>",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:e.IR},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:r,c:["self",e.CLCM,e.CBCM]}]}]}],r:0},{cN:"function",b:"function",e:/[\{;]/,eE:!0,k:r,c:["self",e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:r,c:[e.CLCM,e.CBCM],i:/["'\(]/}],i:/%/,r:0},{bK:"constructor",e:/\{/,eE:!0,c:["self",{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:r,c:[e.CLCM,e.CBCM],i:/["'\(]/}]},{b:/module\./,k:{built_in:"module"},r:0},{bK:"module",e:/\{/,eE:!0},{bK:"interface",e:/\{/,eE:!0,k:"interface extends"},{b:/\$[(.]/},{b:"\\."+e.IR,r:0},{cN:"meta",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("vbnet",function(e){return{aliases:["vb"],cI:!0,k:{keyword:"addhandler addressof alias and andalso aggregate ansi as assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into is isfalse isnot istrue join key let lib like loop me mid mod module mustinherit mustoverride mybase myclass namespace narrowing new next not notinheritable notoverridable of off on operator option optional or order orelse overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim rem removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly xor",built_in:"boolean byte cbool cbyte cchar cdate cdec cdbl char cint clng cobj csbyte cshort csng cstr ctype date decimal directcast double gettype getxmlnamespace iif integer long object sbyte short single string trycast typeof uinteger ulong ushort",literal:"true false nothing"},i:"//|{|}|endif|gosub|variant|wend",c:[e.inherit(e.QSM,{c:[{b:'""'}]}),e.C("'","$",{rB:!0,c:[{cN:"doctag",b:"'''|",c:[e.PWM]},{cN:"doctag",b:"",c:[e.PWM]}]}),e.CNM,{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elseif end region externalsource"}}]}});hljs.registerLanguage("oxygene",function(e){var r="abstract add and array as asc aspect assembly async begin break block by case class concat const copy constructor continue create default delegate desc distinct div do downto dynamic each else empty end ensure enum equals event except exit extension external false final finalize finalizer finally flags for forward from function future global group has if implementation implements implies in index inherited inline interface into invariants is iterator join locked locking loop matching method mod module namespace nested new nil not notify nullable of old on operator or order out override parallel params partial pinned private procedure property protected public queryable raise read readonly record reintroduce remove repeat require result reverse sealed select self sequence set shl shr skip static step soft take then to true try tuple type union unit unsafe until uses using var virtual raises volatile where while with write xor yield await mapped deprecated stdcall cdecl pascal register safecall overload library platform reference packed strict published autoreleasepool selector strong weak unretained",t=e.C("{","}",{r:0}),a=e.C("\\(\\*","\\*\\)",{r:10}),n={cN:"string",b:"'",e:"'",c:[{b:"''"}]},o={cN:"string",b:"(#\\d+)+"},i={cN:"function",bK:"function constructor destructor procedure method",e:"[:;]",k:"function constructor|10 destructor|10 procedure|10 method|10",c:[e.TM,{cN:"params",b:"\\(",e:"\\)",k:r,c:[n,o]},t,a]};return{cI:!0,l:/\.?\w+/,k:r,i:'("|\\$[G-Zg-z]|\\/\\*||->)',c:[t,a,e.CLCM,n,o,e.NM,i,{cN:"class",b:"=\\bclass\\b",e:"end;",k:r,c:[n,o,t,a,e.CLCM,i]}]}});hljs.registerLanguage("rib",function(e){return{k:"ArchiveRecord AreaLightSource Atmosphere Attribute AttributeBegin AttributeEnd Basis Begin Blobby Bound Clipping ClippingPlane Color ColorSamples ConcatTransform Cone CoordinateSystem CoordSysTransform CropWindow Curves Cylinder DepthOfField Detail DetailRange Disk Displacement Display End ErrorHandler Exposure Exterior Format FrameAspectRatio FrameBegin FrameEnd GeneralPolygon GeometricApproximation Geometry Hider Hyperboloid Identity Illuminate Imager Interior LightSource MakeCubeFaceEnvironment MakeLatLongEnvironment MakeShadow MakeTexture Matte MotionBegin MotionEnd NuPatch ObjectBegin ObjectEnd ObjectInstance Opacity Option Orientation Paraboloid Patch PatchMesh Perspective PixelFilter PixelSamples PixelVariance Points PointsGeneralPolygons PointsPolygons Polygon Procedural Projection Quantize ReadArchive RelativeDetail ReverseOrientation Rotate Scale ScreenWindow ShadingInterpolation ShadingRate Shutter Sides Skew SolidBegin SolidEnd Sphere SubdivisionMesh Surface TextureCoordinates Torus Transform TransformBegin TransformEnd TransformPoints Translate TrimCurve WorldBegin WorldEnd",i:" \r\n]","[\\[\\]\\.,\\+\\-<> \r\n]",{rE:!0,r:0}),{cN:"title",b:"[\\[\\]]",r:0},{cN:"string",b:"[\\.,]",r:0},{b:/\+\+|\-\-/,rB:!0,c:[n]},n]}});hljs.registerLanguage("tap",function(b){return{cI:!0,c:[b.HCM,{cN:"meta",v:[{b:"^TAP version (\\d+)$"},{b:"^1\\.\\.(\\d+)$"}]},{b:"(s+)?---$",e:"\\.\\.\\.$",sL:"yaml",r:0},{cN:"number",b:" (\\d+) "},{cN:"symbol",v:[{b:"^ok"},{b:"^not ok"}]}]}});hljs.registerLanguage("ini",function(e){var b={cN:"string",c:[e.BE],v:[{b:"'''",e:"'''",r:10},{b:'"""',e:'"""',r:10},{b:'"',e:'"'},{b:"'",e:"'"}]};return{aliases:["toml"],cI:!0,i:/\S/,c:[e.C(";","$"),e.HCM,{cN:"section",b:/^\s*\[+/,e:/\]+/},{b:/^[a-z0-9\[\]_-]+\s*=\s*/,e:"$",rB:!0,c:[{cN:"attr",b:/[a-z0-9\[\]_-]+/},{b:/=/,eW:!0,r:0,c:[{cN:"literal",b:/\bon|off|true|false|yes|no\b/},{cN:"variable",v:[{b:/\$[\w\d"][\w\d_]*/},{b:/\$\{(.*?)}/}]},b,{cN:"number",b:/([\+\-]+)?[\d]+_[\d_]+/},e.NM]}]}]}});hljs.registerLanguage("dockerfile",function(e){return{aliases:["docker"],cI:!0,k:"from maintainer expose env user onbuild",c:[e.HCM,e.ASM,e.QSM,e.NM,{bK:"run cmd entrypoint volume add copy workdir label healthcheck",starts:{e:/[^\\]\n/,sL:"bash"}}],i:"",c:[e.TM,{b:/\(/,e:/\)/,c:[n,s,e.CNM,e.CBCM]},{b:/:/,eW:!0,c:[n]},e.CLCM]};return{k:r,c:[a,o,n,t,c,i,s,e.CNM,e.CLCM,e.CBCM]}});hljs.registerLanguage("puppet",function(e){var s={keyword:"and case default else elsif false if in import enherits node or true undef unless main settings $string ",literal:"alias audit before loglevel noop require subscribe tag owner ensure group mode name|0 changes context force incl lens load_path onlyif provider returns root show_diff type_check en_address ip_address realname command environment hour monute month monthday special target weekday creates cwd ogoutput refresh refreshonly tries try_sleep umask backup checksum content ctime force ignore links mtime purge recurse recurselimit replace selinux_ignore_defaults selrange selrole seltype seluser source souirce_permissions sourceselect validate_cmd validate_replacement allowdupe attribute_membership auth_membership forcelocal gid ia_load_module members system host_aliases ip allowed_trunk_vlans description device_url duplex encapsulation etherchannel native_vlan speed principals allow_root auth_class auth_type authenticate_user k_of_n mechanisms rule session_owner shared options device fstype enable hasrestart directory present absent link atboot blockdevice device dump pass remounts poller_tag use message withpath adminfile allow_virtual allowcdrom category configfiles flavor install_options instance package_settings platform responsefile status uninstall_options vendor unless_system_user unless_uid binary control flags hasstatus manifest pattern restart running start stop allowdupe auths expiry gid groups home iterations key_membership keys managehome membership password password_max_age password_min_age profile_membership profiles project purge_ssh_keys role_membership roles salt shell uid baseurl cost descr enabled enablegroups exclude failovermethod gpgcheck gpgkey http_caching include includepkgs keepalive metadata_expire metalink mirrorlist priority protect proxy proxy_password proxy_username repo_gpgcheck s3_enabled skip_if_unavailable sslcacert sslclientcert sslclientkey sslverify mounted",built_in:"architecture augeasversion blockdevices boardmanufacturer boardproductname boardserialnumber cfkey dhcp_servers domain ec2_ ec2_userdata facterversion filesystems ldom fqdn gid hardwareisa hardwaremodel hostname id|0 interfaces ipaddress ipaddress_ ipaddress6 ipaddress6_ iphostnumber is_virtual kernel kernelmajversion kernelrelease kernelversion kernelrelease kernelversion lsbdistcodename lsbdistdescription lsbdistid lsbdistrelease lsbmajdistrelease lsbminordistrelease lsbrelease macaddress macaddress_ macosx_buildversion macosx_productname macosx_productversion macosx_productverson_major macosx_productversion_minor manufacturer memoryfree memorysize netmask metmask_ network_ operatingsystem operatingsystemmajrelease operatingsystemrelease osfamily partitions path physicalprocessorcount processor processorcount productname ps puppetversion rubysitedir rubyversion selinux selinux_config_mode selinux_config_policy selinux_current_mode selinux_current_mode selinux_enforced selinux_policyversion serialnumber sp_ sshdsakey sshecdsakey sshrsakey swapencrypted swapfree swapsize timezone type uniqueid uptime uptime_days uptime_hours uptime_seconds uuid virtual vlans xendomains zfs_version zonenae zones zpool_version"},r=e.C("#","$"),a="([A-Za-z_]|::)(\\w|::)*",i=e.inherit(e.TM,{b:a}),o={cN:"variable",b:"\\$"+a},t={cN:"string",c:[e.BE,o],v:[{b:/'/,e:/'/},{b:/"/,e:/"/}]};return{aliases:["pp"],c:[r,o,t,{bK:"class",e:"\\{|;",i:/=/,c:[i,r]},{bK:"define",e:/\{/,c:[{cN:"section",b:e.IR,endsParent:!0}]},{b:e.IR+"\\s+\\{",rB:!0,e:/\S/,c:[{cN:"keyword",b:e.IR},{b:/\{/,e:/\}/,k:s,r:0,c:[t,r,{b:"[a-zA-Z_]+\\s*=>",rB:!0,e:"=>",c:[{cN:"attr",b:e.IR}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},o]}],r:0}]}});hljs.registerLanguage("erlang-repl",function(e){return{k:{built_in:"spawn spawn_link self",keyword:"after and andalso|10 band begin bnot bor bsl bsr bxor case catch cond div end fun if let not of or orelse|10 query receive rem try when xor"},c:[{cN:"meta",b:"^[0-9]+> ",r:10},e.C("%","$"),{cN:"number",b:"\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)",r:0},e.ASM,e.QSM,{b:"\\?(::)?([A-Z]\\w*(::)?)+"},{b:"->"},{b:"ok"},{b:"!"},{b:"(\\b[a-z'][a-zA-Z0-9_']*:[a-z'][a-zA-Z0-9_']*)|(\\b[a-z'][a-zA-Z0-9_']*)",r:0},{b:"[A-Z][a-zA-Z0-9_']*",r:0}]}});hljs.registerLanguage("gauss",function(e){var t={keyword:"and bool break call callexe checkinterrupt clear clearg closeall cls comlog compile continue create debug declare delete disable dlibrary dllcall do dos ed edit else elseif enable end endfor endif endp endo errorlog errorlogat expr external fn for format goto gosub graph if keyword let lib library line load loadarray loadexe loadf loadk loadm loadp loads loadx local locate loopnextindex lprint lpwidth lshow matrix msym ndpclex new not open or output outwidth plot plotsym pop prcsn print printdos proc push retp return rndcon rndmod rndmult rndseed run save saveall screen scroll setarray show sparse stop string struct system trace trap threadfor threadendfor threadbegin threadjoin threadstat threadend until use while winprint",built_in:"abs acf aconcat aeye amax amean AmericanBinomCall AmericanBinomCall_Greeks AmericanBinomCall_ImpVol AmericanBinomPut AmericanBinomPut_Greeks AmericanBinomPut_ImpVol AmericanBSCall AmericanBSCall_Greeks AmericanBSCall_ImpVol AmericanBSPut AmericanBSPut_Greeks AmericanBSPut_ImpVol amin amult annotationGetDefaults annotationSetBkd annotationSetFont annotationSetLineColor annotationSetLineStyle annotationSetLineThickness annualTradingDays arccos arcsin areshape arrayalloc arrayindex arrayinit arraytomat asciiload asclabel astd astds asum atan atan2 atranspose axmargin balance band bandchol bandcholsol bandltsol bandrv bandsolpd bar base10 begwind besselj bessely beta box boxcox cdfBeta cdfBetaInv cdfBinomial cdfBinomialInv cdfBvn cdfBvn2 cdfBvn2e cdfCauchy cdfCauchyInv cdfChic cdfChii cdfChinc cdfChincInv cdfExp cdfExpInv cdfFc cdfFnc cdfFncInv cdfGam cdfGenPareto cdfHyperGeo cdfLaplace cdfLaplaceInv cdfLogistic cdfLogisticInv cdfmControlCreate cdfMvn cdfMvn2e cdfMvnce cdfMvne cdfMvt2e cdfMvtce cdfMvte cdfN cdfN2 cdfNc cdfNegBinomial cdfNegBinomialInv cdfNi cdfPoisson cdfPoissonInv cdfRayleigh cdfRayleighInv cdfTc cdfTci cdfTnc cdfTvn cdfWeibull cdfWeibullInv cdir ceil ChangeDir chdir chiBarSquare chol choldn cholsol cholup chrs close code cols colsf combinate combinated complex con cond conj cons ConScore contour conv convertsatostr convertstrtosa corrm corrms corrvc corrx corrxs cos cosh counts countwts crossprd crout croutp csrcol csrlin csvReadM csvReadSA cumprodc cumsumc curve cvtos datacreate datacreatecomplex datalist dataload dataloop dataopen datasave date datestr datestring datestrymd dayinyr dayofweek dbAddDatabase dbClose dbCommit dbCreateQuery dbExecQuery dbGetConnectOptions dbGetDatabaseName dbGetDriverName dbGetDrivers dbGetHostName dbGetLastErrorNum dbGetLastErrorText dbGetNumericalPrecPolicy dbGetPassword dbGetPort dbGetTableHeaders dbGetTables dbGetUserName dbHasFeature dbIsDriverAvailable dbIsOpen dbIsOpenError dbOpen dbQueryBindValue dbQueryClear dbQueryCols dbQueryExecPrepared dbQueryFetchAllM dbQueryFetchAllSA dbQueryFetchOneM dbQueryFetchOneSA dbQueryFinish dbQueryGetBoundValue dbQueryGetBoundValues dbQueryGetField dbQueryGetLastErrorNum dbQueryGetLastErrorText dbQueryGetLastInsertID dbQueryGetLastQuery dbQueryGetPosition dbQueryIsActive dbQueryIsForwardOnly dbQueryIsNull dbQueryIsSelect dbQueryIsValid dbQueryPrepare dbQueryRows dbQuerySeek dbQuerySeekFirst dbQuerySeekLast dbQuerySeekNext dbQuerySeekPrevious dbQuerySetForwardOnly dbRemoveDatabase dbRollback dbSetConnectOptions dbSetDatabaseName dbSetHostName dbSetNumericalPrecPolicy dbSetPort dbSetUserName dbTransaction DeleteFile delif delrows denseToSp denseToSpRE denToZero design det detl dfft dffti diag diagrv digamma doswin DOSWinCloseall DOSWinOpen dotfeq dotfeqmt dotfge dotfgemt dotfgt dotfgtmt dotfle dotflemt dotflt dotfltmt dotfne dotfnemt draw drop dsCreate dstat dstatmt dstatmtControlCreate dtdate dtday dttime dttodtv dttostr dttoutc dtvnormal dtvtodt dtvtoutc dummy dummybr dummydn eig eigh eighv eigv elapsedTradingDays endwind envget eof eqSolve eqSolvemt eqSolvemtControlCreate eqSolvemtOutCreate eqSolveset erf erfc erfccplx erfcplx error etdays ethsec etstr EuropeanBinomCall EuropeanBinomCall_Greeks EuropeanBinomCall_ImpVol EuropeanBinomPut EuropeanBinomPut_Greeks EuropeanBinomPut_ImpVol EuropeanBSCall EuropeanBSCall_Greeks EuropeanBSCall_ImpVol EuropeanBSPut EuropeanBSPut_Greeks EuropeanBSPut_ImpVol exctsmpl exec execbg exp extern eye fcheckerr fclearerr feq feqmt fflush fft ffti fftm fftmi fftn fge fgemt fgets fgetsa fgetsat fgetst fgt fgtmt fileinfo filesa fle flemt floor flt fltmt fmod fne fnemt fonts fopen formatcv formatnv fputs fputst fseek fstrerror ftell ftocv ftos ftostrC gamma gammacplx gammaii gausset gdaAppend gdaCreate gdaDStat gdaDStatMat gdaGetIndex gdaGetName gdaGetNames gdaGetOrders gdaGetType gdaGetTypes gdaGetVarInfo gdaIsCplx gdaLoad gdaPack gdaRead gdaReadByIndex gdaReadSome gdaReadSparse gdaReadStruct gdaReportVarInfo gdaSave gdaUpdate gdaUpdateAndPack gdaVars gdaWrite gdaWrite32 gdaWriteSome getarray getdims getf getGAUSShome getmatrix getmatrix4D getname getnamef getNextTradingDay getNextWeekDay getnr getorders getpath getPreviousTradingDay getPreviousWeekDay getRow getscalar3D getscalar4D getTrRow getwind glm gradcplx gradMT gradMTm gradMTT gradMTTm gradp graphprt graphset hasimag header headermt hess hessMT hessMTg hessMTgw hessMTm hessMTmw hessMTT hessMTTg hessMTTgw hessMTTm hessMTw hessp hist histf histp hsec imag indcv indexcat indices indices2 indicesf indicesfn indnv indsav integrate1d integrateControlCreate intgrat2 intgrat3 inthp1 inthp2 inthp3 inthp4 inthpControlCreate intquad1 intquad2 intquad3 intrleav intrleavsa intrsect intsimp inv invpd invswp iscplx iscplxf isden isinfnanmiss ismiss key keyav keyw lag lag1 lagn lapEighb lapEighi lapEighvb lapEighvi lapgEig lapgEigh lapgEighv lapgEigv lapgSchur lapgSvdcst lapgSvds lapgSvdst lapSvdcusv lapSvds lapSvdusv ldlp ldlsol linSolve listwise ln lncdfbvn lncdfbvn2 lncdfmvn lncdfn lncdfn2 lncdfnc lnfact lngammacplx lnpdfmvn lnpdfmvt lnpdfn lnpdft loadd loadstruct loadwind loess loessmt loessmtControlCreate log loglog logx logy lower lowmat lowmat1 ltrisol lu lusol machEpsilon make makevars makewind margin matalloc matinit mattoarray maxbytes maxc maxindc maxv maxvec mbesselei mbesselei0 mbesselei1 mbesseli mbesseli0 mbesseli1 meanc median mergeby mergevar minc minindc minv miss missex missrv moment momentd movingave movingaveExpwgt movingaveWgt nextindex nextn nextnevn nextwind ntos null null1 numCombinations ols olsmt olsmtControlCreate olsqr olsqr2 olsqrmt ones optn optnevn orth outtyp pacf packedToSp packr parse pause pdfCauchy pdfChi pdfExp pdfGenPareto pdfHyperGeo pdfLaplace pdfLogistic pdfn pdfPoisson pdfRayleigh pdfWeibull pi pinv pinvmt plotAddArrow plotAddBar plotAddBox plotAddHist plotAddHistF plotAddHistP plotAddPolar plotAddScatter plotAddShape plotAddTextbox plotAddTS plotAddXY plotArea plotBar plotBox plotClearLayout plotContour plotCustomLayout plotGetDefaults plotHist plotHistF plotHistP plotLayout plotLogLog plotLogX plotLogY plotOpenWindow plotPolar plotSave plotScatter plotSetAxesPen plotSetBar plotSetBarFill plotSetBarStacked plotSetBkdColor plotSetFill plotSetGrid plotSetLegend plotSetLineColor plotSetLineStyle plotSetLineSymbol plotSetLineThickness plotSetNewWindow plotSetTitle plotSetWhichYAxis plotSetXAxisShow plotSetXLabel plotSetXRange plotSetXTicInterval plotSetXTicLabel plotSetYAxisShow plotSetYLabel plotSetYRange plotSetZAxisShow plotSetZLabel plotSurface plotTS plotXY polar polychar polyeval polygamma polyint polymake polymat polymroot polymult polyroot pqgwin previousindex princomp printfm printfmt prodc psi putarray putf putvals pvCreate pvGetIndex pvGetParNames pvGetParVector pvLength pvList pvPack pvPacki pvPackm pvPackmi pvPacks pvPacksi pvPacksm pvPacksmi pvPutParVector pvTest pvUnpack QNewton QNewtonmt QNewtonmtControlCreate QNewtonmtOutCreate QNewtonSet QProg QProgmt QProgmtInCreate qqr qqre qqrep qr qre qrep qrsol qrtsol qtyr qtyre qtyrep quantile quantiled qyr qyre qyrep qz rank rankindx readr real reclassify reclassifyCuts recode recserar recsercp recserrc rerun rescale reshape rets rev rfft rffti rfftip rfftn rfftnp rfftp rndBernoulli rndBeta rndBinomial rndCauchy rndChiSquare rndCon rndCreateState rndExp rndGamma rndGeo rndGumbel rndHyperGeo rndi rndKMbeta rndKMgam rndKMi rndKMn rndKMnb rndKMp rndKMu rndKMvm rndLaplace rndLCbeta rndLCgam rndLCi rndLCn rndLCnb rndLCp rndLCu rndLCvm rndLogNorm rndMTu rndMVn rndMVt rndn rndnb rndNegBinomial rndp rndPoisson rndRayleigh rndStateSkip rndu rndvm rndWeibull rndWishart rotater round rows rowsf rref sampleData satostrC saved saveStruct savewind scale scale3d scalerr scalinfnanmiss scalmiss schtoc schur searchsourcepath seekr select selif seqa seqm setdif setdifsa setvars setvwrmode setwind shell shiftr sin singleindex sinh sleep solpd sortc sortcc sortd sorthc sorthcc sortind sortindc sortmc sortr sortrc spBiconjGradSol spChol spConjGradSol spCreate spDenseSubmat spDiagRvMat spEigv spEye spLDL spline spLU spNumNZE spOnes spreadSheetReadM spreadSheetReadSA spreadSheetWrite spScale spSubmat spToDense spTrTDense spTScalar spZeros sqpSolve sqpSolveMT sqpSolveMTControlCreate sqpSolveMTlagrangeCreate sqpSolveMToutCreate sqpSolveSet sqrt statements stdc stdsc stocv stof strcombine strindx strlen strput strrindx strsect strsplit strsplitPad strtodt strtof strtofcplx strtriml strtrimr strtrunc strtruncl strtruncpad strtruncr submat subscat substute subvec sumc sumr surface svd svd1 svd2 svdcusv svds svdusv sysstate tab tan tanh tempname threadBegin threadEnd threadEndFor threadFor threadJoin threadStat time timedt timestr timeutc title tkf2eps tkf2ps tocart todaydt toeplitz token topolar trapchk trigamma trimr trunc type typecv typef union unionsa uniqindx uniqindxsa unique uniquesa upmat upmat1 upper utctodt utctodtv utrisol vals varCovMS varCovXS varget vargetl varmall varmares varput varputl vartypef vcm vcms vcx vcxs vec vech vecr vector vget view viewxyz vlist vnamecv volume vput vread vtypecv wait waitc walkindex where window writer xlabel xlsGetSheetCount xlsGetSheetSize xlsGetSheetTypes xlsMakeRange xlsReadM xlsReadSA xlsWrite xlsWriteM xlsWriteSA xpnd xtics xy xyz ylabel ytics zeros zeta zlabel ztics cdfEmpirical dot h5create h5open h5read h5readAttribute h5write h5writeAttribute ldl plotAddErrorBar plotAddSurface plotCDFEmpirical plotSetColormap plotSetContourLabels plotSetLegendFont plotSetTextInterpreter plotSetXTicCount plotSetYTicCount plotSetZLevels powerm strjoin strtrim sylvester",literal:"DB_AFTER_LAST_ROW DB_ALL_TABLES DB_BATCH_OPERATIONS DB_BEFORE_FIRST_ROW DB_BLOB DB_EVENT_NOTIFICATIONS DB_FINISH_QUERY DB_HIGH_PRECISION DB_LAST_INSERT_ID DB_LOW_PRECISION_DOUBLE DB_LOW_PRECISION_INT32 DB_LOW_PRECISION_INT64 DB_LOW_PRECISION_NUMBERS DB_MULTIPLE_RESULT_SETS DB_NAMED_PLACEHOLDERS DB_POSITIONAL_PLACEHOLDERS DB_PREPARED_QUERIES DB_QUERY_SIZE DB_SIMPLE_LOCKING DB_SYSTEM_TABLES DB_TABLES DB_TRANSACTIONS DB_UNICODE DB_VIEWS"},a={cN:"meta",b:"#",e:"$",k:{"meta-keyword":"define definecs|10 undef ifdef ifndef iflight ifdllcall ifmac ifos2win ifunix else endif lineson linesoff srcfile srcline"},c:[{b:/\\\n/,r:0},{bK:"include",e:"$",k:{"meta-keyword":"include"},c:[{cN:"meta-string",b:'"',e:'"',i:"\\n"}]},e.CLCM,e.CBCM]},r=e.UIR+"\\s*\\(?",o=[{cN:"params",b:/\(/,e:/\)/,k:t,r:0,c:[e.CNM,e.CLCM,e.CBCM]}];return{aliases:["gss"],cI:!0,k:t,i:"(\\{[%#]|[%#]\\})",c:[e.CNM,e.CLCM,e.CBCM,e.C("@","@"),a,{cN:"string",b:'"',e:'"',c:[e.BE]},{cN:"function",bK:"proc keyword",e:";",eE:!0,k:t,c:[{b:r,rB:!0,c:[e.UTM],r:0},e.CNM,e.CLCM,e.CBCM,a].concat(o)},{cN:"function",bK:"fn",e:";",eE:!0,k:t,c:[{b:r+e.IR+"\\)?\\s*\\=\\s*",rB:!0,c:[e.UTM],r:0},e.CNM,e.CLCM,e.CBCM].concat(o)},{cN:"function",b:"\\bexternal (proc|keyword|fn)\\s+",e:";",eE:!0,k:t,c:[{b:r,rB:!0,c:[e.UTM],r:0},e.CLCM,e.CBCM]},{cN:"function",b:"\\bexternal (matrix|string|array|sparse matrix|struct "+e.IR+")\\s+",e:";",eE:!0,k:t,c:[e.CLCM,e.CBCM]}]}});hljs.registerLanguage("processing",function(e){return{k:{keyword:"BufferedReader PVector PFont PImage PGraphics HashMap boolean byte char color double float int long String Array FloatDict FloatList IntDict IntList JSONArray JSONObject Object StringDict StringList Table TableRow XML false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private",literal:"P2D P3D HALF_PI PI QUARTER_PI TAU TWO_PI",title:"setup draw",built_in:"displayHeight displayWidth mouseY mouseX mousePressed pmouseX pmouseY key keyCode pixels focused frameCount frameRate height width size createGraphics beginDraw createShape loadShape PShape arc ellipse line point quad rect triangle bezier bezierDetail bezierPoint bezierTangent curve curveDetail curvePoint curveTangent curveTightness shape shapeMode beginContour beginShape bezierVertex curveVertex endContour endShape quadraticVertex vertex ellipseMode noSmooth rectMode smooth strokeCap strokeJoin strokeWeight mouseClicked mouseDragged mouseMoved mousePressed mouseReleased mouseWheel keyPressed keyPressedkeyReleased keyTyped print println save saveFrame day hour millis minute month second year background clear colorMode fill noFill noStroke stroke alpha blue brightness color green hue lerpColor red saturation modelX modelY modelZ screenX screenY screenZ ambient emissive shininess specular add createImage beginCamera camera endCamera frustum ortho perspective printCamera printProjection cursor frameRate noCursor exit loop noLoop popStyle pushStyle redraw binary boolean byte char float hex int str unbinary unhex join match matchAll nf nfc nfp nfs split splitTokens trim append arrayCopy concat expand reverse shorten sort splice subset box sphere sphereDetail createInput createReader loadBytes loadJSONArray loadJSONObject loadStrings loadTable loadXML open parseXML saveTable selectFolder selectInput beginRaw beginRecord createOutput createWriter endRaw endRecord PrintWritersaveBytes saveJSONArray saveJSONObject saveStream saveStrings saveXML selectOutput popMatrix printMatrix pushMatrix resetMatrix rotate rotateX rotateY rotateZ scale shearX shearY translate ambientLight directionalLight lightFalloff lights lightSpecular noLights normal pointLight spotLight image imageMode loadImage noTint requestImage tint texture textureMode textureWrap blend copy filter get loadPixels set updatePixels blendMode loadShader PShaderresetShader shader createFont loadFont text textFont textAlign textLeading textMode textSize textWidth textAscent textDescent abs ceil constrain dist exp floor lerp log mag map max min norm pow round sq sqrt acos asin atan atan2 cos degrees radians sin tan noise noiseDetail noiseSeed random randomGaussian randomSeed"},c:[e.CLCM,e.CBCM,e.ASM,e.QSM,e.CNM]}});hljs.registerLanguage("powershell",function(e){var t={b:"`[\\s\\S]",r:0},o={cN:"variable",v:[{b:/\$[\w\d][\w\d_:]*/}]},r={cN:"literal",b:/\$(null|true|false)\b/},n={cN:"string",v:[{b:/"/,e:/"/},{b:/@"/,e:/^"@/}],c:[t,o,{cN:"variable",b:/\$[A-z]/,e:/[^A-z]/}]},a={cN:"string",v:[{b:/'/,e:/'/},{b:/@'/,e:/^'@/}]},i={cN:"doctag",v:[{b:/\.(synopsis|description|example|inputs|outputs|notes|link|component|role|functionality)/},{b:/\.(parameter|forwardhelptargetname|forwardhelpcategory|remotehelprunspace|externalhelp)\s+\S+/}]},s=e.inherit(e.C(null,null),{v:[{b:/#/,e:/$/},{b:/<#/,e:/#>/}],c:[i]});return{aliases:["ps"],l:/-?[A-z\.\-]+/,cI:!0,k:{keyword:"if else foreach return function do while until elseif begin for trap data dynamicparam end break throw param continue finally in switch exit filter try process catch",built_in:"Add-Computer Add-Content Add-History Add-JobTrigger Add-Member Add-PSSnapin Add-Type Checkpoint-Computer Clear-Content Clear-EventLog Clear-History Clear-Host Clear-Item Clear-ItemProperty Clear-Variable Compare-Object Complete-Transaction Connect-PSSession Connect-WSMan Convert-Path ConvertFrom-Csv ConvertFrom-Json ConvertFrom-SecureString ConvertFrom-StringData ConvertTo-Csv ConvertTo-Html ConvertTo-Json ConvertTo-SecureString ConvertTo-Xml Copy-Item Copy-ItemProperty Debug-Process Disable-ComputerRestore Disable-JobTrigger Disable-PSBreakpoint Disable-PSRemoting Disable-PSSessionConfiguration Disable-WSManCredSSP Disconnect-PSSession Disconnect-WSMan Disable-ScheduledJob Enable-ComputerRestore Enable-JobTrigger Enable-PSBreakpoint Enable-PSRemoting Enable-PSSessionConfiguration Enable-ScheduledJob Enable-WSManCredSSP Enter-PSSession Exit-PSSession Export-Alias Export-Clixml Export-Console Export-Counter Export-Csv Export-FormatData Export-ModuleMember Export-PSSession ForEach-Object Format-Custom Format-List Format-Table Format-Wide Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem Get-Command Get-ComputerRestorePoint Get-Content Get-ControlPanelItem Get-Counter Get-Credential Get-Culture Get-Date Get-Event Get-EventLog Get-EventSubscriber Get-ExecutionPolicy Get-FormatData Get-Host Get-HotFix Get-Help Get-History Get-IseSnippet Get-Item Get-ItemProperty Get-Job Get-JobTrigger Get-Location Get-Member Get-Module Get-PfxCertificate Get-Process Get-PSBreakpoint Get-PSCallStack Get-PSDrive Get-PSProvider Get-PSSession Get-PSSessionConfiguration Get-PSSnapin Get-Random Get-ScheduledJob Get-ScheduledJobOption Get-Service Get-TraceSource Get-Transaction Get-TypeData Get-UICulture Get-Unique Get-Variable Get-Verb Get-WinEvent Get-WmiObject Get-WSManCredSSP Get-WSManInstance Group-Object Import-Alias Import-Clixml Import-Counter Import-Csv Import-IseSnippet Import-LocalizedData Import-PSSession Import-Module Invoke-AsWorkflow Invoke-Command Invoke-Expression Invoke-History Invoke-Item Invoke-RestMethod Invoke-WebRequest Invoke-WmiMethod Invoke-WSManAction Join-Path Limit-EventLog Measure-Command Measure-Object Move-Item Move-ItemProperty New-Alias New-Event New-EventLog New-IseSnippet New-Item New-ItemProperty New-JobTrigger New-Object New-Module New-ModuleManifest New-PSDrive New-PSSession New-PSSessionConfigurationFile New-PSSessionOption New-PSTransportOption New-PSWorkflowExecutionOption New-PSWorkflowSession New-ScheduledJobOption New-Service New-TimeSpan New-Variable New-WebServiceProxy New-WinEvent New-WSManInstance New-WSManSessionOption Out-Default Out-File Out-GridView Out-Host Out-Null Out-Printer Out-String Pop-Location Push-Location Read-Host Receive-Job Register-EngineEvent Register-ObjectEvent Register-PSSessionConfiguration Register-ScheduledJob Register-WmiEvent Remove-Computer Remove-Event Remove-EventLog Remove-Item Remove-ItemProperty Remove-Job Remove-JobTrigger Remove-Module Remove-PSBreakpoint Remove-PSDrive Remove-PSSession Remove-PSSnapin Remove-TypeData Remove-Variable Remove-WmiObject Remove-WSManInstance Rename-Computer Rename-Item Rename-ItemProperty Reset-ComputerMachinePassword Resolve-Path Restart-Computer Restart-Service Restore-Computer Resume-Job Resume-Service Save-Help Select-Object Select-String Select-Xml Send-MailMessage Set-Acl Set-Alias Set-AuthenticodeSignature Set-Content Set-Date Set-ExecutionPolicy Set-Item Set-ItemProperty Set-JobTrigger Set-Location Set-PSBreakpoint Set-PSDebug Set-PSSessionConfiguration Set-ScheduledJob Set-ScheduledJobOption Set-Service Set-StrictMode Set-TraceSource Set-Variable Set-WmiInstance Set-WSManInstance Set-WSManQuickConfig Show-Command Show-ControlPanelItem Show-EventLog Sort-Object Split-Path Start-Job Start-Process Start-Service Start-Sleep Start-Transaction Start-Transcript Stop-Computer Stop-Job Stop-Process Stop-Service Stop-Transcript Suspend-Job Suspend-Service Tee-Object Test-ComputerSecureChannel Test-Connection Test-ModuleManifest Test-Path Test-PSSessionConfigurationFile Trace-Command Unblock-File Undo-Transaction Unregister-Event Unregister-PSSessionConfiguration Unregister-ScheduledJob Update-FormatData Update-Help Update-List Update-TypeData Use-Transaction Wait-Event Wait-Job Wait-Process Where-Object Write-Debug Write-Error Write-EventLog Write-Host Write-Output Write-Progress Write-Verbose Write-Warning Add-MDTPersistentDrive Disable-MDTMonitorService Enable-MDTMonitorService Get-MDTDeploymentShareStatistics Get-MDTMonitorData Get-MDTOperatingSystemCatalog Get-MDTPersistentDrive Import-MDTApplication Import-MDTDriver Import-MDTOperatingSystem Import-MDTPackage Import-MDTTaskSequence New-MDTDatabase Remove-MDTMonitorData Remove-MDTPersistentDrive Restore-MDTPersistentDrive Set-MDTMonitorData Test-MDTDeploymentShare Test-MDTMonitorData Update-MDTDatabaseSchema Update-MDTDeploymentShare Update-MDTLinkedDS Update-MDTMedia Update-MDTMedia Add-VamtProductKey Export-VamtData Find-VamtManagedMachine Get-VamtConfirmationId Get-VamtProduct Get-VamtProductKey Import-VamtData Initialize-VamtData Install-VamtConfirmationId Install-VamtProductActivation Install-VamtProductKey Update-VamtProduct",nomarkup:"-ne -eq -lt -gt -ge -le -not -like -notlike -match -notmatch -contains -notcontains -in -notin -replace"},c:[t,e.NM,n,a,r,o,s]}});hljs.registerLanguage("coffeescript",function(e){var c={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super yield import export from as default await then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",built_in:"npm require console print module global window document"},n="[A-Za-z$_][0-9A-Za-z$_]*",r={cN:"subst",b:/#\{/,e:/}/,k:c},i=[e.BNM,e.inherit(e.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'''/,e:/'''/,c:[e.BE]},{b:/'/,e:/'/,c:[e.BE]},{b:/"""/,e:/"""/,c:[e.BE,r]},{b:/"/,e:/"/,c:[e.BE,r]}]},{cN:"regexp",v:[{b:"///",e:"///",c:[r,e.HCM]},{b:"//[gim]*",r:0},{b:/\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/}]},{b:"@"+n},{sL:"javascript",eB:!0,eE:!0,v:[{b:"```",e:"```"},{b:"`",e:"`"}]}];r.c=i;var s=e.inherit(e.TM,{b:n}),t="(\\(.*\\))?\\s*\\B[-=]>",o={cN:"params",b:"\\([^\\(]",rB:!0,c:[{b:/\(/,e:/\)/,k:c,c:["self"].concat(i)}]};return{aliases:["coffee","cson","iced"],k:c,i:/\/\*/,c:i.concat([e.C("###","###"),e.HCM,{cN:"function",b:"^\\s*"+n+"\\s*=\\s*"+t,e:"[-=]>",rB:!0,c:[s,o]},{b:/[:\(,=]\s*/,r:0,c:[{cN:"function",b:t,e:"[-=]>",rB:!0,c:[o]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[s]},s]},{b:n+":",e:":",rB:!0,rE:!0,r:0}])}});hljs.registerLanguage("coq",function(e){return{k:{keyword:"_ as at cofix else end exists exists2 fix for forall fun if IF in let match mod Prop return Set then Type using where with Abort About Add Admit Admitted All Arguments Assumptions Axiom Back BackTo Backtrack Bind Blacklist Canonical Cd Check Class Classes Close Coercion Coercions CoFixpoint CoInductive Collection Combined Compute Conjecture Conjectures Constant constr Constraint Constructors Context Corollary CreateHintDb Cut Declare Defined Definition Delimit Dependencies DependentDerive Drop eauto End Equality Eval Example Existential Existentials Existing Export exporting Extern Extract Extraction Fact Field Fields File Fixpoint Focus for From Function Functional Generalizable Global Goal Grab Grammar Graph Guarded Heap Hint HintDb Hints Hypotheses Hypothesis ident Identity If Immediate Implicit Import Include Inductive Infix Info Initial Inline Inspect Instance Instances Intro Intros Inversion Inversion_clear Language Left Lemma Let Libraries Library Load LoadPath Local Locate Ltac ML Mode Module Modules Monomorphic Morphism Next NoInline Notation Obligation Obligations Opaque Open Optimize Options Parameter Parameters Parametric Path Paths pattern Polymorphic Preterm Print Printing Program Projections Proof Proposition Pwd Qed Quit Rec Record Recursive Redirect Relation Remark Remove Require Reserved Reset Resolve Restart Rewrite Right Ring Rings Save Scheme Scope Scopes Script Search SearchAbout SearchHead SearchPattern SearchRewrite Section Separate Set Setoid Show Solve Sorted Step Strategies Strategy Structure SubClass Table Tables Tactic Term Test Theorem Time Timeout Transparent Type Typeclasses Types Undelimit Undo Unfocus Unfocused Unfold Universe Universes Unset Unshelve using Variable Variables Variant Verbose Visibility where with",built_in:"abstract absurd admit after apply as assert assumption at auto autorewrite autounfold before bottom btauto by case case_eq cbn cbv change classical_left classical_right clear clearbody cofix compare compute congruence constr_eq constructor contradict contradiction cut cutrewrite cycle decide decompose dependent destruct destruction dintuition discriminate discrR do double dtauto eapply eassumption eauto ecase econstructor edestruct ediscriminate eelim eexact eexists einduction einjection eleft elim elimtype enough equality erewrite eright esimplify_eq esplit evar exact exactly_once exfalso exists f_equal fail field field_simplify field_simplify_eq first firstorder fix fold fourier functional generalize generalizing gfail give_up has_evar hnf idtac in induction injection instantiate intro intro_pattern intros intuition inversion inversion_clear is_evar is_var lapply lazy left lia lra move native_compute nia nsatz omega once pattern pose progress proof psatz quote record red refine reflexivity remember rename repeat replace revert revgoals rewrite rewrite_strat right ring ring_simplify rtauto set setoid_reflexivity setoid_replace setoid_rewrite setoid_symmetry setoid_transitivity shelve shelve_unifiable simpl simple simplify_eq solve specialize split split_Rabs split_Rmult stepl stepr subst sum swap symmetry tactic tauto time timeout top transitivity trivial try tryif unfold unify until using vm_compute with"},c:[e.QSM,e.C("\\(\\*","\\*\\)"),e.CNM,{cN:"type",eB:!0,b:"\\|\\s*",e:"\\w+"},{b:/[-=]>/}]}});hljs.registerLanguage("less",function(e){var r="[\\w-]+",t="("+r+"|@{"+r+"})",a=[],c=[],s=function(e){return{cN:"string",b:"~?"+e+".*?"+e}},b=function(e,r,t){return{cN:e,b:r,r:t}},n={b:"\\(",e:"\\)",c:c,r:0};c.push(e.CLCM,e.CBCM,s("'"),s('"'),e.CSSNM,{b:"(url|data-uri)\\(",starts:{cN:"string",e:"[\\)\\n]",eE:!0}},b("number","#[0-9A-Fa-f]+\\b"),n,b("variable","@@?"+r,10),b("variable","@{"+r+"}"),b("built_in","~?`[^`]*?`"),{cN:"attribute",b:r+"\\s*:",e:":",rB:!0,eE:!0},{cN:"meta",b:"!important"});var i=c.concat({b:"{",e:"}",c:a}),o={bK:"when",eW:!0,c:[{bK:"and not"}].concat(c)},u={b:t+"\\s*:",rB:!0,e:"[;}]",r:0,c:[{cN:"attribute",b:t,e:":",eE:!0,starts:{eW:!0,i:"[<=$]",r:0,c:c}}]},l={cN:"keyword",b:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{e:"[;{}]",rE:!0,c:c,r:0}},C={cN:"variable",v:[{b:"@"+r+"\\s*:",r:15},{b:"@"+r}],starts:{e:"[;}]",rE:!0,c:i}},p={v:[{b:"[\\.#:&\\[>]",e:"[;{}]"},{b:t,e:"{"}],rB:!0,rE:!0,i:"[<='$\"]",r:0,c:[e.CLCM,e.CBCM,o,b("keyword","all\\b"),b("variable","@{"+r+"}"),b("selector-tag",t+"%?",0),b("selector-id","#"+t),b("selector-class","\\."+t,0),b("selector-tag","&",0),{cN:"selector-attr",b:"\\[",e:"\\]"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"\\(",e:"\\)",c:i},{b:"!important"}]};return a.push(e.CLCM,e.CBCM,l,C,u,p),{cI:!0,i:"[=>'/<($\"]",c:a}});hljs.registerLanguage("dart",function(e){var t={cN:"subst",b:"\\$\\{",e:"}",k:"true false null this is new super"},r={cN:"string",v:[{b:"r'''",e:"'''"},{b:'r"""',e:'"""'},{b:"r'",e:"'",i:"\\n"},{b:'r"',e:'"',i:"\\n"},{b:"'''",e:"'''",c:[e.BE,t]},{b:'"""',e:'"""',c:[e.BE,t]},{b:"'",e:"'",i:"\\n",c:[e.BE,t]},{b:'"',e:'"',i:"\\n",c:[e.BE,t]}]};t.c=[e.CNM,r];var n={keyword:"assert async await break case catch class const continue default do else enum extends false final finally for if in is new null rethrow return super switch sync this throw true try var void while with yield abstract as dynamic export external factory get implements import library operator part set static typedef",built_in:"print Comparable DateTime Duration Function Iterable Iterator List Map Match Null Object Pattern RegExp Set Stopwatch String StringBuffer StringSink Symbol Type Uri bool double int num document window querySelector querySelectorAll Element ElementList"};return{k:n,c:[r,e.C("/\\*\\*","\\*/",{sL:"markdown"}),e.C("///","$",{sL:"markdown"}),e.CLCM,e.CBCM,{cN:"class",bK:"class interface",e:"{",eE:!0,c:[{bK:"extends implements"},e.UTM]},e.CNM,{cN:"meta",b:"@[A-Za-z]+"},{b:"=>"}]}});hljs.registerLanguage("capnproto",function(t){return{aliases:["capnp"],k:{keyword:"struct enum interface union group import using const annotation extends in of on as with from fixed",built_in:"Void Bool Int8 Int16 Int32 Int64 UInt8 UInt16 UInt32 UInt64 Float32 Float64 Text Data AnyPointer AnyStruct Capability List",literal:"true false"},c:[t.QSM,t.NM,t.HCM,{cN:"meta",b:/@0x[\w\d]{16};/,i:/\n/},{cN:"symbol",b:/@\d+\b/},{cN:"class",bK:"struct enum",e:/\{/,i:/\n/,c:[t.inherit(t.TM,{starts:{eW:!0,eE:!0}})]},{cN:"class",bK:"interface",e:/\{/,i:/\n/,c:[t.inherit(t.TM,{starts:{eW:!0,eE:!0}})]}]}});hljs.registerLanguage("livescript",function(e){var t={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger case default function var with then unless until loop of by when and or is isnt not it that otherwise from to til fallthrough super case default function var void const let enum export import native __hasProp __extends __slice __bind __indexOf",literal:"true false null undefined yes no on off it that void",built_in:"npm require console print module global window document"},s="[A-Za-z$_](?:-[0-9A-Za-z$_]|[0-9A-Za-z$_])*",n=e.inherit(e.TM,{b:s}),i={cN:"subst",b:/#\{/,e:/}/,k:t},r={cN:"subst",b:/#[A-Za-z$_]/,e:/(?:\-[0-9A-Za-z$_]|[0-9A-Za-z$_])*/,k:t},c=[e.BNM,{cN:"number",b:"(\\b0[xX][a-fA-F0-9_]+)|(\\b\\d(\\d|_\\d)*(\\.(\\d(\\d|_\\d)*)?)?(_*[eE]([-+]\\d(_\\d|\\d)*)?)?[_a-z]*)",r:0,starts:{e:"(\\s*/)?",r:0}},{cN:"string",v:[{b:/'''/,e:/'''/,c:[e.BE]},{b:/'/,e:/'/,c:[e.BE]},{b:/"""/,e:/"""/,c:[e.BE,i,r]},{b:/"/,e:/"/,c:[e.BE,i,r]},{b:/\\/,e:/(\s|$)/,eE:!0}]},{cN:"regexp",v:[{b:"//",e:"//[gim]*",c:[i,e.HCM]},{b:/\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/}]},{b:"@"+s},{b:"``",e:"``",eB:!0,eE:!0,sL:"javascript"}];i.c=c;var a={cN:"params",b:"\\(",rB:!0,c:[{b:/\(/,e:/\)/,k:t,c:["self"].concat(c)}]};return{aliases:["ls"],k:t,i:/\/\*/,c:c.concat([e.C("\\/\\*","\\*\\/"),e.HCM,{cN:"function",c:[n,a],rB:!0,v:[{b:"("+s+"\\s*(?:=|:=)\\s*)?(\\(.*\\))?\\s*\\B\\->\\*?",e:"\\->\\*?"},{b:"("+s+"\\s*(?:=|:=)\\s*)?!?(\\(.*\\))?\\s*\\B[-~]{1,2}>\\*?",e:"[-~]{1,2}>\\*?"},{b:"("+s+"\\s*(?:=|:=)\\s*)?(\\(.*\\))?\\s*\\B!?[-~]{1,2}>\\*?",e:"!?[-~]{1,2}>\\*?"}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[n]},n]},{b:s+":",e:":",rB:!0,rE:!0,r:0}])}});hljs.registerLanguage("scheme",function(e){var t="[^\\(\\)\\[\\]\\{\\}\",'`;#|\\\\\\s]+",r="(\\-|\\+)?\\d+([./]\\d+)?",a=r+"[+\\-]"+r+"i",i={"builtin-name":"case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules ' * + , ,@ - ... / ; < <= = => > >= ` abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string=? string>? string? substring symbol->string symbol? tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?"},n={cN:"meta",b:"^#!",e:"$"},c={cN:"literal",b:"(#t|#f|#\\\\"+t+"|#\\\\.)"},l={cN:"number",v:[{b:r,r:0},{b:a,r:0},{b:"#b[0-1]+(/[0-1]+)?"},{b:"#o[0-7]+(/[0-7]+)?"},{b:"#x[0-9a-f]+(/[0-9a-f]+)?"}]},s=e.QSM,o=[e.C(";","$",{r:0}),e.C("#\\|","\\|#")],u={b:t,r:0},p={cN:"symbol",b:"'"+t},d={eW:!0,r:0},m={v:[{b:/'/},{b:"`"}],c:[{b:"\\(",e:"\\)",c:["self",c,s,l,u,p]}]},g={cN:"name",b:t,l:t,k:i},h={b:/lambda/,eW:!0,rB:!0,c:[g,{b:/\(/,e:/\)/,endsParent:!0,c:[u]}]},b={v:[{b:"\\(",e:"\\)"},{b:"\\[",e:"\\]"}],c:[h,g,d]};return d.c=[c,l,s,u,p,m,b].concat(o),{i:/\S/,c:[n,l,s,p,m,b].concat(o)}});hljs.registerLanguage("asciidoc",function(e){return{aliases:["adoc"],c:[e.C("^/{4,}\\n","\\n/{4,}$",{r:10}),e.C("^//","$",{r:0}),{cN:"title",b:"^\\.\\w.*$"},{b:"^[=\\*]{4,}\\n",e:"\\n^[=\\*]{4,}$",r:10},{cN:"section",r:10,v:[{b:"^(={1,5}) .+?( \\1)?$"},{b:"^[^\\[\\]\\n]+?\\n[=\\-~\\^\\+]{2,}$"}]},{cN:"meta",b:"^:.+?:",e:"\\s",eE:!0,r:10},{cN:"meta",b:"^\\[.+?\\]$",r:0},{cN:"quote",b:"^_{4,}\\n",e:"\\n_{4,}$",r:10},{cN:"code",b:"^[\\-\\.]{4,}\\n",e:"\\n[\\-\\.]{4,}$",r:10},{b:"^\\+{4,}\\n",e:"\\n\\+{4,}$",c:[{b:"<",e:">",sL:"xml",r:0}],r:10},{cN:"bullet",b:"^(\\*+|\\-+|\\.+|[^\\n]+?::)\\s+"},{cN:"symbol",b:"^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\s+",r:10},{cN:"strong",b:"\\B\\*(?![\\*\\s])",e:"(\\n{2}|\\*)",c:[{b:"\\\\*\\w",r:0}]},{cN:"emphasis",b:"\\B'(?!['\\s])",e:"(\\n{2}|')",c:[{b:"\\\\'\\w",r:0}],r:0},{cN:"emphasis",b:"_(?![_\\s])",e:"(\\n{2}|_)",r:0},{cN:"string",v:[{b:"``.+?''"},{b:"`.+?'"}]},{cN:"code",b:"(`.+?`|\\+.+?\\+)",r:0},{cN:"code",b:"^[ \\t]",e:"$",r:0},{b:"^'{3,}[ \\t]*$",r:10},{b:"(link:)?(http|https|ftp|file|irc|image:?):\\S+\\[.*?\\]",rB:!0,c:[{b:"(link|image:?):",r:0},{cN:"link",b:"\\w",e:"[^\\[]+",r:0},{cN:"string",b:"\\[",e:"\\]",eB:!0,eE:!0,r:0}],r:10}]}});hljs.registerLanguage("crystal",function(e){function r(e,r){var b=[{b:e,e:r}];return b[0].c=b,b}var b="(_[uif](8|16|32|64))?",c="[a-zA-Z_]\\w*[!?=]?",n="!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",i="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\][=?]?",s={keyword:"abstract alias as asm begin break case class def do else elsif end ensure enum extend for fun if ifdef include instance_sizeof is_a? lib macro module next of out pointerof private protected rescue responds_to? return require self sizeof struct super then type typeof union unless until when while with yield __DIR__ __FILE__ __LINE__",literal:"false nil true"},t={cN:"subst",b:"#{",e:"}",k:s},a={cN:"template-variable",v:[{b:"\\{\\{",e:"\\}\\}"},{b:"\\{%",e:"%\\}"}],k:s},l={cN:"string",c:[e.BE,t],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/`/,e:/`/},{b:"%w?\\(",e:"\\)",c:r("\\(","\\)")},{b:"%w?\\[",e:"\\]",c:r("\\[","\\]")},{b:"%w?{",e:"}",c:r("{","}")},{b:"%w?<",e:">",c:r("<",">")},{b:"%w?/",e:"/"},{b:"%w?%",e:"%"},{b:"%w?-",e:"-"},{b:"%w?\\|",e:"\\|"}],r:0},u={b:"("+n+")\\s*",c:[{cN:"regexp",c:[e.BE,t],v:[{b:"//[a-z]*",r:0},{b:"/",e:"/[a-z]*"},{b:"%r\\(",e:"\\)",c:r("\\(","\\)")},{b:"%r\\[",e:"\\]",c:r("\\[","\\]")},{b:"%r{",e:"}",c:r("{","}")},{b:"%r<",e:">",c:r("<",">")},{b:"%r/",e:"/"},{b:"%r%",e:"%"},{b:"%r-",e:"-"},{b:"%r\\|",e:"\\|"}]}],r:0},o={cN:"regexp",c:[e.BE,t],v:[{b:"%r\\(",e:"\\)",c:r("\\(","\\)")},{b:"%r\\[",e:"\\]",c:r("\\[","\\]")},{b:"%r{",e:"}",c:r("{","}")},{b:"%r<",e:">",c:r("<",">")},{b:"%r/",e:"/"},{b:"%r%",e:"%"},{b:"%r-",e:"-"},{b:"%r\\|",e:"\\|"}],r:0},_={cN:"meta",b:"@\\[",e:"\\]",c:[e.inherit(e.QSM,{cN:"meta-string"})]},f=[a,l,u,o,_,e.HCM,{cN:"class",bK:"class module struct",e:"$|;",i:/=/,c:[e.HCM,e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{b:"<"}]},{cN:"class",bK:"lib enum union",e:"$|;",i:/=/,c:[e.HCM,e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"})],r:10},{cN:"function",bK:"def",e:/\B\b/,c:[e.inherit(e.TM,{b:i,endsParent:!0})]},{cN:"function",bK:"fun macro",e:/\B\b/,c:[e.inherit(e.TM,{b:i,endsParent:!0})],r:5},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":",c:[l,{b:i}],r:0},{cN:"number",v:[{b:"\\b0b([01_]*[01])"+b},{b:"\\b0o([0-7_]*[0-7])"+b},{b:"\\b0x([A-Fa-f0-9_]*[A-Fa-f0-9])"+b},{b:"\\b(([0-9][0-9_]*[0-9]|[0-9])(\\.[0-9_]*[0-9])?([eE][+-]?[0-9_]*[0-9])?)"+b}],r:0}];return t.c=f,a.c=f.slice(1),{aliases:["cr"],l:c,k:s,c:f}}); \ No newline at end of file diff --git a/app/src/main/assets/highlight/js/prettify_line_number.js b/app/src/main/assets/highlight/js/prettify_line_number.js deleted file mode 100644 index 17cecfb8c..000000000 --- a/app/src/main/assets/highlight/js/prettify_line_number.js +++ /dev/null @@ -1,88 +0,0 @@ -(function (w) { - 'use strict'; - - var TABLE_NAME = 'hljs-ln', - LINE_NAME = 'hljs-ln-line', - CODE_BLOCK_NAME = 'hljs-ln-code', - NUMBERS_BLOCK_NAME = 'hljs-ln-numbers', - NUMBER_LINE_NAME = 'hljs-ln-n', - DATA_ATTR_NAME = 'data-line-number'; - - // https://wcoder.github.io/notes/string-format-for-string-formating-in-javascript - String.prototype.format = String.prototype.f = function () { - var args = arguments; - return this.replace(/\{(\d+)\}/g, function(m, n){ - return args[n] ? args[n] : m; - }); - }; - - if (typeof w.hljs === 'undefined') { - console.error('highlight.js not detected!'); - } else { - w.hljs.initLineNumbersOnLoad = initLineNumbersOnLoad; - w.hljs.lineNumbersBlock = lineNumbersBlock; - - addStyles(); - } - - function addStyles () { - var css = document.createElement('style'); - css.type = 'text/css'; - css.innerHTML = ('.{0}{border-collapse:collapse}' + - '.{0} td{padding:0}' + - '.{1}:before{content:attr({2})}').format(TABLE_NAME, NUMBER_LINE_NAME, DATA_ATTR_NAME); - document.getElementsByTagName('head')[0].appendChild(css); - } - - function initLineNumbersOnLoad () { - if (document.readyState === 'complete') { - documentReady(); - } else { - w.addEventListener('DOMContentLoaded', documentReady); - } - } - - function documentReady () { - try { - var blocks = document.querySelectorAll('code.hljs'); - - for (var i in blocks) { - if (blocks.hasOwnProperty(i)) { - lineNumbersBlock(blocks[i]); - } - } - } catch (e) { - console.error('LineNumbers error: ', e); - } - } - - function lineNumbersBlock (element) { - if (typeof element !== 'object') return; - - var lines = getLines(element.innerHTML); - - if (lines.length > 1) { - var html = ''; - - for (var i = 0; i < lines.length; i++) { - html += ('
' + - '
{6}
').format( - NUMBERS_BLOCK_NAME, - LINE_NAME, - NUMBER_LINE_NAME, - DATA_ATTR_NAME, - CODE_BLOCK_NAME, - i + 1, - lines[i].length > 0 ? lines[i] : ' '); - } - - element.innerHTML = '{1}
'.format(TABLE_NAME, html); - } - } - - function getLines(text) { - if (text.length === 0) return []; - return text.split(/\r\n|\r|\n/g); - } - -}(window)); \ No newline at end of file diff --git a/app/src/main/assets/highlight/js/scrollto.js b/app/src/main/assets/highlight/js/scrollto.js deleted file mode 100644 index 93f64baff..000000000 --- a/app/src/main/assets/highlight/js/scrollto.js +++ /dev/null @@ -1,65 +0,0 @@ -function scrollToLineNumber(lineNo, secondLineNo) { - console.log(lineNo + "\n" + secondLineNo); - var scrollTo = secondLineNo > lineNo ? secondLineNo : lineNo; - var div = document.querySelector('div[data-line-number="' + scrollTo + '"]'); - var scrollToPosition = scrollTo > 5 ? (scrollTo - 5) : scrollTo; - var toScrollTo = document.querySelector('div[data-line-number="' + scrollToPosition + '"]'); - if (secondLineNo > lineNo) { - for (var i = lineNo; i < secondLineNo + 1; i++) { - var highlighted = document.querySelector('div[data-line-number="' + i + '"]'); - if(highlighted != null) - highlighted.parentElement.style.backgroundColor = "rgb(3, 102, 214)"; - - if(secondLineNo == i) break; - } - } else { - div.parentElement.style.backgroundColor = "rgb(248, 238, 199)"; - } - if (toScrollTo != null) smoothScroll(toScrollTo); -} - -function currentYPosition() { - if (document.body.scrollTop) return document.body.scrollTop; - return 0; -} - -function elmYPosition(element) { - var elm = element; - var y = elm.offsetTop; - var node = elm; - while (node.offsetParent && node.offsetParent != document.body) { - node = node.offsetParent; - y += node.offsetTop; - } - return y; -} - -function smoothScroll(element) { - var startY = currentYPosition(); - var stopY = elmYPosition(element); - var distance = stopY > startY ? stopY - startY : startY - stopY; - if (distance < 100) { - scrollTo(0, stopY); - return; - } - var speed = Math.round(distance / 100); - if (speed >= 20) speed = 20; - var step = Math.round(distance / 25); - var leapY = stopY > startY ? startY + step : startY - step; - var timer = 0; - if (stopY > startY) { - for (var i = startY; i < stopY; i += step) { - setTimeout("window.scrollTo(0, " + leapY + ")", timer * speed); - leapY += step; - if (leapY > stopY) leapY = stopY; - timer++; - } - return; - } - for (var i = startY; i > stopY; i -= step) { - setTimeout("window.scrollTo(0, " + leapY + ")", timer * speed); - leapY -= step; - if (leapY < stopY) leapY = stopY; - timer++; - } -} \ No newline at end of file diff --git a/app/src/main/assets/highlight/styles/prettify.css b/app/src/main/assets/highlight/styles/prettify.css deleted file mode 100644 index e3e6606f2..000000000 --- a/app/src/main/assets/highlight/styles/prettify.css +++ /dev/null @@ -1,98 +0,0 @@ -/* - -Original highlight.js style (c) Ivan Sagalaev - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - color: #333; -} - -.hljs-comment, -.hljs-quote { - color: #998; - font-style: italic; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-subst { - color: #333; - font-weight: bold; -} - -.hljs-number, -.hljs-literal, -.hljs-variable, -.hljs-template-variable, -.hljs-tag .hljs-attr { - color: #008080; -} - -.hljs-string, -.hljs-doctag { - color: #d14; -} - -.hljs-title, -.hljs-section, -.hljs-selector-id { - color: #900; - font-weight: bold; -} - -.hljs-subst { - font-weight: normal; -} - -.hljs-type, -.hljs-class .hljs-title { - color: #458; - font-weight: bold; -} - -.hljs-tag, -.hljs-name, -.hljs-attribute { - color: #000080; - font-weight: normal; -} - -.hljs-regexp, -.hljs-link { - color: #009926; -} - -.hljs-symbol, -.hljs-bullet { - color: #990073; -} - -.hljs-built_in, -.hljs-builtin-name { - color: #0086b3; -} - -.hljs-meta { - color: #999; - font-weight: bold; -} - -.hljs-deletion { - background: #fdd; -} - -.hljs-addition { - background: #dfd; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} \ No newline at end of file diff --git a/app/src/main/assets/highlight/styles/prettify_dark.css b/app/src/main/assets/highlight/styles/prettify_dark.css deleted file mode 100644 index b7ae2f3df..000000000 --- a/app/src/main/assets/highlight/styles/prettify_dark.css +++ /dev/null @@ -1,74 +0,0 @@ -/* - -Original highlight.js style (c) Ivan Sagalaev - -*/ - -.hljs-comment, -.hljs-quote { - color: #969896; -} - -/* Tomorrow Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-tag, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class, -.hljs-regexp, -.hljs-deletion { - color: #cc6666; -} - -/* Tomorrow Orange */ -.hljs-number, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params, -.hljs-meta, -.hljs-link { - color: #de935f; -} - -/* Tomorrow Yellow */ -.hljs-attribute { - color: #f0c674; -} - -/* Tomorrow Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet, -.hljs-addition { - color: #b5bd68; -} - -/* Tomorrow Blue */ -.hljs-title, -.hljs-section { - color: #81a2be; -} - -/* Tomorrow Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #b294bb; -} - -.hljs { - display: block; - overflow-x: auto; - color: #c5c8c6; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} \ No newline at end of file diff --git a/app/src/main/assets/highlight/styles/themes/agate.css b/app/src/main/assets/highlight/styles/themes/agate.css deleted file mode 100644 index 6021c901e..000000000 --- a/app/src/main/assets/highlight/styles/themes/agate.css +++ /dev/null @@ -1,107 +0,0 @@ -/*! - * Agate by Taufik Nurrohman - * ---------------------------------------------------- - * - * #ade5fc - * #a2fca2 - * #c6b4f0 - * #d36363 - * #fcc28c - * #fc9b9b - * #ffa - * #fff - * #333 - * #62c8f3 - * #888 - * - */ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - color: white; -} - -.hljs-name, -.hljs-strong { - font-weight: bold; -} - -.hljs-code, -.hljs-emphasis { - font-style: italic; -} - -.hljs-tag { - color: #62c8f3; -} - -.hljs-variable, -.hljs-template-variable, -.hljs-selector-id, -.hljs-selector-class { - color: #ade5fc; -} - -.hljs-string, -.hljs-bullet { - color: #a2fca2; -} - -.hljs-type, -.hljs-title, -.hljs-section, -.hljs-attribute, -.hljs-quote, -.hljs-built_in, -.hljs-builtin-name { - color: #ffa; -} - -.hljs-number, -.hljs-symbol, -.hljs-bullet { - color: #d36363; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-literal { - color: #fcc28c; -} - -.hljs-comment, -.hljs-deletion, -.hljs-code { - color: #888; -} - -.hljs-regexp, -.hljs-link { - color: #c6b4f0; -} - -.hljs-meta { - color: #fc9b9b; -} - -.hljs-deletion { - background-color: #fc9b9b; - color: #333; -} - -.hljs-addition { - background-color: #a2fca2; - color: #333; -} - -.hljs a { - color: inherit; -} - -.hljs a:focus, -.hljs a:hover { - color: inherit; - text-decoration: underline; -} diff --git a/app/src/main/assets/highlight/styles/themes/androidstudio.css b/app/src/main/assets/highlight/styles/themes/androidstudio.css deleted file mode 100644 index c1ce9d374..000000000 --- a/app/src/main/assets/highlight/styles/themes/androidstudio.css +++ /dev/null @@ -1,65 +0,0 @@ -/* -Date: 24 Fev 2015 -Author: Pedro Oliveira -*/ - -.hljs { - color: #a9b7c6; - display: block; - overflow-x: auto; - padding: 0px; -} - -.hljs-number, -.hljs-literal, -.hljs-symbol, -.hljs-bullet { - color: #6897BB; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-deletion { - color: #cc7832; -} - -.hljs-variable, -.hljs-template-variable, -.hljs-link { - color: #629755; -} - -.hljs-comment, -.hljs-quote { - color: #808080; -} - -.hljs-meta { - color: #bbb529; -} - -.hljs-string, -.hljs-attribute, -.hljs-addition { - color: #6A8759; -} - -.hljs-section, -.hljs-title, -.hljs-type { - color: #ffc66d; -} - -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #e8bf6a; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/arduino-light.css b/app/src/main/assets/highlight/styles/themes/arduino-light.css deleted file mode 100644 index a80f5f7a4..000000000 --- a/app/src/main/assets/highlight/styles/themes/arduino-light.css +++ /dev/null @@ -1,87 +0,0 @@ -/* - -Arduino® Light Theme - Stefania Mellai - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; -} - -.hljs, -.hljs-subst { - color: #434f54; -} - -.hljs-keyword, -.hljs-attribute, -.hljs-selector-tag, -.hljs-doctag, -.hljs-name { - color: #00979D; -} - -.hljs-built_in, -.hljs-literal, -.hljs-bullet, -.hljs-code, -.hljs-addition { - color: #D35400; -} - -.hljs-regexp, -.hljs-symbol, -.hljs-variable, -.hljs-template-variable, -.hljs-link, -.hljs-selector-attr, -.hljs-selector-pseudo { - color: #00979D; -} - -.hljs-type, -.hljs-string, -.hljs-selector-id, -.hljs-selector-class, -.hljs-quote, -.hljs-template-tag, -.hljs-deletion { - color: #005C5F; -} - -.hljs-title, -.hljs-section { - color: #880000; - font-weight: bold; -} - -.hljs-comment { - color: rgba(149,165,166,.8); -} - -.hljs-meta-keyword { - color: #728E00; -} - -.hljs-meta { - color: #728E00; - color: #434f54; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} - -.hljs-function { - color: #728E00; -} - -.hljs-number { - color: #8A7B52; -} diff --git a/app/src/main/assets/highlight/styles/themes/arta.css b/app/src/main/assets/highlight/styles/themes/arta.css deleted file mode 100644 index 7b3bad032..000000000 --- a/app/src/main/assets/highlight/styles/themes/arta.css +++ /dev/null @@ -1,73 +0,0 @@ -/* -Date: 17.V.2011 -Author: pumbur -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - -} - -.hljs, -.hljs-subst { - color: #aaa; -} - -.hljs-section { - color: #fff; -} - -.hljs-comment, -.hljs-quote, -.hljs-meta { - color: #444; -} - -.hljs-string, -.hljs-symbol, -.hljs-bullet, -.hljs-regexp { - color: #ffcc33; -} - -.hljs-number, -.hljs-addition { - color: #00cc66; -} - -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-template-variable, -.hljs-attribute, -.hljs-link { - color: #32aaee; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #6644aa; -} - -.hljs-title, -.hljs-variable, -.hljs-deletion, -.hljs-template-tag { - color: #bb1166; -} - -.hljs-section, -.hljs-doctag, -.hljs-strong { - font-weight: bold; -} - -.hljs-emphasis { - font-style: italic; -} diff --git a/app/src/main/assets/highlight/styles/themes/ascetic.css b/app/src/main/assets/highlight/styles/themes/ascetic.css deleted file mode 100644 index a668b8e34..000000000 --- a/app/src/main/assets/highlight/styles/themes/ascetic.css +++ /dev/null @@ -1,44 +0,0 @@ -/* - -Original style from softwaremaniacs.org (c) Ivan Sagalaev - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - color: black; -} - -.hljs-string, -.hljs-variable, -.hljs-template-variable, -.hljs-symbol, -.hljs-bullet, -.hljs-section, -.hljs-addition, -.hljs-attribute, -.hljs-link { - color: #888; -} - -.hljs-comment, -.hljs-quote, -.hljs-meta, -.hljs-deletion { - color: #ccc; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-section, -.hljs-name, -.hljs-type, -.hljs-strong { - font-weight: bold; -} - -.hljs-emphasis { - font-style: italic; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-cave-dark.css b/app/src/main/assets/highlight/styles/themes/atelier-cave-dark.css deleted file mode 100644 index 110e1440d..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-cave-dark.css +++ /dev/null @@ -1,83 +0,0 @@ -/* Base16 Atelier Cave Dark - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/cave) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Cave Comment */ -.hljs-comment, -.hljs-quote { - color: #7e7887; -} - -/* Atelier-Cave Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-regexp, -.hljs-link, -.hljs-tag, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #be4678; -} - -/* Atelier-Cave Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #aa573c; -} - -/* Atelier-Cave Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #2a9292; -} - -/* Atelier-Cave Blue */ -.hljs-title, -.hljs-section { - color: #576ddb; -} - -/* Atelier-Cave Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #955ae7; -} - -.hljs-deletion, -.hljs-addition { - color: #19171c; - display: inline-block; - width: 100%; -} - -.hljs-deletion { - background-color: #be4678; -} - -.hljs-addition { - background-color: #2a9292; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #8b8792; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-cave-light.css b/app/src/main/assets/highlight/styles/themes/atelier-cave-light.css deleted file mode 100644 index 67ea1c31f..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-cave-light.css +++ /dev/null @@ -1,85 +0,0 @@ -/* Base16 Atelier Cave Light - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/cave) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Cave Comment */ -.hljs-comment, -.hljs-quote { - color: #655f6d; -} - -/* Atelier-Cave Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #be4678; -} - -/* Atelier-Cave Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #aa573c; -} - -/* Atelier-Cave Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #2a9292; -} - -/* Atelier-Cave Blue */ -.hljs-title, -.hljs-section { - color: #576ddb; -} - -/* Atelier-Cave Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #955ae7; -} - -.hljs-deletion, -.hljs-addition { - color: #19171c; - display: inline-block; - width: 100%; -} - -.hljs-deletion { - background-color: #be4678; -} - -.hljs-addition { - background-color: #2a9292; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #585260; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-dune-dark.css b/app/src/main/assets/highlight/styles/themes/atelier-dune-dark.css deleted file mode 100644 index 1c0312f8b..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-dune-dark.css +++ /dev/null @@ -1,69 +0,0 @@ -/* Base16 Atelier Dune Dark - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Dune Comment */ -.hljs-comment, -.hljs-quote { - color: #999580; -} - -/* Atelier-Dune Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #d73737; -} - -/* Atelier-Dune Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #b65611; -} - -/* Atelier-Dune Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #60ac39; -} - -/* Atelier-Dune Blue */ -.hljs-title, -.hljs-section { - color: #6684e1; -} - -/* Atelier-Dune Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #b854d4; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #a6a28c; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-dune-light.css b/app/src/main/assets/highlight/styles/themes/atelier-dune-light.css deleted file mode 100644 index f7815d920..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-dune-light.css +++ /dev/null @@ -1,69 +0,0 @@ -/* Base16 Atelier Dune Light - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Dune Comment */ -.hljs-comment, -.hljs-quote { - color: #7d7a68; -} - -/* Atelier-Dune Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #d73737; -} - -/* Atelier-Dune Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #b65611; -} - -/* Atelier-Dune Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #60ac39; -} - -/* Atelier-Dune Blue */ -.hljs-title, -.hljs-section { - color: #6684e1; -} - -/* Atelier-Dune Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #b854d4; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #6e6b5e; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-estuary-dark.css b/app/src/main/assets/highlight/styles/themes/atelier-estuary-dark.css deleted file mode 100644 index 232639410..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-estuary-dark.css +++ /dev/null @@ -1,84 +0,0 @@ -/* Base16 Atelier Estuary Dark - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/estuary) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Estuary Comment */ -.hljs-comment, -.hljs-quote { - color: #878573; -} - -/* Atelier-Estuary Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #ba6236; -} - -/* Atelier-Estuary Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #ae7313; -} - -/* Atelier-Estuary Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #7d9726; -} - -/* Atelier-Estuary Blue */ -.hljs-title, -.hljs-section { - color: #36a166; -} - -/* Atelier-Estuary Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #5f9182; -} - -.hljs-deletion, -.hljs-addition { - color: #22221b; - display: inline-block; - width: 100%; -} - -.hljs-deletion { - background-color: #ba6236; -} - -.hljs-addition { - background-color: #7d9726; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #929181; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-estuary-light.css b/app/src/main/assets/highlight/styles/themes/atelier-estuary-light.css deleted file mode 100644 index 13c5164f4..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-estuary-light.css +++ /dev/null @@ -1,84 +0,0 @@ -/* Base16 Atelier Estuary Light - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/estuary) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Estuary Comment */ -.hljs-comment, -.hljs-quote { - color: #6c6b5a; -} - -/* Atelier-Estuary Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #ba6236; -} - -/* Atelier-Estuary Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #ae7313; -} - -/* Atelier-Estuary Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #7d9726; -} - -/* Atelier-Estuary Blue */ -.hljs-title, -.hljs-section { - color: #36a166; -} - -/* Atelier-Estuary Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #5f9182; -} - -.hljs-deletion, -.hljs-addition { - color: #22221b; - display: inline-block; - width: 100%; -} - -.hljs-deletion { - background-color: #ba6236; -} - -.hljs-addition { - background-color: #7d9726; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #5f5e4e; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-forest-dark.css b/app/src/main/assets/highlight/styles/themes/atelier-forest-dark.css deleted file mode 100644 index 9f485444e..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-forest-dark.css +++ /dev/null @@ -1,69 +0,0 @@ -/* Base16 Atelier Forest Dark - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Forest Comment */ -.hljs-comment, -.hljs-quote { - color: #9c9491; -} - -/* Atelier-Forest Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #f22c40; -} - -/* Atelier-Forest Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #df5320; -} - -/* Atelier-Forest Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #7b9726; -} - -/* Atelier-Forest Blue */ -.hljs-title, -.hljs-section { - color: #407ee7; -} - -/* Atelier-Forest Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #6666ea; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #a8a19f; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-forest-light.css b/app/src/main/assets/highlight/styles/themes/atelier-forest-light.css deleted file mode 100644 index 748643c41..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-forest-light.css +++ /dev/null @@ -1,69 +0,0 @@ -/* Base16 Atelier Forest Light - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Forest Comment */ -.hljs-comment, -.hljs-quote { - color: #766e6b; -} - -/* Atelier-Forest Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #f22c40; -} - -/* Atelier-Forest Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #df5320; -} - -/* Atelier-Forest Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #7b9726; -} - -/* Atelier-Forest Blue */ -.hljs-title, -.hljs-section { - color: #407ee7; -} - -/* Atelier-Forest Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #6666ea; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #68615e; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-heath-dark.css b/app/src/main/assets/highlight/styles/themes/atelier-heath-dark.css deleted file mode 100644 index e9a676147..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-heath-dark.css +++ /dev/null @@ -1,69 +0,0 @@ -/* Base16 Atelier Heath Dark - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/heath) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Heath Comment */ -.hljs-comment, -.hljs-quote { - color: #9e8f9e; -} - -/* Atelier-Heath Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #ca402b; -} - -/* Atelier-Heath Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #a65926; -} - -/* Atelier-Heath Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #918b3b; -} - -/* Atelier-Heath Blue */ -.hljs-title, -.hljs-section { - color: #516aec; -} - -/* Atelier-Heath Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #7b59c0; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #ab9bab; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-heath-light.css b/app/src/main/assets/highlight/styles/themes/atelier-heath-light.css deleted file mode 100644 index e4d7a2976..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-heath-light.css +++ /dev/null @@ -1,69 +0,0 @@ -/* Base16 Atelier Heath Light - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/heath) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Heath Comment */ -.hljs-comment, -.hljs-quote { - color: #776977; -} - -/* Atelier-Heath Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #ca402b; -} - -/* Atelier-Heath Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #a65926; -} - -/* Atelier-Heath Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #918b3b; -} - -/* Atelier-Heath Blue */ -.hljs-title, -.hljs-section { - color: #516aec; -} - -/* Atelier-Heath Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #7b59c0; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #695d69; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-lakeside-dark.css b/app/src/main/assets/highlight/styles/themes/atelier-lakeside-dark.css deleted file mode 100644 index e448ea4bd..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-lakeside-dark.css +++ /dev/null @@ -1,69 +0,0 @@ -/* Base16 Atelier Lakeside Dark - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Lakeside Comment */ -.hljs-comment, -.hljs-quote { - color: #7195a8; -} - -/* Atelier-Lakeside Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #d22d72; -} - -/* Atelier-Lakeside Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #935c25; -} - -/* Atelier-Lakeside Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #568c3b; -} - -/* Atelier-Lakeside Blue */ -.hljs-title, -.hljs-section { - color: #257fad; -} - -/* Atelier-Lakeside Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #6b6bb8; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #7ea2b4; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-lakeside-light.css b/app/src/main/assets/highlight/styles/themes/atelier-lakeside-light.css deleted file mode 100644 index bdca412f6..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-lakeside-light.css +++ /dev/null @@ -1,69 +0,0 @@ -/* Base16 Atelier Lakeside Light - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Lakeside Comment */ -.hljs-comment, -.hljs-quote { - color: #5a7b8c; -} - -/* Atelier-Lakeside Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #d22d72; -} - -/* Atelier-Lakeside Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #935c25; -} - -/* Atelier-Lakeside Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #568c3b; -} - -/* Atelier-Lakeside Blue */ -.hljs-title, -.hljs-section { - color: #257fad; -} - -/* Atelier-Lakeside Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #6b6bb8; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #516d7b; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-plateau-dark.css b/app/src/main/assets/highlight/styles/themes/atelier-plateau-dark.css deleted file mode 100644 index 22f970ea2..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-plateau-dark.css +++ /dev/null @@ -1,84 +0,0 @@ -/* Base16 Atelier Plateau Dark - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/plateau) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Plateau Comment */ -.hljs-comment, -.hljs-quote { - color: #7e7777; -} - -/* Atelier-Plateau Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #ca4949; -} - -/* Atelier-Plateau Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #b45a3c; -} - -/* Atelier-Plateau Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #4b8b8b; -} - -/* Atelier-Plateau Blue */ -.hljs-title, -.hljs-section { - color: #7272ca; -} - -/* Atelier-Plateau Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #8464c4; -} - -.hljs-deletion, -.hljs-addition { - color: #1b1818; - display: inline-block; - width: 100%; -} - -.hljs-deletion { - background-color: #ca4949; -} - -.hljs-addition { - background-color: #4b8b8b; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #8a8585; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-plateau-light.css b/app/src/main/assets/highlight/styles/themes/atelier-plateau-light.css deleted file mode 100644 index a7a29335d..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-plateau-light.css +++ /dev/null @@ -1,84 +0,0 @@ -/* Base16 Atelier Plateau Light - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/plateau) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Plateau Comment */ -.hljs-comment, -.hljs-quote { - color: #655d5d; -} - -/* Atelier-Plateau Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #ca4949; -} - -/* Atelier-Plateau Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #b45a3c; -} - -/* Atelier-Plateau Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #4b8b8b; -} - -/* Atelier-Plateau Blue */ -.hljs-title, -.hljs-section { - color: #7272ca; -} - -/* Atelier-Plateau Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #8464c4; -} - -.hljs-deletion, -.hljs-addition { - color: #1b1818; - display: inline-block; - width: 100%; -} - -.hljs-deletion { - background-color: #ca4949; -} - -.hljs-addition { - background-color: #4b8b8b; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #585050; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-savanna-dark.css b/app/src/main/assets/highlight/styles/themes/atelier-savanna-dark.css deleted file mode 100644 index 089ea7c2b..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-savanna-dark.css +++ /dev/null @@ -1,84 +0,0 @@ -/* Base16 Atelier Savanna Dark - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/savanna) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Savanna Comment */ -.hljs-comment, -.hljs-quote { - color: #78877d; -} - -/* Atelier-Savanna Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #b16139; -} - -/* Atelier-Savanna Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #9f713c; -} - -/* Atelier-Savanna Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #489963; -} - -/* Atelier-Savanna Blue */ -.hljs-title, -.hljs-section { - color: #478c90; -} - -/* Atelier-Savanna Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #55859b; -} - -.hljs-deletion, -.hljs-addition { - color: #171c19; - display: inline-block; - width: 100%; -} - -.hljs-deletion { - background-color: #b16139; -} - -.hljs-addition { - background-color: #489963; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #87928a; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-savanna-light.css b/app/src/main/assets/highlight/styles/themes/atelier-savanna-light.css deleted file mode 100644 index c2177a8c8..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-savanna-light.css +++ /dev/null @@ -1,84 +0,0 @@ -/* Base16 Atelier Savanna Light - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/savanna) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Savanna Comment */ -.hljs-comment, -.hljs-quote { - color: #5f6d64; -} - -/* Atelier-Savanna Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #b16139; -} - -/* Atelier-Savanna Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #9f713c; -} - -/* Atelier-Savanna Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #489963; -} - -/* Atelier-Savanna Blue */ -.hljs-title, -.hljs-section { - color: #478c90; -} - -/* Atelier-Savanna Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #55859b; -} - -.hljs-deletion, -.hljs-addition { - color: #171c19; - display: inline-block; - width: 100%; -} - -.hljs-deletion { - background-color: #b16139; -} - -.hljs-addition { - background-color: #489963; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #526057; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-seaside-dark.css b/app/src/main/assets/highlight/styles/themes/atelier-seaside-dark.css deleted file mode 100644 index a2cfce247..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-seaside-dark.css +++ /dev/null @@ -1,69 +0,0 @@ -/* Base16 Atelier Seaside Dark - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/seaside) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Seaside Comment */ -.hljs-comment, -.hljs-quote { - color: #809980; -} - -/* Atelier-Seaside Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #e6193c; -} - -/* Atelier-Seaside Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #87711d; -} - -/* Atelier-Seaside Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #29a329; -} - -/* Atelier-Seaside Blue */ -.hljs-title, -.hljs-section { - color: #3d62f5; -} - -/* Atelier-Seaside Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #ad2bee; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #8ca68c; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-seaside-light.css b/app/src/main/assets/highlight/styles/themes/atelier-seaside-light.css deleted file mode 100644 index 5854b0b55..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-seaside-light.css +++ /dev/null @@ -1,69 +0,0 @@ -/* Base16 Atelier Seaside Light - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/seaside) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Seaside Comment */ -.hljs-comment, -.hljs-quote { - color: #687d68; -} - -/* Atelier-Seaside Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #e6193c; -} - -/* Atelier-Seaside Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #87711d; -} - -/* Atelier-Seaside Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #29a329; -} - -/* Atelier-Seaside Blue */ -.hljs-title, -.hljs-section { - color: #3d62f5; -} - -/* Atelier-Seaside Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #ad2bee; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #5e6e5e; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-sulphurpool-dark.css b/app/src/main/assets/highlight/styles/themes/atelier-sulphurpool-dark.css deleted file mode 100644 index ecb87243b..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-sulphurpool-dark.css +++ /dev/null @@ -1,69 +0,0 @@ -/* Base16 Atelier Sulphurpool Dark - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/sulphurpool) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Sulphurpool Comment */ -.hljs-comment, -.hljs-quote { - color: #898ea4; -} - -/* Atelier-Sulphurpool Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #c94922; -} - -/* Atelier-Sulphurpool Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #c76b29; -} - -/* Atelier-Sulphurpool Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #ac9739; -} - -/* Atelier-Sulphurpool Blue */ -.hljs-title, -.hljs-section { - color: #3d8fd1; -} - -/* Atelier-Sulphurpool Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #6679cc; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #979db4; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atelier-sulphurpool-light.css b/app/src/main/assets/highlight/styles/themes/atelier-sulphurpool-light.css deleted file mode 100644 index 4b3d2ac03..000000000 --- a/app/src/main/assets/highlight/styles/themes/atelier-sulphurpool-light.css +++ /dev/null @@ -1,69 +0,0 @@ -/* Base16 Atelier Sulphurpool Light - Theme */ -/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/sulphurpool) */ -/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ - -/* Atelier-Sulphurpool Comment */ -.hljs-comment, -.hljs-quote { - color: #6b7394; -} - -/* Atelier-Sulphurpool Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-regexp, -.hljs-link, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #c94922; -} - -/* Atelier-Sulphurpool Orange */ -.hljs-number, -.hljs-meta, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #c76b29; -} - -/* Atelier-Sulphurpool Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet { - color: #ac9739; -} - -/* Atelier-Sulphurpool Blue */ -.hljs-title, -.hljs-section { - color: #3d8fd1; -} - -/* Atelier-Sulphurpool Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #6679cc; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #5e6687; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/atom-one-dark.css b/app/src/main/assets/highlight/styles/themes/atom-one-dark.css deleted file mode 100644 index 4fd1695f2..000000000 --- a/app/src/main/assets/highlight/styles/themes/atom-one-dark.css +++ /dev/null @@ -1,96 +0,0 @@ -/* - -Atom One Dark by Daniel Gamage -Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax - -base: #282c34 -mono-1: #abb2bf -mono-2: #818896 -mono-3: #5c6370 -hue-1: #56b6c2 -hue-2: #61aeee -hue-3: #c678dd -hue-4: #98c379 -hue-5: #e06c75 -hue-5-2: #be5046 -hue-6: #d19a66 -hue-6-2: #e6c07b - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - color: #abb2bf; - -} - -.hljs-comment, -.hljs-quote { - color: #5c6370; - font-style: italic; -} - -.hljs-doctag, -.hljs-keyword, -.hljs-formula { - color: #c678dd; -} - -.hljs-section, -.hljs-name, -.hljs-selector-tag, -.hljs-deletion, -.hljs-subst { - color: #e06c75; -} - -.hljs-literal { - color: #56b6c2; -} - -.hljs-string, -.hljs-regexp, -.hljs-addition, -.hljs-attribute, -.hljs-meta-string { - color: #98c379; -} - -.hljs-built_in, -.hljs-class .hljs-title { - color: #e6c07b; -} - -.hljs-attr, -.hljs-variable, -.hljs-template-variable, -.hljs-type, -.hljs-selector-class, -.hljs-selector-attr, -.hljs-selector-pseudo, -.hljs-number { - color: #d19a66; -} - -.hljs-symbol, -.hljs-bullet, -.hljs-link, -.hljs-meta, -.hljs-selector-id, -.hljs-title { - color: #61aeee; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} - -.hljs-link { - text-decoration: underline; -} diff --git a/app/src/main/assets/highlight/styles/themes/atom-one-light.css b/app/src/main/assets/highlight/styles/themes/atom-one-light.css deleted file mode 100644 index 7dddf2d3c..000000000 --- a/app/src/main/assets/highlight/styles/themes/atom-one-light.css +++ /dev/null @@ -1,96 +0,0 @@ -/* - -Atom One Light by Daniel Gamage -Original One Light Syntax theme from https://github.com/atom/one-light-syntax - -base: #fafafa -mono-1: #383a42 -mono-2: #686b77 -mono-3: #a0a1a7 -hue-1: #0184bb -hue-2: #4078f2 -hue-3: #a626a4 -hue-4: #50a14f -hue-5: #e45649 -hue-5-2: #c91243 -hue-6: #986801 -hue-6-2: #c18401 - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - color: #383a42; - -} - -.hljs-comment, -.hljs-quote { - color: #a0a1a7; - font-style: italic; -} - -.hljs-doctag, -.hljs-keyword, -.hljs-formula { - color: #a626a4; -} - -.hljs-section, -.hljs-name, -.hljs-selector-tag, -.hljs-deletion, -.hljs-subst { - color: #e45649; -} - -.hljs-literal { - color: #0184bb; -} - -.hljs-string, -.hljs-regexp, -.hljs-addition, -.hljs-attribute, -.hljs-meta-string { - color: #50a14f; -} - -.hljs-built_in, -.hljs-class .hljs-title { - color: #c18401; -} - -.hljs-attr, -.hljs-variable, -.hljs-template-variable, -.hljs-type, -.hljs-selector-class, -.hljs-selector-attr, -.hljs-selector-pseudo, -.hljs-number { - color: #986801; -} - -.hljs-symbol, -.hljs-bullet, -.hljs-link, -.hljs-meta, -.hljs-selector-id, -.hljs-title { - color: #4078f2; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} - -.hljs-link { - text-decoration: underline; -} diff --git a/app/src/main/assets/highlight/styles/themes/brown-paper.css b/app/src/main/assets/highlight/styles/themes/brown-paper.css deleted file mode 100644 index e168ddc13..000000000 --- a/app/src/main/assets/highlight/styles/themes/brown-paper.css +++ /dev/null @@ -1,63 +0,0 @@ -/* - -Brown Paper style from goldblog.com.ua (c) Zaripov Yura - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-literal { - color:#005599; - font-weight:bold; -} - -.hljs, -.hljs-subst { - color: #363c69; -} - -.hljs-string, -.hljs-title, -.hljs-section, -.hljs-type, -.hljs-attribute, -.hljs-symbol, -.hljs-bullet, -.hljs-built_in, -.hljs-addition, -.hljs-variable, -.hljs-template-tag, -.hljs-template-variable, -.hljs-link, -.hljs-name { - color: #2c009f; -} - -.hljs-comment, -.hljs-quote, -.hljs-meta, -.hljs-deletion { - color: #802022; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-literal, -.hljs-doctag, -.hljs-title, -.hljs-section, -.hljs-type, -.hljs-name, -.hljs-strong { - font-weight: bold; -} - -.hljs-emphasis { - font-style: italic; -} diff --git a/app/src/main/assets/highlight/styles/themes/codepen-embed.css b/app/src/main/assets/highlight/styles/themes/codepen-embed.css deleted file mode 100644 index 199d4890f..000000000 --- a/app/src/main/assets/highlight/styles/themes/codepen-embed.css +++ /dev/null @@ -1,60 +0,0 @@ -/* - codepen.io Embed Theme - Author: Justin Perry - Original theme - https://github.com/chriskempson/tomorrow-theme -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - - color: #fff; -} - -.hljs-comment, -.hljs-quote { - color: #777; -} - -.hljs-variable, -.hljs-template-variable, -.hljs-tag, -.hljs-regexp, -.hljs-meta, -.hljs-number, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-params, -.hljs-symbol, -.hljs-bullet, -.hljs-link, -.hljs-deletion { - color: #ab875d; -} - -.hljs-section, -.hljs-title, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class, -.hljs-type, -.hljs-attribute { - color: #9b869b; -} - -.hljs-string, -.hljs-keyword, -.hljs-selector-tag, -.hljs-addition { - color: #8f9c6c; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/color-brewer.css b/app/src/main/assets/highlight/styles/themes/color-brewer.css deleted file mode 100644 index 5f1b13072..000000000 --- a/app/src/main/assets/highlight/styles/themes/color-brewer.css +++ /dev/null @@ -1,71 +0,0 @@ -/* - -Colorbrewer theme -Original: https://github.com/mbostock/colorbrewer-theme (c) Mike Bostock -Ported by Fabrício Tavares de Oliveira - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - -} - -.hljs, -.hljs-subst { - color: #000; -} - -.hljs-string, -.hljs-meta, -.hljs-symbol, -.hljs-template-tag, -.hljs-template-variable, -.hljs-addition { - color: #756bb1; -} - -.hljs-comment, -.hljs-quote { - color: #636363; -} - -.hljs-number, -.hljs-regexp, -.hljs-literal, -.hljs-bullet, -.hljs-link { - color: #31a354; -} - -.hljs-deletion, -.hljs-variable { - color: #88f; -} - - - -.hljs-keyword, -.hljs-selector-tag, -.hljs-title, -.hljs-section, -.hljs-built_in, -.hljs-doctag, -.hljs-type, -.hljs-tag, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class, -.hljs-strong { - color: #3182bd; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-attribute { - color: #e6550d; -} diff --git a/app/src/main/assets/highlight/styles/themes/darcula.css b/app/src/main/assets/highlight/styles/themes/darcula.css deleted file mode 100644 index eb40ab086..000000000 --- a/app/src/main/assets/highlight/styles/themes/darcula.css +++ /dev/null @@ -1,77 +0,0 @@ -/* - -Darcula color scheme from the JetBrains family of IDEs - -*/ - - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - -} - -.hljs { - color: #bababa; -} - -.hljs-strong, -.hljs-emphasis { - color: #a8a8a2; -} - -.hljs-bullet, -.hljs-quote, -.hljs-link, -.hljs-number, -.hljs-regexp, -.hljs-literal { - color: #6896ba; -} - -.hljs-code, -.hljs-selector-class { - color: #a6e22e; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-section, -.hljs-attribute, -.hljs-name, -.hljs-variable { - color: #cb7832; -} - -.hljs-params { - color: #b9b9b9; -} - -.hljs-string { - color: #6a8759; -} - -.hljs-subst, -.hljs-type, -.hljs-built_in, -.hljs-builtin-name, -.hljs-symbol, -.hljs-selector-id, -.hljs-selector-attr, -.hljs-selector-pseudo, -.hljs-template-tag, -.hljs-template-variable, -.hljs-addition { - color: #e0c46c; -} - -.hljs-comment, -.hljs-deletion, -.hljs-meta { - color: #7f7f7f; -} diff --git a/app/src/main/assets/highlight/styles/themes/dark.css b/app/src/main/assets/highlight/styles/themes/dark.css deleted file mode 100644 index e99826c42..000000000 --- a/app/src/main/assets/highlight/styles/themes/dark.css +++ /dev/null @@ -1,63 +0,0 @@ -/* - -Dark style from softwaremaniacs.org (c) Ivan Sagalaev - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-literal, -.hljs-section, -.hljs-link { - color: white; -} - -.hljs, -.hljs-subst { - color: #ddd; -} - -.hljs-string, -.hljs-title, -.hljs-name, -.hljs-type, -.hljs-attribute, -.hljs-symbol, -.hljs-bullet, -.hljs-built_in, -.hljs-addition, -.hljs-variable, -.hljs-template-tag, -.hljs-template-variable { - color: #d88; -} - -.hljs-comment, -.hljs-quote, -.hljs-deletion, -.hljs-meta { - color: #777; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-literal, -.hljs-title, -.hljs-section, -.hljs-doctag, -.hljs-type, -.hljs-name, -.hljs-strong { - font-weight: bold; -} - -.hljs-emphasis { - font-style: italic; -} diff --git a/app/src/main/assets/highlight/styles/themes/darkula.css b/app/src/main/assets/highlight/styles/themes/darkula.css deleted file mode 100644 index f4646c3c5..000000000 --- a/app/src/main/assets/highlight/styles/themes/darkula.css +++ /dev/null @@ -1,6 +0,0 @@ -/* - Deprecated due to a typo in the name and left here for compatibility purpose only. - Please use darcula.css instead. -*/ - -@import url('darcula.css'); diff --git a/app/src/main/assets/highlight/styles/themes/default.css b/app/src/main/assets/highlight/styles/themes/default.css deleted file mode 100644 index b27a2ff88..000000000 --- a/app/src/main/assets/highlight/styles/themes/default.css +++ /dev/null @@ -1,99 +0,0 @@ -/* - -Original highlight.js style (c) Ivan Sagalaev - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - -} - - -/* Base color: saturation 0; */ - -.hljs, -.hljs-subst { - color: #444; -} - -.hljs-comment { - color: #888888; -} - -.hljs-keyword, -.hljs-attribute, -.hljs-selector-tag, -.hljs-meta-keyword, -.hljs-doctag, -.hljs-name { - font-weight: bold; -} - - -/* User color: hue: 0 */ - -.hljs-type, -.hljs-string, -.hljs-number, -.hljs-selector-id, -.hljs-selector-class, -.hljs-quote, -.hljs-template-tag, -.hljs-deletion { - color: #880000; -} - -.hljs-title, -.hljs-section { - color: #880000; - font-weight: bold; -} - -.hljs-regexp, -.hljs-symbol, -.hljs-variable, -.hljs-template-variable, -.hljs-link, -.hljs-selector-attr, -.hljs-selector-pseudo { - color: #BC6060; -} - - -/* Language color: hue: 90; */ - -.hljs-literal { - color: #78A960; -} - -.hljs-built_in, -.hljs-bullet, -.hljs-code, -.hljs-addition { - color: #397300; -} - - -/* Meta color: hue: 200 */ - -.hljs-meta { - color: #1f7199; -} - -.hljs-meta-string { - color: #4d99bf; -} - - -/* Misc effects */ - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/docco.css b/app/src/main/assets/highlight/styles/themes/docco.css deleted file mode 100644 index f4e1cabce..000000000 --- a/app/src/main/assets/highlight/styles/themes/docco.css +++ /dev/null @@ -1,97 +0,0 @@ -/* -Docco style used in http://jashkenas.github.com/docco/ converted by Simon Madine (@thingsinjars) -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - color: #000; - -} - -.hljs-comment, -.hljs-quote { - color: #408080; - font-style: italic; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-literal, -.hljs-subst { - color: #954121; -} - -.hljs-number { - color: #40a070; -} - -.hljs-string, -.hljs-doctag { - color: #219161; -} - -.hljs-selector-id, -.hljs-selector-class, -.hljs-section, -.hljs-type { - color: #19469d; -} - -.hljs-params { - color: #00f; -} - -.hljs-title { - color: #458; - font-weight: bold; -} - -.hljs-tag, -.hljs-name, -.hljs-attribute { - color: #000080; - font-weight: normal; -} - -.hljs-variable, -.hljs-template-variable { - color: #008080; -} - -.hljs-regexp, -.hljs-link { - color: #b68; -} - -.hljs-symbol, -.hljs-bullet { - color: #990073; -} - -.hljs-built_in, -.hljs-builtin-name { - color: #0086b3; -} - -.hljs-meta { - color: #999; - font-weight: bold; -} - -.hljs-deletion { - -} - -.hljs-addition { - -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/dracula.css b/app/src/main/assets/highlight/styles/themes/dracula.css deleted file mode 100644 index ed96263e6..000000000 --- a/app/src/main/assets/highlight/styles/themes/dracula.css +++ /dev/null @@ -1,76 +0,0 @@ -/* - -Dracula Theme v1.2.0 - -https://github.com/zenorocha/dracula-theme - -Copyright 2015, All rights reserved - -Code licensed under the MIT license -http://zenorocha.mit-license.org - -@author Éverton Ribeiro -@author Zeno Rocha - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-literal, -.hljs-section, -.hljs-link { - color: #8be9fd; -} - -.hljs-function .hljs-keyword { - color: #ff79c6; -} - -.hljs, -.hljs-subst { - color: #f8f8f2; -} - -.hljs-string, -.hljs-title, -.hljs-name, -.hljs-type, -.hljs-attribute, -.hljs-symbol, -.hljs-bullet, -.hljs-addition, -.hljs-variable, -.hljs-template-tag, -.hljs-template-variable { - color: #f1fa8c; -} - -.hljs-comment, -.hljs-quote, -.hljs-deletion, -.hljs-meta { - color: #6272a4; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-literal, -.hljs-title, -.hljs-section, -.hljs-doctag, -.hljs-type, -.hljs-name, -.hljs-strong { - font-weight: bold; -} - -.hljs-emphasis { - font-style: italic; -} diff --git a/app/src/main/assets/highlight/styles/themes/far.css b/app/src/main/assets/highlight/styles/themes/far.css deleted file mode 100644 index 454937e5f..000000000 --- a/app/src/main/assets/highlight/styles/themes/far.css +++ /dev/null @@ -1,71 +0,0 @@ -/* - -FAR Style (c) MajestiC - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - -} - -.hljs, -.hljs-subst { - color: #0ff; -} - -.hljs-string, -.hljs-attribute, -.hljs-symbol, -.hljs-bullet, -.hljs-built_in, -.hljs-builtin-name, -.hljs-template-tag, -.hljs-template-variable, -.hljs-addition { - color: #ff0; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-section, -.hljs-type, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class, -.hljs-variable { - color: #fff; -} - -.hljs-comment, -.hljs-quote, -.hljs-doctag, -.hljs-deletion { - color: #888; -} - -.hljs-number, -.hljs-regexp, -.hljs-literal, -.hljs-link { - color: #0f0; -} - -.hljs-meta { - color: #008080; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-title, -.hljs-section, -.hljs-name, -.hljs-strong { - font-weight: bold; -} - -.hljs-emphasis { - font-style: italic; -} diff --git a/app/src/main/assets/highlight/styles/themes/foundation.css b/app/src/main/assets/highlight/styles/themes/foundation.css deleted file mode 100644 index 92509c6b6..000000000 --- a/app/src/main/assets/highlight/styles/themes/foundation.css +++ /dev/null @@ -1,88 +0,0 @@ -/* -Description: Foundation 4 docs style for highlight.js -Author: Dan Allen -Website: http://foundation.zurb.com/docs/ -Version: 1.0 -Date: 2013-04-02 -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - color: black; -} - -.hljs-link, -.hljs-emphasis, -.hljs-attribute, -.hljs-addition { - color: #070; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong, -.hljs-string, -.hljs-deletion { - color: #d14; -} - -.hljs-strong { - font-weight: bold; -} - -.hljs-quote, -.hljs-comment { - color: #998; - font-style: italic; -} - -.hljs-section, -.hljs-title { - color: #900; -} - -.hljs-class .hljs-title, -.hljs-type { - color: #458; -} - -.hljs-variable, -.hljs-template-variable { - color: #336699; -} - -.hljs-bullet { - color: #997700; -} - -.hljs-meta { - color: #3344bb; -} - -.hljs-code, -.hljs-number, -.hljs-literal, -.hljs-keyword, -.hljs-selector-tag { - color: #099; -} - -.hljs-regexp { - background-color: #fff0ff; - color: #880088; -} - -.hljs-symbol { - color: #990073; -} - -.hljs-tag, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #007700; -} diff --git a/app/src/main/assets/highlight/styles/themes/github-gist.css b/app/src/main/assets/highlight/styles/themes/github-gist.css deleted file mode 100644 index 218b52d47..000000000 --- a/app/src/main/assets/highlight/styles/themes/github-gist.css +++ /dev/null @@ -1,70 +0,0 @@ -/** - * GitHub Gist Theme - * Author : Louis Barranqueiro - https://github.com/LouisBarranqueiro - */ - -.hljs { - display: block; - padding: 0px; - color: #333333; - overflow-x: auto; -} - -.hljs-comment, -.hljs-meta { - color: #969896; -} - -.hljs-string, -.hljs-variable, -.hljs-template-variable, -.hljs-strong, -.hljs-emphasis, -.hljs-quote { - color: #df5000; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-type { - color: #a71d5d; -} - -.hljs-literal, -.hljs-symbol, -.hljs-bullet, -.hljs-attribute { - color: #0086b3; -} - -.hljs-section, -.hljs-name { - color: #63a35c; -} - -.hljs-tag { - color: #333333; -} - -.hljs-title, -.hljs-attr, -.hljs-selector-id, -.hljs-selector-class, -.hljs-selector-attr, -.hljs-selector-pseudo { - color: #795da3; -} - -.hljs-addition { - color: #55a532; - background-color: #eaffea; -} - -.hljs-deletion { - color: #bd2c00; - background-color: #ffecec; -} - -.hljs-link { - text-decoration: underline; -} diff --git a/app/src/main/assets/highlight/styles/themes/github.css b/app/src/main/assets/highlight/styles/themes/github.css deleted file mode 100644 index ebddd786a..000000000 --- a/app/src/main/assets/highlight/styles/themes/github.css +++ /dev/null @@ -1,99 +0,0 @@ -/* - -github.com style (c) Vasily Polovnyov - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - color: #333; - -} - -.hljs-comment, -.hljs-quote { - color: #998; - font-style: italic; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-subst { - color: #333; - font-weight: bold; -} - -.hljs-number, -.hljs-literal, -.hljs-variable, -.hljs-template-variable, -.hljs-tag .hljs-attr { - color: #008080; -} - -.hljs-string, -.hljs-doctag { - color: #d14; -} - -.hljs-title, -.hljs-section, -.hljs-selector-id { - color: #900; - font-weight: bold; -} - -.hljs-subst { - font-weight: normal; -} - -.hljs-type, -.hljs-class .hljs-title { - color: #458; - font-weight: bold; -} - -.hljs-tag, -.hljs-name, -.hljs-attribute { - color: #000080; - font-weight: normal; -} - -.hljs-regexp, -.hljs-link { - color: #009926; -} - -.hljs-symbol, -.hljs-bullet { - color: #990073; -} - -.hljs-built_in, -.hljs-builtin-name { - color: #0086b3; -} - -.hljs-meta { - color: #999; - font-weight: bold; -} - -.hljs-deletion { - -} - -.hljs-addition { - -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/googlecode.css b/app/src/main/assets/highlight/styles/themes/googlecode.css deleted file mode 100644 index 9453ecb99..000000000 --- a/app/src/main/assets/highlight/styles/themes/googlecode.css +++ /dev/null @@ -1,88 +0,0 @@ -/* - -Google Code style (c) Aahan Krish - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - color: black; -} - -.hljs-comment, -.hljs-quote { - color: #800; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-section, -.hljs-title, -.hljs-name { - color: #008; -} - -.hljs-variable, -.hljs-template-variable { - color: #660; -} - -.hljs-string, -.hljs-selector-attr, -.hljs-selector-pseudo, -.hljs-regexp { - color: #080; -} - -.hljs-literal, -.hljs-symbol, -.hljs-bullet, -.hljs-meta, -.hljs-number, -.hljs-link { - color: #066; -} - -.hljs-title, -.hljs-doctag, -.hljs-type, -.hljs-attr, -.hljs-built_in, -.hljs-builtin-name, -.hljs-params { - color: #606; -} - -.hljs-attribute, -.hljs-subst { - color: #000; -} - -.hljs-formula { - background-color: #eee; - font-style: italic; -} - -.hljs-selector-id, -.hljs-selector-class { - color: #9B703F -} - -.hljs-addition { - background-color: #baeeba; -} - -.hljs-deletion { - background-color: #ffc8bd; -} - -.hljs-doctag, -.hljs-strong { - font-weight: bold; -} - -.hljs-emphasis { - font-style: italic; -} diff --git a/app/src/main/assets/highlight/styles/themes/grayscale.css b/app/src/main/assets/highlight/styles/themes/grayscale.css deleted file mode 100644 index a4eb3aac2..000000000 --- a/app/src/main/assets/highlight/styles/themes/grayscale.css +++ /dev/null @@ -1,100 +0,0 @@ -/* - -grayscale style (c) MY Sun - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - color: #333; - -} - -.hljs-comment, -.hljs-quote { - color: #777; - font-style: italic; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-subst { - color: #333; - font-weight: bold; -} - -.hljs-number, -.hljs-literal { - color: #777; -} - -.hljs-string, -.hljs-doctag, -.hljs-formula { - color: #333; -} - -.hljs-title, -.hljs-section, -.hljs-selector-id { - color: #000; - font-weight: bold; -} - -.hljs-subst { - font-weight: normal; -} - -.hljs-class .hljs-title, -.hljs-type, -.hljs-name { - color: #333; - font-weight: bold; -} - -.hljs-tag { - color: #333; -} - -.hljs-regexp { - color: #333; - background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAICAYAAADA+m62AAAAPUlEQVQYV2NkQAN37979r6yszIgujiIAU4RNMVwhuiQ6H6wQl3XI4oy4FMHcCJPHcDS6J2A2EqUQpJhohQDexSef15DBCwAAAABJRU5ErkJggg==) repeat; -} - -.hljs-symbol, -.hljs-bullet, -.hljs-link { - color: #000; - background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAKElEQVQIW2NkQAO7d+/+z4gsBhJwdXVlhAvCBECKwIIwAbhKZBUwBQA6hBpm5efZsgAAAABJRU5ErkJggg==) repeat; -} - -.hljs-built_in, -.hljs-builtin-name { - color: #000; - text-decoration: underline; -} - -.hljs-meta { - color: #999; - font-weight: bold; -} - -.hljs-deletion { - color: #fff; - background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAADCAYAAABS3WWCAAAAE0lEQVQIW2MMDQ39zzhz5kwIAQAyxweWgUHd1AAAAABJRU5ErkJggg==) repeat; -} - -.hljs-addition { - color: #000; - background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAALUlEQVQYV2N89+7dfwYk8P79ewZBQUFkIQZGOiu6e/cuiptQHAPl0NtNxAQBAM97Oejj3Dg7AAAAAElFTkSuQmCC) repeat; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/gruvbox-dark.css b/app/src/main/assets/highlight/styles/themes/gruvbox-dark.css deleted file mode 100644 index 5695ef609..000000000 --- a/app/src/main/assets/highlight/styles/themes/gruvbox-dark.css +++ /dev/null @@ -1,108 +0,0 @@ -/* - -Gruvbox style (dark) (c) Pavel Pertsev (original style at https://github.com/morhetz/gruvbox) - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - -} - -.hljs, -.hljs-subst { - color: #ebdbb2; -} - -/* Gruvbox Red */ -.hljs-deletion, -.hljs-formula, -.hljs-keyword, -.hljs-link, -.hljs-selector-tag { - color: #fb4934; -} - -/* Gruvbox Blue */ -.hljs-built_in, -.hljs-emphasis, -.hljs-name, -.hljs-quote, -.hljs-strong, -.hljs-title, -.hljs-variable { - color: #83a598; -} - -/* Gruvbox Yellow */ -.hljs-attr, -.hljs-params, -.hljs-template-tag, -.hljs-type { - color: #fabd2f; -} - -/* Gruvbox Purple */ -.hljs-builtin-name, -.hljs-doctag, -.hljs-literal, -.hljs-number { - color: #8f3f71; -} - -/* Gruvbox Orange */ -.hljs-code, -.hljs-meta, -.hljs-regexp, -.hljs-selector-id, -.hljs-template-variable { - color: #fe8019; -} - -/* Gruvbox Green */ -.hljs-addition, -.hljs-meta-string, -.hljs-section, -.hljs-selector-attr, -.hljs-selector-class, -.hljs-string, -.hljs-symbol { - color: #b8bb26; -} - -/* Gruvbox Aqua */ -.hljs-attribute, -.hljs-bullet, -.hljs-class, -.hljs-function, -.hljs-function .hljs-keyword, -.hljs-meta-keyword, -.hljs-selector-pseudo, -.hljs-tag { - color: #8ec07c; -} - -/* Gruvbox Gray */ -.hljs-comment { - color: #928374; -} - -/* Gruvbox Purple */ -.hljs-link_label, -.hljs-literal, -.hljs-number { - color: #d3869b; -} - -.hljs-comment, -.hljs-emphasis { - font-style: italic; -} - -.hljs-section, -.hljs-strong, -.hljs-tag { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/gruvbox-light.css b/app/src/main/assets/highlight/styles/themes/gruvbox-light.css deleted file mode 100644 index 381522140..000000000 --- a/app/src/main/assets/highlight/styles/themes/gruvbox-light.css +++ /dev/null @@ -1,108 +0,0 @@ -/* - -Gruvbox style (light) (c) Pavel Pertsev (original style at https://github.com/morhetz/gruvbox) - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - -} - -.hljs, -.hljs-subst { - color: #3c3836; -} - -/* Gruvbox Red */ -.hljs-deletion, -.hljs-formula, -.hljs-keyword, -.hljs-link, -.hljs-selector-tag { - color: #9d0006; -} - -/* Gruvbox Blue */ -.hljs-built_in, -.hljs-emphasis, -.hljs-name, -.hljs-quote, -.hljs-strong, -.hljs-title, -.hljs-variable { - color: #076678; -} - -/* Gruvbox Yellow */ -.hljs-attr, -.hljs-params, -.hljs-template-tag, -.hljs-type { - color: #b57614; -} - -/* Gruvbox Purple */ -.hljs-builtin-name, -.hljs-doctag, -.hljs-literal, -.hljs-number { - color: #8f3f71; -} - -/* Gruvbox Orange */ -.hljs-code, -.hljs-meta, -.hljs-regexp, -.hljs-selector-id, -.hljs-template-variable { - color: #af3a03; -} - -/* Gruvbox Green */ -.hljs-addition, -.hljs-meta-string, -.hljs-section, -.hljs-selector-attr, -.hljs-selector-class, -.hljs-string, -.hljs-symbol { - color: #79740e; -} - -/* Gruvbox Aqua */ -.hljs-attribute, -.hljs-bullet, -.hljs-class, -.hljs-function, -.hljs-function .hljs-keyword, -.hljs-meta-keyword, -.hljs-selector-pseudo, -.hljs-tag { - color: #427b58; -} - -/* Gruvbox Gray */ -.hljs-comment { - color: #928374; -} - -/* Gruvbox Purple */ -.hljs-link_label, -.hljs-literal, -.hljs-number { - color: #8f3f71; -} - -.hljs-comment, -.hljs-emphasis { - font-style: italic; -} - -.hljs-section, -.hljs-strong, -.hljs-tag { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/hopscotch.css b/app/src/main/assets/highlight/styles/themes/hopscotch.css deleted file mode 100644 index 0f82c0bd7..000000000 --- a/app/src/main/assets/highlight/styles/themes/hopscotch.css +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Hopscotch - * by Jan T. Sott - * https://github.com/idleberg/Hopscotch - * - * This work is licensed under the Creative Commons CC0 1.0 Universal License - */ - -/* Comment */ -.hljs-comment, -.hljs-quote { - color: #989498; -} - -/* Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-attribute, -.hljs-tag, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class, -.hljs-regexp, -.hljs-link, -.hljs-deletion { - color: #dd464c; -} - -/* Orange */ -.hljs-number, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params { - color: #fd8b19; -} - -/* Yellow */ -.hljs-class .hljs-title { - color: #fdcc59; -} - -/* Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet, -.hljs-addition { - color: #8fc13e; -} - -/* Aqua */ -.hljs-meta { - color: #149b93; -} - -/* Blue */ -.hljs-function, -.hljs-section, -.hljs-title { - color: #1290bf; -} - -/* Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #c85e7c; -} - -.hljs { - display: block; - - color: #b9b5b8; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/hybrid.css b/app/src/main/assets/highlight/styles/themes/hybrid.css deleted file mode 100644 index 488b20db0..000000000 --- a/app/src/main/assets/highlight/styles/themes/hybrid.css +++ /dev/null @@ -1,102 +0,0 @@ -/* - -vim-hybrid theme by w0ng (https://github.com/w0ng/vim-hybrid) - -*/ - -/*background color*/ -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - -} - -/*selection color*/ -.hljs::selection, -.hljs span::selection { - -} - -.hljs::-moz-selection, -.hljs span::-moz-selection { - -} - -/*foreground color*/ -.hljs { - color: #c5c8c6; -} - -/*color: fg_yellow*/ -.hljs-title, -.hljs-name { - color: #f0c674; -} - -/*color: fg_comment*/ -.hljs-comment, -.hljs-meta, -.hljs-meta .hljs-keyword { - color: #707880; -} - -/*color: fg_red*/ -.hljs-number, -.hljs-symbol, -.hljs-literal, -.hljs-deletion, -.hljs-link { - color: #cc6666 -} - -/*color: fg_green*/ -.hljs-string, -.hljs-doctag, -.hljs-addition, -.hljs-regexp, -.hljs-selector-attr, -.hljs-selector-pseudo { - color: #b5bd68; -} - -/*color: fg_purple*/ -.hljs-attribute, -.hljs-code, -.hljs-selector-id { - color: #b294bb; -} - -/*color: fg_blue*/ -.hljs-keyword, -.hljs-selector-tag, -.hljs-bullet, -.hljs-tag { - color: #81a2be; -} - -/*color: fg_aqua*/ -.hljs-subst, -.hljs-variable, -.hljs-template-tag, -.hljs-template-variable { - color: #8abeb7; -} - -/*color: fg_orange*/ -.hljs-type, -.hljs-built_in, -.hljs-builtin-name, -.hljs-quote, -.hljs-section, -.hljs-selector-class { - color: #de935f; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/idea.css b/app/src/main/assets/highlight/styles/themes/idea.css deleted file mode 100644 index 33ad99405..000000000 --- a/app/src/main/assets/highlight/styles/themes/idea.css +++ /dev/null @@ -1,97 +0,0 @@ -/* - -Intellij Idea-like styling (c) Vasily Polovnyov - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - color: #000; - -} - -.hljs-subst, -.hljs-title { - font-weight: normal; - color: #000; -} - -.hljs-comment, -.hljs-quote { - color: #808080; - font-style: italic; -} - -.hljs-meta { - color: #808000; -} - -.hljs-tag { - -} - -.hljs-section, -.hljs-name, -.hljs-literal, -.hljs-keyword, -.hljs-selector-tag, -.hljs-type, -.hljs-selector-id, -.hljs-selector-class { - font-weight: bold; - color: #000080; -} - -.hljs-attribute, -.hljs-number, -.hljs-regexp, -.hljs-link { - font-weight: bold; - color: #0000ff; -} - -.hljs-number, -.hljs-regexp, -.hljs-link { - font-weight: normal; -} - -.hljs-string { - color: #008000; - font-weight: bold; -} - -.hljs-symbol, -.hljs-bullet, -.hljs-formula { - color: #000; - - font-style: italic; -} - -.hljs-doctag { - text-decoration: underline; -} - -.hljs-variable, -.hljs-template-variable { - color: #660e7a; -} - -.hljs-addition { - -} - -.hljs-deletion { - -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/ir-black.css b/app/src/main/assets/highlight/styles/themes/ir-black.css deleted file mode 100644 index 633ec7535..000000000 --- a/app/src/main/assets/highlight/styles/themes/ir-black.css +++ /dev/null @@ -1,73 +0,0 @@ -/* - IR_Black style (c) Vasily Mikhailitchenko -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - - color: #f8f8f8; -} - -.hljs-comment, -.hljs-quote, -.hljs-meta { - color: #7c7c7c; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-tag, -.hljs-name { - color: #96cbfe; -} - -.hljs-attribute, -.hljs-selector-id { - color: #ffffb6; -} - -.hljs-string, -.hljs-selector-attr, -.hljs-selector-pseudo, -.hljs-addition { - color: #a8ff60; -} - -.hljs-subst { - color: #daefa3; -} - -.hljs-regexp, -.hljs-link { - color: #e9c062; -} - -.hljs-title, -.hljs-section, -.hljs-type, -.hljs-doctag { - color: #ffffb6; -} - -.hljs-symbol, -.hljs-bullet, -.hljs-variable, -.hljs-template-variable, -.hljs-literal { - color: #c6c5fe; -} - -.hljs-number, -.hljs-deletion { - color:#ff73fd; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/kimbie.dark.css b/app/src/main/assets/highlight/styles/themes/kimbie.dark.css deleted file mode 100644 index a8a1d20d6..000000000 --- a/app/src/main/assets/highlight/styles/themes/kimbie.dark.css +++ /dev/null @@ -1,74 +0,0 @@ -/* - Name: Kimbie (dark) - Author: Jan T. Sott - License: Creative Commons Attribution-ShareAlike 4.0 Unported License - URL: https://github.com/idleberg/Kimbie-highlight.js -*/ - -/* Kimbie Comment */ -.hljs-comment, -.hljs-quote { - color: #d6baad; -} - -/* Kimbie Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-tag, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class, -.hljs-regexp, -.hljs-meta { - color: #dc3958; -} - -/* Kimbie Orange */ -.hljs-number, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params, -.hljs-deletion, -.hljs-link { - color: #f79a32; -} - -/* Kimbie Yellow */ -.hljs-title, -.hljs-section, -.hljs-attribute { - color: #f06431; -} - -/* Kimbie Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet, -.hljs-addition { - color: #889b4a; -} - -/* Kimbie Purple */ -.hljs-keyword, -.hljs-selector-tag, -.hljs-function { - color: #98676a; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #d3af86; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/kimbie.light.css b/app/src/main/assets/highlight/styles/themes/kimbie.light.css deleted file mode 100644 index 9e2438ddb..000000000 --- a/app/src/main/assets/highlight/styles/themes/kimbie.light.css +++ /dev/null @@ -1,74 +0,0 @@ -/* - Name: Kimbie (light) - Author: Jan T. Sott - License: Creative Commons Attribution-ShareAlike 4.0 Unported License - URL: https://github.com/idleberg/Kimbie-highlight.js -*/ - -/* Kimbie Comment */ -.hljs-comment, -.hljs-quote { - color: #a57a4c; -} - -/* Kimbie Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-tag, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class, -.hljs-regexp, -.hljs-meta { - color: #dc3958; -} - -/* Kimbie Orange */ -.hljs-number, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params, -.hljs-deletion, -.hljs-link { - color: #f79a32; -} - -/* Kimbie Yellow */ -.hljs-title, -.hljs-section, -.hljs-attribute { - color: #f06431; -} - -/* Kimbie Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet, -.hljs-addition { - color: #889b4a; -} - -/* Kimbie Purple */ -.hljs-keyword, -.hljs-selector-tag, -.hljs-function { - color: #98676a; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #84613d; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/magula.css b/app/src/main/assets/highlight/styles/themes/magula.css deleted file mode 100644 index d92ce9f86..000000000 --- a/app/src/main/assets/highlight/styles/themes/magula.css +++ /dev/null @@ -1,69 +0,0 @@ -/* -Description: Magula style for highligh.js -Author: Ruslan Keba -Website: http://rukeba.com/ -Version: 1.0 -Date: 2009-01-03 -Music: Aphex Twin / Xtal -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; -} - -.hljs, -.hljs-subst { - color: black; -} - -.hljs-string, -.hljs-title, -.hljs-symbol, -.hljs-bullet, -.hljs-attribute, -.hljs-addition, -.hljs-variable, -.hljs-template-tag, -.hljs-template-variable { - color: #050; -} - -.hljs-comment, -.hljs-quote { - color: #777; -} - -.hljs-number, -.hljs-regexp, -.hljs-literal, -.hljs-type, -.hljs-link { - color: #800; -} - -.hljs-deletion, -.hljs-meta { - color: #00e; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-doctag, -.hljs-title, -.hljs-section, -.hljs-built_in, -.hljs-tag, -.hljs-name { - font-weight: bold; - color: navy; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/mono-blue.css b/app/src/main/assets/highlight/styles/themes/mono-blue.css deleted file mode 100644 index ebf6eff06..000000000 --- a/app/src/main/assets/highlight/styles/themes/mono-blue.css +++ /dev/null @@ -1,59 +0,0 @@ -/* - Five-color theme from a single blue hue. -*/ -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - -} - -.hljs { - color: #00193a; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-title, -.hljs-section, -.hljs-doctag, -.hljs-name, -.hljs-strong { - font-weight: bold; -} - -.hljs-comment { - color: #738191; -} - -.hljs-string, -.hljs-title, -.hljs-section, -.hljs-built_in, -.hljs-literal, -.hljs-type, -.hljs-addition, -.hljs-tag, -.hljs-quote, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #0048ab; -} - -.hljs-meta, -.hljs-subst, -.hljs-symbol, -.hljs-regexp, -.hljs-attribute, -.hljs-deletion, -.hljs-variable, -.hljs-template-variable, -.hljs-link, -.hljs-bullet { - color: #4c81c9; -} - -.hljs-emphasis { - font-style: italic; -} diff --git a/app/src/main/assets/highlight/styles/themes/monokai-sublime.css b/app/src/main/assets/highlight/styles/themes/monokai-sublime.css deleted file mode 100644 index aaef6b347..000000000 --- a/app/src/main/assets/highlight/styles/themes/monokai-sublime.css +++ /dev/null @@ -1,83 +0,0 @@ -/* - -Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-license.org/ - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - -} - -.hljs, -.hljs-tag, -.hljs-subst { - color: #f8f8f2; -} - -.hljs-strong, -.hljs-emphasis { - color: #a8a8a2; -} - -.hljs-bullet, -.hljs-quote, -.hljs-number, -.hljs-regexp, -.hljs-literal, -.hljs-link { - color: #ae81ff; -} - -.hljs-code, -.hljs-title, -.hljs-section, -.hljs-selector-class { - color: #a6e22e; -} - -.hljs-strong { - font-weight: bold; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-name, -.hljs-attr { - color: #f92672; -} - -.hljs-symbol, -.hljs-attribute { - color: #66d9ef; -} - -.hljs-params, -.hljs-class .hljs-title { - color: #f8f8f2; -} - -.hljs-string, -.hljs-type, -.hljs-built_in, -.hljs-builtin-name, -.hljs-selector-id, -.hljs-selector-attr, -.hljs-selector-pseudo, -.hljs-addition, -.hljs-variable, -.hljs-template-variable { - color: #e6db74; -} - -.hljs-comment, -.hljs-deletion, -.hljs-meta { - color: #75715e; -} diff --git a/app/src/main/assets/highlight/styles/themes/monokai.css b/app/src/main/assets/highlight/styles/themes/monokai.css deleted file mode 100644 index 03b62e45f..000000000 --- a/app/src/main/assets/highlight/styles/themes/monokai.css +++ /dev/null @@ -1,70 +0,0 @@ -/* -Monokai style - ported by Luigi Maselli - http://grigio.org -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - color: #ddd; -} - -.hljs-tag, -.hljs-keyword, -.hljs-selector-tag, -.hljs-literal, -.hljs-strong, -.hljs-name { - color: #f92672; -} - -.hljs-code { - color: #66d9ef; -} - -.hljs-class .hljs-title { - color: white; -} - -.hljs-attribute, -.hljs-symbol, -.hljs-regexp, -.hljs-link { - color: #bf79db; -} - -.hljs-string, -.hljs-bullet, -.hljs-subst, -.hljs-title, -.hljs-section, -.hljs-emphasis, -.hljs-type, -.hljs-built_in, -.hljs-builtin-name, -.hljs-selector-attr, -.hljs-selector-pseudo, -.hljs-addition, -.hljs-variable, -.hljs-template-tag, -.hljs-template-variable { - color: #a6e22e; -} - -.hljs-comment, -.hljs-quote, -.hljs-deletion, -.hljs-meta { - color: #75715e; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-literal, -.hljs-doctag, -.hljs-title, -.hljs-section, -.hljs-type, -.hljs-selector-id { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/obsidian.css b/app/src/main/assets/highlight/styles/themes/obsidian.css deleted file mode 100644 index c32dff9a4..000000000 --- a/app/src/main/assets/highlight/styles/themes/obsidian.css +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Obsidian style - * ported by Alexander Marenin (http://github.com/ioncreature) - */ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-literal, -.hljs-selector-id { - color: #93c763; -} - -.hljs-number { - color: #ffcd22; -} - -.hljs { - color: #e0e2e4; -} - -.hljs-attribute { - color: #668bb0; -} - -.hljs-code, -.hljs-class .hljs-title, -.hljs-section { - color: white; -} - -.hljs-regexp, -.hljs-link { - color: #d39745; -} - -.hljs-meta { - color: #557182; -} - -.hljs-tag, -.hljs-name, -.hljs-bullet, -.hljs-subst, -.hljs-emphasis, -.hljs-type, -.hljs-built_in, -.hljs-selector-attr, -.hljs-selector-pseudo, -.hljs-addition, -.hljs-variable, -.hljs-template-tag, -.hljs-template-variable { - color: #8cbbad; -} - -.hljs-string, -.hljs-symbol { - color: #ec7600; -} - -.hljs-comment, -.hljs-quote, -.hljs-deletion { - color: #818e96; -} - -.hljs-selector-class { - color: #A082BD -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-literal, -.hljs-doctag, -.hljs-title, -.hljs-section, -.hljs-type, -.hljs-name, -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/ocean.css b/app/src/main/assets/highlight/styles/themes/ocean.css deleted file mode 100644 index a308fbe1d..000000000 --- a/app/src/main/assets/highlight/styles/themes/ocean.css +++ /dev/null @@ -1,74 +0,0 @@ -/* Ocean Dark Theme */ -/* https://github.com/gavsiu */ -/* Original theme - https://github.com/chriskempson/base16 */ - -/* Ocean Comment */ -.hljs-comment, -.hljs-quote { - color: #65737e; -} - -/* Ocean Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-tag, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class, -.hljs-regexp, -.hljs-deletion { - color: #bf616a; -} - -/* Ocean Orange */ -.hljs-number, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params, -.hljs-meta, -.hljs-link { - color: #d08770; -} - -/* Ocean Yellow */ -.hljs-attribute { - color: #ebcb8b; -} - -/* Ocean Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet, -.hljs-addition { - color: #a3be8c; -} - -/* Ocean Blue */ -.hljs-title, -.hljs-section { - color: #8fa1b3; -} - -/* Ocean Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #b48ead; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #c0c5ce; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/paraiso-dark.css b/app/src/main/assets/highlight/styles/themes/paraiso-dark.css deleted file mode 100644 index 47fbcddb7..000000000 --- a/app/src/main/assets/highlight/styles/themes/paraiso-dark.css +++ /dev/null @@ -1,72 +0,0 @@ -/* - Paraíso (dark) - Created by Jan T. Sott (http://github.com/idleberg) - Inspired by the art of Rubens LP (http://www.rubenslp.com.br) -*/ - -/* Paraíso Comment */ -.hljs-comment, -.hljs-quote { - color: #8d8687; -} - -/* Paraíso Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-tag, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class, -.hljs-regexp, -.hljs-link, -.hljs-meta { - color: #ef6155; -} - -/* Paraíso Orange */ -.hljs-number, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params, -.hljs-deletion { - color: #f99b15; -} - -/* Paraíso Yellow */ -.hljs-title, -.hljs-section, -.hljs-attribute { - color: #fec418; -} - -/* Paraíso Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet, -.hljs-addition { - color: #48b685; -} - -/* Paraíso Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #815ba4; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #a39e9b; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/paraiso-light.css b/app/src/main/assets/highlight/styles/themes/paraiso-light.css deleted file mode 100644 index 3128b642e..000000000 --- a/app/src/main/assets/highlight/styles/themes/paraiso-light.css +++ /dev/null @@ -1,72 +0,0 @@ -/* - Paraíso (light) - Created by Jan T. Sott (http://github.com/idleberg) - Inspired by the art of Rubens LP (http://www.rubenslp.com.br) -*/ - -/* Paraíso Comment */ -.hljs-comment, -.hljs-quote { - color: #776e71; -} - -/* Paraíso Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-tag, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class, -.hljs-regexp, -.hljs-link, -.hljs-meta { - color: #ef6155; -} - -/* Paraíso Orange */ -.hljs-number, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params, -.hljs-deletion { - color: #f99b15; -} - -/* Paraíso Yellow */ -.hljs-title, -.hljs-section, -.hljs-attribute { - color: #fec418; -} - -/* Paraíso Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet, -.hljs-addition { - color: #48b685; -} - -/* Paraíso Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #815ba4; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #4f424c; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/pojoaque.css b/app/src/main/assets/highlight/styles/themes/pojoaque.css deleted file mode 100644 index 023e5d019..000000000 --- a/app/src/main/assets/highlight/styles/themes/pojoaque.css +++ /dev/null @@ -1,82 +0,0 @@ -/* - -Pojoaque Style by Jason Tate -http://web-cms-designs.com/ftopict-10-pojoaque-style-for-highlight-js-code-highlighter.html -Based on Solarized Style from http://ethanschoonover.com/solarized - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - color: #dccf8f; -} - -.hljs-comment, -.hljs-quote { - color: #586e75; - font-style: italic; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-literal, -.hljs-addition { - color: #b64926; -} - -.hljs-number, -.hljs-string, -.hljs-doctag, -.hljs-regexp { - color: #468966; -} - -.hljs-title, -.hljs-section, -.hljs-built_in, -.hljs-name { - color: #ffb03b; -} - -.hljs-variable, -.hljs-template-variable, -.hljs-class .hljs-title, -.hljs-type, -.hljs-tag { - color: #b58900; -} - -.hljs-attribute { - color: #b89859; -} - -.hljs-symbol, -.hljs-bullet, -.hljs-link, -.hljs-subst, -.hljs-meta { - color: #cb4b16; -} - -.hljs-deletion { - color: #dc322f; -} - -.hljs-selector-id, -.hljs-selector-class { - color: #d3a60c; -} - -.hljs-formula { - -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/purebasic.css b/app/src/main/assets/highlight/styles/themes/purebasic.css deleted file mode 100644 index 8373bfa54..000000000 --- a/app/src/main/assets/highlight/styles/themes/purebasic.css +++ /dev/null @@ -1,96 +0,0 @@ -/* - -PureBASIC native IDE style ( version 1.0 - April 2016 ) - -by Tristano Ajmone - -Public Domain - -NOTE_1: PureBASIC code syntax highlighting only applies the following classes: - .hljs-comment - .hljs-function - .hljs-keywords - .hljs-string - .hljs-symbol - - Other classes are added here for the benefit of styling other languages with the look and feel of PureBASIC native IDE style. - If you need to customize a stylesheet for PureBASIC only, remove all non-relevant classes -- PureBASIC-related classes are followed by - a "--- used for PureBASIC ... ---" comment on same line. - -NOTE_2: Color names provided in comments were derived using "Name that Color" online tool: - http://chir.ag/projects/name-that-color -*/ - -.hljs { /* Common set of rules required by highlight.js (don'r remove!) */ - display: block; - overflow-x: auto; - padding: 0px; - /* Half and Half (approx.) */ -/* --- Uncomment to add PureBASIC native IDE styled font! - font-family: Consolas; -*/ -} - -.hljs, /* --- used for PureBASIC base color --- */ -.hljs-type, /* --- used for PureBASIC Procedures return type --- */ -.hljs-function, /* --- used for wrapping PureBASIC Procedures definitions --- */ -.hljs-name, -.hljs-number, -.hljs-attr, -.hljs-params, -.hljs-subst { - color: #000000; /* Black */ -} - -.hljs-comment, /* --- used for PureBASIC Comments --- */ -.hljs-regexp, -.hljs-section, -.hljs-selector-pseudo, -.hljs-addition { - color: #00AAAA; /* Persian Green (approx.) */ -} - -.hljs-title, /* --- used for PureBASIC Procedures Names --- */ -.hljs-tag, -.hljs-variable, -.hljs-code { - color: #006666; /* Blue Stone (approx.) */ -} - -.hljs-keyword, /* --- used for PureBASIC Keywords --- */ -.hljs-class, -.hljs-meta-keyword, -.hljs-selector-class, -.hljs-built_in, -.hljs-builtin-name { - color: #006666; /* Blue Stone (approx.) */ - font-weight: bold; -} - -.hljs-string, /* --- used for PureBASIC Strings --- */ -.hljs-selector-attr { - color: #0080FF; /* Azure Radiance (approx.) */ -} - -.hljs-symbol, /* --- used for PureBASIC Constants --- */ -.hljs-link, -.hljs-deletion, -.hljs-attribute { - color: #924B72; /* Cannon Pink (approx.) */ -} - -.hljs-meta, -.hljs-literal, -.hljs-selector-id { - color: #924B72; /* Cannon Pink (approx.) */ - font-weight: bold; -} - -.hljs-strong, -.hljs-name { - font-weight: bold; -} - -.hljs-emphasis { - font-style: italic; -} diff --git a/app/src/main/assets/highlight/styles/themes/qtcreator_dark.css b/app/src/main/assets/highlight/styles/themes/qtcreator_dark.css deleted file mode 100644 index 4ce2781b6..000000000 --- a/app/src/main/assets/highlight/styles/themes/qtcreator_dark.css +++ /dev/null @@ -1,83 +0,0 @@ -/* - -Qt Creator dark color scheme - -*/ - - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - -} - -.hljs, -.hljs-subst, -.hljs-tag, -.hljs-title { - color: #aaaaaa; -} - -.hljs-strong, -.hljs-emphasis { - color: #a8a8a2; -} - -.hljs-bullet, -.hljs-quote, -.hljs-number, -.hljs-regexp, -.hljs-literal { - color: #ff55ff; -} - -.hljs-code -.hljs-selector-class { - color: #aaaaff; -} - -.hljs-emphasis, -.hljs-stronge, -.hljs-type { - font-style: italic; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-function, -.hljs-section, -.hljs-symbol, -.hljs-name { - color: #ffff55; -} - -.hljs-attribute { - color: #ff5555; -} - -.hljs-variable, -.hljs-params, -.hljs-class .hljs-title { - color: #8888ff; -} - -.hljs-string, -.hljs-selector-id, -.hljs-selector-attr, -.hljs-selector-pseudo, -.hljs-type, -.hljs-built_in, -.hljs-builtin-name, -.hljs-template-tag, -.hljs-template-variable, -.hljs-addition, -.hljs-link { - color: #ff55ff; -} - -.hljs-comment, -.hljs-meta, -.hljs-deletion { - color: #55ffff; -} diff --git a/app/src/main/assets/highlight/styles/themes/qtcreator_light.css b/app/src/main/assets/highlight/styles/themes/qtcreator_light.css deleted file mode 100644 index 0df3dd824..000000000 --- a/app/src/main/assets/highlight/styles/themes/qtcreator_light.css +++ /dev/null @@ -1,83 +0,0 @@ -/* - -Qt Creator light color scheme - -*/ - - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - -} - -.hljs, -.hljs-subst, -.hljs-tag, -.hljs-title { - color: #000000; -} - -.hljs-strong, -.hljs-emphasis { - color: #000000; -} - -.hljs-bullet, -.hljs-quote, -.hljs-number, -.hljs-regexp, -.hljs-literal { - color: #000080; -} - -.hljs-code -.hljs-selector-class { - color: #800080; -} - -.hljs-emphasis, -.hljs-stronge, -.hljs-type { - font-style: italic; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-function, -.hljs-section, -.hljs-symbol, -.hljs-name { - color: #808000; -} - -.hljs-attribute { - color: #800000; -} - -.hljs-variable, -.hljs-params, -.hljs-class .hljs-title { - color: #0055AF; -} - -.hljs-string, -.hljs-selector-id, -.hljs-selector-attr, -.hljs-selector-pseudo, -.hljs-type, -.hljs-built_in, -.hljs-builtin-name, -.hljs-template-tag, -.hljs-template-variable, -.hljs-addition, -.hljs-link { - color: #008000; -} - -.hljs-comment, -.hljs-meta, -.hljs-deletion { - color: #008000; -} diff --git a/app/src/main/assets/highlight/styles/themes/railscasts.css b/app/src/main/assets/highlight/styles/themes/railscasts.css deleted file mode 100644 index be2c15cf3..000000000 --- a/app/src/main/assets/highlight/styles/themes/railscasts.css +++ /dev/null @@ -1,106 +0,0 @@ -/* - -Railscasts-like style (c) Visoft, Inc. (Damien White) - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - - color: #e6e1dc; -} - -.hljs-comment, -.hljs-quote { - color: #bc9458; - font-style: italic; -} - -.hljs-keyword, -.hljs-selector-tag { - color: #c26230; -} - -.hljs-string, -.hljs-number, -.hljs-regexp, -.hljs-variable, -.hljs-template-variable { - color: #a5c261; -} - -.hljs-subst { - color: #519f50; -} - -.hljs-tag, -.hljs-name { - color: #e8bf6a; -} - -.hljs-type { - color: #da4939; -} - - -.hljs-symbol, -.hljs-bullet, -.hljs-built_in, -.hljs-builtin-name, -.hljs-attr, -.hljs-link { - color: #6d9cbe; -} - -.hljs-params { - color: #d0d0ff; -} - -.hljs-attribute { - color: #cda869; -} - -.hljs-meta { - color: #9b859d; -} - -.hljs-title, -.hljs-section { - color: #ffc66d; -} - -.hljs-addition { - background-color: #144212; - color: #e6e1dc; - display: inline-block; - width: 100%; -} - -.hljs-deletion { - background-color: #600; - color: #e6e1dc; - display: inline-block; - width: 100%; -} - -.hljs-selector-class { - color: #9b703f; -} - -.hljs-selector-id { - color: #8b98ab; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} - -.hljs-link { - text-decoration: underline; -} diff --git a/app/src/main/assets/highlight/styles/themes/rainbow.css b/app/src/main/assets/highlight/styles/themes/rainbow.css deleted file mode 100644 index 5bc848cf4..000000000 --- a/app/src/main/assets/highlight/styles/themes/rainbow.css +++ /dev/null @@ -1,85 +0,0 @@ -/* - -Style with support for rainbow parens - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - - color: #d1d9e1; -} - - -.hljs-comment, -.hljs-quote { - color: #969896; - font-style: italic; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-literal, -.hljs-type, -.hljs-addition { - color: #cc99cc; -} - -.hljs-number, -.hljs-selector-attr, -.hljs-selector-pseudo { - color: #f99157; -} - -.hljs-string, -.hljs-doctag, -.hljs-regexp { - color: #8abeb7; -} - -.hljs-title, -.hljs-name, -.hljs-section, -.hljs-built_in { - color: #b5bd68; -} - -.hljs-variable, -.hljs-template-variable, -.hljs-selector-id, -.hljs-class .hljs-title { - color: #ffcc66; -} - -.hljs-section, -.hljs-name, -.hljs-strong { - font-weight: bold; -} - -.hljs-symbol, -.hljs-bullet, -.hljs-subst, -.hljs-meta, -.hljs-link { - color: #f99157; -} - -.hljs-deletion { - color: #dc322f; -} - -.hljs-formula { - -} - -.hljs-attr, -.hljs-attribute { - color: #81a2be; -} - -.hljs-emphasis { - font-style: italic; -} diff --git a/app/src/main/assets/highlight/styles/themes/routeros.css b/app/src/main/assets/highlight/styles/themes/routeros.css deleted file mode 100644 index a7a436e0b..000000000 --- a/app/src/main/assets/highlight/styles/themes/routeros.css +++ /dev/null @@ -1,108 +0,0 @@ -/* - - highlight.js style for Microtik RouterOS script - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - -} - -/* Base color: saturation 0; */ - -.hljs, -.hljs-subst { - color: #444; -} - -.hljs-comment { - color: #888888; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-meta-keyword, -.hljs-doctag, -.hljs-name { - font-weight: bold; -} - -.hljs-attribute { - color: #0E9A00; -} - -.hljs-function { - color: #99069A; -} - -.hljs-builtin-name { - color: #99069A; -} - -/* User color: hue: 0 */ - -.hljs-type, -.hljs-string, -.hljs-number, -.hljs-selector-id, -.hljs-selector-class, -.hljs-quote, -.hljs-template-tag, -.hljs-deletion { - color: #880000; -} - -.hljs-title, -.hljs-section { - color: #880000; - font-weight: bold; -} - -.hljs-regexp, -.hljs-symbol, -.hljs-variable, -.hljs-template-variable, -.hljs-link, -.hljs-selector-attr, -.hljs-selector-pseudo { - color: #BC6060; -} - - -/* Language color: hue: 90; */ - -.hljs-literal { - color: #78A960; -} - -.hljs-built_in, -.hljs-bullet, -.hljs-code, -.hljs-addition { - color: #0C9A9A; -} - - -/* Meta color: hue: 200 */ - -.hljs-meta { - color: #1f7199; -} - -.hljs-meta-string { - color: #4d99bf; -} - - -/* Misc effects */ - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/school-book.css b/app/src/main/assets/highlight/styles/themes/school-book.css deleted file mode 100644 index 3e1afc2f2..000000000 --- a/app/src/main/assets/highlight/styles/themes/school-book.css +++ /dev/null @@ -1,66 +0,0 @@ -/* - -School Book style from goldblog.com.ua (c) Zaripov Yura - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 15px 0.5em 0.5em 30px; - font-size: 11px; - line-height:16px; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-literal { - color:#005599; - font-weight:bold; -} - -.hljs, -.hljs-subst { - color: #3e5915; -} - -.hljs-string, -.hljs-title, -.hljs-section, -.hljs-type, -.hljs-symbol, -.hljs-bullet, -.hljs-attribute, -.hljs-built_in, -.hljs-builtin-name, -.hljs-addition, -.hljs-variable, -.hljs-template-tag, -.hljs-template-variable, -.hljs-link { - color: #2c009f; -} - -.hljs-comment, -.hljs-quote, -.hljs-deletion, -.hljs-meta { - color: #e60415; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-literal, -.hljs-doctag, -.hljs-title, -.hljs-section, -.hljs-type, -.hljs-name, -.hljs-selector-id, -.hljs-strong { - font-weight: bold; -} - -.hljs-emphasis { - font-style: italic; -} diff --git a/app/src/main/assets/highlight/styles/themes/solarized-dark.css b/app/src/main/assets/highlight/styles/themes/solarized-dark.css deleted file mode 100644 index 9810cf5c4..000000000 --- a/app/src/main/assets/highlight/styles/themes/solarized-dark.css +++ /dev/null @@ -1,84 +0,0 @@ -/* - -Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - - color: #839496; -} - -.hljs-comment, -.hljs-quote { - color: #586e75; -} - -/* Solarized Green */ -.hljs-keyword, -.hljs-selector-tag, -.hljs-addition { - color: #859900; -} - -/* Solarized Cyan */ -.hljs-number, -.hljs-string, -.hljs-meta .hljs-meta-string, -.hljs-literal, -.hljs-doctag, -.hljs-regexp { - color: #2aa198; -} - -/* Solarized Blue */ -.hljs-title, -.hljs-section, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #268bd2; -} - -/* Solarized Yellow */ -.hljs-attribute, -.hljs-attr, -.hljs-variable, -.hljs-template-variable, -.hljs-class .hljs-title, -.hljs-type { - color: #b58900; -} - -/* Solarized Orange */ -.hljs-symbol, -.hljs-bullet, -.hljs-subst, -.hljs-meta, -.hljs-meta .hljs-keyword, -.hljs-selector-attr, -.hljs-selector-pseudo, -.hljs-link { - color: #cb4b16; -} - -/* Solarized Red */ -.hljs-built_in, -.hljs-deletion { - color: #dc322f; -} - -.hljs-formula { - -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/solarized-light.css b/app/src/main/assets/highlight/styles/themes/solarized-light.css deleted file mode 100644 index 8f6c19bfb..000000000 --- a/app/src/main/assets/highlight/styles/themes/solarized-light.css +++ /dev/null @@ -1,84 +0,0 @@ -/* - -Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - - color: #657b83; -} - -.hljs-comment, -.hljs-quote { - color: #93a1a1; -} - -/* Solarized Green */ -.hljs-keyword, -.hljs-selector-tag, -.hljs-addition { - color: #859900; -} - -/* Solarized Cyan */ -.hljs-number, -.hljs-string, -.hljs-meta .hljs-meta-string, -.hljs-literal, -.hljs-doctag, -.hljs-regexp { - color: #2aa198; -} - -/* Solarized Blue */ -.hljs-title, -.hljs-section, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class { - color: #268bd2; -} - -/* Solarized Yellow */ -.hljs-attribute, -.hljs-attr, -.hljs-variable, -.hljs-template-variable, -.hljs-class .hljs-title, -.hljs-type { - color: #b58900; -} - -/* Solarized Orange */ -.hljs-symbol, -.hljs-bullet, -.hljs-subst, -.hljs-meta, -.hljs-meta .hljs-keyword, -.hljs-selector-attr, -.hljs-selector-pseudo, -.hljs-link { - color: #cb4b16; -} - -/* Solarized Red */ -.hljs-built_in, -.hljs-deletion { - color: #dc322f; -} - -.hljs-formula { - -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/sunburst.css b/app/src/main/assets/highlight/styles/themes/sunburst.css deleted file mode 100644 index 75dea3afb..000000000 --- a/app/src/main/assets/highlight/styles/themes/sunburst.css +++ /dev/null @@ -1,101 +0,0 @@ -/* - -Sunburst-like style (c) Vasily Polovnyov - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - color: #f8f8f8; -} - -.hljs-comment, -.hljs-quote { - color: #aeaeae; - font-style: italic; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-type { - color: #e28964; -} - -.hljs-string { - color: #65b042; -} - -.hljs-subst { - color: #daefa3; -} - -.hljs-regexp, -.hljs-link { - color: #e9c062; -} - -.hljs-title, -.hljs-section, -.hljs-tag, -.hljs-name { - color: #89bdff; -} - -.hljs-class .hljs-title, -.hljs-doctag { - text-decoration: underline; -} - -.hljs-symbol, -.hljs-bullet, -.hljs-number { - color: #3387cc; -} - -.hljs-params, -.hljs-variable, -.hljs-template-variable { - color: #3e87e3; -} - -.hljs-attribute { - color: #cda869; -} - -.hljs-meta { - color: #8996a8; -} - -.hljs-formula { - background-color: #0e2231; - color: #f8f8f8; - font-style: italic; -} - -.hljs-addition { - background-color: #253b22; - color: #f8f8f8; -} - -.hljs-deletion { - background-color: #420e09; - color: #f8f8f8; -} - -.hljs-selector-class { - color: #9b703f; -} - -.hljs-selector-id { - color: #8b98ab; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/tomorrow-night-blue.css b/app/src/main/assets/highlight/styles/themes/tomorrow-night-blue.css deleted file mode 100644 index bec1e683d..000000000 --- a/app/src/main/assets/highlight/styles/themes/tomorrow-night-blue.css +++ /dev/null @@ -1,75 +0,0 @@ -/* Tomorrow Night Blue Theme */ -/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ -/* Original theme - https://github.com/chriskempson/tomorrow-theme */ -/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ - -/* Tomorrow Comment */ -.hljs-comment, -.hljs-quote { - color: #7285b7; -} - -/* Tomorrow Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-tag, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class, -.hljs-regexp, -.hljs-deletion { - color: #ff9da4; -} - -/* Tomorrow Orange */ -.hljs-number, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params, -.hljs-meta, -.hljs-link { - color: #ffc58f; -} - -/* Tomorrow Yellow */ -.hljs-attribute { - color: #ffeead; -} - -/* Tomorrow Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet, -.hljs-addition { - color: #d1f1a9; -} - -/* Tomorrow Blue */ -.hljs-title, -.hljs-section { - color: #bbdaff; -} - -/* Tomorrow Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #ebbbff; -} - -.hljs { - display: block; - overflow-x: auto; - - color: white; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/tomorrow-night-bright.css b/app/src/main/assets/highlight/styles/themes/tomorrow-night-bright.css deleted file mode 100644 index c77793170..000000000 --- a/app/src/main/assets/highlight/styles/themes/tomorrow-night-bright.css +++ /dev/null @@ -1,73 +0,0 @@ -/* Tomorrow Night Bright Theme */ -/* Original theme - https://github.com/chriskempson/tomorrow-theme */ -/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ - -/* Tomorrow Comment */ -.hljs-comment, -.hljs-quote { - color: #969896; -} - -/* Tomorrow Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-tag, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class, -.hljs-regexp, -.hljs-deletion { - color: #d54e53; -} - -/* Tomorrow Orange */ -.hljs-number, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params, -.hljs-meta, -.hljs-link { - color: #e78c45; -} - -/* Tomorrow Yellow */ -.hljs-attribute { - color: #e7c547; -} - -/* Tomorrow Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet, -.hljs-addition { - color: #b9ca4a; -} - -/* Tomorrow Blue */ -.hljs-title, -.hljs-section { - color: #7aa6da; -} - -/* Tomorrow Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #c397d8; -} - -.hljs { - display: block; - overflow-x: auto; - color: #eaeaea; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/tomorrow-night-eighties.css b/app/src/main/assets/highlight/styles/themes/tomorrow-night-eighties.css deleted file mode 100644 index a31f76bb1..000000000 --- a/app/src/main/assets/highlight/styles/themes/tomorrow-night-eighties.css +++ /dev/null @@ -1,74 +0,0 @@ -/* Tomorrow Night Eighties Theme */ -/* Original theme - https://github.com/chriskempson/tomorrow-theme */ -/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ - -/* Tomorrow Comment */ -.hljs-comment, -.hljs-quote { - color: #999999; -} - -/* Tomorrow Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-tag, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class, -.hljs-regexp, -.hljs-deletion { - color: #f2777a; -} - -/* Tomorrow Orange */ -.hljs-number, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params, -.hljs-meta, -.hljs-link { - color: #f99157; -} - -/* Tomorrow Yellow */ -.hljs-attribute { - color: #ffcc66; -} - -/* Tomorrow Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet, -.hljs-addition { - color: #99cc99; -} - -/* Tomorrow Blue */ -.hljs-title, -.hljs-section { - color: #6699cc; -} - -/* Tomorrow Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #cc99cc; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #cccccc; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/tomorrow-night.css b/app/src/main/assets/highlight/styles/themes/tomorrow-night.css deleted file mode 100644 index 6e9164e0b..000000000 --- a/app/src/main/assets/highlight/styles/themes/tomorrow-night.css +++ /dev/null @@ -1,75 +0,0 @@ -/* Tomorrow Night Theme */ -/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ -/* Original theme - https://github.com/chriskempson/tomorrow-theme */ -/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ - -/* Tomorrow Comment */ -.hljs-comment, -.hljs-quote { - color: #969896; -} - -/* Tomorrow Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-tag, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class, -.hljs-regexp, -.hljs-deletion { - color: #cc6666; -} - -/* Tomorrow Orange */ -.hljs-number, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params, -.hljs-meta, -.hljs-link { - color: #de935f; -} - -/* Tomorrow Yellow */ -.hljs-attribute { - color: #f0c674; -} - -/* Tomorrow Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet, -.hljs-addition { - color: #b5bd68; -} - -/* Tomorrow Blue */ -.hljs-title, -.hljs-section { - color: #81a2be; -} - -/* Tomorrow Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #b294bb; -} - -.hljs { - display: block; - overflow-x: auto; - - color: #c5c8c6; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/tomorrow.css b/app/src/main/assets/highlight/styles/themes/tomorrow.css deleted file mode 100644 index 82666e064..000000000 --- a/app/src/main/assets/highlight/styles/themes/tomorrow.css +++ /dev/null @@ -1,71 +0,0 @@ -/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ - -/* Tomorrow Comment */ -.hljs-comment, -.hljs-quote { - color: #8e908c; -} - -/* Tomorrow Red */ -.hljs-variable, -.hljs-template-variable, -.hljs-tag, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class, -.hljs-regexp, -.hljs-deletion { - color: #c82829; -} - -/* Tomorrow Orange */ -.hljs-number, -.hljs-built_in, -.hljs-builtin-name, -.hljs-literal, -.hljs-type, -.hljs-params, -.hljs-meta, -.hljs-link { - color: #f5871f; -} - -/* Tomorrow Yellow */ -.hljs-attribute { - color: #eab700; -} - -/* Tomorrow Green */ -.hljs-string, -.hljs-symbol, -.hljs-bullet, -.hljs-addition { - color: #718c00; -} - -/* Tomorrow Blue */ -.hljs-title, -.hljs-section { - color: #4271ae; -} - -/* Tomorrow Purple */ -.hljs-keyword, -.hljs-selector-tag { - color: #8959a8; -} - -.hljs { - display: block; - overflow-x: auto; - color: #4d4d4c; - padding: 0px; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/vs.css b/app/src/main/assets/highlight/styles/themes/vs.css deleted file mode 100644 index 76f8e678e..000000000 --- a/app/src/main/assets/highlight/styles/themes/vs.css +++ /dev/null @@ -1,67 +0,0 @@ -/* - -Visual Studio-like style based on original C# coloring by Jason Diamond - -*/ -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - color: black; -} - -.hljs-comment, -.hljs-quote, -.hljs-variable { - color: #008000; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-built_in, -.hljs-name, -.hljs-tag { - color: #00f; -} - -.hljs-string, -.hljs-title, -.hljs-section, -.hljs-attribute, -.hljs-literal, -.hljs-template-tag, -.hljs-template-variable, -.hljs-type, -.hljs-addition { - color: #a31515; -} - -.hljs-deletion, -.hljs-selector-attr, -.hljs-selector-pseudo, -.hljs-meta { - color: #2b91af; -} - -.hljs-doctag { - color: #808080; -} - -.hljs-attr { - color: #f00; -} - -.hljs-symbol, -.hljs-bullet, -.hljs-link { - color: #00b0e8; -} - - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/highlight/styles/themes/vs2015.css b/app/src/main/assets/highlight/styles/themes/vs2015.css deleted file mode 100644 index 99cf22d1b..000000000 --- a/app/src/main/assets/highlight/styles/themes/vs2015.css +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Visual Studio 2015 dark style - * Author: Nicolas LLOBERA - */ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - - color: #DCDCDC; -} - -.hljs-keyword, -.hljs-literal, -.hljs-symbol, -.hljs-name { - color: #569CD6; -} -.hljs-link { - color: #569CD6; - text-decoration: underline; -} - -.hljs-built_in, -.hljs-type { - color: #4EC9B0; -} - -.hljs-number, -.hljs-class { - color: #B8D7A3; -} - -.hljs-string, -.hljs-meta-string { - color: #D69D85; -} - -.hljs-regexp, -.hljs-template-tag { - color: #9A5334; -} - -.hljs-subst, -.hljs-function, -.hljs-title, -.hljs-params, -.hljs-formula { - color: #DCDCDC; -} - -.hljs-comment, -.hljs-quote { - color: #57A64A; - font-style: italic; -} - -.hljs-doctag { - color: #608B4E; -} - -.hljs-meta, -.hljs-meta-keyword, -.hljs-tag { - color: #9B9B9B; -} - -.hljs-variable, -.hljs-template-variable { - color: #BD63C5; -} - -.hljs-attr, -.hljs-attribute, -.hljs-builtin-name { - color: #9CDCFE; -} - -.hljs-section { - color: gold; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} - -/*.hljs-code { - font-family:'Monospace'; -}*/ - -.hljs-bullet, -.hljs-selector-tag, -.hljs-selector-id, -.hljs-selector-class, -.hljs-selector-attr, -.hljs-selector-pseudo { - color: #D7BA7D; -} - -.hljs-addition { - background-color: #144212; - display: inline-block; - width: 100%; -} - -.hljs-deletion { - background-color: #600; - display: inline-block; - width: 100%; -} diff --git a/app/src/main/assets/highlight/styles/themes/xcode.css b/app/src/main/assets/highlight/styles/themes/xcode.css deleted file mode 100644 index 980ec3e4e..000000000 --- a/app/src/main/assets/highlight/styles/themes/xcode.css +++ /dev/null @@ -1,92 +0,0 @@ -/* - -XCode style (c) Angel Garcia - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - color: black; -} - -.hljs-comment, -.hljs-quote { - color: #006a00; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-literal { - color: #aa0d91; -} - -.hljs-name { - color: #008; -} - -.hljs-variable, -.hljs-template-variable { - color: #660; -} - -.hljs-string { - color: #c41a16; -} - -.hljs-regexp, -.hljs-link { - color: #080; -} - -.hljs-title, -.hljs-tag, -.hljs-symbol, -.hljs-bullet, -.hljs-number, -.hljs-meta { - color: #1c00cf; -} - -.hljs-section, -.hljs-class .hljs-title, -.hljs-type, -.hljs-attr, -.hljs-built_in, -.hljs-builtin-name, -.hljs-params { - color: #5c2699; -} - -.hljs-attribute, -.hljs-subst { - color: #000; -} - -.hljs-formula { - background-color: #eee; - font-style: italic; -} - -.hljs-addition { - background-color: #baeeba; -} - -.hljs-deletion { - background-color: #ffc8bd; -} - -.hljs-selector-id, -.hljs-selector-class { - color: #9b703f; -} - -.hljs-doctag, -.hljs-strong { - font-weight: bold; -} - -.hljs-emphasis { - font-style: italic; -} diff --git a/app/src/main/assets/highlight/styles/themes/xt256.css b/app/src/main/assets/highlight/styles/themes/xt256.css deleted file mode 100644 index 82a952392..000000000 --- a/app/src/main/assets/highlight/styles/themes/xt256.css +++ /dev/null @@ -1,92 +0,0 @@ - -/* - xt256.css - - Contact: initbar [at] protonmail [dot] ch - : github.com/initbar -*/ - -.hljs { - display: block; - overflow-x: auto; - color: #eaeaea; - - padding: 0.5; -} - -.hljs-subst { - color: #eaeaea; -} - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} - -.hljs-builtin-name, -.hljs-type { - color: #eaeaea; -} - -.hljs-params { - color: #da0000; -} - -.hljs-literal, -.hljs-number, -.hljs-name { - color: #ff0000; - font-weight: bolder; -} - -.hljs-comment { - color: #969896; -} - -.hljs-selector-id, -.hljs-quote { - color: #00ffff; -} - -.hljs-template-variable, -.hljs-variable, -.hljs-title { - color: #00ffff; - font-weight: bold; -} - -.hljs-selector-class, -.hljs-keyword, -.hljs-symbol { - color: #fff000; -} - -.hljs-string, -.hljs-bullet { - color: #00ff00; -} - -.hljs-tag, -.hljs-section { - color: #000fff; -} - -.hljs-selector-tag { - color: #000fff; - font-weight: bold; -} - -.hljs-attribute, -.hljs-built_in, -.hljs-regexp, -.hljs-link { - color: #ff00ff; -} - -.hljs-meta { - color: #fff; - font-weight: bolder; -} diff --git a/app/src/main/assets/highlight/styles/themes/zenburn.css b/app/src/main/assets/highlight/styles/themes/zenburn.css deleted file mode 100644 index 5e697a3fb..000000000 --- a/app/src/main/assets/highlight/styles/themes/zenburn.css +++ /dev/null @@ -1,80 +0,0 @@ -/* - -Zenburn style from voldmar.ru (c) Vladimir Epifanov -based on dark.css by Ivan Sagalaev - -*/ - -.hljs { - display: block; - overflow-x: auto; - padding: 0px; - - color: #dcdcdc; -} - -.hljs-keyword, -.hljs-selector-tag, -.hljs-tag { - color: #e3ceab; -} - -.hljs-template-tag { - color: #dcdcdc; -} - -.hljs-number { - color: #8cd0d3; -} - -.hljs-variable, -.hljs-template-variable, -.hljs-attribute { - color: #efdcbc; -} - -.hljs-literal { - color: #efefaf; -} - -.hljs-subst { - color: #8f8f8f; -} - -.hljs-title, -.hljs-name, -.hljs-selector-id, -.hljs-selector-class, -.hljs-section, -.hljs-type { - color: #efef8f; -} - -.hljs-symbol, -.hljs-bullet, -.hljs-link { - color: #dca3a3; -} - -.hljs-deletion, -.hljs-string, -.hljs-built_in, -.hljs-builtin-name { - color: #cc9393; -} - -.hljs-addition, -.hljs-comment, -.hljs-quote, -.hljs-meta { - color: #7f9f7f; -} - - -.hljs-emphasis { - font-style: italic; -} - -.hljs-strong { - font-weight: bold; -} diff --git a/app/src/main/assets/md/github.css b/app/src/main/assets/md/github.css deleted file mode 100644 index dc87ff923..000000000 --- a/app/src/main/assets/md/github.css +++ /dev/null @@ -1,637 +0,0 @@ -body { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; - font-size: 16px; - padding: 10px; - line-height: 1.5; - word-wrap: break-word -} - -body::before { - display: table; - content: "" -} - -body::after { - display: table; - clear: both; - content: "" -} - -body>:first-child { - margin-top: 0!important -} - -body:last-child { - margin-bottom: 46px !important -} - -body a:not([href]) { - color: inherit; - text-decoration: none -} - -body .absent { - color: #c00 -} - -body .anchor { - float: left; - padding-right: 4px; - margin-left: -10px; - line-height: 1 -} - -body .anchor:focus { - outline: none -} - -body p, body blockquote, body ul, body ol, body dl, body table, body pre { - margin-top: 0; - margin-bottom: 10px -} - -body hr { - height: .25em; - padding: 0; - margin: 24px 0; - background-color: #e7e7e7; - border: 0 -} - -body blockquote { - padding: 0 1em; - color: #777; - border-left: .25em solid #ddd -} - -body blockquote>:first-child { - margin-top: 0 -} - -body blockquote>:last-child { - margin-bottom: 0 -} - -body kbd { - display: inline-block; - padding: 3px 5px; - font-size: 11px; - line-height: 10px; - color: #555; - vertical-align: middle; - background-color: #fcfcfc; - border: solid 1px #ccc; - border-bottom-color: #bbb; - border-radius: 3px; - box-shadow: inset 0 -1px 0 #bbb -} - -body .loweralpha { - list-style-type: lower-alpha -} - -body h1, body h2, body h3, body h4, body h5, body h6 { - margin-top: 24px; - margin-bottom: 16px; - font-weight: 600; - line-height: 1.25 -} - -body h1 .octicon-link, body h2 .octicon-link, body h3 .octicon-link, body h4 .octicon-link, body h5 .octicon-link, body h6 .octicon-link { - color: #000; - vertical-align: middle; - visibility: hidden -} - -body h1:hover .anchor, body h2:hover .anchor, body h3:hover .anchor, body h4:hover .anchor, body h5:hover .anchor, body h6:hover .anchor { - text-decoration: none -} - -body h1:hover .anchor .octicon-link, body h2:hover .anchor .octicon-link, body h3:hover .anchor .octicon-link, body h4:hover .anchor .octicon-link, body h5:hover .anchor .octicon-link, body h6:hover .anchor .octicon-link { - visibility: visible -} - -body h1 tt, body h1 code, body h2 tt, body h2 code, body h3 tt, body h3 code, body h4 tt, body h4 code, body h5 tt, body h5 code, body h6 tt, body h6 code { - font-size: inherit -} - -body h1 { - padding-bottom: .3em; - font-size: 2em; - border-bottom: 1px solid #eee -} - -.gh-header-meta { - padding-bottom: .3em; - margin-bottom: 6px; - border-bottom: 1px solid #eee -} - -body h2 { - padding-bottom: .3em; - font-size: 1.5em; - border-bottom: 1px solid #eee -} - -body h3 { - font-size: 1.25em -} - -body h4 { - font-size: 1em -} - -body h5 { - font-size: .875em -} - -body h6 { - font-size: .85em; - color: #777 -} - -body ul, body ol { - padding-left: 1em -} - -body ul.no-list, body ol.no-list { - padding: 0; - list-style-type: none -} - -body ul ul, body ul ol, body ol ol, body ol ul { - margin-top: 0; - margin-bottom: 0 -} - -body li>p { - margin-top: 16px -} - -body li+li { - margin-top: .25em -} - -body dl { - padding: 0 -} - -body dl dt { - padding: 0; - margin-top: 16px; - font-size: 1em; - font-style: italic; - font-weight: 700 -} - -body dl dd { - padding: 0 16px; - margin-bottom: 16px -} - -body table { - display: block; - width: 100%; - overflow: auto -} - -body table th { - font-weight: 700 -} - -body table th, body table td { - padding: 6px 13px; - border: 1px solid #ddd -} - -body table tr { - background-color: #fff; - border-top: 1px solid #ccc -} - -body table tr:nth-child(2n) { - background-color: #f8f8f8 -} - -body img { - max-width: 100%; - box-sizing: content-box; - background-color: #fff -} - -body img[align=right] { - padding-left: 10px -} - -body img[align=left] { - padding-right: 10px -} - -body .emoji { - max-width: none; - vertical-align: text-top; - background-color: transparent -} - -body span.frame { - display: block; - overflow: hidden -} - -body span.frame>span { - display: block; - float: left; - width: auto; - padding: 7px; - margin: 13px 0 0; - overflow: hidden; - border: 1px solid #ddd -} - -body span.frame span img { - display: block; - float: left -} - -body span.frame span span { - display: block; - padding: 5px 0 0; - clear: both; - color: #333 -} - -body span.align-center { - display: block; - overflow: hidden; - clear: both -} - -body span.align-center>span { - display: block; - margin: 8px auto 0; - overflow: hidden; - text-align: center -} - -body span.align-center span img { - margin: 0 auto; - text-align: center -} - -body span.align-right { - display: block; - overflow: hidden; - clear: both -} - -body span.align-right>span { - display: block; - margin: 8px 0 0; - overflow: hidden; - text-align: right -} - -body span.align-right span img { - margin: 0; - text-align: right -} - -body span.float-left { - display: block; - float: left; - margin-right: 8px; - overflow: hidden -} - -body span.float-left span { - margin: 8px 0 0 -} - -body span.float-right { - display: block; - float: right; - margin-left: 8px; - overflow: hidden -} - -body span.float-right>span { - display: block; - margin: 8px auto 0; - overflow: hidden; - text-align: right -} - -body code, body tt { - padding: 0; - padding-top: .1em; - padding-bottom: .1em; - margin: 0; - font-size: 85%; - background-color: rgba(0, 0, 0, 0.04); - border-radius: 3px -} - -body code::before, body code::after, body tt::before, body tt::after { - letter-spacing: -.1em; - content: "\00a0" -} - -body code br, body tt br { - display: none -} - -body del code { - text-decoration: inherit -} - -body pre { - word-wrap: normal -} - -body pre>code { - padding: 0; - margin: 0; - font-size: 100%; - word-break: normal; - white-space: pre; - background: transparent; - border: 0 -} - -body .highlight { - margin-bottom: 10px -} - -body .highlight pre { - margin-bottom: 0; - word-break: normal -} - -body .highlight pre, body pre { - padding: 10px; - overflow: auto; - font-size: 85%; - line-height: 1.45; - background-color: #f6f8fa; - border-radius: 3px -} - -body pre code, body pre tt { - display: inline; - max-width: auto; - padding: 0; - margin: 0; - overflow: visible; - line-height: inherit; - word-wrap: normal; - background-color: transparent; - border: 0 -} - -body pre code::before, body pre code::after, body pre tt::before, body pre tt::after { - content: normal -} - -body .csv-data td, body .csv-data th { - padding: 5px; - overflow: hidden; - font-size: 12px; - line-height: 1; - text-align: left; - white-space: nowrap -} - -body .csv-data .blob-num { - padding: 10px 8px 9px; - text-align: right; - background: #fff; - border: 0 -} - -body .csv-data tr { - border-top: 0 -} - -body .csv-data th { - font-weight: 700; - background: #f8f8f8; - border-top: 0 -} - -body { - font-size: 15px -} - -body blockquote { - margin-right: 0; - margin-left: 0 -} - -body code { - white-space: normal -} - -body.email-format { - line-height: 1.5em!important -} - -body.email-format div { - white-space: pre-wrap -} - -body .email-hidden-reply { - display: none; - white-space: pre-wrap -} - -body .email-hidden-reply.expanded { - display: block -} - -body .email-quoted-reply, body .email-signature-reply { - padding: 0 10px; - margin-bottom: 10px; - color: #767676; - border-left: 4px solid #ddd -} - -.pl-c { - color: #969896 -} - -.pl-c1, .pl-s .pl-v { - color: #0086b3 -} - -.pl-e, .pl-en { - color: #795da3 -} - -.pl-smi, .pl-s .pl-s1 { - color: #333 -} - -.pl-ent { - color: #63a35c -} - -.pl-k { - color: #a71d5d -} - -.pl-s, .pl-pds, .pl-s .pl-pse .pl-s1, .pl-sr, .pl-sr .pl-cce, .pl-sr .pl-sre, .pl-sr .pl-sra { - color: #183691 -} - -.pl-v { - color: #ed6a43 -} - -.pl-id { - color: #b52a1d -} - -.pl-ii { - color: #f8f8f8; - background-color: #b52a1d -} - -.pl-sr .pl-cce { - font-weight: 700; - color: #63a35c -} - -.pl-ml { - color: #693a17 -} - -.pl-mh, .pl-mh .pl-en, .pl-ms { - font-weight: 700; - color: #1d3e81 -} - -.pl-mq { - color: teal -} - -.pl-mi { - font-style: italic; - color: #333 -} - -.pl-mb { - font-weight: 700; - color: #333 -} - -.pl-md { - color: #bd2c00; - background-color: #ffecec -} - -.pl-mi1 { - color: #55a532; - background-color: #eaffea -} - -.pl-mdr { - font-weight: 700; - color: #795da3 -} - -.pl-mo { - color: #1d3e81 -} - -kbd { - display: inline-block; - padding: 3px 5px; - font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace; - line-height: 10px; - color: #555; - vertical-align: middle; - background-color: #fcfcfc; - border: solid 1px #ccc; - border-bottom-color: #bbb; - border-radius: 3px; - box-shadow: inset 0 -1px 0 #bbb -} - -.badmono { - font-family: sans-serif; - font-weight: 700 -} -.task-list-item { - list-style-type: none -} -.task-list-item label { - font-weight: normal -} -.task-list-item.enabled label { - cursor: pointer -} -.task-list-item+.task-list-item { - margin-top: 3px -} -.task-list-item .handle { - display: none -} -.task-list-item-checkbox { - margin: 0 0.2em 0.25em -1.6em; - vertical-align: middle -} -.reorderable-task-lists .markdown-body .contains-task-list { - padding: 0 -} -.reorderable-task-lists .markdown-body li:not(.task-list-item) { - margin-left: 26px -} -.reorderable-task-lists .markdown-body .task-list-item { - padding-right: 15px; - padding-left: 42px; - margin-right: -15px; - margin-left: -15px; - border: 1px solid transparent -} -.reorderable-task-lists .markdown-body .task-list-item+.task-list-item { - margin-top: 0 -} -.reorderable-task-lists .markdown-body .task-list-item .contains-task-list { - padding-top: 4px -} -.reorderable-task-lists .markdown-body .task-list-item .handle { - display: block; - float: left; - width: 20px; - padding: 2px 0 0 2px; - margin-left: -43px; - opacity: 0 -} -.reorderable-task-lists .markdown-body .task-list-item .drag-handle { - fill: #333 -} -.reorderable-task-lists .markdown-body .task-list-item.hovered { - background: #fafafa; - border-top-color: #ededed; - border-bottom-color: #ededed -} -.reorderable-task-lists .markdown-body .task-list-item.hovered>.handle { - opacity: 1 -} -.reorderable-task-lists .markdown-body .task-list-item.is-dragging { - opacity: 0 -} -.reorderable-task-lists .markdown-body .task-list-item.is-ghost { - border-right-color: #ededed; - border-left-color: #ededed -} -.review-comment-contents .markdown-body .task-list-item { - padding-left: 42px; - margin-right: -12px; - margin-left: -12px; - border-top-left-radius: 3px; - border-bottom-left-radius: 3px -} -.review-comment-contents .markdown-body .task-list-item.hovered { - border-left-color: #ededed -} \ No newline at end of file diff --git a/app/src/main/assets/md/github_dark.css b/app/src/main/assets/md/github_dark.css deleted file mode 100644 index a695448c7..000000000 --- a/app/src/main/assets/md/github_dark.css +++ /dev/null @@ -1,642 +0,0 @@ -body { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; - font-size: 16px; - padding: 10px; - line-height: 1.5; - word-wrap: break-word; - color: #ccc; -} - -a { - color: #00E5FF !important; -} - -body::before { - display: table; - content: "" -} - -body::after { - display: table; - clear: both; - content: "" -} - -body>:first-child { - margin-top: 0!important -} - -body:last-child { - margin-bottom: 46px !important -} - -body a:not([href]) { - color: inherit; - text-decoration: none -} - -body .absent { - color: #c0392b -} - -body .anchor { - float: left; - padding-right: 4px; - margin-left: -10px; - line-height: 1 -} - -body .anchor:focus { - outline: none -} - -body p, body blockquote, body ul, body ol, body dl, body table, body pre { - margin-top: 0; - margin-bottom: 10px -} - -body hr { - height: .25em; - padding: 0; - margin: 24px 0; - background-color: #c0c0c0; - border: 0 -} - -body blockquote { - padding: 0 1em; - color: #78909C; - border-left: .25em solid #ddd -} - -body blockquote>:first-child { - margin-top: 0 -} - -body blockquote>:last-child { - margin-bottom: 0 -} - -body kbd { - display: inline-block; - padding: 3px 5px; - font-size: 11px; - line-height: 10px; - color: #fff; - vertical-align: middle; - border: solid 1px #656d78; - border-bottom-color: #bbb; - border-radius: 3px; - box-shadow: inset 0 -1px 0 #656d78 -} - -body .loweralpha { - list-style-type: lower-alpha -} - -body h1, body h2, body h3, body h4, body h5, body h6 { - margin-top: 24px; - margin-bottom: 16px; - font-weight: 600; - line-height: 1.25; - color: #fff; -} - -body h1 .octicon-link, body h2 .octicon-link, body h3 .octicon-link, body h4 .octicon-link, body h5 .octicon-link, body h6 .octicon-link { - color: #fff; - vertical-align: middle; - visibility: hidden -} - -body h1:hover .anchor, body h2:hover .anchor, body h3:hover .anchor, body h4:hover .anchor, body h5:hover .anchor, body h6:hover .anchor { - text-decoration: none -} - -body h1:hover .anchor .octicon-link, body h2:hover .anchor .octicon-link, body h3:hover .anchor .octicon-link, body h4:hover .anchor .octicon-link, body h5:hover .anchor .octicon-link, body h6:hover .anchor .octicon-link { - visibility: visible -} - -body h1 tt, body h1 code, body h2 tt, body h2 code, body h3 tt, body h3 code, body h4 tt, body h4 code, body h5 tt, body h5 code, body h6 tt, body h6 code { - font-size: inherit -} - -body h1 { - padding-bottom: .3em; - font-size: 2em; - border-bottom: 1px solid #656d78 -} - -.gh-header-meta { - padding-bottom: .3em; - margin-bottom: 6px; - border-bottom: 1px solid #656d78 -} - -body h2 { - padding-bottom: .3em; - font-size: 1.5em; - border-bottom: 1px solid #656d78 -} - -body h3 { - font-size: 1.25em -} - -body h4 { - font-size: 1em -} - -body h5 { - font-size: .875em -} - -body h6 { - font-size: .85em; - color: #c0c0c0 -} - -body ul, body ol { - padding-left: 1em -} - -body ul.no-list, body ol.no-list { - padding: 0; - list-style-type: none -} - -body ul ul, body ul ol, body ol ol, body ol ul { - margin-top: 0; - margin-bottom: 0 -} - -body li>p { - margin-top: 16px -} - -body li+li { - margin-top: .25em -} - -body dl { - padding: 0 -} - -body dl dt { - padding: 0; - margin-top: 16px; - font-size: 1em; - font-style: italic; - font-weight: 700 -} - -body dl dd { - padding: 0 16px; - margin-bottom: 16px -} - -body table { - display: block; - width: 100%; - overflow: auto -} - -body table th { - font-weight: 700 -} - -body table th, body table td { - padding: 6px 13px; - border: 1px solid #656d78 -} - -body table tr { - background-color: transparent; - border-top: 1px solid #656d78 -} - -body table tr:nth-child(2n) { - background-color: #656d78 -} - -body img { - max-width: 100%; - box-sizing: content-box; - background-color: transparent; -} - -body img[align=right] { - padding-left: 10px -} - -body img[align=left] { - padding-right: 10px -} - -body .emoji { - max-width: none; - vertical-align: text-top; - background-color: transparent -} - -body span.frame { - display: block; - overflow: hidden -} - -body span.frame>span { - display: block; - float: left; - width: auto; - padding: 7px; - margin: 13px 0 0; - overflow: hidden; - border: 1px solid #656d78 -} - -body span.frame span img { - display: block; - float: left -} - -body span.frame span span { - display: block; - padding: 5px 0 0; - clear: both; - color: #ccc -} - -body span.align-center { - display: block; - overflow: hidden; - clear: both -} - -body span.align-center>span { - display: block; - margin: 13px auto 0; - overflow: hidden; - text-align: center -} - -body span.align-center span img { - margin: 0 auto; - text-align: center -} - -body span.align-right { - display: block; - overflow: hidden; - clear: both -} - -body span.align-right>span { - display: block; - margin: 13px 0 0; - overflow: hidden; - text-align: right -} - -body span.align-right span img { - margin: 0; - text-align: right -} - -body span.float-left { - display: block; - float: left; - margin-right: 8px; - overflow: hidden -} - -body span.float-left span { - margin: 8px 0 0 -} - -body span.float-right { - display: block; - float: right; - margin-left: 8px; - overflow: hidden -} - -body span.float-right>span { - display: block; - margin: 8px auto 0; - overflow: hidden; - text-align: right -} - -body code, body tt { - padding: 0; - padding-top: .1em; - padding-bottom: .2em; - margin: 0; - font-size: 85%; - background-color: rgba(84, 84, 84, 0.04); - border-radius: 3px -} - -body code::before, body code::after, body tt::before, body tt::after { - letter-spacing: -.2em; - content: "\00a0" -} - -body code br, body tt br { - display: none -} - -body del code { - text-decoration: inherit -} - -body pre { - word-wrap: normal -} - -body pre>code { - padding: 0; - margin: 0; - font-size: 100%; - word-break: normal; - white-space: pre; - background: transparent; - border: 0 -} - -body .highlight { - margin-bottom: 10px -} - -body .highlight pre { - margin-bottom: 0; - word-break: normal -} - -body .highlight pre, body pre { - padding: 16px; - overflow: auto; - font-size: 85%; - line-height: 1.45; - border-radius: 3px -} - -body pre code, body pre tt { - display: inline; - max-width: auto; - padding: 0; - margin: 0; - overflow: visible; - line-height: inherit; - word-wrap: normal; - background-color: transparent; - border: 0 -} - -body pre code::before, body pre code::after, body pre tt::before, body pre tt::after { - content: normal -} - -body .csv-data td, body .csv-data th { - padding: 5px; - overflow: hidden; - font-size: 12px; - line-height: 1; - text-align: left; - white-space: nowrap -} - -body .csv-data .blob-num { - padding: 10px 8px 9px; - text-align: right; - background: #656d78; - border: 0 -} - -body .csv-data tr { - border-top: 0 -} - -body .csv-data th { - font-weight: 700; - background: #656d78; - border-top: 0 -} - -body { - font-size: 15px -} - -body blockquote { - margin-right: 0; - margin-left: 0 -} - -body code { - white-space: normal -} - -body.email-format { - line-height: 1.5em!important -} - -body.email-format div { - white-space: pre-wrap -} - -body .email-hidden-reply { - display: none; - white-space: pre-wrap -} - -body .email-hidden-reply.expanded { - display: block -} - -body .email-quoted-reply, body .email-signature-reply { - padding: 0 10px; - margin-bottom: 10px; - color: #c0c0c0; - border-left: 4px solid #656d78 -} - -.pl-c { - color: #969896 -} - -.pl-c1, .pl-s .pl-v { - color: #0086b3 -} - -.pl-e, .pl-en { - color: #795da3 -} - -.pl-smi, .pl-s .pl-s1 { - color: #78909C -} - -.pl-ent { - color: #388E3C -} - -.pl-k { - color: #a71d5d -} - -.pl-s, .pl-pds, .pl-s .pl-pse .pl-s1, .pl-sr, .pl-sr .pl-cce, .pl-sr .pl-sre, .pl-sr .pl-sra { - color: #1976D2 -} - -.pl-v { - color: #ed6a43 -} - -.pl-id { - color: #b52a1d -} - -.pl-ii { - color: #f8f8f8; - background-color: #b52a1d -} - -.pl-sr .pl-cce { - font-weight: 700; - color: #388E3C -} - -.pl-ml { - color: #7f8c8d; -} - -.pl-mh, .pl-mh .pl-en, .pl-ms { - font-weight: 700; - color: #1976D2 -} - -.pl-mq { - color: #0097A7 -} - -.pl-mi { - font-style: italic; - color: #78909C -} - -.pl-mb { - font-weight: 700; - color: #78909C -} - -.pl-md { - color: #bd2c00; - background-color: #ffecec -} - -.pl-mi1 { - color: #55a532; - background-color: #eaffea -} - -.pl-mdr { - font-weight: 700; - color: #795da3 -} - -.pl-mo { - color: #1976D2 -} - -kbd { - display: inline-block; - padding: 3px 5px; - font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace; - line-height: 10px; - color: #555; - vertical-align: middle; - background-color: #656d78; - border: solid 1px #586b78; - border-bottom-color: #556578; - border-radius: 3px; - box-shadow: inset 0 -1px 0 #656d78 -} - -.badmono { - font-family: sans-serif; - font-weight: 700 -} - -.task-list-item { - list-style-type: none -} -.task-list-item label { - font-weight: normal -} -.task-list-item.enabled label { - cursor: pointer -} -.task-list-item+.task-list-item { - margin-top: 3px -} -.task-list-item .handle { - display: none -} -.task-list-item-checkbox { - margin: 0 0.2em 0.25em -1.6em; - vertical-align: middle -} -.reorderable-task-lists .markdown-body .contains-task-list { - padding: 0 -} -.reorderable-task-lists .markdown-body li:not(.task-list-item) { - margin-left: 26px -} -.reorderable-task-lists .markdown-body .task-list-item { - padding-right: 15px; - padding-left: 42px; - margin-right: -15px; - margin-left: -15px; - border: 1px solid transparent -} -.reorderable-task-lists .markdown-body .task-list-item+.task-list-item { - margin-top: 0 -} -.reorderable-task-lists .markdown-body .task-list-item .contains-task-list { - padding-top: 4px -} -.reorderable-task-lists .markdown-body .task-list-item .handle { - display: block; - float: left; - width: 20px; - padding: 2px 0 0 2px; - margin-left: -43px; - opacity: 0 -} -.reorderable-task-lists .markdown-body .task-list-item .drag-handle { - fill: #333 -} -.reorderable-task-lists .markdown-body .task-list-item.hovered { - background: #fafafa; - border-top-color: #ededed; - border-bottom-color: #ededed -} -.reorderable-task-lists .markdown-body .task-list-item.hovered>.handle { - opacity: 1 -} -.reorderable-task-lists .markdown-body .task-list-item.is-dragging { - opacity: 0 -} -.reorderable-task-lists .markdown-body .task-list-item.is-ghost { - border-right-color: #ededed; - border-left-color: #ededed -} -.review-comment-contents .markdown-body .task-list-item { - padding-left: 42px; - margin-right: -12px; - margin-left: -12px; - border-top-left-radius: 3px; - border-bottom-left-radius: 3px -} -.review-comment-contents .markdown-body .task-list-item.hovered { - border-left-color: #ededed -} diff --git a/app/src/main/assets/md/intercept-hash.js b/app/src/main/assets/md/intercept-hash.js deleted file mode 100644 index f1cd0d17f..000000000 --- a/app/src/main/assets/md/intercept-hash.js +++ /dev/null @@ -1,43 +0,0 @@ -window.onload = function () { - var hash = window.location.hash.substr(1); - if (hash !== "") { - scrollTo(hash); - } -}; - -function scrollTo(hash) { - var element = document.getElementById("user-content-" + hash); - if (element) { - element.scrollIntoView(); - } else { - element = document.querySelector('[href="#' + hash + '"]'); - if (element) { - element.scrollIntoView(); - } else { - //HACK!!! - var names = hash.trim().split("-").join(" "); - if (names) { - var elements = document.querySelectorAll("h1"); - for (var index = 0; index < elements.length; index++) { - if (elements[index].innerText.toLowerCase() === names.toLowerCase()) { - elements[index].scrollIntoView(); - } - } - } - } - } -} - -window.onclick = function (e) { - if (e.target.localName === 'a') { - var href = e.target; - href = href.toString().replace("file:///android_asset/md/", ""); - if (hasHashtag(href)) { - scrollTo(href.substr(href.indexOf("#"), href.length).replace("#", "")); - } - } -}; - -function hasHashtag(url) { - return (url.indexOf("#") !== -1); -} diff --git a/app/src/main/assets/md/intercept-touch.js b/app/src/main/assets/md/intercept-touch.js deleted file mode 100644 index cf314bd15..000000000 --- a/app/src/main/assets/md/intercept-touch.js +++ /dev/null @@ -1,29 +0,0 @@ -document.addEventListener("DOMContentLoaded", function(event) { - document.querySelectorAll('img').forEach(function(img){ - img.onerror = function(){this.style.display='none';}; - }); -}); - -window.onload = function() { - addTouchEvents(document.getElementsByTagName("pre")); - addTouchEvents(document.getElementsByTagName("table")); - var hash = window.location.hash.substr(1); - if (hash != ""){ - scrollTo(hash); - } -}; - -function addTouchEvents(elements) { - for (var i = 0; i < elements.length; i++) { - elements[i].addEventListener("touchstart", touchStart, false); - elements[i].addEventListener("touchend", touchEnd, false); - } -} - -function touchStart(event) { - Android.startIntercept(); -} - -function touchEnd(event) { - Android.stopIntercept(); -} \ No newline at end of file diff --git a/app/src/main/graphql/github/PinnedRepos.graphql b/app/src/main/graphql/github/PinnedRepos.graphql deleted file mode 100644 index cfa1a23cd..000000000 --- a/app/src/main/graphql/github/PinnedRepos.graphql +++ /dev/null @@ -1,28 +0,0 @@ -query getPinnedRepos($login: String!) { - user(login: $login) { - pinnedRepositories(first: 100) { - edges { - node { - name - url - issues(states: [OPEN]) { - totalCount - } - pullRequests(states: [OPEN]) { - totalCount - } - stargazers { - totalCount - } - forks { - totalCount - } - primaryLanguage { - name - color - } - } - } - } - } -} \ No newline at end of file diff --git a/app/src/main/graphql/github/PullRequestTimeline.graphql b/app/src/main/graphql/github/PullRequestTimeline.graphql deleted file mode 100644 index ab11f4eea..000000000 --- a/app/src/main/graphql/github/PullRequestTimeline.graphql +++ /dev/null @@ -1,521 +0,0 @@ -query PullRequestTimeline($owner: String!, $name: String!, $number: Int!, $page: String) { - repository(owner: $owner, name: $name) { - pullRequest(number: $number) { - pullRequestCommits: commits(last: 1) { - pullRequestCommit: nodes { - commit { - status { - state - contexts { - state - context - description - targetUrl - } - } - } - } - } - timeline(first: 30 after: $page) { - edges { - cursor - } - pageInfo { - hasNextPage - startCursor - endCursor - } - totalCount - nodes { - ... on Commit { - id - oid - url - committedDate - messageHeadline - status { - state - } - author { - name - user { - login - url - avatarUrl - } - } - } - ... on CommitCommentThread { - path - position - commit { - oid - } - comments(first: 30) { - edges { - node { - id - authorAssociation - bodyHTML - body - createdAt - reactionGroups { - viewerHasReacted - content - users { - totalCount - } - } - lastEditedAt - author { - avatarUrl - login - url - } - } - } - } - } - ... on PullRequestReview { - id - url - bodyHTML - submittedAt - createdAt - state - author { - login - url - avatarUrl - } - comments(first: 30) { - edges { - node { - id - authorAssociation - bodyHTML - diffHunk - createdAt - url - originalPosition - path - position - author { - login - avatarUrl - url - } - reactionGroups { - viewerHasReacted - content - users { - totalCount - } - } - } - } - } - } - ... on IssueComment { - id - bodyHTML - createdAt - updatedAt - viewerCanReact - viewerCanDelete - viewerCanUpdate - viewerDidAuthor - authorAssociation - lastEditedAt - author { - login - url - avatarUrl - } - reactionGroups { - viewerHasReacted - content - users { - totalCount - } - } - } - ... on ClosedEvent { - createdAt - actor { - login - avatarUrl - url - } - commit { - oid - url - messageHeadline - } - } - ... on ReopenedEvent { - createdAt - actor { - login - avatarUrl - url - } - } - ... on MergedEvent { - id - url - createdAt - mergeRefName - commit { - oid - } - actor { - avatarUrl - login - url - } - } - ... on ReferencedEvent { - id - createdAt - isCrossRepository - isDirectReference - actor { - avatarUrl - login - url - } - commitRepository { - nameWithOwner - url - } - commit { - oid - } - subject { - __typename - ... on Issue { - title - number - } - ... on PullRequest { - title - number - } - } - } - ... on AssignedEvent { - id - createdAt - actor { - login - avatarUrl - url - } - user { - avatarUrl - login - url - } - } - ... on UnassignedEvent { - id - createdAt - actor { - login - avatarUrl - url - } - user { - avatarUrl - login - url - } - } - ... on LabeledEvent { - createdAt - actor { - login - avatarUrl - url - } - label { - color - name - } - } - ... on UnlabeledEvent { - createdAt - actor { - login - avatarUrl - url - } - label { - color - name - } - } - ... on MilestonedEvent { - createdAt - id - milestoneTitle - actor { - login - avatarUrl - url - } - } - ... on DemilestonedEvent { - createdAt - id - milestoneTitle - actor { - login - avatarUrl - url - } - } - ... on RenamedTitleEvent { - id - createdAt - currentTitle - previousTitle - actor { - login - avatarUrl - url - } - } - ... on LockedEvent { - createdAt - actor { - login - avatarUrl - url - } - } - ... on UnlockedEvent { - createdAt - actor { - login - avatarUrl - url - } - } - ... on DeployedEvent { - createdAt - actor { - login - avatarUrl - url - } - ref { - name - prefix - } - deployment { - createdAt - state - creator { - avatarUrl - login - url - } - latestStatus { - description - environmentUrl - state - } - statuses(first: 30) { - edges { - node { - creator { - avatarUrl - login - url - } - logUrl - state - description - environmentUrl - } - } - } - } - } - ... on HeadRefDeletedEvent { - createdAt - headRefName - actor { - avatarUrl - login - url - } - } - ... on HeadRefRestoredEvent { - actor { - avatarUrl - login - url - } - createdAt - pullRequest { - number - headRefName - } - } - ... on HeadRefForcePushedEvent { - createdAt - ref { - name - prefix - } - actor { - login - avatarUrl - url - } - afterCommit { - oid - url - } - beforeCommit { - oid - url - status { - state - contexts { - context - createdAt - description - state - targetUrl - creator { - avatarUrl - login - url - } - } - } - } - } - ... on BaseRefForcePushedEvent { - createdAt - ref { - name - prefix - } - actor { - login - avatarUrl - url - } - afterCommit { - oid - url - } - beforeCommit { - oid - url - status { - state - contexts { - context - createdAt - description - state - targetUrl - creator { - avatarUrl - login - url - } - } - } - } - } - ... on ReviewRequestedEvent { - id - createdAt - actor { - avatarUrl - login - url - } - subject { - avatarUrl - login - url - } - } - ... on ReviewRequestRemovedEvent { - id - createdAt - actor { - avatarUrl - login - url - } - subject { - avatarUrl - login - url - } - } - ... on ReviewDismissedEvent { - id - createdAt - messageHtml - previousReviewState - review { - id - submittedAt - authorAssociation - bodyHTML - state - viewerDidAuthor - author { - login - avatarUrl - url - } - comments(first: 30) { - edges { - node { - id - authorAssociation - bodyHTML - diffHunk - createdAt - url - originalPosition - path - position - author { - login - avatarUrl - url - } - reactionGroups { - viewerHasReacted - content - users { - totalCount - } - } - } - } - } - } - } - } - } - } - } - rateLimit { - cost - remaining - limit - } -} diff --git a/app/src/main/graphql/github/RepoProject.graphql b/app/src/main/graphql/github/RepoProject.graphql deleted file mode 100644 index 9dcdc8bc7..000000000 --- a/app/src/main/graphql/github/RepoProject.graphql +++ /dev/null @@ -1,157 +0,0 @@ -query repoProjectsOpen($owner: String!, $name: String!, $page: String) { -repository(owner: $owner, name: $name) { - projects(first: 30, states: [OPEN], after: $page, orderBy: {field: CREATED_AT, direction: DESC}) { - totalCount - edges { - cursor - } - pageInfo { - hasNextPage - startCursor - endCursor - } - nodes { - name - number - body - createdAt - id - viewerCanUpdate - columns(first: 1) { - totalCount - } - databaseId - } - } - } -} -query repoProjectsClosed($owner: String!, $name: String!, $page: String) { -repository(owner: $owner, name: $name) { - projects(first: 30, states: [CLOSED], after: $page, orderBy: {field: CREATED_AT, direction: DESC}) { - totalCount - edges { - cursor - } - pageInfo { - hasNextPage - startCursor - endCursor - } - nodes { - name - number - body - createdAt - id - viewerCanUpdate - columns(first: 1) { - totalCount - } - databaseId - } - } - } -} - -query orgProjectsOpen($owner: String!, $page: String) { -organization(login: $owner) { - projects(first: 30, states: [OPEN], after: $page, orderBy: {field: CREATED_AT, direction: DESC}) { - totalCount - edges { - cursor - } - pageInfo { - hasNextPage - startCursor - endCursor - } - nodes { - name - number - body - createdAt - id - viewerCanUpdate - columns(first: 1) { - totalCount - } - databaseId - } - } - } -} -query orgProjectsClosed($owner: String!, $page: String) { -organization(login: $owner) { - projects(first: 30, states: [CLOSED], after: $page, orderBy: {field: CREATED_AT, direction: DESC}) { - totalCount - edges { - cursor - } - pageInfo { - hasNextPage - startCursor - endCursor - } - nodes { - name - number - body - createdAt - id - viewerCanUpdate - columns(first: 1) { - totalCount - } - databaseId - } - } - } -} - -query getColumns($owner: String!, $name:String!,$number:Int!) { -repository(owner: $owner, name: $name) { - project(number: $number) { - name - viewerCanUpdate - columns(first: 100) { - nodes { - name - createdAt - id - cards(first: 100) { - nodes { - note - createdAt - url - content { - ... on Node { - __typename - } - ... on Issue { - title - url - number - issueState: state - } - ... on PullRequest { - title - url - number - PrState: state - } - ... on Comment { - body - author { - login - avatarUrl - url - } - } - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/app/src/main/graphql/github/schema.json b/app/src/main/graphql/github/schema.json deleted file mode 100644 index 0b9ea514d..000000000 --- a/app/src/main/graphql/github/schema.json +++ /dev/null @@ -1,34201 +0,0 @@ -{ - "data": { - "__schema": { - "queryType": { - "name": "Query" - }, - "mutationType": { - "name": "Mutation" - }, - "subscriptionType": null, - "types": [ - { - "kind": "OBJECT", - "name": "Query", - "description": "The query root of GitHub's GraphQL interface.", - "fields": [ - { - "name": "codeOfConduct", - "description": "Look up a code of conduct by its key", - "args": [ - { - "name": "key", - "description": "The code of conduct's key", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "CodeOfConduct", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "codesOfConduct", - "description": "Look up a code of conduct by its key", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "CodeOfConduct", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "Fetches an object given its ID.", - "args": [ - { - "name": "id", - "description": "ID of the object.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "Lookup nodes by a list of IDs.", - "args": [ - { - "name": "ids", - "description": "The list of node IDs.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - } - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "organization", - "description": "Lookup a organization by login.", - "args": [ - { - "name": "login", - "description": "The organization's login.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Organization", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "rateLimit", - "description": "The client's rate limit information.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "RateLimit", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "relay", - "description": "Hack to workaround https://github.com/facebook/relay/issues/112 re-exposing the root query object", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Query", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "Lookup a given repository by the owner and repository name.", - "args": [ - { - "name": "owner", - "description": "The login field of a user or organizationn", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "name", - "description": "The name of the repository", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repositoryOwner", - "description": "Lookup a repository owner (ie. either a User or an Organization) by login.", - "args": [ - { - "name": "login", - "description": "The username to lookup the owner by.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "INTERFACE", - "name": "RepositoryOwner", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resource", - "description": "Lookup resource by a URL.", - "args": [ - { - "name": "url", - "description": "The URL.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "INTERFACE", - "name": "UniformResourceLocatable", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "search", - "description": "Perform a search across resources.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "query", - "description": "The search string to look for.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "type", - "description": "The types of search items to search within.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "SearchType", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "SearchResultItemConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "topic", - "description": "Look up a topic by name.", - "args": [ - { - "name": "name", - "description": "The topic's name.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Topic", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "user", - "description": "Lookup a user by login.", - "args": [ - { - "name": "login", - "description": "The user's login.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "User", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewer", - "description": "The currently authenticated user.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INTERFACE", - "name": "Node", - "description": "An object with an ID.", - "fields": [ - { - "name": "id", - "description": "ID of the object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "AddedToProjectEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "AssignedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "BaseRefChangedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "BaseRefForcePushedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Blob", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Bot", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ClosedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "CommentDeletedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "CommitComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "CommitCommentThread", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ConvertedNoteToIssueEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "DemilestonedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "DeployedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Deployment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "DeploymentStatus", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ExternalIdentity", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Gist", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "GistComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "HeadRefDeletedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "HeadRefForcePushedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "HeadRefRestoredEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "IssueComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Label", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "LabeledEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Language", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "LockedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "MentionedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "MergedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Milestone", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "MilestonedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "MovedColumnsInProjectEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Organization", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "OrganizationIdentityProvider", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Project", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ProjectCard", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ProjectColumn", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ProtectedBranch", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestCommit", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReview", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReviewComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReviewThread", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PushAllowance", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Reaction", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Ref", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ReferencedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Release", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ReleaseAsset", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "RemovedFromProjectEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "RenamedTitleEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ReopenedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "RepositoryInvitation", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "RepositoryTopic", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ReviewDismissalAllowance", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ReviewDismissedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ReviewRequest", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ReviewRequestRemovedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ReviewRequestedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Status", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "StatusContext", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "SubscribedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Tag", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Team", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Topic", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Tree", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "UnassignedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "UnlabeledEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "UnlockedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "UnsubscribedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - ] - }, - { - "kind": "SCALAR", - "name": "ID", - "description": "Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `\"VXNlci0xMA==\"`) or integer (such as `4`) input value will be accepted as an ID.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INTERFACE", - "name": "UniformResourceLocatable", - "description": "Represents a type that can be retrieved by a URL.", - "fields": [ - { - "name": "resourcePath", - "description": "The HTML path to this resource.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "url", - "description": "The URL to this resource.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Bot", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "MergedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Milestone", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Organization", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestCommit", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Release", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "RepositoryTopic", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ReviewDismissedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - ] - }, - { - "kind": "SCALAR", - "name": "URI", - "description": "An RFC 3986, RFC 3987, and RFC 6570 (level 4) compliant URI string.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "User", - "description": "A user is an individual's account on GitHub that owns repositories and can make new content.", - "fields": [ - { - "name": "avatarUrl", - "description": "A URL pointing to the user's public avatar.", - "args": [ - { - "name": "size", - "description": "The size of the resulting square image.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bio", - "description": "The user's public profile bio.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bioHTML", - "description": "The user's public profile bio as HTML.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "HTML", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "company", - "description": "The user's public profile company.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "companyHTML", - "description": "The user's public profile company as HTML.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "HTML", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "contributedRepositories", - "description": "A list of repositories that the user recently contributed to.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "privacy", - "description": "If non-null, filters repositories according to privacy", - "type": { - "kind": "ENUM", - "name": "RepositoryPrivacy", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for repositories returned from the connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "RepositoryOrder", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "affiliations", - "description": "Affiliation options for repositories returned from the connection", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "RepositoryAffiliation", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "isLocked", - "description": "If non-null, filters repositories according to whether they have been locked", - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "RepositoryConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "email", - "description": "The user's publicly visible profile email.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "followers", - "description": "A list of users the given user is followed by.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "FollowerConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "following", - "description": "A list of users the given user is following.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "FollowingConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "gist", - "description": "Find gist by repo name.", - "args": [ - { - "name": "name", - "description": "The gist name to find.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Gist", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "gists", - "description": "A list of the Gists the user has created.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "privacy", - "description": "Filters Gists according to privacy.", - "type": { - "kind": "ENUM", - "name": "GistPrivacy", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for gists returned from the connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "GistOrder", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "GistConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isBountyHunter", - "description": "Whether or not this user is a participant in the GitHub Security Bug Bounty.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isCampusExpert", - "description": "Whether or not this user is a participant in the GitHub Campus Experts Program.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isDeveloperProgramMember", - "description": "Whether or not this user is a GitHub Developer Program member.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isEmployee", - "description": "Whether or not this user is a GitHub employee.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isHireable", - "description": "Whether or not the user has marked themselves as for hire.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isInvoiced", - "description": "Is the account billed through invoices?", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isSiteAdmin", - "description": "Whether or not this user is a site administrator.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isViewer", - "description": "Whether or not this user is the viewing user.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "issues", - "description": "A list of issues assocated with this user.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "labels", - "description": "A list of label names to filter the pull requests by.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - } - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for issues returned from the connection.", - "type": { - "kind": "INPUT_OBJECT", - "name": "IssueOrder", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "states", - "description": "A list of states to filter the issues by.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "IssueState", - "ofType": null - } - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "IssueConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "location", - "description": "The user's public profile location.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "login", - "description": "The username used to login.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "The user's public profile name.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "organization", - "description": "Find an organization by its login that the user belongs to.", - "args": [ - { - "name": "login", - "description": "The login of the organization to find.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Organization", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "organizations", - "description": "A list of organizations the user belongs to.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "OrganizationConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pinnedRepositories", - "description": "A list of repositories this user has pinned to their profile", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "privacy", - "description": "If non-null, filters repositories according to privacy", - "type": { - "kind": "ENUM", - "name": "RepositoryPrivacy", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for repositories returned from the connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "RepositoryOrder", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "affiliations", - "description": "Affiliation options for repositories returned from the connection", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "RepositoryAffiliation", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "isLocked", - "description": "If non-null, filters repositories according to whether they have been locked", - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "RepositoryConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequests", - "description": "A list of pull requests assocated with this user.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "states", - "description": "A list of states to filter the pull requests by.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "PullRequestState", - "ofType": null - } - } - }, - "defaultValue": null - }, - { - "name": "labels", - "description": "A list of label names to filter the pull requests by.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - } - }, - "defaultValue": null - }, - { - "name": "headRefName", - "description": "The head ref name to filter the pull requests by.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "baseRefName", - "description": "The base ref name to filter the pull requests by.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for pull requests returned from the connection.", - "type": { - "kind": "INPUT_OBJECT", - "name": "IssueOrder", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repositories", - "description": "A list of repositories that the user owns.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "privacy", - "description": "If non-null, filters repositories according to privacy", - "type": { - "kind": "ENUM", - "name": "RepositoryPrivacy", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for repositories returned from the connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "RepositoryOrder", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "affiliations", - "description": "Affiliation options for repositories returned from the connection", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "RepositoryAffiliation", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "isLocked", - "description": "If non-null, filters repositories according to whether they have been locked", - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "isFork", - "description": "If non-null, filters repositories according to whether they are forks of another repository", - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "RepositoryConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "Find Repository.", - "args": [ - { - "name": "name", - "description": "Name of Repository to find.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path for this user", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "starredRepositories", - "description": "Repositories the user has starred.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "ownedByViewer", - "description": "Filters starred repositories to only return repositories owned by the viewer.", - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Order for connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "StarOrder", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "StarredRepositoryConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedAt", - "description": "Identifies the date and time when the object was last updated.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "General type updated timestamps will eventually be replaced by other field specific timestamps." - }, - { - "name": "url", - "description": "The HTTP URL for this user", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanFollow", - "description": "Whether or not the viewer is able to follow the user.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerIsFollowing", - "description": "Whether or not this user is followed by the viewer.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "watching", - "description": "A list of repositories the given user is watching.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "privacy", - "description": "If non-null, filters repositories according to privacy", - "type": { - "kind": "ENUM", - "name": "RepositoryPrivacy", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for repositories returned from the connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "RepositoryOrder", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "affiliations", - "description": "Affiliation options for repositories returned from the connection", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "RepositoryAffiliation", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "isLocked", - "description": "If non-null, filters repositories according to whether they have been locked", - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "RepositoryConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "websiteUrl", - "description": "A URL pointing to the user's public website/blog.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "RepositoryOwner", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UniformResourceLocatable", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INTERFACE", - "name": "Actor", - "description": "Represents an object which can take actions on GitHub. Typically a User or Bot.", - "fields": [ - { - "name": "avatarUrl", - "description": "A URL pointing to the actor's public avatar.", - "args": [ - { - "name": "size", - "description": "The size of the resulting square image.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "login", - "description": "The username of the actor.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path for this actor.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "url", - "description": "The HTTP URL for this actor.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Bot", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Organization", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - ] - }, - { - "kind": "SCALAR", - "name": "String", - "description": "Represents textual data as UTF-8 character sequences. This type is most often used by GraphQL to represent free-form human-readable text.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "Int", - "description": "Represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Repository", - "description": "A repository contains the content for a project.", - "fields": [ - { - "name": "codeOfConduct", - "description": "Returns the code of conduct for this repository", - "args": [], - "type": { - "kind": "OBJECT", - "name": "CodeOfConduct", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commitComments", - "description": "A list of commit comments associated with the repository.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "CommitCommentConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "defaultBranchRef", - "description": "The Ref associated with the repository's default branch.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Ref", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deployments", - "description": "Deployments associated with the repository", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "environments", - "description": "Environments to list deployments for", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "DeploymentConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": "The description of the repository.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "descriptionHTML", - "description": "The description of the repository rendered to HTML.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "HTML", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "diskUsage", - "description": "The number of kilobytes this repository occupies on disk.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "forks", - "description": "A list of forked repositories.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "privacy", - "description": "If non-null, filters repositories according to privacy", - "type": { - "kind": "ENUM", - "name": "RepositoryPrivacy", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for repositories returned from the connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "RepositoryOrder", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "affiliations", - "description": "Affiliation options for repositories returned from the connection", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "RepositoryAffiliation", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "isLocked", - "description": "If non-null, filters repositories according to whether they have been locked", - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "RepositoryConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "hasIssuesEnabled", - "description": "Indicates if the repository has issues feature enabled.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "hasWikiEnabled", - "description": "Indicates if the repository has wiki feature enabled.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "homepageUrl", - "description": "The repository's URL.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isFork", - "description": "Identifies if the repository is a fork.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isLocked", - "description": "Indicates if the repository has been locked or not.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isMirror", - "description": "Identifies if the repository is a mirror.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isPrivate", - "description": "Identifies if the repository is private.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "issue", - "description": "Returns a single issue from the current repository by number.", - "args": [ - { - "name": "number", - "description": "The number for the issue to be returned.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "issueOrPullRequest", - "description": "Returns a single issue-like object from the current repository by number.", - "args": [ - { - "name": "number", - "description": "The number for the issue to be returned.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "UNION", - "name": "IssueOrPullRequest", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "issues", - "description": "A list of issues that have been opened in the repository.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "labels", - "description": "A list of label names to filter the pull requests by.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - } - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for issues returned from the connection.", - "type": { - "kind": "INPUT_OBJECT", - "name": "IssueOrder", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "states", - "description": "A list of states to filter the issues by.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "IssueState", - "ofType": null - } - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "IssueConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "label", - "description": "Returns a single label by name", - "args": [ - { - "name": "name", - "description": "Label name", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Label", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "labels", - "description": "A list of labels associated with the repository.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "LabelConnection", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "languages", - "description": "A list containing a breakdown of the language composition of the repository.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Order for connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "LanguageOrder", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "LanguageConnection", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "license", - "description": "The license associated with the repository", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "lockReason", - "description": "The reason the repository has been locked.", - "args": [], - "type": { - "kind": "ENUM", - "name": "RepositoryLockReason", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "mentionableUsers", - "description": "A list of Users that can be mentioned in the context of the repository.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "UserConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "milestone", - "description": "Returns a single milestone from the current repository by number.", - "args": [ - { - "name": "number", - "description": "The number for the milestone to be returned.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Milestone", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "milestones", - "description": "A list of milestones associated with the repository.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "MilestoneConnection", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "mirrorUrl", - "description": "The repository's original mirror URL.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "The name of the repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nameWithOwner", - "description": "The repository's name with owner.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "object", - "description": "A Git object in the repository", - "args": [ - { - "name": "oid", - "description": "The Git object ID", - "type": { - "kind": "SCALAR", - "name": "GitObjectID", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "expression", - "description": "A Git revision expression suitable for rev-parse", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "INTERFACE", - "name": "GitObject", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "owner", - "description": "The User owner of the repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "RepositoryOwner", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "parent", - "description": "The repository parent, if this is a fork.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "primaryLanguage", - "description": "The primary language of the repository's code.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Language", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "project", - "description": "Find project by number.", - "args": [ - { - "name": "number", - "description": "The project number to find.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Project", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "projects", - "description": "A list of projects under the owner.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for projects returned from the connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "ProjectOrder", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "search", - "description": "Query to search projects by, currently only searching by name.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "states", - "description": "A list of states to filter the projects by.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "ProjectState", - "ofType": null - } - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProjectConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "projectsResourcePath", - "description": "The HTTP path listing repository's projects", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "projectsUrl", - "description": "The HTTP URL listing repository's projects", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "protectedBranches", - "description": "A list of protected branches that are on this repository.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProtectedBranchConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequest", - "description": "Returns a single pull request from the current repository by number.", - "args": [ - { - "name": "number", - "description": "The number for the pull request to be returned.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequests", - "description": "A list of pull requests that have been opened in the repository.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "states", - "description": "A list of states to filter the pull requests by.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "PullRequestState", - "ofType": null - } - } - }, - "defaultValue": null - }, - { - "name": "labels", - "description": "A list of label names to filter the pull requests by.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - } - }, - "defaultValue": null - }, - { - "name": "headRefName", - "description": "The head ref name to filter the pull requests by.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "baseRefName", - "description": "The base ref name to filter the pull requests by.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for pull requests returned from the connection.", - "type": { - "kind": "INPUT_OBJECT", - "name": "IssueOrder", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pushedAt", - "description": "Identifies when the repository was last pushed to.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ref", - "description": "Fetch a given ref from the repository", - "args": [ - { - "name": "qualifiedName", - "description": "The ref to retrieve.Fully qualified matches are checked in order (`refs/heads/master`) before falling back onto checks for short name matches (`master`).", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Ref", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "refs", - "description": "Fetch a list of refs from the repository", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "refPrefix", - "description": "A ref name prefix like `refs/heads/`, `refs/tags/`, etc.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "direction", - "description": "The ordering direction.", - "type": { - "kind": "ENUM", - "name": "OrderDirection", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "RefConnection", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "releases", - "description": "List of releases which are dependent on this repository.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReleaseConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repositoryTopics", - "description": "A list of applied repository-topic associations for this repository.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "RepositoryTopicConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path for this repository", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "stargazers", - "description": "A list of users who have starred this starrable.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Order for connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "StarOrder", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "StargazerConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedAt", - "description": "Identifies the date and time when the object was last updated.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "General type updated timestamps will eventually be replaced by other field specific timestamps." - }, - { - "name": "url", - "description": "The HTTP URL for this repository", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanAdminister", - "description": "Indicates whether the viewer has admin permissions on this repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanCreateProjects", - "description": "Can the current viewer create new projects on this owner.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanSubscribe", - "description": "Check if the viewer is able to change their subscription status for the repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanUpdateTopics", - "description": "Indicates whether the viewer can update the topics of this repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerHasStarred", - "description": "Returns a boolean indicating whether the viewing user has starred this starrable.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerSubscription", - "description": "Identifies if the viewer is watching, not watching, or ignoring the repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "SubscriptionState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "watchers", - "description": "A list of users watching the repository.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "UserConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "ProjectOwner", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Subscribable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Starrable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UniformResourceLocatable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "RepositoryInfo", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INTERFACE", - "name": "ProjectOwner", - "description": "Represents an owner of a Project.", - "fields": [ - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "project", - "description": "Find project by number.", - "args": [ - { - "name": "number", - "description": "The project number to find.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Project", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "projects", - "description": "A list of projects under the owner.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for projects returned from the connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "ProjectOrder", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "search", - "description": "Query to search projects by, currently only searching by name.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "states", - "description": "A list of states to filter the projects by.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "ProjectState", - "ofType": null - } - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProjectConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "projectsResourcePath", - "description": "The HTTP path listing owners projects", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "projectsUrl", - "description": "The HTTP URL listing owners projects", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanCreateProjects", - "description": "Can the current viewer create new projects on this owner.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Organization", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - ] - }, - { - "kind": "OBJECT", - "name": "Project", - "description": "Projects manage issues, pull requests and notes within a project owner.", - "fields": [ - { - "name": "body", - "description": "The project's description body.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bodyHTML", - "description": "The projects description body rendered to HTML.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "HTML", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "closedAt", - "description": "Identifities the date and time when the project was closed.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "columns", - "description": "List of columns in the project", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProjectColumnConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "creator", - "description": "The actor who originally created the project.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "The project's name.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "number", - "description": "The project's number.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "owner", - "description": "The project's owner. Currently limited to repositories and organizations.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "ProjectOwner", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path for this project", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "state", - "description": "Whether the project is open or closed.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "ProjectState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedAt", - "description": "Identifies the date and time when the object was last updated.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "General type updated timestamps will eventually be replaced by other field specific timestamps." - }, - { - "name": "url", - "description": "The HTTP URL for this project", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanUpdate", - "description": "Check if the current viewer can update this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Updatable", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INTERFACE", - "name": "Updatable", - "description": "Entities that can be updated.", - "fields": [ - { - "name": "viewerCanUpdate", - "description": "Check if the current viewer can update this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "CommitComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "GistComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "IssueComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Project", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReview", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReviewComment", - "ofType": null - } - ] - }, - { - "kind": "SCALAR", - "name": "Boolean", - "description": "Represents `true` or `false` values.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "DateTime", - "description": "An ISO-8601 encoded UTC date string.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "ProjectState", - "description": "State of the project; either 'open' or 'closed'", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "OPEN", - "description": "The project is open.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "CLOSED", - "description": "The project is closed.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "HTML", - "description": "A string containing HTML code.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ProjectColumnConnection", - "description": "The connection type for ProjectColumn.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProjectColumnEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProjectColumn", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ProjectColumnEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "ProjectColumn", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ProjectColumn", - "description": "A column inside a project.", - "fields": [ - { - "name": "cards", - "description": "List of cards in the column", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProjectCardConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "The project column's name.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "project", - "description": "The project that contains this column.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Project", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedAt", - "description": "Identifies the date and time when the object was last updated.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "General type updated timestamps will eventually be replaced by other field specific timestamps." - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ProjectCardConnection", - "description": "The connection type for ProjectCard.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProjectCardEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProjectCard", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ProjectCardEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "ProjectCard", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ProjectCard", - "description": "A card in a project.", - "fields": [ - { - "name": "column", - "description": "The project column this card is associated under. A card may only belong to one\nproject column at a time. The column field will be null if the card is created\nin a pending state and has yet to be associated with a column. Once cards are\nassociated with a column, they will not become pending in the future.\n", - "args": [], - "type": { - "kind": "OBJECT", - "name": "ProjectColumn", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "content", - "description": "The card content item", - "args": [], - "type": { - "kind": "UNION", - "name": "ProjectCardItem", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "creator", - "description": "The actor who created this card", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "note", - "description": "The card note", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "project", - "description": "The project that contains this card.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Project", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "projectColumn", - "description": "The column that contains this card.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProjectColumn", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "Use ProjectCard.column instead. The associated column will be null if the card is in a pending state." - }, - { - "name": "resourcePath", - "description": "The HTTP path for this card", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "state", - "description": "The state of ProjectCard", - "args": [], - "type": { - "kind": "ENUM", - "name": "ProjectCardState", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedAt", - "description": "Identifies the date and time when the object was last updated.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "General type updated timestamps will eventually be replaced by other field specific timestamps." - }, - { - "name": "url", - "description": "The HTTP URL for this card", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "ProjectCardState", - "description": "Various content states of a ProjectCard", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "CONTENT_ONLY", - "description": "The card has content only.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "NOTE_ONLY", - "description": "The card has a note only.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "REDACTED", - "description": "The card is redacted.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "UNION", - "name": "ProjectCardItem", - "description": "Types that can be inside Project Cards.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - ] - }, - { - "kind": "OBJECT", - "name": "Issue", - "description": "An Issue is a place to discuss ideas, enhancements, tasks, and bugs for a project.", - "fields": [ - { - "name": "assignees", - "description": "A list of Users assigned to this object.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "UserConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "author", - "description": "The actor who authored the comment.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "authorAssociation", - "description": "Author's association with the subject of the comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "CommentAuthorAssociation", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "body", - "description": "Identifies the body of the issue.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bodyHTML", - "description": "Identifies the body of the issue rendered to HTML.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "HTML", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bodyText", - "description": "Identifies the body of the issue rendered to text.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "closed", - "description": "`true` if the object is closed (definition of closed may depend on type)", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "comments", - "description": "A list of comments associated with the Issue.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "IssueCommentConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdViaEmail", - "description": "Check if this comment was created via an email reply.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "editor", - "description": "The actor who edited the comment.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "labels", - "description": "A list of labels associated with the object.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "LabelConnection", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "lastEditedAt", - "description": "The moment the editor made the last edit", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "locked", - "description": "`true` if the object is locked", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "milestone", - "description": "Identifies the milestone associated with the issue.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Milestone", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "number", - "description": "Identifies the issue number.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "participants", - "description": "A list of Users that are participating in the Issue conversation.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "UserConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "publishedAt", - "description": "Identifies when the comment was published at.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reactionGroups", - "description": "A list of reactions grouped by content left on the subject.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReactionGroup", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reactions", - "description": "A list of Reactions left on the Issue.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "content", - "description": "Allows filtering Reactions by emoji.", - "type": { - "kind": "ENUM", - "name": "ReactionContent", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Allows specifying the order in which reactions are returned.", - "type": { - "kind": "INPUT_OBJECT", - "name": "ReactionOrder", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReactionConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "Identifies the repository associated with the issue.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path for this issue", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "state", - "description": "Identifies the state of the issue.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "IssueState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "timeline", - "description": "A list of events associated with an Issue.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "since", - "description": "Allows filtering timeline events by a `since` timestamp.", - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "IssueTimelineConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "title", - "description": "Identifies the issue title.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedAt", - "description": "Identifies the date and time when the object was last updated.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "General type updated timestamps will eventually be replaced by other field specific timestamps." - }, - { - "name": "url", - "description": "The HTTP URL for this issue", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanReact", - "description": "Can user react to this subject", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanSubscribe", - "description": "Check if the viewer is able to change their subscription status for the repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanUpdate", - "description": "Check if the current viewer can update this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCannotUpdateReasons", - "description": "Reasons why the current viewer can not update this comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "CommentCannotUpdateReason", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerDidAuthor", - "description": "Did the viewer author this comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerSubscription", - "description": "Identifies if the viewer is watching, not watching, or ignoring the repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "SubscriptionState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Assignable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Closable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Comment", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Updatable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UpdatableComment", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Labelable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Lockable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Reactable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "RepositoryNode", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Subscribable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UniformResourceLocatable", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INTERFACE", - "name": "Assignable", - "description": "An object that can have users assigned to it.", - "fields": [ - { - "name": "assignees", - "description": "A list of Users assigned to this object.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "UserConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - ] - }, - { - "kind": "OBJECT", - "name": "UserConnection", - "description": "The connection type for User.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "UserEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "UserEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "User", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PageInfo", - "description": "Information about pagination in a connection.", - "fields": [ - { - "name": "endCursor", - "description": "When paginating forwards, the cursor to continue.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "hasNextPage", - "description": "When paginating forwards, are there more items?", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "hasPreviousPage", - "description": "When paginating backwards, are there more items?", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "startCursor", - "description": "When paginating backwards, the cursor to continue.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INTERFACE", - "name": "Closable", - "description": "An object that can be closed", - "fields": [ - { - "name": "closed", - "description": "`true` if the object is closed (definition of closed may depend on type)", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - ] - }, - { - "kind": "INTERFACE", - "name": "Comment", - "description": "Represents a comment.", - "fields": [ - { - "name": "author", - "description": "The actor who authored the comment.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "authorAssociation", - "description": "Author's association with the subject of the comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "CommentAuthorAssociation", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "body", - "description": "The comment body as Markdown.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bodyHTML", - "description": "The comment body rendered to HTML.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "HTML", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdViaEmail", - "description": "Check if this comment was created via an email reply.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "editor", - "description": "The actor who edited the comment.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "lastEditedAt", - "description": "The moment the editor made the last edit", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "publishedAt", - "description": "Identifies when the comment was published at.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedAt", - "description": "Identifies the date and time when the object was last updated.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "General type updated timestamps will eventually be replaced by other field specific timestamps." - }, - { - "name": "viewerDidAuthor", - "description": "Did the viewer author this comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "CommitComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "GistComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "IssueComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReview", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReviewComment", - "ofType": null - } - ] - }, - { - "kind": "ENUM", - "name": "CommentAuthorAssociation", - "description": "A comment author association with repository.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "MEMBER", - "description": "Author is a member of the organization that owns the repository.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "OWNER", - "description": "Author is the owner of the repository.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "COLLABORATOR", - "description": "Author has been invited to collaborate on the repository.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "CONTRIBUTOR", - "description": "Author has previously committed to the repository.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FIRST_TIME_CONTRIBUTOR", - "description": "Author has not previously committed to the repository.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FIRST_TIMER", - "description": "Author has not previously committed to GitHub.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "NONE", - "description": "Author has no association with the repository.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "INTERFACE", - "name": "UpdatableComment", - "description": "Comments that can be updated.", - "fields": [ - { - "name": "viewerCannotUpdateReasons", - "description": "Reasons why the current viewer can not update this comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "CommentCannotUpdateReason", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "CommitComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "GistComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "IssueComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReview", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReviewComment", - "ofType": null - } - ] - }, - { - "kind": "ENUM", - "name": "CommentCannotUpdateReason", - "description": "The possible errors that will prevent a user from updating a comment.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "INSUFFICIENT_ACCESS", - "description": "You must be the author or have write access to this repository to update this comment.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "LOCKED", - "description": "Unable to create comment because issue is locked.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "LOGIN_REQUIRED", - "description": "You must be logged in to update this comment.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "MAINTENANCE", - "description": "Repository is under maintenance.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "VERIFIED_EMAIL_REQUIRED", - "description": "At least one email address must be verified to update this comment.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "INTERFACE", - "name": "Labelable", - "description": "An object that can have labels assigned to it.", - "fields": [ - { - "name": "labels", - "description": "A list of labels associated with the object.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "LabelConnection", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - ] - }, - { - "kind": "OBJECT", - "name": "LabelConnection", - "description": "The connection type for Label.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "LabelEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Label", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "LabelEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Label", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Label", - "description": "A label for categorizing Issues or Milestones with a given Repository.", - "fields": [ - { - "name": "color", - "description": "Identifies the label color.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "issues", - "description": "A list of issues associated with this label.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "labels", - "description": "A list of label names to filter the pull requests by.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - } - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for issues returned from the connection.", - "type": { - "kind": "INPUT_OBJECT", - "name": "IssueOrder", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "states", - "description": "A list of states to filter the issues by.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "IssueState", - "ofType": null - } - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "IssueConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "Identifies the label name.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequests", - "description": "A list of pull requests associated with this label.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "states", - "description": "A list of states to filter the pull requests by.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "PullRequestState", - "ofType": null - } - } - }, - "defaultValue": null - }, - { - "name": "labels", - "description": "A list of label names to filter the pull requests by.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - } - }, - "defaultValue": null - }, - { - "name": "headRefName", - "description": "The head ref name to filter the pull requests by.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "baseRefName", - "description": "The base ref name to filter the pull requests by.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for pull requests returned from the connection.", - "type": { - "kind": "INPUT_OBJECT", - "name": "IssueOrder", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "The repository associated with this label.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "IssueConnection", - "description": "The connection type for Issue.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "IssueEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "IssueEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "IssueOrder", - "description": "Ways in which lists of issues can be ordered upon return.", - "fields": null, - "inputFields": [ - { - "name": "field", - "description": "The field in which to order issues by.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "IssueOrderField", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "direction", - "description": "The direction in which to order issues by the specified field.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "OrderDirection", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "IssueOrderField", - "description": "Properties by which issue connections can be ordered.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "CREATED_AT", - "description": "Order issues by creation time", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "UPDATED_AT", - "description": "Order issues by update time", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "COMMENTS", - "description": "Order issues by comment count", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "OrderDirection", - "description": "Possible directions in which to order a list of items when provided an `orderBy` argument.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "ASC", - "description": "Specifies an ascending order for a given `orderBy` argument.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "DESC", - "description": "Specifies a descending order for a given `orderBy` argument.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "IssueState", - "description": "The possible states of an issue.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "OPEN", - "description": "An issue that is still open", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "CLOSED", - "description": "An issue that has been closed", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PullRequestConnection", - "description": "The connection type for PullRequest.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PullRequestEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "description": "A repository pull request.", - "fields": [ - { - "name": "assignees", - "description": "A list of Users assigned to this object.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "UserConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "author", - "description": "The actor who authored the comment.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "authorAssociation", - "description": "Author's association with the subject of the comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "CommentAuthorAssociation", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "baseRef", - "description": "Identifies the base Ref associated with the pull request.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Ref", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "baseRefName", - "description": "Identifies the name of the base Ref associated with the pull request, even if the ref has been deleted.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "body", - "description": "Identifies the body of the pull request.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bodyHTML", - "description": "Identifies the body of the pull request rendered to HTML.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "HTML", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bodyText", - "description": "Identifies the body of the pull request rendered to text.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "closed", - "description": "`true` if the pull request is closed", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "comments", - "description": "A list of comments associated with the pull request.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "IssueCommentConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commits", - "description": "A list of commits present in this pull request's head branch not present in the base branch.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestCommitConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdViaEmail", - "description": "Check if this comment was created via an email reply.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "editor", - "description": "The actor who edited this pull request's body.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "headRef", - "description": "Identifies the head Ref associated with the pull request.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Ref", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "headRefName", - "description": "Identifies the name of the head Ref associated with the pull request, even if the ref has been deleted.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "headRepository", - "description": "The repository associated with this pull request's head Ref.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "headRepositoryOwner", - "description": "The owner of the repository associated with this pull request's head Ref.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "RepositoryOwner", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isCrossRepository", - "description": "The head and base repositories are different.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "labels", - "description": "A list of labels associated with the object.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "LabelConnection", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "lastEditedAt", - "description": "The moment the editor made the last edit", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "locked", - "description": "`true` if the pull request is locked", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "mergeCommit", - "description": "The commit that was created when this pull request was merged.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "mergeable", - "description": "Whether or not the pull request can be merged based on the existence of merge conflicts.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "MergeableState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "merged", - "description": "Whether or not the pull request was merged.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "mergedAt", - "description": "The date and time that the pull request was merged.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "number", - "description": "Identifies the pull request number.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "participants", - "description": "A list of Users that are participating in the Pull Request conversation.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "UserConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "potentialMergeCommit", - "description": "The commit that GitHub automatically generated to test if this pull request could be merged. This field will not return a value if the pull request is merged, or if the test merge commit is still being generated. See the `mergeable` field for more details on the mergeability of the pull request.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "publishedAt", - "description": "Identifies when the comment was published at.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reactionGroups", - "description": "A list of reactions grouped by content left on the subject.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReactionGroup", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reactions", - "description": "A list of Reactions left on the Issue.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "content", - "description": "Allows filtering Reactions by emoji.", - "type": { - "kind": "ENUM", - "name": "ReactionContent", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Allows specifying the order in which reactions are returned.", - "type": { - "kind": "INPUT_OBJECT", - "name": "ReactionOrder", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReactionConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "The repository associated with this pull request.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path for this pull request.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "revertResourcePath", - "description": "The HTTP path for reverting this pull request.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "revertUrl", - "description": "The HTTP URL for reverting this pull request.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reviewRequests", - "description": "A list of review requests associated with the pull request.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "ReviewRequestConnection", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reviews", - "description": "A list of reviews associated with the pull request.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "states", - "description": "A list of states to filter the reviews.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "PullRequestReviewState", - "ofType": null - } - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "PullRequestReviewConnection", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "state", - "description": "Identifies the state of the pull request.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "PullRequestState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "suggestedReviewers", - "description": "A list of reviewer suggestions based on commit history and past review comments.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "SuggestedReviewer", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "timeline", - "description": "A list of events associated with a PullRequest.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "since", - "description": "Allows filtering timeline events by a `since` timestamp.", - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestTimelineConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "title", - "description": "Identifies the pull request title.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedAt", - "description": "Identifies the date and time when the object was last updated.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "General type updated timestamps will eventually be replaced by other field specific timestamps." - }, - { - "name": "url", - "description": "The HTTP URL for this pull request.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanReact", - "description": "Can user react to this subject", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanSubscribe", - "description": "Check if the viewer is able to change their subscription status for the repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanUpdate", - "description": "Check if the current viewer can update this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCannotUpdateReasons", - "description": "Reasons why the current viewer can not update this comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "CommentCannotUpdateReason", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerDidAuthor", - "description": "Did the viewer author this comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerSubscription", - "description": "Identifies if the viewer is watching, not watching, or ignoring the repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "SubscriptionState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Assignable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Closable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Comment", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Updatable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UpdatableComment", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Labelable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Lockable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Reactable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "RepositoryNode", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Subscribable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UniformResourceLocatable", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INTERFACE", - "name": "Lockable", - "description": "An object that can be locked.", - "fields": [ - { - "name": "locked", - "description": "`true` if the object is locked", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - ] - }, - { - "kind": "INTERFACE", - "name": "Reactable", - "description": "Represents a subject that can be reacted on.", - "fields": [ - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reactionGroups", - "description": "A list of reactions grouped by content left on the subject.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReactionGroup", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reactions", - "description": "A list of Reactions left on the Issue.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "content", - "description": "Allows filtering Reactions by emoji.", - "type": { - "kind": "ENUM", - "name": "ReactionContent", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Allows specifying the order in which reactions are returned.", - "type": { - "kind": "INPUT_OBJECT", - "name": "ReactionOrder", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReactionConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanReact", - "description": "Can user react to this subject", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "CommitComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "IssueComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReviewComment", - "ofType": null - } - ] - }, - { - "kind": "OBJECT", - "name": "ReactionGroup", - "description": "A group of emoji reactions to a particular piece of content.", - "fields": [ - { - "name": "content", - "description": "Identifies the emoji reaction.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "ReactionContent", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies when the reaction was created.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subject", - "description": "The subject that was reacted to.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Reactable", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "users", - "description": "Users who have reacted to the reaction subject with the emotion represented by this reaction group", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReactingUserConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerHasReacted", - "description": "Whether or not the authenticated user has left a reaction on the subject.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "ReactionContent", - "description": "Emojis that can be attached to Issues, Pull Requests and Comments.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "THUMBS_UP", - "description": "Represents the 👍 emoji.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "THUMBS_DOWN", - "description": "Represents the 👎 emoji.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "LAUGH", - "description": "Represents the 😄 emoji.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "HOORAY", - "description": "Represents the 🎉 emoji.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "CONFUSED", - "description": "Represents the 😕 emoji.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "HEART", - "description": "Represents the ❤️ emoji.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReactingUserConnection", - "description": "The connection type for User.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReactingUserEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReactingUserEdge", - "description": "Represents a user that's made a reaction.", - "fields": [ - { - "name": "cursor", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reactedAt", - "description": "The moment when the user made the reaction.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReactionConnection", - "description": "A list of reactions that have been left on the subject.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReactionEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Reaction", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerHasReacted", - "description": "Whether or not the authenticated user has left a reaction on the subject.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReactionEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Reaction", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Reaction", - "description": "An emoji reaction to a particular piece of content.", - "fields": [ - { - "name": "content", - "description": "Identifies the emoji reaction.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "ReactionContent", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "user", - "description": "Identifies the user who created this reaction.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "User", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "ReactionOrder", - "description": "Ways in which lists of reactions can be ordered upon return.", - "fields": null, - "inputFields": [ - { - "name": "field", - "description": "The field in which to order reactions by.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "ReactionOrderField", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "direction", - "description": "The direction in which to order reactions by the specified field.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "OrderDirection", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "ReactionOrderField", - "description": "A list of fields that reactions can be ordered by.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "CREATED_AT", - "description": "Allows ordering a list of reactions by when they were created.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "INTERFACE", - "name": "RepositoryNode", - "description": "Represents a object that belongs to a repository.", - "fields": [ - { - "name": "repository", - "description": "The repository associated with this node.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "CommitComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "CommitCommentThread", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "IssueComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReview", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReviewComment", - "ofType": null - } - ] - }, - { - "kind": "INTERFACE", - "name": "Subscribable", - "description": "Entities that can be subscribed to for web and email notifications.", - "fields": [ - { - "name": "viewerCanSubscribe", - "description": "Check if the viewer is able to change their subscription status for the repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerSubscription", - "description": "Identifies if the viewer is watching, not watching, or ignoring the repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "SubscriptionState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - ] - }, - { - "kind": "ENUM", - "name": "SubscriptionState", - "description": "The possible states of a subscription.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "UNSUBSCRIBED", - "description": "The User is only notified when particpating or @mentioned.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "SUBSCRIBED", - "description": "The User is notified of all conversations.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "IGNORED", - "description": "The User is never notified.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Ref", - "description": "Represents a Git reference.", - "fields": [ - { - "name": "associatedPullRequests", - "description": "A list of pull requests with this ref as the head ref.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "states", - "description": "A list of states to filter the pull requests by.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "PullRequestState", - "ofType": null - } - } - }, - "defaultValue": null - }, - { - "name": "labels", - "description": "A list of label names to filter the pull requests by.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - } - }, - "defaultValue": null - }, - { - "name": "headRefName", - "description": "The head ref name to filter the pull requests by.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "baseRefName", - "description": "The base ref name to filter the pull requests by.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for pull requests returned from the connection.", - "type": { - "kind": "INPUT_OBJECT", - "name": "IssueOrder", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "The ref name.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "prefix", - "description": "The ref's prefix, such as `refs/heads/` or `refs/tags/`.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "The repository the ref belongs to.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "target", - "description": "The object the ref points to.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "GitObject", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INTERFACE", - "name": "GitObject", - "description": "Represents a Git object.", - "fields": [ - { - "name": "abbreviatedOid", - "description": "An abbreviated version of the Git object ID", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commitResourcePath", - "description": "The HTTP path for this Git object", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commitUrl", - "description": "The HTTP URL for this Git object", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "oid", - "description": "The Git object ID", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "GitObjectID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "The Repository the Git object belongs to", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Blob", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Tag", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Tree", - "ofType": null - } - ] - }, - { - "kind": "SCALAR", - "name": "GitObjectID", - "description": "A Git object ID.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Commit", - "description": "Represents a Git commit.", - "fields": [ - { - "name": "abbreviatedOid", - "description": "An abbreviated version of the Git object ID", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "author", - "description": "Authorship details of the commit.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "GitActor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "authoredByCommitter", - "description": "Check if the committer and the author match.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "blame", - "description": "Fetches `git blame` information.", - "args": [ - { - "name": "path", - "description": "The file whose Git blame information you want.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Blame", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "comments", - "description": "Comments made on the commit.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "CommitCommentConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commitResourcePath", - "description": "The HTTP path for this Git object", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commitUrl", - "description": "The HTTP URL for this Git object", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "committedDate", - "description": "The datetime when this commit was committed.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "committedViaWeb", - "description": "Check if commited via GitHub web UI.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "committer", - "description": "Committership details of the commit.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "GitActor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "history", - "description": "The linear commit history starting from (and including) this commit, in the same order as `git log`.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "path", - "description": "If non-null, filters history to only show commits touching files under this path.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "author", - "description": "If non-null, filters history to only show commits with matching authorship.", - "type": { - "kind": "INPUT_OBJECT", - "name": "CommitAuthor", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "since", - "description": "Allows specifying a beginning time or date for fetching commits.", - "type": { - "kind": "SCALAR", - "name": "GitTimestamp", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "until", - "description": "Allows specifying an ending time or date for fetching commits.", - "type": { - "kind": "SCALAR", - "name": "GitTimestamp", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "CommitHistoryConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "message", - "description": "The Git commit message", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "messageBody", - "description": "The Git commit message body", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "messageBodyHTML", - "description": "The commit message body rendered to HTML.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "HTML", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "messageHeadline", - "description": "The Git commit message headline", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "messageHeadlineHTML", - "description": "The commit message headline rendered to HTML.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "HTML", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "oid", - "description": "The Git object ID", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "GitObjectID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "The Repository this commit belongs to", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path for this commit", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "signature", - "description": "Commit signing information, if present.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "GitSignature", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "status", - "description": "Status information for this commit", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Status", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "tree", - "description": "Commit's root Tree", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Tree", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "treeResourcePath", - "description": "The HTTP path for the tree of this commit", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "treeUrl", - "description": "The HTTP URL for the tree of this commit", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "url", - "description": "The HTTP URL for this commit", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanSubscribe", - "description": "Check if the viewer is able to change their subscription status for the repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerSubscription", - "description": "Identifies if the viewer is watching, not watching, or ignoring the repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "SubscriptionState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "GitObject", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Subscribable", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Tree", - "description": "Represents a Git tree.", - "fields": [ - { - "name": "abbreviatedOid", - "description": "An abbreviated version of the Git object ID", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commitResourcePath", - "description": "The HTTP path for this Git object", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commitUrl", - "description": "The HTTP URL for this Git object", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "entries", - "description": "A list of tree entries.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "TreeEntry", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "oid", - "description": "The Git object ID", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "GitObjectID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "The Repository the Git object belongs to", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "GitObject", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "TreeEntry", - "description": "Represents a Git tree entry.", - "fields": [ - { - "name": "mode", - "description": "Entry file mode.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "Entry file name.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "object", - "description": "Entry file object.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "GitObject", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "oid", - "description": "Entry file Git object ID.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "GitObjectID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "The Repository the tree entry belongs to", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": "Entry file type.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "GitActor", - "description": "Represents an actor in a Git commit (ie. an author or committer).", - "fields": [ - { - "name": "avatarUrl", - "description": "A URL pointing to the author's public avatar.", - "args": [ - { - "name": "size", - "description": "The size of the resulting square image.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "date", - "description": "The timestamp of the Git action (authoring or committing).", - "args": [], - "type": { - "kind": "SCALAR", - "name": "GitTimestamp", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "email", - "description": "The email in the Git commit.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "The name in the Git commit.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "user", - "description": "The GitHub user corresponding to the email field. Null if no such user exists.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "User", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "GitTimestamp", - "description": "An ISO-8601 encoded date string. Unlike the DateTime type, GitTimestamp is not converted in UTC.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "CommitHistoryConnection", - "description": "The connection type for Commit.", - "fields": [ - { - "name": "edges", - "description": null, - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "CommitEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "CommitEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "CommitAuthor", - "description": "Specifies an author for filtering Git commits.", - "fields": null, - "inputFields": [ - { - "name": "id", - "description": "ID of a User to filter by. If non-null, only commits authored by this user will be returned. This field takes precedence over emails.", - "type": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "emails", - "description": "Email addresses to filter by. Commits authored by any of the specified email addresses will be returned.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "CommitCommentConnection", - "description": "The connection type for CommitComment.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "CommitCommentEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "CommitComment", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "CommitCommentEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "CommitComment", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "CommitComment", - "description": "Represents a comment on a given Commit.", - "fields": [ - { - "name": "author", - "description": "The actor who authored the comment.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "authorAssociation", - "description": "Author's association with the subject of the comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "CommentAuthorAssociation", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "body", - "description": "Identifies the comment body.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bodyHTML", - "description": "Identifies the comment body rendered to HTML.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "HTML", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commit", - "description": "Identifies the commit associated with the comment, if the commit exists.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdViaEmail", - "description": "Check if this comment was created via an email reply.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "editor", - "description": "The actor who edited the comment.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "lastEditedAt", - "description": "The moment the editor made the last edit", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "path", - "description": "Identifies the file path associated with the comment.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "position", - "description": "Identifies the line position associated with the comment.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "publishedAt", - "description": "Identifies when the comment was published at.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reactionGroups", - "description": "A list of reactions grouped by content left on the subject.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReactionGroup", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reactions", - "description": "A list of Reactions left on the Issue.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "content", - "description": "Allows filtering Reactions by emoji.", - "type": { - "kind": "ENUM", - "name": "ReactionContent", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Allows specifying the order in which reactions are returned.", - "type": { - "kind": "INPUT_OBJECT", - "name": "ReactionOrder", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReactionConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "Identifies the repository associated with the comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedAt", - "description": "Identifies the date and time when the object was last updated.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "General type updated timestamps will eventually be replaced by other field specific timestamps." - }, - { - "name": "viewerCanDelete", - "description": "Check if the current viewer can delete this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanReact", - "description": "Can user react to this subject", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanUpdate", - "description": "Check if the current viewer can update this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCannotUpdateReasons", - "description": "Reasons why the current viewer can not update this comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "CommentCannotUpdateReason", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerDidAuthor", - "description": "Did the viewer author this comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Comment", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Deletable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Updatable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UpdatableComment", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Reactable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "RepositoryNode", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INTERFACE", - "name": "Deletable", - "description": "Entities that can be deleted.", - "fields": [ - { - "name": "viewerCanDelete", - "description": "Check if the current viewer can delete this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "CommitComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "GistComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "IssueComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReview", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReviewComment", - "ofType": null - } - ] - }, - { - "kind": "INTERFACE", - "name": "GitSignature", - "description": "Information about a signature (GPG or S/MIME) on a Commit or Tag.", - "fields": [ - { - "name": "email", - "description": "Email used to sign this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isValid", - "description": "True if the signature is valid and verified by GitHub.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "payload", - "description": "Payload for GPG signing object. Raw ODB object without the signature header.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "signature", - "description": "ASCII-armored signature header from object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "signer", - "description": "GitHub user corresponding to the email signing this commit.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "User", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "state", - "description": "The state of this signature. `VALID` if signature is valid and verified by GitHub, otherwise represents reason why signature is considered invalid.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "GitSignatureState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "GpgSignature", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "SmimeSignature", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "UnknownSignature", - "ofType": null - } - ] - }, - { - "kind": "ENUM", - "name": "GitSignatureState", - "description": "The state of a Git signature.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "VALID", - "description": "Valid signature and verified by GitHub.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INVALID", - "description": "Invalid signature.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "MALFORMED_SIG", - "description": "Malformed signature.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "UNKNOWN_KEY", - "description": "Key used for signing not known to GitHub.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "BAD_EMAIL", - "description": "Invalid email used for signing.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "UNVERIFIED_EMAIL", - "description": "Email used for signing unverified on GitHub.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "NO_USER", - "description": "Email used for signing not known to GitHub.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "UNKNOWN_SIG_TYPE", - "description": "Unknown signature type.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "UNSIGNED", - "description": "Unsigned.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "GPGVERIFY_UNAVAILABLE", - "description": "Internal error - the GPG verification service is unavailable at the moment.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "GPGVERIFY_ERROR", - "description": "Internal error - the GPG verification service misbehaved.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "NOT_SIGNING_KEY", - "description": "The usage flags for the key that signed this don't allow signing.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "EXPIRED_KEY", - "description": "Signing key expired.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Status", - "description": "Represents a commit status.", - "fields": [ - { - "name": "commit", - "description": "The commit this status is attached to.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "context", - "description": "Looks up an individual status context by context name.", - "args": [ - { - "name": "name", - "description": "The context name.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "StatusContext", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "contexts", - "description": "The individual status contexts for this commit.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "StatusContext", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "state", - "description": "The combined commit status.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "StatusState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "StatusState", - "description": "The possible commit status states.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "EXPECTED", - "description": "Status is expected.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ERROR", - "description": "Status is errored.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FAILURE", - "description": "Status is failing.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "PENDING", - "description": "Status is pending.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "SUCCESS", - "description": "Status is successful.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "StatusContext", - "description": "Represents an individual commit status context", - "fields": [ - { - "name": "commit", - "description": "This commit this status context is attached to.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "context", - "description": "The name of this status context.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "creator", - "description": "The actor who created this status context.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": "The description for this status context.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "state", - "description": "The state of this status context.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "StatusState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "targetUrl", - "description": "The URL for this status context.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Blame", - "description": "Represents a Git blame.", - "fields": [ - { - "name": "ranges", - "description": "The list of ranges from a Git blame.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "BlameRange", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "BlameRange", - "description": "Represents a range of information from a Git blame.", - "fields": [ - { - "name": "age", - "description": "Identifies the recency of the change, from 1 (new) to 10 (old). This is calculated as a 2-quantile and determines the length of distance between the median age of all the changes in the file and the recency of the current range's change.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commit", - "description": "Identifies the line author", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "endingLine", - "description": "The ending line for the range", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "startingLine", - "description": "The starting line for the range", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Blob", - "description": "Represents a Git blob.", - "fields": [ - { - "name": "abbreviatedOid", - "description": "An abbreviated version of the Git object ID", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "byteSize", - "description": "Byte size of Blob object", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commitResourcePath", - "description": "The HTTP path for this Git object", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commitUrl", - "description": "The HTTP URL for this Git object", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isBinary", - "description": "Indicates whether the Blob is binary or text", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isTruncated", - "description": "Indicates whether the contents is truncated", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "oid", - "description": "The Git object ID", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "GitObjectID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "The Repository the Git object belongs to", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "text", - "description": "UTF8 text data or null if the Blob is binary", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "GitObject", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Language", - "description": "Represents a given language found in repositories.", - "fields": [ - { - "name": "color", - "description": "The color defined for the current language.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "The name of the current language.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "PullRequestState", - "description": "The possible states of a pull request.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "OPEN", - "description": "A pull request that is still open.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "CLOSED", - "description": "A pull request that has been closed without being merged.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "MERGED", - "description": "A pull request that has been closed by being merged.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "INTERFACE", - "name": "RepositoryOwner", - "description": "Represents an owner of a Repository.", - "fields": [ - { - "name": "avatarUrl", - "description": "A URL pointing to the owner's public avatar.", - "args": [ - { - "name": "size", - "description": "The size of the resulting square image.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "login", - "description": "The username used to login.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pinnedRepositories", - "description": "A list of repositories this user has pinned to their profile", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "privacy", - "description": "If non-null, filters repositories according to privacy", - "type": { - "kind": "ENUM", - "name": "RepositoryPrivacy", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for repositories returned from the connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "RepositoryOrder", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "affiliations", - "description": "Affiliation options for repositories returned from the connection", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "RepositoryAffiliation", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "isLocked", - "description": "If non-null, filters repositories according to whether they have been locked", - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "RepositoryConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repositories", - "description": "A list of repositories that the user owns.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "privacy", - "description": "If non-null, filters repositories according to privacy", - "type": { - "kind": "ENUM", - "name": "RepositoryPrivacy", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for repositories returned from the connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "RepositoryOrder", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "affiliations", - "description": "Affiliation options for repositories returned from the connection", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "RepositoryAffiliation", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "isLocked", - "description": "If non-null, filters repositories according to whether they have been locked", - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "isFork", - "description": "If non-null, filters repositories according to whether they are forks of another repository", - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "RepositoryConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "Find Repository.", - "args": [ - { - "name": "name", - "description": "Name of Repository to find.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP URL for the owner.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "url", - "description": "The HTTP URL for the owner.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Organization", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - ] - }, - { - "kind": "OBJECT", - "name": "RepositoryConnection", - "description": "A list of repositories owned by the subject.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "RepositoryEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalDiskUsage", - "description": "The total size in kilobytes of all repositories in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "RepositoryEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "RepositoryPrivacy", - "description": "The privacy of a repository", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "PUBLIC", - "description": "Public", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "PRIVATE", - "description": "Private", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "RepositoryOrder", - "description": "Ordering options for repository connections", - "fields": null, - "inputFields": [ - { - "name": "field", - "description": "The field to order repositories by.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "RepositoryOrderField", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "direction", - "description": "The ordering direction.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "OrderDirection", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "RepositoryOrderField", - "description": "Properties by which repository connections can be ordered.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "CREATED_AT", - "description": "Order repositories by creation time", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "UPDATED_AT", - "description": "Order repositories by update time", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "PUSHED_AT", - "description": "Order repositories by push time", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "NAME", - "description": "Order repositories by name", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "STARGAZERS", - "description": "Order repositories by number of stargazers", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "RepositoryAffiliation", - "description": "The affiliation of a user to a repository", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "OWNER", - "description": "Repositories that are owned by the authenticated user.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "COLLABORATOR", - "description": "Repositories that the user has been added to as a collaborator.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ORGANIZATION_MEMBER", - "description": "Repositories that the user has access to through being a member of an organization. This includes every repository on every team that the user is on.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "MergeableState", - "description": "Whether or not a PullRequest can be merged.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "MERGEABLE", - "description": "The pull request can be merged.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "CONFLICTING", - "description": "The pull request cannot be merged due to merge conflicts.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "UNKNOWN", - "description": "The mergeability of the pull request is still being calculated.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "IssueCommentConnection", - "description": "The connection type for IssueComment.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "IssueCommentEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "IssueComment", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "IssueCommentEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "IssueComment", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "IssueComment", - "description": "Represents a comment on an Issue.", - "fields": [ - { - "name": "author", - "description": "The actor who authored the comment.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "authorAssociation", - "description": "Author's association with the subject of the comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "CommentAuthorAssociation", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "body", - "description": "Identifies the comment body.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bodyHTML", - "description": "The comment body rendered to HTML.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "HTML", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bodyText", - "description": "Identifies the body of the issue rendered to text.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdViaEmail", - "description": "Check if this comment was created via an email reply.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "editor", - "description": "The actor who edited the comment.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "issue", - "description": "Identifies the issue associated with the comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "lastEditedAt", - "description": "The moment the editor made the last edit", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "publishedAt", - "description": "Identifies when the comment was published at.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequest", - "description": "Returns the pull request associated with the comment, if this comment was made on a\npull request.\n", - "args": [], - "type": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reactionGroups", - "description": "A list of reactions grouped by content left on the subject.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReactionGroup", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reactions", - "description": "A list of Reactions left on the Issue.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "content", - "description": "Allows filtering Reactions by emoji.", - "type": { - "kind": "ENUM", - "name": "ReactionContent", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Allows specifying the order in which reactions are returned.", - "type": { - "kind": "INPUT_OBJECT", - "name": "ReactionOrder", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReactionConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "The repository associated with this node.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedAt", - "description": "Identifies the date and time when the object was last updated.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "General type updated timestamps will eventually be replaced by other field specific timestamps." - }, - { - "name": "viewerCanDelete", - "description": "Check if the current viewer can delete this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanReact", - "description": "Can user react to this subject", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanUpdate", - "description": "Check if the current viewer can update this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCannotUpdateReasons", - "description": "Reasons why the current viewer can not update this comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "CommentCannotUpdateReason", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerDidAuthor", - "description": "Did the viewer author this comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Comment", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Deletable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Updatable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UpdatableComment", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Reactable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "RepositoryNode", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "IssuePubSubTopic", - "description": "The possible PubSub channels for an issue.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "UPDATED", - "description": "The channel ID for observing issue updates.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "MARKASREAD", - "description": "The channel ID for marking an issue as read.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReviewConnection", - "description": "The connection type for PullRequestReview.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestReviewEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestReview", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReviewEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "PullRequestReview", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReview", - "description": "A review object for a given pull request.", - "fields": [ - { - "name": "author", - "description": "The actor who authored the comment.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "authorAssociation", - "description": "Author's association with the subject of the comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "CommentAuthorAssociation", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "body", - "description": "Identifies the pull request review body.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bodyHTML", - "description": "The body of this review rendered to HTML.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "HTML", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bodyText", - "description": "The body of this review rendered as plain text.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "comments", - "description": "A list of review comments for the current pull request review.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestReviewCommentConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commit", - "description": "Identifies the commit associated with this pull request review.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdViaEmail", - "description": "Check if this comment was created via an email reply.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "editor", - "description": "The actor who edited the comment.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "lastEditedAt", - "description": "The moment the editor made the last edit", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "publishedAt", - "description": "Identifies when the comment was published at.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequest", - "description": "Identifies the pull request associated with this pull request review.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "The repository associated with this node.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path permalink for this PullRequestReview.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "state", - "description": "Identifies the current state of the pull request review.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "PullRequestReviewState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "submittedAt", - "description": "Identifies when the Pull Request Review was submitted", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedAt", - "description": "Identifies the date and time when the object was last updated.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "General type updated timestamps will eventually be replaced by other field specific timestamps." - }, - { - "name": "url", - "description": "The HTTP URL permalink for this PullRequestReview.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanDelete", - "description": "Check if the current viewer can delete this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanUpdate", - "description": "Check if the current viewer can update this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCannotUpdateReasons", - "description": "Reasons why the current viewer can not update this comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "CommentCannotUpdateReason", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerDidAuthor", - "description": "Did the viewer author this comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Comment", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Deletable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Updatable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UpdatableComment", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "RepositoryNode", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "PullRequestReviewState", - "description": "The possible states of a pull request review.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "PENDING", - "description": "A review that has not yet been submitted.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "COMMENTED", - "description": "An informational review.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "APPROVED", - "description": "A review allowing the pull request to merge.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "CHANGES_REQUESTED", - "description": "A review blocking the pull request from merging.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "DISMISSED", - "description": "A review that has been dismissed.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReviewCommentConnection", - "description": "The connection type for PullRequestReviewComment.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestReviewCommentEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestReviewComment", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReviewCommentEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "PullRequestReviewComment", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReviewComment", - "description": "A review comment associated with a given repository pull request.", - "fields": [ - { - "name": "author", - "description": "The actor who authored the comment.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "authorAssociation", - "description": "Author's association with the subject of the comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "CommentAuthorAssociation", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "body", - "description": "The comment body of this review comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bodyHTML", - "description": "The comment body of this review comment rendered to HTML.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "HTML", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bodyText", - "description": "The comment body of this review comment rendered as plain text.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commit", - "description": "Identifies the commit associated with the comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies when the comment was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdViaEmail", - "description": "Check if this comment was created via an email reply.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "diffHunk", - "description": "The diff hunk to which the comment applies.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "draftedAt", - "description": "Identifies when the comment was created in a draft state.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "editor", - "description": "The actor who edited the comment.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "lastEditedAt", - "description": "The moment the editor made the last edit", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "originalCommit", - "description": "Identifies the original commit associated with the comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "originalPosition", - "description": "The original line index in the diff to which the comment applies.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "path", - "description": "The path to which the comment applies.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "position", - "description": "The line index in the diff to which the comment applies.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "publishedAt", - "description": "Identifies when the comment was published at.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequest", - "description": "The pull request associated with this review comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequestReview", - "description": "The pull request review associated with this review comment.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "PullRequestReview", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reactionGroups", - "description": "A list of reactions grouped by content left on the subject.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReactionGroup", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reactions", - "description": "A list of Reactions left on the Issue.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "content", - "description": "Allows filtering Reactions by emoji.", - "type": { - "kind": "ENUM", - "name": "ReactionContent", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Allows specifying the order in which reactions are returned.", - "type": { - "kind": "INPUT_OBJECT", - "name": "ReactionOrder", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReactionConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "The repository associated with this review comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path permalink for this review comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedAt", - "description": "Identifies when the comment was last updated.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "url", - "description": "The HTTP URL permalink for this review comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanDelete", - "description": "Check if the current viewer can delete this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanReact", - "description": "Can user react to this subject", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanUpdate", - "description": "Check if the current viewer can update this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCannotUpdateReasons", - "description": "Reasons why the current viewer can not update this comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "CommentCannotUpdateReason", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerDidAuthor", - "description": "Did the viewer author this comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Comment", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Deletable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Updatable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UpdatableComment", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Reactable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "RepositoryNode", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "PullRequestPubSubTopic", - "description": "The possible PubSub channels for a pull request.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "UPDATED", - "description": "The channel ID for observing pull request updates.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "MARKASREAD", - "description": "The channel ID for marking an pull request as read.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "HEAD_REF", - "description": "The channel ID for observing head ref updates.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PullRequestCommitConnection", - "description": "The connection type for PullRequestCommit.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestCommitEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestCommit", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PullRequestCommitEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "PullRequestCommit", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PullRequestCommit", - "description": "Represents a Git commit part of a pull request.", - "fields": [ - { - "name": "commit", - "description": "The Git commit object", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequest", - "description": "The pull request this commit belongs to", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path for this pull request commit", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "url", - "description": "The HTTP URL for this pull request commit", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UniformResourceLocatable", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReviewRequestConnection", - "description": "The connection type for ReviewRequest.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReviewRequestEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReviewRequest", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReviewRequestEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "ReviewRequest", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReviewRequest", - "description": "A request for a user to review a pull request.", - "fields": [ - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequest", - "description": "Identifies the pull request associated with this review request.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reviewer", - "description": "Identifies the author associated with this review request.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "User", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Team", - "description": "A team of users in an organization.", - "fields": [ - { - "name": "ancestors", - "description": "A list of teams that are ancestors of this team.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "TeamConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "childTeams", - "description": "List of child teams belonging to this team", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Order for connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "TeamOrder", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "userLogins", - "description": "User logins to filter by", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - } - }, - "defaultValue": null - }, - { - "name": "immediateOnly", - "description": "Whether to list immediate child teams or all descendant child teams.", - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": "true" - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "TeamConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "combinedSlug", - "description": "The slug corresponding to the organization and team.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": "The description of the team.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "editTeamResourcePath", - "description": "The HTTP path for editing this team", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "editTeamUrl", - "description": "The HTTP URL for editing this team", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "invitations", - "description": "A list of pending invitations for users to this team", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "OrganizationInvitationConnection", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "members", - "description": "A list of users who are members of this team.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "query", - "description": "The search string to look for.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "membership", - "description": "Filter by membership type", - "type": { - "kind": "ENUM", - "name": "TeamMembershipType", - "ofType": null - }, - "defaultValue": "ALL" - }, - { - "name": "role", - "description": "Filter by team member role", - "type": { - "kind": "ENUM", - "name": "TeamMemberRole", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "TeamMemberConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "membersResourcePath", - "description": "The HTTP path for the team' members", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "membersUrl", - "description": "The HTTP URL for the team' members", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "The name of the team.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "newTeamResourcePath", - "description": "The HTTP path creating a new team", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "newTeamUrl", - "description": "The HTTP URL creating a new team", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "organization", - "description": "The organization that owns this team.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Organization", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "parentTeam", - "description": "The parent team of the team.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Team", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "privacy", - "description": "The level of privacy the team has.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "TeamPrivacy", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repositories", - "description": "A list of repositories this team has access to.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "query", - "description": "The search string to look for.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Order for the connection.", - "type": { - "kind": "INPUT_OBJECT", - "name": "TeamRepositoryOrder", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "TeamRepositoryConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repositoriesResourcePath", - "description": "The HTTP path for this team's repositories", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repositoriesUrl", - "description": "The HTTP URL for this team's repositories", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path for this team", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "slug", - "description": "The slug corresponding to the team.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "teamsResourcePath", - "description": "The HTTP path for this team's teams", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "teamsUrl", - "description": "The HTTP URL for this team's teams", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "url", - "description": "The HTTP URL for this team", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanAdminister", - "description": "Team is adminable by the viewer.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "TeamPrivacy", - "description": "The possible team privacy values.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "SECRET", - "description": "A secret team can only be seen by its members.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "VISIBLE", - "description": "A visible team can be seen and @mentioned by every member of the organization.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "TeamMemberConnection", - "description": "The connection type for User.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "TeamMemberEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "TeamMemberEdge", - "description": "Represents a user who is a member of a team.", - "fields": [ - { - "name": "cursor", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "memberAccessResourcePath", - "description": "The HTTP path to the organization's member access page.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "memberAccessUrl", - "description": "The HTTP URL to the organization's member access page.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "role", - "description": "The role the member has on the team.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "TeamMemberRole", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "TeamMemberRole", - "description": "The possible team member roles; either 'maintainer' or 'member'.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "MAINTAINER", - "description": "A team maintainer has permission to add and remove team members.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "MEMBER", - "description": "A team member has no administrative permissions on the team.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "TeamMembershipType", - "description": "Defines which types of team members are included in the returned list. Can be one of IMMEDIATE, CHILD_TEAM or ALL.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "IMMEDIATE", - "description": "Includes only immediate members of the team.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "CHILD_TEAM", - "description": "Includes only child team members for the team.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ALL", - "description": "Includes immediate and child team members for the team.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "TeamRepositoryConnection", - "description": "The connection type for Repository.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "TeamRepositoryEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "TeamRepositoryEdge", - "description": "Represents a team repository.", - "fields": [ - { - "name": "cursor", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "permission", - "description": "The permission level the team has on the repository", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "RepositoryPermission", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "RepositoryPermission", - "description": "The access level to a repository", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "ADMIN", - "description": "Can read, clone, push, and add collaborators", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "WRITE", - "description": "Can read, clone and push", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "READ", - "description": "Can read and clone", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "TeamRepositoryOrder", - "description": "Ordering options for team repository connections", - "fields": null, - "inputFields": [ - { - "name": "field", - "description": "The field to order repositories by.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "TeamRepositoryOrderField", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "direction", - "description": "The ordering direction.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "OrderDirection", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "TeamRepositoryOrderField", - "description": "Properties by which team repository connections can be ordered.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "CREATED_AT", - "description": "Order repositories by creation time", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "UPDATED_AT", - "description": "Order repositories by update time", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "PUSHED_AT", - "description": "Order repositories by push time", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "NAME", - "description": "Order repositories by name", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "PERMISSION", - "description": "Order repositories by permission", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "STARGAZERS", - "description": "Order repositories by number of stargazers", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "OrganizationInvitationConnection", - "description": "The connection type for OrganizationInvitation.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "OrganizationInvitationEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "OrganizationInvitation", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "OrganizationInvitationEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "OrganizationInvitation", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "OrganizationInvitation", - "description": "An Invitation for a user to an organization.", - "fields": [ - { - "name": "email", - "description": "The email address of the user invited to the organization.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "invitee", - "description": "The user who was invited to the organization.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "User", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "inviter", - "description": "The user who created the invitation.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "role", - "description": "The user's pending role in the organization (e.g. member, owner).", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "OrganizationInvitationRole", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "OrganizationInvitationRole", - "description": "The possible organization invitation roles.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "DIRECT_MEMBER", - "description": "The user is invited to be a direct member of the organization.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ADMIN", - "description": "The user is invited to be an admin of the organization.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "BILLING_MANAGER", - "description": "The user is invited to be a billing manager of the organization.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "REINSTATE", - "description": "The user's previous role will be reinstated.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "TeamConnection", - "description": "The connection type for Team.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "TeamEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Team", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "TeamEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Team", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "TeamOrder", - "description": "Ways in which team connections can be ordered.", - "fields": null, - "inputFields": [ - { - "name": "field", - "description": "The field in which to order nodes by.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "TeamOrderField", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "direction", - "description": "The direction in which to order nodes.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "OrderDirection", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "TeamOrderField", - "description": "Properties by which team connections can be ordered.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "NAME", - "description": "Allows ordering a list of teams by name.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Organization", - "description": "An account on GitHub, with one or more owners, that has repositories, members and teams.", - "fields": [ - { - "name": "avatarUrl", - "description": "A URL pointing to the organization's public avatar.", - "args": [ - { - "name": "size", - "description": "The size of the resulting square image.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isInvoiced", - "description": "Is the account billed through invoices?", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "login", - "description": "The organization's login name.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "members", - "description": "A list of users who are members of this organization.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "UserConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "The organization's public profile name.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "newTeamResourcePath", - "description": "The HTTP path creating a new team", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "newTeamUrl", - "description": "The HTTP URL creating a new team", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "organizationBillingEmail", - "description": "The billing email for the organization.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pinnedRepositories", - "description": "A list of repositories this user has pinned to their profile", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "privacy", - "description": "If non-null, filters repositories according to privacy", - "type": { - "kind": "ENUM", - "name": "RepositoryPrivacy", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for repositories returned from the connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "RepositoryOrder", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "affiliations", - "description": "Affiliation options for repositories returned from the connection", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "RepositoryAffiliation", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "isLocked", - "description": "If non-null, filters repositories according to whether they have been locked", - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "RepositoryConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "project", - "description": "Find project by number.", - "args": [ - { - "name": "number", - "description": "The project number to find.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Project", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "projects", - "description": "A list of projects under the owner.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for projects returned from the connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "ProjectOrder", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "search", - "description": "Query to search projects by, currently only searching by name.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "states", - "description": "A list of states to filter the projects by.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "ProjectState", - "ofType": null - } - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProjectConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "projectsResourcePath", - "description": "The HTTP path listing organization's projects", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "projectsUrl", - "description": "The HTTP URL listing organization's projects", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repositories", - "description": "A list of repositories that the user owns.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "privacy", - "description": "If non-null, filters repositories according to privacy", - "type": { - "kind": "ENUM", - "name": "RepositoryPrivacy", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for repositories returned from the connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "RepositoryOrder", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "affiliations", - "description": "Affiliation options for repositories returned from the connection", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "RepositoryAffiliation", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "isLocked", - "description": "If non-null, filters repositories according to whether they have been locked", - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "isFork", - "description": "If non-null, filters repositories according to whether they are forks of another repository", - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "RepositoryConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "Find Repository.", - "args": [ - { - "name": "name", - "description": "Name of Repository to find.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path for this user", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "samlIdentityProvider", - "description": "The Organization's SAML Identity Providers", - "args": [], - "type": { - "kind": "OBJECT", - "name": "OrganizationIdentityProvider", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "team", - "description": "Find an organization's team by its slug.", - "args": [ - { - "name": "slug", - "description": "The name or slug of the team to find.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "Team", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "teams", - "description": "A list of teams in this organization.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "privacy", - "description": "If non-null, filters teams according to privacy", - "type": { - "kind": "ENUM", - "name": "TeamPrivacy", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "role", - "description": "If non-null, filters teams according to whether the viewer is an admin or member on team", - "type": { - "kind": "ENUM", - "name": "TeamRole", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "query", - "description": "If non-null, filters teams with query on team name and team slug", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "userLogins", - "description": "User logins to filter by", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - } - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Ordering options for teams returned from the connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "TeamOrder", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "ldapMapped", - "description": "If true, filters teams that are mapped to an LDAP Group (Enterprise only)", - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "rootTeamsOnly", - "description": "If true, restrict to only root teams", - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": "false" - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "TeamConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "teamsResourcePath", - "description": "The HTTP path listing organization's teams", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "teamsUrl", - "description": "The HTTP URL listing organization's teams", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "url", - "description": "The HTTP URL for this user", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanAdminister", - "description": "Organization is adminable by the viewer.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanCreateProjects", - "description": "Can the current viewer create new projects on this owner.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanCreateRepositories", - "description": "Viewer can create repositories on this organization", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanCreateTeams", - "description": "Viewer can create teams on this organization.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerIsAMember", - "description": "Viewer is a member of this organization.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "ProjectOwner", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "RepositoryOwner", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UniformResourceLocatable", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "Float", - "description": "Represents signed double-precision fractional values as specified by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "LanguageConnection", - "description": "A list of languages associated with the parent.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "LanguageEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Language", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalSize", - "description": "The total size in bytes of files written in that language.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "LanguageEdge", - "description": "Represents the language of a repository.", - "fields": [ - { - "name": "cursor", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Language", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "size", - "description": "The number of bytes of code written in the language.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Bot", - "description": "A special type of user which takes actions on behalf of GitHub Apps.", - "fields": [ - { - "name": "avatarUrl", - "description": "A URL pointing to the GitHub App's public avatar.", - "args": [ - { - "name": "size", - "description": "The size of the resulting square image.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "login", - "description": "The username of the actor.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path for this bot", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "url", - "description": "The HTTP URL for this bot", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UniformResourceLocatable", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ProjectConnection", - "description": "A list of projects associated with the owner.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProjectEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Project", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ProjectEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Project", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "ProjectOrder", - "description": "Ways in which lists of projects can be ordered upon return.", - "fields": null, - "inputFields": [ - { - "name": "field", - "description": "The field in which to order projects by.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "ProjectOrderField", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "direction", - "description": "The direction in which to order projects by the specified field.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "OrderDirection", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "ProjectOrderField", - "description": "Properties by which project connections can be ordered.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "CREATED_AT", - "description": "Order projects by creation time", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "UPDATED_AT", - "description": "Order projects by update time", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "NAME", - "description": "Order projects by name", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "SCALAR", - "name": "X509Certificate", - "description": "A valid x509 certificate string", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "OrganizationIdentityProvider", - "description": "An Identity Provider configured to provision SAML and SCIM identities for Organizations", - "fields": [ - { - "name": "digestMethod", - "description": "The digest algorithm used to sign SAML requests for the Identity Provider.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "externalIdentities", - "description": "External Identities provisioned by this Identity Provider", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ExternalIdentityConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "idpCertificate", - "description": "The x509 certificate used by the Identity Provder to sign assertions and responses.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "X509Certificate", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "issuer", - "description": "The Issuer Entity ID for the SAML Identity Provider", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "organization", - "description": "Organization this Identity Provider belongs to", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Organization", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "signatureMethod", - "description": "The signature algorithm used to sign SAML requests for the Identity Provider.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ssoUrl", - "description": "The URL endpoint for the Identity Provider's SAML SSO.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ExternalIdentityConnection", - "description": "The connection type for ExternalIdentity.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ExternalIdentityEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ExternalIdentity", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ExternalIdentityEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "ExternalIdentity", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ExternalIdentity", - "description": "An external identity provisioned by SAML SSO or SCIM.", - "fields": [ - { - "name": "guid", - "description": "The GUID for this identity", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "organizationInvitation", - "description": "Organization invitation for this SCIM-provisioned external identity", - "args": [], - "type": { - "kind": "OBJECT", - "name": "OrganizationInvitation", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "samlIdentity", - "description": "SAML Identity attributes", - "args": [], - "type": { - "kind": "OBJECT", - "name": "ExternalIdentitySamlAttributes", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "scimIdentity", - "description": "SCIM Identity attributes", - "args": [], - "type": { - "kind": "OBJECT", - "name": "ExternalIdentityScimAttributes", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "user", - "description": "User linked to this external identity", - "args": [], - "type": { - "kind": "OBJECT", - "name": "User", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ExternalIdentitySamlAttributes", - "description": "SAML attributes for the External Identity", - "fields": [ - { - "name": "nameId", - "description": "The NameID of the SAML identity", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ExternalIdentityScimAttributes", - "description": "SCIM attributes for the External Identity", - "fields": [ - { - "name": "username", - "description": "The userName of the SCIM identity", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "DefaultRepositoryPermissionField", - "description": "The possible default permissions for organization-owned repositories.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "READ", - "description": "Members have read access to org repos by default", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "WRITE", - "description": "Members have read and write access to org repos by default", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ADMIN", - "description": "Members have read, write, and admin access to org repos by default", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "TeamRole", - "description": "The role of a user on a team.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "ADMIN", - "description": "User has admin rights on the team.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "MEMBER", - "description": "User is a member of the team.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "GistConnection", - "description": "The connection type for Gist.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "GistEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Gist", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "GistEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Gist", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Gist", - "description": "A Gist.", - "fields": [ - { - "name": "comments", - "description": "A list of comments associated with the gist", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "GistCommentConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": "The gist description.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isPublic", - "description": "Whether the gist is public or not.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "The gist name.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "owner", - "description": "The gist owner.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "RepositoryOwner", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pushedAt", - "description": "Identifies when the gist was last pushed to.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "stargazers", - "description": "A list of users who have starred this starrable.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Order for connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "StarOrder", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "StargazerConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedAt", - "description": "Identifies the date and time when the object was last updated.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "General type updated timestamps will eventually be replaced by other field specific timestamps." - }, - { - "name": "viewerHasStarred", - "description": "Returns a boolean indicating whether the viewing user has starred this starrable.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Starrable", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INTERFACE", - "name": "Starrable", - "description": "Things that can be starred.", - "fields": [ - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "stargazers", - "description": "A list of users who have starred this starrable.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "orderBy", - "description": "Order for connection", - "type": { - "kind": "INPUT_OBJECT", - "name": "StarOrder", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "StargazerConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerHasStarred", - "description": "Returns a boolean indicating whether the viewing user has starred this starrable.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Gist", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - ] - }, - { - "kind": "OBJECT", - "name": "StargazerConnection", - "description": "The connection type for User.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "StargazerEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "StargazerEdge", - "description": "Represents a user that's starred a repository.", - "fields": [ - { - "name": "cursor", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "starredAt", - "description": "Identifies when the item was starred.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "StarOrder", - "description": "Ways in which star connections can be ordered.", - "fields": null, - "inputFields": [ - { - "name": "field", - "description": "The field in which to order nodes by.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "StarOrderField", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "direction", - "description": "The direction in which to order nodes.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "OrderDirection", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "StarOrderField", - "description": "Properties by which star connections can be ordered.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "STARRED_AT", - "description": "Allows ordering a list of stars by when they were created.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "GistCommentConnection", - "description": "The connection type for GistComment.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "GistCommentEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "GistComment", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "GistCommentEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "GistComment", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "GistComment", - "description": "Represents a comment on an Gist.", - "fields": [ - { - "name": "author", - "description": "The actor who authored the comment.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "authorAssociation", - "description": "Author's association with the gist.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "CommentAuthorAssociation", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "body", - "description": "Identifies the comment body.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "bodyHTML", - "description": "The comment body rendered to HTML.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "HTML", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdViaEmail", - "description": "Check if this comment was created via an email reply.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "editor", - "description": "The actor who edited the comment.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "lastEditedAt", - "description": "The moment the editor made the last edit", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "publishedAt", - "description": "Identifies when the comment was published at.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedAt", - "description": "Identifies the date and time when the object was last updated.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "General type updated timestamps will eventually be replaced by other field specific timestamps." - }, - { - "name": "viewerCanDelete", - "description": "Check if the current viewer can delete this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCanUpdate", - "description": "Check if the current viewer can update this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerCannotUpdateReasons", - "description": "Reasons why the current viewer can not update this comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "CommentCannotUpdateReason", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "viewerDidAuthor", - "description": "Did the viewer author this comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Comment", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Deletable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "Updatable", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UpdatableComment", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "GistPrivacy", - "description": "The privacy of a Gist", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "PUBLIC", - "description": "Public", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "SECRET", - "description": "Secret", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ALL", - "description": "Gists that are public and secret", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "GistOrder", - "description": "Ordering options for gist connections", - "fields": null, - "inputFields": [ - { - "name": "field", - "description": "The field to order repositories by.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "GistOrderField", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "direction", - "description": "The ordering direction.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "OrderDirection", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "GistOrderField", - "description": "Properties by which gist connections can be ordered.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "CREATED_AT", - "description": "Order gists by creation time", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "UPDATED_AT", - "description": "Order gists by update time", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "PUSHED_AT", - "description": "Order gists by push time", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PullRequestTimelineConnection", - "description": "The connection type for PullRequestTimelineItem.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestTimelineItemEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "UNION", - "name": "PullRequestTimelineItem", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PullRequestTimelineItemEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "UNION", - "name": "PullRequestTimelineItem", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "UNION", - "name": "PullRequestTimelineItem", - "description": "An item in an pull request timeline", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "CommitCommentThread", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReview", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReviewThread", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReviewComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "IssueComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ClosedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ReopenedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "SubscribedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "UnsubscribedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "MergedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ReferencedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "AssignedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "UnassignedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "LabeledEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "UnlabeledEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "MilestonedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "DemilestonedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "RenamedTitleEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "LockedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "UnlockedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "DeployedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "HeadRefDeletedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "HeadRefRestoredEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "HeadRefForcePushedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "BaseRefForcePushedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ReviewRequestedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ReviewRequestRemovedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ReviewDismissedEvent", - "ofType": null - } - ] - }, - { - "kind": "OBJECT", - "name": "CommitCommentThread", - "description": "A thread of comments on a commit.", - "fields": [ - { - "name": "comments", - "description": "The comments that exist in this thread.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "CommitCommentConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commit", - "description": "The commit the comments were made on.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "path", - "description": "The file the comments were made on.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "position", - "description": "The position in the diff for the commit that the comment was made on.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "The repository associated with this node.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "RepositoryNode", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PullRequestReviewThread", - "description": "A threaded list of comments for a given pull request.", - "fields": [ - { - "name": "comments", - "description": "A list of pull request comments associated with the thread.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestReviewCommentConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequest", - "description": "Identifies the pull request associated with this thread.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ClosedEvent", - "description": "Represents a 'closed' event on any `Closable`.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "closable", - "description": "Object that was closed.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Closable", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commit", - "description": "Identifies the commit associated with the 'closed' event.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReopenedEvent", - "description": "Represents a 'reopened' event on any `Closable`.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "closable", - "description": "Object that was reopened.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Closable", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "SubscribedEvent", - "description": "Represents a 'subscribed' event on a given `Subscribable`.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subscribable", - "description": "Object referenced by event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Subscribable", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "UnsubscribedEvent", - "description": "Represents an 'unsubscribed' event on a given `Subscribable`.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subscribable", - "description": "Object referenced by event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Subscribable", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "MergedEvent", - "description": "Represents a 'merged' event on a given pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commit", - "description": "Identifies the commit associated with the `merge` event.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "mergeRef", - "description": "Identifies the Ref associated with the `merge` event.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Ref", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "mergeRefName", - "description": "Identifies the name of the Ref associated with the `merge` event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequest", - "description": "PullRequest referenced by event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path for this merged event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "url", - "description": "The HTTP URL for this merged event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UniformResourceLocatable", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReferencedEvent", - "description": "Represents a 'referenced' event on a given `ReferencedSubject`.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commit", - "description": "Identifies the commit associated with the 'referenced' event.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commitRepository", - "description": "Identifies the repository associated with the 'referenced' event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isCrossReference", - "description": "Reference originated in a different repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "Use ReferencedEvent.isCrossRepository instead." - }, - { - "name": "isCrossRepository", - "description": "Reference originated in a different repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isDirectReference", - "description": "Checks if the commit message itself references the subject. Can be false in the case of a commit comment reference.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subject", - "description": "Object referenced by event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "UNION", - "name": "ReferencedSubject", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "UNION", - "name": "ReferencedSubject", - "description": "Any referencable object", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - ] - }, - { - "kind": "OBJECT", - "name": "AssignedEvent", - "description": "Represents an 'assigned' event on any assignable object.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "assignable", - "description": "Identifies the assignable associated with the event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Assignable", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "user", - "description": "Identifies the user who was assigned.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "User", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "UnassignedEvent", - "description": "Represents an 'unassigned' event on any assignable object.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "assignable", - "description": "Identifies the assignable associated with the event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Assignable", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "user", - "description": "Identifies the subject (user) who was unassigned.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "User", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "LabeledEvent", - "description": "Represents a 'labeled' event on a given issue or pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "label", - "description": "Identifies the label associated with the 'labeled' event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Label", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "labelable", - "description": "Identifies the `Labelable` associated with the event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Labelable", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "UnlabeledEvent", - "description": "Represents an 'unlabeled' event on a given issue or pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "label", - "description": "Identifies the label associated with the 'unlabeled' event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Label", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "labelable", - "description": "Identifies the `Labelable` associated with the event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Labelable", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "MilestonedEvent", - "description": "Represents a 'milestoned' event on a given issue or pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "milestoneTitle", - "description": "Identifies the milestone title associated with the 'milestoned' event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subject", - "description": "Object referenced by event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "UNION", - "name": "MilestoneItem", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "UNION", - "name": "MilestoneItem", - "description": "Types that can be inside a Milestone.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - ] - }, - { - "kind": "OBJECT", - "name": "DemilestonedEvent", - "description": "Represents a 'demilestoned' event on a given issue or pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "milestoneTitle", - "description": "Identifies the milestone title associated with the 'demilestoned' event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subject", - "description": "Object referenced by event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "UNION", - "name": "MilestoneItem", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "RenamedTitleEvent", - "description": "Represents a 'renamed' event on a given issue or pull request", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "currentTitle", - "description": "Identifies the current title of the issue or pull request.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "previousTitle", - "description": "Identifies the previous title of the issue or pull request.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subject", - "description": "Subject that was renamed.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "UNION", - "name": "RenamedTitleSubject", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "UNION", - "name": "RenamedTitleSubject", - "description": "An object which has a renamable title", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - ] - }, - { - "kind": "OBJECT", - "name": "LockedEvent", - "description": "Represents a 'locked' event on a given issue or pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "lockable", - "description": "Object that was locked.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Lockable", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "UnlockedEvent", - "description": "Represents an 'unlocked' event on a given issue or pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "lockable", - "description": "Object that was unlocked.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Lockable", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "DeployedEvent", - "description": "Represents a 'deployed' event on a given pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "deployment", - "description": "The deployment associated with the 'deployed' event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Deployment", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequest", - "description": "PullRequest referenced by event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ref", - "description": "The ref associated with the 'deployed' event.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Ref", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Deployment", - "description": "Represents triggered deployment instance.", - "fields": [ - { - "name": "commit", - "description": "Identifies the commit sha of the deployment.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "creator", - "description": "Identifies the actor who triggered the deployment.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "environment", - "description": "The environment to which this deployment was made.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "latestStatus", - "description": "The latest status of this deployment.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "DeploymentStatus", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "Identifies the repository associated with the deployment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "state", - "description": "The current state of the deployment.", - "args": [], - "type": { - "kind": "ENUM", - "name": "DeploymentState", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "statuses", - "description": "A list of statuses associated with the deployment.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "DeploymentStatusConnection", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "DeploymentStatusConnection", - "description": "The connection type for DeploymentStatus.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "DeploymentStatusEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "DeploymentStatus", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "DeploymentStatusEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "DeploymentStatus", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "DeploymentStatus", - "description": "Describes the status of a given deployment attempt.", - "fields": [ - { - "name": "creator", - "description": "Identifies the actor who triggered the deployment.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deployment", - "description": "Identifies the deployment associated with status.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Deployment", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": "Identifies the description of the deployment.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "environmentUrl", - "description": "Identifies the environment URL of the deployment.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "logUrl", - "description": "Identifies the log URL of the deployment.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "state", - "description": "Identifies the current state of the deployment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "DeploymentStatusState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "DeploymentStatusState", - "description": "The possible states for a deployment status.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "PENDING", - "description": "The deployment is pending.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "SUCCESS", - "description": "The deployment was successful.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FAILURE", - "description": "The deployment has failed.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INACTIVE", - "description": "The deployment is inactive.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ERROR", - "description": "The deployment experienced an error.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "DeploymentState", - "description": "The possible states in which a deployment can be.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "ABANDONED", - "description": "The pending deployment was not updated after 30 minutes.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ACTIVE", - "description": "The deployment is currently active.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "DESTROYED", - "description": "An inactive transient deployment.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ERROR", - "description": "The deployment experienced an error.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FAILURE", - "description": "The deployment has failed.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INACTIVE", - "description": "The deployment is inactive.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "PENDING", - "description": "The deployment is pending.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "HeadRefDeletedEvent", - "description": "Represents a 'head_ref_deleted' event on a given pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "headRef", - "description": "Identifies the Ref associated with the `head_ref_deleted` event.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Ref", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "headRefName", - "description": "Identifies the name of the Ref associated with the `head_ref_deleted` event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequest", - "description": "PullRequest referenced by event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "HeadRefRestoredEvent", - "description": "Represents a 'head_ref_restored' event on a given pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequest", - "description": "PullRequest referenced by event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "HeadRefForcePushedEvent", - "description": "Represents a 'head_ref_force_pushed' event on a given pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "afterCommit", - "description": "Identifies the after commit SHA for the 'head_ref_force_pushed' event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "beforeCommit", - "description": "Identifies the before commit SHA for the 'head_ref_force_pushed' event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequest", - "description": "PullRequest referenced by event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ref", - "description": "Identifies the fully qualified ref name for the 'head_ref_force_pushed' event.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Ref", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "BaseRefForcePushedEvent", - "description": "Represents a 'base_ref_force_pushed' event on a given pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "afterCommit", - "description": "Identifies the after commit SHA for the 'base_ref_force_pushed' event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "beforeCommit", - "description": "Identifies the before commit SHA for the 'base_ref_force_pushed' event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequest", - "description": "PullRequest referenced by event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ref", - "description": "Identifies the fully qualified ref name for the 'base_ref_force_pushed' event.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Ref", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReviewRequestedEvent", - "description": "Represents an 'review_requested' event on a given pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequest", - "description": "PullRequest referenced by event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subject", - "description": "Identifies the user whose review was requested.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReviewRequestRemovedEvent", - "description": "Represents an 'review_request_removed' event on a given pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequest", - "description": "PullRequest referenced by event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subject", - "description": "Identifies the user whose review request was removed.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReviewDismissedEvent", - "description": "Represents a 'review_dismissed' event on a given issue or pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "message", - "description": "Identifies the message associated with the 'review_dismissed' event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "messageHtml", - "description": "The message associated with the event, rendered to HTML.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "HTML", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "previousReviewState", - "description": "Identifies the previous state of the review with the 'review_dismissed' event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "PullRequestReviewState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequest", - "description": "PullRequest referenced by event.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequestCommit", - "description": "Identifies the commit which caused the review to become stale.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "PullRequestCommit", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path for this ReviewDismissedEvent.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "review", - "description": "Identifies the review associated with the 'review_dismissed' event.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "PullRequestReview", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "url", - "description": "The HTTP URL for this ReviewDismissedEvent.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UniformResourceLocatable", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "SuggestedReviewer", - "description": "A suggestion to review a pull request based on a user's commit history and review comments.", - "fields": [ - { - "name": "isAuthor", - "description": "Is this suggestion based on past commits?", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isCommenter", - "description": "Is this suggestion based on past review comments?", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reviewer", - "description": "Identifies the user suggested to review the pull request.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Milestone", - "description": "Represents a Milestone object on a given repository.", - "fields": [ - { - "name": "creator", - "description": "Identifies the actor who created the milestone.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": "Identifies the description of the milestone.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "dueOn", - "description": "Identifies the due date of the milestone.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "number", - "description": "Identifies the number of the milestone.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "The repository associated with this milestone.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path for this milestone", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "state", - "description": "Identifies the state of the milestone.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "MilestoneState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "title", - "description": "Identifies the title of the milestone.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "url", - "description": "The HTTP URL for this milestone", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UniformResourceLocatable", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "MilestoneState", - "description": "The possible states of a milestone.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "OPEN", - "description": "A milestone that is still open.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "CLOSED", - "description": "A milestone that has been closed.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "IssueTimelineConnection", - "description": "The connection type for IssueTimelineItem.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "IssueTimelineItemEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "UNION", - "name": "IssueTimelineItem", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "IssueTimelineItemEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "UNION", - "name": "IssueTimelineItem", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "UNION", - "name": "IssueTimelineItem", - "description": "An item in an issue timeline", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Commit", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "IssueComment", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ClosedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ReopenedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "SubscribedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "UnsubscribedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "ReferencedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "AssignedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "UnassignedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "LabeledEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "UnlabeledEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "MilestonedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "DemilestonedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "RenamedTitleEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "LockedEvent", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "UnlockedEvent", - "ofType": null - } - ] - }, - { - "kind": "UNION", - "name": "IssueOrPullRequest", - "description": "Used for return value of Repository.issueOrPullRequest.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - ] - }, - { - "kind": "INTERFACE", - "name": "RepositoryInfo", - "description": "A subset of repository info.", - "fields": [ - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": "The description of the repository.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "descriptionHTML", - "description": "The description of the repository rendered to HTML.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "HTML", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "hasIssuesEnabled", - "description": "Indicates if the repository has issues feature enabled.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "hasWikiEnabled", - "description": "Indicates if the repository has wiki feature enabled.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "homepageUrl", - "description": "The repository's URL.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isFork", - "description": "Identifies if the repository is a fork.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isLocked", - "description": "Indicates if the repository has been locked or not.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isMirror", - "description": "Identifies if the repository is a mirror.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isPrivate", - "description": "Identifies if the repository is private.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "license", - "description": "The license associated with the repository", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "lockReason", - "description": "The reason the repository has been locked.", - "args": [], - "type": { - "kind": "ENUM", - "name": "RepositoryLockReason", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "mirrorUrl", - "description": "The repository's original mirror URL.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "The name of the repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nameWithOwner", - "description": "The repository's name with owner.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "owner", - "description": "The User owner of the repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "RepositoryOwner", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pushedAt", - "description": "Identifies when the repository was last pushed to.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path for this repository", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedAt", - "description": "Identifies the date and time when the object was last updated.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "General type updated timestamps will eventually be replaced by other field specific timestamps." - }, - { - "name": "url", - "description": "The HTTP URL for this repository", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "RepositoryInvitationRepository", - "ofType": null - } - ] - }, - { - "kind": "ENUM", - "name": "RepositoryLockReason", - "description": "The possible reasons a given repository could be in a locked state.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "MOVING", - "description": "The repository is locked due to a move.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "BILLING", - "description": "The repository is locked due to a billing related reason.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "RENAME", - "description": "The repository is locked due to a rename.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "MIGRATING", - "description": "The repository is locked due to a migration.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "RepositoryCollaboratorAffiliation", - "description": "The affiliation type between collaborator and repository.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "ALL", - "description": "All collaborators of the repository.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "OUTSIDE", - "description": "All outside collaborators of an organization-owned repository.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "RepositoryTopicConnection", - "description": "The connection type for RepositoryTopic.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "RepositoryTopicEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "RepositoryTopic", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "RepositoryTopicEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "RepositoryTopic", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "RepositoryTopic", - "description": "A repository-topic connects a repository to a topic.", - "fields": [ - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path for this repository-topic.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "topic", - "description": "The topic.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Topic", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "url", - "description": "The HTTP URL for this repository-topic.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UniformResourceLocatable", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Topic", - "description": "A topic aggregates entities that are related to a subject.", - "fields": [ - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "The topic's name.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "relatedTopics", - "description": "A list of related topics sorted with the most relevant first.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Topic", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ProtectedBranchConnection", - "description": "The connection type for ProtectedBranch.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProtectedBranchEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProtectedBranch", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ProtectedBranchEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "ProtectedBranch", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ProtectedBranch", - "description": "A repository protected branch.", - "fields": [ - { - "name": "creator", - "description": "The actor who created this protected branch.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "hasDismissableStaleReviews", - "description": "Will new commits pushed to this branch dismiss pull request review approvals.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "hasRequiredReviews", - "description": "Are reviews required to update this branch.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "hasRequiredStatusChecks", - "description": "Are status checks required to update this branch.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "hasRestrictedPushes", - "description": "Is pushing to this branch restricted.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "hasRestrictedReviewDismissals", - "description": "Is dismissal of pull request reviews restricted.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "hasStrictRequiredStatusChecks", - "description": "Are branches required to be up to date before merging.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isAdminEnforced", - "description": "Can admins overwrite branch protection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "Identifies the name of the protected branch.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pushAllowances", - "description": "A list push allowances for this protected branch.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PushAllowanceConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "The repository associated with this protected branch.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "requiredStatusCheckContexts", - "description": "List of required status check contexts that must pass for commits to be accepted to this branch.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reviewDismissalAllowances", - "description": "A list review dismissal allowances for this protected branch.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReviewDismissalAllowanceConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReviewDismissalAllowanceConnection", - "description": "The connection type for ReviewDismissalAllowance.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReviewDismissalAllowanceEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReviewDismissalAllowance", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReviewDismissalAllowanceEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "ReviewDismissalAllowance", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReviewDismissalAllowance", - "description": "A team or user who has the ability to dismiss a review on a protected branch.", - "fields": [ - { - "name": "actor", - "description": "The actor that can dismiss.", - "args": [], - "type": { - "kind": "UNION", - "name": "ReviewDismissalAllowanceActor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "protectedBranch", - "description": "Identifies the protected branch associated with the allowed user or team.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProtectedBranch", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "UNION", - "name": "ReviewDismissalAllowanceActor", - "description": "Types that can be an actor.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "User", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Team", - "ofType": null - } - ] - }, - { - "kind": "OBJECT", - "name": "PushAllowanceConnection", - "description": "The connection type for PushAllowance.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PushAllowanceEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PushAllowance", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PushAllowanceEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "PushAllowance", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "PushAllowance", - "description": "A team or user who has the ability to push to a protected branch.", - "fields": [ - { - "name": "actor", - "description": "The actor that can push.", - "args": [], - "type": { - "kind": "UNION", - "name": "PushAllowanceActor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "protectedBranch", - "description": "Identifies the protected branch associated with the allowed user or team.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProtectedBranch", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "UNION", - "name": "PushAllowanceActor", - "description": "Types that can be an actor.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "User", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Team", - "ofType": null - } - ] - }, - { - "kind": "OBJECT", - "name": "MilestoneConnection", - "description": "The connection type for Milestone.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "MilestoneEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Milestone", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "MilestoneEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Milestone", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "CodeOfConduct", - "description": "The Code of Conduct for a repository", - "fields": [ - { - "name": "body", - "description": "The body of the CoC", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "key", - "description": "The key for the CoC", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "The formal name of the CoC", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "url", - "description": "The path to the CoC", - "args": [], - "type": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "LanguageOrder", - "description": "Ordering options for language connections.", - "fields": null, - "inputFields": [ - { - "name": "field", - "description": "The field to order languages by.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "LanguageOrderField", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "direction", - "description": "The ordering direction.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "OrderDirection", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "LanguageOrderField", - "description": "Properties by which language connections can be ordered.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "SIZE", - "description": "Order languages by the size of all files containing the language", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "RefConnection", - "description": "The connection type for Ref.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "RefEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Ref", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "RefEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Ref", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReleaseConnection", - "description": "The connection type for Release.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReleaseEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Release", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReleaseEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Release", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Release", - "description": "A release contains the content for a release.", - "fields": [ - { - "name": "description", - "description": "Identifies the description of the release.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "Identifies the title of the release.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "publishedAt", - "description": "Identifies the date and time when the release was created.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "releaseAssets", - "description": "List of releases assets which are dependent on this release.", - "args": [ - { - "name": "first", - "description": "Returns the first _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "after", - "description": "Returns the elements in the list that come after the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "last", - "description": "Returns the last _n_ elements from the list.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "before", - "description": "Returns the elements in the list that come before the specified global ID.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "name", - "description": "A list of names to filter the assets by.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReleaseAssetConnection", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path for this issue", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "tag", - "description": "The Git tag the release points to", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Ref", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "url", - "description": "The HTTP URL for this issue", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "UniformResourceLocatable", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReleaseAssetConnection", - "description": "The connection type for ReleaseAsset.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReleaseAssetEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ReleaseAsset", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReleaseAssetEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "ReleaseAsset", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ReleaseAsset", - "description": "A release asset contains the content for a release asset.", - "fields": [ - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "Identifies the title of the release asset.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "release", - "description": "release that the asset is associated with", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Release", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "url", - "description": "Identifies the URL of the release asset.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "DeploymentConnection", - "description": "The connection type for Deployment.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "DeploymentEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Deployment", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "DeploymentEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Deployment", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "FollowingConnection", - "description": "The connection type for User.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "UserEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "FollowerConnection", - "description": "The connection type for User.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "UserEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "OrganizationConnection", - "description": "The connection type for Organization.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "OrganizationEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Organization", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "OrganizationEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "Organization", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "StarredRepositoryConnection", - "description": "The connection type for Repository.", - "fields": [ - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "StarredRepositoryEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "totalCount", - "description": "Identifies the total count of items in the connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "StarredRepositoryEdge", - "description": "Represents a starred repository.", - "fields": [ - { - "name": "cursor", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "starredAt", - "description": "Identifies when the item was starred.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "RateLimit", - "description": "Represents the client's rate limit.", - "fields": [ - { - "name": "cost", - "description": "The point cost for the current query counting against the rate limit.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "limit", - "description": "The maximum number of points the client is permitted to consume in a 60 minute window.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "remaining", - "description": "The number of points remaining in the current rate limit window.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resetAt", - "description": "The time at which the current rate limit window resets in UTC epoch seconds.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "SearchResultItemConnection", - "description": "A list of results that matched against a search query.", - "fields": [ - { - "name": "codeCount", - "description": "The number of pieces of code that matched the search query.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "edges", - "description": "A list of edges.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "SearchResultItemEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "issueCount", - "description": "The number of issues that matched the search query.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nodes", - "description": "A list of nodes.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "UNION", - "name": "SearchResultItem", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pageInfo", - "description": "Information to aid in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PageInfo", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repositoryCount", - "description": "The number of repositories that matched the search query.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "userCount", - "description": "The number of users that matched the search query.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "wikiCount", - "description": "The number of wiki pages that matched the search query.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "SearchResultItemEdge", - "description": "An edge in a connection.", - "fields": [ - { - "name": "cursor", - "description": "A cursor for use in pagination.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "node", - "description": "The item at the end of the edge.", - "args": [], - "type": { - "kind": "UNION", - "name": "SearchResultItem", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "UNION", - "name": "SearchResultItem", - "description": "The results of a search.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": null, - "possibleTypes": [ - { - "kind": "OBJECT", - "name": "Issue", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "User", - "ofType": null - }, - { - "kind": "OBJECT", - "name": "Organization", - "ofType": null - } - ] - }, - { - "kind": "ENUM", - "name": "SearchType", - "description": "Represents the individual results of a search.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "ISSUE", - "description": "Returns results matching issues in repositories.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "REPOSITORY", - "description": "Returns results matching repositories.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "USER", - "description": "Returns results matching users on GitHub.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Mutation", - "description": "The root query for implementing GraphQL mutations.", - "fields": [ - { - "name": "acceptTopicSuggestion", - "description": "Applies a suggested topic to the repository.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "AcceptTopicSuggestionInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "AcceptTopicSuggestionPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "addComment", - "description": "Adds a comment to an Issue or Pull Request.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "AddCommentInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "AddCommentPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "addProjectCard", - "description": "Adds a card to a ProjectColumn. Either `contentId` or `note` must be provided but **not** both.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "AddProjectCardInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "AddProjectCardPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "addProjectColumn", - "description": "Adds a column to a Project.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "AddProjectColumnInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "AddProjectColumnPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "addPullRequestReview", - "description": "Adds a review to a Pull Request.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "AddPullRequestReviewInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "AddPullRequestReviewPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "addPullRequestReviewComment", - "description": "Adds a comment to a review.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "AddPullRequestReviewCommentInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "AddPullRequestReviewCommentPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "addReaction", - "description": "Adds a reaction to a subject.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "AddReactionInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "AddReactionPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "addStar", - "description": "Adds a star to a Starrable.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "AddStarInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "AddStarPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createProject", - "description": "Creates a new project.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "CreateProjectInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "CreateProjectPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "declineTopicSuggestion", - "description": "Rejects a suggested topic for the repository.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "DeclineTopicSuggestionInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "DeclineTopicSuggestionPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deleteProject", - "description": "Deletes a project.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "DeleteProjectInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "DeleteProjectPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deleteProjectCard", - "description": "Deletes a project card.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "DeleteProjectCardInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "DeleteProjectCardPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deleteProjectColumn", - "description": "Deletes a project column.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "DeleteProjectColumnInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "DeleteProjectColumnPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deletePullRequestReview", - "description": "Deletes a pull request review.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "DeletePullRequestReviewInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "DeletePullRequestReviewPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "dismissPullRequestReview", - "description": "Dismisses an approved or rejected pull request review.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "DismissPullRequestReviewInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "DismissPullRequestReviewPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "moveProjectCard", - "description": "Moves a project card to another place.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "MoveProjectCardInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "MoveProjectCardPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "moveProjectColumn", - "description": "Moves a project column to another place.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "MoveProjectColumnInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "MoveProjectColumnPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "removeOutsideCollaborator", - "description": "Removes outside collaborator from all repositories in an organization.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "RemoveOutsideCollaboratorInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "RemoveOutsideCollaboratorPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "removeReaction", - "description": "Removes a reaction from a subject.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "RemoveReactionInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "RemoveReactionPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "removeStar", - "description": "Removes a star from a Starrable.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "RemoveStarInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "RemoveStarPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "requestReviews", - "description": "Set review requests on a pull request.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "RequestReviewsInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "RequestReviewsPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "submitPullRequestReview", - "description": "Submits a pending pull request review.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "SubmitPullRequestReviewInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "SubmitPullRequestReviewPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updateProject", - "description": "Updates an existing project.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "UpdateProjectInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "UpdateProjectPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updateProjectCard", - "description": "Updates an existing project card.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "UpdateProjectCardInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "UpdateProjectCardPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updateProjectColumn", - "description": "Updates an existing project column.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "UpdateProjectColumnInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "UpdateProjectColumnPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatePullRequestReview", - "description": "Updates the body of a pull request review.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "UpdatePullRequestReviewInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "UpdatePullRequestReviewPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatePullRequestReviewComment", - "description": "Updates a pull request review comment.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "UpdatePullRequestReviewCommentInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "UpdatePullRequestReviewCommentPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updateSubscription", - "description": "Updates viewers repository subscription state.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "UpdateSubscriptionInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "UpdateSubscriptionPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updateTopics", - "description": "Replaces the repository's topics with the given topics.", - "args": [ - { - "name": "input", - "description": null, - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "UpdateTopicsInput", - "ofType": null - } - }, - "defaultValue": null - } - ], - "type": { - "kind": "OBJECT", - "name": "UpdateTopicsPayload", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "AddReactionPayload", - "description": "Autogenerated return type of AddReaction", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reaction", - "description": "The reaction object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Reaction", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subject", - "description": "The reactable subject.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Reactable", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "AddReactionInput", - "description": "Autogenerated input type of AddReaction", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "subjectId", - "description": "The Node ID of the subject to modify.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "content", - "description": "The name of the emoji to react with.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "ReactionContent", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "RemoveReactionPayload", - "description": "Autogenerated return type of RemoveReaction", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reaction", - "description": "The reaction object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Reaction", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subject", - "description": "The reactable subject.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Reactable", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "RemoveReactionInput", - "description": "Autogenerated input type of RemoveReaction", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "subjectId", - "description": "The Node ID of the subject to modify.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "content", - "description": "The name of the emoji to react with.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "ReactionContent", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "AddCommentPayload", - "description": "Autogenerated return type of AddComment", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commentEdge", - "description": "The edge from the subject's comment connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "IssueCommentEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subject", - "description": "The subject", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "timelineEdge", - "description": "The edge from the subject's timeline connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "IssueTimelineItemEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "AddCommentInput", - "description": "Autogenerated input type of AddComment", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "subjectId", - "description": "The Node ID of the subject to modify.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "body", - "description": "The contents of the comment.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "UpdateSubscriptionPayload", - "description": "Autogenerated return type of UpdateSubscription", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subscribable", - "description": "The input subscribable entity.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Subscribable", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "UpdateSubscriptionInput", - "description": "Autogenerated input type of UpdateSubscription", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "subscribableId", - "description": "The Node ID of the subscribable object to modify.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "state", - "description": "The new state of the subscription.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "SubscriptionState", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "CreateProjectPayload", - "description": "Autogenerated return type of CreateProject", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "project", - "description": "The new project.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Project", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "CreateProjectInput", - "description": "Autogenerated input type of CreateProject", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "ownerId", - "description": "The owner ID to create the project under.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "name", - "description": "The name of project.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "body", - "description": "The description of project.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "UpdateProjectPayload", - "description": "Autogenerated return type of UpdateProject", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "project", - "description": "The updated project.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Project", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "UpdateProjectInput", - "description": "Autogenerated input type of UpdateProject", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "projectId", - "description": "The Project ID to update.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "name", - "description": "The name of project.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "body", - "description": "The description of project.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "state", - "description": "Whether the project is open or closed.", - "type": { - "kind": "ENUM", - "name": "ProjectState", - "ofType": null - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "DeleteProjectPayload", - "description": "Autogenerated return type of DeleteProject", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "owner", - "description": "The repository or organization the project was removed from.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "ProjectOwner", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "DeleteProjectInput", - "description": "Autogenerated input type of DeleteProject", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "projectId", - "description": "The Project ID to update.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "AddProjectColumnPayload", - "description": "Autogenerated return type of AddProjectColumn", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "columnEdge", - "description": "The edge from the project's column connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProjectColumnEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "project", - "description": "The project", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Project", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "AddProjectColumnInput", - "description": "Autogenerated input type of AddProjectColumn", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "projectId", - "description": "The Node ID of the project.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "name", - "description": "The name of the column.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "MoveProjectColumnPayload", - "description": "Autogenerated return type of MoveProjectColumn", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "columnEdge", - "description": "The new edge of the moved column.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProjectColumnEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "MoveProjectColumnInput", - "description": "Autogenerated input type of MoveProjectColumn", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "columnId", - "description": "The id of the column to move.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "afterColumnId", - "description": "Place the new column after the column with this id. Pass null to place it at the front.", - "type": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "UpdateProjectColumnPayload", - "description": "Autogenerated return type of UpdateProjectColumn", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "projectColumn", - "description": "The updated project column.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProjectColumn", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "UpdateProjectColumnInput", - "description": "Autogenerated input type of UpdateProjectColumn", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "projectColumnId", - "description": "The ProjectColumn ID to update.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "name", - "description": "The name of project column.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "DeleteProjectColumnPayload", - "description": "Autogenerated return type of DeleteProjectColumn", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deletedColumnId", - "description": "The deleted column ID.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "project", - "description": "The project the deleted column was in.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Project", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "DeleteProjectColumnInput", - "description": "Autogenerated input type of DeleteProjectColumn", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "columnId", - "description": "The id of the column to delete.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "AddProjectCardPayload", - "description": "Autogenerated return type of AddProjectCard", - "fields": [ - { - "name": "cardEdge", - "description": "The edge from the ProjectColumn's card connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProjectCardEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "projectColumn", - "description": "The ProjectColumn", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Project", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "AddProjectCardInput", - "description": "Autogenerated input type of AddProjectCard", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "projectColumnId", - "description": "The Node ID of the ProjectColumn.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "contentId", - "description": "The content of the card. Must be a member of the ProjectCardItem union", - "type": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "note", - "description": "The note on the card.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "UpdateProjectCardPayload", - "description": "Autogenerated return type of UpdateProjectCard", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "projectCard", - "description": "The updated ProjectCard.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProjectCard", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "UpdateProjectCardInput", - "description": "Autogenerated input type of UpdateProjectCard", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "projectCardId", - "description": "The ProjectCard ID to update.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "note", - "description": "The note of ProjectCard.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "MoveProjectCardPayload", - "description": "Autogenerated return type of MoveProjectCard", - "fields": [ - { - "name": "cardEdge", - "description": "The new edge of the moved card.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProjectCardEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "MoveProjectCardInput", - "description": "Autogenerated input type of MoveProjectCard", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "cardId", - "description": "The id of the card to move.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "columnId", - "description": "The id of the column to move it into.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "afterCardId", - "description": "Place the new card after the card with this id. Pass null to place it at the top.", - "type": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "DeleteProjectCardPayload", - "description": "Autogenerated return type of DeleteProjectCard", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "column", - "description": "The column the deleted card was in.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "ProjectColumn", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deletedCardId", - "description": "The deleted card ID.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "DeleteProjectCardInput", - "description": "Autogenerated input type of DeleteProjectCard", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "cardId", - "description": "The id of the card to delete.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "AddPullRequestReviewPayload", - "description": "Autogenerated return type of AddPullRequestReview", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequestReview", - "description": "The newly created pull request review.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestReview", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "reviewEdge", - "description": "The edge from the pull request's review connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestReviewEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "AddPullRequestReviewInput", - "description": "Autogenerated input type of AddPullRequestReview", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "pullRequestId", - "description": "The Node ID of the pull request to modify.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "commitOID", - "description": "The commit OID the review pertains to.", - "type": { - "kind": "SCALAR", - "name": "GitObjectID", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "body", - "description": "The contents of the review body comment.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "event", - "description": "The event to perform on the pull request review.", - "type": { - "kind": "ENUM", - "name": "PullRequestReviewEvent", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "comments", - "description": "The review line comments.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "INPUT_OBJECT", - "name": "DraftPullRequestReviewComment", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "PullRequestReviewEvent", - "description": "The possible events to perform on a pull request review.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "COMMENT", - "description": "Submit general feedback without explicit approval.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "APPROVE", - "description": "Submit feedback and approve merging these changes.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "REQUEST_CHANGES", - "description": "Submit feedback that must be addressed before merging.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "DISMISS", - "description": "Dismiss review so it now longer effects merging.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "DraftPullRequestReviewComment", - "description": "Specifies a review comment to be left with a Pull Request Review.", - "fields": null, - "inputFields": [ - { - "name": "path", - "description": "Path to the file being commented on.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "position", - "description": "Position in the file to leave a comment on.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "body", - "description": "Body of the comment to leave.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "SubmitPullRequestReviewPayload", - "description": "Autogenerated return type of SubmitPullRequestReview", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequestReview", - "description": "The submitted pull request review.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestReview", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "SubmitPullRequestReviewInput", - "description": "Autogenerated input type of SubmitPullRequestReview", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "pullRequestReviewId", - "description": "The Pull Request Review ID to submit.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "event", - "description": "The event to send to the Pull Request Review.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "PullRequestReviewEvent", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "body", - "description": "The text field to set on the Pull Request Review.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "UpdatePullRequestReviewPayload", - "description": "Autogenerated return type of UpdatePullRequestReview", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequestReview", - "description": "The updated pull request review.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestReview", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "UpdatePullRequestReviewInput", - "description": "Autogenerated input type of UpdatePullRequestReview", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "pullRequestReviewId", - "description": "The Node ID of the pull request review to modify.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "body", - "description": "The contents of the pull request review body.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "DismissPullRequestReviewPayload", - "description": "Autogenerated return type of DismissPullRequestReview", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequestReview", - "description": "The dismissed pull request review.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestReview", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "DismissPullRequestReviewInput", - "description": "Autogenerated input type of DismissPullRequestReview", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "pullRequestReviewId", - "description": "The Node ID of the pull request review to modify.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "message", - "description": "The contents of the pull request review dismissal message.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "DeletePullRequestReviewPayload", - "description": "Autogenerated return type of DeletePullRequestReview", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequestReview", - "description": "The deleted pull request review.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestReview", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "DeletePullRequestReviewInput", - "description": "Autogenerated input type of DeletePullRequestReview", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "pullRequestReviewId", - "description": "The Node ID of the pull request review to delete.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "AddPullRequestReviewCommentPayload", - "description": "Autogenerated return type of AddPullRequestReviewComment", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "comment", - "description": "The newly created comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestReviewComment", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commentEdge", - "description": "The edge from the review's comment connection.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestReviewCommentEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "AddPullRequestReviewCommentInput", - "description": "Autogenerated input type of AddPullRequestReviewComment", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "pullRequestReviewId", - "description": "The Node ID of the review to modify.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "commitOID", - "description": "The SHA of the commit to comment on.", - "type": { - "kind": "SCALAR", - "name": "GitObjectID", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "body", - "description": "The text of the comment.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "path", - "description": "The relative path of the file to comment on.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "position", - "description": "The line index in the diff to comment on.", - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "inReplyTo", - "description": "The comment id to reply to.", - "type": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "UpdatePullRequestReviewCommentPayload", - "description": "Autogenerated return type of UpdatePullRequestReviewComment", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequestReviewComment", - "description": "The updated comment.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequestReviewComment", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "UpdatePullRequestReviewCommentInput", - "description": "Autogenerated input type of UpdatePullRequestReviewComment", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "pullRequestReviewCommentId", - "description": "The Node ID of the comment to modify.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "body", - "description": "The text of the comment.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "RemoveOutsideCollaboratorPayload", - "description": "Autogenerated return type of RemoveOutsideCollaborator", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "removedUser", - "description": "The user that was removed as an outside collaborator.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "RemoveOutsideCollaboratorInput", - "description": "Autogenerated input type of RemoveOutsideCollaborator", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "userId", - "description": "The ID of the outside collaborator to remove.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "organizationId", - "description": "The ID of the organization to remove the outside collaborator from.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "RequestReviewsPayload", - "description": "Autogenerated return type of RequestReviews", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pullRequest", - "description": "The pull request that is getting requests.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "PullRequest", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "requestedReviewersEdge", - "description": "The edge from the pull request to the requested reviewers.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "UserEdge", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "RequestReviewsInput", - "description": "Autogenerated input type of RequestReviews", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "pullRequestId", - "description": "The Node ID of the pull request to modify.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "userIds", - "description": "The Node IDs of the user to request.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - } - }, - "defaultValue": null - }, - { - "name": "teamIds", - "description": "The Node IDs of the team to request.", - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - } - }, - "defaultValue": null - }, - { - "name": "union", - "description": "Add users to the set rather than replace.", - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "AddStarPayload", - "description": "Autogenerated return type of AddStar", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "starrable", - "description": "The starrable.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Starrable", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "AddStarInput", - "description": "Autogenerated input type of AddStar", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "starrableId", - "description": "The Starrable ID to star.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "RemoveStarPayload", - "description": "Autogenerated return type of RemoveStar", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "starrable", - "description": "The starrable.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "Starrable", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "RemoveStarInput", - "description": "Autogenerated input type of RemoveStar", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "starrableId", - "description": "The Starrable ID to unstar.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "AcceptTopicSuggestionPayload", - "description": "Autogenerated return type of AcceptTopicSuggestion", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "topic", - "description": "The accepted topic.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Topic", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "AcceptTopicSuggestionInput", - "description": "Autogenerated input type of AcceptTopicSuggestion", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "repositoryId", - "description": "The Node ID of the repository.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "name", - "description": "The name of the suggested topic.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "DeclineTopicSuggestionPayload", - "description": "Autogenerated return type of DeclineTopicSuggestion", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "topic", - "description": "The declined topic.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Topic", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "DeclineTopicSuggestionInput", - "description": "Autogenerated input type of DeclineTopicSuggestion", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "repositoryId", - "description": "The Node ID of the repository.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "name", - "description": "The name of the suggested topic.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "reason", - "description": "The reason why the suggested topic is declined.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "TopicSuggestionDeclineReason", - "ofType": null - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "TopicSuggestionDeclineReason", - "description": "Reason that the suggested topic is declined.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "NOT_RELEVANT", - "description": "The suggested topic is not relevant to the repository.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "TOO_SPECIFIC", - "description": "The suggested topic is too specific for the repository (e.g. #ruby-on-rails-version-4-2-1).", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "PERSONAL_PREFERENCE", - "description": "The viewer does not like the suggested topic.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "TOO_GENERAL", - "description": "The suggested topic is too general for the repository.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "UpdateTopicsPayload", - "description": "Autogenerated return type of UpdateTopics", - "fields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "invalidTopicNames", - "description": "Names of the provided topics that are not valid.", - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "The updated repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "INPUT_OBJECT", - "name": "UpdateTopicsInput", - "description": "Autogenerated input type of UpdateTopics", - "fields": null, - "inputFields": [ - { - "name": "clientMutationId", - "description": "A unique identifier for the client performing the mutation.", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": null - }, - { - "name": "repositoryId", - "description": "The Node ID of the repository.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "defaultValue": null - }, - { - "name": "topicNames", - "description": "An array of topic names.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - } - } - }, - "defaultValue": null - } - ], - "interfaces": null, - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__Schema", - "description": "A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.", - "fields": [ - { - "name": "directives", - "description": "A list of all directives supported by this server.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Directive", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "mutationType", - "description": "If this server supports mutation, the type that mutation operations will be rooted at.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "queryType", - "description": "The type that query operations will be rooted at.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "subscriptionType", - "description": "If this server support subscription, the type that subscription operations will be rooted at.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "types", - "description": "A list of all types supported by this server.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__Type", - "description": "The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name and description, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.", - "fields": [ - { - "name": "description", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "enumValues", - "description": null, - "args": [ - { - "name": "includeDeprecated", - "description": null, - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": "false" - } - ], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__EnumValue", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "fields", - "description": null, - "args": [ - { - "name": "includeDeprecated", - "description": null, - "type": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - }, - "defaultValue": "false" - } - ], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Field", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "inputFields", - "description": null, - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__InputValue", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "interfaces", - "description": null, - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "kind", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "__TypeKind", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ofType", - "description": null, - "args": [], - "type": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "possibleTypes", - "description": null, - "args": [], - "type": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "__TypeKind", - "description": "An enum describing what kind of type a given `__Type` is.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "SCALAR", - "description": "Indicates this type is a scalar.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "OBJECT", - "description": "Indicates this type is an object. `fields` and `interfaces` are valid fields.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INTERFACE", - "description": "Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "UNION", - "description": "Indicates this type is a union. `possibleTypes` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ENUM", - "description": "Indicates this type is an enum. `enumValues` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INPUT_OBJECT", - "description": "Indicates this type is an input object. `inputFields` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "LIST", - "description": "Indicates this type is a list. `ofType` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "NON_NULL", - "description": "Indicates this type is a non-null. `ofType` is a valid field.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__Field", - "description": "Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.", - "fields": [ - { - "name": "args", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__InputValue", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "deprecationReason", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isDeprecated", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__InputValue", - "description": "Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.", - "fields": [ - { - "name": "defaultValue", - "description": "A GraphQL-formatted string representing the default value for this input value.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "type", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__Type", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__EnumValue", - "description": "One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.", - "fields": [ - { - "name": "deprecationReason", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isDeprecated", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "__Directive", - "description": "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", - "fields": [ - { - "name": "args", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "__InputValue", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": null, - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "locations", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "__DirectiveLocation", - "ofType": null - } - } - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "onField", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "Use `locations`." - }, - { - "name": "onFragment", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "Use `locations`." - }, - { - "name": "onOperation", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "Use `locations`." - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "ENUM", - "name": "__DirectiveLocation", - "description": "A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.", - "fields": null, - "inputFields": null, - "interfaces": null, - "enumValues": [ - { - "name": "QUERY", - "description": "Location adjacent to a query operation.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "MUTATION", - "description": "Location adjacent to a mutation operation.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "SUBSCRIPTION", - "description": "Location adjacent to a subscription operation.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FIELD", - "description": "Location adjacent to a field.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FRAGMENT_DEFINITION", - "description": "Location adjacent to a fragment definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FRAGMENT_SPREAD", - "description": "Location adjacent to a fragment spread.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INLINE_FRAGMENT", - "description": "Location adjacent to an inline fragment.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "SCHEMA", - "description": "Location adjacent to a schema definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "SCALAR", - "description": "Location adjacent to a scalar definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "OBJECT", - "description": "Location adjacent to an object type definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "FIELD_DEFINITION", - "description": "Location adjacent to a field definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ARGUMENT_DEFINITION", - "description": "Location adjacent to an argument definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INTERFACE", - "description": "Location adjacent to an interface definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "UNION", - "description": "Location adjacent to a union definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ENUM", - "description": "Location adjacent to an enum definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "ENUM_VALUE", - "description": "Location adjacent to an enum value definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INPUT_OBJECT", - "description": "Location adjacent to an input object type definition.", - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "INPUT_FIELD_DEFINITION", - "description": "Location adjacent to an input object field definition.", - "isDeprecated": false, - "deprecationReason": null - } - ], - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "GpgSignature", - "description": "Represents a GPG signature on a Commit or Tag.", - "fields": [ - { - "name": "email", - "description": "Email used to sign this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isValid", - "description": "True if the signature is valid and verified by GitHub.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "keyId", - "description": "Hex-encoded ID of the key that signed this object.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "payload", - "description": "Payload for GPG signing object. Raw ODB object without the signature header.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "signature", - "description": "ASCII-armored signature header from object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "signer", - "description": "GitHub user corresponding to the email signing this commit.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "User", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "state", - "description": "The state of this signature. `VALID` if signature is valid and verified by GitHub, otherwise represents reason why signature is considered invalid.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "GitSignatureState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "GitSignature", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "RepositoryInvitation", - "description": "An invitation for a user to be added to a repository.", - "fields": [ - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "invitee", - "description": "The user who received the invitation.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "inviter", - "description": "The user who created the invitation.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "User", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "The Repository the user is invited to.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "RepositoryInvitationRepository", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "RepositoryInvitationRepository", - "description": "A subset of repository info shared with potential collaborators.", - "fields": [ - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "description", - "description": "The description of the repository.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "descriptionHTML", - "description": "The description of the repository rendered to HTML.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "HTML", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "hasIssuesEnabled", - "description": "Indicates if the repository has issues feature enabled.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "hasWikiEnabled", - "description": "Indicates if the repository has wiki feature enabled.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "homepageUrl", - "description": "The repository's URL.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isFork", - "description": "Identifies if the repository is a fork.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isLocked", - "description": "Indicates if the repository has been locked or not.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isMirror", - "description": "Identifies if the repository is a mirror.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isPrivate", - "description": "Identifies if the repository is private.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "license", - "description": "The license associated with the repository", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "lockReason", - "description": "The reason the repository has been locked.", - "args": [], - "type": { - "kind": "ENUM", - "name": "RepositoryLockReason", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "mirrorUrl", - "description": "The repository's original mirror URL.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "The name of the repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "nameWithOwner", - "description": "The repository's name with owner.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "owner", - "description": "The User owner of the repository.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "RepositoryOwner", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "pushedAt", - "description": "Identifies when the repository was last pushed to.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "resourcePath", - "description": "The HTTP path for this repository", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "updatedAt", - "description": "Identifies the date and time when the object was last updated.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": true, - "deprecationReason": "General type updated timestamps will eventually be replaced by other field specific timestamps." - }, - { - "name": "url", - "description": "The HTTP URL for this repository", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "RepositoryInfo", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "SmimeSignature", - "description": "Represents an S/MIME signature on a Commit or Tag.", - "fields": [ - { - "name": "email", - "description": "Email used to sign this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isValid", - "description": "True if the signature is valid and verified by GitHub.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "payload", - "description": "Payload for GPG signing object. Raw ODB object without the signature header.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "signature", - "description": "ASCII-armored signature header from object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "signer", - "description": "GitHub user corresponding to the email signing this commit.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "User", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "state", - "description": "The state of this signature. `VALID` if signature is valid and verified by GitHub, otherwise represents reason why signature is considered invalid.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "GitSignatureState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "GitSignature", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "Tag", - "description": "Represents a Git tag.", - "fields": [ - { - "name": "abbreviatedOid", - "description": "An abbreviated version of the Git object ID", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commitResourcePath", - "description": "The HTTP path for this Git object", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "commitUrl", - "description": "The HTTP URL for this Git object", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "URI", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "message", - "description": "The Git tag message.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "name", - "description": "The Git tag name.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "oid", - "description": "The Git object ID", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "GitObjectID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "repository", - "description": "The Repository the Git object belongs to", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "Repository", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "tagger", - "description": "Details about the tag author.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "GitActor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "target", - "description": "The Git object the tag points to.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "INTERFACE", - "name": "GitObject", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - }, - { - "kind": "INTERFACE", - "name": "GitObject", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "UnknownSignature", - "description": "Represents an unknown signature on a Commit or Tag.", - "fields": [ - { - "name": "email", - "description": "Email used to sign this object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "isValid", - "description": "True if the signature is valid and verified by GitHub.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "payload", - "description": "Payload for GPG signing object. Raw ODB object without the signature header.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "signature", - "description": "ASCII-armored signature header from object.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "String", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "signer", - "description": "GitHub user corresponding to the email signing this commit.", - "args": [], - "type": { - "kind": "OBJECT", - "name": "User", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "state", - "description": "The state of this signature. `VALID` if signature is valid and verified by GitHub, otherwise represents reason why signature is considered invalid.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "ENUM", - "name": "GitSignatureState", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "GitSignature", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "AddedToProjectEvent", - "description": "Represents a 'added_to_project' event on a given issue or pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "BaseRefChangedEvent", - "description": "Represents a 'base_ref_changed' event on a given issue or pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "CommentDeletedEvent", - "description": "Represents a 'comment_deleted' event on a given issue or pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ConvertedNoteToIssueEvent", - "description": "Represents a 'converted_note_to_issue' event on a given issue or pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "MentionedEvent", - "description": "Represents a 'mentioned' event on a given issue or pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "MovedColumnsInProjectEvent", - "description": "Represents a 'moved_columns_in_project' event on a given issue or pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "RemovedFromProjectEvent", - "description": "Represents a 'removed_from_project' event on a given issue or pull request.", - "fields": [ - { - "name": "actor", - "description": "Identifies the actor who performed the event.", - "args": [], - "type": { - "kind": "INTERFACE", - "name": "Actor", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "createdAt", - "description": "Identifies the date and time when the object was created.", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "DateTime", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - }, - { - "name": "databaseId", - "description": "Identifies the primary key from the database.", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": true, - "deprecationReason": "Exposed database IDs will eventually be removed in favor of global Relay IDs." - }, - { - "name": "id", - "description": null, - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "ID", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [ - { - "kind": "INTERFACE", - "name": "Node", - "ofType": null - } - ], - "enumValues": null, - "possibleTypes": null - } - ], - "directives": [ - { - "name": "include", - "description": "Directs the executor to include this field or fragment only when the `if` argument is true.", - "locations": [ - "FIELD", - "FRAGMENT_SPREAD", - "INLINE_FRAGMENT" - ], - "args": [ - { - "name": "if", - "description": "Included when true.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "defaultValue": null - } - ] - }, - { - "name": "skip", - "description": "Directs the executor to skip this field or fragment when the `if` argument is true.", - "locations": [ - "FIELD", - "FRAGMENT_SPREAD", - "INLINE_FRAGMENT" - ], - "args": [ - { - "name": "if", - "description": "Skipped when true.", - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Boolean", - "ofType": null - } - }, - "defaultValue": null - } - ] - }, - { - "name": "deprecated", - "description": "Marks an element of a GraphQL schema as no longer supported.", - "locations": [ - "FIELD_DEFINITION", - "ENUM_VALUE" - ], - "args": [ - { - "name": "reason", - "description": "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted in [Markdown](https://daringfireball.net/projects/markdown/).", - "type": { - "kind": "SCALAR", - "name": "String", - "ofType": null - }, - "defaultValue": "\"No longer supported\"" - } - ] - } - ] - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/App.java b/app/src/main/java/com/fastaccess/App.java deleted file mode 100644 index d770b1e9d..000000000 --- a/app/src/main/java/com/fastaccess/App.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.fastaccess; - -import android.app.Application; -import androidx.annotation.NonNull; -import androidx.preference.PreferenceManager; - -import com.fastaccess.data.dao.model.Models; -import com.fastaccess.helper.DeviceNameGetter; -import com.fastaccess.helper.TypeFaceHelper; -import com.fastaccess.provider.colors.ColorsProvider; -import com.fastaccess.provider.emoji.EmojiManager; -import com.fastaccess.provider.fabric.FabricProvider; -import com.fastaccess.provider.tasks.notification.NotificationSchedulerJobTask; -import com.google.firebase.messaging.FirebaseMessaging; -import com.miguelbcr.io.rx_billing_service.RxBillingService; - -import io.requery.Persistable; -import io.requery.android.sqlite.DatabaseSource; -import io.requery.meta.EntityModel; -import io.requery.reactivex.ReactiveEntityStore; -import io.requery.reactivex.ReactiveSupport; -import io.requery.sql.Configuration; -import io.requery.sql.EntityDataStore; -import io.requery.sql.TableCreationMode; -import shortbread.Shortbread; - - -/** - * Created by Kosh on 03 Feb 2017, 12:07 AM - */ - -public class App extends Application { - private static App instance; - private ReactiveEntityStore dataStore; - - @Override public void onCreate() { - super.onCreate(); - instance = this; - init(); - } - - @NonNull public static App getInstance() { - return instance; - } - - private void init() { - FabricProvider.INSTANCE.initFabric(this); - RxBillingService.register(this); - deleteDatabase("database.db"); - getDataStore(); - setupPreference(); - TypeFaceHelper.generateTypeface(this); - NotificationSchedulerJobTask.scheduleJob(this); - Shortbread.create(this); - EmojiManager.load(); - ColorsProvider.load(); - DeviceNameGetter.getInstance().loadDevice(); - try { - FirebaseMessaging.getInstance().subscribeToTopic("FastHub"); - } catch (Exception ignored) {} - } - - private void setupPreference() { - PreferenceManager.setDefaultValues(this, R.xml.fasthub_settings, false); - PreferenceManager.setDefaultValues(this, R.xml.about_settings, false); - PreferenceManager.setDefaultValues(this, R.xml.behaviour_settings, false); - PreferenceManager.setDefaultValues(this, R.xml.customization_settings, false); - PreferenceManager.setDefaultValues(this, R.xml.language_settings, false); - PreferenceManager.setDefaultValues(this, R.xml.notification_settings, false); - } - - public ReactiveEntityStore getDataStore() { - if (dataStore == null) { - EntityModel model = Models.DEFAULT; - DatabaseSource source = new DatabaseSource(this, model, "FastHub-DB", 18); - Configuration configuration = source.getConfiguration(); - if (BuildConfig.DEBUG) { - source.setTableCreationMode(TableCreationMode.CREATE_NOT_EXISTS); - } - dataStore = ReactiveSupport.toReactiveStore(new EntityDataStore(configuration)); - } - return dataStore; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/data/dao/AccessTokenModel.java b/app/src/main/java/com/fastaccess/data/dao/AccessTokenModel.java deleted file mode 100644 index 2766fa0eb..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/AccessTokenModel.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 09 Nov 2016, 11:28 PM - */ - - -@Getter @Setter @NoArgsConstructor -public class AccessTokenModel implements Parcelable { - private long id; - private String token; - private String hashedToken; - private String accessToken; - private String tokenType; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeString(this.token); - dest.writeString(this.hashedToken); - dest.writeString(this.accessToken); - dest.writeString(this.tokenType); - } - - private AccessTokenModel(Parcel in) { - this.id = in.readLong(); - this.token = in.readString(); - this.hashedToken = in.readString(); - this.accessToken = in.readString(); - this.tokenType = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public AccessTokenModel createFromParcel(Parcel source) {return new AccessTokenModel(source);} - - @Override public AccessTokenModel[] newArray(int size) {return new AccessTokenModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/AppLanguageModel.java b/app/src/main/java/com/fastaccess/data/dao/AppLanguageModel.java deleted file mode 100644 index 81350448f..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/AppLanguageModel.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; - -/** - * Created by kosh on 20/07/2017. - */ - -@Getter @Setter @AllArgsConstructor public class AppLanguageModel implements Parcelable { - private String value; - private String label; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.value); - dest.writeString(this.label); - } - - private AppLanguageModel(Parcel in) { - this.value = in.readString(); - this.label = in.readString(); - } - - @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - AppLanguageModel that = (AppLanguageModel) o; - - return label != null ? label.equals(that.label) : that.label == null; - } - - @Override public int hashCode() { - return label != null ? label.hashCode() : 0; - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override public AppLanguageModel createFromParcel(Parcel source) {return new AppLanguageModel(source);} - - @Override public AppLanguageModel[] newArray(int size) {return new AppLanguageModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/AssigneesRequestModel.java b/app/src/main/java/com/fastaccess/data/dao/AssigneesRequestModel.java deleted file mode 100644 index 38258bbc2..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/AssigneesRequestModel.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.fastaccess.data.dao; - -import java.util.List; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 05 Mar 2017, 12:01 PM - */ - -@Getter @Setter @NoArgsConstructor -public class AssigneesRequestModel { - private List assignees; - private List reviewers; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/AuthModel.java b/app/src/main/java/com/fastaccess/data/dao/AuthModel.java deleted file mode 100644 index a37d066e9..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/AuthModel.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.google.gson.annotations.SerializedName; - -import java.util.List; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 12 Mar 2017, 3:16 AM - */ - -@Getter @Setter @NoArgsConstructor -public class AuthModel implements Parcelable { - - private String clientId; - private String clientSecret; - private String redirectUri; - private List scopes; - private String state; - private String note; - private String noteUrl; - @SerializedName("X-GitHub-OTP") private String otpCode; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.clientId); - dest.writeString(this.clientSecret); - dest.writeString(this.redirectUri); - dest.writeStringList(this.scopes); - dest.writeString(this.state); - dest.writeString(this.note); - dest.writeString(this.noteUrl); - dest.writeString(this.otpCode); - } - - private AuthModel(Parcel in) { - this.clientId = in.readString(); - this.clientSecret = in.readString(); - this.redirectUri = in.readString(); - this.scopes = in.createStringArrayList(); - this.state = in.readString(); - this.note = in.readString(); - this.noteUrl = in.readString(); - this.otpCode = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public AuthModel createFromParcel(Parcel source) {return new AuthModel(source);} - - @Override public AuthModel[] newArray(int size) {return new AuthModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/BranchesModel.java b/app/src/main/java/com/fastaccess/data/dao/BranchesModel.java deleted file mode 100644 index 77a08db46..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/BranchesModel.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.data.dao.model.Commit; -import com.google.gson.annotations.SerializedName; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 03 Mar 2017, 9:08 PM - */ - -@Getter @Setter @NoArgsConstructor -public class BranchesModel implements Parcelable { - - public String name; - public Commit commit; - @SerializedName("protected") public boolean protectedBranch; - public String protectionUrl; - public boolean isTag; - - @Override public String toString() { - return name; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.name); - dest.writeParcelable(this.commit, flags); - dest.writeByte(this.protectedBranch ? (byte) 1 : (byte) 0); - dest.writeString(this.protectionUrl); - dest.writeByte(this.isTag ? (byte) 1 : (byte) 0); - } - - private BranchesModel(Parcel in) { - this.name = in.readString(); - this.commit = in.readParcelable(Commit.class.getClassLoader()); - this.protectedBranch = in.readByte() != 0; - this.protectionUrl = in.readString(); - this.isTag = in.readByte() != 0; - } - - public static final Creator CREATOR = new Creator() { - @Override public BranchesModel createFromParcel(Parcel source) {return new BranchesModel(source);} - - @Override public BranchesModel[] newArray(int size) {return new BranchesModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/CommentRequestModel.java b/app/src/main/java/com/fastaccess/data/dao/CommentRequestModel.java deleted file mode 100644 index f37e0739b..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/CommentRequestModel.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.google.gson.annotations.SerializedName; - -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Kosh on 20 Nov 2016, 10:40 AM - */ - -@Getter @Setter public class CommentRequestModel implements Parcelable { - public String body; - @SerializedName("in_reply_to") public Long inReplyTo; - public String path; - public Integer position; - public Integer line; - - public CommentRequestModel() {} - - @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - CommentRequestModel that = (CommentRequestModel) o; - return (path != null ? path.equals(that.path) : that.path == null) && - (position != null ? position.equals(that.position) : that.position == null); - } - - @Override public int hashCode() { - int result = path != null ? path.hashCode() : 0; - result = 31 * result + (position != null ? position.hashCode() : 0); - return result; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.body); - dest.writeValue(this.inReplyTo); - dest.writeString(this.path); - dest.writeValue(this.position); - dest.writeValue(this.line); - } - - @Override public String toString() { - return "CommentRequestModel{" + - "body='" + body + '\'' + - ", inReplyTo=" + inReplyTo + - ", path='" + path + '\'' + - ", position=" + position + - ", line=" + line + - '}'; - } - - private CommentRequestModel(Parcel in) { - this.body = in.readString(); - this.inReplyTo = (Long) in.readValue(Long.class.getClassLoader()); - this.path = in.readString(); - this.position = (Integer) in.readValue(Integer.class.getClassLoader()); - this.line = (Integer) in.readValue(Integer.class.getClassLoader()); - } - - public static final Creator CREATOR = new Creator() { - @Override public CommentRequestModel createFromParcel(Parcel source) {return new CommentRequestModel(source);} - - @Override public CommentRequestModel[] newArray(int size) {return new CommentRequestModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/CommitCountModel.java b/app/src/main/java/com/fastaccess/data/dao/CommitCountModel.java deleted file mode 100644 index 8b74c7857..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/CommitCountModel.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import java.util.ArrayList; -import java.util.List; - -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Kosh on 01 Apr 2017, 12:42 PM - */ -@Getter @Setter public class CommitCountModel implements Parcelable { - - private List all; - private List owner; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeList(this.all); - dest.writeList(this.owner); - } - - public CommitCountModel() {} - - private CommitCountModel(Parcel in) { - this.all = new ArrayList(); - in.readList(this.all, Integer.class.getClassLoader()); - this.owner = new ArrayList(); - in.readList(this.owner, Integer.class.getClassLoader()); - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override public CommitCountModel createFromParcel(Parcel source) {return new CommitCountModel(source);} - - @Override public CommitCountModel[] newArray(int size) {return new CommitCountModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/CommitFileChanges.java b/app/src/main/java/com/fastaccess/data/dao/CommitFileChanges.java deleted file mode 100644 index 074f72f84..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/CommitFileChanges.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.annimon.stream.Stream; - -import java.util.ArrayList; -import java.util.List; - -import io.reactivex.Observable; -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Kosh on 20 Jun 2017, 7:32 PM - */ - -@Getter @Setter public class CommitFileChanges implements Parcelable { - - public List linesModel; - public CommitFileModel commitFileModel; - - private CommitFileChanges() {} - - public static Observable constructToObservable(@Nullable ArrayList files) { - if (files == null || files.isEmpty()) return Observable.empty(); - return Observable.fromIterable(construct(files)); - } - - @NonNull public static List construct(@Nullable List files) { - if (files == null || files.isEmpty()) { - return new ArrayList<>(); - } - return Stream.of(files) - .map(CommitFileChanges::getCommitFileChanges) - .toList(); - } - - @NonNull private static CommitFileChanges getCommitFileChanges(CommitFileModel m) { - CommitFileChanges model = new CommitFileChanges(); - model.setLinesModel(CommitLinesModel.getLines(m.getPatch())); - if (m.getPatch() != null) { - m.setPatch("fake"); - } - model.setCommitFileModel(m); - return model; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeTypedList(this.linesModel); - dest.writeParcelable(this.commitFileModel, flags); - } - - private CommitFileChanges(Parcel in) { - this.linesModel = in.createTypedArrayList(CommitLinesModel.CREATOR); - this.commitFileModel = in.readParcelable(CommitFileModel.class.getClassLoader()); - } - - public static final Creator CREATOR = new Creator() { - @Override public CommitFileChanges createFromParcel(Parcel source) {return new CommitFileChanges(source);} - - @Override public CommitFileChanges[] newArray(int size) {return new CommitFileChanges[size];} - }; - - public static boolean canAttachToBundle(CommitFileChanges model) { - Parcel parcel = Parcel.obtain(); - model.writeToParcel(parcel, 0); - int size = parcel.dataSize(); - return size < 600000; - } - - @Override public String toString() { - return "CommitFileChanges{" + - "linesModel=" + linesModel + - ", commitFileModel=" + commitFileModel + - '}'; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/CommitFileListModel.java b/app/src/main/java/com/fastaccess/data/dao/CommitFileListModel.java deleted file mode 100644 index 6bd6ed294..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/CommitFileListModel.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fastaccess.data.dao; - -import java.util.ArrayList; - -/** - * Created by Kosh on 12 Feb 2017, 12:06 AM - */ - -public class CommitFileListModel extends ArrayList {} diff --git a/app/src/main/java/com/fastaccess/data/dao/CommitFileModel.java b/app/src/main/java/com/fastaccess/data/dao/CommitFileModel.java deleted file mode 100644 index b2a86f6af..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/CommitFileModel.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -/** - * Created by Kosh on 01 Jan 2017, 9:00 PM - */ -public class CommitFileModel implements Parcelable { - - private String sha; - private String filename; - private String status; - private int additions; - private int deletions; - private int changes; - private String blobUrl; - private String rawUrl; - private String contentsUrl; - private String patch; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.sha); - dest.writeString(this.filename); - dest.writeString(this.status); - dest.writeInt(this.additions); - dest.writeInt(this.deletions); - dest.writeInt(this.changes); - dest.writeString(this.blobUrl); - dest.writeString(this.rawUrl); - dest.writeString(this.contentsUrl); - dest.writeString(this.patch); - } - - @SuppressWarnings("WeakerAccess") protected CommitFileModel(Parcel in) { - this.sha = in.readString(); - this.filename = in.readString(); - this.status = in.readString(); - this.additions = in.readInt(); - this.deletions = in.readInt(); - this.changes = in.readInt(); - this.blobUrl = in.readString(); - this.rawUrl = in.readString(); - this.contentsUrl = in.readString(); - this.patch = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public CommitFileModel createFromParcel(Parcel source) {return new CommitFileModel(source);} - - @Override public CommitFileModel[] newArray(int size) {return new CommitFileModel[size];} - }; - - @Override public String toString() { - return "CommitFileModel{" + - "sha='" + sha + '\'' + - ", filename='" + filename + '\'' + - ", status='" + status + '\'' + - ", additions=" + additions + - ", deletions=" + deletions + - ", changes=" + changes + - ", blobUrl='" + blobUrl + '\'' + - ", rawUrl='" + rawUrl + '\'' + - ", contentsUrl='" + contentsUrl + '\'' + - ", patch='" + patch + '\'' + - '}'; - } - - public String getSha() { - return sha; - } - - public void setSha(String sha) { - this.sha = sha; - } - - public String getFilename() { - return filename; - } - - public void setFilename(String filename) { - this.filename = filename; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public int getAdditions() { - return additions; - } - - public void setAdditions(int additions) { - this.additions = additions; - } - - public int getDeletions() { - return deletions; - } - - public void setDeletions(int deletions) { - this.deletions = deletions; - } - - public int getChanges() { - return changes; - } - - public void setChanges(int changes) { - this.changes = changes; - } - - public String getBlobUrl() { - return blobUrl; - } - - public void setBlobUrl(String blobUrl) { - this.blobUrl = blobUrl; - } - - public String getRawUrl() { - return rawUrl; - } - - public void setRawUrl(String rawUrl) { - this.rawUrl = rawUrl; - } - - public String getContentsUrl() { - return contentsUrl; - } - - public void setContentsUrl(String contentsUrl) { - this.contentsUrl = contentsUrl; - } - - public String getPatch() { - return patch; - } - - public void setPatch(String patch) { - this.patch = patch; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/CommitLinesModel.java b/app/src/main/java/com/fastaccess/data/dao/CommitLinesModel.java deleted file mode 100644 index 9e8c9b68e..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/CommitLinesModel.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.helper.InputHelper; - -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; - -import lombok.AllArgsConstructor; - -import static com.fastaccess.ui.widgets.DiffLineSpan.HUNK_TITLE; - -/** - * Created by Kosh on 20 Jun 2017, 7:32 PM - */ - -@AllArgsConstructor public class CommitLinesModel implements Parcelable { - - public static final int TRANSPARENT = 0; - public static final int ADDITION = 1; - public static final int DELETION = 2; - public static final int PATCH = 3; - - - public String text; - public int color; - public int leftLineNo; - public int rightLineNo; - public boolean noNewLine; - public int position; - private boolean hasCommentedOn; - - @NonNull public static List getLines(@Nullable String text) { - ArrayList models = new ArrayList<>(); - if (!InputHelper.isEmpty(text)) { - String[] split = text.split("\\r?\\n|\\r"); - if (split.length > 1) { - int leftLineNo = -1; - int rightLineNo = -1; - int position = 0; - for (String token : split) { - char firstChar = token.charAt(0); - boolean addLeft = false; - boolean addRight = false; - int color = TRANSPARENT; - if (token.startsWith("@@")) { - color = PATCH; - Matcher matcher = HUNK_TITLE.matcher(token.trim()); - if (matcher.matches()) { - try { - leftLineNo = Math.abs(Integer.parseInt(matcher.group(1))) - 1; - rightLineNo = Integer.parseInt(matcher.group(3)) - 1; - } catch (NumberFormatException e) {e.printStackTrace();} - } - } else if (firstChar == '+') { - position++; - color = ADDITION; - ++rightLineNo; - addRight = true; - addLeft = false; - } else if (firstChar == '-') { - position++; - color = DELETION; - ++leftLineNo; - addRight = false; - addLeft = true; - } else { - position++; - addLeft = true; - addRight = true; - ++rightLineNo; - ++leftLineNo; - } - int index = token.indexOf("\\ No newline at end of file"); - if (index != -1) { - token = token.replace("\\ No newline at end of file", ""); - } - models.add(new CommitLinesModel(token, color, token.startsWith("@@") || !addLeft ? -1 : leftLineNo, - token.startsWith("@@") || !addRight ? -1 : rightLineNo, index != -1, position, false)); - } - } - } - return models; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.text); - dest.writeInt(this.color); - dest.writeInt(this.leftLineNo); - dest.writeInt(this.rightLineNo); - dest.writeByte(this.noNewLine ? (byte) 1 : (byte) 0); - dest.writeInt(this.position); - } - - private CommitLinesModel(Parcel in) { - this.text = in.readString(); - this.color = in.readInt(); - this.leftLineNo = in.readInt(); - this.rightLineNo = in.readInt(); - this.noNewLine = in.readByte() != 0; - this.position = in.readInt(); - } - - public static final Creator CREATOR = new Creator() { - @Override public CommitLinesModel createFromParcel(Parcel source) {return new CommitLinesModel(source);} - - @Override public CommitLinesModel[] newArray(int size) {return new CommitLinesModel[size];} - }; - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - public int getColor() { - return color; - } - - public void setColor(int color) { - this.color = color; - } - - public int getLeftLineNo() { - return leftLineNo; - } - - public void setLeftLineNo(int leftLineNo) { - this.leftLineNo = leftLineNo; - } - - public int getRightLineNo() { - return rightLineNo; - } - - public void setRightLineNo(int rightLineNo) { - this.rightLineNo = rightLineNo; - } - - public boolean isNoNewLine() { - return noNewLine; - } - - public void setNoNewLine(boolean noNewLine) { - this.noNewLine = noNewLine; - } - - public int getPosition() { - return position; - } - - public void setPosition(int position) { - this.position = position; - } - - public boolean isHasCommentedOn() { - return hasCommentedOn; - } - - public void setHasCommentedOn(boolean hasCommentedOn) { - this.hasCommentedOn = hasCommentedOn; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/CommitListModel.java b/app/src/main/java/com/fastaccess/data/dao/CommitListModel.java deleted file mode 100644 index 2b91db77b..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/CommitListModel.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.fastaccess.data.dao; - -import com.fastaccess.data.dao.model.Commit; - -import java.util.ArrayList; - -/** - * Created by Kosh on 12 Feb 2017, 12:10 AM - */ - -public class CommitListModel extends ArrayList {} diff --git a/app/src/main/java/com/fastaccess/data/dao/CommitRequestModel.java b/app/src/main/java/com/fastaccess/data/dao/CommitRequestModel.java deleted file mode 100644 index 3baa2db84..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/CommitRequestModel.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.fastaccess.data.dao; - -/** - * Created by kosh on 31/08/2017. - */ - -public class CommitRequestModel { - - private String message; - private String content; - private String sha; - private String branch; - - public CommitRequestModel(String message, String content, String sha, String branch) { - this.message = message; - this.content = content; - this.sha = sha; - this.branch = branch; - } - - public String getSha() { - return sha; - } - - public void setSha(String sha) { - this.sha = sha; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public String getBranch() { - return branch; - } - - public void setBranch(String branch) { - this.branch = branch; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/CreateGistModel.java b/app/src/main/java/com/fastaccess/data/dao/CreateGistModel.java deleted file mode 100644 index 8beb28115..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/CreateGistModel.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.google.gson.annotations.SerializedName; - -import java.util.HashMap; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 18 Feb 2017, 11:15 PM - */ - -@Setter @Getter @NoArgsConstructor -public class CreateGistModel implements Parcelable { - private HashMap files; - private String description; - @SerializedName("public") private Boolean publicGist; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeSerializable(this.files); - dest.writeString(this.description); - dest.writeValue(this.publicGist); - } - - @SuppressWarnings("unchecked") private CreateGistModel(Parcel in) { - this.files = (HashMap) in.readSerializable(); - this.description = in.readString(); - this.publicGist = (Boolean) in.readValue(Boolean.class.getClassLoader()); - } - - public static final Creator CREATOR = new Creator() { - @Override public CreateGistModel createFromParcel(Parcel source) {return new CreateGistModel(source);} - - @Override public CreateGistModel[] newArray(int size) {return new CreateGistModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/CreateIssueModel.java b/app/src/main/java/com/fastaccess/data/dao/CreateIssueModel.java deleted file mode 100644 index 35d165998..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/CreateIssueModel.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import java.util.ArrayList; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 19 Feb 2017, 12:13 PM - */ - -@Getter @Setter @NoArgsConstructor -public class CreateIssueModel implements Parcelable { - private String title; - private String body; - private ArrayList labels; - private ArrayList assignees; - private Long milestone; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.title); - dest.writeString(this.body); - dest.writeStringList(this.labels); - dest.writeStringList(this.assignees); - dest.writeValue(this.milestone); - } - - protected CreateIssueModel(Parcel in) { - this.title = in.readString(); - this.body = in.readString(); - this.labels = in.createStringArrayList(); - this.assignees = in.createStringArrayList(); - this.milestone = (Long) in.readValue(Long.class.getClassLoader()); - } - - public static final Creator CREATOR = new Creator() { - @Override public CreateIssueModel createFromParcel(Parcel source) {return new CreateIssueModel(source);} - - @Override public CreateIssueModel[] newArray(int size) {return new CreateIssueModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/CreateMilestoneModel.java b/app/src/main/java/com/fastaccess/data/dao/CreateMilestoneModel.java deleted file mode 100644 index a10f8c026..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/CreateMilestoneModel.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.fastaccess.data.dao; - -import com.google.gson.annotations.SerializedName; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 05 Mar 2017, 2:30 AM - */ - -@Getter @Setter @NoArgsConstructor -public class CreateMilestoneModel { - private String title; - private String description; - @SerializedName("due_on") private String dueOn; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/EditRepoFileModel.kt b/app/src/main/java/com/fastaccess/data/dao/EditRepoFileModel.kt deleted file mode 100644 index 09cdedd02..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/EditRepoFileModel.kt +++ /dev/null @@ -1,44 +0,0 @@ -package com.fastaccess.data.dao - -import android.os.Parcel -import com.fastaccess.helper.* - -/** - * Created by Hashemsergani on 01/09/2017. - */ -data class EditRepoFileModel( - val login: String, - val repoId: String, - val path: String?, - val ref: String, - val sha: String?, - val contentUrl: String?, - val fileName: String?, - val isEdit: Boolean -) : KotlinParcelable { - constructor(parcel: Parcel) : this( - parcel.readString() ?: "", - parcel.readString() ?: "", - parcel.readString() ?: "", - parcel.readString() ?: "", - parcel.readString() ?: "", - parcel.readString() ?: "", - parcel.readString() ?: "", - parcel.readBooleanCompat() - ) - - override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) { - writeString(login) - writeString(repoId) - writeString(path) - writeString(ref) - writeString(sha) - writeString(contentUrl) - writeString(fileName) - writeBooleanCompat(isEdit) - } - - companion object { - @JvmField val CREATOR = parcelableCreator(::EditRepoFileModel) - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/EditReviewCommentModel.java b/app/src/main/java/com/fastaccess/data/dao/EditReviewCommentModel.java deleted file mode 100644 index e5dde19bf..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/EditReviewCommentModel.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.google.gson.annotations.SerializedName; - -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Kosh on 22 May 2017, 8:36 PM - */ - -@Getter @Setter public class EditReviewCommentModel implements Parcelable { - - public int groupPosition; - public int commentPosition; - public String comment; - public ReviewCommentModel commentModel; - @SerializedName("in_reply_to") public long inReplyTo; - - - public EditReviewCommentModel() {} - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(this.groupPosition); - dest.writeInt(this.commentPosition); - dest.writeString(this.comment); - dest.writeParcelable(this.commentModel, flags); - dest.writeLong(this.inReplyTo); - } - - private EditReviewCommentModel(Parcel in) { - this.groupPosition = in.readInt(); - this.commentPosition = in.readInt(); - this.comment = in.readString(); - this.commentModel = in.readParcelable(ReviewCommentModel.class.getClassLoader()); - this.inReplyTo = in.readLong(); - } - - public static final Creator CREATOR = new Creator() { - @Override public EditReviewCommentModel createFromParcel(Parcel source) {return new EditReviewCommentModel(source);} - - @Override public EditReviewCommentModel[] newArray(int size) {return new EditReviewCommentModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/FilesListModel.java b/app/src/main/java/com/fastaccess/data/dao/FilesListModel.java deleted file mode 100644 index 1ce1106e1..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/FilesListModel.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import java.io.Serializable; - -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Kosh on 12 Nov 2016, 11:09 AM - */ - -@Getter @Setter -public class FilesListModel implements Parcelable, Serializable { - public String filename; - public String type; - public String rawUrl; - public Long size; - public String content; - public Boolean needFetching; - public String language; - - public FilesListModel() { - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.filename); - dest.writeString(this.type); - dest.writeString(this.rawUrl); - dest.writeValue(this.size); - dest.writeString(this.content); - dest.writeValue(this.needFetching); - dest.writeString(this.language); - } - - protected FilesListModel(Parcel in) { - this.filename = in.readString(); - this.type = in.readString(); - this.rawUrl = in.readString(); - this.size = (Long) in.readValue(Long.class.getClassLoader()); - this.content = in.readString(); - this.needFetching = (Boolean) in.readValue(Boolean.class.getClassLoader()); - this.language = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public FilesListModel createFromParcel(Parcel source) {return new FilesListModel(source);} - - @Override public FilesListModel[] newArray(int size) {return new FilesListModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/FilterOptionsModel.java b/app/src/main/java/com/fastaccess/data/dao/FilterOptionsModel.java deleted file mode 100644 index e74e41456..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/FilterOptionsModel.java +++ /dev/null @@ -1,174 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.annimon.stream.Stream; -import com.fastaccess.helper.InputHelper; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Serves a model for the filter in Repositories fragment - */ -public class FilterOptionsModel implements Parcelable { - - private static final String TYPE = "type"; - private static final String SORT = "sort"; - private static final String AFFILIATION = "affiliation"; - private static final String DIRECTION = "direction"; - - private String type; - private String sort = "Pushed"; - private String sortDirection = "descending"; - private Map queryMap; - private boolean isPersonalProfile; - - private List typesListForPersonalProfile = Stream.of("Select", "All", "Owner", "Public", "Private", "Member").toList(); - private List typesListForExternalProfile = Stream.of("Select", "All", "Owner", "Member").toList(); - private List typesListForOrganizationProfile = Stream.of("Select", "All", "Public", "Private", "Forks", "Sources", "Member").toList(); - private List sortOptionsList = Stream.of("Pushed", "Created", "Updated", "Full Name").toList(); - private List sortDirectionList = Stream.of("Descending", "Ascending").toList(); - private boolean isOrg; - - public FilterOptionsModel() { - } - - public void setType(String type) { - this.type = type; - } - - public void setSort(String sort) { - this.sort = sort; - } - - public void setSortDirection(String sortDirection) { - this.sortDirection = sortDirection; - } - - public Map getQueryMap() { - if (queryMap == null) { - queryMap = new HashMap<>(); - } else { - queryMap.clear(); - } - if (InputHelper.isEmpty(type) || "Select".equalsIgnoreCase(type)) { - queryMap.remove(TYPE); - queryMap.put(AFFILIATION, "owner,collaborator"); - } else { - queryMap.remove(AFFILIATION); - queryMap.put(TYPE, type.toLowerCase()); - } - //Not supported for organization repo - if (!isOrg) { - if (sort.contains(" ")) { - //full name should be full_name - queryMap.put(SORT, sort.replace(" ", "_").toLowerCase()); - } else { - queryMap.put(SORT, sort.toLowerCase()); - } - if (sortDirection.equals(sortDirectionList.get(0))) { - //Descending should be desc - queryMap.put(DIRECTION, sortDirection.toLowerCase().substring(0, 4)); - } else { - //Ascending should be asc - queryMap.put(DIRECTION, sortDirection.toLowerCase().substring(0, 3)); - } - } - return queryMap; - } - - public int getSelectedTypeIndex() { - if (isPersonalProfile) { - return typesListForPersonalProfile.indexOf(type); - } else { - return typesListForExternalProfile.indexOf(type); - } - } - - public int getSelectedSortOptionIndex() { - return sortOptionsList.indexOf(sort); - } - - public int getSelectedSortDirectionIndex() { - return sortDirectionList.indexOf(sortDirection); - } - - public List getTypesList() { - if (isPersonalProfile) { - return typesListForPersonalProfile; - } else if (isOrg) { - return typesListForOrganizationProfile; - } else { - return typesListForExternalProfile; - } - } - - public List getSortOptionList() { - return sortOptionsList; - } - - public List getSortDirectionList() { - return sortDirectionList; - } - - public void setIsPersonalProfile(boolean isPersonalProfile) { - this.isPersonalProfile = isPersonalProfile; - } - - public void setOrg(boolean org) { - this.isOrg = org; - } - - public boolean isOrg() { - return isOrg; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.type); - dest.writeString(this.sort); - dest.writeString(this.sortDirection); - dest.writeInt(this.queryMap.size()); - for (Map.Entry entry : this.queryMap.entrySet()) { - dest.writeString(entry.getKey()); - dest.writeString(entry.getValue()); - } - dest.writeByte(this.isPersonalProfile ? (byte) 1 : (byte) 0); - dest.writeStringList(this.typesListForPersonalProfile); - dest.writeStringList(this.typesListForExternalProfile); - dest.writeStringList(this.typesListForOrganizationProfile); - dest.writeStringList(this.sortOptionsList); - dest.writeStringList(this.sortDirectionList); - dest.writeByte(this.isOrg ? (byte) 1 : (byte) 0); - } - - private FilterOptionsModel(Parcel in) { - this.type = in.readString(); - this.sort = in.readString(); - this.sortDirection = in.readString(); - int queryMapSize = in.readInt(); - this.queryMap = new HashMap(queryMapSize); - for (int i = 0; i < queryMapSize; i++) { - String key = in.readString(); - String value = in.readString(); - this.queryMap.put(key, value); - } - this.isPersonalProfile = in.readByte() != 0; - this.typesListForPersonalProfile = in.createStringArrayList(); - this.typesListForExternalProfile = in.createStringArrayList(); - this.typesListForOrganizationProfile = in.createStringArrayList(); - this.sortOptionsList = in.createStringArrayList(); - this.sortDirectionList = in.createStringArrayList(); - this.isOrg = in.readByte() != 0; - } - - public static final Creator CREATOR = new Creator() { - @Override public FilterOptionsModel createFromParcel(Parcel source) {return new FilterOptionsModel(source);} - - @Override public FilterOptionsModel[] newArray(int size) {return new FilterOptionsModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/FragmentPagerAdapterModel.java b/app/src/main/java/com/fastaccess/data/dao/FragmentPagerAdapterModel.java deleted file mode 100644 index c945600fd..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/FragmentPagerAdapterModel.java +++ /dev/null @@ -1,294 +0,0 @@ -package com.fastaccess.data.dao; - -import android.content.Context; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; - -import com.annimon.stream.Collectors; -import com.annimon.stream.Stream; -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Commit; -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.data.dao.types.MyIssuesType; -import com.fastaccess.ui.modules.feeds.FeedsFragment; -import com.fastaccess.ui.modules.gists.GistsFragment; -import com.fastaccess.ui.modules.gists.gist.comments.GistCommentsFragment; -import com.fastaccess.ui.modules.gists.gist.files.GistFilesListFragment; -import com.fastaccess.ui.modules.gists.starred.StarredGistsFragment; -import com.fastaccess.ui.modules.main.drawer.AccountDrawerFragment; -import com.fastaccess.ui.modules.main.drawer.MainDrawerFragment; -import com.fastaccess.ui.modules.main.issues.MyIssuesFragment; -import com.fastaccess.ui.modules.main.pullrequests.MyPullRequestFragment; -import com.fastaccess.ui.modules.notification.all.AllNotificationsFragment; -import com.fastaccess.ui.modules.notification.fasthub.FastHubNotificationsFragment; -import com.fastaccess.ui.modules.notification.unread.UnreadNotificationsFragment; -import com.fastaccess.ui.modules.pinned.gist.PinnedGistFragment; -import com.fastaccess.ui.modules.pinned.issue.PinnedIssueFragment; -import com.fastaccess.ui.modules.pinned.pullrequest.PinnedPullRequestFragment; -import com.fastaccess.ui.modules.pinned.repo.PinnedReposFragment; -import com.fastaccess.ui.modules.profile.followers.ProfileFollowersFragment; -import com.fastaccess.ui.modules.profile.following.ProfileFollowingFragment; -import com.fastaccess.ui.modules.profile.gists.ProfileGistsFragment; -import com.fastaccess.ui.modules.profile.org.OrgProfileOverviewFragment; -import com.fastaccess.ui.modules.profile.org.members.OrgMembersFragment; -import com.fastaccess.ui.modules.profile.org.repos.OrgReposFragment; -import com.fastaccess.ui.modules.profile.org.teams.OrgTeamFragment; -import com.fastaccess.ui.modules.profile.org.teams.details.members.TeamMembersFragment; -import com.fastaccess.ui.modules.profile.org.teams.details.repos.TeamReposFragment; -import com.fastaccess.ui.modules.profile.overview.ProfileOverviewFragment; -import com.fastaccess.ui.modules.profile.repos.ProfileReposFragment; -import com.fastaccess.ui.modules.profile.starred.ProfileStarredFragment; -import com.fastaccess.ui.modules.repos.code.commit.RepoCommitsFragment; -import com.fastaccess.ui.modules.repos.code.commit.details.comments.CommitCommentsFragment; -import com.fastaccess.ui.modules.repos.code.commit.details.files.CommitFilesFragment; -import com.fastaccess.ui.modules.repos.code.contributors.RepoContributorsFragment; -import com.fastaccess.ui.modules.repos.code.files.paths.RepoFilePathFragment; -import com.fastaccess.ui.modules.repos.code.prettifier.ViewerFragment; -import com.fastaccess.ui.modules.repos.code.releases.RepoReleasesFragment; -import com.fastaccess.ui.modules.repos.extras.branches.BranchesFragment; -import com.fastaccess.ui.modules.repos.issues.issue.RepoClosedIssuesFragment; -import com.fastaccess.ui.modules.repos.issues.issue.RepoOpenedIssuesFragment; -import com.fastaccess.ui.modules.repos.issues.issue.details.timeline.IssueTimelineFragment; -import com.fastaccess.ui.modules.repos.projects.columns.ProjectColumnFragment; -import com.fastaccess.ui.modules.repos.projects.list.RepoProjectFragment; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.RepoPullRequestFragment; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.commits.PullRequestCommitsFragment; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.files.PullRequestFilesFragment; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.timeline.timeline.PullRequestTimelineFragment; -import com.fastaccess.ui.modules.search.code.SearchCodeFragment; -import com.fastaccess.ui.modules.search.issues.SearchIssuesFragment; -import com.fastaccess.ui.modules.search.repos.SearchReposFragment; -import com.fastaccess.ui.modules.search.users.SearchUsersFragment; -import com.fastaccess.ui.modules.theme.fragment.ThemeFragment; - -import java.util.List; - -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Kosh on 03 Dec 2016, 9:26 AM - */ - -@Getter @Setter public class FragmentPagerAdapterModel { - - String title; - Fragment fragment; - String key; - - private FragmentPagerAdapterModel(String title, Fragment fragment) { - this(title, fragment, null); - } - - public FragmentPagerAdapterModel(String title, Fragment fragment, String key) { - this.title = title; - this.fragment = fragment; - this.key = key; - } - - @NonNull public static List buildForProfile(@NonNull Context context, @NonNull String login) { - return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.overview), ProfileOverviewFragment.newInstance(login)), - new FragmentPagerAdapterModel(context.getString(R.string.feed), FeedsFragment.newInstance(login, false)), - new FragmentPagerAdapterModel(context.getString(R.string.repos), ProfileReposFragment.newInstance(login)), - new FragmentPagerAdapterModel(context.getString(R.string.starred), ProfileStarredFragment.newInstance(login)), - new FragmentPagerAdapterModel(context.getString(R.string.gists), ProfileGistsFragment.newInstance(login)), - new FragmentPagerAdapterModel(context.getString(R.string.followers), ProfileFollowersFragment.newInstance(login)), - new FragmentPagerAdapterModel(context.getString(R.string.following), ProfileFollowingFragment.newInstance(login))) - .collect(Collectors.toList()); - } - - @NonNull public static List buildForRepoCode(@NonNull Context context, @NonNull String repoId, - @NonNull String login, @NonNull String url, - @NonNull String defaultBranch, - @NonNull String htmlUrl) { - return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.readme), ViewerFragment.newInstance(url, htmlUrl, true)), - new FragmentPagerAdapterModel(context.getString(R.string.files), RepoFilePathFragment.newInstance(login, repoId, null, - defaultBranch)), - new FragmentPagerAdapterModel(context.getString(R.string.commits), RepoCommitsFragment.newInstance(repoId, login, defaultBranch)), - new FragmentPagerAdapterModel(context.getString(R.string.releases), RepoReleasesFragment.newInstance(repoId, login)), - new FragmentPagerAdapterModel(context.getString(R.string.contributors), RepoContributorsFragment.newInstance(repoId, login))) - .collect(Collectors.toList()); - } - - @NonNull public static List buildForSearch(@NonNull Context context) { - return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.repos), SearchReposFragment.newInstance()), - new FragmentPagerAdapterModel(context.getString(R.string.users), SearchUsersFragment.newInstance()), - new FragmentPagerAdapterModel(context.getString(R.string.issues), SearchIssuesFragment.newInstance()), - new FragmentPagerAdapterModel(context.getString(R.string.code), SearchCodeFragment.newInstance())) - .collect(Collectors.toList()); - } - - @NonNull public static List buildForIssues(@NonNull Context context, long commentId) { - return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.details), IssueTimelineFragment.newInstance(commentId))) - .collect(Collectors.toList()); - } - - - @NonNull public static List buildForPullRequest(@NonNull Context context, @NonNull PullRequest pullRequest) { - String login = pullRequest.getLogin(); - String repoId = pullRequest.getRepoId(); - int number = pullRequest.getNumber(); - return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.details), PullRequestTimelineFragment.newInstance()), - new FragmentPagerAdapterModel(context.getString(R.string.commits), PullRequestCommitsFragment.newInstance(repoId, login, number)), - new FragmentPagerAdapterModel(context.getString(R.string.files), PullRequestFilesFragment.newInstance(repoId, login, number))) - .collect(Collectors.toList()); - } - - - @NonNull public static List buildForRepoIssue(@NonNull Context context, @NonNull String login, - @NonNull String repoId) { - return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.opened), - RepoOpenedIssuesFragment.newInstance(repoId, login)), - new FragmentPagerAdapterModel(context.getString(R.string.closed), - RepoClosedIssuesFragment.newInstance(repoId, login))) - .collect(Collectors.toList()); - } - - @NonNull public static List buildForRepoPullRequest(@NonNull Context context, @NonNull String login, - @NonNull String repoId) { - return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.opened), - RepoPullRequestFragment.newInstance(repoId, login, IssueState.open)), - new FragmentPagerAdapterModel(context.getString(R.string.closed), - RepoPullRequestFragment.newInstance(repoId, login, IssueState.closed))) - .collect(Collectors.toList()); - } - - @NonNull public static List buildForCommit(@NonNull Context context, @NonNull Commit commitModel) { - String login = commitModel.getLogin(); - String repoId = commitModel.getRepoId(); - String sha = commitModel.getSha(); - return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.files), - CommitFilesFragment.newInstance(commitModel.getSha(), commitModel.getFiles())), - new FragmentPagerAdapterModel(context.getString(R.string.comments), - CommitCommentsFragment.newInstance(login, repoId, sha))) - .collect(Collectors.toList()); - } - - @NonNull public static List buildForGist(@NonNull Context context, @NonNull Gist gistsModel) { - return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.files), GistFilesListFragment.newInstance(gistsModel - .getFilesAsList(), false)), - new FragmentPagerAdapterModel(context.getString(R.string.comments), GistCommentsFragment.newInstance(gistsModel.getGistId()))) - .collect(Collectors.toList()); - } - - @NonNull public static List buildForNotifications(@NonNull Context context) { - return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.unread), new UnreadNotificationsFragment()), - new FragmentPagerAdapterModel(context.getString(R.string.all), AllNotificationsFragment.newInstance()), - new FragmentPagerAdapterModel(context.getString(R.string.app_name), new FastHubNotificationsFragment())) - .collect(Collectors.toList()); - } - - @NonNull public static List buildForGists(@NonNull Context context) { - return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.my_gists), ProfileGistsFragment - .newInstance(Login.getUser().getLogin())), - new FragmentPagerAdapterModel(context.getString(R.string.starred), StarredGistsFragment.newInstance()), - new FragmentPagerAdapterModel(context.getString(R.string.public_gists), GistsFragment.newInstance())) - .collect(Collectors.toList()); - } - - @NonNull public static List buildForMyIssues(@NonNull Context context) { - return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.created), - MyIssuesFragment.newInstance(IssueState.open, MyIssuesType.CREATED)), - new FragmentPagerAdapterModel(context.getString(R.string.assigned), - MyIssuesFragment.newInstance(IssueState.open, MyIssuesType.ASSIGNED)), - new FragmentPagerAdapterModel(context.getString(R.string.mentioned), - MyIssuesFragment.newInstance(IssueState.open, MyIssuesType.MENTIONED)), - new FragmentPagerAdapterModel(context.getString(R.string.participated), - MyIssuesFragment.newInstance(IssueState.open, MyIssuesType.PARTICIPATED))) - .collect(Collectors.toList()); - } - - @NonNull public static List buildForMyPulls(@NonNull Context context) { - return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.created), - MyPullRequestFragment.newInstance(IssueState.open, MyIssuesType.CREATED)), - new FragmentPagerAdapterModel(context.getString(R.string.assigned), - MyPullRequestFragment.newInstance(IssueState.open, MyIssuesType.ASSIGNED)), - new FragmentPagerAdapterModel(context.getString(R.string.mentioned), - MyPullRequestFragment.newInstance(IssueState.open, MyIssuesType.MENTIONED)), - new FragmentPagerAdapterModel(context.getString(R.string.review_requests), - MyPullRequestFragment.newInstance(IssueState.open, MyIssuesType.REVIEW))) - .collect(Collectors.toList()); - } - - @NonNull public static List buildForOrg(@NonNull Context context, @NonNull String login, boolean isMember) { - return Stream.of( - new FragmentPagerAdapterModel(context.getString(R.string.feeds), - isMember ? FeedsFragment.newInstance(login, true) : null), - new FragmentPagerAdapterModel(context.getString(R.string.overview), OrgProfileOverviewFragment.newInstance(login)), - new FragmentPagerAdapterModel(context.getString(R.string.repos), OrgReposFragment.newInstance(login)), - new FragmentPagerAdapterModel(context.getString(R.string.people), OrgMembersFragment.newInstance(login)), - new FragmentPagerAdapterModel(context.getString(R.string.teams), isMember ? OrgTeamFragment.newInstance(login) : null)) - .filter(fragmentPagerAdapterModel -> fragmentPagerAdapterModel.getFragment() != null) - .collect(Collectors.toList()); - } - - @NonNull public static List buildForTeam(@NonNull Context context, long id) { - return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.members), TeamMembersFragment.newInstance(id)), - new FragmentPagerAdapterModel(context.getString(R.string.repos), TeamReposFragment.newInstance(id))) - .collect(Collectors.toList()); - } - - @NonNull public static List buildForTheme() { - return Stream.of(new FragmentPagerAdapterModel("", ThemeFragment.Companion.newInstance(R.style.ThemeLight)), - new FragmentPagerAdapterModel("", ThemeFragment.Companion.newInstance(R.style.ThemeDark)), - new FragmentPagerAdapterModel("", ThemeFragment.Companion.newInstance(R.style.ThemeAmlod)), - new FragmentPagerAdapterModel("", ThemeFragment.Companion.newInstance(R.style.ThemeBluish))) -// new FragmentPagerAdapterModel("", ThemeFragment.Companion.newInstance(R.style.ThemeMidnight))) - .collect(Collectors.toList()); - } - - @NonNull public static List buildForBranches(@NonNull Context context, @NonNull String repoId, @NonNull String login) { - return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.branches), - BranchesFragment.Companion.newInstance(login, repoId, true)), - new FragmentPagerAdapterModel(context.getString(R.string.tags), - BranchesFragment.Companion.newInstance(login, repoId, false))) - .toList(); - } - - @NonNull public static List buildForRepoProjects(@NonNull Context context, @Nullable String repoId, - @NonNull String login) { - return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.open), - RepoProjectFragment.Companion.newInstance(login, repoId, IssueState.open)), - new FragmentPagerAdapterModel(context.getString(R.string.closed), - RepoProjectFragment.Companion.newInstance(login, repoId, IssueState.closed))) - .toList(); - } - - @NonNull public static List buildForProjectColumns(@NonNull List models, boolean isCollaborator) { - return Stream.of(models) - .map(projectColumnModel -> new FragmentPagerAdapterModel("", ProjectColumnFragment.Companion - .newInstance(projectColumnModel, isCollaborator), String.valueOf(projectColumnModel.getId()))) - .toList(); - } - - @NonNull public static List buildForPinned(@NonNull Context context) { - return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.repos), PinnedReposFragment.newInstance()), - new FragmentPagerAdapterModel(context.getString(R.string.issues), PinnedIssueFragment.newInstance()), - new FragmentPagerAdapterModel(context.getString(R.string.pull_requests), PinnedPullRequestFragment.newInstance()), - new FragmentPagerAdapterModel(context.getString(R.string.gists), PinnedGistFragment.newInstance())) - .collect(Collectors.toList()); - } - - @NonNull public static List buildForDrawer(@NonNull Context context) { - return Stream.of(new FragmentPagerAdapterModel(context.getString(R.string.menu_label), new MainDrawerFragment()), - new FragmentPagerAdapterModel(context.getString(R.string.profile), new AccountDrawerFragment())) - .toList(); - } - - @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - FragmentPagerAdapterModel that = (FragmentPagerAdapterModel) o; - - return key != null ? key.equals(that.key) : that.key == null; - } - - @Override public int hashCode() { - return key != null ? key.hashCode() : 0; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/GistHubErrorsModel.java b/app/src/main/java/com/fastaccess/data/dao/GistHubErrorsModel.java deleted file mode 100644 index 6111e8478..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/GistHubErrorsModel.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.fastaccess.data.dao; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 18 Feb 2017, 2:10 PM - */ - -@Getter @Setter @NoArgsConstructor class GistHubErrorsModel { - private String resource; - private String field; - private String code; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/GitCommitListModel.java b/app/src/main/java/com/fastaccess/data/dao/GitCommitListModel.java deleted file mode 100644 index 99827b7d3..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/GitCommitListModel.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fastaccess.data.dao; - -import java.util.ArrayList; - -/** - * Created by Kosh on 12 Feb 2017, 12:14 AM - */ - -public class GitCommitListModel extends ArrayList {} diff --git a/app/src/main/java/com/fastaccess/data/dao/GitCommitModel.java b/app/src/main/java/com/fastaccess/data/dao/GitCommitModel.java deleted file mode 100644 index 61dd15767..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/GitCommitModel.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.data.dao.model.User; -import com.google.gson.annotations.SerializedName; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 08 Dec 2016, 8:59 PM - */ - -@Getter @Setter @NoArgsConstructor -public class GitCommitModel implements Parcelable { - - public String sha; - public String url; - public String message; - public User author; - public User committer; - public User tree; - public @SerializedName("distinct") boolean distincted; - public GitCommitListModel parents; - public int commentCount; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.sha); - dest.writeString(this.url); - dest.writeString(this.message); - dest.writeParcelable(this.author, flags); - dest.writeParcelable(this.committer, flags); - dest.writeParcelable(this.tree, flags); - dest.writeByte(this.distincted ? (byte) 1 : (byte) 0); - dest.writeList(this.parents); - dest.writeInt(this.commentCount); - } - - protected GitCommitModel(Parcel in) { - this.sha = in.readString(); - this.url = in.readString(); - this.message = in.readString(); - this.author = in.readParcelable(User.class.getClassLoader()); - this.committer = in.readParcelable(User.class.getClassLoader()); - this.tree = in.readParcelable(User.class.getClassLoader()); - this.distincted = in.readByte() != 0; - this.parents = new GitCommitListModel(); - in.readList(this.parents, this.parents.getClass().getClassLoader()); - this.commentCount = in.readInt(); - } - - public static final Creator CREATOR = new Creator() { - @Override public GitCommitModel createFromParcel(Parcel source) {return new GitCommitModel(source);} - - @Override public GitCommitModel[] newArray(int size) {return new GitCommitModel[size];} - }; - - @Override public String toString() { - if (message != null) { - return (sha != null && sha.length() > 7 ? sha.substring(0, 7) + " - " : "") + message.split(System.lineSeparator())[0]; - } else if (sha != null && sha.length() > 10) { - return sha.substring(0, 10); - } - return "N/A"; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/GitHubErrorResponse.java b/app/src/main/java/com/fastaccess/data/dao/GitHubErrorResponse.java deleted file mode 100644 index cbe1c5b8e..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/GitHubErrorResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.fastaccess.data.dao; - -import java.util.List; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 18 Feb 2017, 2:09 PM - */ - -@Getter @Setter @NoArgsConstructor -public class GitHubErrorResponse { - private String message; - private String documentation_url; - private List errors; - - @Override public String toString() { - return "GitHubErrorResponse{" + - "message='" + message + '\'' + - ", documentation_url='" + documentation_url + '\'' + - ", errors=" + errors + - '}'; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/GithubFileModel.java b/app/src/main/java/com/fastaccess/data/dao/GithubFileModel.java deleted file mode 100644 index b3d5a06fa..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/GithubFileModel.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.fastaccess.data.dao; - -import java.io.Serializable; -import java.util.HashMap; - -/** - * Created by Kosh on 10 Feb 2017, 9:46 PM - */ - - -public class GithubFileModel extends HashMap implements Serializable {} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/data/dao/GithubState.java b/app/src/main/java/com/fastaccess/data/dao/GithubState.java deleted file mode 100644 index 31020150f..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/GithubState.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 08 Dec 2016, 8:57 PM - */ - -@Getter @Setter @NoArgsConstructor -public class GithubState implements Parcelable { - private int additions; - private int deletions; - private int total; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(this.additions); - dest.writeInt(this.deletions); - dest.writeInt(this.total); - } - - protected GithubState(Parcel in) { - this.additions = in.readInt(); - this.deletions = in.readInt(); - this.total = in.readInt(); - } - - public static final Creator CREATOR = new Creator() { - @Override public GithubState createFromParcel(Parcel source) {return new GithubState(source);} - - @Override public GithubState[] newArray(int size) {return new GithubState[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/GroupedNotificationModel.java b/app/src/main/java/com/fastaccess/data/dao/GroupedNotificationModel.java deleted file mode 100644 index 7517823a1..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/GroupedNotificationModel.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.fastaccess.data.dao; - -import androidx.annotation.Nullable; - -import com.annimon.stream.Collectors; -import com.annimon.stream.Stream; -import com.fastaccess.data.dao.model.Notification; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.helper.InputHelper; - -import java.util.ArrayList; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import lombok.Getter; -import lombok.NonNull; -import lombok.Setter; - -import static com.annimon.stream.Collectors.toList; - -/** - * Created by Kosh on 18 Apr 2017, 8:07 PM - */ - -@Getter @Setter public class GroupedNotificationModel { - public static final int HEADER = 1; - public static final int ROW = 2; - - private int type; - private Repo repo; - private Notification notification; - private Date date; - - private GroupedNotificationModel(Repo repo) { - this.type = HEADER; - this.repo = repo; - } - - public GroupedNotificationModel(Notification notification) { - this.type = ROW; - this.notification = notification; - this.date = notification.getUpdatedAt(); - } - - @NonNull public static List construct(@Nullable List items) { - List models = new ArrayList<>(); - if (items == null || items.isEmpty()) return models; - Map> grouped = Stream.of(items) - .filter(value -> !value.isUnread()) - .collect(Collectors.groupingBy(Notification::getRepository, LinkedHashMap::new, - Collectors.mapping(o -> o, toList()))); - Stream.of(grouped) - .filter(repoListEntry -> repoListEntry.getValue() != null && !repoListEntry.getValue().isEmpty()) - .forEach(repoListEntry -> { - Repo repo = repoListEntry.getKey(); - List notifications = repoListEntry.getValue(); - models.add(new GroupedNotificationModel(repo)); - Stream.of(notifications) - .sorted((o1, o2) -> o2.getUpdatedAt().compareTo(o1.getUpdatedAt())) - .forEach(notification -> models.add(new GroupedNotificationModel(notification))); - }); - return models; - } - - @NonNull public static List onlyNotifications(@Nullable List items) { - if (items == null || items.isEmpty()) return new ArrayList<>(); - return Stream.of(items) - .map(GroupedNotificationModel::new) - .collect(Collectors.toList()); - } - - @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - GroupedNotificationModel model = (GroupedNotificationModel) o; - return notification != null && model.getNotification() != null && notification.getId() == (model.notification.getId()); - } - - @Override public int hashCode() { - return notification != null ? InputHelper.getSafeIntId(notification.getId()) : 0; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/GroupedReviewModel.java b/app/src/main/java/com/fastaccess/data/dao/GroupedReviewModel.java deleted file mode 100644 index 583c89a46..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/GroupedReviewModel.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import java.util.Date; -import java.util.List; - -/** - * Created by Kosh on 07 May 2017, 5:08 PM - */ - -public class GroupedReviewModel implements Parcelable { - - private int position; //to group with! - private String diffText; - private Date date; - private String path; - private long id; - private List comments; - - public GroupedReviewModel() {} - - public int getPosition() { - return position; - } - - public void setPosition(int position) { - this.position = position; - } - - public String getDiffText() { - return diffText; - } - - public void setDiffText(String diffText) { - this.diffText = diffText; - } - - public Date getDate() { - return date; - } - - public void setDate(Date date) { - this.date = date; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public List getComments() { - return comments; - } - - public void setComments(List comments) { - this.comments = comments; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(this.position); - dest.writeString(this.diffText); - dest.writeLong(this.date != null ? this.date.getTime() : -1); - dest.writeString(this.path); - dest.writeLong(this.id); - dest.writeTypedList(this.comments); - } - - private GroupedReviewModel(Parcel in) { - this.position = in.readInt(); - this.diffText = in.readString(); - long tmpDate = in.readLong(); - this.date = tmpDate == -1 ? null : new Date(tmpDate); - this.path = in.readString(); - this.id = in.readLong(); - this.comments = in.createTypedArrayList(ReviewCommentModel.CREATOR); - } - - public static final Creator CREATOR = new Creator() { - @Override public GroupedReviewModel createFromParcel(Parcel source) {return new GroupedReviewModel(source);} - - @Override public GroupedReviewModel[] newArray(int size) {return new GroupedReviewModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/ImgurReponseModel.java b/app/src/main/java/com/fastaccess/data/dao/ImgurReponseModel.java deleted file mode 100644 index bd8d66e33..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/ImgurReponseModel.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Kosh on 15 Apr 2017, 8:09 PM - */ - -@Getter @Setter public class ImgurReponseModel implements Parcelable { - private boolean success; - private int status; - private ImgurImage data; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeByte(this.success ? (byte) 1 : (byte) 0); - dest.writeInt(this.status); - dest.writeParcelable(this.data, flags); - } - - public ImgurReponseModel() {} - - private ImgurReponseModel(Parcel in) { - this.success = in.readByte() != 0; - this.status = in.readInt(); - this.data = in.readParcelable(ImgurImage.class.getClassLoader()); - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override public ImgurReponseModel createFromParcel(Parcel source) {return new ImgurReponseModel(source);} - - @Override public ImgurReponseModel[] newArray(int size) {return new ImgurReponseModel[size];} - }; - - @Getter @Setter public static class ImgurImage implements Parcelable { - private String title; - private String description; - private String link; - - public ImgurImage() {} - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.title); - dest.writeString(this.description); - dest.writeString(this.link); - } - - private ImgurImage(Parcel in) { - this.title = in.readString(); - this.description = in.readString(); - this.link = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public ImgurImage createFromParcel(Parcel source) {return new ImgurImage(source);} - - @Override public ImgurImage[] newArray(int size) {return new ImgurImage[size];} - }; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/IssueEventAdapterModel.java b/app/src/main/java/com/fastaccess/data/dao/IssueEventAdapterModel.java deleted file mode 100644 index 37e812862..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/IssueEventAdapterModel.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.Nullable; - -import com.annimon.stream.Stream; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.IssueEvent; - -import java.util.ArrayList; -import java.util.List; - -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Kosh on 10 Dec 2016, 3:34 PM - */ - -@Getter @Setter -public class IssueEventAdapterModel implements Parcelable { - - public static final int HEADER = 1; - public static final int ROW = 2; - private int type; - - private IssueEvent issueEvent; - private Issue issueModel; - - private IssueEventAdapterModel(int type, IssueEvent model) { - this.type = type; - this.issueEvent = model; - } - - public IssueEventAdapterModel(int type, Issue issueModel) { - this.type = type; - this.issueModel = issueModel; - } - - public static ArrayList addEvents(@Nullable List modelList) { - ArrayList models = new ArrayList<>(); - if (modelList == null || modelList.isEmpty()) return models; - Stream.of(modelList).forEach(issueEventModel -> models.add(new IssueEventAdapterModel(ROW, issueEventModel))); - return models; - } - - public IssueEventAdapterModel() {} - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(this.type); - dest.writeParcelable(this.issueEvent, flags); - dest.writeParcelable(this.issueModel, flags); - } - - private IssueEventAdapterModel(Parcel in) { - this.type = in.readInt(); - this.issueEvent = in.readParcelable(IssueEvent.class.getClassLoader()); - this.issueModel = in.readParcelable(Issue.class.getClassLoader()); - } - - public static final Creator CREATOR = new Creator() { - @Override public IssueEventAdapterModel createFromParcel(Parcel source) {return new IssueEventAdapterModel(source);} - - @Override public IssueEventAdapterModel[] newArray(int size) {return new IssueEventAdapterModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/IssueRequestModel.java b/app/src/main/java/com/fastaccess/data/dao/IssueRequestModel.java deleted file mode 100644 index 7ed7449fb..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/IssueRequestModel.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; - -import com.annimon.stream.Collectors; -import com.annimon.stream.Stream; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.types.IssueState; - -import java.util.List; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 10 Dec 2016, 8:53 AM - */ - -@Getter @Setter @NoArgsConstructor -public class IssueRequestModel implements Parcelable { - - private IssueState state; - private String title; - private String body; - private Integer milestone; - private String assignee; - private List labels; - private String base; - - public static IssueRequestModel clone(@NonNull Issue issue, boolean toClose) { - IssueRequestModel model = new IssueRequestModel(); - if (issue.getLabels() != null) { - model.setLabels(Stream.of(issue.getLabels()).filter(value -> value.getName() != null) - .map(LabelModel::getName).collect(Collectors.toList())); - } - model.setAssignee(issue.getAssignee() != null ? issue.getAssignee().getLogin() : null); - model.setBody(issue.getBody()); - model.setMilestone(issue.getMilestone() != null ? issue.getMilestone().getNumber() : null); - model.setState(toClose ? issue.getState() == IssueState.closed ? IssueState.open : IssueState.closed : issue.getState()); - model.setTitle(issue.getTitle()); - return model; - } - - public static IssueRequestModel clone(@NonNull PullRequest issue, boolean toClose) { - IssueRequestModel model = new IssueRequestModel(); - if (issue.getLabels() != null) { - model.setLabels(Stream.of(issue.getLabels()).filter(value -> value.getName() != null) - .map(LabelModel::getName).collect(Collectors.toList())); - } - model.setBase(issue.getBase() != null ? issue.getBase().getRef() : "master"); - model.setAssignee(issue.getAssignee() != null ? issue.getAssignee().getLogin() : null); - model.setBody(issue.getBody()); - model.setMilestone(issue.getMilestone() != null ? issue.getMilestone().getNumber() : null); - model.setState(toClose ? issue.getState() == IssueState.closed ? IssueState.open : IssueState.closed : issue.getState()); - model.setTitle(issue.getTitle()); - return model; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(this.state == null ? -1 : this.state.ordinal()); - dest.writeString(this.title); - dest.writeString(this.body); - dest.writeValue(this.milestone); - dest.writeString(this.assignee); - dest.writeStringList(this.labels); - } - - private IssueRequestModel(Parcel in) { - int tmpState = in.readInt(); - this.state = tmpState == -1 ? null : IssueState.values()[tmpState]; - this.title = in.readString(); - this.body = in.readString(); - this.milestone = (Integer) in.readValue(Integer.class.getClassLoader()); - this.assignee = in.readString(); - this.labels = in.createStringArrayList(); - } - - public static final Creator CREATOR = new Creator() { - @Override public IssueRequestModel createFromParcel(Parcel source) {return new IssueRequestModel(source);} - - @Override public IssueRequestModel[] newArray(int size) {return new IssueRequestModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/IssuesPageable.java b/app/src/main/java/com/fastaccess/data/dao/IssuesPageable.java deleted file mode 100644 index 99e8b3652..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/IssuesPageable.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import java.util.List; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 15 Nov 2016, 7:04 PM - */ - - -@Getter @Setter @NoArgsConstructor -public class IssuesPageable implements Parcelable { - - public int first; - public int next; - public int prev; - public int last; - public int totalCount; - public boolean incompleteResults; - public List items; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(this.first); - dest.writeInt(this.next); - dest.writeInt(this.prev); - dest.writeInt(this.last); - dest.writeInt(this.totalCount); - dest.writeByte(this.incompleteResults ? (byte) 1 : (byte) 0); - } - - @SuppressWarnings("WeakerAccess") protected IssuesPageable(Parcel in) { - this.first = in.readInt(); - this.next = in.readInt(); - this.prev = in.readInt(); - this.last = in.readInt(); - this.totalCount = in.readInt(); - this.incompleteResults = in.readByte() != 0; - } - - public static final Creator CREATOR = new Creator() { - @Override public IssuesPageable createFromParcel(Parcel source) {return new IssuesPageable(source);} - - @Override public IssuesPageable[] newArray(int size) {return new IssuesPageable[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/LabelListModel.java b/app/src/main/java/com/fastaccess/data/dao/LabelListModel.java deleted file mode 100644 index 77ee5a82a..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/LabelListModel.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fastaccess.data.dao; - -import java.util.ArrayList; - -/** - * Created by Kosh on 12 Feb 2017, 1:32 PM - */ - -public class LabelListModel extends ArrayList {} diff --git a/app/src/main/java/com/fastaccess/data/dao/LabelModel.java b/app/src/main/java/com/fastaccess/data/dao/LabelModel.java deleted file mode 100644 index 68c4068f3..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/LabelModel.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 08 Dec 2016, 9:05 PM - */ - -@Getter @Setter @NoArgsConstructor -public class LabelModel implements Parcelable { - String url; - String name; - String color; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.url); - dest.writeString(this.name); - dest.writeString(this.color); - } - - protected LabelModel(Parcel in) { - this.url = in.readString(); - this.name = in.readString(); - this.color = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public LabelModel createFromParcel(Parcel source) {return new LabelModel(source);} - - @Override public LabelModel[] newArray(int size) {return new LabelModel[size];} - }; - - @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - LabelModel that = (LabelModel) o; - - return name != null ? name.equals(that.name) : that.name == null; - } - - @Override public int hashCode() { - return name != null ? name.hashCode() : 0; - } - - @Override public String toString() { - return "LabelModel{" + - "url='" + url + '\'' + - ", name='" + name + '\'' + - ", color='" + color + '\'' + - '}'; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/LanguageColorModel.java b/app/src/main/java/com/fastaccess/data/dao/LanguageColorModel.java deleted file mode 100644 index 2f40fc9a6..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/LanguageColorModel.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -/** - * Created by Kosh on 27 May 2017, 9:47 PM - */ - -@Getter @Setter @ToString public class LanguageColorModel implements Parcelable { - public String color; - public String url; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.color); - dest.writeString(this.url); - } - - public LanguageColorModel() {} - - private LanguageColorModel(Parcel in) { - this.color = in.readString(); - this.url = in.readString(); - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override public LanguageColorModel createFromParcel(Parcel source) {return new LanguageColorModel(source);} - - @Override public LanguageColorModel[] newArray(int size) {return new LanguageColorModel[size];} - }; -} - diff --git a/app/src/main/java/com/fastaccess/data/dao/LicenseModel.java b/app/src/main/java/com/fastaccess/data/dao/LicenseModel.java deleted file mode 100644 index c6a555186..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/LicenseModel.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 01 Jan 2017, 1:15 PM - */ - -@Getter @Setter @NoArgsConstructor -public class LicenseModel implements Parcelable { - String key; - String name; - String spdxId; - String url; - boolean featured; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.key); - dest.writeString(this.name); - dest.writeString(this.spdxId); - dest.writeString(this.url); - dest.writeByte(this.featured ? (byte) 1 : (byte) 0); - } - - protected LicenseModel(Parcel in) { - this.key = in.readString(); - this.name = in.readString(); - this.spdxId = in.readString(); - this.url = in.readString(); - this.featured = in.readByte() != 0; - } - - public static final Creator CREATOR = new Creator() { - @Override public LicenseModel createFromParcel(Parcel source) {return new LicenseModel(source);} - - @Override public LicenseModel[] newArray(int size) {return new LicenseModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/LockIssuePrModel.java b/app/src/main/java/com/fastaccess/data/dao/LockIssuePrModel.java deleted file mode 100644 index 481788b3c..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/LockIssuePrModel.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.fastaccess.data.dao; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 10.02.18. - */ -@NoArgsConstructor @AllArgsConstructor @Getter @Setter public class LockIssuePrModel { - private boolean locked; - private String activeLockReason; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/MarkdownModel.java b/app/src/main/java/com/fastaccess/data/dao/MarkdownModel.java deleted file mode 100644 index b4c972814..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/MarkdownModel.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 18 Feb 2017, 7:20 PM - */ - -@Getter @Setter @NoArgsConstructor -public class MarkdownModel implements Parcelable { - private String text; - private String mode = "gfm"; - private String context; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.text); - dest.writeString(this.mode); - dest.writeString(this.context); - } - - @SuppressWarnings("WeakerAccess") protected MarkdownModel(Parcel in) { - this.text = in.readString(); - this.mode = in.readString(); - this.context = in.readString(); - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override public MarkdownModel createFromParcel(Parcel source) {return new MarkdownModel(source);} - - @Override public MarkdownModel[] newArray(int size) {return new MarkdownModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/MergeRequestModel.java b/app/src/main/java/com/fastaccess/data/dao/MergeRequestModel.java deleted file mode 100644 index 70120d55e..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/MergeRequestModel.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 16 Dec 2016, 11:42 PM - */ - -@Getter @Setter @NoArgsConstructor -public class MergeRequestModel implements Parcelable { - - private String commitMessage; - private String sha; - private String base; - private String head; - private String mergeMethod = "merge"; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.commitMessage); - dest.writeString(this.sha); - dest.writeString(this.base); - dest.writeString(this.head); - } - - @SuppressWarnings("WeakerAccess") protected MergeRequestModel(Parcel in) { - this.commitMessage = in.readString(); - this.sha = in.readString(); - this.base = in.readString(); - this.head = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public MergeRequestModel createFromParcel(Parcel source) {return new MergeRequestModel(source);} - - @Override public MergeRequestModel[] newArray(int size) {return new MergeRequestModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/MergeResponseModel.java b/app/src/main/java/com/fastaccess/data/dao/MergeResponseModel.java deleted file mode 100644 index 2c20c7b5c..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/MergeResponseModel.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 16 Dec 2016, 11:40 PM - */ - -@Getter @Setter @NoArgsConstructor -public class MergeResponseModel implements Parcelable { - - private String sha; - private boolean merged; - private String message; - private String documentationUrl; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.sha); - dest.writeByte(this.merged ? (byte) 1 : (byte) 0); - dest.writeString(this.message); - dest.writeString(this.documentationUrl); - } - - @SuppressWarnings("WeakerAccess") protected MergeResponseModel(Parcel in) { - this.sha = in.readString(); - this.merged = in.readByte() != 0; - this.message = in.readString(); - this.documentationUrl = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public MergeResponseModel createFromParcel(Parcel source) {return new MergeResponseModel(source);} - - @Override public MergeResponseModel[] newArray(int size) {return new MergeResponseModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/MilestoneModel.java b/app/src/main/java/com/fastaccess/data/dao/MilestoneModel.java deleted file mode 100644 index a774dbdea..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/MilestoneModel.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.data.dao.model.User; - -import java.util.Date; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 08 Dec 2016, 8:47 PM - */ - -@Getter @Setter @NoArgsConstructor -public class MilestoneModel implements Parcelable { - - long id; - String url; - String title; - String state; - String description; - int number; - User creator; - String htmlUr; - int openIssues; - int closedIssues; - Date createdAt; - Date updatedAt; - Date closedAt; - Date dueOn; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeString(this.url); - dest.writeString(this.title); - dest.writeString(this.state); - dest.writeString(this.description); - dest.writeInt(this.number); - dest.writeParcelable(this.creator, flags); - dest.writeString(this.htmlUr); - dest.writeInt(this.openIssues); - dest.writeInt(this.closedIssues); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1); - dest.writeLong(this.closedAt != null ? this.closedAt.getTime() : -1); - dest.writeLong(this.dueOn != null ? this.dueOn.getTime() : -1); - } - - protected MilestoneModel(Parcel in) { - this.id = in.readLong(); - this.url = in.readString(); - this.title = in.readString(); - this.state = in.readString(); - this.description = in.readString(); - this.number = in.readInt(); - this.creator = in.readParcelable(User.class.getClassLoader()); - this.htmlUr = in.readString(); - this.openIssues = in.readInt(); - this.closedIssues = in.readInt(); - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - long tmpUpdatedAt = in.readLong(); - this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt); - long tmpClosedAt = in.readLong(); - this.closedAt = tmpClosedAt == -1 ? null : new Date(tmpClosedAt); - long tmpDueOn = in.readLong(); - this.dueOn = tmpDueOn == -1 ? null : new Date(tmpDueOn); - } - - public static final Creator CREATOR = new Creator() { - @Override public MilestoneModel createFromParcel(Parcel source) {return new MilestoneModel(source);} - - @Override public MilestoneModel[] newArray(int size) {return new MilestoneModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/NameParser.java b/app/src/main/java/com/fastaccess/data/dao/NameParser.java deleted file mode 100644 index 4c25b006e..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/NameParser.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.fastaccess.data.dao; - -import android.net.Uri; -import androidx.annotation.Nullable; - -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.scheme.LinkParserHelper; - -import java.util.List; - -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Kosh on 11 Feb 2017, 11:03 PM - */ - -@Getter @Setter -public class NameParser { - - public String name; - public String username; - public boolean isEnterprise; - - public NameParser(@Nullable String url) { - if (!InputHelper.isEmpty(url)) { - boolean isEnterprise = LinkParserHelper.isEnterprise(url); - if (isEnterprise) { - url = url.replace("api/v3/", ""); - } - Uri uri = Uri.parse(url); - List segments = uri.getPathSegments(); - if (segments == null || segments.size() < 2) { - return; - } - boolean isFirstPathIsRepo = (segments.get(0).equalsIgnoreCase("repos") || segments.get(0).equalsIgnoreCase("repo")); - this.username = isFirstPathIsRepo ? segments.get(1) : segments.get(0); - this.name = isFirstPathIsRepo ? segments.get(2) : segments.get(1); - this.isEnterprise = isEnterprise; - } - } - - @Override public String toString() { - return "NameParser{" + - "name='" + name + '\'' + - ", username='" + username + '\'' + - '}'; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/NotificationSoundModel.kt b/app/src/main/java/com/fastaccess/data/dao/NotificationSoundModel.kt deleted file mode 100644 index fcb5b279e..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/NotificationSoundModel.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.fastaccess.data.dao - -import android.net.Uri - -/** - * Created by kosh on 23/07/2017. - */ -class NotificationSoundModel(val name: String? = null, val uri: Uri? = null, val isSelected: Boolean = false) \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/data/dao/NotificationSubjectModel.java b/app/src/main/java/com/fastaccess/data/dao/NotificationSubjectModel.java deleted file mode 100644 index e17e9eb7b..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/NotificationSubjectModel.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.data.dao.types.NotificationType; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 19 Feb 2017, 6:11 PM - */ - -@Getter @Setter @NoArgsConstructor -public class NotificationSubjectModel implements Parcelable { - String title; - String url; - NotificationType type; - String latestCommentUrl; - - @Override public String toString() { - return "NotificationSubjectModel{" + - ", title='" + title + '\'' + - ", url='" + url + '\'' + - ", type='" + type + '\'' + - ", latestCommentUrl='" + latestCommentUrl + '\'' + - '}'; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.title); - dest.writeString(this.url); - dest.writeInt(this.type == null ? -1 : this.type.ordinal()); - dest.writeString(this.latestCommentUrl); - } - - protected NotificationSubjectModel(Parcel in) { - this.title = in.readString(); - this.url = in.readString(); - int tmpType = in.readInt(); - this.type = tmpType == -1 ? null : NotificationType.values()[tmpType]; - this.latestCommentUrl = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public NotificationSubjectModel createFromParcel(Parcel source) {return new NotificationSubjectModel(source);} - - @Override public NotificationSubjectModel[] newArray(int size) {return new NotificationSubjectModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/NotificationSubscriptionBodyModel.java b/app/src/main/java/com/fastaccess/data/dao/NotificationSubscriptionBodyModel.java deleted file mode 100644 index a0f174763..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/NotificationSubscriptionBodyModel.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.fastaccess.data.dao; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Hashemsergani on 14.10.17. - */ - -@AllArgsConstructor @Getter @Setter public class NotificationSubscriptionBodyModel { - private Boolean subscribed; - private Boolean ignored; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/Pageable.java b/app/src/main/java/com/fastaccess/data/dao/Pageable.java deleted file mode 100644 index cbfafe6c6..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/Pageable.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import java.util.List; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 15 Nov 2016, 7:04 PM - */ - - -@Getter @Setter @NoArgsConstructor -public class Pageable implements Parcelable { - - public int first; - public int next; - public int prev; - public int last; - public int totalCount; - public boolean incompleteResults; - public List items; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(this.first); - dest.writeInt(this.next); - dest.writeInt(this.prev); - dest.writeInt(this.last); - dest.writeInt(this.totalCount); - dest.writeByte(this.incompleteResults ? (byte) 1 : (byte) 0); - dest.writeTypedList(this.items); - } - - @SuppressWarnings("WeakerAccess") protected Pageable(Parcel in) { - this.first = in.readInt(); - this.next = in.readInt(); - this.prev = in.readInt(); - this.last = in.readInt(); - this.totalCount = in.readInt(); - this.incompleteResults = in.readByte() != 0; - in.readList(this.items, this.items.getClass().getClassLoader()); - } - - public static final Creator CREATOR = new Creator() { - @Override public Pageable createFromParcel(Parcel source) {return new Pageable(source);} - - @Override public Pageable[] newArray(int size) {return new Pageable[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/PayloadModel.java b/app/src/main/java/com/fastaccess/data/dao/PayloadModel.java deleted file mode 100644 index e430ebe45..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/PayloadModel.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.Commit; -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.model.Release; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.data.dao.model.User; - -import java.util.List; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - - -/** - * Created by Kosh on 08 Feb 2017, 10:03 PM - */ - - -@Getter @Setter @NoArgsConstructor -public class PayloadModel implements Parcelable { - - public String action; - public Repo forkee; - public Issue issue; - public PullRequest pullRequest; - public String refType; - public Comment comment; - public User target; - public User member; - public TeamsModel team; - public Comment commitComment; - public String description; - public ReleasesAssetsModel download; - public Gist gist; - public List pages; - public String before; - public String head; - public String ref; - public int size; - public List commits; - public User user; - public Release release; - public User blockedUser; - public User organization; - public User invitation; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.action); - dest.writeParcelable(this.forkee, flags); - dest.writeParcelable(this.issue, flags); - dest.writeParcelable(this.pullRequest, flags); - dest.writeString(this.refType); - dest.writeParcelable(this.comment, flags); - dest.writeParcelable(this.target, flags); - dest.writeParcelable(this.member, flags); - dest.writeParcelable(this.team, flags); - dest.writeParcelable(this.commitComment, flags); - dest.writeString(this.description); - dest.writeParcelable(this.download, flags); - dest.writeParcelable(this.gist, flags); - dest.writeTypedList(this.pages); - dest.writeString(this.before); - dest.writeString(this.head); - dest.writeString(this.ref); - dest.writeInt(this.size); - dest.writeTypedList(this.commits); - dest.writeParcelable(this.user, flags); - dest.writeParcelable(this.release, flags); - dest.writeParcelable(this.blockedUser, flags); - dest.writeParcelable(this.organization, flags); - dest.writeParcelable(this.invitation, flags); - } - - protected PayloadModel(Parcel in) { - this.action = in.readString(); - this.forkee = in.readParcelable(Repo.class.getClassLoader()); - this.issue = in.readParcelable(Issue.class.getClassLoader()); - this.pullRequest = in.readParcelable(PullRequest.class.getClassLoader()); - this.refType = in.readString(); - this.comment = in.readParcelable(Comment.class.getClassLoader()); - this.target = in.readParcelable(User.class.getClassLoader()); - this.member = in.readParcelable(User.class.getClassLoader()); - this.team = in.readParcelable(TeamsModel.class.getClassLoader()); - this.commitComment = in.readParcelable(Comment.class.getClassLoader()); - this.description = in.readString(); - this.download = in.readParcelable(ReleasesAssetsModel.class.getClassLoader()); - this.gist = in.readParcelable(Gist.class.getClassLoader()); - this.pages = in.createTypedArrayList(WikiModel.CREATOR); - this.before = in.readString(); - this.head = in.readString(); - this.ref = in.readString(); - this.size = in.readInt(); - this.commits = in.createTypedArrayList(GitCommitModel.CREATOR); - this.user = in.readParcelable(User.class.getClassLoader()); - this.release = in.readParcelable(Release.class.getClassLoader()); - this.blockedUser = in.readParcelable(User.class.getClassLoader()); - this.organization = in.readParcelable(User.class.getClassLoader()); - this.invitation = in.readParcelable(User.class.getClassLoader()); - } - - public static final Creator CREATOR = new Creator() { - @Override public PayloadModel createFromParcel(Parcel source) {return new PayloadModel(source);} - - @Override public PayloadModel[] newArray(int size) {return new PayloadModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/PostReactionModel.java b/app/src/main/java/com/fastaccess/data/dao/PostReactionModel.java deleted file mode 100644 index 46f428e80..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/PostReactionModel.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 29 Mar 2017, 9:50 PM - */ - -@Getter @Setter @NoArgsConstructor @AllArgsConstructor public class PostReactionModel implements Parcelable { - - private String content; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) {dest.writeString(this.content);} - - private PostReactionModel(Parcel in) {this.content = in.readString();} - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override public PostReactionModel createFromParcel(Parcel source) {return new PostReactionModel(source);} - - @Override public PostReactionModel[] newArray(int size) {return new PostReactionModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/ProUsersModel.java b/app/src/main/java/com/fastaccess/data/dao/ProUsersModel.java deleted file mode 100644 index f39a58c1c..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/ProUsersModel.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -/** - * Created by Hashemsergani on 03.10.17. - */ - -public class ProUsersModel implements Parcelable { - private int count; - private boolean allowed; - private int type; - private boolean isBlocked; - - public int getCount() { return count;} - - public void setCount(int count) { this.count = count;} - - public boolean isAllowed() { return allowed;} - - public void setAllowed(boolean allowed) { this.allowed = allowed;} - - public int getType() { return type;} - - public void setType(int type) { this.type = type;} - - public boolean isBlocked() { - return isBlocked; - } - - public void setBlocked(boolean blocked) { - isBlocked = blocked; - } - - @Override public String toString() { - return "ProUsersModel{" + - ", count=" + count + - ", allowed=" + allowed + - ", type=" + type + - '}'; - } - - public ProUsersModel() {} - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(this.count); - dest.writeByte(this.allowed ? (byte) 1 : (byte) 0); - dest.writeInt(this.type); - dest.writeByte(this.isBlocked ? (byte) 1 : (byte) 0); - } - - protected ProUsersModel(Parcel in) { - this.count = in.readInt(); - this.allowed = in.readByte() != 0; - this.type = in.readInt(); - this.isBlocked = in.readByte() != 0; - } - - public static final Creator CREATOR = new Creator() { - @Override public ProUsersModel createFromParcel(Parcel source) {return new ProUsersModel(source);} - - @Override public ProUsersModel[] newArray(int size) {return new ProUsersModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/ProjectCardModel.java b/app/src/main/java/com/fastaccess/data/dao/ProjectCardModel.java deleted file mode 100644 index 0a5ec2fdc..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/ProjectCardModel.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.data.dao.model.User; - -import java.util.Date; - -/** - * Created by Hashemsergani on 11.09.17. - */ - -public class ProjectCardModel implements Parcelable { - private String url; - private String columnUrl; - private String contentUrl; - private Integer id; - private String note; - private User creator; - private Date createdAt; - private Date updatedAt; - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getColumnUrl() { - return columnUrl; - } - - public void setColumnUrl(String columnUrl) { - this.columnUrl = columnUrl; - } - - public String getContentUrl() { - return contentUrl; - } - - public void setContentUrl(String contentUrl) { - this.contentUrl = contentUrl; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getNote() { - return note; - } - - public void setNote(String note) { - this.note = note; - } - - public User getCreator() { - return creator; - } - - public void setCreator(User creator) { - this.creator = creator; - } - - public Date getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - } - - public Date getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(Date updatedAt) { - this.updatedAt = updatedAt; - } - - public ProjectCardModel() {} - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.url); - dest.writeString(this.columnUrl); - dest.writeString(this.contentUrl); - dest.writeValue(this.id); - dest.writeString(this.note); - dest.writeParcelable(this.creator, flags); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1); - } - - protected ProjectCardModel(Parcel in) { - this.url = in.readString(); - this.columnUrl = in.readString(); - this.contentUrl = in.readString(); - this.id = (Integer) in.readValue(Integer.class.getClassLoader()); - this.note = in.readString(); - this.creator = in.readParcelable(User.class.getClassLoader()); - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - long tmpUpdatedAt = in.readLong(); - this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt); - } - - public static final Creator CREATOR = new Creator() { - @Override public ProjectCardModel createFromParcel(Parcel source) {return new ProjectCardModel(source);} - - @Override public ProjectCardModel[] newArray(int size) {return new ProjectCardModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/ProjectColumnModel.java b/app/src/main/java/com/fastaccess/data/dao/ProjectColumnModel.java deleted file mode 100644 index c7f3515b3..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/ProjectColumnModel.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import java.util.Date; - -/** - * Created by Hashemsergani on 11.09.17. - */ - -public class ProjectColumnModel implements Parcelable { - - private Long id; - private String name; - private String url; - private String projectUrl; - private String cardsUrl; - private Date createdAt; - private Date updatedAt; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getProjectUrl() { - return projectUrl; - } - - public void setProjectUrl(String projectUrl) { - this.projectUrl = projectUrl; - } - - public String getCardsUrl() { - return cardsUrl; - } - - public void setCardsUrl(String cardsUrl) { - this.cardsUrl = cardsUrl; - } - - public Date getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - } - - public Date getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(Date updatedAt) { - this.updatedAt = updatedAt; - } - - public ProjectColumnModel() {} - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeValue(this.id); - dest.writeString(this.name); - dest.writeString(this.url); - dest.writeString(this.projectUrl); - dest.writeString(this.cardsUrl); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1); - } - - protected ProjectColumnModel(Parcel in) { - this.id = (Long) in.readValue(Long.class.getClassLoader()); - this.name = in.readString(); - this.url = in.readString(); - this.projectUrl = in.readString(); - this.cardsUrl = in.readString(); - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - long tmpUpdatedAt = in.readLong(); - this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt); - } - - public static final Creator CREATOR = new Creator() { - @Override public ProjectColumnModel createFromParcel(Parcel source) {return new ProjectColumnModel(source);} - - @Override public ProjectColumnModel[] newArray(int size) {return new ProjectColumnModel[size];} - }; - - @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ProjectColumnModel that = (ProjectColumnModel) o; - - return id != null ? id.equals(that.id) : that.id == null; - } - - @Override public int hashCode() { - return id != null ? id.hashCode() : 0; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/ProjectsModel.java b/app/src/main/java/com/fastaccess/data/dao/ProjectsModel.java deleted file mode 100644 index 92244fb61..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/ProjectsModel.java +++ /dev/null @@ -1,165 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.data.dao.model.User; - -import java.util.Date; - -/** - * Created by kosh on 09/09/2017. - */ - -public class ProjectsModel implements Parcelable { - private String ownerUrl; - private String url; - private String htmlUrl; - private String columnsUrl; - private long id; - private String name; - private String body; - private int number; - private String state; - private User creator; - private Date createdAt; - private Date updatedAt; - - public String getOwnerUrl() { - return ownerUrl; - } - - public void setOwnerUrl(String ownerUrl) { - this.ownerUrl = ownerUrl; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getHtmlUrl() { - return htmlUrl; - } - - public void setHtmlUrl(String htmlUrl) { - this.htmlUrl = htmlUrl; - } - - public String getColumnsUrl() { - return columnsUrl; - } - - public void setColumnsUrl(String columnsUrl) { - this.columnsUrl = columnsUrl; - } - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getBody() { - return body; - } - - public void setBody(String body) { - this.body = body; - } - - public int getNumber() { - return number; - } - - public void setNumber(int number) { - this.number = number; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public User getCreator() { - return creator; - } - - public void setCreator(User creator) { - this.creator = creator; - } - - public Date getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - } - - public Date getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(Date updatedAt) { - this.updatedAt = updatedAt; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.ownerUrl); - dest.writeString(this.url); - dest.writeString(this.htmlUrl); - dest.writeString(this.columnsUrl); - dest.writeLong(this.id); - dest.writeString(this.name); - dest.writeString(this.body); - dest.writeInt(this.number); - dest.writeString(this.state); - dest.writeParcelable(this.creator, flags); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1); - } - - public ProjectsModel() {} - - protected ProjectsModel(Parcel in) { - this.ownerUrl = in.readString(); - this.url = in.readString(); - this.htmlUrl = in.readString(); - this.columnsUrl = in.readString(); - this.id = in.readLong(); - this.name = in.readString(); - this.body = in.readString(); - this.number = in.readInt(); - this.state = in.readString(); - this.creator = in.readParcelable(User.class.getClassLoader()); - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - long tmpUpdatedAt = in.readLong(); - this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt); - } - - public static final Creator CREATOR = new Creator() { - @Override public ProjectsModel createFromParcel(Parcel source) {return new ProjectsModel(source);} - - @Override public ProjectsModel[] newArray(int size) {return new ProjectsModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/PullRequestAdapterModel.java b/app/src/main/java/com/fastaccess/data/dao/PullRequestAdapterModel.java deleted file mode 100644 index bd1d55868..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/PullRequestAdapterModel.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.Nullable; - -import com.annimon.stream.Stream; -import com.fastaccess.data.dao.model.IssueEvent; -import com.fastaccess.data.dao.model.PullRequest; - -import java.util.ArrayList; -import java.util.List; - -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Kosh on 10 Dec 2016, 3:34 PM - */ - -@Getter @Setter -public class PullRequestAdapterModel implements Parcelable { - - public static final int HEADER = 1; - public static final int ROW = 2; - private int type; - - private IssueEvent issueEvent; - private PullRequest pullRequest; - - private PullRequestAdapterModel(int type, IssueEvent model) { - this.type = type; - this.issueEvent = model; - } - - public PullRequestAdapterModel(int type, PullRequest pullRequest) { - this.type = type; - this.pullRequest = pullRequest; - } - - public static ArrayList addEvents(@Nullable List modelList) { - ArrayList models = new ArrayList<>(); - if (modelList == null || modelList.isEmpty()) return models; - Stream.of(modelList).forEach(issueEventModel -> models.add(new PullRequestAdapterModel(ROW, issueEventModel))); - return models; - } - - public PullRequestAdapterModel() {} - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(this.type); - dest.writeParcelable(this.issueEvent, flags); - dest.writeParcelable(this.pullRequest, flags); - } - - private PullRequestAdapterModel(Parcel in) { - this.type = in.readInt(); - this.issueEvent = in.readParcelable(IssueEvent.class.getClassLoader()); - this.pullRequest = in.readParcelable(PullRequest.class.getClassLoader()); - } - - public static final Creator CREATOR = new Creator() { - @Override public PullRequestAdapterModel createFromParcel(Parcel source) {return new PullRequestAdapterModel(source);} - - @Override public PullRequestAdapterModel[] newArray(int size) {return new PullRequestAdapterModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/PullRequestStatusModel.java b/app/src/main/java/com/fastaccess/data/dao/PullRequestStatusModel.java deleted file mode 100644 index f292280ae..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/PullRequestStatusModel.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.data.dao.types.StatusStateType; - -import java.util.Date; -import java.util.List; - -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Kosh on 10 Apr 2017, 3:15 AM - */ - -@Getter @Setter public class PullRequestStatusModel implements Parcelable { - - private StatusStateType state; - private String sha; - private int totalCount; - private List statuses; - private String commitUrl; - private String url; - private boolean mergable; - private Date createdAt; - private String mergeableState; - - public PullRequestStatusModel() {} - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(this.state == null ? -1 : this.state.ordinal()); - dest.writeString(this.sha); - dest.writeInt(this.totalCount); - dest.writeTypedList(this.statuses); - dest.writeString(this.commitUrl); - dest.writeString(this.url); - dest.writeByte(this.mergable ? (byte) 1 : (byte) 0); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeString(this.mergeableState); - } - - protected PullRequestStatusModel(Parcel in) { - int tmpState = in.readInt(); - this.state = tmpState == -1 ? null : StatusStateType.values()[tmpState]; - this.sha = in.readString(); - this.totalCount = in.readInt(); - this.statuses = in.createTypedArrayList(StatusesModel.CREATOR); - this.commitUrl = in.readString(); - this.url = in.readString(); - this.mergable = in.readByte() != 0; - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - this.mergeableState = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public PullRequestStatusModel createFromParcel(Parcel source) {return new PullRequestStatusModel(source);} - - @Override public PullRequestStatusModel[] newArray(int size) {return new PullRequestStatusModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/PullsIssuesParser.java b/app/src/main/java/com/fastaccess/data/dao/PullsIssuesParser.java deleted file mode 100644 index 6904db6e3..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/PullsIssuesParser.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.fastaccess.data.dao; - -import android.net.Uri; -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; - -import com.fastaccess.helper.InputHelper; - -import java.util.List; - -/** - * Created by Kosh on 17 Dec 2016, 12:17 AM - */ - -public class PullsIssuesParser implements Parcelable { - - private String login; - private String repoId; - private int number; - - public static PullsIssuesParser getForPullRequest(@NonNull String url) { - Uri uri = Uri.parse(url); - List segments = uri.getPathSegments(); - if (segments == null || segments.size() < 3) return null; - String owner = null; - String repo = null; - String number = null; - if (segments.size() > 3) { - if (("pull".equals(segments.get(2)) || "pulls".equals(segments.get(2)))) { - owner = segments.get(0); - repo = segments.get(1); - number = segments.get(3); - } else if (("pull".equals(segments.get(3)) || "pulls".equals(segments.get(3))) && segments.size() > 4) { - owner = segments.get(1); - repo = segments.get(2); - number = segments.get(4); - } else { - return null; - } - } - if (InputHelper.isEmpty(number)) return null; - int issueNumber; - try { - issueNumber = Integer.parseInt(number); - } catch (NumberFormatException nfe) { - return null; - } - if (issueNumber < 1) return null; - PullsIssuesParser model = new PullsIssuesParser(); - model.setLogin(owner); - model.setRepoId(repo); - model.setNumber(issueNumber); - return model; - } - - public static PullsIssuesParser getForIssue(@NonNull String url) { - Uri uri = Uri.parse(url); - List segments = uri.getPathSegments(); - if (segments == null || segments.size() < 3) return null; - String owner = null; - String repo = null; - String number = null; - if (segments.size() > 3) { - if (segments.get(2).equalsIgnoreCase("issues")) { - owner = segments.get(0); - repo = segments.get(1); - number = segments.get(3); - } else if (segments.get(3).equalsIgnoreCase("issues") && segments.size() > 4) { - owner = segments.get(1); - repo = segments.get(2); - number = segments.get(4); - } else { - return null; - } - } - if (InputHelper.isEmpty(number)) - return null; - int issueNumber; - try { - issueNumber = Integer.parseInt(number); - } catch (NumberFormatException nfe) { - return null; - } - if (issueNumber < 1) return null; - PullsIssuesParser model = new PullsIssuesParser(); - model.setLogin(owner); - model.setRepoId(repo); - model.setNumber(issueNumber); - return model; - } - - @Override public String toString() { - return "PullsIssuesParser{" + - "login='" + login + '\'' + - ", repoId='" + repoId + '\'' + - ", number=" + number + - '}'; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.login); - dest.writeString(this.repoId); - dest.writeInt(this.number); - } - - public String getLogin() { - return login; - } - - public void setLogin(String login) { - this.login = login; - } - - public String getRepoId() { - return repoId; - } - - public void setRepoId(String repoId) { - this.repoId = repoId; - } - - public int getNumber() { - return number; - } - - public void setNumber(int number) { - this.number = number; - } - - public PullsIssuesParser() {} - - protected PullsIssuesParser(Parcel in) { - this.login = in.readString(); - this.repoId = in.readString(); - this.number = in.readInt(); - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override public PullsIssuesParser createFromParcel(Parcel source) {return new PullsIssuesParser(source);} - - @Override public PullsIssuesParser[] newArray(int size) {return new PullsIssuesParser[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/ReactionsModel.java b/app/src/main/java/com/fastaccess/data/dao/ReactionsModel.java deleted file mode 100644 index ffcddd073..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/ReactionsModel.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.model.User; -import com.google.gson.annotations.SerializedName; - -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; - -import lombok.Getter; -import lombok.NonNull; -import lombok.Setter; -import github.PullRequestTimelineQuery; - -/** - * Created by Kosh on 28 Mar 2017, 9:15 PM - */ - -@Getter @Setter public class ReactionsModel implements Parcelable { - - public long id; - public String url; - public int total_count; - @SerializedName(value = "+1", alternate = "thumbs_up") public int plusOne; - @SerializedName(value = "-1", alternate = "thumbs_down") public int minusOne; - public int laugh; - public int hooray; - public int confused; - public int heart; - public int rocket; - public int eyes; - public String content; - public User user; - public boolean viewerHasReacted; - public boolean isCallingApi; - - public ReactionsModel() {} - - @NotNull @Override public String toString() { - return "ReactionsModel{" + - "id=" + id + - ", url='" + url + '\'' + - ", total_count=" + total_count + - ", plusOne=" + plusOne + - ", minusOne=" + minusOne + - ", laugh=" + laugh + - ", hooray=" + hooray + - ", confused=" + confused + - ", heart=" + heart + - ", rocket=" + rocket + - ", eyes=" + eyes + - '}'; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeString(this.url); - dest.writeInt(this.total_count); - dest.writeInt(this.plusOne); - dest.writeInt(this.minusOne); - dest.writeInt(this.laugh); - dest.writeInt(this.hooray); - dest.writeInt(this.confused); - dest.writeInt(this.heart); - dest.writeInt(this.rocket); - dest.writeInt(this.eyes); - dest.writeString(this.content); - dest.writeParcelable(this.user, flags); - dest.writeByte(this.isCallingApi ? (byte) 1 : (byte) 0); - } - - protected ReactionsModel(Parcel in) { - this.id = in.readLong(); - this.url = in.readString(); - this.total_count = in.readInt(); - this.plusOne = in.readInt(); - this.minusOne = in.readInt(); - this.laugh = in.readInt(); - this.hooray = in.readInt(); - this.confused = in.readInt(); - this.heart = in.readInt(); - this.rocket = in.readInt(); - this.eyes = in.readInt(); - this.content = in.readString(); - this.user = in.readParcelable(User.class.getClassLoader()); - this.isCallingApi = in.readByte() != 0; - } - - public static final Creator CREATOR = new Creator() { - @Override public ReactionsModel createFromParcel(Parcel source) {return new ReactionsModel(source);} - - @Override public ReactionsModel[] newArray(int size) {return new ReactionsModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/ReleasesAssetsListModel.java b/app/src/main/java/com/fastaccess/data/dao/ReleasesAssetsListModel.java deleted file mode 100644 index 439b1d0f7..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/ReleasesAssetsListModel.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fastaccess.data.dao; - -import java.util.ArrayList; - -/** - * Created by Kosh on 31 Dec 2016, 1:28 PM - */ - -public class ReleasesAssetsListModel extends ArrayList {} diff --git a/app/src/main/java/com/fastaccess/data/dao/ReleasesAssetsModel.java b/app/src/main/java/com/fastaccess/data/dao/ReleasesAssetsModel.java deleted file mode 100644 index 51beeabf8..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/ReleasesAssetsModel.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.data.dao.model.User; - -import java.util.Date; - -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Kosh on 31 Dec 2016, 1:28 PM - */ - -@Getter @Setter public class ReleasesAssetsModel implements Parcelable { - private String url; - private String browserDownloadUrl; - private long id; - private String name; - private String label; - private String state; - private String contentType; - private int size; - private int downloadCount; - private Date createdAt; - private Date updatedAt; - private User uploader; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.url); - dest.writeString(this.browserDownloadUrl); - dest.writeLong(this.id); - dest.writeString(this.name); - dest.writeString(this.label); - dest.writeString(this.state); - dest.writeString(this.contentType); - dest.writeInt(this.size); - dest.writeInt(this.downloadCount); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1); - dest.writeParcelable(this.uploader, flags); - } - - public ReleasesAssetsModel() {} - - @SuppressWarnings("WeakerAccess") protected ReleasesAssetsModel(Parcel in) { - this.url = in.readString(); - this.browserDownloadUrl = in.readString(); - this.id = in.readLong(); - this.name = in.readString(); - this.label = in.readString(); - this.state = in.readString(); - this.contentType = in.readString(); - this.size = in.readInt(); - this.downloadCount = in.readInt(); - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - long tmpUpdatedAt = in.readLong(); - this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt); - this.uploader = in.readParcelable(User.class.getClassLoader()); - } - - public static final Creator CREATOR = new Creator() { - @Override public ReleasesAssetsModel createFromParcel(Parcel source) {return new ReleasesAssetsModel(source);} - - @Override public ReleasesAssetsModel[] newArray(int size) {return new ReleasesAssetsModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/RenameModel.java b/app/src/main/java/com/fastaccess/data/dao/RenameModel.java deleted file mode 100644 index 4ef99e22a..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/RenameModel.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.google.gson.annotations.SerializedName; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 13 Dec 2016, 12:33 AM - */ - -@Getter @Setter @NoArgsConstructor -public class RenameModel implements Parcelable { - @SerializedName("from") String fromValue; - @SerializedName("to") String toValue; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.fromValue); - dest.writeString(this.toValue); - } - - protected RenameModel(Parcel in) { - this.fromValue = in.readString(); - this.toValue = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public RenameModel createFromParcel(Parcel source) {return new RenameModel(source);} - - @Override public RenameModel[] newArray(int size) {return new RenameModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/RepoPathsManager.java b/app/src/main/java/com/fastaccess/data/dao/RepoPathsManager.java deleted file mode 100644 index 5f1121860..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/RepoPathsManager.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.fastaccess.data.dao; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.model.RepoFile; - -import java.util.HashMap; -import java.util.List; - -import lombok.NoArgsConstructor; - -/** - * Created by Kosh on 03 Mar 2017, 10:43 PM - */ - -@NoArgsConstructor -public class RepoPathsManager { - private HashMap> files = new HashMap<>(); - - @Nullable public List getPaths(@NonNull String url, @NonNull String ref) { - return files.get(ref + "/" + url); - } - - public void setFiles(@NonNull String ref, @NonNull String path, @NonNull List paths) { - files.put(ref + "/" + path, paths); - } - - public void clear() { - files.clear(); - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/RepoPermissionsModel.java b/app/src/main/java/com/fastaccess/data/dao/RepoPermissionsModel.java deleted file mode 100644 index 1ae4679d8..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/RepoPermissionsModel.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 03 Dec 2016, 11:12 AM - */ - -@Getter @Setter @NoArgsConstructor -public class RepoPermissionsModel implements Parcelable { - - boolean admin; - boolean push; - boolean pull; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeByte(this.admin ? (byte) 1 : (byte) 0); - dest.writeByte(this.push ? (byte) 1 : (byte) 0); - dest.writeByte(this.pull ? (byte) 1 : (byte) 0); - } - - protected RepoPermissionsModel(Parcel in) { - this.admin = in.readByte() != 0; - this.push = in.readByte() != 0; - this.pull = in.readByte() != 0; - } - - public static final Creator CREATOR = new Creator() { - @Override public RepoPermissionsModel createFromParcel(Parcel source) {return new RepoPermissionsModel(source);} - - @Override public RepoPermissionsModel[] newArray(int size) {return new RepoPermissionsModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/RepoSubscriptionModel.java b/app/src/main/java/com/fastaccess/data/dao/RepoSubscriptionModel.java deleted file mode 100644 index 4774d1c86..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/RepoSubscriptionModel.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.fastaccess.data.dao; - -import java.util.Date; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 14 Mar 2017, 9:10 PM - */ - -@Getter @Setter @NoArgsConstructor -public class RepoSubscriptionModel { - private boolean subscribed; - private boolean ignored; - private Date createdAt; - private String url; - private String repositoryUrl; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/ReviewCommentModel.java b/app/src/main/java/com/fastaccess/data/dao/ReviewCommentModel.java deleted file mode 100644 index eaf66c5db..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/ReviewCommentModel.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.data.dao.model.User; - -import java.util.Date; - -/** - * Created by Kosh on 04 May 2017, 7:10 PM - */ - - public class ReviewCommentModel implements Parcelable { - - private long id; - private String url; - private long pullRequestReviewId; - private String diffHunk; - private String path; - private int position; - private int originalPosition; - private String commitId; - private String originalCommitId; - private User user; - private String bodyHtml; - private String body; - private Date createdAt; - private Date updatedAt; - private String htmlUrl; - private String pullRequestUrl; - private ReactionsModel reactions; - private String authorAssociation; - - public ReviewCommentModel() {} - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public long getPullRequestReviewId() { - return pullRequestReviewId; - } - - public void setPullRequestReviewId(long pullRequestReviewId) { - this.pullRequestReviewId = pullRequestReviewId; - } - - public String getDiffHunk() { - return diffHunk; - } - - public void setDiffHunk(String diffHunk) { - this.diffHunk = diffHunk; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public int getPosition() { - return position; - } - - public void setPosition(int position) { - this.position = position; - } - - public int getOriginalPosition() { - return originalPosition; - } - - public void setOriginalPosition(int originalPosition) { - this.originalPosition = originalPosition; - } - - public String getCommitId() { - return commitId; - } - - public void setCommitId(String commitId) { - this.commitId = commitId; - } - - public String getOriginalCommitId() { - return originalCommitId; - } - - public void setOriginalCommitId(String originalCommitId) { - this.originalCommitId = originalCommitId; - } - - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } - - public String getBodyHtml() { - return bodyHtml; - } - - public void setBodyHtml(String bodyHtml) { - this.bodyHtml = bodyHtml; - } - - public String getBody() { - return body; - } - - public void setBody(String body) { - this.body = body; - } - - public Date getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - } - - public Date getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(Date updatedAt) { - this.updatedAt = updatedAt; - } - - public String getHtmlUrl() { - return htmlUrl; - } - - public void setHtmlUrl(String htmlUrl) { - this.htmlUrl = htmlUrl; - } - - public String getPullRequestUrl() { - return pullRequestUrl; - } - - public void setPullRequestUrl(String pullRequestUrl) { - this.pullRequestUrl = pullRequestUrl; - } - - public ReactionsModel getReactions() { - return reactions; - } - - public void setReactions(ReactionsModel reactions) { - this.reactions = reactions; - } - - public String getAuthorAssociation() { - return authorAssociation; - } - - public void setAuthorAssociation(String authorAssociation) { - this.authorAssociation = authorAssociation; - } - - @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ReviewCommentModel that = (ReviewCommentModel) o; - - return id == that.id; - } - - @Override public int hashCode() { - return (int) (id ^ (id >>> 32)); - } - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeString(this.url); - dest.writeLong(this.pullRequestReviewId); - dest.writeString(this.diffHunk); - dest.writeString(this.path); - dest.writeInt(this.position); - dest.writeInt(this.originalPosition); - dest.writeString(this.commitId); - dest.writeString(this.originalCommitId); - dest.writeParcelable(this.user, flags); - dest.writeString(this.bodyHtml); - dest.writeString(this.body); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1); - dest.writeString(this.htmlUrl); - dest.writeString(this.pullRequestUrl); - dest.writeParcelable(this.reactions, flags); - dest.writeString(this.authorAssociation); - } - - protected ReviewCommentModel(Parcel in) { - this.id = in.readLong(); - this.url = in.readString(); - this.pullRequestReviewId = in.readLong(); - this.diffHunk = in.readString(); - this.path = in.readString(); - this.position = in.readInt(); - this.originalPosition = in.readInt(); - this.commitId = in.readString(); - this.originalCommitId = in.readString(); - this.user = in.readParcelable(User.class.getClassLoader()); - this.bodyHtml = in.readString(); - this.body = in.readString(); - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - long tmpUpdatedAt = in.readLong(); - this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt); - this.htmlUrl = in.readString(); - this.pullRequestUrl = in.readString(); - this.reactions = in.readParcelable(ReactionsModel.class.getClassLoader()); - this.authorAssociation = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public ReviewCommentModel createFromParcel(Parcel source) {return new ReviewCommentModel(source);} - - @Override public ReviewCommentModel[] newArray(int size) {return new ReviewCommentModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/ReviewModel.java b/app/src/main/java/com/fastaccess/data/dao/ReviewModel.java deleted file mode 100644 index 9e6d94216..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/ReviewModel.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.data.dao.model.User; - -import java.util.Date; -import java.util.List; - -/** - * Created by Kosh on 10 Apr 2017, 4:26 PM - */ - -public class ReviewModel implements Parcelable { - - private long id; - private User user; - private String bodyHtml; - private String state; - private Date submittedAt; - private String commitId; - private String diffText; - private List comments; - private ReactionsModel reactions; - private String bodyText; - - public ReviewModel() {} - - @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - ReviewModel that = (ReviewModel) o; - return id == that.id; - } - - @Override public int hashCode() { - return (int) (id ^ (id >>> 32)); - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeParcelable(this.user, flags); - dest.writeString(this.bodyHtml); - dest.writeString(this.state); - dest.writeLong(this.submittedAt != null ? this.submittedAt.getTime() : -1); - dest.writeString(this.commitId); - dest.writeString(this.diffText); - dest.writeTypedList(this.comments); - dest.writeParcelable(this.reactions, flags); - dest.writeString(this.bodyText); - } - - protected ReviewModel(Parcel in) { - this.id = in.readLong(); - this.user = in.readParcelable(User.class.getClassLoader()); - this.bodyHtml = in.readString(); - this.state = in.readString(); - long tmpSubmittedAt = in.readLong(); - this.submittedAt = tmpSubmittedAt == -1 ? null : new Date(tmpSubmittedAt); - this.commitId = in.readString(); - this.diffText = in.readString(); - this.comments = in.createTypedArrayList(ReviewCommentModel.CREATOR); - this.reactions = in.readParcelable(ReactionsModel.class.getClassLoader()); - this.bodyText = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public ReviewModel createFromParcel(Parcel source) {return new ReviewModel(source);} - - @Override public ReviewModel[] newArray(int size) {return new ReviewModel[size];} - }; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } - - public String getBodyHtml() { - return bodyHtml; - } - - public void setBodyHtml(String bodyHtml) { - this.bodyHtml = bodyHtml; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public Date getSubmittedAt() { - return submittedAt; - } - - public void setSubmittedAt(Date submittedAt) { - this.submittedAt = submittedAt; - } - - public String getCommitId() { - return commitId; - } - - public void setCommitId(String commitId) { - this.commitId = commitId; - } - - public String getDiffText() { - return diffText; - } - - public void setDiffText(String diffText) { - this.diffText = diffText; - } - - public List getComments() { - return comments; - } - - public void setComments(List comments) { - this.comments = comments; - } - - public ReactionsModel getReactions() { - return reactions; - } - - public void setReactions(ReactionsModel reactions) { - this.reactions = reactions; - } - - public String getBodyText() { - return bodyText; - } - - public void setBodyText(String bodyText) { - this.bodyText = bodyText; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/ReviewRequestModel.java b/app/src/main/java/com/fastaccess/data/dao/ReviewRequestModel.java deleted file mode 100644 index df40f83cb..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/ReviewRequestModel.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import java.util.List; - -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Kosh on 24 Jun 2017, 4:15 PM - */ - -@Getter @Setter public class ReviewRequestModel implements Parcelable { - public String commitId; - public String body; - public String event; - public List comments; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.commitId); - dest.writeString(this.body); - dest.writeString(this.event); - dest.writeTypedList(this.comments); - } - - private ReviewRequestModel(Parcel in) { - this.commitId = in.readString(); - this.body = in.readString(); - this.event = in.readString(); - this.comments = in.createTypedArrayList(CommentRequestModel.CREATOR); - } - - public ReviewRequestModel() { - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override public ReviewRequestModel createFromParcel(Parcel source) {return new ReviewRequestModel(source);} - - @Override public ReviewRequestModel[] newArray(int size) {return new ReviewRequestModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/SearchCodeModel.java b/app/src/main/java/com/fastaccess/data/dao/SearchCodeModel.java deleted file mode 100644 index f6e872219..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/SearchCodeModel.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.data.dao.model.Repo; - -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Kosh on 19 Feb 2017, 1:17 AM - */ - -@Getter @Setter -public class SearchCodeModel implements Parcelable { - private String name; - private String path; - private String sha; - private String url; - private String gitUrl; - private Repo repository; - private double score; - private String htmlUrl; - - - public SearchCodeModel() {} - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.name); - dest.writeString(this.path); - dest.writeString(this.sha); - dest.writeString(this.url); - dest.writeString(this.gitUrl); - dest.writeParcelable(this.repository, flags); - dest.writeDouble(this.score); - } - - protected SearchCodeModel(Parcel in) { - this.name = in.readString(); - this.path = in.readString(); - this.sha = in.readString(); - this.url = in.readString(); - this.gitUrl = in.readString(); - this.repository = in.readParcelable(Repo.class.getClassLoader()); - this.score = in.readDouble(); - } - - public static final Creator CREATOR = new Creator() { - @Override public SearchCodeModel createFromParcel(Parcel source) {return new SearchCodeModel(source);} - - @Override public SearchCodeModel[] newArray(int size) {return new SearchCodeModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/SettingsModel.java b/app/src/main/java/com/fastaccess/data/dao/SettingsModel.java deleted file mode 100644 index a844c85f7..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/SettingsModel.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.fastaccess.data.dao; - -import androidx.annotation.IntDef; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; - -/** - * Created by JediB on 5/12/2017. - */ - -@Getter @Setter @AllArgsConstructor public class SettingsModel { - - - public static final int THEME = 0; - public static final int NOTIFICATION = 1; - public static final int BEHAVIOR = 2; - public static final int CUSTOMIZATION = 3; - public static final int BACKUP = 4; - public static final int LANGUAGE = 5; - public static final int CODE_THEME = 6; - - @IntDef({ - THEME, - NOTIFICATION, - CUSTOMIZATION, - BEHAVIOR, - BACKUP, - LANGUAGE, - CODE_THEME - }) - @Retention(RetentionPolicy.SOURCE) public @interface SettingsType {} - - private int image; - private String title; - @SettingsType private int settingsType; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/SimpleUrlsModel.java b/app/src/main/java/com/fastaccess/data/dao/SimpleUrlsModel.java deleted file mode 100644 index 7a7293fe8..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/SimpleUrlsModel.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Kosh on 31 Dec 2016, 3:32 PM - */ - - -@Getter @Setter -public class SimpleUrlsModel implements Parcelable { - - public String item; - public String url; - public String extension; - - public SimpleUrlsModel(String item, String url) { - this.item = item; - this.url = url; - } - - public SimpleUrlsModel(String item, String url, String extension) { - this.item = item; - this.url = url; - this.extension = extension; - } - - @Override public String toString() { - return item; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.item); - dest.writeString(this.url); - } - - @SuppressWarnings("WeakerAccess") protected SimpleUrlsModel(Parcel in) { - this.item = in.readString(); - this.url = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public SimpleUrlsModel createFromParcel(Parcel source) {return new SimpleUrlsModel(source);} - - @Override public SimpleUrlsModel[] newArray(int size) {return new SimpleUrlsModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/SparseBooleanArrayParcelable.java b/app/src/main/java/com/fastaccess/data/dao/SparseBooleanArrayParcelable.java deleted file mode 100644 index 912eb792b..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/SparseBooleanArrayParcelable.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; -import android.util.SparseBooleanArray; - - -/** - * Class from http://stackoverflow.com/a/16711258/1627904 - */ -public class SparseBooleanArrayParcelable extends SparseBooleanArray implements Parcelable { - public static Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override - public SparseBooleanArrayParcelable createFromParcel(Parcel source) { - SparseBooleanArrayParcelable read = new SparseBooleanArrayParcelable(); - int size = source.readInt(); - - int[] keys = new int[size]; - boolean[] values = new boolean[size]; - - source.readIntArray(keys); - source.readBooleanArray(values); - - for (int i = 0; i < size; i++) { - read.put(keys[i], values[i]); - } - - return read; - } - - @Override - public SparseBooleanArrayParcelable[] newArray(int size) { - return new SparseBooleanArrayParcelable[size]; - } - }; - - public SparseBooleanArrayParcelable() { - - } - - public SparseBooleanArrayParcelable(SparseBooleanArray sparseBooleanArray) { - for (int i = 0; i < sparseBooleanArray.size(); i++) { - this.put(sparseBooleanArray.keyAt(i), sparseBooleanArray.valueAt(i)); - } - } - - @Override public int describeContents() { - return 0; - } - - @Override public void writeToParcel(Parcel dest, int flags) { - int[] keys = new int[size()]; - boolean[] values = new boolean[size()]; - - for (int i = 0; i < size(); i++) { - keys[i] = keyAt(i); - values[i] = valueAt(i); - } - - dest.writeInt(size()); - dest.writeIntArray(keys); - dest.writeBooleanArray(values); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/data/dao/StatusesModel.java b/app/src/main/java/com/fastaccess/data/dao/StatusesModel.java deleted file mode 100644 index ca7cb0e9b..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/StatusesModel.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.data.dao.types.StatusStateType; - -import java.util.Date; - -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Kosh on 10 Apr 2017, 3:16 AM - */ - -@Getter @Setter public class StatusesModel implements Parcelable { - private String url; - private StatusStateType state; - private String description; - private String targetUrl; - private String context; - private Date createdAt; - private Date updatedAt; - - public StatusesModel() {} - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.url); - dest.writeInt(this.state == null ? -1 : this.state.ordinal()); - dest.writeString(this.description); - dest.writeString(this.targetUrl); - dest.writeString(this.context); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1); - } - - private StatusesModel(Parcel in) { - this.url = in.readString(); - int tmpState = in.readInt(); - this.state = tmpState == -1 ? null : StatusStateType.values()[tmpState]; - this.description = in.readString(); - this.targetUrl = in.readString(); - this.context = in.readString(); - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - long tmpUpdatedAt = in.readLong(); - this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt); - } - - public static final Creator CREATOR = new Creator() { - @Override public StatusesModel createFromParcel(Parcel source) {return new StatusesModel(source);} - - @Override public StatusesModel[] newArray(int size) {return new StatusesModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/TabsCountStateModel.java b/app/src/main/java/com/fastaccess/data/dao/TabsCountStateModel.java deleted file mode 100644 index ca65a36e4..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/TabsCountStateModel.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.DrawableRes; - -import java.io.Serializable; - -/** - * Created by Kosh on 27 Apr 2017, 6:10 PM - */ - -public class TabsCountStateModel implements Parcelable, Serializable { - private int count; - private int tabIndex; - @DrawableRes private int drawableId; - - public int getCount() { - return count; - } - - public void setCount(int count) { - this.count = count; - } - - public int getTabIndex() { - return tabIndex; - } - - public void setTabIndex(int tabIndex) { - this.tabIndex = tabIndex; - } - - public int getDrawableId() { - return drawableId; - } - - public void setDrawableId(int drawableId) { - this.drawableId = drawableId; - } - - @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - TabsCountStateModel model = (TabsCountStateModel) o; - - return tabIndex == model.tabIndex; - } - - @Override public int hashCode() { - return tabIndex; - } - - public TabsCountStateModel() {} - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(this.count); - dest.writeInt(this.tabIndex); - dest.writeInt(this.drawableId); - } - - protected TabsCountStateModel(Parcel in) { - this.count = in.readInt(); - this.tabIndex = in.readInt(); - this.drawableId = in.readInt(); - } - - public static final Creator CREATOR = new Creator() { - @Override public TabsCountStateModel createFromParcel(Parcel source) {return new TabsCountStateModel(source);} - - @Override public TabsCountStateModel[] newArray(int size) {return new TabsCountStateModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/TeamsModel.java b/app/src/main/java/com/fastaccess/data/dao/TeamsModel.java deleted file mode 100644 index 984268d8b..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/TeamsModel.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 03 Apr 2017, 7:40 PM - */ - -@Getter @Setter @NoArgsConstructor public class TeamsModel implements Parcelable { - private long id; - private String url; - private String name; - private String slug; - private String description; - private String privacy; - private String permission; - private String membersUrl; - private String repositoriesUrl; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeString(this.url); - dest.writeString(this.name); - dest.writeString(this.slug); - dest.writeString(this.description); - dest.writeString(this.privacy); - dest.writeString(this.permission); - dest.writeString(this.membersUrl); - dest.writeString(this.repositoriesUrl); - } - - protected TeamsModel(Parcel in) { - this.id = in.readLong(); - this.url = in.readString(); - this.name = in.readString(); - this.slug = in.readString(); - this.description = in.readString(); - this.privacy = in.readString(); - this.permission = in.readString(); - this.membersUrl = in.readString(); - this.repositoriesUrl = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public TeamsModel createFromParcel(Parcel source) {return new TeamsModel(source);} - - @Override public TeamsModel[] newArray(int size) {return new TeamsModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/TimelineModel.java b/app/src/main/java/com/fastaccess/data/dao/TimelineModel.java deleted file mode 100644 index 1e4e15a96..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/TimelineModel.java +++ /dev/null @@ -1,223 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.timeline.GenericEvent; -import com.fastaccess.data.dao.timeline.PullRequestCommitModel; -import com.fastaccess.data.dao.types.IssueEventType; - -import java.util.List; - -import io.reactivex.Observable; -import lombok.Getter; -import lombok.NonNull; -import lombok.Setter; - -/** - * Created by Kosh on 30 Mar 2017, 9:03 PM - */ - -@Getter @Setter public class TimelineModel implements Parcelable { - public static final int HEADER = 1; - public static final int EVENT = 2; - public static final int COMMENT = 3; - public static final int REVIEW = 4; - public static final int GROUP = 5; - public static final int COMMIT_COMMENTS = 6; - public static final int STATUS = 7; - - private IssueEventType event; - private Comment comment; - private GenericEvent genericEvent; - private PullRequestStatusModel status; - private Issue issue; - private PullRequest pullRequest; - private ReviewModel review; - private GroupedReviewModel groupedReviewModel; - private PullRequestCommitModel commit; - private int position; - - public TimelineModel(Issue issue) { - this.issue = issue; - } - - public TimelineModel(PullRequest pullRequest) { - this.pullRequest = pullRequest; - } - - public TimelineModel(Comment comment) { - this.comment = comment; - this.event = IssueEventType.commented; - } - - public TimelineModel(PullRequestStatusModel statusModel) { - this.status = statusModel; - } - - public TimelineModel() {} - - public int getType() { - if (getEvent() != null) { - switch (getEvent()) { - case commented: - return COMMENT; - case reviewed: - case changes_requested: - return REVIEW; - case GROUPED: - return GROUP; - case commit_commented: - return COMMIT_COMMENTS; - default: - return EVENT; - } - } else { - if (issue != null || pullRequest != null) return HEADER; - else if (status != null) return STATUS; - return 0; - } - } - - public static TimelineModel constructHeader(Issue issue) { - return new TimelineModel(issue); - } - - public static TimelineModel constructHeader(PullRequest pullRequest) { - return new TimelineModel(pullRequest); - } - - public static TimelineModel constructComment(Comment comment) { - return new TimelineModel(comment); - } - - @NonNull public static Observable> construct(@Nullable List comments) { - if (comments == null || comments.isEmpty()) return Observable.empty(); - return Observable.fromIterable(comments) - .map(TimelineModel::new) - .toList() - .toObservable(); - } - - @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - TimelineModel model = (TimelineModel) o; - return (comment != null && model.getComment() != null) && (comment.getId() == model.comment.getId()); - } - - @Override public int hashCode() { - return comment != null ? (int) comment.getId() : 0; - } - - public IssueEventType getEvent() { - return event; - } - - public void setEvent(IssueEventType event) { - this.event = event; - } - - public Comment getComment() { - return comment; - } - - public void setComment(Comment comment) { - this.comment = comment; - } - - public GenericEvent getGenericEvent() { - return genericEvent; - } - - public void setGenericEvent(GenericEvent genericEvent) { - this.genericEvent = genericEvent; - } - - public PullRequestStatusModel getStatus() { - return status; - } - - public void setStatus(PullRequestStatusModel status) { - this.status = status; - } - - public Issue getIssue() { - return issue; - } - - public void setIssue(Issue issue) { - this.issue = issue; - } - - public PullRequest getPullRequest() { - return pullRequest; - } - - public void setPullRequest(PullRequest pullRequest) { - this.pullRequest = pullRequest; - } - - public ReviewModel getReview() { - return review; - } - - public void setReview(ReviewModel review) { - this.review = review; - } - - public GroupedReviewModel getGroupedReviewModel() { - return groupedReviewModel; - } - - public void setGroupedReviewModel(GroupedReviewModel groupedReviewModel) { - this.groupedReviewModel = groupedReviewModel; - } - - public PullRequestCommitModel getCommit() { - return commit; - } - - public void setCommit(PullRequestCommitModel commit) { - this.commit = commit; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(this.event == null ? -1 : this.event.ordinal()); - dest.writeParcelable(this.comment, flags); - dest.writeParcelable(this.genericEvent, flags); - dest.writeParcelable(this.status, flags); - dest.writeParcelable(this.issue, flags); - dest.writeParcelable(this.pullRequest, flags); - dest.writeParcelable(this.review, flags); - dest.writeParcelable(this.groupedReviewModel, flags); - dest.writeParcelable(this.commit, flags); - dest.writeInt(this.position); - } - - protected TimelineModel(Parcel in) { - int tmpEvent = in.readInt(); - this.event = tmpEvent == -1 ? null : IssueEventType.values()[tmpEvent]; - this.comment = in.readParcelable(Comment.class.getClassLoader()); - this.genericEvent = in.readParcelable(GenericEvent.class.getClassLoader()); - this.status = in.readParcelable(PullRequestStatusModel.class.getClassLoader()); - this.issue = in.readParcelable(Issue.class.getClassLoader()); - this.pullRequest = in.readParcelable(PullRequest.class.getClassLoader()); - this.review = in.readParcelable(ReviewModel.class.getClassLoader()); - this.groupedReviewModel = in.readParcelable(GroupedReviewModel.class.getClassLoader()); - this.commit = in.readParcelable(PullRequestCommitModel.class.getClassLoader()); - this.position = in.readInt(); - } - - public static final Creator CREATOR = new Creator() { - @Override public TimelineModel createFromParcel(Parcel source) {return new TimelineModel(source);} - - @Override public TimelineModel[] newArray(int size) {return new TimelineModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/TopicsModel.java b/app/src/main/java/com/fastaccess/data/dao/TopicsModel.java deleted file mode 100644 index 948dcbacc..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/TopicsModel.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fastaccess.data.dao; - -import java.util.ArrayList; - -/** - * Created by Kosh on 09 May 2017, 7:52 PM - */ - -public class TopicsModel extends ArrayList {} diff --git a/app/src/main/java/com/fastaccess/data/dao/TreeResponseModel.java b/app/src/main/java/com/fastaccess/data/dao/TreeResponseModel.java deleted file mode 100644 index 53b9808f9..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/TreeResponseModel.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.fastaccess.data.dao; - -import com.fastaccess.data.dao.model.RepoFile; - -import java.util.List; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by Kosh on 12 Apr 2017, 1:12 PM - */ - -@NoArgsConstructor @Getter @Setter public class TreeResponseModel { - private String sha; - private String url; - boolean truncated; - List tree; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/TrendingModel.kt b/app/src/main/java/com/fastaccess/data/dao/TrendingModel.kt deleted file mode 100644 index f97bbfe15..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/TrendingModel.kt +++ /dev/null @@ -1,36 +0,0 @@ -package com.fastaccess.data.dao - -import android.os.Parcel -import com.fastaccess.helper.KotlinParcelable -import com.fastaccess.helper.parcelableCreator - -data class TrendingModel( - val title: String? = null, - val description: String? = null, - val language: String? = null, - val stars: String? = null, - val forks: String? = null, - val todayStars: String? = null -) : KotlinParcelable { - companion object { - @JvmField val CREATOR = parcelableCreator(::TrendingModel) - } - - constructor(source: Parcel) : this( - source.readString(), - source.readString(), - source.readString(), - source.readString(), - source.readString(), - source.readString() - ) - - override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) { - writeString(title) - writeString(description) - writeString(language) - writeString(stars) - writeString(forks) - writeString(todayStars) - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/UsersListModel.java b/app/src/main/java/com/fastaccess/data/dao/UsersListModel.java deleted file mode 100644 index fbaa38aaf..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/UsersListModel.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.fastaccess.data.dao; - -import com.fastaccess.data.dao.model.User; - -import java.util.ArrayList; - -/** - * Created by Kosh on 12 Feb 2017, 1:33 PM - */ - -public class UsersListModel extends ArrayList {} diff --git a/app/src/main/java/com/fastaccess/data/dao/WikiModel.java b/app/src/main/java/com/fastaccess/data/dao/WikiModel.java deleted file mode 100644 index 02c85eade..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/WikiModel.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.fastaccess.data.dao; - -import android.os.Parcel; -import android.os.Parcelable; - -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Kosh on 11 Jun 2017, 7:13 PM - */ - -@Getter @Setter public class WikiModel implements Parcelable { - public String pageName; - public String title; - public String summary; - public String action; - public String sha; - - public String htmlUrl; - - public WikiModel() {} - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.pageName); - dest.writeString(this.title); - dest.writeString(this.summary); - dest.writeString(this.action); - dest.writeString(this.sha); - dest.writeString(this.htmlUrl); - } - - private WikiModel(Parcel in) { - this.pageName = in.readString(); - this.title = in.readString(); - this.summary = in.readString(); - this.action = in.readString(); - this.sha = in.readString(); - this.htmlUrl = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public WikiModel createFromParcel(Parcel source) {return new WikiModel(source);} - - @Override public WikiModel[] newArray(int size) {return new WikiModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/BaseConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/BaseConverter.java deleted file mode 100644 index aea04fb24..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/BaseConverter.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.provider.rest.RestProvider; - -import io.requery.Converter; - -/** - * Created by Kosh on 15 Mar 2017, 8:02 PM - */ - -public abstract class BaseConverter implements Converter { - - protected abstract Class getTypeClass(); - - @SuppressWarnings("unchecked") @Override public Class getMappedType() { - return (Class) getTypeClass(); - } - - @Override public Class getPersistedType() { - return String.class; - } - - @Override public Integer getPersistedSize() { - return null; - } - - @Override public String convertToPersisted(C value) { - return RestProvider.gson.toJson(value); - } - - @Override public C convertToMapped(Class type, String value) { - return RestProvider.gson.fromJson(value, type); - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/CommitConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/CommitConverter.java deleted file mode 100644 index b9fb30821..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/CommitConverter.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.model.Commit; - -/** - * Created by Kosh on 15 Mar 2017, 7:58 PM - */ - -public class CommitConverter extends BaseConverter { - - @Override protected Class getTypeClass() { - return Commit.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/CommitFilesConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/CommitFilesConverter.java deleted file mode 100644 index bdb48e72b..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/CommitFilesConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.CommitFileListModel; - -/** - * Created by Kosh on 15 Mar 2017, 8:37 PM - */ - -public class CommitFilesConverter extends BaseConverter { - @Override protected Class getTypeClass() { - return CommitFileListModel.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/CommitsConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/CommitsConverter.java deleted file mode 100644 index e01b55110..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/CommitsConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.CommitListModel; - -/** - * Created by Kosh on 15 Mar 2017, 8:37 PM - */ - -public class CommitsConverter extends BaseConverter { - @Override protected Class getTypeClass() { - return CommitListModel.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/GistConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/GistConverter.java deleted file mode 100644 index 067ff8f4e..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/GistConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.model.Gist; - -/** - * Created by Kosh on 15 Mar 2017, 8:30 PM - */ - -public class GistConverter extends BaseConverter { - @Override protected Class getTypeClass() { - return Gist.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/GitCommitConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/GitCommitConverter.java deleted file mode 100644 index cf16b8d10..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/GitCommitConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.GitCommitModel; - -/** - * Created by Kosh on 15 Mar 2017, 8:42 PM - */ - -public class GitCommitConverter extends BaseConverter { - @Override protected Class getTypeClass() { - return GitCommitModel.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/GitHubFilesConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/GitHubFilesConverter.java deleted file mode 100644 index 2c1a3c1e1..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/GitHubFilesConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.GithubFileModel; - -/** - * Created by Kosh on 15 Mar 2017, 8:21 PM - */ - -public class GitHubFilesConverter extends BaseConverter { - @Override protected Class getTypeClass() { - return GithubFileModel.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/GitHubStateConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/GitHubStateConverter.java deleted file mode 100644 index bf506b34b..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/GitHubStateConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.GithubState; - -/** - * Created by Kosh on 15 Mar 2017, 8:41 PM - */ - -public class GitHubStateConverter extends BaseConverter { - @Override protected Class getTypeClass() { - return GithubState.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/IssueConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/IssueConverter.java deleted file mode 100644 index 9326c2172..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/IssueConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.model.Issue; - -/** - * Created by Kosh on 15 Mar 2017, 8:30 PM - */ - -public class IssueConverter extends BaseConverter { - @Override protected Class getTypeClass() { - return Issue.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/LabelConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/LabelConverter.java deleted file mode 100644 index 0109c054f..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/LabelConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.LabelModel; - -/** - * Created by Kosh on 15 Mar 2017, 8:30 PM - */ - -public class LabelConverter extends BaseConverter { - @Override protected Class getTypeClass() { - return LabelModel.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/LabelsListConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/LabelsListConverter.java deleted file mode 100644 index f1a605d7b..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/LabelsListConverter.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.LabelListModel; - -/** - * Created by Kosh on 11 Feb 2017, 11:43 PM - */ - -public class LabelsListConverter extends BaseConverter { - - @Override protected Class getTypeClass() { - return LabelListModel.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/LicenseConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/LicenseConverter.java deleted file mode 100644 index cd0b977f5..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/LicenseConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.LicenseModel; - -/** - * Created by Kosh on 15 Mar 2017, 8:33 PM - */ - -public class LicenseConverter extends BaseConverter { - @Override protected Class getTypeClass() { - return LicenseModel.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/MilestoneConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/MilestoneConverter.java deleted file mode 100644 index 118b9cbfc..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/MilestoneConverter.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.MilestoneModel; - -/** - * Created by Kosh on 11 Feb 2017, 11:43 PM - */ - -public class MilestoneConverter extends BaseConverter { - - @Override protected Class getTypeClass() { - return MilestoneModel.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/NotificationSubjectConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/NotificationSubjectConverter.java deleted file mode 100644 index dccbb1dec..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/NotificationSubjectConverter.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.NotificationSubjectModel; - -/** - * Created by Kosh on 15 Mar 2017, 7:58 PM - */ - -public class NotificationSubjectConverter extends BaseConverter { - - @Override protected Class getTypeClass() { - return NotificationSubjectModel.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/PayloadConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/PayloadConverter.java deleted file mode 100644 index 3be077ec5..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/PayloadConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.PayloadModel; - -/** - * Created by Kosh on 15 Mar 2017, 8:39 PM - */ - -public class PayloadConverter extends BaseConverter { - @Override protected Class getTypeClass() { - return PayloadModel.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/PullRequestConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/PullRequestConverter.java deleted file mode 100644 index 06a372c7e..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/PullRequestConverter.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.model.PullRequest; - -/** - * Created by Kosh on 15 Mar 2017, 7:58 PM - */ - -public class PullRequestConverter extends BaseConverter { - - @Override protected Class getTypeClass() { - return PullRequest.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/ReactionsConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/ReactionsConverter.java deleted file mode 100644 index 8897a7608..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/ReactionsConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.ReactionsModel; - -/** - * Created by Kosh on 06 May 2017, 4:53 PM - */ - -public class ReactionsConverter extends BaseConverter { - @Override protected Class getTypeClass() { - return ReactionsModel.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/ReleasesAssetsConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/ReleasesAssetsConverter.java deleted file mode 100644 index 88ecc3d68..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/ReleasesAssetsConverter.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.ReleasesAssetsListModel; - -/** - * Created by Kosh on 11 Feb 2017, 11:43 PM - */ - -public class ReleasesAssetsConverter extends BaseConverter { - - @Override protected Class getTypeClass() { - return ReleasesAssetsListModel.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/RenameConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/RenameConverter.java deleted file mode 100644 index ebe0a5f78..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/RenameConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.RenameModel; - -/** - * Created by Kosh on 15 Mar 2017, 8:29 PM - */ - -public class RenameConverter extends BaseConverter { - @Override protected Class getTypeClass() { - return RenameModel.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/RepoConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/RepoConverter.java deleted file mode 100644 index a92e6bb47..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/RepoConverter.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.model.Repo; - -/** - * Created by Kosh on 15 Mar 2017, 7:58 PM - */ - -public class RepoConverter extends BaseConverter { - - @Override protected Class getTypeClass() { - return Repo.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/RepoPermissionConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/RepoPermissionConverter.java deleted file mode 100644 index e28979f24..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/RepoPermissionConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.RepoPermissionsModel; - -/** - * Created by Kosh on 15 Mar 2017, 8:33 PM - */ - -public class RepoPermissionConverter extends BaseConverter { - @Override protected Class getTypeClass() { - return RepoPermissionsModel.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/TeamConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/TeamConverter.java deleted file mode 100644 index df637b03a..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/TeamConverter.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.TeamsModel; -import com.fastaccess.data.dao.model.User; - -/** - * Created by Kosh on 15 Mar 2017, 7:58 PM - */ - -public class TeamConverter extends BaseConverter { - - @Override protected Class getTypeClass() { - return TeamsModel.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/TopicsConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/TopicsConverter.java deleted file mode 100644 index adac4bfb1..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/TopicsConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.TopicsModel; - -/** - * Created by Kosh on 09 May 2017, 7:54 PM - */ - -public class TopicsConverter extends BaseConverter { - @Override protected Class getTypeClass() { - return TopicsModel.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/UserConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/UserConverter.java deleted file mode 100644 index 90c02b75d..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/UserConverter.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.model.User; - -/** - * Created by Kosh on 15 Mar 2017, 7:58 PM - */ - -public class UserConverter extends BaseConverter { - - @Override protected Class getTypeClass() { - return User.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/converters/UsersConverter.java b/app/src/main/java/com/fastaccess/data/dao/converters/UsersConverter.java deleted file mode 100644 index 10215295d..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/converters/UsersConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fastaccess.data.dao.converters; - -import com.fastaccess.data.dao.UsersListModel; - -/** - * Created by Kosh on 15 Mar 2017, 8:26 PM - */ - -public class UsersConverter extends BaseConverter { - @Override protected Class getTypeClass() { - return UsersListModel.class; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractComment.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractComment.java deleted file mode 100644 index 806f83d19..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractComment.java +++ /dev/null @@ -1,224 +0,0 @@ -package com.fastaccess.data.dao.model; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; - -import com.fastaccess.App; -import com.fastaccess.data.dao.ReactionsModel; -import com.fastaccess.data.dao.converters.ReactionsConverter; -import com.fastaccess.data.dao.converters.UserConverter; -import com.fastaccess.helper.RxHelper; - -import java.util.Date; -import java.util.List; - -import io.reactivex.Single; -import io.reactivex.disposables.Disposable; -import io.requery.BlockingEntityStore; -import io.requery.Column; -import io.requery.Convert; -import io.requery.Entity; -import io.requery.Key; -import io.requery.Persistable; -import lombok.NoArgsConstructor; - -import static com.fastaccess.data.dao.model.Comment.COMMIT_ID; -import static com.fastaccess.data.dao.model.Comment.GIST_ID; -import static com.fastaccess.data.dao.model.Comment.ID; -import static com.fastaccess.data.dao.model.Comment.ISSUE_ID; -import static com.fastaccess.data.dao.model.Comment.LOGIN; -import static com.fastaccess.data.dao.model.Comment.PULL_REQUEST_ID; -import static com.fastaccess.data.dao.model.Comment.REPO_ID; -import static com.fastaccess.data.dao.model.Comment.UPDATED_AT; - -/** - * Created by Kosh on 16 Mar 2017, 7:24 PM - */ -@Entity @NoArgsConstructor public abstract class AbstractComment implements Parcelable { - @Key long id; - @Column(name = "user_column") @Convert(UserConverter.class) User user; - String url; - String body; - String bodyHtml; - String htmlUrl; - Date createdAt; - Date updatedAt; - int position; - int line; - String path; - String commitId; - String repoId; - String login; - String gistId; - String issueId; - String pullRequestId; - @Convert(ReactionsConverter.class) ReactionsModel reactions; - String authorAssociation; - - public static Disposable saveForGist(@NonNull List models, @NonNull String gistId) { - return RxHelper.getSingle(Single.fromPublisher(s -> { - try { - BlockingEntityStore dataSource = App.getInstance().getDataStore().toBlocking(); - dataSource.delete(Comment.class) - .where(GIST_ID.equal(gistId)) - .get() - .value(); - if (!models.isEmpty()) { - for (Comment model : models) { - dataSource.delete(Comment.class).where(ID.eq(model.getId())).get().value(); - model.setGistId(gistId); - dataSource.insert(model); - } - } - s.onNext(""); - } catch (Exception e) { - s.onError(e); - } - s.onComplete(); - })).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace); - } - - public static Disposable saveForCommits(@NonNull List models, @NonNull String repoId, - @NonNull String login, @NonNull String commitId) { - return RxHelper.getSingle(Single.fromPublisher(s -> { - try { - BlockingEntityStore dataSource = App.getInstance().getDataStore().toBlocking(); - dataSource.delete(Comment.class) - .where(COMMIT_ID.equal(commitId) - .and(REPO_ID.equal(repoId)) - .and(LOGIN.equal(login))) - .get() - .value(); - if (!models.isEmpty()) { - for (Comment model : models) { - dataSource.delete(Comment.class).where(ID.eq(model.getId())).get().value(); - model.setLogin(login); - model.setRepoId(repoId); - model.setCommitId(commitId); - dataSource.insert(model); - } - } - s.onNext(""); - } catch (Exception e) { - s.onError(e); - } - s.onComplete(); - })).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace); - } - - public static Single> getGistComments(@NonNull String gistId) { - return App.getInstance().getDataStore() - .select(Comment.class) - .where(GIST_ID.equal(gistId)) - .orderBy(UPDATED_AT.desc()) - .get() - .observable() - .toList(); - } - - public static Single> getCommitComments(@NonNull String repoId, @NonNull String login, - @NonNull String commitId) { - return App.getInstance().getDataStore() - .select(Comment.class) - .where(REPO_ID.equal(repoId) - .and(LOGIN.equal(login)) - .and(COMMIT_ID.equal(commitId))) - .orderBy(UPDATED_AT.desc()) - .get() - .observable() - .toList(); - } - - public static Single> getIssueComments(@NonNull String repoId, @NonNull String login, @NonNull String issueId) { - return App.getInstance().getDataStore() - .select(Comment.class) - .where(REPO_ID.equal(repoId) - .and(LOGIN.equal(login)) - .and(ISSUE_ID.equal(issueId))) - .orderBy(UPDATED_AT.desc()) - .get() - .observable() - .toList(); - } - - public static Single> getPullRequestComments(@NonNull String repoId, @NonNull String login, - @NonNull String pullRequestId) { - return App.getInstance().getDataStore() - .select(Comment.class) - .where(REPO_ID.equal(repoId) - .and(LOGIN.equal(login)) - .and(PULL_REQUEST_ID.equal(pullRequestId))) - .orderBy(UPDATED_AT.desc()) - .get() - .observable() - .toList(); - } - - - @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Comment that = (Comment) o; - return id == that.id; - - } - - @Override public int hashCode() { - return (int) (id ^ (id >>> 32)); - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeParcelable(this.user, flags); - dest.writeString(this.url); - dest.writeString(this.body); - dest.writeString(this.bodyHtml); - dest.writeString(this.htmlUrl); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1); - dest.writeInt(this.position); - dest.writeInt(this.line); - dest.writeString(this.path); - dest.writeString(this.commitId); - dest.writeString(this.repoId); - dest.writeString(this.login); - dest.writeString(this.gistId); - dest.writeString(this.issueId); - dest.writeString(this.pullRequestId); - dest.writeParcelable(this.reactions, flags); - dest.writeString(this.authorAssociation); - } - - protected AbstractComment(Parcel in) { - this.id = in.readLong(); - this.user = in.readParcelable(User.class.getClassLoader()); - this.url = in.readString(); - this.body = in.readString(); - this.bodyHtml = in.readString(); - this.htmlUrl = in.readString(); - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - long tmpUpdatedAt = in.readLong(); - this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt); - this.position = in.readInt(); - this.line = in.readInt(); - this.path = in.readString(); - this.commitId = in.readString(); - this.repoId = in.readString(); - this.login = in.readString(); - this.gistId = in.readString(); - this.issueId = in.readString(); - this.pullRequestId = in.readString(); - this.reactions = in.readParcelable(ReactionsModel.class.getClassLoader()); - this.authorAssociation = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public Comment createFromParcel(Parcel source) {return new Comment(source);} - - @Override public Comment[] newArray(int size) {return new Comment[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractCommit.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractCommit.java deleted file mode 100644 index 32fe38a99..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractCommit.java +++ /dev/null @@ -1,203 +0,0 @@ -package com.fastaccess.data.dao.model; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; - -import com.fastaccess.App; -import com.fastaccess.data.dao.CommitFileListModel; -import com.fastaccess.data.dao.CommitListModel; -import com.fastaccess.data.dao.GitCommitModel; -import com.fastaccess.data.dao.GithubState; -import com.fastaccess.data.dao.converters.CommitFilesConverter; -import com.fastaccess.data.dao.converters.CommitsConverter; -import com.fastaccess.data.dao.converters.GitCommitConverter; -import com.fastaccess.data.dao.converters.GitHubStateConverter; -import com.fastaccess.data.dao.converters.RepoConverter; -import com.fastaccess.data.dao.converters.UserConverter; -import com.fastaccess.helper.RxHelper; -import com.google.gson.annotations.SerializedName; - -import java.util.List; - -import io.reactivex.Observable; -import io.reactivex.Single; -import io.reactivex.disposables.Disposable; -import io.requery.BlockingEntityStore; -import io.requery.Column; -import io.requery.Convert; -import io.requery.Entity; -import io.requery.Generated; -import io.requery.Key; -import io.requery.Nullable; -import io.requery.Persistable; -import io.requery.Table; -import lombok.NoArgsConstructor; - -import static com.fastaccess.data.dao.model.Commit.ID; -import static com.fastaccess.data.dao.model.Commit.LOGIN; -import static com.fastaccess.data.dao.model.Commit.PULL_REQUEST_NUMBER; -import static com.fastaccess.data.dao.model.Commit.REPO_ID; -import static com.fastaccess.data.dao.model.Commit.SHA; - -@Entity @NoArgsConstructor @Table(name = "commit_table") -public abstract class AbstractCommit implements Parcelable { - @Key @Generated long id; - String url; - String sha; - String htmlUrl; - String login; - String repoId; - long pullRequestNumber; - @Convert(GitHubStateConverter.class) GithubState stats; - @Convert(CommitFilesConverter.class) CommitFileListModel files; - @Convert(CommitsConverter.class) CommitListModel parents; - @Column(name = "ref_column") String ref; - @SerializedName("distincted") boolean distincted; - @SerializedName("commit") @Convert(GitCommitConverter.class) GitCommitModel gitCommit; - @Convert(UserConverter.class) User author; - @Convert(UserConverter.class) User committer; - @Convert(RepoConverter.class) Repo repo; - @Column(name = "user_column") @Convert(UserConverter.class) User user; - @Nullable int commentCount; - - public Single save(Commit entity) { - return RxHelper.getSingle(App.getInstance().getDataStore().upsert(entity)); - } - - public static Disposable save(@NonNull List models, @NonNull String repoId, @NonNull String login) { - return RxHelper.getSingle(Single.fromPublisher(s -> { - try { - BlockingEntityStore dataSource = App.getInstance().getDataStore().toBlocking(); - dataSource.delete(Commit.class) - .where(REPO_ID.eq(repoId).and(LOGIN.eq(login))) - .get() - .value(); - if (!models.isEmpty()) { - for (Commit commitModel : models) { - dataSource.delete(Commit.class).where(ID.eq(commitModel.getId())).get().value(); - commitModel.setRepoId(repoId); - commitModel.setLogin(login); - dataSource.insert(commitModel); - } - } - s.onNext(""); - } catch (Exception e) { - s.onError(e); - } - s.onComplete(); - })).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace); - } - - public static Disposable save(@NonNull List models, @NonNull String repoId, @NonNull String login, long number) { - return RxHelper.getSingle(Single.fromPublisher(s -> { - try { - BlockingEntityStore dataSource = App.getInstance().getDataStore().toBlocking(); - dataSource.delete(Commit.class) - .where(REPO_ID.eq(repoId) - .and(LOGIN.eq(login)) - .and(PULL_REQUEST_NUMBER.eq(number))) - .get() - .value(); - if (!models.isEmpty()) { - for (Commit commitModel : models) { - dataSource.delete(Commit.class).where(ID.eq(commitModel.getId())).get().value(); - commitModel.setRepoId(repoId); - commitModel.setLogin(login); - commitModel.setPullRequestNumber(number); - dataSource.insert(commitModel); - } - } - s.onNext(""); - } catch (Exception e) { - s.onError(e); - } - s.onComplete(); - })).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace); - } - - public static Single> getCommits(@NonNull String repoId, @NonNull String login) { - return App.getInstance().getDataStore() - .select(Commit.class) - .where(REPO_ID.eq(repoId) - .and(LOGIN.eq(login)) - .and(PULL_REQUEST_NUMBER.eq(0L))) - .get() - .observable() - .toList(); - } - - public static Single> getCommits(@NonNull String repoId, @NonNull String login, long pullRequestNumber) { - return App.getInstance().getDataStore() - .select(Commit.class) - .where(REPO_ID.eq(repoId) - .and(LOGIN.eq(login)) - .and(PULL_REQUEST_NUMBER.eq(pullRequestNumber))) - .get() - .observable() - .toList(); - } - - public static Observable getCommit(@NonNull String sha, @NonNull String repoId, @NonNull String login) { - return App.getInstance().getDataStore() - .select(Commit.class) - .where(REPO_ID.eq(repoId) - .and(LOGIN.eq(login)) - .and(SHA.eq(sha))) - .limit(1) - .get() - .observable(); - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeString(this.url); - dest.writeString(this.sha); - dest.writeString(this.htmlUrl); - dest.writeString(this.login); - dest.writeString(this.repoId); - dest.writeLong(this.pullRequestNumber); - dest.writeParcelable(this.stats, flags); - dest.writeList(this.files); - dest.writeList(this.parents); - dest.writeString(this.ref); - dest.writeByte(this.distincted ? (byte) 1 : (byte) 0); - dest.writeParcelable(this.gitCommit, flags); - dest.writeParcelable(this.author, flags); - dest.writeParcelable(this.committer, flags); - dest.writeParcelable(this.repo, flags); - dest.writeParcelable(this.user, flags); - dest.writeInt(this.commentCount); - } - - protected AbstractCommit(Parcel in) { - this.id = in.readLong(); - this.url = in.readString(); - this.sha = in.readString(); - this.htmlUrl = in.readString(); - this.login = in.readString(); - this.repoId = in.readString(); - this.pullRequestNumber = in.readLong(); - this.stats = in.readParcelable(GithubState.class.getClassLoader()); - this.files = new CommitFileListModel(); - in.readList(this.files, this.files.getClass().getClassLoader()); - this.parents = new CommitListModel(); - in.readList(this.parents, this.parents.getClass().getClassLoader()); - this.ref = in.readString(); - this.distincted = in.readByte() != 0; - this.gitCommit = in.readParcelable(GitCommitModel.class.getClassLoader()); - this.author = in.readParcelable(User.class.getClassLoader()); - this.committer = in.readParcelable(User.class.getClassLoader()); - this.repo = in.readParcelable(Repo.class.getClassLoader()); - this.user = in.readParcelable(User.class.getClassLoader()); - this.commentCount = in.readInt(); - } - - public static final Creator CREATOR = new Creator() { - @Override public Commit createFromParcel(Parcel source) {return new Commit(source);} - - @Override public Commit[] newArray(int size) {return new Commit[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractEvent.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractEvent.java deleted file mode 100644 index ee9a0a628..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractEvent.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.fastaccess.data.dao.model; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; -import android.text.TextUtils; - -import com.fastaccess.App; -import com.fastaccess.data.dao.PayloadModel; -import com.fastaccess.data.dao.converters.PayloadConverter; -import com.fastaccess.data.dao.converters.RepoConverter; -import com.fastaccess.data.dao.converters.UserConverter; -import com.fastaccess.data.dao.types.EventsType; -import com.fastaccess.helper.RxHelper; -import com.google.gson.annotations.SerializedName; - -import java.util.Date; -import java.util.List; - -import io.reactivex.Single; -import io.reactivex.disposables.Disposable; -import io.requery.BlockingEntityStore; -import io.requery.Convert; -import io.requery.Entity; -import io.requery.Key; -import io.requery.Nullable; -import io.requery.Persistable; -import lombok.NoArgsConstructor; - -/** - * Created by Kosh on 16 Mar 2017, 7:29 PM - */ - -@Entity @NoArgsConstructor public abstract class AbstractEvent implements Parcelable { - @Key long id; - EventsType type; - Date createdAt; - @Convert(UserConverter.class) User actor; - @Convert(RepoConverter.class) Repo repo; - @Convert(PayloadConverter.class) PayloadModel payload; - @SerializedName("public") boolean publicEvent; - @Nullable String login; - - @NonNull - public static Disposable save(@androidx.annotation.Nullable List events, @androidx.annotation.Nullable String user) { - return RxHelper.getSingle(Single.fromPublisher(s -> { - try { - Login login = Login.getUser(); - if (login == null) { - s.onNext(""); - s.onComplete(); - return; - } - BlockingEntityStore dataSource = App.getInstance().getDataStore().toBlocking(); - dataSource.delete(Event.class) - .where(Event.LOGIN.isNull() - .or(Event.LOGIN.eq(login.getLogin()))) - .get() - .value(); - if (events != null && !events.isEmpty() && TextUtils.equals(login.getLogin(), user)) { - for (Event event : events) { - dataSource.delete(Event.class).where(Event.ID.eq(event.getId())).get().value(); - event.setLogin(login.getLogin()); - dataSource.insert(event); - } - } - s.onNext(""); - } catch (Exception e) { - s.onError(e); - } - s.onComplete(); - })).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace); - } - - @NonNull public static Single> getEvents(@NonNull String login) { - return RxHelper.getSingle( - App.getInstance().getDataStore() - .select(Event.class) - .where(Event.LOGIN.eq(login)) - .orderBy(Event.CREATED_AT.desc()) - .get() - .observable() - .toList()); - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeInt(this.type == null ? -1 : this.type.ordinal()); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeParcelable(this.actor, flags); - dest.writeParcelable(this.repo, flags); - dest.writeParcelable(this.payload, flags); - dest.writeByte(this.publicEvent ? (byte) 1 : (byte) 0); - } - - protected AbstractEvent(Parcel in) { - this.id = in.readLong(); - int tmpType = in.readInt(); - this.type = tmpType == -1 ? null : EventsType.values()[tmpType]; - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - this.actor = in.readParcelable(User.class.getClassLoader()); - this.repo = in.readParcelable(Repo.class.getClassLoader()); - this.payload = in.readParcelable(PayloadModel.class.getClassLoader()); - this.publicEvent = in.readByte() != 0; - } - - public static final Creator CREATOR = new Creator() { - @Override public Event createFromParcel(Parcel source) {return new Event(source);} - - @Override public Event[] newArray(int size) {return new Event[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractFastHubNotification.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractFastHubNotification.java deleted file mode 100644 index b8721fd5b..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractFastHubNotification.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.fastaccess.data.dao.model; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.App; - -import java.util.Date; - -import io.reactivex.Observable; -import io.requery.Column; -import io.requery.Entity; -import io.requery.Generated; -import io.requery.Key; -import lombok.NoArgsConstructor; - -/** - * Created by Kosh on 11.11.17. - */ -@Entity @NoArgsConstructor public class AbstractFastHubNotification implements Parcelable { - - public enum NotificationType { - UPDATE, GUIDE, PURCHASE, REPORT_ISSUE, PROMOTION, STAR_REPO - } - - @Generated @Key long id; - @io.requery.Nullable @Column(name = "notification_date") Date date; - @io.requery.Nullable boolean read; - @io.requery.Nullable String body; - @io.requery.Nullable String title; - @io.requery.Nullable NotificationType type; - - public static void update(@NonNull FastHubNotification notification) { - App.getInstance().getDataStore().toBlocking().update(notification); - } - - public static void save(@NonNull FastHubNotification notification) { - App.getInstance().getDataStore().toBlocking().insert(notification); - } - - @Nullable public static FastHubNotification getLatest() { - return App.getInstance().getDataStore().toBlocking() - .select(FastHubNotification.class) - .where(FastHubNotification.READ.eq(false)) - .orderBy(FastHubNotification.DATE.desc()) - .limit(1) - .get() - .firstOrNull(); - } - - @NonNull public static Observable getNotifications() { - return App.getInstance().getDataStore() - .select(FastHubNotification.class) - .orderBy(FastHubNotification.DATE.desc()) - .get() - .observable(); - } - - public static boolean hasNotifications() { - return App.getInstance().getDataStore() - .count(FastHubNotification.class) - .get() - .value() > 0; - } - - @Override public String toString() { - return "AbstractFastHubNotification{" + - "date=" + date + - ", isRead=" + read + - ", body='" + body + '\'' + - ", title='" + title + '\'' + - ", type=" + type + - '}'; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeLong(this.date != null ? this.date.getTime() : -1); - dest.writeByte(this.read ? (byte) 1 : (byte) 0); - dest.writeString(this.body); - dest.writeString(this.title); - dest.writeInt(this.type == null ? -1 : this.type.ordinal()); - } - - protected AbstractFastHubNotification(Parcel in) { - this.id = in.readLong(); - long tmpDate = in.readLong(); - this.date = tmpDate == -1 ? null : new Date(tmpDate); - this.read = in.readByte() != 0; - this.body = in.readString(); - this.title = in.readString(); - int tmpType = in.readInt(); - this.type = tmpType == -1 ? null : NotificationType.values()[tmpType]; - } - - public static final Creator CREATOR = new Creator() { - @Override public FastHubNotification createFromParcel(Parcel source) {return new FastHubNotification(source);} - - @Override public FastHubNotification[] newArray(int size) {return new FastHubNotification[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractGist.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractGist.java deleted file mode 100644 index c9e8542e1..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractGist.java +++ /dev/null @@ -1,257 +0,0 @@ -package com.fastaccess.data.dao.model; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; - -import com.annimon.stream.Collectors; -import com.annimon.stream.LongStream; -import com.annimon.stream.Stream; -import com.fastaccess.App; -import com.fastaccess.data.dao.FilesListModel; -import com.fastaccess.data.dao.GithubFileModel; -import com.fastaccess.data.dao.converters.GitHubFilesConverter; -import com.fastaccess.data.dao.converters.UserConverter; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.google.gson.annotations.SerializedName; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import io.reactivex.Observable; -import io.reactivex.Single; -import io.reactivex.disposables.Disposable; -import io.requery.BlockingEntityStore; -import io.requery.Column; -import io.requery.Convert; -import io.requery.Entity; -import io.requery.Key; -import io.requery.Persistable; -import lombok.NoArgsConstructor; - -import static com.fastaccess.data.dao.model.Gist.ID; -import static com.fastaccess.data.dao.model.Gist.OWNER_NAME; - -/** - * Created by Kosh on 16 Mar 2017, 7:32 PM - */ - -@Entity() @NoArgsConstructor public abstract class AbstractGist implements Parcelable { - @SerializedName("nooope") @Key long id; - String url; - String forksUrl; - String commitsUrl; - String gitPullUrl; - String gitPushUrl; - String htmlUrl; - boolean publicX; - Date createdAt; - Date updatedAt; - String description; - int comments; - String commentsUrl; - boolean truncated; - String ownerName; - @SerializedName("id") String gistId; - @Convert(GitHubFilesConverter.class) GithubFileModel files; - @Column(name = "user_column") @Convert(UserConverter.class) User user; - @Convert(UserConverter.class) User owner; - - public static Disposable save(@NonNull List models, @NonNull String ownerName) { - return RxHelper.getSingle(Single.fromPublisher(s -> { - try { - Login login = Login.getUser(); - if (login != null) { - if (login.getLogin().equalsIgnoreCase(ownerName)) { - BlockingEntityStore dataSource = App.getInstance().getDataStore().toBlocking(); - dataSource.delete(Gist.class) - .where(Gist.OWNER_NAME.equal(ownerName)) - .get() - .value(); - if (!models.isEmpty()) { - for (Gist gistModel : models) { - dataSource.delete(Gist.class).where(ID.eq(gistModel.getId())).get().value(); - gistModel.setOwnerName(ownerName); - dataSource.insert(gistModel); - } - } - } else { - App.getInstance().getDataStore().toBlocking() - .delete(Gist.class) - .where(Gist.OWNER_NAME.notEqual(ownerName) - .or(OWNER_NAME.isNull())) - .get() - .value(); - } - } - s.onNext(""); - } catch (Exception e) { - s.onError(e); - } - s.onComplete(); - })).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace); - } - - @NonNull public static Single> getMyGists(@NonNull String ownerName) { - return App.getInstance() - .getDataStore() - .select(Gist.class) - .where(Gist.OWNER_NAME.equal(ownerName)) - .get() - .observable() - .toList(); - } - - @NonNull public static Single> getGists() { - return App.getInstance() - .getDataStore() - .select(Gist.class) - .where(Gist.OWNER_NAME.isNull()) - .get() - .observable() - .toList(); - } - - public static Observable getGist(@NonNull String gistId) { - return App.getInstance() - .getDataStore() - .select(Gist.class) - .where(Gist.GIST_ID.eq(gistId)) - .get() - .observable(); - } - - @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - AbstractGist that = (AbstractGist) o; - return url != null ? url.equals(that.url) : that.url == null; - } - - @Override public int hashCode() { - return url != null ? url.hashCode() : 0; - } - - @NonNull public ArrayList getFilesAsList() { - if (files != null) { - return Stream.of(files) - .map(Map.Entry::getValue) - .collect(Collectors.toCollection(ArrayList::new)); - } - return new ArrayList<>(); - } - - @NonNull public SpannableBuilder getDisplayTitle(boolean isFromProfile) { - return getDisplayTitle(isFromProfile, false); - } - - @NonNull public SpannableBuilder getDisplayTitle(boolean isFromProfile, boolean gistView) { - SpannableBuilder spannableBuilder = SpannableBuilder.builder(); - boolean addDescription = true; - if (!isFromProfile) { - if (owner != null) { - spannableBuilder.bold(owner.getLogin()); - } else if (user != null) { - spannableBuilder.bold(user.getLogin()); - } else { - spannableBuilder.bold("Anonymous"); - } - if (!gistView) { - List files = getFilesAsList(); - if (!files.isEmpty()) { - FilesListModel filesListModel = files.get(0); - if (!InputHelper.isEmpty(filesListModel.getFilename()) && filesListModel.getFilename().trim().length() > 2) { - spannableBuilder.append(" ").append("/").append(" ") - .append(filesListModel.getFilename()); - addDescription = false; - } - } - } - } - if (!InputHelper.isEmpty(description) && addDescription) { - if (!InputHelper.isEmpty(spannableBuilder.toString())) { - spannableBuilder.append(" ").append("/").append(" "); - } - spannableBuilder.append(description); - } - if (InputHelper.isEmpty(spannableBuilder.toString())) { - if (isFromProfile) { - List files = getFilesAsList(); - if (!files.isEmpty()) { - FilesListModel filesListModel = files.get(0); - if (!InputHelper.isEmpty(filesListModel.getFilename()) && filesListModel.getFilename().trim().length() > 2) { - spannableBuilder.append(" ") - .append(filesListModel.getFilename()); - } - } - } - } - return spannableBuilder; - } - - public long getSize() { - List models = getFilesAsList(); - if (!models.isEmpty()) { - return Stream.of(models).flatMapToLong(filesListModel -> LongStream.of(filesListModel.getSize())).sum(); - } - return 0; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeString(this.url); - dest.writeString(this.forksUrl); - dest.writeString(this.commitsUrl); - dest.writeString(this.gitPullUrl); - dest.writeString(this.gitPushUrl); - dest.writeString(this.htmlUrl); - dest.writeByte(this.publicX ? (byte) 1 : (byte) 0); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1); - dest.writeString(this.description); - dest.writeInt(this.comments); - dest.writeString(this.commentsUrl); - dest.writeByte(this.truncated ? (byte) 1 : (byte) 0); - dest.writeString(this.ownerName); - dest.writeString(this.gistId); - dest.writeSerializable(this.files); - dest.writeParcelable(this.user, flags); - dest.writeParcelable(this.owner, flags); - } - - protected AbstractGist(Parcel in) { - this.id = in.readLong(); - this.url = in.readString(); - this.forksUrl = in.readString(); - this.commitsUrl = in.readString(); - this.gitPullUrl = in.readString(); - this.gitPushUrl = in.readString(); - this.htmlUrl = in.readString(); - this.publicX = in.readByte() != 0; - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - long tmpUpdatedAt = in.readLong(); - this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt); - this.description = in.readString(); - this.comments = in.readInt(); - this.commentsUrl = in.readString(); - this.truncated = in.readByte() != 0; - this.ownerName = in.readString(); - this.gistId = in.readString(); - this.files = (GithubFileModel) in.readSerializable(); - this.user = in.readParcelable(User.class.getClassLoader()); - this.owner = in.readParcelable(User.class.getClassLoader()); - } - - public static final Creator CREATOR = new Creator() { - @Override public Gist createFromParcel(Parcel source) {return new Gist(source);} - - @Override public Gist[] newArray(int size) {return new Gist[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractIssue.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractIssue.java deleted file mode 100644 index 744fce425..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractIssue.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.fastaccess.data.dao.model; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; - -import com.fastaccess.App; -import com.fastaccess.data.dao.LabelListModel; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.data.dao.ReactionsModel; -import com.fastaccess.data.dao.UsersListModel; -import com.fastaccess.data.dao.converters.LabelsListConverter; -import com.fastaccess.data.dao.converters.MilestoneConverter; -import com.fastaccess.data.dao.converters.PullRequestConverter; -import com.fastaccess.data.dao.converters.ReactionsConverter; -import com.fastaccess.data.dao.converters.RepoConverter; -import com.fastaccess.data.dao.converters.UserConverter; -import com.fastaccess.data.dao.converters.UsersConverter; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.helper.RxHelper; - -import java.util.Date; -import java.util.List; - -import io.reactivex.Observable; -import io.reactivex.Single; -import io.reactivex.disposables.Disposable; -import io.requery.BlockingEntityStore; -import io.requery.Column; -import io.requery.Convert; -import io.requery.Entity; -import io.requery.Key; -import io.requery.Persistable; -import lombok.NoArgsConstructor; - -import static com.fastaccess.data.dao.model.Issue.ID; -import static com.fastaccess.data.dao.model.Issue.LOGIN; -import static com.fastaccess.data.dao.model.Issue.NUMBER; -import static com.fastaccess.data.dao.model.Issue.REPO_ID; -import static com.fastaccess.data.dao.model.Issue.STATE; -import static com.fastaccess.data.dao.model.Issue.UPDATED_AT; - -/** - * Created by Kosh on 16 Mar 2017, 7:34 PM - */ -@Entity @NoArgsConstructor public abstract class AbstractIssue implements Parcelable { - @Key long id; - String url; - String body; - String title; - int comments; - int number; - boolean locked; - IssueState state; - String repoUrl; - String bodyHtml; - String htmlUrl; - Date closedAt; - Date createdAt; - Date updatedAt; - String repoId; - String login; - @Column(name = "user_column") @Convert(UserConverter.class) User user; - @Convert(UserConverter.class) User assignee; - @Convert(UsersConverter.class) UsersListModel assignees; - @Convert(LabelsListConverter.class) LabelListModel labels; - @Convert(MilestoneConverter.class) MilestoneModel milestone; - @Convert(RepoConverter.class) Repo repository; - @Convert(PullRequestConverter.class) PullRequest pullRequest; - @Convert(UserConverter.class) User closedBy; - @Convert(ReactionsConverter.class) ReactionsModel reactions; - - public Single save(Issue entity) { - return RxHelper.getSingle(App.getInstance().getDataStore() - .delete(Issue.class) - .where(Issue.ID.eq(entity.getId())) - .get() - .single() - .flatMap(observer -> App.getInstance().getDataStore().insert(entity))); - } - - public static Disposable save(@NonNull List models, @NonNull String repoId, @NonNull String login) { - return RxHelper.getSingle(Single.fromPublisher(s -> { - try { - BlockingEntityStore dataSource = App.getInstance().getDataStore().toBlocking(); - dataSource.delete(Issue.class) - .where(REPO_ID.equal(repoId).and(LOGIN.equal(login))) - .get() - .value(); - if (!models.isEmpty()) { - for (Issue issueModel : models) { - dataSource.delete(Issue.class).where(Issue.ID.eq(issueModel.getId())).get().value(); - issueModel.setRepoId(repoId); - issueModel.setLogin(login); - dataSource.insert(issueModel); - } - } - s.onNext(""); - } catch (Exception e) { - s.onError(e); - } - s.onComplete(); - })).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace); - } - - public static Single> getIssues(@NonNull String repoId, @NonNull String login, @NonNull IssueState issueState) { - return App.getInstance().getDataStore().select(Issue.class) - .where(REPO_ID.equal(repoId) - .and(LOGIN.equal(login)) - .and(STATE.equal(issueState))) - .orderBy(UPDATED_AT.desc()) - .get() - .observable() - .toList(); - } - - public static Observable getIssue(long id) { - return App.getInstance().getDataStore() - .select(Issue.class) - .where(ID.equal(id)) - .get() - .observable(); - } - - public static Observable getIssueByNumber(int number, String repoId, String login) { - return App.getInstance().getDataStore() - .select(Issue.class) - .where(NUMBER.equal(number) - .and(REPO_ID.eq(repoId)) - .and(LOGIN.eq(login))) - .get() - .observable(); - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeString(this.url); - dest.writeString(this.body); - dest.writeString(this.title); - dest.writeInt(this.comments); - dest.writeInt(this.number); - dest.writeByte(this.locked ? (byte) 1 : (byte) 0); - dest.writeInt(this.state == null ? -1 : this.state.ordinal()); - dest.writeString(this.repoUrl); - dest.writeString(this.bodyHtml); - dest.writeString(this.htmlUrl); - dest.writeLong(this.closedAt != null ? this.closedAt.getTime() : -1); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1); - dest.writeString(this.repoId); - dest.writeString(this.login); - dest.writeParcelable(this.user, flags); - dest.writeParcelable(this.assignee, flags); - dest.writeList(this.assignees); - dest.writeList(this.labels); - dest.writeParcelable(this.milestone, flags); - dest.writeParcelable(this.repository, flags); - dest.writeParcelable(this.pullRequest, flags); - dest.writeParcelable(this.closedBy, flags); - dest.writeParcelable(this.reactions, flags); - } - - protected AbstractIssue(Parcel in) { - this.id = in.readLong(); - this.url = in.readString(); - this.body = in.readString(); - this.title = in.readString(); - this.comments = in.readInt(); - this.number = in.readInt(); - this.locked = in.readByte() != 0; - int tmpState = in.readInt(); - this.state = tmpState == -1 ? null : IssueState.values()[tmpState]; - this.repoUrl = in.readString(); - this.bodyHtml = in.readString(); - this.htmlUrl = in.readString(); - long tmpClosedAt = in.readLong(); - this.closedAt = tmpClosedAt == -1 ? null : new Date(tmpClosedAt); - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - long tmpUpdatedAt = in.readLong(); - this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt); - this.repoId = in.readString(); - this.login = in.readString(); - this.user = in.readParcelable(User.class.getClassLoader()); - this.assignee = in.readParcelable(User.class.getClassLoader()); - this.assignees = new UsersListModel(); - in.readList(this.assignees, this.assignees.getClass().getClassLoader()); - this.labels = new LabelListModel(); - in.readList(this.labels, this.labels.getClass().getClassLoader()); - this.milestone = in.readParcelable(MilestoneModel.class.getClassLoader()); - this.repository = in.readParcelable(Repo.class.getClassLoader()); - this.pullRequest = in.readParcelable(PullRequest.class.getClassLoader()); - this.closedBy = in.readParcelable(User.class.getClassLoader()); - this.reactions = in.readParcelable(ReactionsModel.class.getClassLoader()); - } - - public static final Creator CREATOR = new Creator() { - @Override public Issue createFromParcel(Parcel source) {return new Issue(source);} - - @Override public Issue[] newArray(int size) {return new Issue[size];} - }; - -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractIssueEvent.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractIssueEvent.java deleted file mode 100644 index 1621e0d38..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractIssueEvent.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.fastaccess.data.dao.model; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; - -import com.fastaccess.App; -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.data.dao.RenameModel; -import com.fastaccess.data.dao.TeamsModel; -import com.fastaccess.data.dao.converters.IssueConverter; -import com.fastaccess.data.dao.converters.LabelConverter; -import com.fastaccess.data.dao.converters.MilestoneConverter; -import com.fastaccess.data.dao.converters.RenameConverter; -import com.fastaccess.data.dao.converters.TeamConverter; -import com.fastaccess.data.dao.converters.UserConverter; -import com.fastaccess.data.dao.types.IssueEventType; -import com.fastaccess.helper.RxHelper; - -import java.util.Date; -import java.util.List; - -import io.reactivex.Single; -import io.reactivex.disposables.Disposable; -import io.requery.BlockingEntityStore; -import io.requery.Convert; -import io.requery.Entity; -import io.requery.Key; -import io.requery.Persistable; -import io.requery.Transient; -import lombok.NoArgsConstructor; - -import static com.fastaccess.data.dao.model.IssueEvent.CREATED_AT; -import static com.fastaccess.data.dao.model.IssueEvent.ISSUE_ID; -import static com.fastaccess.data.dao.model.IssueEvent.LOGIN; -import static com.fastaccess.data.dao.model.IssueEvent.REPO_ID; - -/** - * Created by Kosh on 16 Mar 2017, 7:33 PM - */ - -@Entity @NoArgsConstructor public abstract class AbstractIssueEvent implements Parcelable { - - @Key long id; - String url; - IssueEventType event; - @Convert(UserConverter.class) User actor; - @Convert(UserConverter.class) User assigner; - @Convert(UserConverter.class) User assignee; - @Convert(UserConverter.class) User requestedReviewer; - @Convert(TeamConverter.class) TeamsModel requestedTeam; - @Convert(MilestoneConverter.class) MilestoneModel milestone; - @Convert(RenameConverter.class) RenameModel rename; - @Convert(IssueConverter.class) Issue source; - @Convert(LabelConverter.class) LabelModel label; - String commitId; - String commitUrl; - Date createdAt; - String issueId; - String repoId; - String login; - @Transient List labels; - @Transient Issue issue; - - public static Disposable save(@NonNull List models, @NonNull String repoId, - @NonNull String login, @NonNull String issueId) { - return RxHelper.getSingle(Single.fromPublisher(s -> { - try { - BlockingEntityStore dataSource = App.getInstance().getDataStore().toBlocking(); - dataSource.delete(IssueEvent.class) - .where(LOGIN.equal(login) - .and(REPO_ID.equal(repoId)) - .and(ISSUE_ID.equal(issueId))) - .get() - .value(); - if (!models.isEmpty()) { - for (IssueEvent issueEventModel : models) { - dataSource.delete(IssueEvent.class).where(IssueEvent.ID.eq(issueEventModel.getId())).get().value(); - issueEventModel.setIssueId(issueId); - issueEventModel.setLogin(login); - issueEventModel.setRepoId(repoId); - dataSource.insert(issueEventModel); - } - } - s.onNext(""); - } catch (Exception e) { - s.onError(e); - } - s.onComplete(); - })).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace); - } - - public static Single> get(@NonNull String repoId, @NonNull String login, - @NonNull String issueId) { - return App.getInstance().getDataStore() - .select(IssueEvent.class) - .where(LOGIN.equal(login) - .and(REPO_ID.equal(repoId)) - .and(ISSUE_ID.equal(issueId))) - .orderBy(CREATED_AT.desc()) - .get() - .observable() - .toList(); - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeString(this.url); - dest.writeInt(this.event == null ? -1 : this.event.ordinal()); - dest.writeParcelable(this.actor, flags); - dest.writeParcelable(this.assigner, flags); - dest.writeParcelable(this.assignee, flags); - dest.writeParcelable(this.requestedReviewer, flags); - dest.writeParcelable(this.requestedTeam, flags); - dest.writeParcelable(this.milestone, flags); - dest.writeParcelable(this.rename, flags); - dest.writeParcelable(this.source, flags); - dest.writeParcelable(this.label, flags); - dest.writeString(this.commitId); - dest.writeString(this.commitUrl); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeString(this.issueId); - dest.writeString(this.repoId); - dest.writeString(this.login); - dest.writeTypedList(this.labels); - dest.writeParcelable(this.issue, flags); - } - - protected AbstractIssueEvent(Parcel in) { - this.id = in.readLong(); - this.url = in.readString(); - int tmpEvent = in.readInt(); - this.event = tmpEvent == -1 ? null : IssueEventType.values()[tmpEvent]; - this.actor = in.readParcelable(User.class.getClassLoader()); - this.assigner = in.readParcelable(User.class.getClassLoader()); - this.assignee = in.readParcelable(User.class.getClassLoader()); - this.requestedReviewer = in.readParcelable(User.class.getClassLoader()); - this.requestedTeam = in.readParcelable(TeamsModel.class.getClassLoader()); - this.milestone = in.readParcelable(MilestoneModel.class.getClassLoader()); - this.rename = in.readParcelable(RenameModel.class.getClassLoader()); - this.source = in.readParcelable(Issue.class.getClassLoader()); - this.label = in.readParcelable(LabelModel.class.getClassLoader()); - this.commitId = in.readString(); - this.commitUrl = in.readString(); - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - this.issueId = in.readString(); - this.repoId = in.readString(); - this.login = in.readString(); - this.labels = in.createTypedArrayList(LabelModel.CREATOR); - this.issue = in.readParcelable(Issue.class.getClassLoader()); - } - - public static final Creator CREATOR = new Creator() { - @Override public IssueEvent createFromParcel(Parcel source) {return new IssueEvent(source);} - - @Override public IssueEvent[] newArray(int size) {return new IssueEvent[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractLogin.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractLogin.java deleted file mode 100644 index 27b2f1c6e..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractLogin.java +++ /dev/null @@ -1,263 +0,0 @@ -package com.fastaccess.data.dao.model; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; - -import com.fastaccess.App; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.helper.RxHelper; - -import java.util.Date; - -import io.reactivex.Observable; -import io.requery.Column; -import io.requery.Entity; -import io.requery.Key; -import io.requery.Nullable; -import lombok.NoArgsConstructor; - -/** - * Created by Kosh on 16 Mar 2017, 7:36 PM - */ - -@Entity @NoArgsConstructor public abstract class AbstractLogin implements Parcelable { - @Key long id; - @Column String login; - String avatarUrl; - String gravatarId; - String url; - String htmlUrl; - String followersUrl; - String followingUrl; - String gistsUrl; - String starredUrl; - String subscriptionsUrl; - String organizationsUrl; - String reposUrl; - String eventsUrl; - String receivedEventsUrl; - String type; - boolean siteAdmin; - String name; - String company; - String blog; - String location; - String email; - boolean hireable; - String bio; - long publicRepos; - long publicGists; - long followers; - long following; - Date createdAt; - Date updatedAt; - String token; - int contributions; - @Nullable boolean isLoggedIn; - @Nullable boolean isEnterprise; - @Nullable String otpCode; - @Nullable String enterpriseUrl; - - public Observable update(Login login) { - return RxHelper.safeObservable(App.getInstance().getDataStore().update(login) - .toObservable()); - } - - public void save(Login entity) { - App.getInstance().getDataStore() - .delete(Login.class) - .where(Login.LOGIN.eq(entity.getLogin())) - .get() - .single() - .flatMap(integer -> App.getInstance().getDataStore().insert(entity)) - .blockingGet(); - } - - public static Login getUser() { - return App.getInstance().getDataStore() - .select(Login.class) - .where(Login.LOGIN.notNull() - .and(Login.TOKEN.notNull()) - .and(Login.IS_LOGGED_IN.eq(true))) - .get() - .firstOrNull(); - } - - public static Login getUser(@NonNull String login) { - return App.getInstance().getDataStore() - .select(Login.class) - .where(Login.LOGIN.eq(login) - .and(Login.TOKEN.notNull())) - .get() - .firstOrNull(); - } - - public static Observable getAccounts() { - return App.getInstance().getDataStore() - .select(Login.class) - .where(Login.IS_LOGGED_IN.eq(false)) - .orderBy(Login.LOGIN.desc()) - .get() - .observable(); - } - - public static void logout() { - Login login = getUser(); - if (login == null) return; - App.getInstance().getDataStore().toBlocking().delete(PinnedRepos.class) - .where(PinnedRepos.LOGIN.eq(login.getLogin())).get().value(); - App.getInstance().getDataStore().toBlocking().delete(login); - } - - public static boolean hasNormalLogin() { - return App.getInstance().getDataStore() - .count(Login.class) - .where(Login.IS_ENTERPRISE.eq(false) - .or(Login.IS_ENTERPRISE.isNull())) - .get() - .value() > 0; - } - - public static Observable onMultipleLogin(@NonNull Login userModel, boolean isEnterprise, boolean isNew) { - return Observable.fromPublisher(s -> { - Login currentUser = Login.getUser(); - if (currentUser != null) { - currentUser.setIsLoggedIn(false); - App.getInstance().getDataStore() - .toBlocking() - .update(currentUser); - } - if (!isEnterprise) { - PrefGetter.resetEnterprise(); - } - userModel.setIsLoggedIn(true); - if (isNew) { - userModel.setIsEnterprise(isEnterprise); - userModel.setToken(isEnterprise ? PrefGetter.getEnterpriseToken() : PrefGetter.getToken()); - userModel.setOtpCode(isEnterprise ? PrefGetter.getEnterpriseOtpCode() : PrefGetter.getOtpCode()); - userModel.setEnterpriseUrl(isEnterprise ? PrefGetter.getEnterpriseUrl() : null); - App.getInstance().getDataStore() - .toBlocking() - .delete(Login.class) - .where(Login.ID.eq(userModel.getId())) - .get() - .value(); - App.getInstance().getDataStore() - .toBlocking() - .insert(userModel); - } else { - if (isEnterprise) { - PrefGetter.setTokenEnterprise(userModel.token); - PrefGetter.setEnterpriseOtpCode(userModel.otpCode); - PrefGetter.setEnterpriseUrl(userModel.enterpriseUrl); - } else { - PrefGetter.resetEnterprise(); - PrefGetter.setToken(userModel.token); - PrefGetter.setOtpCode(userModel.otpCode); - } - App.getInstance().getDataStore() - .toBlocking() - .update(userModel); - } - s.onNext(true); - s.onComplete(); - }); - } - - @Override public int describeContents() { - return 0; - } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeString(this.login); - dest.writeString(this.avatarUrl); - dest.writeString(this.gravatarId); - dest.writeString(this.url); - dest.writeString(this.htmlUrl); - dest.writeString(this.followersUrl); - dest.writeString(this.followingUrl); - dest.writeString(this.gistsUrl); - dest.writeString(this.starredUrl); - dest.writeString(this.subscriptionsUrl); - dest.writeString(this.organizationsUrl); - dest.writeString(this.reposUrl); - dest.writeString(this.eventsUrl); - dest.writeString(this.receivedEventsUrl); - dest.writeString(this.type); - dest.writeByte(this.siteAdmin ? (byte) 1 : (byte) 0); - dest.writeString(this.name); - dest.writeString(this.company); - dest.writeString(this.blog); - dest.writeString(this.location); - dest.writeString(this.email); - dest.writeByte(this.hireable ? (byte) 1 : (byte) 0); - dest.writeString(this.bio); - dest.writeLong(this.publicRepos); - dest.writeLong(this.publicGists); - dest.writeLong(this.followers); - dest.writeLong(this.following); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1); - dest.writeString(this.token); - dest.writeInt(this.contributions); - dest.writeByte(this.isLoggedIn ? (byte) 1 : (byte) 0); - dest.writeByte(this.isEnterprise ? (byte) 1 : (byte) 0); - dest.writeString(this.otpCode); - dest.writeString(this.enterpriseUrl); - } - - protected AbstractLogin(Parcel in) { - this.id = in.readLong(); - this.login = in.readString(); - this.avatarUrl = in.readString(); - this.gravatarId = in.readString(); - this.url = in.readString(); - this.htmlUrl = in.readString(); - this.followersUrl = in.readString(); - this.followingUrl = in.readString(); - this.gistsUrl = in.readString(); - this.starredUrl = in.readString(); - this.subscriptionsUrl = in.readString(); - this.organizationsUrl = in.readString(); - this.reposUrl = in.readString(); - this.eventsUrl = in.readString(); - this.receivedEventsUrl = in.readString(); - this.type = in.readString(); - this.siteAdmin = in.readByte() != 0; - this.name = in.readString(); - this.company = in.readString(); - this.blog = in.readString(); - this.location = in.readString(); - this.email = in.readString(); - this.hireable = in.readByte() != 0; - this.bio = in.readString(); - this.publicRepos = in.readLong(); - this.publicGists = in.readLong(); - this.followers = in.readLong(); - this.following = in.readLong(); - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - long tmpUpdatedAt = in.readLong(); - this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt); - this.token = in.readString(); - this.contributions = in.readInt(); - this.isLoggedIn = in.readByte() != 0; - this.isEnterprise = in.readByte() != 0; - this.otpCode = in.readString(); - this.enterpriseUrl = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override - public Login createFromParcel(Parcel source) { - return new Login(source); - } - - @Override - public Login[] newArray(int size) { - return new Login[size]; - } - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractNotification.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractNotification.java deleted file mode 100644 index 41bb69652..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractNotification.java +++ /dev/null @@ -1,195 +0,0 @@ -package com.fastaccess.data.dao.model; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.App; -import com.fastaccess.data.dao.NotificationSubjectModel; -import com.fastaccess.data.dao.converters.NotificationSubjectConverter; -import com.fastaccess.data.dao.converters.RepoConverter; -import com.fastaccess.data.dao.types.NotificationReason; -import com.fastaccess.helper.RxHelper; - -import java.util.Date; -import java.util.List; - -import io.reactivex.Observable; -import io.reactivex.Single; -import io.reactivex.disposables.Disposable; -import io.requery.BlockingEntityStore; -import io.requery.Convert; -import io.requery.Entity; -import io.requery.Key; -import io.requery.Nullable; -import io.requery.Persistable; -import lombok.NoArgsConstructor; - -/** - * Created by Kosh on 16 Mar 2017, 7:37 PM - */ - -@Entity @NoArgsConstructor public abstract class AbstractNotification implements Parcelable { - @Key long id; - @Convert(RepoConverter.class) Repo repository; - @Convert(NotificationSubjectConverter.class) NotificationSubjectModel subject; - NotificationReason reason; - String url; - boolean unread; - Date updatedAt; - Date lastReadAt; - @Nullable boolean isSubscribed; - - public Disposable save(Notification entity) { - return RxHelper.getSingle(Single.fromPublisher(s -> { - try { - BlockingEntityStore dataStore = App.getInstance().getDataStore().toBlocking(); - dataStore.delete(Notification.class).where(Notification.ID.eq(entity.getId())).get().value(); - dataStore.insert(entity); - s.onNext(true); - } catch (Exception e) { - e.printStackTrace(); - s.onError(e); - } - s.onComplete(); - })).subscribe(o -> {/*do nothing*/}, Throwable::printStackTrace); - } - - public static Disposable markAsRead(long id) { - return RxHelper.getSingle(Single.fromPublisher(s -> { - try { - BlockingEntityStore dataStore = App.getInstance().getDataStore().toBlocking(); - Notification current = dataStore.select(Notification.class).where(Notification.ID.eq(id)).get().firstOrNull(); - if (current != null) { - current.setUnread(false); - dataStore.update(current); - } - s.onNext(true); - } catch (Exception e) { - e.printStackTrace(); - s.onError(e); - } - s.onComplete(); - })).subscribe(o -> {/*do nothing*/}, Throwable::printStackTrace); - } - - public static Disposable save(@androidx.annotation.Nullable List models) { - if (models == null || models.isEmpty()) { - return Observable.empty().subscribe(); - } - return RxHelper.getSingle(Single.fromPublisher(s -> { - try { - BlockingEntityStore dataStore = App.getInstance().getDataStore().toBlocking(); - for (Notification entity : models) { - dataStore.delete(Notification.class).where(Notification.ID.eq(entity.getId())).get().value(); - } - dataStore.insert(models); - s.onNext(true); - } catch (Exception e) { - e.printStackTrace(); - s.onError(e); - } - s.onComplete(); - })).subscribe(o -> {/*do nothing*/}, Throwable::printStackTrace); - } - - public static Single saveAsSingle(@androidx.annotation.Nullable List models) { - if (models == null || models.isEmpty()) { - return Single.just(true); - } - return RxHelper.getSingle(Single.fromPublisher(s -> { - try { - BlockingEntityStore dataStore = App.getInstance().getDataStore().toBlocking(); - for (Notification entity : models) { - dataStore.delete(Notification.class).where(Notification.ID.eq(entity.getId())).get().value(); - } - dataStore.insert(models); - s.onNext(true); - } catch (Exception e) { - e.printStackTrace(); - s.onError(e); - } - s.onComplete(); - })); - } - - public static Single> getUnreadNotifications() { - return App.getInstance() - .getDataStore() - .select(Notification.class) - .where(Notification.UNREAD.eq(true)) - .orderBy(Notification.UPDATED_AT.desc()) - .get() - .observable() - .toList(); - } - - public static Single> getAllNotifications() { - return App.getInstance() - .getDataStore() - .select(Notification.class) - .orderBy(Notification.UPDATED_AT.desc(), Notification.UNREAD.eq(false).getLeftOperand()) - .get() - .observable() - .toList(); - } - - public static boolean hasUnreadNotifications() { - return App.getInstance() - .getDataStore() - .toBlocking() - .count(Notification.class) - .where(Notification.UNREAD.equal(true)) - .get() - .value() > 0; - } - - public static void deleteAll() { - App.getInstance().getDataStore().toBlocking().delete(Notification.class).get().value(); - } - - @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Notification that = (Notification) o; - return repository != null && that.repository != null && repository.getId() == that.repository.getId(); - } - - @Override public int hashCode() { - return repository != null ? (int) repository.getId() : 0; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeParcelable(this.repository, flags); - dest.writeParcelable(this.subject, flags); - dest.writeInt(this.reason == null ? -1 : this.reason.ordinal()); - dest.writeString(this.url); - dest.writeByte(this.unread ? (byte) 1 : (byte) 0); - dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1); - dest.writeLong(this.lastReadAt != null ? this.lastReadAt.getTime() : -1); - dest.writeByte(this.isSubscribed ? (byte) 1 : (byte) 0); - } - - protected AbstractNotification(Parcel in) { - this.id = in.readLong(); - this.repository = in.readParcelable(Repo.class.getClassLoader()); - this.subject = in.readParcelable(NotificationSubjectModel.class.getClassLoader()); - int tmpReason = in.readInt(); - this.reason = tmpReason == -1 ? null : NotificationReason.values()[tmpReason]; - this.url = in.readString(); - this.unread = in.readByte() != 0; - long tmpUpdatedAt = in.readLong(); - this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt); - long tmpLastReadAt = in.readLong(); - this.lastReadAt = tmpLastReadAt == -1 ? null : new Date(tmpLastReadAt); - this.isSubscribed = in.readByte() != 0; - } - - public static final Creator CREATOR = new Creator() { - @Override public Notification createFromParcel(Parcel source) {return new Notification(source);} - - @Override public Notification[] newArray(int size) {return new Notification[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractNotificationQueue.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractNotificationQueue.java deleted file mode 100644 index 350bc73b9..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractNotificationQueue.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.fastaccess.data.dao.model; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.Nullable; - -import com.fastaccess.App; -import com.fastaccess.helper.RxHelper; - -import java.util.Date; -import java.util.List; - -import io.reactivex.Observable; -import io.requery.BlockingEntityStore; -import io.requery.Entity; -import io.requery.Key; -import io.requery.Persistable; -import lombok.NoArgsConstructor; - -/** - * Created by Kosh on 03.11.17. - */ - -@Entity @NoArgsConstructor public abstract class AbstractNotificationQueue implements Parcelable { - @Key long notificationId; - Date date; - - public static boolean exists(long notificationId) { - return App.getInstance().getDataStore().toBlocking().select(NotificationQueue.class) - .where(NotificationQueue.NOTIFICATION_ID.eq(notificationId)) - .get().firstOrNull() != null; - } - - public static Observable put(@Nullable List models) { - if (models == null || models.isEmpty()) { - return Observable.empty(); - } - return RxHelper.getObservable(Observable.fromPublisher(s -> { - try { - BlockingEntityStore dataStore = App.getInstance().getDataStore().toBlocking(); - dataStore.delete(NotificationQueue.class).get().value(); - for (Notification entity : models) { - NotificationQueue notificationQueue = new NotificationQueue(); - notificationQueue.setNotificationId(entity.getId()); - notificationQueue.setDate(entity.getUpdatedAt()); - dataStore.insert(notificationQueue); - } - s.onNext(true); - } catch (Exception e) { - e.printStackTrace(); - s.onError(e); - } - s.onComplete(); - })); - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.notificationId); - dest.writeLong(this.date != null ? this.date.getTime() : -1); - } - - protected AbstractNotificationQueue(Parcel in) { - this.notificationId = in.readLong(); - long tmpDate = in.readLong(); - this.date = tmpDate == -1 ? null : new Date(tmpDate); - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override public NotificationQueue createFromParcel(Parcel source) {return new NotificationQueue(source);} - - @Override public NotificationQueue[] newArray(int size) {return new NotificationQueue[size];} - }; - -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractPinnedGists.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractPinnedGists.java deleted file mode 100644 index 8cd2282e2..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractPinnedGists.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.fastaccess.data.dao.model; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.App; -import com.fastaccess.data.dao.converters.GistConverter; - -import java.util.List; - -import io.reactivex.Single; -import io.requery.Convert; -import io.requery.Entity; -import io.requery.Generated; -import io.requery.Key; -import lombok.NoArgsConstructor; - -import static com.fastaccess.data.dao.model.PinnedGists.ENTRY_COUNT; -import static com.fastaccess.data.dao.model.PinnedGists.ID; -import static com.fastaccess.data.dao.model.PinnedGists.LOGIN; - -/** - * Created by Hashemsergani on 14.10.17. - */ - -@Entity @NoArgsConstructor public class AbstractPinnedGists { - - @Key @Generated long id; - @io.requery.Nullable int entryCount; - @io.requery.Nullable String login; - @io.requery.Nullable @Convert(GistConverter.class) Gist gist; - @io.requery.Nullable long gistId; - - public static void pinUpin(@NonNull Gist gist) { - PinnedGists pinnedIssues = get(gist.getGistId().hashCode()); - if (pinnedIssues == null) { - PinnedGists pinned = new PinnedGists(); - pinned.setLogin(Login.getUser().getLogin()); - pinned.setGist(gist); - pinned.setGistId(gist.getGistId().hashCode()); - try { - App.getInstance().getDataStore().toBlocking().insert(pinned); - } catch (Exception ignored) {} - } else { - delete(gist.getGistId().hashCode()); - } - } - - @Nullable public static PinnedGists get(long gistId) { - return App.getInstance().getDataStore().select(PinnedGists.class) - .where(PinnedGists.GIST_ID.eq(gistId)) - .get() - .firstOrNull(); - } - - public static void delete(long gistId) { - App.getInstance().getDataStore().delete(PinnedGists.class) - .where(PinnedGists.GIST_ID.eq(gistId)) - .get() - .value(); - } - - @NonNull public static Single> getMyPinnedGists() { - return App.getInstance().getDataStore().select(PinnedGists.class) - .where(LOGIN.eq(Login.getUser().getLogin()).or(LOGIN.isNull())) - .orderBy(ENTRY_COUNT.desc(), ID.desc()) - .get() - .observable() - .map(PinnedGists::getGist) - .toList(); - } - - public static boolean isPinned(long gistId) { - return get(gistId) != null; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractPinnedIssues.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractPinnedIssues.java deleted file mode 100644 index 7617675e6..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractPinnedIssues.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.fastaccess.data.dao.model; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.App; -import com.fastaccess.data.dao.converters.IssueConverter; -import com.fastaccess.helper.RxHelper; - -import java.util.List; - -import io.reactivex.Observable; -import io.reactivex.Single; -import io.reactivex.disposables.Disposable; -import io.requery.Convert; -import io.requery.Entity; -import io.requery.Generated; -import io.requery.Key; -import lombok.NoArgsConstructor; - -import static com.fastaccess.data.dao.model.PinnedIssues.ENTRY_COUNT; -import static com.fastaccess.data.dao.model.PinnedIssues.ID; -import static com.fastaccess.data.dao.model.PinnedIssues.LOGIN; - -/** - * Created by Hashemsergani on 14.10.17. - */ - -@Entity @NoArgsConstructor public class AbstractPinnedIssues { - - @Key @Generated long id; - @io.requery.Nullable int entryCount; - @io.requery.Nullable String login; - @io.requery.Nullable @Convert(IssueConverter.class) Issue issue; - @io.requery.Nullable long issueId; - - public static void pinUpin(@NonNull Issue issue) { - PinnedIssues pinnedIssues = get(issue.getId()); - if (pinnedIssues == null) { - PinnedIssues pinned = new PinnedIssues(); - pinned.setLogin(Login.getUser().getLogin()); - pinned.setIssue(issue); - pinned.setIssueId(issue.getId()); - try { - App.getInstance().getDataStore().toBlocking().insert(pinned); - } catch (Exception ignored) {} - } else { - delete(issue.getId()); - } - } - - @Nullable public static PinnedIssues get(long issueId) { - return App.getInstance().getDataStore().select(PinnedIssues.class) - .where(PinnedIssues.ISSUE_ID.eq(issueId)) - .get() - .firstOrNull(); - } - - public static void delete(long issueId) { - App.getInstance().getDataStore().delete(PinnedIssues.class) - .where(PinnedIssues.ISSUE_ID.eq(issueId)) - .get() - .value(); - } - - @NonNull public static Disposable updateEntry(long issueId) { - return RxHelper.getObservable(Observable.fromPublisher(e -> { - PinnedIssues pinned = get(issueId); - if (pinned != null) { - pinned.setEntryCount(pinned.getEntryCount() + 1); - App.getInstance().getDataStore().toBlocking().update(pinned); - e.onNext(""); - } - e.onComplete(); - })).subscribe(o -> {/*do nothing*/}, Throwable::printStackTrace); - } - - @NonNull public static Single> getMyPinnedIssues() { - return App.getInstance().getDataStore().select(PinnedIssues.class) - .where(LOGIN.eq(Login.getUser().getLogin()).or(LOGIN.isNull())) - .orderBy(ENTRY_COUNT.desc(), ID.desc()) - .get() - .observable() - .map(PinnedIssues::getIssue) - .toList(); - } - - public static boolean isPinned(long issueId) { - return get(issueId) != null; - } - -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractPinnedPullRequests.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractPinnedPullRequests.java deleted file mode 100644 index 3df8d59de..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractPinnedPullRequests.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.fastaccess.data.dao.model; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.App; -import com.fastaccess.data.dao.converters.PullRequestConverter; -import com.fastaccess.helper.RxHelper; - -import java.util.List; - -import io.reactivex.Observable; -import io.reactivex.Single; -import io.reactivex.disposables.Disposable; -import io.requery.Convert; -import io.requery.Entity; -import io.requery.Generated; -import io.requery.Key; -import lombok.NoArgsConstructor; - -import static com.fastaccess.data.dao.model.PinnedPullRequests.ENTRY_COUNT; -import static com.fastaccess.data.dao.model.PinnedPullRequests.ID; -import static com.fastaccess.data.dao.model.PinnedPullRequests.LOGIN; - -/** - * Created by Hashemsergani on 14.10.17. - */ - -@Entity @NoArgsConstructor public class AbstractPinnedPullRequests { - - @Key @Generated long id; - @io.requery.Nullable int entryCount; - @io.requery.Nullable String login; - @io.requery.Nullable @Convert(PullRequestConverter.class) PullRequest pullRequest; - @io.requery.Nullable long pullRequestId; - - public static void pinUpin(@NonNull PullRequest pullRequest) { - PinnedPullRequests pinnedPullRequests = get(pullRequest.getId()); - if (pinnedPullRequests == null) { - PinnedPullRequests pinned = new PinnedPullRequests(); - pinned.setLogin(Login.getUser().getLogin()); - pinned.setPullRequest(pullRequest); - pinned.setPullRequestId(pullRequest.getId()); - try { - App.getInstance().getDataStore().toBlocking().insert(pinned); - } catch (Exception ignored) {} - } else { - delete(pullRequest.getId()); - } - } - - @Nullable public static PinnedPullRequests get(long pullRequestId) { - return App.getInstance().getDataStore().select(PinnedPullRequests.class) - .where(PinnedPullRequests.PULL_REQUEST_ID.eq(pullRequestId)) - .get() - .firstOrNull(); - } - - public static void delete(long pullRequestId) { - App.getInstance().getDataStore().delete(PinnedPullRequests.class) - .where(PinnedPullRequests.PULL_REQUEST_ID.eq(pullRequestId)) - .get() - .value(); - } - - @NonNull public static Disposable updateEntry(@NonNull long pullRequestId) { - return RxHelper.getObservable(Observable.fromPublisher(e -> { - PinnedPullRequests pinned = get(pullRequestId); - if (pinned != null) { - pinned.setEntryCount(pinned.getEntryCount() + 1); - App.getInstance().getDataStore().toBlocking().update(pinned); - e.onNext(""); - } - e.onComplete(); - })).subscribe(o -> {/*do nothing*/}, Throwable::printStackTrace); - } - - @NonNull public static Single> getMyPinnedPullRequests() { - return App.getInstance().getDataStore().select(PinnedPullRequests.class) - .where(LOGIN.eq(Login.getUser().getLogin()).or(LOGIN.isNull())) - .orderBy(ENTRY_COUNT.desc(), ID.desc()) - .get() - .observable() - .map(PinnedPullRequests::getPullRequest) - .toList(); - } - - public static boolean isPinned(long pullRequestId) { - return get(pullRequestId) != null; - } - -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractPinnedRepos.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractPinnedRepos.java deleted file mode 100644 index 877202e55..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractPinnedRepos.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.fastaccess.data.dao.model; - -import android.os.Parcelable; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.App; -import com.fastaccess.data.dao.converters.RepoConverter; -import com.fastaccess.helper.Logger; -import com.fastaccess.helper.RxHelper; - -import java.util.List; - -import io.reactivex.Observable; -import io.reactivex.Single; -import io.reactivex.disposables.Disposable; -import io.requery.BlockingEntityStore; -import io.requery.Column; -import io.requery.Convert; -import io.requery.Entity; -import io.requery.Generated; -import io.requery.Key; -import io.requery.Persistable; -import lombok.NoArgsConstructor; - -import static com.fastaccess.data.dao.model.PinnedRepos.ENTRY_COUNT; -import static com.fastaccess.data.dao.model.PinnedRepos.ID; -import static com.fastaccess.data.dao.model.PinnedRepos.LOGIN; -import static com.fastaccess.data.dao.model.PinnedRepos.REPO_FULL_NAME; - -/** - * Created by Kosh on 25 Mar 2017, 7:29 PM - */ - -@Entity @NoArgsConstructor public abstract class AbstractPinnedRepos implements Parcelable { - @Key @Generated long id; - @Column(unique = false) String repoFullName; - @Convert(RepoConverter.class) Repo pinnedRepo; - @io.requery.Nullable int entryCount; - @io.requery.Nullable String login; - - public static Single update(@NonNull PinnedRepos entity) { - return RxHelper.getSingle(App.getInstance().getDataStore().update(entity)); - } - - public static boolean pinUpin(@NonNull Repo repo) { - PinnedRepos pinnedRepos = get(repo.getFullName()); - if (pinnedRepos == null) { - PinnedRepos pinned = new PinnedRepos(); - pinned.setRepoFullName(repo.getFullName()); - pinned.setLogin(Login.getUser().getLogin()); - pinned.setPinnedRepo(repo); - try { - App.getInstance().getDataStore().toBlocking().insert(pinned); - return true; - } catch (Exception ignored) {} - return false; - } else { - delete(pinnedRepos.getId()); - return false; - } - } - - @Nullable public static PinnedRepos get(long id) { - return App.getInstance().getDataStore().select(PinnedRepos.class) - .where(ID.eq(id)) - .get() - .firstOrNull(); - } - - @Nullable public static PinnedRepos get(@NonNull String repoFullName) { - return App.getInstance().getDataStore().toBlocking().select(PinnedRepos.class) - .where(REPO_FULL_NAME.eq(repoFullName).and(LOGIN.eq(Login.getUser().getLogin())) - .or(REPO_FULL_NAME.eq(repoFullName))) - .get() - .firstOrNull(); - } - - public static boolean isPinned(@NonNull String repoFullName) { - return get(repoFullName) != null; - } - - @NonNull public static Disposable updateEntry(@NonNull String repoFullName) { - return RxHelper.getObservable(Observable.fromPublisher(e -> { - PinnedRepos pinned = get(repoFullName); - if (pinned != null) { - pinned.setEntryCount(pinned.getEntryCount() + 1); - App.getInstance().getDataStore().toBlocking().update(pinned); - e.onNext(""); - } - e.onComplete(); - })).subscribe(o -> {/*do nothing*/}, Throwable::printStackTrace); - } - - @NonNull public static Single> getMyPinnedRepos() { - return App.getInstance().getDataStore().select(PinnedRepos.class) - .where(LOGIN.eq(Login.getUser().getLogin()) - .or(LOGIN.isNull())) - .orderBy(ENTRY_COUNT.desc(), ID.desc()) - .get() - .observable() - .toList(); - - } - - @NonNull public static Observable> getMenuRepos() { - return App.getInstance().getDataStore().select(PinnedRepos.class) - .where(LOGIN.eq(Login.getUser().getLogin())) - .orderBy(ENTRY_COUNT.desc(), ID.desc()) - .limit(5) - .get() - .observable() - .toList() - .toObservable(); - } - - public static void migrateToVersion4() { - RxHelper.getObservable(Observable.fromPublisher(e -> { - try { - Login login = Login.getUser(); - if (login == null) { - e.onComplete(); - return; - } - BlockingEntityStore reactiveEntityStore = App.getInstance().getDataStore().toBlocking(); - List pinnedRepos = reactiveEntityStore.select(PinnedRepos.class) - .where(LOGIN.isNull()) - .get() - .toList(); - if (pinnedRepos != null) { - for (PinnedRepos pinnedRepo : pinnedRepos) { - pinnedRepo.setRepoFullName(login.getLogin()); - reactiveEntityStore.update(pinnedRepo); - } - } - Logger.e("Hello"); - } catch (Exception ignored) { - e.onError(ignored); - } - e.onComplete(); - })).subscribe(o -> {/*do nothing*/}, Throwable::printStackTrace); - } - - public static void delete(long id) { - App.getInstance().getDataStore().delete(PinnedRepos.class) - .where(ID.eq(id)) - .get() - .value(); - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractPullRequest.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractPullRequest.java deleted file mode 100644 index 8d4b8c071..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractPullRequest.java +++ /dev/null @@ -1,335 +0,0 @@ -package com.fastaccess.data.dao.model; - -import android.content.Context; -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; - -import com.fastaccess.App; -import com.fastaccess.R; -import com.fastaccess.data.dao.LabelListModel; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.data.dao.PullsIssuesParser; -import com.fastaccess.data.dao.ReactionsModel; -import com.fastaccess.data.dao.UsersListModel; -import com.fastaccess.data.dao.converters.CommitConverter; -import com.fastaccess.data.dao.converters.LabelsListConverter; -import com.fastaccess.data.dao.converters.MilestoneConverter; -import com.fastaccess.data.dao.converters.PullRequestConverter; -import com.fastaccess.data.dao.converters.ReactionsConverter; -import com.fastaccess.data.dao.converters.UserConverter; -import com.fastaccess.data.dao.converters.UsersConverter; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.ui.widgets.SpannableBuilder; - -import java.util.Date; -import java.util.List; - -import io.reactivex.Observable; -import io.reactivex.Single; -import io.reactivex.disposables.Disposable; -import io.requery.BlockingEntityStore; -import io.requery.Column; -import io.requery.Convert; -import io.requery.Entity; -import io.requery.Key; -import io.requery.Persistable; -import lombok.NoArgsConstructor; - -import static com.fastaccess.data.dao.model.PullRequest.ID; -import static com.fastaccess.data.dao.model.PullRequest.LOGIN; -import static com.fastaccess.data.dao.model.PullRequest.NUMBER; -import static com.fastaccess.data.dao.model.PullRequest.REPO_ID; -import static com.fastaccess.data.dao.model.PullRequest.STATE; -import static com.fastaccess.data.dao.model.PullRequest.UPDATED_AT; - -/** - * Created by Kosh on 16 Mar 2017, 7:39 PM - */ - -@Entity @NoArgsConstructor public abstract class AbstractPullRequest implements Parcelable { - @Key long id; - String url; - String body; - String title; - int comments; - int number; - boolean locked; - boolean mergable; - boolean merged; - boolean mergeable; - int commits; - int additions; - int deletions; - IssueState state; - String bodyHtml; - String htmlUrl; - Date closedAt; - Date createdAt; - Date updatedAt; - int changedFiles; - String diffUrl; - String patchUrl; - String mergeCommitSha; - Date mergedAt; - String mergeState; - int reviewComments; - String repoId; - String login; - String mergeableState; - @Convert(UsersConverter.class) UsersListModel assignees; - @Convert(UserConverter.class) User mergedBy; - @Convert(UserConverter.class) User closedBy; - @Column(name = "user_column") @Convert(UserConverter.class) User user; - @Convert(UserConverter.class) User assignee; - @Convert(LabelsListConverter.class) LabelListModel labels; - @Convert(MilestoneConverter.class) MilestoneModel milestone; - @Convert(CommitConverter.class) Commit base; - @Convert(CommitConverter.class) Commit head; - @Convert(PullRequestConverter.class) PullRequest pullRequest; - @Convert(ReactionsConverter.class) ReactionsModel reactions; - - public Single save(PullRequest entity) { - return RxHelper.getSingle(App.getInstance().getDataStore() - .delete(PullRequest.class) - .where(PullRequest.ID.eq(entity.getId())) - .get() - .single() - .flatMap(observer -> App.getInstance().getDataStore().insert(entity))); - } - - public static Disposable save(@NonNull List models, @NonNull String repoId, @NonNull String login) { - return RxHelper.getSingle(Single.fromPublisher(s -> { - try { - BlockingEntityStore dataSource = App.getInstance().getDataStore().toBlocking(); - dataSource.delete(PullRequest.class) - .where(REPO_ID.equal(repoId) - .and(LOGIN.equal(login))) - .get() - .value(); - if (!models.isEmpty()) { - for (PullRequest pullRequest : models) { - dataSource.delete(PullRequest.class).where(PullRequest.ID.eq(pullRequest.getId())).get().value(); - pullRequest.setRepoId(repoId); - pullRequest.setLogin(login); - dataSource.insert(pullRequest); - } - } - s.onNext(""); - } catch (Exception e) { - s.onError(e); - } - s.onComplete(); - })).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace); - } - - public static Single> getPullRequests(@NonNull String repoId, @NonNull String login, - @NonNull IssueState issueState) { - return App.getInstance().getDataStore() - .select(PullRequest.class) - .where(REPO_ID.equal(repoId) - .and(LOGIN.equal(login)) - .and(STATE.equal(issueState))) - .orderBy(UPDATED_AT.desc()) - .get() - .observable() - .toList(); - } - - public static Observable getPullRequestById(long id) { - return App.getInstance().getDataStore() - .select(PullRequest.class) - .where(ID.eq(id)) - .get() - .observable(); - } - - public static Observable getPullRequestByNumber(int number, @NonNull String repoId, @NonNull String login) { - return App.getInstance().getDataStore() - .select(PullRequest.class) - .where(REPO_ID.equal(repoId) - .and(LOGIN.equal(login)) - .and(NUMBER.equal(number))) - .get() - .observable(); - } - - @NonNull public static SpannableBuilder getMergeBy(@NonNull PullRequest pullRequest, @NonNull Context context, boolean showRepoName) { - boolean isMerge = pullRequest.isMerged() || !InputHelper.isEmpty(pullRequest.mergedAt); - if (isMerge) { - User merger = pullRequest.getMergedBy(); - SpannableBuilder builder = SpannableBuilder.builder(); - if (showRepoName) { - PullsIssuesParser parser = PullsIssuesParser.getForPullRequest(pullRequest.getHtmlUrl()); - if (parser != null) - builder.bold(parser.getLogin()) - .append("/") - .bold(parser.getRepoId()) - .append(" ") - .bold("#").bold(String.valueOf(pullRequest.getNumber())) - .append(" "); - } else { - builder.bold("#" + pullRequest.getNumber()) - .append(" ") - .append(merger != null ? merger.getLogin() + " " : ""); - } - builder.append(context.getString(R.string.merged).toLowerCase()) - .append(" "); - if (pullRequest.getHead() != null) { - builder.bold(pullRequest.getHead().getRef()) - .append(" ") - .append(context.getString(R.string.to)) - .append(" ") - .bold(pullRequest.getBase().getRef()) - .append(" "); - } - builder.append(ParseDateFormat.getTimeAgo(pullRequest.getMergedAt())); - return builder; - } else { - User user = pullRequest.getUser(); - String status = context.getString(pullRequest.getState().getStatus()); - SpannableBuilder builder = SpannableBuilder.builder(); - if (showRepoName) { - PullsIssuesParser parser = PullsIssuesParser.getForPullRequest(pullRequest.getHtmlUrl()); - if (parser != null) { - builder.bold(parser.getLogin()) - .append("/") - .bold(parser.getRepoId()) - .append(" ") - .bold("#").bold(String.valueOf(pullRequest.getNumber())) - .append(" "); - } - } else { - builder.bold("#" + pullRequest.getNumber()) - .append(" ") - .append(user.getLogin()) - .append(" "); - } - if (pullRequest.getState() == IssueState.open && pullRequest.getHead() != null && pullRequest.getBase() != null) { - return builder - .append(context.getString(R.string.want_to_merge)) - .append(" ") - .bold(pullRequest.getHead().getRef()) - .append(" ") - .append(context.getString(R.string.to)) - .append(" ") - .bold(pullRequest.getBase().getRef()) - .append(" ") - .append(ParseDateFormat.getTimeAgo(pullRequest.getState() == IssueState.closed - ? pullRequest.getClosedAt() : pullRequest.getCreatedAt())); - } else { - return builder - .bold(status.toLowerCase()) - .append(" ") - .bold(pullRequest.getHead() != null ? pullRequest.getHead().getRef() : "") - .append(" ") - .append(ParseDateFormat.getTimeAgo(pullRequest.getState() == IssueState.closed - ? pullRequest.getClosedAt() : pullRequest.getCreatedAt())); - } - } - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeString(this.url); - dest.writeString(this.body); - dest.writeString(this.title); - dest.writeInt(this.comments); - dest.writeInt(this.number); - dest.writeByte(this.locked ? (byte) 1 : (byte) 0); - dest.writeByte(this.mergable ? (byte) 1 : (byte) 0); - dest.writeByte(this.merged ? (byte) 1 : (byte) 0); - dest.writeByte(this.mergeable ? (byte) 1 : (byte) 0); - dest.writeInt(this.commits); - dest.writeInt(this.additions); - dest.writeInt(this.deletions); - dest.writeInt(this.state == null ? -1 : this.state.ordinal()); - dest.writeString(this.bodyHtml); - dest.writeString(this.htmlUrl); - dest.writeLong(this.closedAt != null ? this.closedAt.getTime() : -1); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1); - dest.writeInt(this.changedFiles); - dest.writeString(this.diffUrl); - dest.writeString(this.patchUrl); - dest.writeString(this.mergeCommitSha); - dest.writeLong(this.mergedAt != null ? this.mergedAt.getTime() : -1); - dest.writeString(this.mergeState); - dest.writeInt(this.reviewComments); - dest.writeString(this.repoId); - dest.writeString(this.login); - dest.writeString(this.mergeableState); - dest.writeList(this.assignees); - dest.writeParcelable(this.mergedBy, flags); - dest.writeParcelable(this.closedBy, flags); - dest.writeParcelable(this.user, flags); - dest.writeParcelable(this.assignee, flags); - dest.writeList(this.labels); - dest.writeParcelable(this.milestone, flags); - dest.writeParcelable(this.base, flags); - dest.writeParcelable(this.head, flags); - dest.writeParcelable(this.pullRequest, flags); - dest.writeParcelable(this.reactions, flags); - } - - protected AbstractPullRequest(Parcel in) { - this.id = in.readLong(); - this.url = in.readString(); - this.body = in.readString(); - this.title = in.readString(); - this.comments = in.readInt(); - this.number = in.readInt(); - this.locked = in.readByte() != 0; - this.mergable = in.readByte() != 0; - this.merged = in.readByte() != 0; - this.mergeable = in.readByte() != 0; - this.commits = in.readInt(); - this.additions = in.readInt(); - this.deletions = in.readInt(); - int tmpState = in.readInt(); - this.state = tmpState == -1 ? null : IssueState.values()[tmpState]; - this.bodyHtml = in.readString(); - this.htmlUrl = in.readString(); - long tmpClosedAt = in.readLong(); - this.closedAt = tmpClosedAt == -1 ? null : new Date(tmpClosedAt); - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - long tmpUpdatedAt = in.readLong(); - this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt); - this.changedFiles = in.readInt(); - this.diffUrl = in.readString(); - this.patchUrl = in.readString(); - this.mergeCommitSha = in.readString(); - long tmpMergedAt = in.readLong(); - this.mergedAt = tmpMergedAt == -1 ? null : new Date(tmpMergedAt); - this.mergeState = in.readString(); - this.reviewComments = in.readInt(); - this.repoId = in.readString(); - this.login = in.readString(); - this.mergeableState = in.readString(); - this.assignees = new UsersListModel(); - in.readList(this.assignees, this.assignees.getClass().getClassLoader()); - this.mergedBy = in.readParcelable(User.class.getClassLoader()); - this.closedBy = in.readParcelable(User.class.getClassLoader()); - this.user = in.readParcelable(User.class.getClassLoader()); - this.assignee = in.readParcelable(User.class.getClassLoader()); - this.labels = new LabelListModel(); - in.readList(this.labels, this.labels.getClass().getClassLoader()); - this.milestone = in.readParcelable(MilestoneModel.class.getClassLoader()); - this.base = in.readParcelable(Commit.class.getClassLoader()); - this.head = in.readParcelable(Commit.class.getClassLoader()); - this.pullRequest = in.readParcelable(PullRequest.class.getClassLoader()); - this.reactions = in.readParcelable(ReactionsModel.class.getClassLoader()); - } - - public static final Creator CREATOR = new Creator() { - @Override public PullRequest createFromParcel(Parcel source) {return new PullRequest(source);} - - @Override public PullRequest[] newArray(int size) {return new PullRequest[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractRelease.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractRelease.java deleted file mode 100644 index 321796fcb..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractRelease.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.fastaccess.data.dao.model; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; - -import com.fastaccess.App; -import com.fastaccess.data.dao.ReleasesAssetsListModel; -import com.fastaccess.data.dao.converters.ReleasesAssetsConverter; -import com.fastaccess.data.dao.converters.UserConverter; -import com.fastaccess.helper.RxHelper; -import com.google.gson.annotations.SerializedName; - -import java.util.Date; -import java.util.List; - -import io.reactivex.Completable; -import io.reactivex.Observable; -import io.reactivex.Single; -import io.reactivex.disposables.Disposable; -import io.requery.BlockingEntityStore; -import io.requery.Convert; -import io.requery.Entity; -import io.requery.Key; -import io.requery.Persistable; -import io.requery.Table; -import lombok.NoArgsConstructor; - -import static com.fastaccess.data.dao.model.Release.CREATED_AT; -import static com.fastaccess.data.dao.model.Release.ID; -import static com.fastaccess.data.dao.model.Release.LOGIN; -import static com.fastaccess.data.dao.model.Release.REPO_ID; - -/** - * Created by Kosh on 16 Mar 2017, 7:40 PM - */ - -@Entity @NoArgsConstructor @Table(name = "release_table") -public abstract class AbstractRelease implements Parcelable { - @Key long id; - String url; - String htmlUrl; - String assetsUrl; - String uploadUrl; - String tagName; - String targetCommitish; - String name; - boolean draft; - boolean preRelease; - Date createdAt; - Date publishedAt; - String repoId; - String login; - @SerializedName("tarball_url") String tarballUrl; - @SerializedName("body_html") String body; - @SerializedName("zipball_url") String zipBallUrl; - @Convert(UserConverter.class) User author; - @Convert(ReleasesAssetsConverter.class) ReleasesAssetsListModel assets; - - public static Disposable save(@NonNull List models, @NonNull String repoId, @NonNull String login) { - return RxHelper.getSingle(Single.fromPublisher(s -> { - try { - BlockingEntityStore dataSource = App.getInstance().getDataStore().toBlocking(); - dataSource.delete(Release.class) - .where(Release.REPO_ID.equal(repoId) - .and(Release.LOGIN.equal(login))) - .get() - .value(); - if (!models.isEmpty()) { - for (Release releasesModel : models) { - dataSource.delete(Release.class).where(Release.ID.eq(releasesModel.getId())).get().value(); - releasesModel.setRepoId(repoId); - releasesModel.setLogin(login); - dataSource.insert(releasesModel); - } - } - s.onNext(""); - } catch (Exception e) { - s.onError(e); - } - s.onComplete(); - })).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace); - } - - public static Completable delete(@NonNull String repoId, @NonNull String login) { - return App.getInstance().getDataStore() - .delete(Release.class) - .where(REPO_ID.eq(repoId) - .and(LOGIN.eq(login))) - .get() - .single() - .toCompletable(); - } - - public static Observable get(long id) { - return App.getInstance().getDataStore() - .select(Release.class) - .where(ID.eq(id)) - .get() - .observable(); - } - - public static Single> get(@NonNull String repoId, @NonNull String login) { - return App.getInstance().getDataStore() - .select(Release.class) - .where(REPO_ID.eq(repoId) - .and(LOGIN.eq(login))) - .orderBy(CREATED_AT.desc()) - .get() - .observable() - .toList(); - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeString(this.url); - dest.writeString(this.htmlUrl); - dest.writeString(this.assetsUrl); - dest.writeString(this.uploadUrl); - dest.writeString(this.tagName); - dest.writeString(this.targetCommitish); - dest.writeString(this.name); - dest.writeByte(this.draft ? (byte) 1 : (byte) 0); - dest.writeByte(this.preRelease ? (byte) 1 : (byte) 0); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeLong(this.publishedAt != null ? this.publishedAt.getTime() : -1); - dest.writeString(this.repoId); - dest.writeString(this.login); - dest.writeString(this.tarballUrl); - dest.writeString(this.body); - dest.writeString(this.zipBallUrl); - dest.writeParcelable(this.author, flags); - dest.writeList(this.assets); - } - - protected AbstractRelease(Parcel in) { - this.id = in.readLong(); - this.url = in.readString(); - this.htmlUrl = in.readString(); - this.assetsUrl = in.readString(); - this.uploadUrl = in.readString(); - this.tagName = in.readString(); - this.targetCommitish = in.readString(); - this.name = in.readString(); - this.draft = in.readByte() != 0; - this.preRelease = in.readByte() != 0; - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - long tmpPublishedAt = in.readLong(); - this.publishedAt = tmpPublishedAt == -1 ? null : new Date(tmpPublishedAt); - this.repoId = in.readString(); - this.login = in.readString(); - this.tarballUrl = in.readString(); - this.body = in.readString(); - this.zipBallUrl = in.readString(); - this.author = in.readParcelable(User.class.getClassLoader()); - this.assets = new ReleasesAssetsListModel(); - in.readList(this.assets, this.assets.getClass().getClassLoader()); - } - - public static final Creator CREATOR = new Creator() { - @Override public Release createFromParcel(Parcel source) {return new Release(source);} - - @Override public Release[] newArray(int size) {return new Release[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractRepo.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractRepo.java deleted file mode 100644 index 24bb911b6..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractRepo.java +++ /dev/null @@ -1,419 +0,0 @@ -package com.fastaccess.data.dao.model; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; - -import com.fastaccess.App; -import com.fastaccess.data.dao.LicenseModel; -import com.fastaccess.data.dao.RepoPermissionsModel; -import com.fastaccess.data.dao.TopicsModel; -import com.fastaccess.data.dao.converters.LicenseConverter; -import com.fastaccess.data.dao.converters.RepoConverter; -import com.fastaccess.data.dao.converters.RepoPermissionConverter; -import com.fastaccess.data.dao.converters.TopicsConverter; -import com.fastaccess.data.dao.converters.UserConverter; -import com.fastaccess.helper.RxHelper; -import com.google.gson.annotations.SerializedName; - -import java.util.Date; -import java.util.List; - -import io.reactivex.Maybe; -import io.reactivex.Single; -import io.reactivex.disposables.Disposable; -import io.requery.BlockingEntityStore; -import io.requery.Column; -import io.requery.Convert; -import io.requery.Entity; -import io.requery.Key; -import io.requery.Nullable; -import io.requery.Persistable; -import lombok.NoArgsConstructor; - -import static com.fastaccess.data.dao.model.Repo.FULL_NAME; -import static com.fastaccess.data.dao.model.Repo.ID; -import static com.fastaccess.data.dao.model.Repo.REPOS_OWNER; -import static com.fastaccess.data.dao.model.Repo.STARRED_USER; -import static com.fastaccess.data.dao.model.Repo.STATUSES_URL; -import static com.fastaccess.data.dao.model.Repo.UPDATED_AT; - -/** - * Created by Kosh on 16 Mar 2017, 7:54 PM - */ - -@Entity @NoArgsConstructor public abstract class AbstractRepo implements Parcelable { - @Key long id; - String name; - String fullName; - @SerializedName("private") boolean privateX; - String htmlUrl; - String description; - boolean fork; - String url; - String forksUrl; - String keysUrl; - String collaboratorsUrl; - String teamsUrl; - String hooksUrl; - String issueEventsUrl; - String eventsUrl; - String assigneesUrl; - String branchesUrl; - String tagsUrl; - String blobsUrl; - String gitTagsUrl; - String gitRefsUrl; - String treesUrl; - String statusesUrl; - String languagesUrl; - String stargazersUrl; - String contributorsUrl; - String subscribersUrl; - String subscriptionUrl; - String commitsUrl; - String gitCommitsUrl; - String commentsUrl; - String issueCommentUrl; - String contentsUrl; - String compareUrl; - String mergesUrl; - String archiveUrl; - String downloadsUrl; - String issuesUrl; - String pullsUrl; - String milestonesUrl; - String notificationsUrl; - String labelsUrl; - String releasesUrl; - Date createdAt; - Date updatedAt; - Date pushedAt; - String gitUrl; - String sshUrl; - String cloneUrl; - String svnUrl; - String homepage; - long size; - long stargazersCount; - long watchersCount; - @Column(name = "language_column") String language; - boolean hasIssues; - boolean hasDownloads; - boolean hasWiki; - boolean hasPages; - long forksCount; - String mirrorUrl; - long openIssuesCount; - long forks; - long openIssues; - long watchers; - String defaultBranch; - @Nullable @Convert(TopicsConverter.class) TopicsModel topics; - @Convert(UserConverter.class) User owner; - @Convert(RepoPermissionConverter.class) RepoPermissionsModel permissions; - @Convert(UserConverter.class) User organization; - @Convert(RepoConverter.class) Repo parent; - @Convert(RepoConverter.class) Repo source; - @Convert(LicenseConverter.class) LicenseModel license; - @SerializedName("subscribers_count") int subsCount; - int networkCount; - String starredUser; - String reposOwner; - @Nullable boolean hasProjects; - - public Disposable save(Repo entity) { - return Single.create(e -> { - BlockingEntityStore dataSource = App.getInstance().getDataStore().toBlocking(); - dataSource.delete(Repo.class).where(Repo.ID.eq(entity.getId())).get().value(); - dataSource.insert(entity); - }).subscribe(o -> {/**/}, Throwable::printStackTrace); - } - - public static Maybe getRepo(@NonNull String name, @NonNull String login) { - return App.getInstance().getDataStore() - .select(Repo.class) - .where(FULL_NAME.eq(login + "/" + name)) - .get() - .maybe(); - } - - public static Repo getRepo(long id) { - return App.getInstance().getDataStore() - .select(Repo.class) - .where(ID.eq(id)) - .get() - .firstOrNull(); - } - - public static Disposable saveStarred(@NonNull List models, @NonNull String starredUser) { - return RxHelper.getSingle(Single.fromPublisher(s -> { - try { - Login login = Login.getUser(); - if (login != null) { - BlockingEntityStore dataSource = App.getInstance().getDataStore().toBlocking(); - if (login.getLogin().equalsIgnoreCase(starredUser)) { - dataSource.delete(Repo.class) - .where(STARRED_USER.eq(starredUser)) - .get() - .value(); - if (!models.isEmpty()) { - for (Repo repo : models) { - dataSource.delete(Repo.class).where(Repo.ID.eq(repo.getId())).get().value(); - repo.setStarredUser(starredUser); - dataSource.insert(repo); - } - } - } else { - dataSource.delete(Repo.class) - .where(STARRED_USER.notEqual(login.getLogin()) - .or(STATUSES_URL.isNull())) - .get() - .value(); - } - } - s.onNext(""); - } catch (Exception ignored) {} - s.onComplete(); - })).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace); - } - - public static Disposable saveMyRepos(@NonNull List models, @NonNull String reposOwner) { - return RxHelper.getSingle(Single.fromPublisher(s -> { - try { - Login login = Login.getUser(); - if (login != null) { - BlockingEntityStore dataSource = App.getInstance().getDataStore().toBlocking(); - if (login.getLogin().equalsIgnoreCase(reposOwner)) { - dataSource.delete(Repo.class) - .where(REPOS_OWNER.eq(reposOwner)) - .get() - .value(); - if (!models.isEmpty()) { - for (Repo repo : models) { - dataSource.delete(Repo.class).where(Repo.ID.eq(repo.getId())).get().value(); - repo.setReposOwner(reposOwner); - dataSource.insert(repo); - } - } - } else { - dataSource.delete(Repo.class) - .where(REPOS_OWNER.notEqual(login.getLogin()) - .or(REPOS_OWNER.isNull())) - .get() - .value(); - } - } - s.onNext(""); - } catch (Exception e) { - s.onError(e); - } - s.onComplete(); - })).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace); - } - - public static Single> getStarred(@NonNull String starredUser) { - return App.getInstance().getDataStore() - .select(Repo.class) - .where(STARRED_USER.eq(starredUser)) - .orderBy(UPDATED_AT.desc()) - .get() - .observable() - .toList(); - } - - public static Single> getMyRepos(@NonNull String reposOwner) { - return App.getInstance().getDataStore() - .select(Repo.class) - .where(REPOS_OWNER.eq(reposOwner)) - .orderBy(UPDATED_AT.desc()) - .get() - .observable() - .toList(); - } - - @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - AbstractRepo that = (AbstractRepo) o; - return id == that.id; - } - - @Override public int hashCode() { - return (int) (id ^ (id >>> 32)); - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeString(this.name); - dest.writeString(this.fullName); - dest.writeByte(this.privateX ? (byte) 1 : (byte) 0); - dest.writeString(this.htmlUrl); - dest.writeString(this.description); - dest.writeByte(this.fork ? (byte) 1 : (byte) 0); - dest.writeString(this.url); - dest.writeString(this.forksUrl); - dest.writeString(this.keysUrl); - dest.writeString(this.collaboratorsUrl); - dest.writeString(this.teamsUrl); - dest.writeString(this.hooksUrl); - dest.writeString(this.issueEventsUrl); - dest.writeString(this.eventsUrl); - dest.writeString(this.assigneesUrl); - dest.writeString(this.branchesUrl); - dest.writeString(this.tagsUrl); - dest.writeString(this.blobsUrl); - dest.writeString(this.gitTagsUrl); - dest.writeString(this.gitRefsUrl); - dest.writeString(this.treesUrl); - dest.writeString(this.statusesUrl); - dest.writeString(this.languagesUrl); - dest.writeString(this.stargazersUrl); - dest.writeString(this.contributorsUrl); - dest.writeString(this.subscribersUrl); - dest.writeString(this.subscriptionUrl); - dest.writeString(this.commitsUrl); - dest.writeString(this.gitCommitsUrl); - dest.writeString(this.commentsUrl); - dest.writeString(this.issueCommentUrl); - dest.writeString(this.contentsUrl); - dest.writeString(this.compareUrl); - dest.writeString(this.mergesUrl); - dest.writeString(this.archiveUrl); - dest.writeString(this.downloadsUrl); - dest.writeString(this.issuesUrl); - dest.writeString(this.pullsUrl); - dest.writeString(this.milestonesUrl); - dest.writeString(this.notificationsUrl); - dest.writeString(this.labelsUrl); - dest.writeString(this.releasesUrl); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1); - dest.writeLong(this.pushedAt != null ? this.pushedAt.getTime() : -1); - dest.writeString(this.gitUrl); - dest.writeString(this.sshUrl); - dest.writeString(this.cloneUrl); - dest.writeString(this.svnUrl); - dest.writeString(this.homepage); - dest.writeLong(this.size); - dest.writeLong(this.stargazersCount); - dest.writeLong(this.watchersCount); - dest.writeString(this.language); - dest.writeByte(this.hasIssues ? (byte) 1 : (byte) 0); - dest.writeByte(this.hasDownloads ? (byte) 1 : (byte) 0); - dest.writeByte(this.hasWiki ? (byte) 1 : (byte) 0); - dest.writeByte(this.hasPages ? (byte) 1 : (byte) 0); - dest.writeLong(this.forksCount); - dest.writeString(this.mirrorUrl); - dest.writeLong(this.openIssuesCount); - dest.writeLong(this.forks); - dest.writeLong(this.openIssues); - dest.writeLong(this.watchers); - dest.writeString(this.defaultBranch); - dest.writeList(this.topics); - dest.writeParcelable(this.owner, flags); - dest.writeParcelable(this.permissions, flags); - dest.writeParcelable(this.organization, flags); - dest.writeParcelable(this.parent, flags); - dest.writeParcelable(this.source, flags); - dest.writeParcelable(this.license, flags); - dest.writeInt(this.subsCount); - dest.writeInt(this.networkCount); - dest.writeString(this.starredUser); - dest.writeString(this.reposOwner); - dest.writeByte(this.hasProjects ? (byte) 1 : (byte) 0); - } - - protected AbstractRepo(Parcel in) { - this.id = in.readLong(); - this.name = in.readString(); - this.fullName = in.readString(); - this.privateX = in.readByte() != 0; - this.htmlUrl = in.readString(); - this.description = in.readString(); - this.fork = in.readByte() != 0; - this.url = in.readString(); - this.forksUrl = in.readString(); - this.keysUrl = in.readString(); - this.collaboratorsUrl = in.readString(); - this.teamsUrl = in.readString(); - this.hooksUrl = in.readString(); - this.issueEventsUrl = in.readString(); - this.eventsUrl = in.readString(); - this.assigneesUrl = in.readString(); - this.branchesUrl = in.readString(); - this.tagsUrl = in.readString(); - this.blobsUrl = in.readString(); - this.gitTagsUrl = in.readString(); - this.gitRefsUrl = in.readString(); - this.treesUrl = in.readString(); - this.statusesUrl = in.readString(); - this.languagesUrl = in.readString(); - this.stargazersUrl = in.readString(); - this.contributorsUrl = in.readString(); - this.subscribersUrl = in.readString(); - this.subscriptionUrl = in.readString(); - this.commitsUrl = in.readString(); - this.gitCommitsUrl = in.readString(); - this.commentsUrl = in.readString(); - this.issueCommentUrl = in.readString(); - this.contentsUrl = in.readString(); - this.compareUrl = in.readString(); - this.mergesUrl = in.readString(); - this.archiveUrl = in.readString(); - this.downloadsUrl = in.readString(); - this.issuesUrl = in.readString(); - this.pullsUrl = in.readString(); - this.milestonesUrl = in.readString(); - this.notificationsUrl = in.readString(); - this.labelsUrl = in.readString(); - this.releasesUrl = in.readString(); - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - long tmpUpdatedAt = in.readLong(); - this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt); - long tmpPushedAt = in.readLong(); - this.pushedAt = tmpPushedAt == -1 ? null : new Date(tmpPushedAt); - this.gitUrl = in.readString(); - this.sshUrl = in.readString(); - this.cloneUrl = in.readString(); - this.svnUrl = in.readString(); - this.homepage = in.readString(); - this.size = in.readLong(); - this.stargazersCount = in.readLong(); - this.watchersCount = in.readLong(); - this.language = in.readString(); - this.hasIssues = in.readByte() != 0; - this.hasDownloads = in.readByte() != 0; - this.hasWiki = in.readByte() != 0; - this.hasPages = in.readByte() != 0; - this.forksCount = in.readLong(); - this.mirrorUrl = in.readString(); - this.openIssuesCount = in.readLong(); - this.forks = in.readLong(); - this.openIssues = in.readLong(); - this.watchers = in.readLong(); - this.defaultBranch = in.readString(); - this.topics = new TopicsModel(); - in.readList(this.topics, this.topics.getClass().getClassLoader()); - this.owner = in.readParcelable(User.class.getClassLoader()); - this.permissions = in.readParcelable(RepoPermissionsModel.class.getClassLoader()); - this.organization = in.readParcelable(User.class.getClassLoader()); - this.parent = in.readParcelable(Repo.class.getClassLoader()); - this.source = in.readParcelable(Repo.class.getClassLoader()); - this.license = in.readParcelable(LicenseModel.class.getClassLoader()); - this.subsCount = in.readInt(); - this.networkCount = in.readInt(); - this.starredUser = in.readString(); - this.reposOwner = in.readString(); - this.hasProjects = in.readByte() != 0; - } - - public static final Creator CREATOR = new Creator() { - @Override public Repo createFromParcel(Parcel source) {return new Repo(source);} - - @Override public Repo[] newArray(int size) {return new Repo[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractRepoFile.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractRepoFile.java deleted file mode 100644 index 470883172..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractRepoFile.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.fastaccess.data.dao.model; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; - -import com.fastaccess.App; -import com.fastaccess.data.dao.types.FilesType; -import com.fastaccess.helper.RxHelper; - -import java.util.List; - -import io.reactivex.Observable; -import io.reactivex.Single; -import io.requery.Entity; -import io.requery.Generated; -import io.requery.Key; -import io.requery.Persistable; -import io.requery.reactivex.ReactiveEntityStore; -import lombok.NoArgsConstructor; - -import static com.fastaccess.data.dao.model.RepoFile.LOGIN; -import static com.fastaccess.data.dao.model.RepoFile.REPO_ID; -import static com.fastaccess.data.dao.model.RepoFile.SHA; -import static com.fastaccess.data.dao.model.RepoFile.TYPE; - -/** - * Created by Kosh on 16 Mar 2017, 7:53 PM - */ - -@Entity @NoArgsConstructor public abstract class AbstractRepoFile implements Parcelable { - @Key @Generated long id; - String name; - String path; - String sha; - long size; - String url; - String htmlUrl; - String gitUrl; - String downloadUrl; - FilesType type; - String repoId; - String login; - - - public Single save(RepoFile entity) { - return RxHelper.getSingle(App.getInstance().getDataStore().insert(entity)); - } - - public static Observable save(@NonNull List models, @NonNull String login, @NonNull String repoId) { - ReactiveEntityStore singleEntityStore = App.getInstance().getDataStore(); - return RxHelper.safeObservable(singleEntityStore.delete(RepoFile.class) - .where(REPO_ID.eq(repoId) - .and(LOGIN.eq(login))) - .get() - .single() - .toObservable() - .flatMap(integer -> Observable.fromIterable(models)) - .flatMap(filesModel -> { - filesModel.setRepoId(repoId); - filesModel.setLogin(login); - return filesModel.save(filesModel).toObservable(); - })); - } - - public static Single> getFiles(@NonNull String login, @NonNull String repoId) { - return App.getInstance().getDataStore() - .select(RepoFile.class) - .where(REPO_ID.eq(repoId) - .and(LOGIN.eq(login))) - .orderBy(TYPE.asc()) - .get() - .observable() - .toList(); - } - - public static Observable getFile(@NonNull String login, @NonNull String repoId, @NonNull String sha) { - return App.getInstance().getDataStore() - .select(RepoFile.class) - .where(REPO_ID.eq(repoId) - .and(LOGIN.eq(login)) - .and(SHA.eq(sha))) - .orderBy(TYPE.asc()) - .get() - .observable(); - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeString(this.name); - dest.writeString(this.path); - dest.writeString(this.sha); - dest.writeLong(this.size); - dest.writeString(this.url); - dest.writeString(this.htmlUrl); - dest.writeString(this.gitUrl); - dest.writeString(this.downloadUrl); - dest.writeInt(this.type == null ? -1 : this.type.ordinal()); - dest.writeString(this.repoId); - dest.writeString(this.login); - } - - protected AbstractRepoFile(Parcel in) { - this.id = in.readLong(); - this.name = in.readString(); - this.path = in.readString(); - this.sha = in.readString(); - this.size = in.readLong(); - this.url = in.readString(); - this.htmlUrl = in.readString(); - this.gitUrl = in.readString(); - this.downloadUrl = in.readString(); - int tmpType = in.readInt(); - this.type = tmpType == -1 ? null : FilesType.values()[tmpType]; - this.repoId = in.readString(); - this.login = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public RepoFile createFromParcel(Parcel source) {return new RepoFile(source);} - - @Override public RepoFile[] newArray(int size) {return new RepoFile[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractSearchHistory.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractSearchHistory.java deleted file mode 100644 index 6953ddf30..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractSearchHistory.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.fastaccess.data.dao.model; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.App; -import com.fastaccess.helper.RxHelper; - -import java.util.List; - -import io.reactivex.Single; -import io.requery.Column; -import io.requery.Entity; - -/** - * Created by Kosh on 01 Jan 2017, 11:20 PM - */ - - -@Entity -public abstract class AbstractSearchHistory implements Parcelable { - @Column(unique = true) String text; - - public Single save(SearchHistory entity) { - return RxHelper.getSingle( - App.getInstance().getDataStore() - .delete(SearchHistory.class) - .where(SearchHistory.TEXT.eq(entity.getText())) - .get() - .single() - .flatMap(integer -> App.getInstance().getDataStore().insert(entity))); - } - - public static Single> getHistory() { - return App.getInstance().getDataStore() - .select(SearchHistory.class) - .groupBy(SearchHistory.TEXT.asc()) - .get() - .observable() - .toList(); - } - - @Override public String toString() { - return text; - } - - @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - AbstractSearchHistory that = (AbstractSearchHistory) o; - - return text != null ? text.equals(that.text) : that.text == null; - - } - - @Override public int hashCode() { - return text != null ? text.hashCode() : 0; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) {dest.writeString(this.text);} - - public AbstractSearchHistory() {} - - public AbstractSearchHistory(String text) { - this.text = text; - } - - protected AbstractSearchHistory(Parcel in) {this.text = in.readString();} - - public static final Creator CREATOR = new Creator() { - @Override public SearchHistory createFromParcel(Parcel source) {return new SearchHistory(source);} - - @Override public SearchHistory[] newArray(int size) {return new SearchHistory[size];} - }; - - public static void deleteAll() { - App.getInstance().getDataStore() - .delete(SearchHistory.class) - .get() - .value(); - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractUser.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractUser.java deleted file mode 100644 index 200c36fd9..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractUser.java +++ /dev/null @@ -1,274 +0,0 @@ -package com.fastaccess.data.dao.model; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.App; -import com.fastaccess.helper.RxHelper; - -import java.util.Date; -import java.util.List; - -import io.reactivex.Single; -import io.reactivex.disposables.Disposable; -import io.requery.BlockingEntityStore; -import io.requery.Column; -import io.requery.Entity; -import io.requery.Key; -import io.requery.Persistable; -import io.requery.Table; -import io.requery.Transient; -import lombok.NoArgsConstructor; - -import static com.fastaccess.data.dao.model.User.FOLLOWER_NAME; -import static com.fastaccess.data.dao.model.User.FOLLOWING_NAME; -import static com.fastaccess.data.dao.model.User.ID; -import static com.fastaccess.data.dao.model.User.LOGIN; - -/** - * Created by Kosh on 16 Mar 2017, 7:55 PM - */ - -@Entity @NoArgsConstructor @Table(name = "user_table") -public abstract class AbstractUser implements Parcelable { - @Key long id; - String login; - String avatarUrl; - String gravatarId; - String url; - String htmlUrl; - String followersUrl; - String followingUrl; - String gistsUrl; - String starredUrl; - String subscriptionsUrl; - String organizationsUrl; - String reposUrl; - String eventsUrl; - String receivedEventsUrl; - String type; - boolean siteAdmin; - String name; - String company; - String blog; - String location; - String email; - boolean hireable; - String bio; - long publicRepos; - long publicGists; - long followers; - long following; - Date createdAt; - Date updatedAt; - int contributions; - String followingName; - String followerName; - @Column(name = "date_column") Date date; - String repoId; - String description; - @Transient boolean hasOrganizationProjects; - - public void save(User entity) { - if (getUser(entity.getId()) != null) { - App.getInstance().getDataStore().toBlocking().update(entity); - } else { - App.getInstance().getDataStore().toBlocking().insert(entity); - } - } - - @Nullable public static User getUser(String login) { - return App.getInstance().getDataStore() - .select(User.class) - .where(LOGIN.eq(login)) - .get() - .firstOrNull(); - } - - @Nullable public static User getUser(long id) { - return App.getInstance().getDataStore() - .select(User.class) - .where(ID.eq(id)) - .get() - .firstOrNull(); - } - - public static Disposable saveUserFollowerList(@NonNull List models, @NonNull String followingName) { - return RxHelper.getSingle(Single.fromPublisher(s -> { - try { - Login login = Login.getUser(); - if (login != null) { - BlockingEntityStore dataSource = App.getInstance().getDataStore().toBlocking(); - if (login.getLogin().equalsIgnoreCase(followingName)) { - dataSource.delete(User.class) - .where(FOLLOWING_NAME.eq(followingName)) - .get() - .value(); - if (!models.isEmpty()) { - for (User user : models) { - dataSource.delete(User.class).where(User.ID.eq(user.getId())).get().value(); - user.setFollowingName(followingName); - dataSource.insert(user); - } - } - } else { - dataSource.delete(User.class) - .where(User.FOLLOWING_NAME.notEqual(login.getLogin())) - .get() - .value(); - } - } - s.onNext(""); - } catch (Exception e) { - s.onError(e); - } - s.onComplete(); - })).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace); - } - - public static Disposable saveUserFollowingList(@NonNull List models, @NonNull String followerName) { - return RxHelper.getSingle(Single.fromPublisher(s -> { - try { - Login login = Login.getUser(); - if (login != null) { - BlockingEntityStore dataSource = App.getInstance().getDataStore().toBlocking(); - if (login.getLogin().equalsIgnoreCase(followerName)) { - dataSource.delete(User.class) - .where(FOLLOWER_NAME.eq(followerName)) - .get() - .value(); - if (!models.isEmpty()) { - for (User user : models) { - dataSource.delete(User.class).where(User.ID.eq(user.getId())).get().value(); - user.setFollowerName(followerName); - dataSource.insert(user); - } - } - } else { - dataSource.delete(User.class) - .where(User.FOLLOWER_NAME.notEqual(login.getLogin())) - .get() - .value(); - } - } - s.onNext(""); - } catch (Exception e) { - s.onError(e); - } - s.onComplete(); - })).subscribe(o -> {/*donothing*/}, Throwable::printStackTrace); - } - - @NonNull public static Single> getUserFollowerList(@NonNull String following) { - return App.getInstance().getDataStore() - .select(User.class) - .where(FOLLOWING_NAME.eq(following)) - .get() - .observable() - .toList(); - } - - @NonNull public static Single> getUserFollowingList(@NonNull String follower) { - return App.getInstance().getDataStore() - .select(User.class) - .where(FOLLOWER_NAME.eq(follower)) - .get() - .observable() - .toList(); - } - - public boolean isOrganizationType() { - return type != null && type.equalsIgnoreCase("Organization"); - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeString(this.login); - dest.writeString(this.avatarUrl); - dest.writeString(this.gravatarId); - dest.writeString(this.url); - dest.writeString(this.htmlUrl); - dest.writeString(this.followersUrl); - dest.writeString(this.followingUrl); - dest.writeString(this.gistsUrl); - dest.writeString(this.starredUrl); - dest.writeString(this.subscriptionsUrl); - dest.writeString(this.organizationsUrl); - dest.writeString(this.reposUrl); - dest.writeString(this.eventsUrl); - dest.writeString(this.receivedEventsUrl); - dest.writeString(this.type); - dest.writeByte(this.siteAdmin ? (byte) 1 : (byte) 0); - dest.writeString(this.name); - dest.writeString(this.company); - dest.writeString(this.blog); - dest.writeString(this.location); - dest.writeString(this.email); - dest.writeByte(this.hireable ? (byte) 1 : (byte) 0); - dest.writeString(this.bio); - dest.writeLong(this.publicRepos); - dest.writeLong(this.publicGists); - dest.writeLong(this.followers); - dest.writeLong(this.following); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1); - dest.writeInt(this.contributions); - dest.writeString(this.followingName); - dest.writeString(this.followerName); - dest.writeLong(this.date != null ? this.date.getTime() : -1); - dest.writeString(this.repoId); - dest.writeString(this.description); - } - - protected AbstractUser(Parcel in) { - this.id = in.readLong(); - this.login = in.readString(); - this.avatarUrl = in.readString(); - this.gravatarId = in.readString(); - this.url = in.readString(); - this.htmlUrl = in.readString(); - this.followersUrl = in.readString(); - this.followingUrl = in.readString(); - this.gistsUrl = in.readString(); - this.starredUrl = in.readString(); - this.subscriptionsUrl = in.readString(); - this.organizationsUrl = in.readString(); - this.reposUrl = in.readString(); - this.eventsUrl = in.readString(); - this.receivedEventsUrl = in.readString(); - this.type = in.readString(); - this.siteAdmin = in.readByte() != 0; - this.name = in.readString(); - this.company = in.readString(); - this.blog = in.readString(); - this.location = in.readString(); - this.email = in.readString(); - this.hireable = in.readByte() != 0; - this.bio = in.readString(); - this.publicRepos = in.readLong(); - this.publicGists = in.readLong(); - this.followers = in.readLong(); - this.following = in.readLong(); - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - long tmpUpdatedAt = in.readLong(); - this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt); - this.contributions = in.readInt(); - this.followingName = in.readString(); - this.followerName = in.readString(); - long tmpDate = in.readLong(); - this.date = tmpDate == -1 ? null : new Date(tmpDate); - this.repoId = in.readString(); - this.description = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override public User createFromParcel(Parcel source) {return new User(source);} - - @Override public User[] newArray(int size) {return new User[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/model/AbstractViewerFile.java b/app/src/main/java/com/fastaccess/data/dao/model/AbstractViewerFile.java deleted file mode 100644 index 9e0f3ac6c..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/model/AbstractViewerFile.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.fastaccess.data.dao.model; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; - -import com.fastaccess.App; -import com.fastaccess.helper.RxHelper; - -import io.requery.Column; -import io.requery.Entity; -import io.requery.Generated; -import io.requery.Key; -import lombok.NoArgsConstructor; -import io.reactivex.Observable;import io.reactivex.Single; - -/** - * Created by Kosh on 06 Dec 2016, 10:42 PM - */ - -@Entity @NoArgsConstructor public abstract class AbstractViewerFile implements Parcelable { - @Key @Generated long id; - boolean markdown; - String content; - @Column(unique = true) String fullUrl; - boolean repo; - - public Single save(ViewerFile modelEntity) { - return RxHelper.getSingle(App.getInstance().getDataStore() - .delete(ViewerFile.class) - .where(ViewerFile.FULL_URL.eq(modelEntity.getFullUrl())) - .get() - .single() - .flatMap(i -> App.getInstance().getDataStore().insert(modelEntity))); - } - - public static Observable get(@NonNull String url) { - return App.getInstance() - .getDataStore() - .select(ViewerFile.class) - .where(ViewerFile.FULL_URL.equal(url)) - .get() - .observable(); - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeByte(this.markdown ? (byte) 1 : (byte) 0); - dest.writeString(this.content); - dest.writeString(this.fullUrl); - dest.writeByte(this.repo ? (byte) 1 : (byte) 0); - } - - protected AbstractViewerFile(Parcel in) { - this.id = in.readLong(); - this.markdown = in.readByte() != 0; - this.content = in.readString(); - this.fullUrl = in.readString(); - this.repo = in.readByte() != 0; - } - - public static final Creator CREATOR = new Creator() { - @Override public ViewerFile createFromParcel(Parcel source) {return new ViewerFile(source);} - - @Override public ViewerFile[] newArray(int size) {return new ViewerFile[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/timeline/AuthorModel.java b/app/src/main/java/com/fastaccess/data/dao/timeline/AuthorModel.java deleted file mode 100644 index fc89b57b3..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/timeline/AuthorModel.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.fastaccess.data.dao.timeline; - -import android.os.Parcel; -import android.os.Parcelable; - -import java.util.Date; - -import lombok.Getter; -import lombok.Setter; - -@Getter @Setter public class AuthorModel implements Parcelable { - private String name; - private String email; - private Date date; - - public AuthorModel() {} - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.name); - dest.writeString(this.email); - dest.writeLong(this.date != null ? this.date.getTime() : -1); - } - - private AuthorModel(Parcel in) { - this.name = in.readString(); - this.email = in.readString(); - long tmpDate = in.readLong(); - this.date = tmpDate == -1 ? null : new Date(tmpDate); - } - - public static final Creator CREATOR = new Creator() { - @Override public AuthorModel createFromParcel(Parcel source) {return new AuthorModel(source);} - - @Override public AuthorModel[] newArray(int size) {return new AuthorModel[size];} - }; -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/data/dao/timeline/CommentEvent.java b/app/src/main/java/com/fastaccess/data/dao/timeline/CommentEvent.java deleted file mode 100644 index 4086a5775..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/timeline/CommentEvent.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.fastaccess.data.dao.timeline; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.data.dao.ReactionsModel; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.User; - -import java.util.Date; - -import lombok.Getter; -import lombok.Setter; - -/** - * Created by Kosh on 16 Mar 2017, 7:24 PM - */ -@Getter @Setter public class CommentEvent implements Parcelable { - private long id; - private User user; - private String url; - private String body; - private String bodyHtml; - private String htmlUrl; - private Date createdAt; - private Date updatedAt; - private int position; - private int line; - private String path; - private String commitId; - private String repoId; - private String login; - private String gistId; - private String issueId; - private String pullRequestId; - private ReactionsModel reactions; - - @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Comment that = (Comment) o; - return id == that.getId(); - - } - - @Override public int hashCode() { - return (int) (id ^ (id >>> 32)); - } - - public CommentEvent() {} - - @Override public String toString() { - return "CommentEvent{" + - "id=" + id + - ", user=" + user + - ", url='" + url + '\'' + - ", body='" + body + '\'' + - ", bodyHtml='" + bodyHtml + '\'' + - ", htmlUrl='" + htmlUrl + '\'' + - ", createdAt=" + createdAt + - ", updatedAt=" + updatedAt + - ", position=" + position + - ", line=" + line + - ", path='" + path + '\'' + - ", commitId='" + commitId + '\'' + - ", repoId='" + repoId + '\'' + - ", login='" + login + '\'' + - ", gistId='" + gistId + '\'' + - ", issueId='" + issueId + '\'' + - ", pullRequestId='" + pullRequestId + '\'' + - ", reactions=" + reactions + - '}'; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeParcelable(this.user, flags); - dest.writeString(this.url); - dest.writeString(this.body); - dest.writeString(this.bodyHtml); - dest.writeString(this.htmlUrl); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeLong(this.updatedAt != null ? this.updatedAt.getTime() : -1); - dest.writeInt(this.position); - dest.writeInt(this.line); - dest.writeString(this.path); - dest.writeString(this.commitId); - dest.writeString(this.repoId); - dest.writeString(this.login); - dest.writeString(this.gistId); - dest.writeString(this.issueId); - dest.writeString(this.pullRequestId); - dest.writeParcelable(this.reactions, flags); - } - - private CommentEvent(Parcel in) { - this.id = in.readLong(); - this.user = in.readParcelable(User.class.getClassLoader()); - this.url = in.readString(); - this.body = in.readString(); - this.bodyHtml = in.readString(); - this.htmlUrl = in.readString(); - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - long tmpUpdatedAt = in.readLong(); - this.updatedAt = tmpUpdatedAt == -1 ? null : new Date(tmpUpdatedAt); - this.position = in.readInt(); - this.line = in.readInt(); - this.path = in.readString(); - this.commitId = in.readString(); - this.repoId = in.readString(); - this.login = in.readString(); - this.gistId = in.readString(); - this.issueId = in.readString(); - this.pullRequestId = in.readString(); - this.reactions = in.readParcelable(ReactionsModel.class.getClassLoader()); - } - - public static final Creator CREATOR = new Creator() { - @Override public CommentEvent createFromParcel(Parcel source) {return new CommentEvent(source);} - - @Override public CommentEvent[] newArray(int size) {return new CommentEvent[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/timeline/GenericEvent.java b/app/src/main/java/com/fastaccess/data/dao/timeline/GenericEvent.java deleted file mode 100644 index a5d4c86b5..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/timeline/GenericEvent.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.fastaccess.data.dao.timeline; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.data.dao.RenameModel; -import com.fastaccess.data.dao.TeamsModel; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.data.dao.types.IssueEventType; - -import java.util.Date; -import java.util.List; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Created by kosh on 25/07/2017. - */ - -@NoArgsConstructor @Getter @Setter public class GenericEvent implements Parcelable { - - private long id; - private String url; - private String commitId; - private String commitUrl; - private String message; - private String sha; - private String htmlUrl; - private Date createdAt; - private User actor; - private User requestedReviewer; - private User reviewRequester; - private User assigner; - private User assignee; - private User author; - private User committer; - private LabelModel label; - private TeamsModel requestedTeam; - private MilestoneModel milestone; - private RenameModel rename; - private SourceModel source; - private Issue issue; - private PullRequest pullRequest; - private ParentsModel tree; - private List parents; - private IssueEventType event; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(this.id); - dest.writeString(this.url); - dest.writeString(this.commitId); - dest.writeString(this.commitUrl); - dest.writeString(this.message); - dest.writeString(this.sha); - dest.writeString(this.htmlUrl); - dest.writeLong(this.createdAt != null ? this.createdAt.getTime() : -1); - dest.writeParcelable(this.actor, flags); - dest.writeParcelable(this.requestedReviewer, flags); - dest.writeParcelable(this.reviewRequester, flags); - dest.writeParcelable(this.assigner, flags); - dest.writeParcelable(this.assignee, flags); - dest.writeParcelable(this.author, flags); - dest.writeParcelable(this.committer, flags); - dest.writeParcelable(this.label, flags); - dest.writeParcelable(this.requestedTeam, flags); - dest.writeParcelable(this.milestone, flags); - dest.writeParcelable(this.rename, flags); - dest.writeParcelable(this.source, flags); - dest.writeParcelable(this.issue, flags); - dest.writeParcelable(this.pullRequest, flags); - dest.writeParcelable(this.tree, flags); - dest.writeTypedList(this.parents); - dest.writeInt(this.event == null ? -1 : this.event.ordinal()); - } - - private GenericEvent(Parcel in) { - this.id = in.readLong(); - this.url = in.readString(); - this.commitId = in.readString(); - this.commitUrl = in.readString(); - this.message = in.readString(); - this.sha = in.readString(); - this.htmlUrl = in.readString(); - long tmpCreatedAt = in.readLong(); - this.createdAt = tmpCreatedAt == -1 ? null : new Date(tmpCreatedAt); - this.actor = in.readParcelable(User.class.getClassLoader()); - this.requestedReviewer = in.readParcelable(User.class.getClassLoader()); - this.reviewRequester = in.readParcelable(User.class.getClassLoader()); - this.assigner = in.readParcelable(User.class.getClassLoader()); - this.assignee = in.readParcelable(User.class.getClassLoader()); - this.author = in.readParcelable(User.class.getClassLoader()); - this.committer = in.readParcelable(User.class.getClassLoader()); - this.label = in.readParcelable(LabelModel.class.getClassLoader()); - this.requestedTeam = in.readParcelable(TeamsModel.class.getClassLoader()); - this.milestone = in.readParcelable(MilestoneModel.class.getClassLoader()); - this.rename = in.readParcelable(RenameModel.class.getClassLoader()); - this.source = in.readParcelable(SourceModel.class.getClassLoader()); - this.issue = in.readParcelable(Issue.class.getClassLoader()); - this.pullRequest = in.readParcelable(PullRequest.class.getClassLoader()); - this.tree = in.readParcelable(ParentsModel.class.getClassLoader()); - this.parents = in.createTypedArrayList(ParentsModel.CREATOR); - int tmpEvent = in.readInt(); - this.event = tmpEvent == -1 ? null : IssueEventType.values()[tmpEvent]; - } - - public static final Creator CREATOR = new Creator() { - @Override public GenericEvent createFromParcel(Parcel source) {return new GenericEvent(source);} - - @Override public GenericEvent[] newArray(int size) {return new GenericEvent[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/timeline/ParentsModel.java b/app/src/main/java/com/fastaccess/data/dao/timeline/ParentsModel.java deleted file mode 100644 index 9c091d984..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/timeline/ParentsModel.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.fastaccess.data.dao.timeline; - -import android.os.Parcel; -import android.os.Parcelable; - -import lombok.Getter; -import lombok.Setter; - -@Getter @Setter public class ParentsModel implements Parcelable { - private String sha; - private String url; - private String htmlUrl; - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.sha); - dest.writeString(this.url); - dest.writeString(this.htmlUrl); - } - - public ParentsModel() {} - - private ParentsModel(Parcel in) { - this.sha = in.readString(); - this.url = in.readString(); - this.htmlUrl = in.readString(); - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override public ParentsModel createFromParcel(Parcel source) {return new ParentsModel(source);} - - @Override public ParentsModel[] newArray(int size) {return new ParentsModel[size];} - }; -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/data/dao/timeline/PullRequestCommitModel.java b/app/src/main/java/com/fastaccess/data/dao/timeline/PullRequestCommitModel.java deleted file mode 100644 index d17c6bb2b..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/timeline/PullRequestCommitModel.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.fastaccess.data.dao.timeline; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.data.dao.model.Comment; - -import java.util.List; - -/** - * Created by kosh on 15/08/2017. - */ - -public class PullRequestCommitModel implements Parcelable { - private String login; - private String path; - private int position; - private String commitId; - private List comments; - private int line; - - - public int getLine() { - return line; - } - - public void setLine(int line) { - this.line = line; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public int getPosition() { - return position; - } - - public void setPosition(int position) { - this.position = position; - } - - public String getCommitId() { - return commitId; - } - - public void setCommitId(String commitId) { - this.commitId = commitId; - } - - public List getComments() { - return comments; - } - - public void setComments(List comments) { - this.comments = comments; - } - - public PullRequestCommitModel() {} - - public String getLogin() { - return login; - } - - public void setLogin(String login) { - this.login = login; - } - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.login); - dest.writeString(this.path); - dest.writeInt(this.position); - dest.writeString(this.commitId); - dest.writeTypedList(this.comments); - dest.writeInt(this.line); - } - - protected PullRequestCommitModel(Parcel in) { - this.login = in.readString(); - this.path = in.readString(); - this.position = in.readInt(); - this.commitId = in.readString(); - this.comments = in.createTypedArrayList(Comment.CREATOR); - this.line = in.readInt(); - } - - public static final Creator CREATOR = new Creator() { - @Override public PullRequestCommitModel createFromParcel(Parcel source) {return new PullRequestCommitModel(source);} - - @Override public PullRequestCommitModel[] newArray(int size) {return new PullRequestCommitModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/timeline/SourceModel.java b/app/src/main/java/com/fastaccess/data/dao/timeline/SourceModel.java deleted file mode 100644 index 3efcfe06d..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/timeline/SourceModel.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.fastaccess.data.dao.timeline; - -import android.os.Parcel; -import android.os.Parcelable; - -import com.fastaccess.data.dao.model.Commit; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.model.Repo; - -import lombok.Getter; -import lombok.Setter; - -/** - * Created by kosh on 26/07/2017. - */ - -@Getter @Setter public class SourceModel implements Parcelable { - - private String type; - private Issue issue; - private PullRequest pullRequest; - private Commit commit; - private Repo repository; - - public SourceModel() {} - - @Override public int describeContents() { return 0; } - - @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeString(this.type); - dest.writeParcelable(this.issue, flags); - dest.writeParcelable(this.pullRequest, flags); - dest.writeParcelable(this.commit, flags); - dest.writeParcelable(this.repository, flags); - } - - private SourceModel(Parcel in) { - this.type = in.readString(); - this.issue = in.readParcelable(Issue.class.getClassLoader()); - this.pullRequest = in.readParcelable(PullRequest.class.getClassLoader()); - this.commit = in.readParcelable(Commit.class.getClassLoader()); - this.repository = in.readParcelable(Repo.class.getClassLoader()); - } - - public static final Creator CREATOR = new Creator() { - @Override public SourceModel createFromParcel(Parcel source) {return new SourceModel(source);} - - @Override public SourceModel[] newArray(int size) {return new SourceModel[size];} - }; -} diff --git a/app/src/main/java/com/fastaccess/data/dao/types/EventsType.java b/app/src/main/java/com/fastaccess/data/dao/types/EventsType.java deleted file mode 100644 index 85b96d189..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/types/EventsType.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.fastaccess.data.dao.types; - - -import androidx.annotation.DrawableRes; -import androidx.annotation.StringRes; - -import com.fastaccess.R; - -public enum EventsType { - WatchEvent(R.string.starred, R.drawable.ic_star_filled), - CreateEvent(R.string.created_repo, R.drawable.ic_repo), - CommitCommentEvent(R.string.commented_on_commit, R.drawable.ic_comment), - DownloadEvent(R.string.downloaded, R.drawable.ic_download), - FollowEvent(R.string.followed, R.drawable.ic_add), - ForkEvent(R.string.forked, R.drawable.ic_fork), - GistEvent(R.string.created_gist, R.drawable.ic_gists), - GollumEvent(R.string.gollum, R.drawable.ic_info_outline), - IssueCommentEvent(R.string.commented_on_issue, R.drawable.ic_comment), - IssuesEvent(R.string.created_issue, R.drawable.ic_issues), - MemberEvent(R.string.member, R.drawable.ic_add), - PublicEvent(R.string.public_event, R.drawable.ic_repo), - PullRequestEvent(R.string.pull_request, R.drawable.ic_pull_requests), - PullRequestReviewCommentEvent(R.string.pr_comment_review, R.drawable.ic_comment), - PullRequestReviewEvent(R.string.pr_review_event, R.drawable.ic_eye), - RepositoryEvent(R.string.repo_event, R.drawable.ic_repo), - PushEvent(R.string.pushed, R.drawable.ic_push), - TeamAddEvent(R.string.team_event, R.drawable.ic_profile), - DeleteEvent(R.string.deleted, R.drawable.ic_trash), - ReleaseEvent(R.string.released, R.drawable.ic_download), - ForkApplyEvent(R.string.forked, R.drawable.ic_fork), - OrgBlockEvent(R.string.organization_event, R.drawable.ic_profile), - ProjectCardEvent(R.string.card_event, R.drawable.ic_info_outline), - ProjectColumnEvent(R.string.project_event, R.drawable.ic_info_outline), - OrganizationEvent(R.string.organization_event, R.drawable.ic_profile), - ProjectEvent(R.string.project_event, R.drawable.ic_info_outline); - - @StringRes int type; - @DrawableRes int drawableRes; - - EventsType(@StringRes int type, @DrawableRes int drawableRes) { - this.type = type; - this.drawableRes = drawableRes; - } - - @DrawableRes public int getDrawableRes() { - return drawableRes > 0 ? drawableRes : R.drawable.ic_info_outline; - } - - @StringRes public int getType() { - return type > 0 ? type : R.string.unknown; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/data/dao/types/FilesType.java b/app/src/main/java/com/fastaccess/data/dao/types/FilesType.java deleted file mode 100644 index 4c44606ae..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/types/FilesType.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.fastaccess.data.dao.types; - -import androidx.annotation.DrawableRes; - -import com.fastaccess.R; - -/** - * Created by Kosh on 17 Feb 2017, 7:45 PM - */ - -public enum FilesType { - file(R.drawable.ic_file_document), - dir(R.drawable.ic_folder), - blob(R.drawable.ic_file_document), - tree(R.drawable.ic_folder), - symlink(R.drawable.ic_submodule); - - int icon; - - FilesType(int icon) { - this.icon = icon; - } - - @DrawableRes public int getIcon() { - return icon > 0 ? icon : R.drawable.ic_file_document; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/types/GitEntryType.java b/app/src/main/java/com/fastaccess/data/dao/types/GitEntryType.java deleted file mode 100644 index ac7457a6f..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/types/GitEntryType.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.fastaccess.data.dao.types; - -public enum GitEntryType { - commit, - tree, - blob -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/data/dao/types/IssueEventType.java b/app/src/main/java/com/fastaccess/data/dao/types/IssueEventType.java deleted file mode 100644 index c8ef9f5ce..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/types/IssueEventType.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.fastaccess.data.dao.types; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.annimon.stream.Stream; -import com.fastaccess.R; -import com.google.gson.annotations.SerializedName; - -public enum IssueEventType { - assigned(R.drawable.ic_profile), - closed(R.drawable.ic_issue_closed), - commented(R.drawable.ic_comment), - committed(R.drawable.ic_push), - demilestoned(R.drawable.ic_milestone), - head_ref_deleted(R.drawable.ic_trash), - head_ref_restored(R.drawable.ic_redo), - labeled(R.drawable.ic_label), - locked(R.drawable.ic_lock), - mentioned(R.drawable.ic_at), - merged(R.drawable.ic_fork), - milestoned(R.drawable.ic_milestone), - referenced(R.drawable.ic_format_quote), - renamed(R.drawable.ic_edit), - reopened(R.drawable.ic_issue_opened), - subscribed(R.drawable.ic_subscribe), - unassigned(R.drawable.ic_profile), - unlabeled(R.drawable.ic_label), - unlocked(R.drawable.ic_unlock), - unsubscribed(R.drawable.ic_eye_off), - review_requested(R.drawable.ic_eye), - review_dismissed(R.drawable.ic_eye_off), - review_request_removed(R.drawable.ic_eye_off), - @SerializedName("cross-referenced")cross_referenced(R.drawable.ic_format_quote), - @SerializedName("line-commented")line_commented(R.drawable.ic_comment), - @SerializedName("commit-commented")commit_commented(R.drawable.ic_comment), - reviewed(R.drawable.ic_eye), - changes_requested(R.drawable.ic_eye), - added_to_project(R.drawable.ic_add), - GROUPED(R.drawable.ic_eye), - deployed(R.drawable.ic_rocket); - - int iconResId; - - IssueEventType(int iconResId) {this.iconResId = iconResId;} - - public int getIconResId() { - return iconResId == 0 ? R.drawable.ic_label : iconResId; - } - - @Nullable public static IssueEventType getType(@NonNull String type) { - return Stream.of(values()) - .filter(value -> value.name().toLowerCase().equalsIgnoreCase(type.toLowerCase() - .replaceAll("-", "_"))) - .findFirst() - .orElse(null); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/data/dao/types/IssueState.java b/app/src/main/java/com/fastaccess/data/dao/types/IssueState.java deleted file mode 100644 index 039f45c3f..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/types/IssueState.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.fastaccess.data.dao.types; - -import androidx.annotation.StringRes; - -import com.fastaccess.R; - -public enum IssueState { - open(R.string.opened), - closed(R.string.closed), - all(R.string.all); - - int status; - - IssueState(@StringRes int status) { - this.status = status; - } - - @StringRes public int getStatus() { - return status; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/data/dao/types/MyIssuesType.java b/app/src/main/java/com/fastaccess/data/dao/types/MyIssuesType.java deleted file mode 100644 index ba93a0ad3..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/types/MyIssuesType.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fastaccess.data.dao.types; - -/** - * Created by Kosh on 30 Apr 2017, 1:03 PM - */ - -public enum MyIssuesType { - CREATED, - ASSIGNED, - MENTIONED, - REVIEW, - PARTICIPATED -} diff --git a/app/src/main/java/com/fastaccess/data/dao/types/NotificationReason.java b/app/src/main/java/com/fastaccess/data/dao/types/NotificationReason.java deleted file mode 100644 index 7600a115f..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/types/NotificationReason.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.fastaccess.data.dao.types; - -public enum NotificationReason { - subscribed, - manual, - author, - comment, - mention, - team_mention, - state_change, - assign, -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/data/dao/types/NotificationType.java b/app/src/main/java/com/fastaccess/data/dao/types/NotificationType.java deleted file mode 100644 index 7f681b286..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/types/NotificationType.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.fastaccess.data.dao.types; - -import com.fastaccess.R; - -/** - * Created by Kosh on 19 Apr 2017, 7:57 PM - */ - -public enum NotificationType { - PullRequest(R.drawable.ic_pull_requests), - Issue(R.drawable.ic_issues), - Commit(R.drawable.ic_push); - - int drawableRes; - - NotificationType(int drawableRes) { - this.drawableRes = drawableRes; - } - - public int getDrawableRes() { - return drawableRes > 0 ? drawableRes : R.drawable.ic_issues; - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/types/ReactionTypes.java b/app/src/main/java/com/fastaccess/data/dao/types/ReactionTypes.java deleted file mode 100644 index 4e42fb06d..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/types/ReactionTypes.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.fastaccess.data.dao.types; - -import androidx.annotation.IdRes; -import androidx.annotation.Nullable; - -import com.annimon.stream.Stream; -import com.fastaccess.R; - -/** - * Created by Kosh on 29 Mar 2017, 10:11 PM - */ - -public enum ReactionTypes { - - HEART("heart", R.id.heart, R.id.heartReaction), - HOORAY("hooray", R.id.hurray, R.id.hurrayReaction), - PLUS_ONE("thumbs_up", R.id.thumbsUp, R.id.thumbsUpReaction), - MINUS_ONE("thumbs_down", R.id.thumbsDown, R.id.thumbsDownReaction), - CONFUSED("confused", R.id.sad, R.id.sadReaction), - LAUGH("laugh", R.id.laugh, R.id.laughReaction), - ROCKET("rocket", R.id.rocket, R.id.rocketReaction), - EYES("eyes", R.id.eyes, R.id.eyeReaction); - - private String content; - private int vId; - private int secondaryViewId; - - ReactionTypes(String content, int vId, int secondaryViewId) { - this.content = content; - this.vId = vId; - this.secondaryViewId = secondaryViewId; - } - - public String getContent() { - return content; - } - - public String getPostContent() { - if (this == PLUS_ONE) { - return "+1"; - } else if (this == MINUS_ONE) { - return "-1"; - } else { - return getContent(); - } - } - - @IdRes public int getvId() { - return vId; - } - - @Nullable public static ReactionTypes get(@IdRes int vId) { - return Stream.of(values()) - .filter(value -> value.getvId() == vId || value.secondaryViewId == vId) - .findFirst() - .orElse(null); - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/types/ReviewStateType.java b/app/src/main/java/com/fastaccess/data/dao/types/ReviewStateType.java deleted file mode 100644 index 58b1a451e..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/types/ReviewStateType.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.fastaccess.data.dao.types; - -import androidx.annotation.DrawableRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; - -import com.annimon.stream.Stream; -import com.fastaccess.R; - -/** - * Created by Kosh on 10 Apr 2017, 4:27 PM - */ - -public enum ReviewStateType { - COMMENTED(R.string.reviewed, R.drawable.ic_eye), - CHANGES_REQUESTED(R.string.request_changes, R.drawable.ic_clear), - REQUEST_CHANGES(R.string.reviewed, R.drawable.ic_eye), - DISMISSED(R.string.dismissed_review, R.drawable.ic_clear), - APPROVED(R.string.approved_these_changes, R.drawable.ic_done), - APPROVE(R.string.approved_these_changes, R.drawable.ic_done); - - private int stringRes; - private int drawableRes; - - ReviewStateType(@StringRes int stringRes, @DrawableRes int drawableRes) { - this.stringRes = stringRes; - this.drawableRes = drawableRes; - } - - @StringRes public int getStringRes() { - return stringRes > 0 ? stringRes : R.string.reviewed; - } - - @DrawableRes public int getDrawableRes() { - return drawableRes > 0 ? drawableRes : R.drawable.ic_eye; - } - - @Nullable public static ReviewStateType getType(@NonNull String state) { - return Stream.of(values()) - .filter(value -> value.name().toLowerCase().equalsIgnoreCase(state.toLowerCase())) - .findFirst() - .orElse(null); - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/types/StatusStateType.java b/app/src/main/java/com/fastaccess/data/dao/types/StatusStateType.java deleted file mode 100644 index 0d104c1dc..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/types/StatusStateType.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.fastaccess.data.dao.types; - -import androidx.annotation.DrawableRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.annimon.stream.Stream; -import com.fastaccess.R; - -/** - * Created by Kosh on 10 Apr 2017, 3:41 AM - */ - -public enum StatusStateType { - failure(R.drawable.ic_issues_small), - pending(R.drawable.ic_time_small), - success(R.drawable.ic_check_small), - error(R.drawable.ic_issues_small); - - @DrawableRes private int drawableRes; - - StatusStateType(@DrawableRes int drawableRes) { - this.drawableRes = drawableRes; - } - - @DrawableRes public int getDrawableRes() { - return drawableRes; - } - - @NonNull public static StatusStateType getState(@Nullable String status) { - return Stream.of(values()) - .filter(value -> value.name().toLowerCase().equalsIgnoreCase(status)) - .findFirst() - .orElse(pending); - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/wiki/WikiContentModel.kt b/app/src/main/java/com/fastaccess/data/dao/wiki/WikiContentModel.kt deleted file mode 100644 index 0de0a4214..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/wiki/WikiContentModel.kt +++ /dev/null @@ -1,30 +0,0 @@ -package com.fastaccess.data.dao.wiki - -import android.os.Parcel -import com.fastaccess.helper.KotlinParcelable -import com.fastaccess.helper.parcelableCreator - -/** - * Created by Kosh on 13 Jun 2017, 8:06 PM - */ -data class WikiContentModel( - val content: String? = null, - private val footer: String? = null, - val sidebar: List -) : KotlinParcelable { - companion object { - @JvmField val CREATOR = parcelableCreator(::WikiContentModel) - } - - constructor(source: Parcel) : this( - source.readString(), - source.readString(), - source.createTypedArrayList(WikiSideBarModel.CREATOR) ?: arrayListOf() - ) - - override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) { - writeString(content) - writeString(footer) - writeTypedList(sidebar) - } -} diff --git a/app/src/main/java/com/fastaccess/data/dao/wiki/WikiSideBarModel.kt b/app/src/main/java/com/fastaccess/data/dao/wiki/WikiSideBarModel.kt deleted file mode 100644 index 6b0780dd3..000000000 --- a/app/src/main/java/com/fastaccess/data/dao/wiki/WikiSideBarModel.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.fastaccess.data.dao.wiki - -import android.os.Parcel -import com.fastaccess.helper.KotlinParcelable -import com.fastaccess.helper.parcelableCreator - -/** - * Created by Kosh on 13 Jun 2017, 8:03 PM - */ -data class WikiSideBarModel( - val title: String? = null, - val link: String? = null -) : KotlinParcelable { - companion object { - @JvmField val CREATOR = parcelableCreator(::WikiSideBarModel) - } - - constructor(source: Parcel) : this( - source.readString(), - source.readString() - ) - - override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) { - writeString(title) - writeString(link) - } -} diff --git a/app/src/main/java/com/fastaccess/data/service/ContentService.kt b/app/src/main/java/com/fastaccess/data/service/ContentService.kt deleted file mode 100644 index 2348e9e54..000000000 --- a/app/src/main/java/com/fastaccess/data/service/ContentService.kt +++ /dev/null @@ -1,30 +0,0 @@ -package com.fastaccess.data.service - -import com.fastaccess.data.dao.CommitRequestModel -import com.fastaccess.data.dao.GitCommitModel -import com.fastaccess.data.dao.GitHubStatusModel -import io.reactivex.Observable -import retrofit2.http.* - -/** - * Created by kosh on 29/08/2017. - */ -interface ContentService { - - @PUT("repos/{owner}/{repoId}/contents/{path}") - fun updateCreateFile(@Path("owner") owner: String, - @Path("repoId") repoId: String, - @Path("path") path: String, - @Query("branch") branch: String, - @Body body: CommitRequestModel): Observable - - @HTTP(method = "DELETE", path = "repos/{owner}/{repoId}/contents/{path}", hasBody = true) - fun deleteFile(@Path("owner") owner: String, - @Path("repoId") repoId: String, - @Path("path") path: String, - @Query("branch") branch: String, - @Body body: CommitRequestModel): Observable - - @GET("api/v2/status.json") - fun checkStatus(): Observable -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/data/service/GistService.java b/app/src/main/java/com/fastaccess/data/service/GistService.java deleted file mode 100644 index 10a19ff8c..000000000 --- a/app/src/main/java/com/fastaccess/data/service/GistService.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.fastaccess.data.service; - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.CommentRequestModel; -import com.fastaccess.data.dao.CreateGistModel; -import com.fastaccess.data.dao.Pageable; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.Gist; - -import io.reactivex.Observable; -import retrofit2.Response; -import retrofit2.http.Body; -import retrofit2.http.DELETE; -import retrofit2.http.GET; -import retrofit2.http.Headers; -import retrofit2.http.PATCH; -import retrofit2.http.POST; -import retrofit2.http.PUT; -import retrofit2.http.Path; -import retrofit2.http.Query; -import retrofit2.http.Url; - -/** - * Created by Kosh on 20 Nov 2016, 10:28 AM - */ - -public interface GistService { - - @NonNull @GET @Headers("Accept: application/vnd.github.VERSION.raw") - Observable getGistFile(@Url String url); - - @POST("gists") Observable createGist(@Body CreateGistModel gistBody); - - @PATCH("gists/{id}") Observable editGist(@Body CreateGistModel gistBody, @Path("id") String id); - - @DELETE("gists/{id}") Observable> deleteGist(@Path("id") String id); - - @GET("gists/public") Observable> getPublicGists(@Query("per_page") int perPage, @Query("page") int page); - - @GET("gists") Observable> getMyGists(@Query("page") int page); - - @GET("users/{username}/gists") - Observable> getUserGists(@NonNull @Path("username") String username, @Query("page") int page); - - @GET("gists/{id}") - Observable getGist(@Path("id") String id); - - @GET("gists/{id}/comments") - @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") - Observable> getGistComments(@NonNull @Path("id") String id, @Query("page") int page); - - @POST("gists/{gist_id}/comments") - @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") - Observable createGistComment(@Path("gist_id") String gistId, @Body CommentRequestModel body); - - @PATCH("gists/{gist_id}/comments/{id}") - @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") - Observable editGistComment(@Path("gist_id") String gistId, @Path("id") long id, @Body CommentRequestModel body); - - @DELETE("gists/{gist_id}/comments/{id}") - Observable> deleteGistComment(@Path("gist_id") String gistId, @Path("id") long id); - - @GET("gists/{gist_id}/star") - Observable> checkGistStar(@Path("gist_id") @NonNull String gistId); - - @PUT("gists/{gist_id}/star") - Observable> starGist(@Path("gist_id") @NonNull String gistId); - - @DELETE("gists/{gist_id}/star") - Observable> unStarGist(@Path("gist_id") @NonNull String gistId); - - @POST("gists/{gist_id}/forks") - Observable> forkGist(@Path("gist_id") @NonNull String gistId); - - @GET("/gists/starred") Observable> getStarredGists(@Query("page") int page); - -} diff --git a/app/src/main/java/com/fastaccess/data/service/ImgurService.java b/app/src/main/java/com/fastaccess/data/service/ImgurService.java deleted file mode 100644 index 834f71093..000000000 --- a/app/src/main/java/com/fastaccess/data/service/ImgurService.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.fastaccess.data.service; - -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.ImgurReponseModel; - -import okhttp3.RequestBody; -import retrofit2.http.Body; -import retrofit2.http.POST; -import retrofit2.http.Query; -import io.reactivex.Observable; - -/** - * Created by Kosh on 15 Apr 2017, 8:06 PM - */ - -public interface ImgurService { - @POST("image") - Observable postImage(@Nullable @Query("title") String title, @Body RequestBody body); -} diff --git a/app/src/main/java/com/fastaccess/data/service/IssueService.java b/app/src/main/java/com/fastaccess/data/service/IssueService.java deleted file mode 100644 index 63496cbbe..000000000 --- a/app/src/main/java/com/fastaccess/data/service/IssueService.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.fastaccess.data.service; - - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.AssigneesRequestModel; -import com.fastaccess.data.dao.CommentRequestModel; -import com.fastaccess.data.dao.CreateIssueModel; -import com.fastaccess.data.dao.IssueRequestModel; -import com.fastaccess.data.dao.IssuesPageable; -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.LockIssuePrModel; -import com.fastaccess.data.dao.Pageable; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.IssueEvent; -import com.google.gson.JsonObject; - -import java.util.List; - -import io.reactivex.Observable; -import retrofit2.Response; -import retrofit2.http.Body; -import retrofit2.http.DELETE; -import retrofit2.http.GET; -import retrofit2.http.HTTP; -import retrofit2.http.Headers; -import retrofit2.http.PATCH; -import retrofit2.http.POST; -import retrofit2.http.PUT; -import retrofit2.http.Path; -import retrofit2.http.Query; - -public interface IssueService { - - @GET("repos/{owner}/{repo}/issues") - Observable> getRepositoryIssues(@Path("owner") String owner, @Path("repo") String repo, - @Query("state") String state, @Query("sort") String sortBy, - @Query("page") int page); - - @GET("search/issues") Observable> getIssuesWithCount(@NonNull @Query(value = "q", encoded = true) String query, - @Query("page") int page); - - @GET("user/issues") - Observable> getUserIssues(@Query("page") int page, @Query("state") @NonNull String state); - - @GET("repos/{owner}/{repo}/issues/{number}") - @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") - Observable getIssue(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") int number); - - @GET("repos/{owner}/{repo}/issues/{issue_number}/events?per_page=100") - Observable> getTimeline(@Path("owner") String owner, @Path("repo") String repo, - @Path("issue_number") int issue_number); - - @GET("repos/{owner}/{repo}/issues/{issue_number}/timeline?per_page=100") - @Headers("Accept: application/vnd.github.mockingbird-preview,application/vnd.github.VERSION.full+json," + - " application/vnd.github.squirrel-girl-preview") - Observable> getTimeline(@Path("owner") String owner, @Path("repo") String repo, - @Path("issue_number") int issue_number, @Query("page") int page); - - @POST("repos/{owner}/{repo}/issues") - Observable createIssue(@Path("owner") String owner, @Path("repo") String repo, - @Body IssueRequestModel issue); - - @PATCH("repos/{owner}/{repo}/issues/{number}") - @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") - Observable editIssue(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") int number, - @Body IssueRequestModel issue); - - @Headers("Accept: application/vnd.github.sailor-v-preview+json") - @PUT("repos/{owner}/{repo}/issues/{number}/lock") - Observable> lockIssue(@Body LockIssuePrModel body, @Path("owner") String owner, - @Path("repo") String repo, @Path("number") int number); - - @DELETE("repos/{owner}/{repo}/issues/{number}/lock") - Observable> unlockIssue(@Path("owner") String owner, @Path("repo") String repo, @Path("number") int number); - - - @GET("repos/{owner}/{repo}/issues/{number}/comments?per_page=100") - @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") - Observable> getIssueComments(@Path("owner") String owner, - @Path("repo") String repo, - @Path("number") int number, - @Query("page") int page); - - @GET("repos/{owner}/{repo}/issues/{number}/comments/{id}") - @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") - Observable getIssueComment(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") int number, @Path("id") long id); - - @POST("repos/{owner}/{repo}/issues/{number}/comments") - @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") - Observable createIssueComment(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") int number, @Body CommentRequestModel body); - - @PATCH("repos/{owner}/{repo}/issues/comments/{id}") - @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") - Observable editIssueComment(@Path("owner") String owner, @Path("repo") String repo, @Path("id") long id, - @Body CommentRequestModel body); - - @DELETE("repos/{owner}/{repo}/issues/comments/{id}") - Observable> deleteIssueComment(@Path("owner") String owner, @Path("repo") String repo, @Path("id") long id); - - @POST("repos/{owner}/{repo}/issues") - Observable createIssue(@Path("owner") String owner, @Path("repo") String repo, @NonNull @Body CreateIssueModel body); - - @PUT("repos/{owner}/{repo}/issues/{number}/labels") - Observable> putLabels(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") int number, @Body @NonNull List labels); - - - @POST("repos/{owner}/{repo}/issues/{number}/assignees") - Observable putAssignees(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") int number, @Body AssigneesRequestModel body); - - @HTTP(method = "DELETE", path = "repos/{owner}/{repo}/issues/{number}/assignees", hasBody = true) - Observable deleteAssignees(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") int number, @Body AssigneesRequestModel body); - - @GET("/repos/{owner}/{repo}/issues/comments/{id}") - @Headers("Accept: application/vnd.github.mockingbird-preview,application/vnd.github.VERSION.full+json," + - " application/vnd.github.squirrel-girl-preview") - Observable getComment(@Path("owner") String owner, @Path("repo") String repo, @Path("id") long id); - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/data/service/LoginRestService.java b/app/src/main/java/com/fastaccess/data/service/LoginRestService.java deleted file mode 100644 index ffbaee3b5..000000000 --- a/app/src/main/java/com/fastaccess/data/service/LoginRestService.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.fastaccess.data.service; - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.AccessTokenModel; -import com.fastaccess.data.dao.AuthModel; -import com.fastaccess.data.dao.model.Login; - -import io.reactivex.Observable; -import retrofit2.http.Body; -import retrofit2.http.Field; -import retrofit2.http.FormUrlEncoded; -import retrofit2.http.GET; -import retrofit2.http.Headers; -import retrofit2.http.POST; - -public interface LoginRestService { - - @GET("user") Observable loginAccessToken(); - - @POST("authorizations") Observable login(@NonNull @Body AuthModel authModel); - - @FormUrlEncoded @POST("access_token") - @Headers("Accept: application/json") - Observable getAccessToken(@NonNull @Field("code") String code, - @NonNull @Field("client_id") String clientId, - @NonNull @Field("client_secret") String clientSecret, - @NonNull @Field("state") String state, - @NonNull @Field("redirect_uri") String redirectUrl); -} diff --git a/app/src/main/java/com/fastaccess/data/service/NotificationService.java b/app/src/main/java/com/fastaccess/data/service/NotificationService.java deleted file mode 100644 index 04ad2502f..000000000 --- a/app/src/main/java/com/fastaccess/data/service/NotificationService.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.fastaccess.data.service; - - -import androidx.annotation.NonNull; -import androidx.annotation.StringDef; - -import com.fastaccess.data.dao.NotificationSubscriptionBodyModel; -import com.fastaccess.data.dao.Pageable; -import com.fastaccess.data.dao.RepoSubscriptionModel; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.Notification; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -import io.reactivex.Observable; -import retrofit2.Response; -import retrofit2.http.Body; -import retrofit2.http.DELETE; -import retrofit2.http.GET; -import retrofit2.http.PATCH; -import retrofit2.http.PUT; -import retrofit2.http.Path; -import retrofit2.http.Query; -import retrofit2.http.Url; - -/** - * Created by Kosh on 19 Feb 2017, 6:34 PM - */ - -public interface NotificationService { - String SUBSCRIPTION_URL = "https://github.com/notifications/thread"; - - String ISSUE_THREAD_CLASS = "Issue"; - String PULL_REQUEST_THREAD_CLASS = "PullRequest"; - String SUBSCRIBE = "subscribe"; - String MUTE = "mute"; - String UTF8 = "✓"; - - @StringDef({ - ISSUE_THREAD_CLASS, - PULL_REQUEST_THREAD_CLASS - }) - @Retention(RetentionPolicy.SOURCE) @interface ThreadClass {} - - @StringDef({ - SUBSCRIBE, - MUTE - }) - @Retention(RetentionPolicy.SOURCE) @interface ThreadId {} - - @GET("notifications") Observable> getNotifications(@Query("since") String date); - - @GET("notifications?all=true&per_page=200") Observable> getAllNotifications(); - - @PATCH("notifications/threads/{id}") Observable> markAsRead(@Path("id") String id); - - @GET() Observable getComment(@Url @NonNull String commentUrl); - - @GET("notifications/threads/{id}/subscription") Observable isSubscribed(@Path("id") long id); - - @DELETE("notifications/threads/{id}/subscription") Observable> unSubscribe(@Path("id") long id); - - @PUT("notifications/threads/{id}/subscription") - Observable> subscribe(@Path("id") long id, @Body NotificationSubscriptionBodyModel body); -} diff --git a/app/src/main/java/com/fastaccess/data/service/OrganizationService.java b/app/src/main/java/com/fastaccess/data/service/OrganizationService.java deleted file mode 100644 index b5e2d2b95..000000000 --- a/app/src/main/java/com/fastaccess/data/service/OrganizationService.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.fastaccess.data.service; - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.Pageable; -import com.fastaccess.data.dao.TeamsModel; -import com.fastaccess.data.dao.model.Event; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.data.dao.model.User; - -import java.util.Map; - -import io.reactivex.Observable; -import retrofit2.Response; -import retrofit2.http.GET; -import retrofit2.http.Path; -import retrofit2.http.Query; -import retrofit2.http.QueryMap; - -/** - * Created by Kosh on 22 Mar 2017, 6:44 PM - */ -public interface OrganizationService { - - @GET("orgs/{org}/members/{username}") - Observable> isMember(@NonNull @Path("org") String org, @NonNull @Path("username") String username); - - @GET("orgs/{org}") Observable getOrganization(@NonNull @Path("org") String org); - - @GET("user/orgs?per_page=200") Observable> getMyOrganizations(); - - @GET("users/{user}/orgs") Observable> getMyOrganizations(@NonNull @Path("user") String user); - - @GET("orgs/{org}/teams") Observable> getOrgTeams(@NonNull @Path("org") String org, @Query("page") int page); - - @GET("orgs/{org}/members") Observable> getOrgMembers(@NonNull @Path("org") String org, @Query("page") int page); - - @GET("teams/{id}/members") Observable> getTeamMembers(@Path("id") long id, @Query("page") int page); - - @GET("teams/{id}/repos") Observable> getTeamRepos(@Path("id") long id, @Query("page") int page); - - @GET("users/{username}/events/orgs/{org}") - Observable> getReceivedEvents(@NonNull @Path("username") String userName, - @NonNull @Path("org") String org, @Query("page") int page); - - @GET("orgs/{org}/repos") - Observable> getOrgRepos(@NonNull @Path("org") String org, - @QueryMap(encoded = true) Map filterParams, - @Query("page") int page); - -} diff --git a/app/src/main/java/com/fastaccess/data/service/ProjectsService.kt b/app/src/main/java/com/fastaccess/data/service/ProjectsService.kt deleted file mode 100644 index 61eb11685..000000000 --- a/app/src/main/java/com/fastaccess/data/service/ProjectsService.kt +++ /dev/null @@ -1,58 +0,0 @@ -package com.fastaccess.data.service - -import com.fastaccess.data.dao.Pageable -import com.fastaccess.data.dao.ProjectCardModel -import com.fastaccess.data.dao.ProjectColumnModel -import com.fastaccess.data.dao.ProjectsModel -import io.reactivex.Observable -import retrofit2.Response -import retrofit2.http.* - -/** - * Created by kosh on 09/09/2017. - */ - -interface ProjectsService { - - @GET("repos/{owner}/{repo}/projects") - @Headers("Accept: application/vnd.github.inertia-preview+json") - fun getRepoProjects(@Path("owner") owner: String, @Path("repo") repo: String, - @Query("state") state: String?, @Query("page") page: Int): Observable> - - @GET("orgs/{org}/projects") - @Headers("Accept: application/vnd.github.inertia-preview+json") - fun getOrgsProjects(@Path("org") org: String, - @Query("page") page: Int): Observable> - - @GET("projects/{projectId}/columns?per_page=100") - @Headers("Accept: application/vnd.github.inertia-preview+json") - fun getProjectColumns(@Path("projectId") projectId: Long): Observable> - - @GET("projects/columns/{columnId}/cards") - @Headers("Accept: application/vnd.github.inertia-preview+json") - fun getProjectCards(@Path("columnId") columnId: Long, @Query("page") page: Int): Observable> - - @POST("projects/columns/{projectId}") - @Headers("Accept: application/vnd.github.inertia-preview+json") - fun createColumn(@Path("projectId") projectId: Long, @Body card: ProjectColumnModel): Observable - - @PATCH("projects/columns/{projectId}") - @Headers("Accept: application/vnd.github.inertia-preview+json") - fun updateColumn(@Path("projectId") projectId: Long, @Body card: ProjectColumnModel): Observable - - @DELETE("projects/columns/{projectId}") - @Headers("Accept: application/vnd.github.inertia-preview+json") - fun deleteColumn(@Path("projectId") projectId: Long): Observable> - - @POST("/projects/columns/{columnId}/cards") - @Headers("Accept: application/vnd.github.inertia-preview+json") - fun createCard(@Path("columnId") columnId: Long, @Body card: ProjectCardModel): Observable - - @PATCH("projects/columns/cards/{cardId}") - @Headers("Accept: application/vnd.github.inertia-preview+json") - fun updateCard(@Path("cardId") cardId: Long, @Body card: ProjectCardModel): Observable - - @DELETE("projects/columns/cards/{cardId}") - @Headers("Accept: application/vnd.github.inertia-preview+json") - fun deleteCard(@Path("cardId") cardId: Long): Observable> -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/data/service/PullRequestService.java b/app/src/main/java/com/fastaccess/data/service/PullRequestService.java deleted file mode 100644 index 91963af6f..000000000 --- a/app/src/main/java/com/fastaccess/data/service/PullRequestService.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.fastaccess.data.service; - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.AssigneesRequestModel; -import com.fastaccess.data.dao.CommitFileModel; -import com.fastaccess.data.dao.IssueRequestModel; -import com.fastaccess.data.dao.MergeRequestModel; -import com.fastaccess.data.dao.MergeResponseModel; -import com.fastaccess.data.dao.Pageable; -import com.fastaccess.data.dao.PullRequestStatusModel; -import com.fastaccess.data.dao.model.Commit; -import com.fastaccess.data.dao.model.PullRequest; - -import retrofit2.Response; -import retrofit2.http.Body; -import retrofit2.http.GET; -import retrofit2.http.Headers; -import retrofit2.http.PATCH; -import retrofit2.http.POST; -import retrofit2.http.PUT; -import retrofit2.http.Path; -import retrofit2.http.Query; -import io.reactivex.Observable; - -/** - * Created by Kosh on 15 Dec 2016, 10:21 PM - */ - -public interface PullRequestService { - - @GET("repos/{owner}/{repo}/pulls") - Observable> getPullRequests(@Path("owner") String owner, @Path("repo") String repo, - @Query("state") String state, @Query("page") int page); - - @GET("search/issues") - Observable> getPullsWithCount(@NonNull @Query(value = "q", encoded = true) String query, - @Query("page") int page); - - @GET("repos/{owner}/{repo}/pulls/{number}") - @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") - Observable getPullRequest(@Path("owner") String owner, @Path("repo") String repo, @Path("number") long number); - - @PUT("repos/{owner}/{repo}/pulls/{number}/merge") - Observable mergePullRequest(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") long number, @Body MergeRequestModel body); - - - @GET("repos/{owner}/{repo}/pulls/{number}/commits") - Observable> getPullRequestCommits(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") long number, - @Query("page") int page); - - @GET("repos/{owner}/{repo}/pulls/{number}/files") - Observable> getPullRequestFiles(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") long number, - @Query("page") int page); - - @GET("repos/{owner}/{repo}/pulls/{number}/merge") - Observable> hasPullRequestBeenMerged(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") long number); - - @PATCH("repos/{owner}/{repo}/pulls/{number}") - @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") - Observable editPullRequest(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") int number, - @Body IssueRequestModel issue); - - @PATCH("repos/{owner}/{repo}/issues/{number}") - @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") - Observable editIssue(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") int number, - @Body IssueRequestModel issue); - - @POST("repos/{owner}/{repo}/issues/{number}/assignees") - @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") - Observable putAssignees(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") int number, @Body AssigneesRequestModel body); - - @GET("repos/{owner}/{repo}/commits/{ref}/status") - Observable getPullStatus(@Path("owner") String owner, @Path("repo") String repo, @Path("ref") String ref); - - @POST("repos/{owner}/{repo}/pulls/{number}/requested_reviewers") - @Headers("Accept: application/vnd.github.black-cat-preview+json") - Observable putReviewers(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") int number, @Body AssigneesRequestModel body); -} diff --git a/app/src/main/java/com/fastaccess/data/service/ReactionsService.java b/app/src/main/java/com/fastaccess/data/service/ReactionsService.java deleted file mode 100644 index 0ee4e8cec..000000000 --- a/app/src/main/java/com/fastaccess/data/service/ReactionsService.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.fastaccess.data.service; - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.Pageable; -import com.fastaccess.data.dao.PostReactionModel; -import com.fastaccess.data.dao.ReactionsModel; - -import retrofit2.Response; -import retrofit2.http.Body; -import retrofit2.http.DELETE; -import retrofit2.http.GET; -import retrofit2.http.Headers; -import retrofit2.http.POST; -import retrofit2.http.Path; -import retrofit2.http.Query; -import io.reactivex.Observable; - -/** - * Created by Kosh on 29 Mar 2017, 9:48 PM - */ -public interface ReactionsService { - - @POST("repos/{owner}/{repo}/issues/comments/{id}/reactions") - @Headers("Accept: application/vnd.github.squirrel-girl-preview") - Observable postIssueCommentReaction(@NonNull @Body PostReactionModel body, - @NonNull @Path("owner") String owner, - @Path("repo") @NonNull String repo, - @Path("id") long id); - - @POST("repos/{owner}/{repo}/issues/{number}/reactions") - @Headers("Accept: application/vnd.github.squirrel-girl-preview") - Observable postIssueReaction(@NonNull @Body PostReactionModel body, - @NonNull @Path("owner") String owner, - @Path("repo") @NonNull String repo, - @Path("number") long number); - - @POST("repos/{owner}/{repo}/comments/{id}/reactions") - @Headers("Accept: application/vnd.github.squirrel-girl-preview") - Observable postCommitReaction(@NonNull @Body PostReactionModel body, - @NonNull @Path("owner") String owner, - @Path("repo") @NonNull String repo, - @Path("id") long id); - - @DELETE("reactions/{id}") - @Headers("Accept: application/vnd.github.squirrel-girl-preview") - Observable> delete(@Path("id") long id); - - @GET("repos/{owner}/{repo}/issues/comments/{id}/reactions") - @Headers("Accept: application/vnd.github.squirrel-girl-preview") - Observable> getIssueCommentReaction(@NonNull @Path("owner") String owner, - @Path("repo") @NonNull String repo, - @Path("id") long id, - @Query("content") @NonNull String content, - @Query("page") int page); - - @GET("repos/{owner}/{repo}/issues/{number}/reactions") - @Headers("Accept: application/vnd.github.squirrel-girl-preview") - Observable> getIssueReaction(@NonNull @Path("owner") String owner, - @Path("repo") @NonNull String repo, - @Path("number") long id, - @Query("content") @NonNull String content, - @Query("page") int page); - - @GET("repos/{owner}/{repo}/comments/{id}/reactions") - @Headers("Accept: application/vnd.github.squirrel-girl-preview") - Observable> getCommitReaction(@NonNull @Path("owner") String owner, - @Path("repo") @NonNull String repo, - @Path("id") long id, - @Query("content") @NonNull String content, - @Query("page") int page); - - @GET("repos/{owner}/{repo}/pulls/comments/{id}/reactions") - @Headers("Accept: application/vnd.github.squirrel-girl-preview, application/vnd.github.black-cat-preview") - Observable> getPullRequestReactions(@NonNull @Path("owner") String owner, - @Path("repo") @NonNull String repo, - @Path("id") long id, - @Query("content") @NonNull String content, - @Query("page") int page); - - @POST("repos/{owner}/{repo}/pulls/comments/{id}/reactions") - @Headers("Accept: application/vnd.github.squirrel-girl-preview, application/vnd.github.black-cat-preview") - Observable postCommentReviewReaction(@NonNull @Body PostReactionModel body, - @NonNull @Path("owner") String owner, - @Path("repo") @NonNull String repo, - @Path("id") long id); -} - diff --git a/app/src/main/java/com/fastaccess/data/service/RepoService.java b/app/src/main/java/com/fastaccess/data/service/RepoService.java deleted file mode 100644 index 76daeefda..000000000 --- a/app/src/main/java/com/fastaccess/data/service/RepoService.java +++ /dev/null @@ -1,193 +0,0 @@ -package com.fastaccess.data.service; - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.BranchesModel; -import com.fastaccess.data.dao.CommentRequestModel; -import com.fastaccess.data.dao.CreateMilestoneModel; -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.MarkdownModel; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.data.dao.Pageable; -import com.fastaccess.data.dao.RepoSubscriptionModel; -import com.fastaccess.data.dao.TreeResponseModel; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.Commit; -import com.fastaccess.data.dao.model.Release; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.data.dao.model.RepoFile; -import com.fastaccess.data.dao.model.User; - -import io.reactivex.Observable; -import retrofit2.Response; -import retrofit2.http.Body; -import retrofit2.http.DELETE; -import retrofit2.http.GET; -import retrofit2.http.Headers; -import retrofit2.http.PATCH; -import retrofit2.http.POST; -import retrofit2.http.PUT; -import retrofit2.http.Path; -import retrofit2.http.Query; -import retrofit2.http.Url; - -/** - * Created by Kosh on 10 Dec 2016, 3:16 PM - */ -public interface RepoService { - - - @NonNull @GET @Headers("Accept: application/vnd.github.VERSION.raw") - Observable getFileAsStream(@Url String url); - - @NonNull @GET @Headers("Accept: application/vnd.github.html") - Observable getFileAsHtmlStream(@Url String url); - - @NonNull @POST("markdown") - Observable convertReadmeToHtml(@Body MarkdownModel model); - - @NonNull @GET("repos/{login}/{repoId}") - @Headers({"Accept: application/vnd.github.drax-preview+json, application/vnd.github.mercy-preview+json"}) - Observable getRepo(@Path("login") String login, @Path("repoId") String repoId); - - @NonNull @DELETE("repos/{login}/{repoId}") - Observable> deleteRepo(@Path("login") String login, @Path("repoId") String repoId); - - @NonNull @GET @Headers("Accept: application/vnd.github.html") - Observable getReadmeHtml(@NonNull @Url String url); - - @NonNull @GET("user/starred/{owner}/{repo}") - Observable> checkStarring(@NonNull @Path("owner") String login, @NonNull @Path("repo") String repoId); - - @NonNull @PUT("user/starred/{owner}/{repo}") - Observable> starRepo(@NonNull @Path("owner") String login, @NonNull @Path("repo") String repoId); - - @NonNull @DELETE("user/starred/{owner}/{repo}") - Observable> unstarRepo(@NonNull @Path("owner") String login, @NonNull @Path("repo") String repoId); - - @NonNull @POST("/repos/{owner}/{repo}/forks") - Observable forkRepo(@NonNull @Path("owner") String login, @NonNull @Path("repo") String repoId); - - @NonNull @GET("repos/{owner}/{repo}/subscription") - Observable isWatchingRepo(@Path("owner") String owner, @Path("repo") String repo); - - @NonNull @PUT("user/subscriptions/{owner}/{repo}") - Observable> watchRepo(@Path("owner") String owner, @Path("repo") String repo); - - @NonNull @DELETE("user/subscriptions/{owner}/{repo}") - Observable> unwatchRepo(@Path("owner") String owner, @Path("repo") String repo); - - @NonNull @GET("repos/{owner}/{repo}/commits") - Observable> getCommits(@Path("owner") String owner, @Path("repo") String repo, - @NonNull @Query("sha") String branch, @Query("page") int page); - - @NonNull @GET("repos/{owner}/{repo}/commits") - Observable> getCommits(@Path("owner") String owner, @Path("repo") String repo, - @NonNull @Query("sha") String branch, - @NonNull @Query("path") String path, - @Query("page") int page); - - @NonNull @GET("repos/{owner}/{repo}/releases") - @Headers("Accept: application/vnd.github.VERSION.full+json") - Observable> getReleases(@Path("owner") String owner, @Path("repo") String repo, @Query("page") int page); - - @NonNull @GET("repos/{owner}/{repo}/releases/{id}") - @Headers("Accept: application/vnd.github.VERSION.full+json") - Observable getRelease(@Path("owner") String owner, @Path("repo") String repo, @Path("id") long id); - - @NonNull @GET("repos/{owner}/{repo}/releases/latest") - Observable getLatestRelease(@Path("owner") String owner, @Path("repo") String repo); - - @NonNull @GET("repos/{owner}/{repo}/tags") - @Headers("Accept: application/vnd.github.VERSION.full+json") - Observable> getTagReleases(@Path("owner") String owner, @Path("repo") String repo, @Query("page") int page); - - @NonNull @GET("repos/{owner}/{repo}/tags/{tag}") - @Headers("Accept: application/vnd.github.VERSION.full+json") - Observable getTagRelease(@Path("owner") String owner, @Path("repo") String repo, @Path("tag") String tag); - - @NonNull @GET("repos/{owner}/{repo}/contributors") - Observable> getContributors(@Path("owner") String owner, @Path("repo") String repo, @Query("page") int page); - - @NonNull @GET("repos/{owner}/{repo}/commits/{sha}") - @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") - Observable getCommit(@Path("owner") String owner, @Path("repo") String repo, @Path("sha") String sha); - - @NonNull @GET("repos/{owner}/{repo}/commits/{sha}/comments") - @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") - Observable> getCommitComments(@NonNull @Path("owner") String owner, @NonNull @Path("repo") String repo, - @NonNull @Path("sha") String ref, @Query("page") int page); - - @NonNull @POST("repos/{owner}/{repo}/commits/{sha}/comments") - @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") - Observable postCommitComment(@NonNull @Path("owner") String owner, @NonNull @Path("repo") String repo, - @NonNull @Path("sha") String ref, @Body CommentRequestModel model); - - - @NonNull @PATCH("repos/{owner}/{repo}/comments/{id}") - @Headers("Accept: application/vnd.github.VERSION.full+json, application/vnd.github.squirrel-girl-preview") - Observable editCommitComment(@Path("owner") String owner, @Path("repo") String repo, @Path("id") long id, - @Body CommentRequestModel body); - - @NonNull @DELETE("repos/{owner}/{repo}/comments/{id}") - Observable> deleteComment(@Path("owner") String owner, @Path("repo") String repo, @Path("id") long id); - - @NonNull @GET("repos/{owner}/{repo}/contents/{path}") - Observable> getRepoFiles(@NonNull @Path("owner") String owner, @NonNull @Path("repo") String repo, - @NonNull @Path(value = "path", encoded = true) String path, - @NonNull @Query("ref") String ref); - - @NonNull @GET("repos/{owner}/{repo}/git/trees/{sha}?recursive=1") - Observable getRepoTree(@NonNull @Path("owner") String owner, @NonNull @Path("repo") String repo, - @NonNull @Path("sha") String sha); - - @NonNull @GET("repos/{owner}/{repo}/labels?per_page=100") - Observable> getLabels(@NonNull @Path("owner") String owner, @NonNull @Path("repo") String repo); - - @NonNull @GET("repos/{owner}/{repo}/labels?per_page=100") - Observable> getLabels(@NonNull @Path("owner") String owner, @NonNull @Path("repo") String repo, @Query("page") int page); - - @NonNull @POST("repos/{owner}/{repo}/labels") - Observable addLabel(@NonNull @Path("owner") String owner, @NonNull @Path("repo") String repo, @Body LabelModel body); - - @NonNull @GET("repos/{owner}/{repo}/collaborators/{username}") - Observable> isCollaborator(@NonNull @Path("owner") String owner, @NonNull @Path("repo") String repo, - @NonNull @Path("username") String username); - - @NonNull @GET("repos/{owner}/{repo}/collaborators?per_page=100") - Observable> getCollaborator(@NonNull @Path("owner") String owner, @NonNull @Path("repo") String repo); - - - @NonNull @GET("repos/{owner}/{repo}/branches") - Observable> getBranches(@NonNull @Path("owner") String owner, @NonNull @Path("repo") String repo, - @Query("page") int page); - - @NonNull @GET("repos/{owner}/{repo}/tags") - Observable> getTags(@NonNull @Path("owner") String owner, @NonNull @Path("repo") String repo, - @Query("page") int page); - - @NonNull @GET("repos/{owner}/{repo}/milestones") - Observable> getMilestones(@Path("owner") String owner, @Path("repo") String repo); - - @NonNull @POST("repos/{owner}/{repo}/milestones") - Observable createMilestone(@Path("owner") String owner, @Path("repo") String repo, - @Body CreateMilestoneModel create); - - @NonNull @GET("repos/{owner}/{repo}/assignees") - Observable> getAssignees(@Path("owner") String owner, @Path("repo") String repo); - - @NonNull @GET("repos/{owner}/{repo}/commits?per_page=1") - Observable> getCommitCounts(@Path("owner") String owner, @Path("repo") String repo, @Query("sha") String ref); - - @NonNull @GET("/repos/{owner}/{repo}/stargazers") - Observable> getStargazers(@Path("owner") String owner, @Path("repo") String repo, @Query("page") int page); - - @NonNull @GET("/repos/{owner}/{repo}/subscribers") - Observable> getWatchers(@Path("owner") String owner, @Path("repo") String repo, @Query("page") int page); - - @NonNull @GET("/repos/{owner}/{repo}/forks") - Observable> getForks(@Path("owner") String owner, @Path("repo") String repo, @Query("page") int page); - - @NonNull @GET("repos/{owner}/{repo}/license") @Headers("Accept: application/vnd.github.html") - Observable getLicense(@Path("owner") String owner, @Path("repo") String repo); -} diff --git a/app/src/main/java/com/fastaccess/data/service/ReviewService.java b/app/src/main/java/com/fastaccess/data/service/ReviewService.java deleted file mode 100644 index 875dc42a0..000000000 --- a/app/src/main/java/com/fastaccess/data/service/ReviewService.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.fastaccess.data.service; - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.CommentRequestModel; -import com.fastaccess.data.dao.Pageable; -import com.fastaccess.data.dao.ReviewCommentModel; -import com.fastaccess.data.dao.ReviewModel; -import com.fastaccess.data.dao.ReviewRequestModel; - -import io.reactivex.Observable; -import retrofit2.Response; -import retrofit2.http.Body; -import retrofit2.http.DELETE; -import retrofit2.http.GET; -import retrofit2.http.Headers; -import retrofit2.http.PATCH; -import retrofit2.http.POST; -import retrofit2.http.Path; - -/** - * Created by Kosh on 07 May 2017, 1:01 PM - */ - -public interface ReviewService { - - @GET("repos/{owner}/{repo}/pulls/{number}/reviews/{id}") - @Headers("Accept: application/vnd.github.black-cat-preview+json, application/vnd.github.VERSION.html") - @NonNull - Observable getReview(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") long number, @Path("id") long id); - - @GET("repos/{owner}/{repo}/pulls/{number}/reviews?per_page=100") - @Headers("Accept: application/vnd.github.black-cat-preview+json, application/vnd.github.VERSION.html") - @NonNull - Observable> getReviews(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") long number); - - @GET("repos/{owner}/{repo}/pulls/{number}/reviews/{id}/comments") - @Headers("Accept: application/vnd.github.black-cat-preview+json, application/vnd.github.VERSION.html") - @NonNull - Observable> getReviewComments(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") long number, @Path("id") long reviewId); - - @GET("repos/{owner}/{repo}/pulls/{number}/comments?per_page=100") - @Headers("Accept: application/vnd.github.black-cat-preview+json, application/vnd.github.VERSION.html, " - + "application/vnd.github.squirrel-girl-preview") - @NonNull - Observable> getPrReviewComments(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") long number); - - @POST("/repos/{owner}/{repo}/pulls/{number}/comments") - @Headers("Accept: application/vnd.github.black-cat-preview+json, application/vnd.github.VERSION.html, " - + "application/vnd.github.squirrel-girl-preview") - Observable submitComment(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") long number, @Body CommentRequestModel body); - - @PATCH("/repos/{owner}/{repo}/pulls/comments/{id}") - @Headers("Accept: application/vnd.github.black-cat-preview+json, application/vnd.github.VERSION.html, " - + "application/vnd.github.squirrel-girl-preview") - Observable editComment(@Path("owner") String owner, @Path("repo") String repo, - @Path("id") long id, @Body CommentRequestModel body); - - @DELETE("repos/{owner}/{repo}/pulls/comments/{id}") - @Headers("Accept: application/vnd.github.black-cat-preview") - Observable> deleteComment(@Path("owner") String owner, @Path("repo") String repo, @Path("id") long id); - - @POST("repos/{owner}/{repo}/pulls/{number}/reviews") - @Headers("Accept: application/vnd.github.black-cat-preview") - Observable> submitPrReview(@Path("owner") String owner, @Path("repo") String repo, - @Path("number") long number, @NonNull @Body ReviewRequestModel body); -} diff --git a/app/src/main/java/com/fastaccess/data/service/ScrapService.kt b/app/src/main/java/com/fastaccess/data/service/ScrapService.kt deleted file mode 100644 index c75711ce7..000000000 --- a/app/src/main/java/com/fastaccess/data/service/ScrapService.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.fastaccess.data.service - - -import io.reactivex.Observable -import retrofit2.Response -import retrofit2.http.GET -import retrofit2.http.Path -import retrofit2.http.Query - -/** - * Created by Kosh on 02 Jun 2017, 12:58 PM - */ - -interface ScrapService { - - @GET("{lan}") fun getTrending(@Path("lan") lan: String?, @Query("since") since: String?): Observable> - - @GET("{path}") fun getWiki(@Path(value = "path", encoded = true) path: String?): Observable -} diff --git a/app/src/main/java/com/fastaccess/data/service/SearchService.java b/app/src/main/java/com/fastaccess/data/service/SearchService.java deleted file mode 100644 index 60ca75fbc..000000000 --- a/app/src/main/java/com/fastaccess/data/service/SearchService.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.fastaccess.data.service; - -import com.fastaccess.data.dao.Pageable; -import com.fastaccess.data.dao.SearchCodeModel; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.data.dao.model.User; - -import retrofit2.http.GET; -import retrofit2.http.Query; -import io.reactivex.Observable; - -/** - * Created by Kosh on 08 Dec 2016, 9:07 PM - */ - -public interface SearchService { - - @GET("search/repositories") - Observable> searchRepositories(@Query(value = "q", encoded = true) String query, @Query("page") long page); - - @GET("search/code") - Observable> searchCode(@Query(value = "q", encoded = true) String query, @Query("page") long page); - - @GET("search/issues") - Observable> searchIssues(@Query(value = "q", encoded = true) String query, @Query("page") long page); - - @GET("search/users") - Observable> searchUsers(@Query(value = "q", encoded = true) String query, @Query("page") long page); -} diff --git a/app/src/main/java/com/fastaccess/data/service/UserRestService.java b/app/src/main/java/com/fastaccess/data/service/UserRestService.java deleted file mode 100644 index b0c709883..000000000 --- a/app/src/main/java/com/fastaccess/data/service/UserRestService.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.fastaccess.data.service; - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.Pageable; -import com.fastaccess.data.dao.model.Event; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.data.dao.model.User; - -import java.util.Map; - -import io.reactivex.Observable; -import retrofit2.Response; -import retrofit2.http.DELETE; -import retrofit2.http.GET; -import retrofit2.http.Headers; -import retrofit2.http.PUT; -import retrofit2.http.Path; -import retrofit2.http.Query; -import retrofit2.http.QueryMap; -import retrofit2.http.Url; - - -/** - * Created by Kosh on 08 Feb 2017, 8:54 PM - */ - -public interface UserRestService { - - @GET("user") Observable getUser(); - - @GET("users/{username}") Observable getUser(@Path("username") @NonNull String username); - - @GET("users/{username}/received_events") - Observable> getReceivedEvents(@NonNull @Path("username") String userName, @Query("page") int page); - - @GET("users/{username}/events") - Observable> getUserEvents(@NonNull @Path("username") String userName, @Query("page") int page); - - @GET("users/{username}/repos") - Observable> getRepos(@Path("username") @NonNull String username, @QueryMap(encoded = true) Map filterParams, - @Query("page") int page); - - @GET("user/repos") - Observable> getRepos(@QueryMap(encoded = true) Map filterParams, @Query(value = "page") int page); - - @GET("users/{username}/starred") Observable> - getStarred(@Path("username") @NonNull String username, @Query("page") int page); - - @GET("users/{username}/starred?per_page=1") Observable> - getStarredCount(@Path("username") @NonNull String username); - - @GET("users/{username}/following") - Observable> getFollowing(@Path("username") @NonNull String username, @Query("page") int page); - - @GET("users/{username}/followers") - Observable> getFollowers(@Path("username") @NonNull String username, @Query("page") int page); - - @GET("user/following/{username}") - Observable> getFollowStatus(@Path("username") @NonNull String username); - - @PUT("user/following/{username}") - Observable> followUser(@Path("username") @NonNull String username); - - @DELETE("user/following/{username}") - Observable> unfollowUser(@Path("username") @NonNull String username); - - @GET Observable getContributions(@Url String url); - - @GET("user/blocks/{username}") - @Headers("Accept: application/vnd.github.giant-sentry-fist-preview+json") - Observable> isUserBlocked(@Path("username") @NonNull String username); - - @PUT("user/blocks/{username}") - @Headers("Accept: application/vnd.github.giant-sentry-fist-preview+json") - Observable> blockUser(@Path("username") @NonNull String username); - - @DELETE("user/blocks/{username}") - @Headers("Accept: application/vnd.github.giant-sentry-fist-preview+json") - Observable> unBlockUser(@Path("username") @NonNull String username); -} diff --git a/app/src/main/java/com/fastaccess/github/App.kt b/app/src/main/java/com/fastaccess/github/App.kt new file mode 100644 index 000000000..a5357b3df --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/App.kt @@ -0,0 +1,42 @@ +package com.fastaccess.github + +import androidx.work.Configuration +import androidx.work.WorkManager +import com.evernote.android.state.StateSaver +import com.fastaccess.github.di.components.AppComponent +import com.fastaccess.github.platform.fabric.FabricProvider +import com.fastaccess.github.platform.timber.FabricTree +import com.fastaccess.github.platform.timber.FastHubTree +import com.fastaccess.markdown.emoji.EmojiManager +import dagger.android.AndroidInjector +import dagger.android.support.DaggerApplication +import timber.log.Timber + +/** + * Created by Kosh on 12.05.18. + */ +class App : DaggerApplication() { + + private val appComponent by lazy { AppComponent.getComponent(this) } + + override fun applicationInjector(): AndroidInjector = appComponent + + override fun onCreate() { + super.onCreate() + initConfigs() + } + + private fun initConfigs() { + WorkManager.initialize(this, Configuration.Builder() + .setWorkerFactory(appComponent.daggerWorkerFactory()) + .build()) + FabricProvider.initFabric(this) + StateSaver.setEnabledForAllActivitiesAndSupportFragments(this, true) + if (BuildConfig.DEBUG) { + Timber.plant(FastHubTree()) + } else { + Timber.plant(FabricTree()) + } + EmojiManager.load(this) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/di/components/AppComponent.kt b/app/src/main/java/com/fastaccess/github/di/components/AppComponent.kt new file mode 100644 index 000000000..cdc742e70 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/di/components/AppComponent.kt @@ -0,0 +1,57 @@ +package com.fastaccess.github.di.components + +import android.app.Application +import com.fastaccess.data.persistence.db.FastHubDatabase +import com.fastaccess.data.persistence.db.FastHubLoginDatabase +import com.fastaccess.di.RepositoryModule +import com.fastaccess.domain.di.NetworkModule +import com.fastaccess.github.App +import com.fastaccess.github.di.modules.ActivityBindingModule +import com.fastaccess.github.di.modules.ApplicationModule +import com.fastaccess.github.di.modules.FastHubDatabaseModule +import com.fastaccess.github.platform.workmanager.DaggerWorkerFactory +import dagger.BindsInstance +import dagger.Component +import dagger.android.AndroidInjector +import dagger.android.support.DaggerApplication +import javax.inject.Singleton + +/** + * Created by Kosh on 12.05.18. + */ +@Singleton +@Component( + modules = [ + ApplicationModule::class, + FastHubDatabaseModule::class, + NetworkModule::class, + RepositoryModule::class, + ActivityBindingModule::class + ] +) +interface AppComponent : AndroidInjector { + + @Component.Builder + interface Builder { + @BindsInstance fun application(application: Application): Builder + @BindsInstance fun fastHubDatabaseModule(module: FastHubDatabaseModule): Builder + @BindsInstance fun networkModule(module: NetworkModule): Builder + @BindsInstance fun repositoryModule(module: RepositoryModule): Builder + + fun build(): AppComponent + } + + fun daggerWorkerFactory(): DaggerWorkerFactory + fun workerSubComponentBuilder(): WorkerSubComponent.Builder + fun fastHubDatabase(): FastHubDatabase + fun fasthubLoginDatabase(): FastHubLoginDatabase + + companion object { + fun getComponent(app: App): AppComponent = DaggerAppComponent.builder() + .application(app) + .fastHubDatabaseModule(FastHubDatabaseModule()) + .networkModule(NetworkModule()) + .repositoryModule(RepositoryModule()) + .build() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/di/components/WorkerSubComponent.kt b/app/src/main/java/com/fastaccess/github/di/components/WorkerSubComponent.kt new file mode 100644 index 000000000..6196f002f --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/di/components/WorkerSubComponent.kt @@ -0,0 +1,22 @@ +package com.fastaccess.github.di.components + +import androidx.work.RxWorker +import androidx.work.WorkerParameters +import com.fastaccess.github.di.modules.WorkersModule +import dagger.BindsInstance +import dagger.Subcomponent +import javax.inject.Provider + +@Subcomponent(modules = [WorkersModule::class]) +interface WorkerSubComponent { + + fun workers(): Map, Provider> + + @Subcomponent.Builder + interface Builder { + @BindsInstance + fun workerParameters(param: WorkerParameters): Builder + + fun build(): WorkerSubComponent + } +} diff --git a/app/src/main/java/com/fastaccess/github/di/modules/ActivityBindingModule.kt b/app/src/main/java/com/fastaccess/github/di/modules/ActivityBindingModule.kt new file mode 100644 index 000000000..4fee4d189 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/di/modules/ActivityBindingModule.kt @@ -0,0 +1,45 @@ +package com.fastaccess.github.di.modules + +import com.fastaccess.fasthub.commit.list.CommitsListActivity +import com.fastaccess.fasthub.dagger.scopes.PerActivity +import com.fastaccess.fasthub.diff.DiffViewerActivity +import com.fastaccess.fasthub.reviews.PullRequestReviewsActivity +import com.fastaccess.github.editor.EditorActivity +import com.fastaccess.github.editor.comment.CommentActivity +import com.fastaccess.github.ui.modules.auth.LoginChooserActivity +import com.fastaccess.github.ui.modules.issue.IssueActivity +import com.fastaccess.github.ui.modules.issuesprs.edit.EditIssuePrActivity +import com.fastaccess.github.ui.modules.main.MainActivity +import com.fastaccess.github.ui.modules.multipurpose.MultiPurposeActivity +import com.fastaccess.github.ui.modules.pr.PullRequestActivity +import com.fastaccess.github.ui.modules.profile.ProfileActivity +import com.fastaccess.github.ui.modules.trending.TrendingActivity +import dagger.Module +import dagger.android.ContributesAndroidInjector +import dagger.android.support.AndroidSupportInjectionModule + +/** + * Created by Kosh on 12.05.18. + */ +@Suppress("unused") +@Module( + includes = [ + AndroidSupportInjectionModule::class, + FragmentBindingModule::class, + DialogFragmentBindingModule::class] +) +abstract class ActivityBindingModule { + @PerActivity @ContributesAndroidInjector abstract fun mainActivity(): MainActivity + @PerActivity @ContributesAndroidInjector abstract fun loginChooser(): LoginChooserActivity + @PerActivity @ContributesAndroidInjector abstract fun profileActivity(): ProfileActivity + @PerActivity @ContributesAndroidInjector abstract fun multiPurposeActivity(): MultiPurposeActivity + @PerActivity @ContributesAndroidInjector abstract fun trendingActivity(): TrendingActivity + @PerActivity @ContributesAndroidInjector abstract fun issueActivity(): IssueActivity + @PerActivity @ContributesAndroidInjector abstract fun editorActivity(): EditorActivity + @PerActivity @ContributesAndroidInjector abstract fun editIssuePrActivity(): EditIssuePrActivity + @PerActivity @ContributesAndroidInjector abstract fun commentActivity(): CommentActivity + @PerActivity @ContributesAndroidInjector abstract fun pullRequestActivity(): PullRequestActivity + @PerActivity @ContributesAndroidInjector abstract fun commitsListActivity(): CommitsListActivity + @PerActivity @ContributesAndroidInjector abstract fun diffViewerActivity(): DiffViewerActivity + @PerActivity @ContributesAndroidInjector abstract fun pullRequestReviewsActivity(): PullRequestReviewsActivity +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/di/modules/ActivityModule.kt b/app/src/main/java/com/fastaccess/github/di/modules/ActivityModule.kt new file mode 100644 index 000000000..b1725154b --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/di/modules/ActivityModule.kt @@ -0,0 +1,9 @@ +package com.fastaccess.github.di.modules + +import dagger.Module + +/** + * Created by Kosh on 18.05.18. + */ +@Module +class ActivityModule \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/di/modules/ApplicationModule.kt b/app/src/main/java/com/fastaccess/github/di/modules/ApplicationModule.kt new file mode 100644 index 000000000..d80428f4b --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/di/modules/ApplicationModule.kt @@ -0,0 +1,27 @@ +package com.fastaccess.github.di.modules + +import android.app.Application +import android.content.Context +import com.fastaccess.data.storage.FastHubSharedPreference +import com.fastaccess.fasthub.dagger.annotations.ForApplication +import com.fastaccess.github.base.extensions.theme +import dagger.Module +import dagger.Provides +import javax.inject.Named +import javax.inject.Singleton + +/** + * Created by Kosh on 12.05.18. + */ + +@Module(includes = [ViewModelModule::class]) +class ApplicationModule { + + @Provides @ForApplication fun providesApplicationContext(application: Application): Context { + return application + } + + @Provides @Named("theme") @Singleton fun provideTheme(preference: FastHubSharedPreference) = preference.theme + +// @Provides fun provideGlide(@ForApplication context: Context): GlideRequests = GlideApp.with(context) +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/di/modules/DialogFragmentBindingModule.kt b/app/src/main/java/com/fastaccess/github/di/modules/DialogFragmentBindingModule.kt new file mode 100644 index 000000000..2a85fb881 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/di/modules/DialogFragmentBindingModule.kt @@ -0,0 +1,33 @@ +package com.fastaccess.github.di.modules + +import com.fastaccess.fasthub.commit.dialog.CommitListBottomSheetDialog +import com.fastaccess.fasthub.dagger.scopes.PerFragment +import com.fastaccess.github.base.dialog.IconDialogFragment +import com.fastaccess.github.editor.dialog.CreateLinkDialogFragment +import com.fastaccess.github.ui.modules.issuesprs.edit.labels.create.CreateLabelFragment +import com.fastaccess.github.ui.modules.issuesprs.edit.milestone.CreateMilestoneDialogFragment +import com.fastaccess.github.ui.modules.issuesprs.filter.FilterIssuesPrsBottomSheet +import com.fastaccess.github.ui.modules.multipurpose.MultiPurposeBottomSheetDialog +import com.fastaccess.github.ui.modules.quickmsg.QuickMessageBottomSheetDialog +import com.fastaccess.github.ui.modules.search.filter.FilterSearchBottomSheet +import com.fastaccess.github.ui.modules.trending.filter.FilterTrendingBottomSheet +import dagger.Module +import dagger.android.ContributesAndroidInjector + +/** + * Created by Kosh on 19.05.18. + */ +@Suppress("unused") +@Module +abstract class DialogFragmentBindingModule { + @PerFragment @ContributesAndroidInjector abstract fun provideIconDialog(): IconDialogFragment + @PerFragment @ContributesAndroidInjector abstract fun provideCreateLabel(): CreateLabelFragment + @PerFragment @ContributesAndroidInjector abstract fun provideCreateMilestone(): CreateMilestoneDialogFragment + @PerFragment @ContributesAndroidInjector abstract fun provideMultiPurposeBottomSheetDialog(): MultiPurposeBottomSheetDialog + @PerFragment @ContributesAndroidInjector abstract fun provideFilterIssuesPrsBottomSheet(): FilterIssuesPrsBottomSheet + @PerFragment @ContributesAndroidInjector abstract fun provideFilterSearchBottomSheet(): FilterSearchBottomSheet + @PerFragment @ContributesAndroidInjector abstract fun provideFilterTrendingBottomSheet(): FilterTrendingBottomSheet + @PerFragment @ContributesAndroidInjector abstract fun provideCreateLinkDialogFragment(): CreateLinkDialogFragment + @PerFragment @ContributesAndroidInjector abstract fun provideQuickMessageBottomSheetDialog(): QuickMessageBottomSheetDialog + @PerFragment @ContributesAndroidInjector abstract fun provideCommitListBottomSheetDialog(): CommitListBottomSheetDialog +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/di/modules/FastHubDatabaseModule.kt b/app/src/main/java/com/fastaccess/github/di/modules/FastHubDatabaseModule.kt new file mode 100644 index 000000000..15d6c4f5e --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/di/modules/FastHubDatabaseModule.kt @@ -0,0 +1,56 @@ +package com.fastaccess.github.di.modules + +import android.app.Application +import android.content.Context +import androidx.room.Room +import com.fastaccess.data.persistence.db.DATABASE_NAME +import com.fastaccess.data.persistence.db.FastHubDatabase +import com.fastaccess.data.persistence.db.FastHubLoginDatabase +import com.fastaccess.data.persistence.db.LOGIN_DATABASE_NAME +import com.fastaccess.data.storage.FastHubSharedPreference +import com.fastaccess.fasthub.dagger.annotations.ForApplication +import com.fastaccess.fasthub.dagger.annotations.ForDB +import com.google.firebase.database.DatabaseReference +import com.google.firebase.database.FirebaseDatabase +import com.google.gson.Gson +import com.google.gson.GsonBuilder +import dagger.Module +import dagger.Provides +import java.lang.reflect.Modifier +import javax.inject.Named +import javax.inject.Singleton + +/** + * Created by Kosh on 11.05.18. + */ +@Module +class FastHubDatabaseModule { + + @Singleton @Provides fun provideDatabase(@ForApplication context: Context): FastHubDatabase = Room.databaseBuilder( + context, + FastHubDatabase::class.java, DATABASE_NAME + ) + .allowMainThreadQueries() // allow querying on MainThread (this useful in some cases) + .fallbackToDestructiveMigration() // this mean that it will delete all tables and recreate them after version is changed + .build() + + @Singleton @Provides fun provideLoginDatabase(@ForApplication context: Context): FastHubLoginDatabase = Room.databaseBuilder( + context, + FastHubLoginDatabase::class.java, LOGIN_DATABASE_NAME + ) + .allowMainThreadQueries() // allow querying on MainThread + .build() + + @Singleton @Provides fun providePreference(app: Application): FastHubSharedPreference = FastHubSharedPreference(app) + + @ForDB @Singleton @Provides fun provideGson(): Gson = GsonBuilder() + .excludeFieldsWithModifiers(Modifier.FINAL, Modifier.TRANSIENT, Modifier.STATIC) + .disableHtmlEscaping() + .setPrettyPrinting() + .create() + + @Singleton @Provides @Named(value = "github_trending") fun provideFastHubTrendingDataReference(): DatabaseReference { + return FirebaseDatabase.getInstance().reference.child("github_trending") + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/di/modules/FragmentBindingModule.kt b/app/src/main/java/com/fastaccess/github/di/modules/FragmentBindingModule.kt new file mode 100644 index 000000000..ee21c7339 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/di/modules/FragmentBindingModule.kt @@ -0,0 +1,83 @@ +package com.fastaccess.github.di.modules + +import com.fastaccess.fasthub.commit.list.CommitListFragment +import com.fastaccess.fasthub.commit.list.CommitPagerFragment +import com.fastaccess.fasthub.commit.view.CommitFragment +import com.fastaccess.fasthub.commit.view.comment.CommitCommentsFragment +import com.fastaccess.fasthub.commit.view.comment.di.CommitCommentsModule +import com.fastaccess.fasthub.commit.view.di.CommitModule +import com.fastaccess.fasthub.commit.view.files.CommitFilesFragment +import com.fastaccess.fasthub.commit.view.files.di.CommitFilesModule +import com.fastaccess.fasthub.dagger.scopes.PerFragment +import com.fastaccess.fasthub.reviews.ReviewsFragment +import com.fastaccess.fasthub.reviews.di.ReviewsModule +import com.fastaccess.github.editor.EditorFragment +import com.fastaccess.github.editor.comment.CommentFragment +import com.fastaccess.github.editor.di.CommentModule +import com.fastaccess.github.editor.di.EditorModule +import com.fastaccess.github.ui.modules.auth.chooser.LoginChooserFragment +import com.fastaccess.github.ui.modules.auth.login.AuthLoginFragment +import com.fastaccess.github.ui.modules.feed.fragment.FeedsFragment +import com.fastaccess.github.ui.modules.issue.fragment.IssueFragment +import com.fastaccess.github.ui.modules.issuesprs.edit.EditIssuePrFragment +import com.fastaccess.github.ui.modules.issuesprs.edit.assignees.AssigneesFragment +import com.fastaccess.github.ui.modules.issuesprs.edit.labels.LabelsFragment +import com.fastaccess.github.ui.modules.issuesprs.edit.lockunlock.LockUnlockFragment +import com.fastaccess.github.ui.modules.issuesprs.edit.milestone.MilestoneFragment +import com.fastaccess.github.ui.modules.issuesprs.fragment.FilterIssuePullRequestsFragment +import com.fastaccess.github.ui.modules.main.fragment.MainFragment +import com.fastaccess.github.ui.modules.notifications.NotificationPagerFragment +import com.fastaccess.github.ui.modules.notifications.fragment.read.AllNotificationsFragment +import com.fastaccess.github.ui.modules.notifications.fragment.unread.UnreadNotificationsFragment +import com.fastaccess.github.ui.modules.pr.fragment.PullRequestFragment +import com.fastaccess.github.ui.modules.profile.feeds.ProfileFeedFragment +import com.fastaccess.github.ui.modules.profile.followersandfollowings.ProfileFollowersFragment +import com.fastaccess.github.ui.modules.profile.fragment.ProfileFragment +import com.fastaccess.github.ui.modules.profile.gists.ProfileGistsFragment +import com.fastaccess.github.ui.modules.profile.orgs.userorgs.UserOrgsFragment +import com.fastaccess.github.ui.modules.profile.repos.ProfileReposFragment +import com.fastaccess.github.ui.modules.profile.starred.ProfileStarredReposFragment +import com.fastaccess.github.ui.modules.search.fragment.SearchFragment +import com.fastaccess.github.ui.modules.trending.fragment.TrendingFragment +import dagger.Module +import dagger.android.ContributesAndroidInjector + +/** + * Created by Kosh on 19.05.18. + */ +@Suppress("unused") +@Module +abstract class FragmentBindingModule { + @PerFragment @ContributesAndroidInjector abstract fun provideLoginChooseFragment(): LoginChooserFragment + @PerFragment @ContributesAndroidInjector abstract fun provideLoginFragment(): AuthLoginFragment + @PerFragment @ContributesAndroidInjector abstract fun provideMainFragment(): MainFragment + @PerFragment @ContributesAndroidInjector abstract fun provideProfileFragment(): ProfileFragment + @PerFragment @ContributesAndroidInjector abstract fun provideProfileReposFragment(): ProfileReposFragment + @PerFragment @ContributesAndroidInjector abstract fun provideProfileStarredReposFragment(): ProfileStarredReposFragment + @PerFragment @ContributesAndroidInjector abstract fun provideProfileGistsFragment(): ProfileGistsFragment + @PerFragment @ContributesAndroidInjector abstract fun provideProfileFollowersFragment(): ProfileFollowersFragment + @PerFragment @ContributesAndroidInjector abstract fun provideProfileFeedsFragment(): ProfileFeedFragment + @PerFragment @ContributesAndroidInjector abstract fun provideFeedsFragment(): FeedsFragment + @PerFragment @ContributesAndroidInjector abstract fun provideNotificationPagerFragment(): NotificationPagerFragment + @PerFragment @ContributesAndroidInjector abstract fun provideUnreadNotificationsFragment(): UnreadNotificationsFragment + @PerFragment @ContributesAndroidInjector abstract fun provideAllNotificationsFragment(): AllNotificationsFragment + @PerFragment @ContributesAndroidInjector abstract fun provideUserOrgsFragment(): UserOrgsFragment + @PerFragment @ContributesAndroidInjector abstract fun provideFilterIssuePullRequestsFragment(): FilterIssuePullRequestsFragment + @PerFragment @ContributesAndroidInjector abstract fun provideSearchFragment(): SearchFragment + @PerFragment @ContributesAndroidInjector abstract fun provideTrendingFragment(): TrendingFragment + @PerFragment @ContributesAndroidInjector abstract fun provideLockUnlockFragment(): LockUnlockFragment + @PerFragment @ContributesAndroidInjector abstract fun provideLabelsFragment(): LabelsFragment + @PerFragment @ContributesAndroidInjector abstract fun provideAssigneesFragment(): AssigneesFragment + @PerFragment @ContributesAndroidInjector abstract fun provideMilestoneFragment(): MilestoneFragment + @PerFragment @ContributesAndroidInjector abstract fun provideCommitListFragment(): CommitListFragment + @PerFragment @ContributesAndroidInjector abstract fun provideCommitPagerFragment(): CommitPagerFragment + @PerFragment @ContributesAndroidInjector(modules = [EditorModule::class]) abstract fun provideEditorFragment(): EditorFragment + @PerFragment @ContributesAndroidInjector(modules = [CommentModule::class]) abstract fun provideCommentFragment(): CommentFragment + @PerFragment @ContributesAndroidInjector(modules = [CommitModule::class]) abstract fun provideCommitFragment(): CommitFragment + @PerFragment @ContributesAndroidInjector(modules = [CommitCommentsModule::class]) abstract fun provideCommitCommentsFragment(): CommitCommentsFragment + @PerFragment @ContributesAndroidInjector(modules = [CommitFilesModule::class]) abstract fun provideCommitFilesFragment(): CommitFilesFragment + @PerFragment @ContributesAndroidInjector(modules = [ReviewsModule::class]) abstract fun provideReviewsFragment(): ReviewsFragment + @PerFragment @ContributesAndroidInjector(modules = [IssueModule::class]) abstract fun provideIssueFragment(): IssueFragment + @PerFragment @ContributesAndroidInjector(modules = [EditIssuePrModule::class]) abstract fun provideEditIssuePrFragment(): EditIssuePrFragment + @PerFragment @ContributesAndroidInjector(modules = [PullRequestModule::class]) abstract fun providePullRequestFragment(): PullRequestFragment +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/di/modules/FragmentModule.kt b/app/src/main/java/com/fastaccess/github/di/modules/FragmentModule.kt new file mode 100644 index 000000000..6f368bc6e --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/di/modules/FragmentModule.kt @@ -0,0 +1,29 @@ +package com.fastaccess.github.di.modules + +import com.fastaccess.fasthub.dagger.scopes.PerFragment +import com.fastaccess.github.editor.di.MentionsModule +import com.fastaccess.github.ui.modules.issue.fragment.IssueFragment +import com.fastaccess.github.ui.modules.issuesprs.edit.EditIssuePrFragment +import com.fastaccess.github.ui.modules.pr.fragment.PullRequestFragment +import com.fastaccess.markdown.di.MarkdownModule +import dagger.Module +import dagger.Provides + +/** + * Created by Kosh on 02.02.19. + */ + +@Module(includes = [MarkdownModule::class, MentionsModule::class]) +class IssueModule { + @PerFragment @Provides fun provideIssueContext(fragment: IssueFragment) = fragment.requireContext() +} + +@Module(includes = [MarkdownModule::class, MentionsModule::class]) +class EditIssuePrModule { + @PerFragment @Provides fun provideEditorContext(fragment: EditIssuePrFragment) = fragment.requireContext() +} + +@Module(includes = [MarkdownModule::class, MentionsModule::class]) +class PullRequestModule { + @PerFragment @Provides fun provideEditorContext(fragment: PullRequestFragment) = fragment.requireContext() +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/di/modules/ViewModelModule.kt b/app/src/main/java/com/fastaccess/github/di/modules/ViewModelModule.kt new file mode 100644 index 000000000..79153beac --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/di/modules/ViewModelModule.kt @@ -0,0 +1,131 @@ +package com.fastaccess.github.di.modules + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.fasthub.commit.list.CommitListViewModel +import com.fastaccess.fasthub.commit.view.CommitViewModel +import com.fastaccess.fasthub.commit.view.comment.CommitCommentsViewModel +import com.fastaccess.fasthub.commit.view.files.CommitFilesViewModel +import com.fastaccess.fasthub.dagger.annotations.ViewModelKey +import com.fastaccess.fasthub.reviews.ReviewsViewModel +import com.fastaccess.github.editor.dialog.UploadPictureViewModel +import com.fastaccess.github.platform.viewmodel.FastHubViewModelFactory +import com.fastaccess.github.ui.modules.auth.LoginChooserViewModel +import com.fastaccess.github.ui.modules.auth.login.LoginViewModel +import com.fastaccess.github.ui.modules.feed.fragment.viewmodel.FeedsViewModel +import com.fastaccess.github.ui.modules.issue.fragment.viewmodel.IssueTimelineViewModel +import com.fastaccess.github.ui.modules.issuesprs.edit.EditIssuePrViewModel +import com.fastaccess.github.ui.modules.issuesprs.edit.assignees.viewmodel.AssigneesViewModel +import com.fastaccess.github.ui.modules.issuesprs.edit.labels.viewmodel.LabelsViewModel +import com.fastaccess.github.ui.modules.issuesprs.edit.milestone.viewmodel.MilestoneViewModel +import com.fastaccess.github.ui.modules.issuesprs.fragment.viewmodel.FilterIssuePullRequestsViewModel +import com.fastaccess.github.ui.modules.main.fragment.viewmodel.MainFragmentViewModel +import com.fastaccess.github.ui.modules.notifications.fragment.read.AllNotificationsViewModel +import com.fastaccess.github.ui.modules.notifications.fragment.unread.viewmodel.UnreadNotificationsViewModel +import com.fastaccess.github.ui.modules.pr.fragment.viewmodel.PullRequestTimelineViewModel +import com.fastaccess.github.ui.modules.profile.feeds.viewmodel.ProfileFeedsViewModel +import com.fastaccess.github.ui.modules.profile.followersandfollowings.viewmodel.FollowersFollowingViewModel +import com.fastaccess.github.ui.modules.profile.fragment.viewmodel.ProfileViewModel +import com.fastaccess.github.ui.modules.profile.gists.viewmodel.ProfileGistsViewModel +import com.fastaccess.github.ui.modules.profile.orgs.userorgs.viewmodel.UserOrgsViewModel +import com.fastaccess.github.ui.modules.profile.repos.viewmodel.ProfileReposViewModel +import com.fastaccess.github.ui.modules.profile.starred.viewmodel.ProfileStarredReposViewModel +import com.fastaccess.github.ui.modules.search.fragment.viewmodel.FilterSearchViewModel +import com.fastaccess.github.ui.modules.trending.fragment.viewmodel.TrendingViewModel +import dagger.Binds +import dagger.Module +import dagger.multibindings.IntoMap + +/** + * Created by Kosh on 21.05.18. + */ +@Suppress("unused") +@Module +abstract class ViewModelModule { + + @Binds abstract fun bindViewModelFactory(factoryFastHub: FastHubViewModelFactory): ViewModelProvider.Factory + + @Binds @IntoMap @ViewModelKey(LoginViewModel::class) + abstract fun bindLoginViewModel(viewModel: LoginViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(MainFragmentViewModel::class) + abstract fun bindMainFragmentViewModel(viewModel: MainFragmentViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(ProfileViewModel::class) + abstract fun bindProfileViewModel(viewModel: ProfileViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(ProfileReposViewModel::class) + abstract fun bindProfileReposViewModel(viewModel: ProfileReposViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(ProfileStarredReposViewModel::class) + abstract fun bindProfileStarredReposViewModel(viewModel: ProfileStarredReposViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(ProfileGistsViewModel::class) + abstract fun bindProfileGistsViewModel(viewModel: ProfileGistsViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(FollowersFollowingViewModel::class) + abstract fun bindFollowersFollowingViewModel(viewModel: FollowersFollowingViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(ProfileFeedsViewModel::class) + abstract fun bindProfileFeedsViewModel(viewModel: ProfileFeedsViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(FeedsViewModel::class) + abstract fun bindFeedsViewModel(viewModel: FeedsViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(UnreadNotificationsViewModel::class) + abstract fun bindUnreadNotificationsViewModel(viewModel: UnreadNotificationsViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(AllNotificationsViewModel::class) + abstract fun bindAllNotificationsViewModel(viewModel: AllNotificationsViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(LoginChooserViewModel::class) + abstract fun bindLoginChooserViewModel(viewModel: LoginChooserViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(UserOrgsViewModel::class) + abstract fun bindUserOrgsViewModel(viewModel: UserOrgsViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(FilterIssuePullRequestsViewModel::class) + abstract fun bindFilterIssuePullRequestsViewModel(viewModel: FilterIssuePullRequestsViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(FilterSearchViewModel::class) + abstract fun bindFilterSearchViewModel(viewModel: FilterSearchViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(TrendingViewModel::class) + abstract fun bindTrendingViewModel(viewModel: TrendingViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(IssueTimelineViewModel::class) + abstract fun bindIssueTimelineViewModel(viewModel: IssueTimelineViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(LabelsViewModel::class) + abstract fun bindLabelsViewModel(viewModel: LabelsViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(AssigneesViewModel::class) + abstract fun bindAssigneesViewModel(viewModel: AssigneesViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(MilestoneViewModel::class) + abstract fun bindMilestoneViewModel(viewModel: MilestoneViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(UploadPictureViewModel::class) + abstract fun bindUploadPictureViewModel(viewModel: UploadPictureViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(EditIssuePrViewModel::class) + abstract fun bindEditIssuePrViewModel(viewModel: EditIssuePrViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(PullRequestTimelineViewModel::class) + abstract fun bindPullRequestTimelineViewModel(viewModel: PullRequestTimelineViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(CommitViewModel::class) + abstract fun bindCommitViewModel(viewModel: CommitViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(CommitCommentsViewModel::class) + abstract fun bindCommitCommentsViewModel(viewModel: CommitCommentsViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(CommitFilesViewModel::class) + abstract fun bindCommitFilesViewModel(viewModel: CommitFilesViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(CommitListViewModel::class) + abstract fun bindCommitListViewModel(viewModel: CommitListViewModel): ViewModel + + @Binds @IntoMap @ViewModelKey(ReviewsViewModel::class) + abstract fun bindReviewsViewModel(viewModel: ReviewsViewModel): ViewModel +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/di/modules/WorkersModule.kt b/app/src/main/java/com/fastaccess/github/di/modules/WorkersModule.kt new file mode 100644 index 000000000..1480339dd --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/di/modules/WorkersModule.kt @@ -0,0 +1,24 @@ +package com.fastaccess.github.di.modules + +import androidx.work.RxWorker +import com.fastaccess.fasthub.dagger.annotations.WorkerKey +import com.fastaccess.github.platform.works.MarkAsReadNotificationWorker +import com.fastaccess.fasthub.reactions.ReactionWorker +import dagger.Binds +import dagger.Module +import dagger.multibindings.IntoMap + +/** + * Created by Kosh on 12.01.19. + */ +@Module abstract class WorkersModule { + @Binds + @IntoMap + @WorkerKey(MarkAsReadNotificationWorker::class) + abstract fun bindMarkAsReadNotificationWorker(worker: MarkAsReadNotificationWorker): RxWorker + + @Binds + @IntoMap + @WorkerKey(ReactionWorker::class) + abstract fun bindReactionWorker(worker: ReactionWorker): RxWorker +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/platform/extension/ClickExtenion.kt b/app/src/main/java/com/fastaccess/github/platform/extension/ClickExtenion.kt new file mode 100644 index 000000000..3cfbf7a5a --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/platform/extension/ClickExtenion.kt @@ -0,0 +1,58 @@ +@file:Suppress("UNCHECKED_CAST") + +package com.fastaccess.github.platform.extension + +import androidx.fragment.app.Fragment +import com.fastaccess.data.model.MainScreenModel +import com.fastaccess.data.model.MainScreenModelRowType +import com.fastaccess.data.persistence.models.FeedModel +import com.fastaccess.domain.response.enums.EventsType +import com.fastaccess.fasthub.commit.dialog.CommitListBottomSheetDialog +import com.fastaccess.github.base.utils.FEEDS_LINK +import com.fastaccess.github.base.utils.FILTER_ISSUE_LINK +import com.fastaccess.github.base.utils.FILTER_PR_LINK +import com.fastaccess.github.base.utils.NOTIFICATION_LINK +import com.fastaccess.github.extensions.route +import timber.log.Timber + +/** + * Created by Kosh on 2019-01-29. + */ + + +fun MainScreenModel.onClick(fragment: Fragment) { + val model = this + when (model.mainScreenModelRowType) { + MainScreenModelRowType.FEED_TITLE -> fragment.route(FEEDS_LINK) + MainScreenModelRowType.FEED -> model.feed?.onClick(fragment) + MainScreenModelRowType.NOTIFICATION_TITLE -> fragment.route(NOTIFICATION_LINK) + MainScreenModelRowType.NOTIFICATION -> Timber.e("${model.notificationModel}") + MainScreenModelRowType.ISSUES_TITLE -> fragment.route(FILTER_ISSUE_LINK) + MainScreenModelRowType.ISSUES -> fragment.route("${model.issuesPullsModel?.url}") + MainScreenModelRowType.PRS_TITLE -> fragment.route(FILTER_PR_LINK) + MainScreenModelRowType.PRS -> fragment.route(model.issuesPullsModel?.url) + } +} + +fun FeedModel.onClick(fragment: Fragment) { + Timber.e("$type") + when (type) { + EventsType.IssueCommentEvent -> fragment.route("${payload?.issue?.htmlUrl}") + EventsType.IssuesEvent -> fragment.route("${payload?.issue?.htmlUrl}") + EventsType.PullRequestEvent -> fragment.route("${payload?.pullRequest?.htmlUrl}") + EventsType.PullRequestReviewCommentEvent -> fragment.route("${payload?.pullRequest?.htmlUrl}") + EventsType.PullRequestReviewEvent -> fragment.route("${payload?.pullRequest?.htmlUrl}") + EventsType.PushEvent -> { + payload?.commits?.let { list -> + if (list.size > 1) { + val m = payload?.commits?.associateBy({ it.sha?.take(7) ?: "" }, { it.url }) + CommitListBottomSheetDialog.show(fragment.childFragmentManager, m as HashMap) + } else { + fragment.route(list[0].url) + } + } + + } + else -> fragment.route(actor?.url) // TODO(handle click) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/platform/fabric/FabricProvider.kt b/app/src/main/java/com/fastaccess/github/platform/fabric/FabricProvider.kt new file mode 100644 index 000000000..7f842c243 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/platform/fabric/FabricProvider.kt @@ -0,0 +1,33 @@ +package com.fastaccess.github.platform.fabric + +import android.content.Context +import com.crashlytics.android.BuildConfig +import com.crashlytics.android.Crashlytics +import com.crashlytics.android.answers.Answers +import com.crashlytics.android.answers.PurchaseEvent +import com.crashlytics.android.core.CrashlyticsCore +import io.fabric.sdk.android.Fabric +import java.math.BigDecimal +import java.math.RoundingMode + +object FabricProvider { + + fun initFabric(context: Context) { + val fabric = Fabric.Builder(context) + .kits(Crashlytics.Builder() + .core(CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()) + .build()) + .debuggable(BuildConfig.DEBUG) + .build() + Fabric.with(fabric) + } + + fun logPurchase(productKey: String, price: Long? = null, priceText: String? = null) { + val purchaseEvent = PurchaseEvent() + .putItemName(productKey) + .putSuccess(true) + priceText?.let { purchaseEvent.putItemType(it) } + price?.let { purchaseEvent.putItemPrice(BigDecimal(it).setScale(2, RoundingMode.CEILING)) } + Answers.getInstance().logPurchase(purchaseEvent) + } +} diff --git a/app/src/main/java/com/fastaccess/GlideModule.kt b/app/src/main/java/com/fastaccess/github/platform/glide/GlideModule.kt similarity index 76% rename from app/src/main/java/com/fastaccess/GlideModule.kt rename to app/src/main/java/com/fastaccess/github/platform/glide/GlideModule.kt index bcb42df20..709e27548 100644 --- a/app/src/main/java/com/fastaccess/GlideModule.kt +++ b/app/src/main/java/com/fastaccess/github/platform/glide/GlideModule.kt @@ -1,4 +1,4 @@ -package com.fastaccess +package com.fastaccess.github.platform.glide import com.bumptech.glide.annotation.GlideModule import com.bumptech.glide.module.AppGlideModule diff --git a/app/src/main/java/com/fastaccess/github/platform/timber/LogTree.kt b/app/src/main/java/com/fastaccess/github/platform/timber/LogTree.kt new file mode 100644 index 000000000..706a722a3 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/platform/timber/LogTree.kt @@ -0,0 +1,36 @@ +package com.fastaccess.github.platform.timber + +import android.util.Log +import com.crashlytics.android.Crashlytics +import timber.log.Timber + +class FabricTree : Timber.Tree() { + + override fun log(priority: Int, tag: String?, message: String, t: Throwable?) { + if (priority == Log.VERBOSE || priority == Log.DEBUG || priority == Log.INFO) { + return + } + + Crashlytics.setInt(CRASHLYTICS_KEY_PRIORITY, priority) + Crashlytics.setString(CRASHLYTICS_KEY_TAG, tag) + Crashlytics.setString(CRASHLYTICS_KEY_MESSAGE, message) + if (t == null) { + Crashlytics.logException(Exception(message)) + } else { + Crashlytics.logException(t) + } + } + + companion object { + private const val CRASHLYTICS_KEY_PRIORITY = "priority" + private const val CRASHLYTICS_KEY_TAG = "tag" + private const val CRASHLYTICS_KEY_MESSAGE = "message" + } +} + +class FastHubTree : Timber.DebugTree() { + override fun createStackElementTag(element: StackTraceElement): String? { + val className = super.createStackElementTag(element)?.split("$")?.get(0) + return "($className.kt:${element.lineNumber})#${element.methodName}" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/platform/viewmodel/FastHubViewModelFactory.kt b/app/src/main/java/com/fastaccess/github/platform/viewmodel/FastHubViewModelFactory.kt new file mode 100644 index 000000000..aed68af80 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/platform/viewmodel/FastHubViewModelFactory.kt @@ -0,0 +1,26 @@ +package com.fastaccess.github.platform.viewmodel + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.ViewModelProvider + +import javax.inject.Inject +import javax.inject.Provider +import javax.inject.Singleton + +@Singleton +class FastHubViewModelFactory @Inject constructor( + private val creators: Map, @JvmSuppressWildcards Provider> +) : ViewModelProvider.Factory { + override fun create(modelClass: Class): T { + val creator = creators[modelClass] ?: creators.entries.firstOrNull { + modelClass.isAssignableFrom(it.key) + }?.value ?: throw IllegalArgumentException("unknown model class $modelClass") + try { + @Suppress("UNCHECKED_CAST") + return creator.get() as T + } catch (e: Exception) { + throw RuntimeException(e) + } + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/platform/workmanager/DaggerWorkerFactory.kt b/app/src/main/java/com/fastaccess/github/platform/workmanager/DaggerWorkerFactory.kt new file mode 100644 index 000000000..62c605537 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/platform/workmanager/DaggerWorkerFactory.kt @@ -0,0 +1,51 @@ +package com.fastaccess.github.platform.workmanager + +import android.content.Context +import androidx.work.ListenableWorker +import androidx.work.RxWorker +import androidx.work.WorkerFactory +import androidx.work.WorkerParameters +import com.fastaccess.github.di.components.WorkerSubComponent +import javax.inject.Inject +import javax.inject.Provider +import javax.inject.Singleton + +@Singleton +class DaggerWorkerFactory @Inject constructor( + private val workerSubComponent: WorkerSubComponent.Builder +) : WorkerFactory() { + + override fun createWorker( + appContext: Context, + workerClassName: String, + workerParameters: WorkerParameters + ) = workerSubComponent + .workerParameters(workerParameters) + .build().run { + createWorker(workerClassName, workers()) + } + + private fun createWorker( + workerClassName: String, + workers: Map, Provider> + ): ListenableWorker? = try { + val workerClass = Class.forName(workerClassName).asSubclass(RxWorker::class.java) + + var provider = workers[workerClass] + if (provider == null) { + for ((key, value) in workers) { + if (workerClass.isAssignableFrom(key)) { + provider = value + break + } + } + } + if (provider == null) { + throw IllegalArgumentException("Missing binding for $workerClassName") + } + + provider.get() + } catch (e: Exception) { + throw RuntimeException(e) + } +} diff --git a/app/src/main/java/com/fastaccess/github/platform/works/MarkAsReadNotificationWorker.kt b/app/src/main/java/com/fastaccess/github/platform/works/MarkAsReadNotificationWorker.kt new file mode 100644 index 000000000..5ac21876c --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/platform/works/MarkAsReadNotificationWorker.kt @@ -0,0 +1,72 @@ +package com.fastaccess.github.platform.works + +import android.app.Application +import androidx.work.* +import com.fastaccess.data.repository.NotificationRepository +import com.fastaccess.domain.services.NotificationService +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.base.utils.EXTRA_TWO +import io.reactivex.Single +import javax.inject.Inject + +/** + * Created by Kosh on 12.01.19. + */ +class MarkAsReadNotificationWorker @Inject constructor( + context: Application, + private val workerParams: WorkerParameters, + private val notificationService: NotificationService, + private val provider: NotificationRepository +) : RxWorker(context, workerParams) { + override fun createWork(): Single { + val id = workerParams.inputData.getString(EXTRA) + val ids = workerParams.inputData.getStringArray(EXTRA_TWO) + if (id.isNullOrEmpty() && ids.isNullOrEmpty()) { + return Single.just(Result.failure()) + } + return if (!id.isNullOrEmpty()) markSingleAsRead(id) else if (!ids.isNullOrEmpty()) markMultiAsRead(ids) else Single.just(Result.failure()) + } + + private fun markSingleAsRead(id: String): Single { + return Single.fromObservable(notificationService.markAsRead(id)) + .doOnSuccess { + if (it.code() == 205) { + provider.markAsRead(id) + } + } + .map { if (it.code() == 205) Result.success() else Result.failure() } + .onErrorReturnItem(Result.failure()) + } + + private fun markMultiAsRead(ids: Array): Single { + return Single.fromPublisher { subscriber -> + provider.markAllAsRead() + kotlin.runCatching { + ids.forEach { + notificationService.markAsRead(it).blockingSingle() + } + } + subscriber.onNext(Result.success()) // always succeed + subscriber.onComplete() + } + } + + companion object { + fun enqueue(id: String? = null, ids: Array? = null) { + val workManager = WorkManager.getInstance() + workManager.enqueueUniqueWork(id ?: ids?.hashCode()?.toString() ?: "MarkAsReadNotificationWorker", + ExistingWorkPolicy.KEEP, OneTimeWorkRequest.Builder(MarkAsReadNotificationWorker::class.java) + .setInputData(Data.Builder() + .apply { + if (!id.isNullOrEmpty()) { + putString(EXTRA, id) + } + if (!ids.isNullOrEmpty()) { + putStringArray(EXTRA_TWO, ids) + } + } + .build()) + .build()) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/AllNotificationsAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/AllNotificationsAdapter.kt new file mode 100644 index 000000000..6993b25ae --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/AllNotificationsAdapter.kt @@ -0,0 +1,52 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.core.view.isVisible +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.ListAdapter +import androidx.recyclerview.widget.RecyclerView +import com.fastaccess.data.model.GroupedNotificationsModel +import com.fastaccess.github.ui.adapter.viewholder.NotificationsViewHolder +import com.fastaccess.github.ui.adapter.viewholder.TitleSectionViewHolder + +/** + * Created by Kosh on 04.11.18. + */ +class AllNotificationsAdapter : ListAdapter(DIFF_CALLBACK) { + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { + return when (viewType) { + GroupedNotificationsModel.HEADER -> TitleSectionViewHolder(parent) + else -> NotificationsViewHolder(parent) + } + } + + override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { + val item = getItem(position) ?: return + when (holder) { + is NotificationsViewHolder -> { + val notification = item.notification + if (notification != null) { + holder.bind(notification) + } else { + holder.itemView.isVisible = false + } + } + is TitleSectionViewHolder -> holder.bind(item.repo?.fullName ?: item.repo?.name ?: "N/A") + } + } + + override fun getItemViewType(position: Int): Int { + return getItem(position).rowType + } + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: GroupedNotificationsModel, newItem: GroupedNotificationsModel): + Boolean = oldItem.rowType == newItem.rowType + + override fun areContentsTheSame(oldItem: GroupedNotificationsModel, newItem: GroupedNotificationsModel): + Boolean = oldItem == newItem + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/AssigneesAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/AssigneesAdapter.kt new file mode 100644 index 000000000..20d83ad26 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/AssigneesAdapter.kt @@ -0,0 +1,45 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.ListAdapter +import com.fastaccess.data.model.ShortUserModel +import com.fastaccess.github.ui.adapter.viewholder.AssigneeViewHolder + +/** + * Created by Kosh on 20.01.19. + */ +class AssigneesAdapter( + val selection: HashSet, + val deselection: HashSet +) : ListAdapter(DIFF_CALLBACK) { + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AssigneeViewHolder = AssigneeViewHolder(parent).apply { + itemView.let { view -> + view.setOnClickListener { + val position = adapterPosition + val item = getItem(position) + if (!selection.contains(item)) { + selection.add(item) + deselection.remove(item) + } else { + deselection.add(item) + selection.remove(item) + } + notifyItemChanged(position) + } + } + } + + override fun onBindViewHolder(holder: AssigneeViewHolder, position: Int) { + val item = getItem(position) + holder.bind(item, selection.contains(item)) + } + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: ShortUserModel, newItem: ShortUserModel): Boolean = oldItem.name == newItem.name + override fun areContentsTheSame(oldItem: ShortUserModel, newItem: ShortUserModel): Boolean = oldItem == newItem + } + } +} diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/IssueTimelineAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/IssueTimelineAdapter.kt new file mode 100644 index 000000000..5e2952c73 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/IssueTimelineAdapter.kt @@ -0,0 +1,137 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.core.view.isVisible +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.ListAdapter +import androidx.recyclerview.widget.RecyclerView +import com.fastaccess.data.model.CommentModel +import com.fastaccess.data.model.ReviewModel +import com.fastaccess.data.model.TimelineModel +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.github.base.adapter.LoadingViewHolder +import com.fastaccess.github.ui.adapter.viewholder.CommentViewHolder +import com.fastaccess.github.ui.adapter.viewholder.CommitThreadViewHolder +import com.fastaccess.github.ui.adapter.viewholder.IssueContentViewHolder +import com.fastaccess.github.ui.adapter.viewholder.ReviewViewHolder +import io.noties.markwon.Markwon + +/** + * Created by Kosh on 20.01.19. + */ +class IssueTimelineAdapter( + private val markwon: Markwon, + private val theme: Int, + private val commentClickListener: (position: Int, model: CommentModel) -> Unit, + private val deleteCommentListener: (position: Int, model: TimelineModel) -> Unit, + private val editCommentListener: (position: Int, model: TimelineModel) -> Unit, + private val reviewClickListener: ((model: ReviewModel) -> Unit)? = null +) : ListAdapter(DIFF_CALLBACK) { + + private val notifyCallback by lazy { + { position: Int -> + notifyItemChanged(position) + } + } + + override fun getItemViewType(position: Int): Int { + return getItem(position)?.let { + when { + it.comment != null -> COMMENT + !it.review?.body.isNullOrEmpty() || it.review?.comment != null -> REVIEW_THREAD + it.commitThread != null -> COMMIT_THREAD + else -> CONTENT + } + } ?: super.getItemViewType(position) + } + + override fun onCreateViewHolder( + parent: ViewGroup, + viewType: Int + ): RecyclerView.ViewHolder { + return when (viewType) { + COMMENT -> CommentViewHolder(parent, markwon, theme, notifyCallback, { position -> + getItemByPosition(position)?.let { deleteCommentListener.invoke(position, it) } + }, { position -> + getItemByPosition(position)?.let { editCommentListener.invoke(position, it) } + }).apply { + itemView.setOnClickListener { + val position = adapterPosition + if (position == RecyclerView.NO_POSITION) return@setOnClickListener + getItemByPosition(position)?.comment?.let { commentClickListener.invoke(position, it) } + } + } + REVIEW_THREAD -> ReviewViewHolder(parent, markwon, theme, notifyCallback, { position, isReviewBody -> + getItemByPosition(position)?.let { + it.review?.isReviewBody = isReviewBody + deleteCommentListener.invoke(position, it) + } + }, { position, isReviewBody -> + getItemByPosition(position)?.let { + it.review?.isReviewBody = isReviewBody + editCommentListener.invoke(position, it) + } + }).apply { + itemView.setOnClickListener { + val position = adapterPosition + if (position == RecyclerView.NO_POSITION) return@setOnClickListener + getItemByPosition(position)?.review?.let { reviewClickListener?.invoke(it) } + } + } + COMMIT_THREAD -> CommitThreadViewHolder(parent, markwon, theme, notifyCallback, { position -> + getItemByPosition(position)?.let { deleteCommentListener.invoke(position, it) } + }, { position -> + getItemByPosition(position)?.let { editCommentListener.invoke(position, it) } + }).apply { + itemView.setOnClickListener { + val position = adapterPosition + if (position == RecyclerView.NO_POSITION) return@setOnClickListener + getItemByPosition(position)?.comment?.let { commentClickListener.invoke(position, it) } + } + } + CONTENT -> IssueContentViewHolder(parent) + else -> LoadingViewHolder(parent).apply { itemView.isVisible = false } + } + } + + override fun onBindViewHolder( + holder: RecyclerView.ViewHolder, + position: Int + ) { + when (holder) { + is CommentViewHolder -> holder.bind(getItem(position).comment) + is ReviewViewHolder -> holder.bind(getItem(position).review) + is CommitThreadViewHolder -> holder.bind(getItem(position).commitThread) + is IssueContentViewHolder -> holder.bind(getItem(position)) + } + } + + override fun onViewRecycled(holder: RecyclerView.ViewHolder) { + if (holder is BaseViewHolder<*>) { + holder.onDetached() + } + super.onViewRecycled(holder) + } + + fun getItemByPosition(position: Int): TimelineModel? = runCatching { getItem(position) }.getOrNull() + + companion object { + private const val HEADER = 1 + private const val COMMENT = 2 + private const val CONTENT = 3 + private const val REVIEW_THREAD = 4 + private const val COMMIT_THREAD = 5 + + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame( + oldItem: TimelineModel, + newItem: TimelineModel + ): Boolean = oldItem.hashCode() == newItem.hashCode() + + override fun areContentsTheSame( + oldItem: TimelineModel, + newItem: TimelineModel + ): Boolean = oldItem == newItem + } + } +} diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/LabelColorAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/LabelColorAdapter.kt new file mode 100644 index 000000000..36265b460 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/LabelColorAdapter.kt @@ -0,0 +1,23 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import com.fastaccess.github.ui.adapter.viewholder.LabelColorViewHolder + +/** + * Created by Kosh on 07.03.19. + */ +class LabelColorAdapter( + private val list: List, + private val callback: (String) -> Unit +) : RecyclerView.Adapter() { + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): LabelColorViewHolder = LabelColorViewHolder(parent).apply { + itemView.setOnClickListener { + callback.invoke(list[adapterPosition]) + } + } + + override fun getItemCount(): Int = list.size + override fun onBindViewHolder(holder: LabelColorViewHolder, position: Int) = holder.bind(list[position]) +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/LabelsAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/LabelsAdapter.kt new file mode 100644 index 000000000..5daaae5d6 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/LabelsAdapter.kt @@ -0,0 +1,45 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.ListAdapter +import com.fastaccess.data.model.parcelable.LabelModel +import com.fastaccess.github.ui.adapter.viewholder.LabelViewHolder + +/** + * Created by Kosh on 20.01.19. + */ +class LabelsAdapter( + val selection: HashSet, + val deselection: HashSet +) : ListAdapter(DIFF_CALLBACK) { + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): LabelViewHolder = LabelViewHolder(parent).apply { + itemView.let { view -> + view.setOnClickListener { + val position = adapterPosition + val item = getItem(position) + if (!selection.contains(item)) { + selection.add(item) + deselection.remove(item) + } else { + deselection.add(item) + selection.remove(item) + } + notifyItemChanged(position) + } + } + } + + override fun onBindViewHolder(holder: LabelViewHolder, position: Int) { + val item = getItem(position) + holder.bind(item, selection.contains(item)) + } + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: LabelModel, newItem: LabelModel): Boolean = oldItem.name == newItem.name + override fun areContentsTheSame(oldItem: LabelModel, newItem: LabelModel): Boolean = oldItem == newItem + } + } +} diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/LanguagesAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/LanguagesAdapter.kt new file mode 100644 index 000000000..56f6bbe41 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/LanguagesAdapter.kt @@ -0,0 +1,39 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.ListAdapter +import com.fastaccess.data.model.LanguageColorsModel +import com.fastaccess.github.ui.adapter.viewholder.LanguagesViewHolder +import kotlinx.android.synthetic.main.language_row_item.view.* + +/** + * Created by Kosh on 20.01.19. + */ +class LanguagesAdapter : ListAdapter(DIFF_CALLBACK) { + + var checkedLanguage = "All" + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): LanguagesViewHolder = LanguagesViewHolder(this, parent).apply { + itemView.languageChip.let { chip -> + chip.setOnClickListener { + val isChecked = chip.isChecked + checkedLanguage = if (isChecked) { + chip.text?.toString() ?: "All" + } else { + "All" + } + notifyDataSetChanged() + } + } + } + + override fun onBindViewHolder(holder: LanguagesViewHolder, position: Int) = holder.bind(getItem(position)) + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: LanguageColorsModel, newItem: LanguageColorsModel): Boolean = oldItem.name == newItem.name + override fun areContentsTheSame(oldItem: LanguageColorsModel, newItem: LanguageColorsModel): Boolean = oldItem == newItem + } + } +} diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/LoggedInUsersAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/LoggedInUsersAdapter.kt new file mode 100644 index 000000000..431007fd1 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/LoggedInUsersAdapter.kt @@ -0,0 +1,30 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.ListAdapter +import androidx.recyclerview.widget.RecyclerView +import com.fastaccess.data.persistence.models.LoginModel +import com.fastaccess.github.ui.adapter.viewholder.LoggedInUserViewHolder + +/** + * Created by Kosh on 12.10.18. + */ +class LoggedInUsersAdapter(private val onClick: (user: LoginModel) -> Unit) : ListAdapter(DIFF_CALLBACK) { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): LoggedInUserViewHolder = LoggedInUserViewHolder(parent).apply { + itemView.setOnClickListener { + val position = adapterPosition + if (position == RecyclerView.NO_POSITION) return@setOnClickListener + getItem(position)?.let(onClick) + } + } + + override fun onBindViewHolder(holder: LoggedInUserViewHolder, position: Int) = holder.bind(getItem(position)) + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: LoginModel, newItem: LoginModel): Boolean = oldItem.login == newItem.login + override fun areContentsTheSame(oldItem: LoginModel, newItem: LoginModel): Boolean = oldItem == newItem + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/MainScreenAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/MainScreenAdapter.kt new file mode 100644 index 000000000..ef52c2b7f --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/MainScreenAdapter.kt @@ -0,0 +1,105 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.core.view.isVisible +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.ListAdapter +import androidx.recyclerview.widget.RecyclerView +import com.fastaccess.data.model.MainScreenModel +import com.fastaccess.data.model.MainScreenModelRowType +import com.fastaccess.github.R +import com.fastaccess.github.extensions.getDrawableCompat +import com.fastaccess.github.ui.adapter.viewholder.FeedsViewHolder +import com.fastaccess.github.ui.adapter.viewholder.MyIssuesPrsViewHolder +import com.fastaccess.github.ui.adapter.viewholder.NotificationsViewHolder +import com.fastaccess.github.ui.adapter.viewholder.TitleSectionViewHolder +import com.fastaccess.markdown.widget.SpannableBuilder + +/** + * Created by Kosh on 04.11.18. + */ +class MainScreenAdapter( + private val clickListener: (model: MainScreenModel) -> Unit +) : ListAdapter(DIFF_CALLBACK) { + + override fun onCreateViewHolder( + parent: ViewGroup, + viewType: Int + ): RecyclerView.ViewHolder { + return when (viewType) { + MainScreenModelRowType.FEED.rowType -> FeedsViewHolder(parent).apply { setOnClick(this) } + MainScreenModelRowType.NOTIFICATION.rowType -> NotificationsViewHolder(parent).apply { setOnClick(this) } + MainScreenModelRowType.ISSUES.rowType -> MyIssuesPrsViewHolder(parent).apply { setOnClick(this) } + MainScreenModelRowType.PRS.rowType -> MyIssuesPrsViewHolder(parent).apply { setOnClick(this) } + else -> TitleSectionViewHolder(parent).apply { setOnClick(this) } + } + } + + private fun setOnClick(viewHolder: RecyclerView.ViewHolder) { + viewHolder.itemView.setOnClickListener { + val position = viewHolder.adapterPosition + if (position > RecyclerView.NO_POSITION) { + clickListener.invoke(getItem(position)) + } + } + } + + + override fun getItemCount(): Int { + val count = super.getItemCount() + if (count > 24) { + return 24 + } + return count + } + + override fun onBindViewHolder( + holder: RecyclerView.ViewHolder, + position: Int + ) { + val item = getItem(position) ?: return + when (holder) { + is FeedsViewHolder -> item.feed?.let { holder.bind(it) } + is NotificationsViewHolder -> item.notificationModel?.let { holder.bind(it) } + is MyIssuesPrsViewHolder -> item.issuesPullsModel?.let { holder.bind(it) } + is TitleSectionViewHolder -> { + when (item.mainScreenModelRowType) { + MainScreenModelRowType.FEED_TITLE -> holder.bind(holder.itemView.context.getString(R.string.feeds)) + MainScreenModelRowType.NOTIFICATION_TITLE -> holder.bind( + if (item.hasBubble) { + SpannableBuilder.builder() + .append(holder.itemView.context.getString(R.string.notifications)) + .space().space() + .append(holder.itemView.context.getDrawableCompat(R.drawable.circle_shape_red_small)) + } else { + holder.itemView.context.getString(R.string.notifications) + } + ) + MainScreenModelRowType.ISSUES_TITLE -> holder.bind(holder.itemView.context.getString(R.string.issues)) + MainScreenModelRowType.PRS_TITLE -> holder.bind(holder.itemView.context.getString(R.string.pull_requests)) + else -> holder.itemView.isVisible = false + } + } + } + } + + override fun getItemViewType(position: Int): Int { + return getItem(position).mainScreenModelRowType?.rowType ?: super.getItemViewType(position) + } + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame( + oldItem: MainScreenModel, + newItem: MainScreenModel + ): + Boolean = oldItem.mainScreenModelRowType == newItem.mainScreenModelRowType + + override fun areContentsTheSame( + oldItem: MainScreenModel, + newItem: MainScreenModel + ): + Boolean = oldItem == newItem + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/MilestonesAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/MilestonesAdapter.kt new file mode 100644 index 000000000..499b242cc --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/MilestonesAdapter.kt @@ -0,0 +1,35 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.ListAdapter +import com.fastaccess.data.model.parcelable.MilestoneModel +import com.fastaccess.github.ui.adapter.viewholder.MilestoneViewHolder + +/** + * Created by Kosh on 20.01.19. + */ +class MilestonesAdapter( + private val clickCallback: (MilestoneModel) -> Unit +) : ListAdapter(DIFF_CALLBACK) { + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MilestoneViewHolder = MilestoneViewHolder(parent).apply { + itemView.let { view -> + view.setOnClickListener { + getItem(adapterPosition)?.let(clickCallback) + } + } + } + + override fun onBindViewHolder(holder: MilestoneViewHolder, position: Int) { + val item = getItem(position) + holder.bind(item) + } + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: MilestoneModel, newItem: MilestoneModel): Boolean = oldItem.id == newItem.id + override fun areContentsTheSame(oldItem: MilestoneModel, newItem: MilestoneModel): Boolean = oldItem == newItem + } + } +} diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/MyIssuesPrsAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/MyIssuesPrsAdapter.kt new file mode 100644 index 000000000..33fc5f2fe --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/MyIssuesPrsAdapter.kt @@ -0,0 +1,34 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.ListAdapter +import androidx.recyclerview.widget.RecyclerView +import com.fastaccess.data.persistence.models.MyIssuesPullsModel +import com.fastaccess.github.ui.adapter.viewholder.MyIssuesPrsViewHolder + +/** + * Created by Kosh on 20.01.19. + */ +class MyIssuesPrsAdapter( + private val onClick: (model: MyIssuesPullsModel) -> Unit +) : ListAdapter(DIFF_CALLBACK) { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyIssuesPrsViewHolder = MyIssuesPrsViewHolder(parent).apply { + itemView.setOnClickListener { _ -> + val position = adapterPosition + if (position == RecyclerView.NO_POSITION) return@setOnClickListener + kotlin.runCatching { getItem(position) }.onSuccess { + onClick(it) + } + } + } + + override fun onBindViewHolder(holder: MyIssuesPrsViewHolder, position: Int) = holder.bind(getItem(position)) + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: MyIssuesPullsModel, newItem: MyIssuesPullsModel): Boolean = oldItem.id == newItem.id + override fun areContentsTheSame(oldItem: MyIssuesPullsModel, newItem: MyIssuesPullsModel): Boolean = oldItem == newItem + } + } +} diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/OrganizationsAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/OrganizationsAdapter.kt new file mode 100644 index 000000000..7077df62b --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/OrganizationsAdapter.kt @@ -0,0 +1,30 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.RecyclerView +import com.fastaccess.data.persistence.models.OrganizationModel +import com.fastaccess.github.base.adapter.BasePagedAdapter +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.github.ui.adapter.viewholder.OrganizationViewHolder + +/** + * Created by Kosh on 12.10.18. + */ +class OrganizationsAdapter(private val onClick: (url: String) -> Unit) : BasePagedAdapter(DIFF_CALLBACK) { + + override fun contentViewHolder(parent: ViewGroup): BaseViewHolder = OrganizationViewHolder(parent).apply { + itemView.setOnClickListener { + val position = adapterPosition + if (position == RecyclerView.NO_POSITION) return@setOnClickListener + getItem(position)?.url?.let(onClick) + } + } + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: OrganizationModel, newItem: OrganizationModel): Boolean = oldItem.login == newItem.login + override fun areContentsTheSame(oldItem: OrganizationModel, newItem: OrganizationModel): Boolean = oldItem == newItem + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/ProfileFeedsAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/ProfileFeedsAdapter.kt new file mode 100644 index 000000000..96ea03c21 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/ProfileFeedsAdapter.kt @@ -0,0 +1,30 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.RecyclerView +import com.fastaccess.data.persistence.models.FeedModel +import com.fastaccess.github.base.adapter.BasePagedAdapter +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.github.ui.adapter.viewholder.FeedsViewHolder + +/** + * Created by Kosh on 12.10.18. + */ +class ProfileFeedsAdapter(private val onClick: (model: FeedModel) -> Unit) : BasePagedAdapter(DIFF_CALLBACK) { + + override fun contentViewHolder(parent: ViewGroup): BaseViewHolder = FeedsViewHolder(parent).apply { + itemView.setOnClickListener { + val position = adapterPosition + if (position == RecyclerView.NO_POSITION) return@setOnClickListener + getItem(position)?.let(onClick) + } + } + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: FeedModel, newItem: FeedModel): Boolean = oldItem.id == newItem.id + override fun areContentsTheSame(oldItem: FeedModel, newItem: FeedModel): Boolean = oldItem == newItem + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/ProfileFollowingFollowersAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/ProfileFollowingFollowersAdapter.kt new file mode 100644 index 000000000..e6d3faacc --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/ProfileFollowingFollowersAdapter.kt @@ -0,0 +1,30 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.RecyclerView +import com.fastaccess.data.persistence.models.FollowingFollowerModel +import com.fastaccess.github.base.adapter.BasePagedAdapter +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.github.ui.adapter.viewholder.ProfileFollowerFollowingViewHolder + +/** + * Created by Kosh on 12.10.18. + */ +class ProfileFollowingFollowersAdapter(private val onClick: (url: String) -> Unit) : BasePagedAdapter(DIFF_CALLBACK) { + + override fun contentViewHolder(parent: ViewGroup): BaseViewHolder = ProfileFollowerFollowingViewHolder(parent).apply { + itemView.setOnClickListener { + val position = adapterPosition + if (position == RecyclerView.NO_POSITION) return@setOnClickListener + getItem(position)?.url?.let(onClick) + } + } + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: FollowingFollowerModel, newItem: FollowingFollowerModel): Boolean = oldItem.login == newItem.login + override fun areContentsTheSame(oldItem: FollowingFollowerModel, newItem: FollowingFollowerModel): Boolean = oldItem == newItem + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/ProfileGistsAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/ProfileGistsAdapter.kt new file mode 100644 index 000000000..e56e7fe4c --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/ProfileGistsAdapter.kt @@ -0,0 +1,23 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.DiffUtil +import com.fastaccess.data.persistence.models.ProfileGistModel +import com.fastaccess.github.base.adapter.BasePagedAdapter +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.github.ui.adapter.viewholder.ProfileGistsViewHolder + +/** + * Created by Kosh on 12.10.18. + */ +class ProfileGistsAdapter : BasePagedAdapter(DIFF_CALLBACK) { + + override fun contentViewHolder(parent: ViewGroup): BaseViewHolder = ProfileGistsViewHolder(parent) + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: ProfileGistModel, newItem: ProfileGistModel): Boolean = oldItem.id == newItem.id + override fun areContentsTheSame(oldItem: ProfileGistModel, newItem: ProfileGistModel): Boolean = oldItem == newItem + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/ProfileOrgsAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/ProfileOrgsAdapter.kt new file mode 100644 index 000000000..2aa75b6c3 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/ProfileOrgsAdapter.kt @@ -0,0 +1,24 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import com.fastaccess.data.persistence.models.UserOrganizationNodesModel +import com.fastaccess.github.ui.adapter.viewholder.ProfileOrgsViewHolder + +/** + * Created by Kosh on 2018-11-17. + */ +class ProfileOrgsAdapter(private val list: ArrayList) : RecyclerView.Adapter() { + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ProfileOrgsViewHolder = ProfileOrgsViewHolder(parent) + override fun getItemCount(): Int = list.size + override fun onBindViewHolder(holder: ProfileOrgsViewHolder, position: Int) = holder.bind(list[position]) + + fun insertNew(list: List) { + this.list.apply { + clear() + addAll(list) + notifyDataSetChanged() + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/ProfilePinnedReposAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/ProfilePinnedReposAdapter.kt new file mode 100644 index 000000000..126daa8b9 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/ProfilePinnedReposAdapter.kt @@ -0,0 +1,24 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import com.fastaccess.data.persistence.models.UserPinnedRepoNodesModel +import com.fastaccess.github.ui.adapter.viewholder.ProfilePinnedReposViewHolder + +/** + * Created by Kosh on 2018-11-17. + */ +class ProfilePinnedReposAdapter(private val list: ArrayList) : RecyclerView.Adapter() { + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ProfilePinnedReposViewHolder = ProfilePinnedReposViewHolder(parent) + override fun getItemCount(): Int = list.size + override fun onBindViewHolder(holder: ProfilePinnedReposViewHolder, position: Int) = holder.bind(list[position]) + + fun insertNew(list: List) { + this.list.apply { + clear() + addAll(list) + notifyDataSetChanged() + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/ProfileReposAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/ProfileReposAdapter.kt new file mode 100644 index 000000000..1c688c79f --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/ProfileReposAdapter.kt @@ -0,0 +1,23 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.DiffUtil +import com.fastaccess.data.persistence.models.ProfileRepoModel +import com.fastaccess.github.base.adapter.BasePagedAdapter +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.github.ui.adapter.viewholder.ReposProfileViewHolder + +/** + * Created by Kosh on 12.10.18. + */ +class ProfileReposAdapter : BasePagedAdapter(DIFF_CALLBACK) { + + override fun contentViewHolder(parent: ViewGroup): BaseViewHolder = ReposProfileViewHolder(parent) + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: ProfileRepoModel, newItem: ProfileRepoModel): Boolean = oldItem.id == newItem.id + override fun areContentsTheSame(oldItem: ProfileRepoModel, newItem: ProfileRepoModel): Boolean = oldItem == newItem + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/ProfileStarredReposAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/ProfileStarredReposAdapter.kt new file mode 100644 index 000000000..a4b5834e2 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/ProfileStarredReposAdapter.kt @@ -0,0 +1,23 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.DiffUtil +import com.fastaccess.data.persistence.models.ProfileStarredRepoModel +import com.fastaccess.github.base.adapter.BasePagedAdapter +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.github.ui.adapter.viewholder.ReposStarredProfileViewHolder + +/** + * Created by Kosh on 12.10.18. + */ +class ProfileStarredReposAdapter : BasePagedAdapter(DIFF_CALLBACK) { + + override fun contentViewHolder(parent: ViewGroup): BaseViewHolder = ReposStarredProfileViewHolder(parent) + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: ProfileStarredRepoModel, newItem: ProfileStarredRepoModel): Boolean = oldItem.id == newItem.id + override fun areContentsTheSame(oldItem: ProfileStarredRepoModel, newItem: ProfileStarredRepoModel): Boolean = oldItem == newItem + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/SearchReposAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/SearchReposAdapter.kt new file mode 100644 index 000000000..e958afc15 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/SearchReposAdapter.kt @@ -0,0 +1,22 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.ListAdapter +import com.fastaccess.data.model.ShortRepoModel +import com.fastaccess.github.ui.adapter.viewholder.ShortRepoViewHolder + +/** + * Created by Kosh on 20.01.19. + */ +class SearchReposAdapter : ListAdapter(DIFF_CALLBACK) { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ShortRepoViewHolder = ShortRepoViewHolder(parent) + override fun onBindViewHolder(holder: ShortRepoViewHolder, position: Int) = holder.bind(getItem(position)) + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: ShortRepoModel, newItem: ShortRepoModel): Boolean = oldItem.id == newItem.id + override fun areContentsTheSame(oldItem: ShortRepoModel, newItem: ShortRepoModel): Boolean = oldItem == newItem + } + } +} diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/ShortUsersAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/ShortUsersAdapter.kt new file mode 100644 index 000000000..ca18e67fc --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/ShortUsersAdapter.kt @@ -0,0 +1,30 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.ListAdapter +import androidx.recyclerview.widget.RecyclerView +import com.fastaccess.data.model.ShortUserModel +import com.fastaccess.github.ui.adapter.viewholder.ShortUserViewHolder + +/** + * Created by Kosh on 12.10.18. + */ +class ShortUsersAdapter(private val onClick: (url: String) -> Unit) : ListAdapter(DIFF_CALLBACK) { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ShortUserViewHolder = ShortUserViewHolder(parent).apply { + itemView.setOnClickListener { + val position = adapterPosition + if (position == RecyclerView.NO_POSITION) return@setOnClickListener + getItem(position)?.url?.let(onClick) + } + } + + override fun onBindViewHolder(holder: ShortUserViewHolder, position: Int) = holder.bind(getItem(position)) + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: ShortUserModel, newItem: ShortUserModel): Boolean = oldItem.login == newItem.login + override fun areContentsTheSame(oldItem: ShortUserModel, newItem: ShortUserModel): Boolean = oldItem == newItem + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/TrendingsAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/TrendingsAdapter.kt new file mode 100644 index 000000000..b6d8ded4f --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/TrendingsAdapter.kt @@ -0,0 +1,22 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.ListAdapter +import com.fastaccess.data.model.TrendingModel +import com.fastaccess.github.ui.adapter.viewholder.TrendingViewHolder + +/** + * Created by Kosh on 20.01.19. + */ +class TrendingsAdapter : ListAdapter(DIFF_CALLBACK) { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TrendingViewHolder = TrendingViewHolder(parent) + override fun onBindViewHolder(holder: TrendingViewHolder, position: Int) = holder.bind(getItem(position)) + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: TrendingModel, newItem: TrendingModel): Boolean = oldItem.title == newItem.title + override fun areContentsTheSame(oldItem: TrendingModel, newItem: TrendingModel): Boolean = oldItem == newItem + } + } +} diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/UnreadNotificationsAdapter.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/UnreadNotificationsAdapter.kt new file mode 100644 index 000000000..d93d05cc0 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/UnreadNotificationsAdapter.kt @@ -0,0 +1,23 @@ +package com.fastaccess.github.ui.adapter + +import android.view.ViewGroup +import androidx.recyclerview.widget.DiffUtil +import com.fastaccess.data.persistence.models.NotificationModel +import com.fastaccess.github.base.adapter.BasePagedAdapter +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.github.ui.adapter.viewholder.NotificationsViewHolder + +/** + * Created by Kosh on 12.10.18. + */ +class UnreadNotificationsAdapter : BasePagedAdapter(DIFF_CALLBACK) { + + override fun contentViewHolder(parent: ViewGroup): BaseViewHolder = NotificationsViewHolder(parent) + + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: NotificationModel, newItem: NotificationModel): Boolean = oldItem.id == newItem.id + override fun areContentsTheSame(oldItem: NotificationModel, newItem: NotificationModel): Boolean = oldItem == newItem + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/AssigneeViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/AssigneeViewHolder.kt new file mode 100644 index 000000000..2a5d131cd --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/AssigneeViewHolder.kt @@ -0,0 +1,25 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.core.view.isVisible +import com.fastaccess.data.model.ShortUserModel +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.BaseViewHolder +import kotlinx.android.synthetic.main.assignees_row_item.view.* + +/** + * Created by Kosh on 04.11.18. + */ +class AssigneeViewHolder(parent: ViewGroup) : BaseViewHolder(LayoutInflater.from(parent.context) + .inflate(R.layout.assignees_row_item, parent, false)) { + override fun bind(item: ShortUserModel) = Unit + + fun bind(item: ShortUserModel, isSelected: Boolean) { + itemView.apply { + backgroundLayout.isVisible = isSelected + userIcon.loadAvatar(item.avatarUrl, item.url) + title.text = item.login ?: item.name ?: "" + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/CommentViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/CommentViewHolder.kt new file mode 100644 index 000000000..fa95e981f --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/CommentViewHolder.kt @@ -0,0 +1,105 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.annotation.SuppressLint +import android.view.LayoutInflater +import android.view.MotionEvent +import android.view.ViewGroup +import androidx.core.view.isVisible +import com.fastaccess.data.model.CommentAuthorAssociation +import com.fastaccess.data.model.CommentModel +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.github.base.extensions.popMenu +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.showYesNoDialog +import com.fastaccess.github.extensions.timeAgo +import io.noties.markwon.Markwon +import io.noties.markwon.utils.NoCopySpannableFactory +import kotlinx.android.synthetic.main.comment_row_item.view.* + + +/** + * Created by Kosh on 12.10.18. + */ + +class CommentViewHolder( + parent: ViewGroup, + private val markwon: Markwon, + private val theme: Int, + private val callback: (position: Int) -> Unit, + private val deleteCommentListener: (position: Int) -> Unit, + private val editCommentListener: (position: Int) -> Unit +) : BaseViewHolder( + LayoutInflater.from(parent.context) + .inflate(R.layout.comment_row_item, parent, false) +) { + + @SuppressLint("SetTextI18n", "DefaultLocale") + override fun bind(item: CommentModel?) { + val model = item ?: run { + itemView.isVisible = false + return + } + itemView.apply { + userIcon.loadAvatar(model.author?.avatarUrl, model.author?.url ?: "") + author.text = model.author?.login ?: "" + association.text = if (CommentAuthorAssociation.NONE == model.authorAssociation) { + model.updatedAt?.timeAgo() + } else { + com.fastaccess.markdown.widget.SpannableBuilder.builder() + .bold(model.authorAssociation?.value?.toLowerCase()?.replace("_", "") ?: "") + .space() + .append(model.updatedAt?.timeAgo()) + } + + description.post { + description.setSpannableFactory(NoCopySpannableFactory.getInstance()) + val bodyMd = model.body + markwon.setMarkdown(description, if (!bodyMd.isNullOrEmpty()) bodyMd else resources.getString(R.string.no_description_provided)) + } + + description.setOnTouchListener { _, event -> + if (event.action == MotionEvent.ACTION_UP && !description.hasSelection()) { + itemView.callOnClick() + } + return@setOnTouchListener false + } + + val canAlter = model.viewerCanUpdate == true || model.viewerCanDelete == true + menu.isVisible = canAlter + if (canAlter) { + menu.popMenu(R.menu.comment_menu, { menu -> + menu.findItem(R.id.edit)?.isVisible = model.viewerCanUpdate == true + menu.findItem(R.id.delete)?.isVisible = model.viewerCanDelete == true + }) { itemId -> + if (itemId == R.id.delete) { + context.showYesNoDialog(R.string.delete) { + it.isTrue { + deleteCommentListener.invoke(adapterPosition) + } + } + } else if (itemId == R.id.edit) { + editCommentListener.invoke(adapterPosition) + } + } + } + + +// val filter = Linkify.TransformFilter { match, _ -> match.group() } +// val mentionPattern = Pattern.compile("@([A-Za-z0-9_-]+)") +// val mentionScheme = "https://www.github.com/" +// Linkify.addLinks(description, mentionPattern, mentionScheme, null, filter) +// +// val hashtagPattern = Pattern.compile("#([A-Za-z0-9_-]+)") +// val hashtagScheme = "https://www.github.com/" +// Linkify.addLinks(description, hashtagPattern, hashtagScheme, null, filter) +// +// val urlPattern = Patterns.WEB_URL +// Linkify.addLinks(description, urlPattern, null, null, filter) + + adaptiveEmoticon.init(requireNotNull(model.id), model.reactionGroups) { + callback.invoke(adapterPosition) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/CommitThreadViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/CommitThreadViewHolder.kt new file mode 100644 index 000000000..ddbe6fadb --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/CommitThreadViewHolder.kt @@ -0,0 +1,99 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.annotation.SuppressLint +import android.view.LayoutInflater +import android.view.MotionEvent +import android.view.ViewGroup +import androidx.core.view.isVisible +import com.fastaccess.data.model.CommentAuthorAssociation +import com.fastaccess.data.model.CommitThreadModel +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.github.base.extensions.popMenu +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.showYesNoDialog +import com.fastaccess.github.extensions.timeAgo +import io.noties.markwon.Markwon +import io.noties.markwon.utils.NoCopySpannableFactory +import kotlinx.android.synthetic.main.comment_small_row_item.view.* +import kotlinx.android.synthetic.main.commit_with_comment_row_item.view.* + + +/** + * Created by Kosh on 12.10.18. + */ + +class CommitThreadViewHolder( + parent: ViewGroup, + private val markwon: Markwon, + private val theme: Int, + private val callback: (position: Int) -> Unit, + private val deleteCommentListener: (position: Int) -> Unit, + private val editCommentListener: (position: Int) -> Unit +) : BaseViewHolder( + LayoutInflater.from(parent.context) + .inflate(R.layout.commit_with_comment_row_item, parent, false) +) { + + @SuppressLint("SetTextI18n", "DefaultLocale") + override fun bind(item: CommitThreadModel?) { + val review = item ?: run { + itemView.isVisible = false + return + } + itemView.apply { + itemView.commentLayout.isVisible = review.comment != null + review.comment?.let { model -> + if (model.path != null && model.originalPosition != null) { + fileName.text = "${model.path}#${model.originalPosition}" + } + userIcon.loadAvatar(model.author?.avatarUrl, model.author?.url ?: "") + author.text = model.author?.login ?: "" + association.text = if (CommentAuthorAssociation.NONE == model.authorAssociation) { + model.updatedAt?.timeAgo() + } else { + com.fastaccess.markdown.widget.SpannableBuilder.builder() + .bold(model.authorAssociation?.value?.toLowerCase()?.replace("_", "") ?: "") + .space() + .append(model.updatedAt?.timeAgo()) + } + + description.post { + description.setSpannableFactory(NoCopySpannableFactory.getInstance()) + val bodyMd = model.body + markwon.setMarkdown(description, if (!bodyMd.isNullOrEmpty()) bodyMd else resources.getString(R.string.no_description_provided)) + } + + description.setOnTouchListener { _, event -> + if (event.action == MotionEvent.ACTION_UP && !description.hasSelection()) { + itemView.callOnClick() + } + return@setOnTouchListener false + } + + val canAlter = model.viewerCanUpdate == true || model.viewerCanDelete == true + menu.isVisible = canAlter + if (canAlter) { + menu.popMenu(R.menu.comment_menu, { menu -> + menu.findItem(R.id.edit)?.isVisible = model.viewerCanUpdate == true + menu.findItem(R.id.delete)?.isVisible = model.viewerCanDelete == true + }) { itemId -> + if (itemId == R.id.delete) { + context.showYesNoDialog(R.string.delete) { + it.isTrue { + deleteCommentListener.invoke(adapterPosition) + } + } + } else if (itemId == R.id.edit) { + editCommentListener.invoke(adapterPosition) + } + } + } + + adaptiveEmoticon.init(requireNotNull(model.id), model.reactionGroups) { + callback.invoke(adapterPosition) + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/FeedsViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/FeedsViewHolder.kt new file mode 100644 index 000000000..b8ebe24d9 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/FeedsViewHolder.kt @@ -0,0 +1,360 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.core.view.isVisible +import com.fastaccess.data.persistence.models.FeedModel +import com.fastaccess.domain.response.enums.EventsType +import com.fastaccess.github.R +import com.fastaccess.github.extensions.replaceAllNewLines +import com.fastaccess.github.extensions.timeAgo +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.markdown.MarkdownProvider +import com.fastaccess.markdown.widget.SpannableBuilder +import kotlinx.android.synthetic.main.feeds_row_item.view.* + +/** + * Created by Kosh on 20.10.18. + */ +class FeedsViewHolder( + parent: ViewGroup +) : BaseViewHolder(LayoutInflater.from(parent.context) + .inflate(R.layout.feeds_row_item, parent, false)) { + + override fun bind(item: FeedModel) { + itemView.apply { + feedDescription.text = "" + feedDescription.isVisible = false + feedTitle.text = context.getString(item.type?.titleId ?: 0).toLowerCase() + when (item.type) { + EventsType.WatchEvent -> watchEvent(this, item) + EventsType.CreateEvent -> createEvent(this, item) + EventsType.CommitCommentEvent -> commitCommentEvent(this, item) + EventsType.DownloadEvent -> downloadEvent(this, item) + EventsType.FollowEvent -> followEvent(this, item) + EventsType.ForkEvent -> forkEvent(this, item) + EventsType.GistEvent -> gistEvent(this, item) + EventsType.GollumEvent -> gollumEvent(this, item) + EventsType.IssueCommentEvent -> issueCommentEvent(this, item) + EventsType.IssuesEvent -> issueEvent(this, item) + EventsType.MemberEvent -> memberEvent(this, item) + EventsType.PublicEvent -> publicEvent(this, item) + EventsType.PullRequestEvent -> pullRequestEvent(this, item) + EventsType.PullRequestReviewCommentEvent -> pullRequestReviewCommentEvent(this, item) + EventsType.PullRequestReviewEvent -> pullRequestReviewEvent(this, item) + EventsType.RepositoryEvent -> repositoryEvent(this, item) + EventsType.PushEvent -> pushEvent(this, item) + EventsType.TeamAddEvent -> teamAddedEvent(this, item) + EventsType.DeleteEvent -> deleteEvent(this, item) + EventsType.ReleaseEvent -> releaseEvent(this, item) + EventsType.ForkApplyEvent -> forkApplyEvent(this, item) + EventsType.OrgBlockEvent -> orgBlockEvent(this, item) + EventsType.ProjectCardEvent -> projectCardEvent(this, item) + EventsType.ProjectColumnEvent -> projectColumnEvent(this, item) + EventsType.OrganizationEvent -> organizationEvent(this, item) + EventsType.ProjectEvent -> projectEvent(this, item) + else -> otherEvent(this, item) + } + dateWithIcon.text = item.createdAt?.timeAgo() + stateIcon.setImageResource(item.type?.drawableRes ?: 0) + userIcon.loadAvatar(item.actor?.avatarUrl, item.actor?.url) + } + } + + private fun otherEvent(view: View, item: FeedModel) { + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold(item.payload?.action) + .space() + .append(item.repo?.name) + } + + private fun organizationEvent(view: View, item: FeedModel) { + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold(item.payload?.action?.replace("_", "")) + .space() + .append(item.payload?.invitation?.login) + .space() + .append(item.payload?.organization?.login) + } + + private fun projectEvent(view: View, item: FeedModel) = projectCardEvent(view, item, false) + + private fun projectColumnEvent(view: View, item: FeedModel) = projectCardEvent(view, item, true) + + private fun projectCardEvent(view: View, item: FeedModel, isColumn: Boolean = false) { + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold(item.payload?.action) + .space() + .append(if (isColumn) "column" else "project") + .space() + .append(item.payload?.organization?.login) + } + + private fun orgBlockEvent(view: View, item: FeedModel) { + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold(item.payload?.action) + .space() + .append(item.payload?.blockedUser?.login) + .space() + .append(item.payload?.organization?.login) + } + + private fun forkApplyEvent(view: View, item: FeedModel) { + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold(item.payload?.head) + .space() + .append(item.payload?.before) + .space() + .append(item.repo?.name) + } + + private fun releaseEvent(view: View, item: FeedModel) { + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold("released") + .space() + .append(item.payload?.release?.name) + .space() + .append(item.repo?.name) + + } + + private fun deleteEvent(view: View, item: FeedModel) { + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold("deleted") + .space() + .append(item.payload?.refType) + .space() + .bold("at ") + .append(item.repo?.name) + } + + private fun teamAddedEvent(view: View, item: FeedModel) { + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold("added") + .space() + .append(item.payload?.user?.login ?: item.repo?.name) + .space() + .bold("in ") + .append(item.payload?.team?.name ?: item.payload?.team?.slug) + + } + + private fun pushEvent(view: View, item: FeedModel) { + val ref = if (item.payload?.ref?.startsWith("refs/heads/") == true) { + item.payload?.ref?.substring(11) + } else { + item.payload?.ref + } + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold("push to") + .space() + .append(ref) + .space() + .bold("at") + .space() + .append(item.repo?.name) + + val builder = SpannableBuilder.builder() + val commits = item.payload?.commits + if (commits?.isNotEmpty() == true) { + if (commits.size != 1) { + builder.bold("${commits.size} new commits") + } else { + builder.bold("1 new commit").newline() + } + view.feedDescription.text = builder + view.feedDescription.isVisible = true + } + } + + private fun repositoryEvent(view: View, item: FeedModel) = publicEvent(view, item) + + private fun pullRequestReviewEvent(view: View, item: FeedModel) = pullRequestReviewCommentEvent(view, item) + + private fun pullRequestReviewCommentEvent(view: View, item: FeedModel) { + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold(if (item.payload?.comment != null) "commented on a review in " else "reviewed a pull request in") + .space() + .append("${item.repo?.name}") + .bold("#${item.payload?.pullRequest?.number}") + view.feedDescription.apply { + text = item.payload?.comment?.body ?: "" + isVisible = !item.payload?.comment?.body.isNullOrEmpty() + } + } + + private fun pullRequestEvent(view: View, item: FeedModel) { + val pullRequest = item.payload?.pullRequest + val action = when { + "synchronize" == item.payload?.action -> "updated" + pullRequest?.isMerged == true -> "merged" + else -> item.payload?.action + } + + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold(action ?: "") + .space() + .append("${item.repo?.name}") + .bold("#${pullRequest?.number}") + if ("opened" == action || "closed" == action) { + view.feedDescription.text = pullRequest?.title?.replaceAllNewLines() ?: "" + view.feedDescription.isVisible = !pullRequest?.title?.replaceAllNewLines().isNullOrEmpty() + } + } + + private fun publicEvent(view: View, item: FeedModel) { + val action = if ("privatized" == item.payload?.action) { + "private" + } else { + "public" + } + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .append(item.repo?.name) + .space() + .bold(action) + } + + private fun memberEvent(view: View, item: FeedModel) { + val user = item.payload?.member + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold("added") + .space() + .append(user?.login) + .space() + .append("as a collaborator to ") + .append(item.repo?.name) + } + + private fun issueEvent(view: View, item: FeedModel) { + val issue = item.payload?.issue + val label = item.payload?.issue?.labels?.lastOrNull() + val isLabel = "label" == item.payload?.action + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold(if (isLabel && label != null) "Labeled ${label.name}" else item.payload?.action ?: "") + .space() + .append(item.repo?.name) + .space() + .bold("#${issue?.number}") + view.feedDescription.text = issue?.title?.replaceAllNewLines() ?: "" + view.feedDescription.isVisible = !issue?.title?.replaceAllNewLines().isNullOrEmpty() + } + + private fun issueCommentEvent(view: View, item: FeedModel) { + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold("commented on ${if (item.payload?.issue?.htmlUrl?.contains("/pull/", true) == true) "a pull request" else "an issue"}") + .space() + .append("${item.repo?.name}") + .bold("#${item.payload?.issue?.number}") + + view.feedDescription.text = item.payload?.comment?.body?.replaceAllNewLines()?.let { MarkdownProvider.stripMd(it) } + view.feedDescription.isVisible = !item.payload?.comment?.body?.replaceAllNewLines().isNullOrEmpty() + } + + private fun gollumEvent(view: View, item: FeedModel) { + val wikies = item.payload?.pages + val builder = SpannableBuilder.builder().append(item.actor?.login) + .space() + if (wikies?.isNotEmpty() == true) { + wikies.forEach { + builder.bold(it.action) + .space() + .append(it.packageName) + .space() + } + } else { + builder.bold(view.resources.getString(R.string.gollum)) + .space() + } + builder.append(item.repo?.name) + view.feedTitle.text = builder + } + + private fun gistEvent(view: View, item: FeedModel) { + val action = if ("create" == item.payload?.action) "created" else if ("update" == item.payload?.action) "updated" else item.payload?.action + + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold("$action ${view.resources.getString(R.string.gist).toLowerCase()}") + .space() + .append(item.payload?.gist?.id) + } + + private fun forkEvent(view: View, item: FeedModel) { + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold("forked") + .space() + .append(item.repo?.name) + } + + private fun followEvent(view: View, item: FeedModel) { + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold("started following") + .space() + .append(item.payload?.target?.login) + } + + private fun downloadEvent(view: View, item: FeedModel) { + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold("uploaded a file") + .space() + .append("${item.payload?.download?.name}") + .space() + .append("to") + .space() + .bold(item.repo?.name ?: "") + } + + private fun commitCommentEvent(view: View, item: FeedModel) { + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold("commented on commit") + .space() + .append("${item.repo?.name}") + .bold("#${item.payload?.issue?.number?.toString()}") + } + + private fun watchEvent(view: View, item: FeedModel) { + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold(view.context.getString(item.type?.titleId ?: 0).toLowerCase()) + .space() + .append(item.repo?.name) + } + + private fun createEvent(view: View, item: FeedModel) { + item.payload?.let { + view.feedTitle.text = SpannableBuilder.builder().append(item.actor?.login) + .space() + .bold("created") + .space() + .append(it.refType) + .space() + .append(if ("repository" != it.refType) it.ref else "") + .space() + .append("at") + .space() + .append(item.repo?.name) + view.feedDescription.text = it.description?.replaceAllNewLines()?.let { MarkdownProvider.stripMd(it) } + view.feedDescription.isVisible = !it.description?.replaceAllNewLines().isNullOrEmpty() + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/IssueContentViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/IssueContentViewHolder.kt new file mode 100644 index 000000000..04ef8a7de --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/IssueContentViewHolder.kt @@ -0,0 +1,415 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.annotation.SuppressLint +import android.graphics.Color +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.core.view.isVisible +import com.fastaccess.data.model.* +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.github.extensions.route +import com.fastaccess.github.extensions.timeAgo +import com.fastaccess.markdown.spans.LabelSpan +import com.fastaccess.markdown.widget.SpannableBuilder +import github.type.PullRequestReviewState +import github.type.PullRequestState +import github.type.StatusState +import kotlinx.android.synthetic.main.issue_content_row_item.view.* + +/** + * Created by Kosh on 04.02.19. + */ +class IssueContentViewHolder(parent: ViewGroup) : BaseViewHolder( + LayoutInflater.from(parent.context) + .inflate(R.layout.issue_content_row_item, parent, false) +) { + override fun canDivide(): Boolean = false + + override fun bind(item: TimelineModel) { + itemView.text.text = "" + itemView.userIcon.setImageDrawable(null) + itemView.stateIcon.setImageDrawable(null) + item.commit?.let(this::presentCommit) + item.crossReferencedEventModel?.let(this::presentCrossReference) + item.referencedEventModel?.let(this::presentReference) + item.closeOpenEventModel?.let(this::presentClosedReopen) + item.lockUnlockEventModel?.let(this::presentLockUnlock) + item.labelUnlabeledEvent?.let(this::presentLabels) + item.subscribedUnsubscribedEvent?.let(this::presentSubscribeUnsubscribed) + item.assignedEventModel?.let(this::presentAssignedAndUnassigned) + item.milestoneEventModel?.let(this::presentMilestoneDemilestone) + item.renamedEventModel?.let(this::presentRenamed) + item.transferredEventModel?.let(this::presentTransferred) + item.baseRefChangedEvent?.let(this::presentBaseRefChanged) + item.baseRefForcePush?.let(this::presentForcePush) + item.headRefRestored?.let(this::presentRefRestored) + item.headRefDeleted?.let(this::presentHeadDeleted) + item.reviewRequested?.let(this::presentReviewRequest) + item.reviewDismissed?.let(this::presenetReviewDismissed) + item.reviewRequestRemoved?.let(this::presenetReviewRequestRemoved) + item.pullRequestCommit?.let(this::presentPrCommit) + item.review?.let(this::presentReview) + } + + @SuppressLint("DefaultLocale") + private fun presentReview(model: ReviewModel) { + itemView.apply { + val icon = when (model.state) { + PullRequestReviewState.APPROVED.rawValue() -> R.drawable.ic_done + PullRequestReviewState.CHANGES_REQUESTED.rawValue() -> R.drawable.ic_clear + PullRequestReviewState.COMMENTED.rawValue() -> R.drawable.ic_comment + else -> 0 + } + if (icon != 0) { + stateIcon.setImageResource(icon) + stateIcon.isVisible = true + } else { + stateIcon.isVisible = false + } + userIcon.loadAvatar(model.author?.avatarUrl, model.author?.url) + text.text = SpannableBuilder.builder() + .bold(model.author?.login) + .space() + .apply { + append(model.state?.replace("_", " ")?.toLowerCase() ?: "") + val body = model.body + if (!body.isNullOrEmpty()) { + newline() + append(body) + space() + } else { + space() + } + } + .append(model.createdAt?.timeAgo()) + } + } + + private fun presentPrCommit(model: PullRequestCommitModel) { + itemView.apply { + val icon = when (model.commit?.state) { + StatusState.ERROR.rawValue(), StatusState.FAILURE.rawValue() -> R.drawable.ic_state_error + StatusState.SUCCESS.rawValue() -> R.drawable.ic_state_success + StatusState.PENDING.rawValue() -> R.drawable.ic_state_pending + else -> 0 + } + if (icon == 0) { + stateIcon.isVisible = false + } else { + stateIcon.setImageResource(icon) + stateIcon.isVisible = true + } + userIcon.loadAvatar(model.commit?.author?.avatarUrl, model.commit?.author?.url) + text.text = SpannableBuilder.builder() + .bold(model.commit?.author?.login) + .space() + .append("committed") + .space() + .url("${model.commit?.abbreviatedOid}", View.OnClickListener { view -> + model.commit?.commitUrl?.let { view.context.route(it) } + }) + .space() + .append("${model.commit?.message} ") + .append(model.commit?.authoredDate?.timeAgo()) + } + } + + @SuppressLint("DefaultLocale") + private fun presenetReviewRequestRemoved(model: ReviewRequestRemovedModel) { + itemView.apply { + stateIcon.setImageResource(R.drawable.ic_track_changes) + userIcon.loadAvatar(model.actor?.avatarUrl, model.actor?.url) + text.text = SpannableBuilder.builder() + .bold(model.actor?.login) + .space() + .append("dismissed ${model.reviewer?.login} review ") + .append(model.createdAt?.timeAgo()) + } + } + + @SuppressLint("DefaultLocale") + private fun presenetReviewDismissed(model: ReviewDismissedModel) { + itemView.apply { + stateIcon.setImageResource(R.drawable.ic_track_changes) + userIcon.loadAvatar(model.actor?.avatarUrl, model.actor?.url) + text.text = SpannableBuilder.builder() + .bold(model.actor?.login) + .space() + .append("dismissed their review (${model.previousReviewState?.toLowerCase()})") + .apply { + val msg = model.dismissalMessage + if (!msg.isNullOrEmpty()) { + newline() + append(msg) + } + space() + } + .append(model.createdAt?.timeAgo()) + } + } + + private fun presentReviewRequest(model: ReviewRequestedModel) { + itemView.apply { + stateIcon.setImageResource(R.drawable.ic_track_changes) + userIcon.loadAvatar(model.actor?.avatarUrl, model.actor?.url) + text.text = SpannableBuilder.builder() + .bold(model.actor?.login) + .space() + .append("requested review from ") + .bold(model.reviewer?.login ?: "") + .space() + .append(model.createdAt?.timeAgo()) + } + } + + private fun presentHeadDeleted(model: HeadRefDeletedModel) { + itemView.apply { + stateIcon.setImageResource(R.drawable.ic_track_changes) + userIcon.loadAvatar(model.actor?.avatarUrl, model.actor?.url) + text.text = SpannableBuilder.builder() + .bold(model.actor?.login) + .space() + .append("deleted ${model.headRefName ?: "this branch"}") + .space() + .append(model.createdAt?.timeAgo()) + } + } + + private fun presentRefRestored(model: HeadRefRestoredModel) { + itemView.apply { + stateIcon.setImageResource(R.drawable.ic_track_changes) + userIcon.loadAvatar(model.actor?.avatarUrl, model.actor?.url) + text.text = SpannableBuilder.builder() + .bold(model.actor?.login) + .space() + .append("restored this branch") + .space() + .append(model.createdAt?.timeAgo()) + } + } + + private fun presentForcePush(model: BaseRefForcePushModel) { + itemView.apply { + stateIcon.setImageResource(R.drawable.ic_track_changes) + userIcon.loadAvatar(model.actor?.avatarUrl, model.actor?.url) + text.text = SpannableBuilder.builder() + .bold(model.actor?.login) + .space() + .append("force pushed this branch from ${model.beforeCommit} to ${model.afterCommit}") + .space() + .append(model.createdAt?.timeAgo()) + } + } + + private fun presentBaseRefChanged(model: BaseRefChangedModel) { + itemView.apply { + stateIcon.setImageResource(R.drawable.ic_track_changes) + userIcon.loadAvatar(model.actor?.avatarUrl, model.actor?.url) + text.text = SpannableBuilder.builder() + .bold(model.actor?.login) + .space() + .append("changed base reference ") + .space() + .append(model.createdAt?.timeAgo()) + } + } + + private fun presentTransferred(model: TransferredEventModel) { + itemView.apply { + stateIcon.setImageResource(R.drawable.ic_track_changes) + userIcon.loadAvatar(model.actor?.avatarUrl, model.actor?.url) + text.text = SpannableBuilder.builder() + .bold(model.actor?.login) + .space() + .append("transferred this from ") + .bold(model.fromRepository) + .space() + .append(model.createdAt?.timeAgo()) + } + } + + private fun presentRenamed(model: RenamedEventModel) { + itemView.apply { + stateIcon.setImageResource(R.drawable.ic_edit) + userIcon.loadAvatar(model.actor?.avatarUrl, model.actor?.url) + text.text = SpannableBuilder.builder() + .bold(model.actor?.login) + .space() + .append("renamed this from ") + .bold(model.previousTitle) + .append(" to ") + .bold(model.currentTitle) + .space() + .append(model.createdAt?.timeAgo()) + } + } + + private fun presentMilestoneDemilestone(model: MilestoneDemilestonedEventModel) { + itemView.apply { + stateIcon.setImageResource(R.drawable.ic_milestone) + userIcon.loadAvatar(model.actor?.avatarUrl, model.actor?.url) + text.text = SpannableBuilder.builder() + .bold(model.actor?.login) + .space() + .append(if (model.isMilestone == true) "added this to the milestone " else "demilestoned this from ") + .bold(model.milestoneTitle) + .space() + .append(model.createdAt?.timeAgo()) + } + } + + private fun presentAssignedAndUnassigned(model: AssignedUnAssignedEventModel) { + itemView.apply { + stateIcon.setImageResource(R.drawable.ic_profile) + userIcon.loadAvatar(model.actor?.avatarUrl, model.actor?.url) + text.text = SpannableBuilder.builder() + .bold(model.actor?.login) + .space() + .append(if (model.isAssigned == true) "assigned " else "unassigned ") + .apply { + model.users.forEachIndexed { index, shortUserModel -> + bold(shortUserModel.login).append( + when { + index == model.users.size - 2 -> " and " + index != model.users.size - 1 -> ", " + else -> " " + } + ) + } + } + .append(model.createdAt?.timeAgo()) + } + } + + private fun presentSubscribeUnsubscribed(model: SubscribedUnsubscribedEventModel) { + itemView.apply { + stateIcon.setImageResource(if (model.isSubscribe == true) R.drawable.ic_subscribe else R.drawable.ic_unsubscribe) + userIcon.loadAvatar(model.actor?.avatarUrl, model.actor?.url) + text.text = SpannableBuilder.builder() + .bold(model.actor?.login) + .space() + .append(if (model.isSubscribe == true) "subscribed to this " else "unsubscribed from this ") + .append(model.createdAt?.timeAgo()) + } + } + + private fun presentLabels(model: LabelUnlabeledEventModel) { + itemView.apply { + stateIcon.setImageResource(R.drawable.ic_label) + userIcon.loadAvatar(model.actor?.avatarUrl, model.actor?.url) + val builder = SpannableBuilder.builder() + .apply { + bold(SpannableBuilder.builder().append(model.actor?.login ?: "", LabelSpan(Color.TRANSPARENT))) + space() + append(if (model.isLabel == true) "added " else "unlabeled ", LabelSpan(Color.TRANSPARENT)) + model.labels.forEach { + append(it.name ?: "", LabelSpan(kotlin.runCatching { Color.parseColor("#${it.color}") }.getOrDefault(Color.BLUE))) + .space() + } + append("${model.createdAt?.timeAgo()}", LabelSpan(Color.TRANSPARENT)) + } + text.text = builder + } + } + + @SuppressLint("DefaultLocale") + private fun presentLockUnlock(model: LockUnlockEventModel) { + itemView.apply { + stateIcon.setImageResource(if (model.isLock == true) R.drawable.ic_lock else R.drawable.ic_unlock) + userIcon.loadAvatar(model.actor?.avatarUrl, model.actor?.url) + val builder = SpannableBuilder.builder() + .bold(model.actor?.login) + .space() + if (model.isLock == true) { + builder.append("locked ") + .bold(if (model.lockReason != null) "as ${model.lockReason?.replace("_", "")?.toLowerCase()} " else "") + .append("and limited conversation to collaborators ") + } else { + builder.append("unlocked this conversation ") + } + text.text = builder.append(model.createdAt?.timeAgo()) + } + } + + private fun presentClosedReopen(model: CloseOpenEventModel) { + itemView.apply { + stateIcon.setImageResource( + when { + PullRequestState.MERGED.rawValue().equals(model.pullRequest?.state, true) -> R.drawable.ic_issue_merged + model.isClosed == true -> R.drawable.ic_issue_closed + else -> R.drawable.ic_issue_opened + } + ) + userIcon.loadAvatar(model.actor?.avatarUrl, model.actor?.url) + val builder = SpannableBuilder.builder() + .bold(model.actor?.login) + .space() + when { + PullRequestState.MERGED.rawValue().equals(model.pullRequest?.state, true) -> builder + .append("merged this ") + .append("${model.createdAt?.timeAgo()}") + model.isClosed == true -> builder + .append("closed this ") + .clickable( + when { + model.commit != null -> "in commit (${model.commit?.abbreviatedOid}) " + model.pullRequest != null -> "in pull request (#${model.pullRequest?.number}) " + else -> "" + } + ) + .append("${model.createdAt?.timeAgo()}") + else -> builder.append("reopened this ${model.createdAt?.timeAgo()}") + } + text.text = builder + } + } + + private fun presentCrossReference(model: CrossReferencedEventModel) { + itemView.apply { + stateIcon.setImageResource(R.drawable.ic_format_quote) + userIcon.loadAvatar(model.actor?.avatarUrl, model.actor?.url) + text.text = SpannableBuilder.builder() + .bold(model.actor?.login) + .space() + .append("${if (model.isCrossRepository == true) "cross" else ""} referenced this in ") + .clickable( + when { + model.issue != null -> "issue (#${model.issue?.number}) " + model.pullRequest != null -> "pull request (#${model.pullRequest?.number}) " + else -> "" + } + ) + .append("${model.referencedAt?.timeAgo()}") + } + } + + private fun presentCommit(model: CommitModel) { + itemView.apply { + stateIcon.setImageResource(R.drawable.ic_push) + userIcon.loadAvatar(model.author?.avatarUrl, model.author?.url) + text.text = SpannableBuilder.builder() + .append(model.author?.name) + .space() + .append("referenced this in ") + .clickable("commit ${model.abbreviatedOid} ") + .append(model.authoredDate?.timeAgo()) + } + } + + private fun presentReference(model: ReferencedEventModel) { + itemView.apply { + stateIcon.setImageResource(R.drawable.ic_format_quote) + userIcon.loadAvatar(model.actor?.avatarUrl, model.actor?.url) + text.text = SpannableBuilder.builder() + .bold(model.actor?.login) + .space() + .append("added a commit ") + .clickable("(${model.commit?.abbreviatedOid})") + .append(" that referenced this issue ${model.createdAt?.timeAgo()}") + .newline() + .bold(model.commit?.message) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/LabelColorViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/LabelColorViewHolder.kt new file mode 100644 index 000000000..a38613906 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/LabelColorViewHolder.kt @@ -0,0 +1,23 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.content.res.ColorStateList +import android.graphics.Color +import android.view.LayoutInflater +import android.view.ViewGroup +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.BaseViewHolder +import kotlinx.android.synthetic.main.label_color_row_item.view.* + +/** + * Created by Kosh on 12.10.18. + */ +class LabelColorViewHolder(parent: ViewGroup) : BaseViewHolder(LayoutInflater.from(parent.context) + .inflate(R.layout.label_color_row_item, parent, false)) { + + override fun bind(item: String) { + itemView.apply { + colorChip.text = item + colorChip.chipBackgroundColor = ColorStateList.valueOf(Color.parseColor(item)) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/LabelViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/LabelViewHolder.kt new file mode 100644 index 000000000..9028fb776 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/LabelViewHolder.kt @@ -0,0 +1,24 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.core.view.isVisible +import com.fastaccess.data.model.parcelable.LabelModel +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.BaseViewHolder +import kotlinx.android.synthetic.main.label_row_item.view.* + +/** + * Created by Kosh on 04.11.18. + */ +class LabelViewHolder(parent: ViewGroup) : BaseViewHolder(LayoutInflater.from(parent.context) + .inflate(R.layout.label_row_item, parent, false)) { + override fun bind(item: LabelModel) = Unit + + fun bind(item: LabelModel, isSelected: Boolean) { + itemView.apply { + backgroundLayout.isVisible = isSelected + label.text = item.name + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/LanguagesViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/LanguagesViewHolder.kt new file mode 100644 index 000000000..1c143d646 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/LanguagesViewHolder.kt @@ -0,0 +1,33 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.graphics.Color +import android.view.LayoutInflater +import android.view.ViewGroup +import com.fastaccess.data.model.LanguageColorsModel +import com.fastaccess.github.R +import com.fastaccess.github.ui.adapter.LanguagesAdapter +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.github.extensions.getColorAttr +import kotlinx.android.synthetic.main.language_row_item.view.* + +/** + * Created by Kosh on 2018-11-17. + */ +class LanguagesViewHolder( + private val languagesAdapter: LanguagesAdapter, + parent: ViewGroup +) : BaseViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.language_row_item, parent, false)) { + + override fun bind(item: LanguageColorsModel) { + itemView.apply { + languageChip.text = item.name + languageChip.isChecked = languagesAdapter.checkedLanguage == item.name + languageChip.checkedIcon?.mutate()?.setTint(if (item.color.isNullOrEmpty()) { + context.getColorAttr(R.attr.colorAccent) + } else { + kotlin.runCatching { Color.parseColor(item.color) }.getOrDefault(context.getColorAttr(R.attr.colorAccent)) + }) + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/LoggedInUserViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/LoggedInUserViewHolder.kt new file mode 100644 index 000000000..b7bc0b86b --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/LoggedInUserViewHolder.kt @@ -0,0 +1,26 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.core.view.isVisible +import com.fastaccess.data.persistence.models.LoginModel +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.BaseViewHolder +import kotlinx.android.synthetic.main.profile_follower_following_row_item.view.* + +/** + * Created by Kosh on 12.10.18. + */ + +class LoggedInUserViewHolder(parent: ViewGroup) : BaseViewHolder(LayoutInflater.from(parent.context) + .inflate(R.layout.profile_follower_following_row_item, parent, false)) { + + override fun bind(item: LoginModel) { + itemView.apply { + title.text = if (item.name.isNullOrEmpty()) item.login else item.name + description.isVisible = !item.bio.isNullOrEmpty() + description.text = item.bio + userIcon.loadAvatar(item.avatarUrl, null) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/MilestoneViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/MilestoneViewHolder.kt new file mode 100644 index 000000000..0f64c78d2 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/MilestoneViewHolder.kt @@ -0,0 +1,25 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.view.LayoutInflater +import android.view.ViewGroup +import com.fastaccess.data.model.parcelable.MilestoneModel +import com.fastaccess.github.R +import com.fastaccess.github.extensions.DatePrettifier +import com.fastaccess.github.base.adapter.BaseViewHolder +import kotlinx.android.synthetic.main.milestone_row_item.view.* + +/** + * Created by Kosh on 04.11.18. + */ +class MilestoneViewHolder(parent: ViewGroup) : BaseViewHolder(LayoutInflater.from(parent.context) + .inflate(R.layout.milestone_row_item, parent, false)) { + + override fun bind(item: MilestoneModel) { + itemView.apply { + title.text = item.title ?: "${item.number ?: "N/A"}" + dueOn.text = item.dueOn?.let { + DatePrettifier.prettifyDate(it.time) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/MyIssuesPrsViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/MyIssuesPrsViewHolder.kt new file mode 100644 index 000000000..e5e4e58dd --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/MyIssuesPrsViewHolder.kt @@ -0,0 +1,47 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.annotation.SuppressLint +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.core.view.isVisible +import com.fastaccess.data.persistence.models.MyIssuesPullsModel +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.github.extensions.getColorCompat +import github.type.PullRequestState +import kotlinx.android.synthetic.main.issues_prs_main_screen_row_item.view.* + +@Suppress("IMPLICIT_CAST_TO_ANY") class MyIssuesPrsViewHolder(viewGroup: ViewGroup) : BaseViewHolder( + LayoutInflater.from(viewGroup.context) + .inflate(R.layout.issues_prs_main_screen_row_item, viewGroup, false) +) { + + @Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE") + @SuppressLint("SetTextI18n") + override fun bind(model: MyIssuesPullsModel?) { + itemView.let { + val item = model ?: run { + itemView.isVisible = false + return + } + it.issueTitle.text = "${item.title}#${item.number}" + it.issueDescription.apply { + text = item.repoName ?: "" + isVisible = !item.repoName.isNullOrBlank() + } + it.commentCountBox.isVisible = item.commentCounts != 0 + it.commentCount.text = "${if (item.commentCounts ?: 0 > 99) "99" else item.commentCounts}" + if (!item.state.isNullOrEmpty()) { + it.stateIcon.isVisible = true + it.stateIcon.setImageResource( + when { + PullRequestState.OPEN.name == item.state -> R.drawable.circle_shape_green_small + PullRequestState.CLOSED.name == item.state -> R.drawable.circle_shape_red_small + PullRequestState.MERGED.name == item.state -> R.drawable.circle_shape_blue_small + else -> it.context.getColorCompat(R.color.material_green_700) + } + ) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/NotificationsViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/NotificationsViewHolder.kt new file mode 100644 index 000000000..c81f34392 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/NotificationsViewHolder.kt @@ -0,0 +1,59 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.graphics.Color +import android.graphics.drawable.Drawable +import android.view.LayoutInflater +import android.view.ViewGroup +import com.fastaccess.data.persistence.models.NotificationModel +import com.fastaccess.github.R +import com.fastaccess.github.extensions.getColorCompat +import com.fastaccess.github.extensions.getDrawableCompat +import com.fastaccess.github.extensions.replaceAllNewLines +import com.fastaccess.github.extensions.timeAgo +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.github.base.widget.recyclerview.SwipeToDeleteCallback +import kotlinx.android.synthetic.main.notification_main_screen_row_item.view.* + +/** + * Created by Kosh on 12.10.18. + */ + +class NotificationsViewHolder(parent: ViewGroup) : BaseViewHolder(LayoutInflater.from(parent.context) + .inflate(R.layout.notification_main_screen_row_item, parent, false)), SwipeToDeleteCallback.AllowSwipeToDeleteDelegate { + + private var item: NotificationModel? = null + + override val drawableStart: Drawable? = null + override val drawableStartBackground: Int = 0 + + override val drawableEnd: Drawable? + get() { + if (item?.unread == true) { + return itemView.context.getDrawableCompat(R.drawable.ic_done)?.apply { + setTint(Color.WHITE) + } + } + return null + } + + override val drawableEndBackground: Int = itemView.context.getColorCompat(R.color.material_green_700) + + override fun bind(item: NotificationModel) { + this.item = item + itemView.apply { + item.subject?.let { subject -> + notificationTitle.text = subject.title?.replaceAllNewLines() ?: "" + subject.type?.let { type -> + when (type) { + "PullRequest" -> typeIcon.setImageResource(R.drawable.ic_pull_requests) + "Issue" -> typeIcon.setImageResource(R.drawable.ic_issues) + "Commit" -> typeIcon.setImageResource(R.drawable.ic_branch) + else -> typeIcon.setImageResource(R.drawable.ic_issues) + } + } + } + repoName.text = item.repository?.fullName ?: "" + dateWithIcon.text = item.updatedAt?.timeAgo() + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/OrganizationViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/OrganizationViewHolder.kt new file mode 100644 index 000000000..d9b320b80 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/OrganizationViewHolder.kt @@ -0,0 +1,28 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.view.LayoutInflater +import android.view.ViewGroup +import com.fastaccess.data.persistence.models.OrganizationModel +import com.fastaccess.github.R +import com.fastaccess.github.extensions.formatNumber +import com.fastaccess.github.base.adapter.BaseViewHolder +import kotlinx.android.synthetic.main.organization_row_item.view.* + +/** + * Created by Kosh on 12.10.18. + */ + +class OrganizationViewHolder(parent: ViewGroup) : BaseViewHolder(LayoutInflater.from(parent.context) + .inflate(R.layout.organization_row_item, parent, false)) { + + override fun bind(item: OrganizationModel) { + itemView.apply { + title.text = if (item.name.isNullOrEmpty()) item.login else item.name + avatar.loadAvatar(item.avatarUrl, item.url) + teams.text = item.teams?.totalCount?.formatNumber() ?: "0" + members.text = item.members?.totalCount?.formatNumber() ?: "0" + projects.text = item.projects?.totalCount?.formatNumber() ?: "0" + repos.text = item.repositories?.totalCount?.formatNumber() ?: "0" + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ProfileFollowerFollowingViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ProfileFollowerFollowingViewHolder.kt new file mode 100644 index 000000000..f0db15204 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ProfileFollowerFollowingViewHolder.kt @@ -0,0 +1,26 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.core.view.isVisible +import com.fastaccess.data.persistence.models.FollowingFollowerModel +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.BaseViewHolder +import kotlinx.android.synthetic.main.profile_follower_following_row_item.view.* + +/** + * Created by Kosh on 12.10.18. + */ + +class ProfileFollowerFollowingViewHolder(parent: ViewGroup) : BaseViewHolder(LayoutInflater.from(parent.context) + .inflate(R.layout.profile_follower_following_row_item, parent, false)) { + + override fun bind(item: FollowingFollowerModel) { + itemView.apply { + title.text = if (item.name.isNullOrEmpty()) item.login else item.name + description.isVisible = !item.bio.isNullOrEmpty() + description.text = item.bio + userIcon.loadAvatar(item.avatarUrl, item.url) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ProfileGistsViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ProfileGistsViewHolder.kt new file mode 100644 index 000000000..92eaca472 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ProfileGistsViewHolder.kt @@ -0,0 +1,32 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.view.LayoutInflater +import android.view.ViewGroup +import com.fastaccess.data.persistence.models.ProfileGistModel +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.github.extensions.formatNumber +import kotlinx.android.synthetic.main.profile_gist_repo_row_item.view.* + +/** + * Created by Kosh on 12.10.18. + */ + +class ProfileGistsViewHolder(parent: ViewGroup) : BaseViewHolder(LayoutInflater.from(parent.context) + .inflate(R.layout.profile_gist_repo_row_item, parent, false)) { + + override fun bind(item: ProfileGistModel) { + itemView.apply { + title.text = if (item.description.isNullOrEmpty()) context.getString(R.string.no_data) else item.description + starCount.text = item.stargazers?.totalCount?.formatNumber() ?: "0" + commentCount.text = item.comments?.totalCount?.formatNumber() ?: "0" + if (item.isPublic == true) { + isPublic.text = context.getString(R.string.public_label) + isPublic.setChipIconResource(R.drawable.ic_brower) + } else { + isPublic.text = context.getString(R.string.private_label) + isPublic.setChipIconResource(R.drawable.ic_incognito) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ProfileOrgsViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ProfileOrgsViewHolder.kt new file mode 100644 index 000000000..2e2017863 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ProfileOrgsViewHolder.kt @@ -0,0 +1,20 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.view.LayoutInflater +import android.view.ViewGroup +import com.fastaccess.data.persistence.models.UserOrganizationNodesModel +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.BaseViewHolder +import kotlinx.android.synthetic.main.icon_row_item.view.* + +/** + * Created by Kosh on 2018-11-17. + */ +class ProfileOrgsViewHolder(parent: ViewGroup) : BaseViewHolder(LayoutInflater.from(parent.context) + .inflate(R.layout.icon_row_item, parent, false)) { + + override fun bind(item: UserOrganizationNodesModel) { + itemView.imageIcon.loadAvatar(item.avatarUrl, null) + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ProfilePinnedReposViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ProfilePinnedReposViewHolder.kt new file mode 100644 index 000000000..1f145e617 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ProfilePinnedReposViewHolder.kt @@ -0,0 +1,35 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.content.res.ColorStateList +import android.graphics.Color +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.core.view.isVisible +import com.fastaccess.data.persistence.models.UserPinnedRepoNodesModel +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.github.extensions.formatNumber +import kotlinx.android.synthetic.main.profile_pinned_repo_row_item.view.* + +/** + * Created by Kosh on 2018-11-17. + */ +class ProfilePinnedReposViewHolder(parent: ViewGroup) : BaseViewHolder(LayoutInflater.from(parent.context) + .inflate(R.layout.profile_pinned_repo_row_item, parent, false)) { + + override fun bind(item: UserPinnedRepoNodesModel) { + itemView.apply { + title.text = item.name + star.text = item.stargazers?.totalCount?.formatNumber() ?: "0" + forks.text = item.forkCount?.formatNumber() ?: "0" + issues.text = item.issues?.totalCount?.formatNumber() ?: "0" + pulls.text = item.pullRequests?.totalCount?.formatNumber() ?: "0" + language.isVisible = !item.primaryLanguage?.name.isNullOrEmpty() + language.text = item.primaryLanguage?.name ?: "" + if (!item.primaryLanguage?.color.isNullOrBlank()) { + language.chipIconTint = ColorStateList.valueOf(Color.parseColor(item.primaryLanguage?.color)) + } + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ReposProfileViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ReposProfileViewHolder.kt new file mode 100644 index 000000000..41528e74e --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ReposProfileViewHolder.kt @@ -0,0 +1,48 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.content.res.ColorStateList +import android.graphics.Color +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.core.view.isVisible +import com.fastaccess.data.persistence.models.ProfileRepoModel +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.markdown.widget.SpannableBuilder +import com.fastaccess.markdown.spans.LabelSpan +import com.fastaccess.github.extensions.formatNumber +import com.fastaccess.github.extensions.getColorCompat +import kotlinx.android.synthetic.main.profile_pinned_repo_row_item.view.* + +/** + * Created by Kosh on 12.10.18. + */ + +class ReposProfileViewHolder(parent: ViewGroup) : BaseViewHolder(LayoutInflater.from(parent.context) + .inflate(R.layout.profile_pinned_repo_row_item, parent, false)) { + + override fun bind(item: ProfileRepoModel) { + itemView.apply { + title.text = when { + item.isPrivate == true -> SpannableBuilder.builder() + .append(" ${context.getString(R.string.private_repo)} ", LabelSpan(context.getColorCompat(R.color.material_grey_700))) + .space() + .append(item.name ?: "", LabelSpan(Color.TRANSPARENT)) + item.isFork == true -> SpannableBuilder.builder() + .append(" ${context.getString(R.string.forked)} ", LabelSpan(context.getColorCompat(R.color.material_indigo_700))) + .space() + .append(item.name ?: "", LabelSpan(Color.TRANSPARENT)) + else -> item.name + } + star.text = item.stargazers?.totalCount?.formatNumber() ?: "0" + forks.text = item.forkCount?.formatNumber() ?: "0" + issues.text = item.issues?.totalCount?.formatNumber() ?: "0" + pulls.text = item.pullRequests?.totalCount?.formatNumber() ?: "0" + language.isVisible = !item.primaryLanguage?.name.isNullOrEmpty() + language.text = item.primaryLanguage?.name ?: "" + if (!item.primaryLanguage?.color.isNullOrBlank()) { + language.chipIconTint = ColorStateList.valueOf(Color.parseColor(item.primaryLanguage?.color)) ?: null + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ReposStarredProfileViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ReposStarredProfileViewHolder.kt new file mode 100644 index 000000000..72bea5172 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ReposStarredProfileViewHolder.kt @@ -0,0 +1,48 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.content.res.ColorStateList +import android.graphics.Color +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.core.view.isVisible +import com.fastaccess.data.persistence.models.ProfileStarredRepoModel +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.markdown.widget.SpannableBuilder +import com.fastaccess.markdown.spans.LabelSpan +import com.fastaccess.github.extensions.formatNumber +import com.fastaccess.github.extensions.getColorCompat +import kotlinx.android.synthetic.main.profile_pinned_repo_row_item.view.* + +/** + * Created by Kosh on 12.10.18. + */ + +class ReposStarredProfileViewHolder(parent: ViewGroup) : BaseViewHolder(LayoutInflater.from(parent.context) + .inflate(R.layout.profile_pinned_repo_row_item, parent, false)) { + + override fun bind(item: ProfileStarredRepoModel) { + itemView.apply { + title.text = when { + item.isPrivate == true -> SpannableBuilder.builder() + .append(" ${context.getString(R.string.private_repo)} ", LabelSpan(context.getColorCompat(R.color.material_grey_700))) + .space() + .append(item.nameWithOwner ?: "", LabelSpan(Color.TRANSPARENT)) + item.isFork == true -> SpannableBuilder.builder() + .append(" ${context.getString(R.string.forked)} ", LabelSpan(context.getColorCompat(R.color.material_indigo_700))) + .space() + .append(item.nameWithOwner ?: "", LabelSpan(Color.TRANSPARENT)) + else -> item.nameWithOwner + } + star.text = item.stargazers?.totalCount?.formatNumber() ?: "0" + forks.text = item.forkCount?.formatNumber() ?: "0" + issues.text = item.issues?.totalCount?.formatNumber() ?: "0" + pulls.text = item.pullRequests?.totalCount?.formatNumber() ?: "0" + language.isVisible = !item.primaryLanguage?.name.isNullOrEmpty() + language.text = item.primaryLanguage?.name ?: "" + if (!item.primaryLanguage?.color.isNullOrBlank()) { + language.chipIconTint = ColorStateList.valueOf(Color.parseColor(item.primaryLanguage?.color)) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ReviewViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ReviewViewHolder.kt new file mode 100644 index 000000000..56e6577b5 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ReviewViewHolder.kt @@ -0,0 +1,183 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.annotation.SuppressLint +import android.view.LayoutInflater +import android.view.MotionEvent +import android.view.ViewGroup +import androidx.core.view.isVisible +import com.fastaccess.data.model.CommentAuthorAssociation +import com.fastaccess.data.model.ReviewModel +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.github.base.extensions.popMenu +import com.fastaccess.github.extensions.getColorAttr +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.showYesNoDialog +import com.fastaccess.github.extensions.timeAgo +import com.fastaccess.markdown.spans.DiffLineSpan +import com.fastaccess.markdown.widget.SpannableBuilder +import github.type.PullRequestReviewState +import io.noties.markwon.Markwon +import io.noties.markwon.utils.NoCopySpannableFactory +import kotlinx.android.synthetic.main.comment_small_row_item.view.* +import kotlinx.android.synthetic.main.review_with_comment_row_item.view.* + + +/** + * Created by Kosh on 12.10.18. + */ + +class ReviewViewHolder( + parent: ViewGroup, + private val markwon: Markwon, + private val theme: Int, + private val callback: (position: Int) -> Unit, + private val deleteCommentListener: (position: Int, isReviewBody: Boolean) -> Unit, + private val editCommentListener: (position: Int, isReviewBody: Boolean) -> Unit +) : BaseViewHolder( + LayoutInflater.from(parent.context) + .inflate(R.layout.review_with_comment_row_item, parent, false) +) { + + @SuppressLint("SetTextI18n", "DefaultLocale") + override fun bind(item: ReviewModel?) { + val _review = item ?: run { + itemView.isVisible = false + return + } + itemView.apply { + itemView.commentLayout.isVisible = _review.comment != null + val showReview = !_review.body.isNullOrBlank() + if (showReview) { + initReview(_review) + } + reviewLayout.isVisible = showReview + _review.comment?.let { model -> + fileName.text = model.path + if (!model.diffHunk.isNullOrEmpty()) { + diffHunk.text = DiffLineSpan.getSpannable( + model.diffHunk, + context.getColorAttr(R.attr.patch_addition), context.getColorAttr(R.attr.patch_deletion), + context.getColorAttr(R.attr.patch_ref), + truncate = true + ) + diffHunk.isVisible = true + } else { + diffHunk.isVisible = false + } + userIcon.loadAvatar(model.author?.avatarUrl, model.author?.url ?: "") + author.text = model.author?.login ?: "" + association.text = if (CommentAuthorAssociation.NONE == model.authorAssociation) { + if (!showReview) { + SpannableBuilder.builder() + .bold(_review.state?.replace("_", " ")?.toLowerCase()) + .append(", ") + .append(model.createdAt?.timeAgo()) + } else { + model.createdAt?.timeAgo() + } + } else { + SpannableBuilder.builder() + .bold(model.authorAssociation?.value?.toLowerCase()?.replace("_", "") ?: "") + .append(", ") + .append(model.updatedAt?.timeAgo()) + } + + description.post { + description.setSpannableFactory(NoCopySpannableFactory.getInstance()) + val bodyMd = model.body + markwon.setMarkdown(description, if (!bodyMd.isNullOrEmpty()) bodyMd else resources.getString(R.string.no_description_provided)) + } + + description.setOnTouchListener { v, event -> + if (event.action == MotionEvent.ACTION_UP && !description.hasSelection()) { + itemView.callOnClick() + } + return@setOnTouchListener false + } + + val canAlter = model.viewerCanUpdate == true || model.viewerCanDelete == true + menu.isVisible = canAlter + if (canAlter) { + menu.popMenu(R.menu.comment_menu, { menu -> + menu.findItem(R.id.edit)?.isVisible = model.viewerCanUpdate == true + menu.findItem(R.id.delete)?.isVisible = model.viewerCanDelete == true + }) { itemId -> + if (itemId == R.id.delete) { + context.showYesNoDialog(R.string.delete) { + it.isTrue { + deleteCommentListener.invoke(adapterPosition, false) + } + } + } else if (itemId == R.id.edit) { + editCommentListener.invoke(adapterPosition, false) + } + } + } + + adaptiveEmoticon.init(requireNotNull(model.id), model.reactionGroups) { + callback.invoke(adapterPosition) + } + } + divider.isVisible = _review.comment != null + reviewCommentLayout.isVisible = _review.comment != null + } + } + + @SuppressLint("DefaultLocale") + private fun initReview(model: ReviewModel) { + itemView.apply { + reviewUserIcon.loadAvatar(model.author?.avatarUrl, model.author?.url ?: "") + reviewAuthor.text = model.author?.login ?: "" + reviewAssociation.text = if (CommentAuthorAssociation.NONE.value == model.authorAssociation) { + SpannableBuilder.builder() + .bold(model.state?.replace("_", " ")?.toLowerCase()) + .append(", ") + .append(model.createdAt?.timeAgo()) + } else { + SpannableBuilder.builder() + .bold(model.state?.replace("_", " ")?.toLowerCase()) + .append(", ") + .append(model.authorAssociation?.toLowerCase()?.replace("_", "") ?: "") + .append(", ") + .append(model.createdAt?.timeAgo()) + } + + reviewDescription.post { + reviewDescription.setSpannableFactory(NoCopySpannableFactory.getInstance()) + val bodyMd = model.body + markwon.setMarkdown(reviewDescription, if (!bodyMd.isNullOrEmpty()) bodyMd else resources.getString(R.string.no_description_provided)) + } + + reviewDescription.setOnTouchListener { _, event -> + if (event.action == MotionEvent.ACTION_UP && !reviewDescription.hasSelection()) { + itemView.callOnClick() + } + return@setOnTouchListener false + } + + val canAlter = model.viewerCanUpdate == true || model.viewerCanDelete == true + reviewMenu.isVisible = canAlter + if (canAlter) { + reviewMenu.popMenu(R.menu.comment_menu, { menu -> + menu.findItem(R.id.edit)?.isVisible = model.viewerCanUpdate == true + menu.findItem(R.id.delete)?.let { + it.isVisible = model.viewerCanDelete == true && + model.state != PullRequestReviewState.COMMENTED.rawValue() + it.title = context.getString(R.string.dismiss_review) + } + }) { itemId -> + if (itemId == R.id.delete) { + deleteCommentListener.invoke(adapterPosition, true) + } else if (itemId == R.id.edit) { + editCommentListener.invoke(adapterPosition, true) + } + } + } + + reviewAdaptiveEmoticon.init(requireNotNull(model.id), model.reactionGroups) { + callback.invoke(adapterPosition) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ShortRepoViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ShortRepoViewHolder.kt new file mode 100644 index 000000000..fa92d49e8 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ShortRepoViewHolder.kt @@ -0,0 +1,43 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.graphics.Color +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.core.view.isVisible +import com.fastaccess.data.model.ShortRepoModel +import com.fastaccess.github.R +import com.fastaccess.github.extensions.formatNumber +import com.fastaccess.github.base.adapter.BaseViewHolder +import com.fastaccess.markdown.widget.SpannableBuilder +import com.fastaccess.markdown.spans.LabelSpan +import com.fastaccess.github.extensions.getColorCompat +import kotlinx.android.synthetic.main.profile_pinned_repo_row_item.view.* + +/** + * Created by Kosh on 12.10.18. + */ + +class ShortRepoViewHolder(parent: ViewGroup) : BaseViewHolder(LayoutInflater.from(parent.context) + .inflate(R.layout.profile_pinned_repo_row_item, parent, false)) { + + override fun bind(item: ShortRepoModel) { + itemView.apply { + title.text = when { + item.isPrivate == true -> SpannableBuilder.builder() + .append(" ${context.getString(R.string.private_repo)} ", LabelSpan(context.getColorCompat(R.color.material_grey_700))) + .space() + .append(item.name ?: "", LabelSpan(Color.TRANSPARENT)) + item.isFork == true -> SpannableBuilder.builder() + .append(" ${context.getString(R.string.forked)} ", LabelSpan(context.getColorCompat(R.color.material_indigo_700))) + .space() + .append(item.name ?: "", LabelSpan(Color.TRANSPARENT)) + else -> item.name + } + star.text = item.stargazers?.totalCount?.formatNumber() ?: "0" + forks.text = item.forkCount?.formatNumber() ?: "0" + issues.text = item.issues?.totalCount?.formatNumber() ?: "0" + pulls.text = item.pullRequests?.totalCount?.formatNumber() ?: "0" + language.isVisible = false + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ShortUserViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ShortUserViewHolder.kt new file mode 100644 index 000000000..49d6d61f3 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/ShortUserViewHolder.kt @@ -0,0 +1,26 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.core.view.isVisible +import com.fastaccess.data.model.ShortUserModel +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.BaseViewHolder +import kotlinx.android.synthetic.main.profile_follower_following_row_item.view.* + +/** + * Created by Kosh on 12.10.18. + */ + +class ShortUserViewHolder(parent: ViewGroup) : BaseViewHolder(LayoutInflater.from(parent.context) + .inflate(R.layout.profile_follower_following_row_item, parent, false)) { + + override fun bind(item: ShortUserModel) { + itemView.apply { + title.text = if (item.name.isNullOrEmpty()) item.login else item.name + description.isVisible = !item.bio.isNullOrEmpty() + description.text = item.bio + userIcon.loadAvatar(item.avatarUrl, item.url) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/TitleSectionViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/TitleSectionViewHolder.kt new file mode 100644 index 000000000..efc3f0fc3 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/TitleSectionViewHolder.kt @@ -0,0 +1,18 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.view.LayoutInflater +import android.view.ViewGroup +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.BaseViewHolder +import kotlinx.android.synthetic.main.title_section_row_item.view.* + +/** + * Created by Kosh on 04.11.18. + */ +class TitleSectionViewHolder(parent: ViewGroup) : BaseViewHolder( + LayoutInflater.from(parent.context).inflate(R.layout.title_section_row_item, parent, false) +) { + override fun bind(item: CharSequence) { + itemView.title.text = item + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/TrendingViewHolder.kt b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/TrendingViewHolder.kt new file mode 100644 index 000000000..34b473e0f --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/adapter/viewholder/TrendingViewHolder.kt @@ -0,0 +1,31 @@ +package com.fastaccess.github.ui.adapter.viewholder + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.core.view.isVisible +import com.fastaccess.data.model.TrendingModel +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.BaseViewHolder +import kotlinx.android.synthetic.main.trending_row_item.view.* + +/** + * Created by Kosh on 2018-11-17. + */ +class TrendingViewHolder(parent: ViewGroup) : BaseViewHolder(LayoutInflater.from(parent.context) + .inflate(R.layout.trending_row_item, parent, false)) { + + override fun bind(item: TrendingModel) { + itemView.apply { + title.text = item.title + description.isVisible = !item.description.isNullOrEmpty() + description.text = item.description + star.text = item.stars + forks.text = item.forks + todayStars.isVisible = !item.todayStars.isNullOrEmpty() + todayStars.text = item.todayStars + language.isVisible = !item.language.isNullOrEmpty() + language.text = item.language + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/auth/LoginChooserActivity.kt b/app/src/main/java/com/fastaccess/github/ui/modules/auth/LoginChooserActivity.kt new file mode 100644 index 000000000..8ef6a4949 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/auth/LoginChooserActivity.kt @@ -0,0 +1,134 @@ +package com.fastaccess.github.ui.modules.auth + +import android.content.Intent +import android.net.Uri +import android.os.Bundle +import android.view.View +import androidx.browser.customtabs.CustomTabsIntent +import androidx.core.view.ViewCompat +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.data.persistence.models.LoginModel +import com.fastaccess.domain.BuildConfig +import com.fastaccess.github.R +import com.fastaccess.github.base.deeplink.AppDeepLink +import com.fastaccess.github.base.extensions.* +import com.fastaccess.github.base.utils.LOGIN_PATH +import com.fastaccess.github.base.utils.REDIRECT_URL +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.github.extensions.getColorAttr +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.ui.modules.auth.callback.LoginChooserCallback +import com.fastaccess.github.ui.modules.auth.chooser.LoginChooserFragment +import com.fastaccess.github.ui.modules.auth.login.AuthLoginFragment +import com.fastaccess.github.ui.modules.main.MainActivity +import javax.inject.Inject + +/** + * Created by Kosh on 18.05.18. + */ +@AppDeepLink("/$LOGIN_PATH") +class LoginChooserActivity : com.fastaccess.github.base.BaseActivity(), LoginChooserCallback { + + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(LoginChooserViewModel::class.java) } + + override fun hasTheme(): Boolean = true + override fun layoutRes(): Int = R.layout.login_chooser_activity_layout + + override fun onCreate(savedInstanceState: Bundle?) { + setTheme(R.style.LoginTheme) + super.onCreate(savedInstanceState) + if (savedInstanceState == null) { + supportFragmentManager.beginTransaction() + .replace(R.id.container, LoginChooserFragment(), LoginChooserFragment.TAG) + .commit() + } + } + + override fun navToBasicAuth(view: View) { + supportFragmentManager.beginTransaction() + .addSharedElement(view, ViewCompat.getTransitionName(view) ?: "") + .replace(R.id.container, AuthLoginFragment.newInstance(), AuthLoginFragment.TAG) + .addToBackStack(AuthLoginFragment.TAG) + .commit() + } + + override fun navToAccessToken(view: View) { + supportFragmentManager.beginTransaction() + .addSharedElement(view, ViewCompat.getTransitionName(view) ?: "") + .replace(R.id.container, AuthLoginFragment.newInstance(accessToken = true), AuthLoginFragment.TAG) + .addToBackStack(AuthLoginFragment.TAG) + .commit() + } + + override fun navToEnterprise(view: View) { + supportFragmentManager.beginTransaction() + .addSharedElement(view, ViewCompat.getTransitionName(view) ?: "") + .replace(R.id.container, AuthLoginFragment.newInstance(isEnterprise = true), AuthLoginFragment.TAG) + .addToBackStack(AuthLoginFragment.TAG) + .commit() + } + + override fun loginWithBrowser() { + val tabIntent = CustomTabsIntent.Builder() + .setToolbarColor(getColorAttr(R.attr.colorPrimary)) + .enableUrlBarHiding() + .build() + + tabIntent.launchUrl( + this, Uri.Builder() + .scheme("https") + .authority("github.com") + .appendPath("login") + .appendPath("oauth") + .appendPath("authorize") + .appendQueryParameter("client_id", BuildConfig.GITHUB_CLIENT_ID) + .appendQueryParameter("redirect_uri", REDIRECT_URL) + .appendQueryParameter("scope", "user,repo,gist,notifications,read:org") + .appendQueryParameter("state", com.fastaccess.github.BuildConfig.APPLICATION_ID) + .build() + ) + } + + override fun popStack() = supportFragmentManager.popBackStack() + + override fun onActivityCreatedWithUser(savedInstanceState: Bundle?) {} + + override fun onNewIntent(intent: Intent?) { + super.onNewIntent(intent) + handleIntent(intent) + setIntent(null) + } + + override fun onResume() { + super.onResume() + handleIntent(intent) + intent = null + } + + override fun onUserLoggedIn(login: LoginModel) { + if (BuildConfig.DEBUG) preference.theme = 1 + if (login.isEnterprise == true) { + preference.enterpriseOtpCode = login.otpCode + preference.enterpriseToken = login.token + preference.enterpriseUrl = login.enterpriseUrl + } else { + preference.token = login.token + preference.otpCode = login.otpCode + } + startActivity(Intent(this, MainActivity::class.java).apply { + flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK + }) + finishAffinity() + } + + override fun isLoginActivity(): Boolean = true + + private fun handleIntent(intent: Intent?) { + if (!viewModel.loggedInUser.hasActiveObservers()) { + viewModel.loggedInUser.observeNotNull(this) { onUserLoggedIn(it) } + } + intent?.data?.let { viewModel.handleBrowserLogin(it) } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/auth/LoginChooserViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/auth/LoginChooserViewModel.kt new file mode 100644 index 000000000..e34b3c77e --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/auth/LoginChooserViewModel.kt @@ -0,0 +1,69 @@ +package com.fastaccess.github.ui.modules.auth + +import android.net.Uri +import androidx.lifecycle.MutableLiveData +import com.fastaccess.data.persistence.db.FastHubDatabase +import com.fastaccess.data.persistence.models.LoginModel +import com.fastaccess.data.repository.LoginRepository +import com.fastaccess.domain.di.AuthenticationInterceptor +import com.fastaccess.github.usecase.auth.GetAccessTokenUseCase +import com.fastaccess.github.usecase.auth.LoginWithAccessTokenUseCase +import com.fastaccess.github.base.utils.REDIRECT_URL +import io.reactivex.Completable +import javax.inject.Inject + +/** + * Created by Kosh on 2018-11-23. + */ +class LoginChooserViewModel @Inject constructor( + private val accessTokenUseCase: GetAccessTokenUseCase, + private val loginWithAccessTokenUseCase: LoginWithAccessTokenUseCase, + private val interceptor: AuthenticationInterceptor, + private val loginRepositoryProvider: LoginRepository, + private val fastHubDatabase: FastHubDatabase +) : com.fastaccess.github.base.BaseViewModel() { + + val loggedInUser = MutableLiveData() + val loggedInUsers = MutableLiveData>() + + init { + justSubscribe(loginRepositoryProvider.getAll() + .doOnSuccess { + loggedInUsers.postValue(ArrayList(it)) + } + .toObservable()) + } + + fun handleBrowserLogin(uri: Uri) { + if (uri.toString().startsWith(REDIRECT_URL)) { + val token = uri.getQueryParameter("code") + token?.let { code -> + accessTokenUseCase.code = code + add(callApi(accessTokenUseCase.buildObservable() + .flatMap { accessTokenResponse -> + interceptor.token = accessTokenResponse.token ?: accessTokenResponse.accessToken ?: "" + return@flatMap loginWithAccessTokenUseCase.buildObservable() + .flatMap { + it.token = interceptor.token + it.isLoggedIn = true + loginWithAccessTokenUseCase.insertUser(it) + } + }) + .subscribe({ loggedInUser.postValue(it) }, { it.printStackTrace() })) + } + } + } + + override fun onCleared() { + super.onCleared() + accessTokenUseCase.dispose() + loginWithAccessTokenUseCase.dispose() + } + + fun reLogin(user: LoginModel): Completable = user.let { me -> + loginRepositoryProvider.logoutAll() // logout everyone in case of adding account + fastHubDatabase.clearAll() // clear everything in db and start fresh! + me.isLoggedIn = true + return@let loginRepositoryProvider.update(me) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/auth/callback/LoginChooserCallback.kt b/app/src/main/java/com/fastaccess/github/ui/modules/auth/callback/LoginChooserCallback.kt new file mode 100644 index 000000000..c45650c63 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/auth/callback/LoginChooserCallback.kt @@ -0,0 +1,17 @@ +package com.fastaccess.github.ui.modules.auth.callback + +import android.view.View +import com.fastaccess.data.persistence.models.LoginModel + +/** + * Created by Kosh on 19.05.18. + */ + +interface LoginChooserCallback { + fun navToBasicAuth(view: View) + fun navToAccessToken(view: View) + fun navToEnterprise(view: View) + fun popStack() + fun onUserLoggedIn(login: LoginModel) + fun loginWithBrowser() +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/auth/chooser/LoginChooserFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/auth/chooser/LoginChooserFragment.kt new file mode 100644 index 000000000..ffd4bf428 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/auth/chooser/LoginChooserFragment.kt @@ -0,0 +1,92 @@ +package com.fastaccess.github.ui.modules.auth.chooser + +import android.content.Context +import android.os.Bundle +import android.view.View +import androidx.core.view.isVisible +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.beginDelayedTransition +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.github.ui.adapter.LoggedInUsersAdapter +import com.fastaccess.github.ui.modules.auth.LoginChooserViewModel +import com.fastaccess.github.ui.modules.auth.callback.LoginChooserCallback +import kotlinx.android.synthetic.main.login_chooser_fragment_layout.* +import javax.inject.Inject + +/** + * Created by Kosh on 19.05.18. + */ +class LoginChooserFragment : com.fastaccess.github.base.BaseFragment() { + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + @Inject lateinit var schedulerProvider: SchedulerProvider + + private val viewModel by lazy { ViewModelProviders.of(requireActivity(), viewModelFactory).get(LoginChooserViewModel::class.java) } + private var callback: LoginChooserCallback? = null + private val adapter by lazy { + LoggedInUsersAdapter { user -> + addDisposal( + viewModel.reLogin(user) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .subscribe({ (requireActivity() as? LoginChooserCallback)?.onUserLoggedIn(user) }, + { throwable -> view?.let { showSnackBar(it, message = throwable.message) } }) + ) + } + } + + override fun onAttach(context: Context) { + super.onAttach(context) + callback = context as LoginChooserCallback + } + + override fun onDetach() { + callback = null + super.onDetach() + } + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = null + override fun layoutRes() = R.layout.login_chooser_fragment_layout + override fun onFragmentCreatedWithUser( + view: View, + savedInstanceState: Bundle? + ) { + } + + override fun onViewCreated( + view: View, + savedInstanceState: Bundle? + ) { + super.onViewCreated(view, savedInstanceState) + basicAuth.setOnClickListener { callback?.navToBasicAuth(loginCard) } + accessToken.setOnClickListener { callback?.navToAccessToken(loginCard) } + enterprise.setOnClickListener { callback?.navToEnterprise(loginCard) } + browserLogin.setOnClickListener { callback?.loginWithBrowser() } + + viewModel.progress.observeNotNull(this) { progress -> + this@LoginChooserFragment.view?.beginDelayedTransition() + buttonsLayout.isVisible = !progress + progressBar.isVisible = progress + } + + toggle.setOnClickListener { + parentLayout.beginDelayedTransition() + val isVisible = recycler.isVisible + recycler.isVisible = !isVisible + toggleImage.rotation = if (!isVisible) 180f else 0f + } + + viewModel.loggedInUsers.observeNotNull(this) { + if (it.isEmpty()) return@observeNotNull + multiAccLayout?.isVisible = true + adapter.submitList(it) + recycler.adapter = adapter + } + } + + companion object { + const val TAG = "LoginChooserFragment" + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/auth/login/AuthLoginFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/auth/login/AuthLoginFragment.kt new file mode 100644 index 000000000..91361946b --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/auth/login/AuthLoginFragment.kt @@ -0,0 +1,145 @@ +package com.fastaccess.github.ui.modules.auth.login + +import android.content.Context +import android.os.Bundle +import android.view.View +import androidx.core.view.isVisible +import androidx.lifecycle.Observer +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.data.model.FastHubErrors +import com.fastaccess.data.model.ValidationError.FieldType.* +import com.fastaccess.github.R +import com.fastaccess.github.base.BaseFragment +import com.fastaccess.github.base.extensions.asString +import com.fastaccess.github.base.extensions.beginDelayedTransition +import com.fastaccess.github.base.extensions.hideKeyboard +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.base.utils.EXTRA_TWO +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.ui.modules.auth.callback.LoginChooserCallback +import kotlinx.android.synthetic.main.login_form_layout.* +import javax.inject.Inject + +/** + * Created by Kosh on 18.05.18. + */ +class AuthLoginFragment : BaseFragment() { + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + private var callback: LoginChooserCallback? = null + + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(LoginViewModel::class.java) } + private val isAccessToken by lazy { arguments?.getBoolean(EXTRA) ?: false } + private val isEnterpriseBundle by lazy { arguments?.getBoolean(EXTRA_TWO) ?: false } + + override fun onAttach(context: Context) { + super.onAttach(context) + callback = context as LoginChooserCallback + } + + override fun onDetach() { + callback = null + super.onDetach() + } + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = null + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) = Unit + override fun layoutRes(): Int = R.layout.login_form_layout + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + isAccessToken.isTrue { + password.hint = getString(R.string.access_token) + } + isEnterpriseBundle.isTrue { + endpoint.isVisible = true + accessTokenCheckbox.isVisible = true + accessTokenCheckbox.setOnCheckedChangeListener { _, checked -> + password.hint = if (checked) { + getString(R.string.access_token) + } else { + getString(R.string.password) + } + } + } + + bottomBar.setNavigationOnClickListener { callback?.popStack() } + loginBtn.setOnClickListener { + it.isEnabled = false + if (progressBar.isVisible) return@setOnClickListener + viewModel.login( + usernameEditText.asString(), + passwordEditText.asString(), + twoFactorEditText.asString(), + endpointEditText.asString(), + (isAccessToken || accessTokenCheckbox.isVisible && accessTokenCheckbox.isChecked) + ) + } + + passwordEditText.setOnEditorActionListener { v, _, _ -> + when { + twoFactor.isVisible -> twoFactor.requestFocus() + endpoint.isVisible -> endpoint.requestFocus() + else -> { + v.hideKeyboard() + loginBtn.callOnClick() + } + } + return@setOnEditorActionListener true + } + observeData() + } + + private fun observeData() { + viewModel.validationLiveData.observe(this, Observer { validationError -> + validationError?.let { + val requiredField = getString(R.string.required_field) + when (it.fieldType) { + USERNAME -> username.error = if (it.isValid) null else requiredField + PASSWORD -> password.error = if (it.isValid) null else requiredField + TWO_FACTOR -> twoFactor.error = if (it.isValid) null else requiredField + URL -> endpoint.error = if (it.isValid) null else requiredField + } + } + }) + + viewModel.progress.observe(this, Observer { isLoading -> + loginBtn.isEnabled = isLoading == false + view?.beginDelayedTransition() + loginForm.isVisible = isLoading == false + progressBar.isVisible = isLoading == true + }) + + viewModel.error.observe(this, Observer { errors -> + errors?.let { + if (it.errorType == FastHubErrors.ErrorType.TWO_FACTOR) { + twoFactor.isVisible = true + } + view?.let { view -> + showSnackBar(view, resId = it.resId, message = it.message) + } + } + }) + + viewModel.loggedInUser.observe(this, Observer { model -> + if (model != null) { + addDisposal(viewModel.clearDb() + .subscribe({ callback?.onUserLoggedIn(model) }, { throwable -> view?.let { showSnackBar(it, message = throwable.message) } }) + ) + } else { + view?.let { showSnackBar(it, resId = R.string.failed_login) } + } + }) + } + + companion object { + const val TAG = "AuthLoginFragment" + fun newInstance(accessToken: Boolean = false, isEnterprise: Boolean = false): AuthLoginFragment = AuthLoginFragment() + .apply { + arguments = Bundle().apply { + putBoolean(EXTRA, accessToken) + putBoolean(EXTRA_TWO, isEnterprise) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/auth/login/LoginViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/auth/login/LoginViewModel.kt new file mode 100644 index 000000000..2d9a003e8 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/auth/login/LoginViewModel.kt @@ -0,0 +1,116 @@ +package com.fastaccess.github.ui.modules.auth.login + +import androidx.lifecycle.MutableLiveData +import com.crashlytics.android.Crashlytics +import com.fastaccess.data.model.FastHubErrors +import com.fastaccess.data.model.ValidationError +import com.fastaccess.data.persistence.db.FastHubDatabase +import com.fastaccess.data.persistence.models.LoginModel +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.github.R +import com.fastaccess.domain.di.AuthenticationInterceptor +import com.fastaccess.github.usecase.auth.GetAccessTokenUseCase +import com.fastaccess.github.usecase.auth.LoginUseCase +import com.fastaccess.github.usecase.auth.LoginWithAccessTokenUseCase +import io.reactivex.Completable +import okhttp3.Credentials +import javax.inject.Inject + +/** + * Created by Kosh on 21.05.18. + */ +class LoginViewModel @Inject constructor( + private val loginUserCase: LoginUseCase, + private val accessTokenUseCase: GetAccessTokenUseCase, + private val loginWithAccessTokenUseCase: LoginWithAccessTokenUseCase, + private val interceptor: AuthenticationInterceptor, + private val fasthubDatabase: FastHubDatabase, + private val schedulerProvider: SchedulerProvider +) : com.fastaccess.github.base.BaseViewModel() { + + val validationLiveData = MutableLiveData() + val loggedInUser = MutableLiveData() + + fun login( + userName: String? = null, + password: String? = null, + twoFactorCode: String? = null, + endPoint: String? = null, + isAccessToken: Boolean = true + ) { + validationLiveData.value = ValidationError(ValidationError.FieldType.TWO_FACTOR, !twoFactorCode.isNullOrBlank()) + validationLiveData.value = ValidationError(ValidationError.FieldType.URL, !endPoint.isNullOrBlank()) + validationLiveData.value = ValidationError(ValidationError.FieldType.PASSWORD, !password.isNullOrBlank()) + validationLiveData.value = ValidationError(ValidationError.FieldType.USERNAME, !userName.isNullOrBlank()) + if (userName == null || password == null) return // just to disable lint + if (!userName.isNullOrEmpty() && !password.isNullOrEmpty()) { + try { + val authToken = Credentials.basic(userName, password) + interceptor.otp = twoFactorCode + interceptor.token = authToken + if (!isAccessToken) { + loginBasic(twoFactorCode) + } else { + loginWithAccessToken(password) + } + } catch (e: Exception) { + error.postValue(FastHubErrors(FastHubErrors.ErrorType.OTHER, resId = R.string.failed_login)) + e.printStackTrace() + Crashlytics.logException(e) + } + } + } + + private fun loginWithAccessToken( + password: String, + twoFactorCode: String? = null, + isEnterprise: Boolean? = false, + enterpriseUrl: String? = null + ) { + interceptor.token = password + loginWithAccessTokenUseCase.executeSafely(callApi(loginWithAccessTokenUseCase.buildObservable() + .flatMap { user -> + user.isLoggedIn = true + user.otpCode = twoFactorCode + user.token = password + user.isEnterprise = isEnterprise + user.enterpriseUrl = enterpriseUrl + return@flatMap loginWithAccessTokenUseCase.insertUser(user) + } + .doOnNext { loggedInUser.postValue(it) } + )) + } + + private fun loginBasic( + twoFactorCode: String? = null, + isEnterprise: Boolean? = false, + enterpriseUrl: String? = null + ) { + loginUserCase.setAuthBody(twoFactorCode) + loginUserCase.executeSafely(callApi(loginUserCase.buildObservable() + .flatMap({ + interceptor.token = it.token ?: it.accessToken + return@flatMap loginWithAccessTokenUseCase.buildObservable() + }, { accessToken, user -> + user.isLoggedIn = true + user.otpCode = twoFactorCode + user.token = accessToken.token ?: accessToken.accessToken + user.isEnterprise = isEnterprise + user.enterpriseUrl = enterpriseUrl + return@flatMap user + }) + .flatMap { loginWithAccessTokenUseCase.insertUser(it) }) + .doOnNext { loggedInUser.postValue(it) }) + } + + override fun onCleared() { + loginUserCase.dispose() + accessTokenUseCase.dispose() + loginWithAccessTokenUseCase.dispose() + super.onCleared() + } + + fun clearDb() = Completable.fromCallable { fasthubDatabase.clearAll() } + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/feed/fragment/FeedsFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/feed/fragment/FeedsFragment.kt new file mode 100644 index 000000000..b040191fb --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/feed/fragment/FeedsFragment.kt @@ -0,0 +1,78 @@ +package com.fastaccess.github.ui.modules.feed.fragment + +import android.os.Bundle +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.data.model.FragmentType +import com.fastaccess.fasthub.commit.dialog.CommitListCallback +import com.fastaccess.github.R +import com.fastaccess.github.base.BaseFragment +import com.fastaccess.github.base.adapter.CurrentState +import com.fastaccess.github.base.extensions.isConnected +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.extensions.route +import com.fastaccess.github.platform.extension.onClick +import com.fastaccess.github.ui.adapter.ProfileFeedsAdapter +import com.fastaccess.github.ui.modules.feed.fragment.viewmodel.FeedsViewModel +import javax.inject.Inject + +/** + * Created by Kosh on 20.10.18. + */ +class FeedsFragment : BaseFragment(), CommitListCallback { + + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(FeedsViewModel::class.java) } + private val adapter by lazy { + ProfileFeedsAdapter { + it.onClick(this) + } + } + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = viewModel + override fun layoutRes(): Int = R.layout.toolbar_fragment_list_layout + + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + setupToolbar(R.string.feeds) + recyclerView.adapter = adapter + recyclerView.setEmptyView(emptyLayout) + fastScroller.attachRecyclerView(recyclerView, appBar) + if (savedInstanceState == null) isConnected().isTrue { viewModel.loadFeeds(true) } + swipeRefresh.setOnRefreshListener { + if (isConnected()) { + recyclerView.resetScrollState() + viewModel.loadFeeds(true) + } else { + swipeRefresh.isRefreshing = false + } + } + recyclerView.addOnLoadMore { isConnected().isTrue { viewModel.loadFeeds() } } + listenToChanges() + } + + override fun onCommitClicked(url: String) { + route(url) + } + + private fun listenToChanges() { + viewModel.progress.observeNotNull(this) { + adapter.currentState = if (it) CurrentState.LOADING else CurrentState.DONE + } + + viewModel.feeds().observeNotNull(this) { + adapter.currentState = CurrentState.DONE + adapter.submitList(it) + } + + viewModel.counter.observeNotNull(this) { + postCount(FragmentType.FEEDS, it) + } + } + + companion object { + fun newInstance() = FeedsFragment() + } +} + diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/feed/fragment/viewmodel/FeedsViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/feed/fragment/viewmodel/FeedsViewModel.kt new file mode 100644 index 000000000..e1223ed29 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/feed/fragment/viewmodel/FeedsViewModel.kt @@ -0,0 +1,45 @@ +package com.fastaccess.github.ui.modules.feed.fragment.viewmodel + +import androidx.lifecycle.LiveData +import androidx.paging.LivePagedListBuilder +import androidx.paging.PagedList +import com.fastaccess.data.persistence.models.FeedModel +import com.fastaccess.data.repository.FeedsRepository +import com.fastaccess.github.usecase.feed.FeedsUseCase +import javax.inject.Inject + +/** + * Created by Kosh on 20.10.18. + */ +class FeedsViewModel @Inject constructor( + private val provider: FeedsRepository, + private val usecase: FeedsUseCase +) : com.fastaccess.github.base.BaseViewModel() { + + private var currentPage = 0 + private var isLastPage = false + + fun feeds(): LiveData> { + val dataSourceFactory = provider.getReceivedEventAsLiveData() + val config = PagedList.Config.Builder() + .setPrefetchDistance(com.fastaccess.github.base.utils.PRE_FETCH_SIZE) + .setPageSize(com.fastaccess.github.base.utils.PAGE_SIZE) + .build() + return LivePagedListBuilder(dataSourceFactory, config) + .build() + } + + fun loadFeeds(reload: Boolean = false) { + if (reload) { + currentPage = 0 + isLastPage = false + } + currentPage++ + if (!reload && isLastPage) return + usecase.page = currentPage + justSubscribe(usecase.buildObservable() + .doOnNext { isLastPage = it.last == currentPage }) + } + + fun hasNext() = isLastPage +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issue/IssueActivity.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issue/IssueActivity.kt new file mode 100644 index 000000000..736306c03 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issue/IssueActivity.kt @@ -0,0 +1,32 @@ +package com.fastaccess.github.ui.modules.issue + +import android.os.Bundle +import com.fastaccess.github.R +import com.fastaccess.github.extensions.replace +import com.fastaccess.github.base.deeplink.WebDeepLink +import com.fastaccess.github.ui.modules.issue.fragment.IssueFragment + +/** + * Created by Kosh on 28.01.19. + */ +@WebDeepLink("/{login}/{repo}/issues/{number}") +class IssueActivity : com.fastaccess.github.base.BaseActivity() { + + override fun layoutRes(): Int = R.layout.activity_main + override fun onActivityCreatedWithUser(savedInstanceState: Bundle?) { + if (savedInstanceState == null && intent != null) { + val login = intent?.extras?.getString("login") + val repo = intent?.extras?.getString("repo") + val number = intent?.extras?.getString("number")?.toIntOrNull() + if (login == null || repo == null || number == null) { + finish() + return + } + replace(R.id.container, IssueFragment.newInstance(login, repo, number), IssueFragment.TAG) + } + } + + override fun onBackPressed() { + super.onBackPressed() + } +} diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issue/fragment/IssueFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issue/fragment/IssueFragment.kt new file mode 100644 index 000000000..268291463 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issue/fragment/IssueFragment.kt @@ -0,0 +1,186 @@ +package com.fastaccess.github.ui.modules.issue.fragment + +import android.annotation.SuppressLint +import android.os.Bundle +import android.view.View +import android.widget.EditText +import androidx.core.os.bundleOf +import androidx.core.view.isVisible +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.data.model.TimelineModel +import com.fastaccess.data.model.TimelineType +import com.fastaccess.data.persistence.models.IssueModel +import com.fastaccess.data.persistence.models.LoginModel +import com.fastaccess.data.storage.FastHubSharedPreference +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.hideKeyboard +import com.fastaccess.github.base.extensions.theme +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.base.utils.EXTRA_THREE +import com.fastaccess.github.base.utils.EXTRA_TWO +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.extensions.timeAgo +import com.fastaccess.github.ui.adapter.IssueTimelineAdapter +import com.fastaccess.github.ui.modules.issue.fragment.viewmodel.IssueTimelineViewModel +import com.fastaccess.github.ui.modules.issuesprs.BaseIssuePrTimelineFragment +import com.fastaccess.markdown.widget.SpannableBuilder +import github.type.CommentAuthorAssociation +import github.type.IssueState +import github.type.LockReason +import io.noties.markwon.Markwon +import io.noties.markwon.recycler.MarkwonAdapter +import io.noties.markwon.utils.NoCopySpannableFactory +import kotlinx.android.synthetic.main.issue_header_row_item.* +import kotlinx.android.synthetic.main.issue_pr_view_layout.* +import javax.inject.Inject + +/** + * Created by Kosh on 28.01.19. + */ +class IssueFragment : BaseIssuePrTimelineFragment() { + + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + @Inject lateinit var markwon: Markwon + @Inject lateinit var preference: FastHubSharedPreference + @Inject lateinit var markwonAdapterBuilder: MarkwonAdapter.Builder + + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(IssueTimelineViewModel::class.java) } + + override val adapter by lazy { + IssueTimelineAdapter(markwon, preference.theme, onCommentClicked(), onDeleteCommentClicked(), onEditCommentClicked()) + } + + override fun layoutRes(): Int = R.layout.issue_pr_fragment_layout + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = viewModel + override fun isPr(): Boolean = false + override fun lockIssuePr(lockReason: LockReason?, isLock: Boolean) = viewModel.lockUnlockIssue(login, repo, number, lockReason, isLock) + override fun onMilestoneAdd(timeline: TimelineModel) = viewModel.addTimeline(timeline) + override fun reload(refresh: Boolean) = viewModel.loadData(login, repo, number, refresh) + override fun sendComment(comment: String) = viewModel.createComment(login, repo, number, comment) + + override fun onFragmentCreatedWithUser( + view: View, + savedInstanceState: Bundle? + ) { + super.onFragmentCreatedWithUser(view, savedInstanceState) + observeChanges() + } + + override fun onDestroyView() { + mentionsPresenter.onDispose() + super.onDestroyView() + } + + override fun editIssuerPr( + title: String?, + description: String? + ) = viewModel.editIssue(login, repo, number, title, description) + + override fun closeOpenIssuePr() = viewModel.closeOpenIssue(login, repo, number) + + private fun observeChanges() { + viewModel.getIssue(login, repo, number).observeNotNull(this) { + initIssue(it.first, it.second) + } + viewModel.timeline.observeNotNull(this) { timeline -> + adapter.submitList(timeline) + } + viewModel.userNamesLiveData.observeNotNull(this) { + mentionsPresenter.setUsers(it) + } + viewModel.commentProgress.observeNotNull(this) { + view?.findViewById(R.id.commentProgress)?.isVisible = it + view?.findViewById(R.id.sendComment)?.isVisible = !it + if (!it) { + view?.findViewById(R.id.commentText)?.let { commentText -> + commentText.setText("") + commentText.hideKeyboard() + } + recyclerView.scrollToPosition(adapter.itemCount) + } + } + viewModel.forceAdapterUpdate.observeNotNull(this) { + it.isTrue { adapter.notifyDataSetChanged() } + } + } + + @SuppressLint("DefaultLocale") + private fun initIssue( + model: IssueModel, + me: LoginModel? + ) { + view?.findViewById(R.id.commentLayout)?.isVisible = model.locked == false + issueHeaderWrapper.isVisible = true + title.text = model.title + toolbar?.title = SpannableBuilder.builder() + .append(getString(R.string.issue)) + .bold("#${model.number}") + + opener.text = SpannableBuilder.builder() + .bold(model.author?.login) + .space() + .append(getString(R.string.opened_this_issue)) + .space() + .append(model.createdAt?.timeAgo()) + + userIcon.loadAvatar(model.author?.avatarUrl, model.author?.url ?: "") + author.text = model.author?.login + association.text = if (CommentAuthorAssociation.NONE.rawValue() == model.authorAssociation) { + model.updatedAt?.timeAgo() + } else { + "${model.authorAssociation?.toLowerCase()?.replace("_", "")} ${model.updatedAt?.timeAgo()}" + } + + description.post { + val bodyMd = model.body +// description.setMovementMethod(LinkMovementMethod.getInstance()) + description.setSpannableFactory(NoCopySpannableFactory.getInstance()) + markwon.setMarkdown( + description, if (!bodyMd.isNullOrEmpty()) bodyMd else "**${getString(R.string.no_description_provided)}**" + ) + } + + state.text = model.state?.toLowerCase() + state.setChipBackgroundColorResource( + if (IssueState.OPEN.rawValue().equals(model.state, true)) { + R.color.material_green_500 + } else { + R.color.material_red_500 + } + ) + + adaptiveEmoticon.init(requireNotNull(model.id), model.reactionGroups) { + adaptiveEmoticon.initReactions(model.reactionGroups) + } + val isAuthor = login == me?.login || model.authorAssociation?.equals(CommentAuthorAssociation.OWNER.rawValue(), true) == true || + model.authorAssociation?.equals(CommentAuthorAssociation.COLLABORATOR.rawValue(), true) == true + menuClick(model.url, model.labels, model.assignees, model.title, model.body, isAuthor) + initLabels(model.labels) + initAssignees(model.assignees) + initMilestone(model.milestone) + initToolbarMenu(isAuthor, model.viewerCanUpdate == true, model.viewerDidAuthor, model.locked, state = model.state) + recyclerView.removeEmptyView() + } + + + override fun onEditComment(comment: String?, commentId: Int?, type: TimelineType) { + viewModel.editComment(login, repo, comment, commentId?.toLong()) + } + + override fun deleteComment(login: String, repo: String, commentId: Long, type: TimelineType) { + viewModel.deleteComment(login, repo, commentId) + } + + companion object { + const val TAG = "IssueFragment" + fun newInstance( + login: String, + repo: String, + number: Int + ) = IssueFragment().apply { + arguments = bundleOf(EXTRA to login, EXTRA_TWO to repo, EXTRA_THREE to number) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issue/fragment/viewmodel/IssueTimelineViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issue/fragment/viewmodel/IssueTimelineViewModel.kt new file mode 100644 index 000000000..f45a130d7 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issue/fragment/viewmodel/IssueTimelineViewModel.kt @@ -0,0 +1,224 @@ +package com.fastaccess.github.ui.modules.issue.fragment.viewmodel + +import androidx.lifecycle.MutableLiveData +import com.apollographql.apollo.api.Input +import com.fastaccess.data.model.PageInfoModel +import com.fastaccess.data.model.TimelineModel +import com.fastaccess.data.repository.IssueRepository +import com.fastaccess.data.repository.LoginRepository +import com.fastaccess.github.editor.usecase.CreateIssueCommentUseCase +import com.fastaccess.github.editor.usecase.DeleteCommentUseCase +import com.fastaccess.github.editor.usecase.EditCommentUseCase +import com.fastaccess.github.extensions.filterNull +import com.fastaccess.github.extensions.map +import com.fastaccess.github.usecase.issuesprs.* +import github.type.LockReason +import io.reactivex.Observable +import timber.log.Timber +import javax.inject.Inject + +/** + * Created by Kosh on 20.10.18. + */ +class IssueTimelineViewModel @Inject constructor( + private val issueUseCase: GetIssueUseCase, + private val timelineUseCase: GetIssueTimelineUseCase, + private val issueRepositoryProvider: IssueRepository, + private val closeOpenIssuePrUseCase: CloseOpenIssuePrUseCase, + private val lockUnlockIssuePrUseCase: LockUnlockIssuePrUseCase, + private val loginRepositoryProvider: LoginRepository, + private val createIssueCommentUseCase: CreateIssueCommentUseCase, + private val editIssuePrUseCase: EditIssuePrUseCase, + private val deleteCommentUseCase: DeleteCommentUseCase, + private val editCommentUseCase: EditCommentUseCase +) : com.fastaccess.github.base.BaseViewModel() { + + private var pageInfo: PageInfoModel? = null + private val list = arrayListOf() + val forceAdapterUpdate = MutableLiveData() + val timeline = MutableLiveData>() + val userNamesLiveData = MutableLiveData>() + val commentProgress = MutableLiveData() + + fun getIssue( + login: String, + repo: String, + number: Int + ) = issueRepositoryProvider.getIssueByNumber("$login/$repo", number) + .filterNull() + .map { Pair(it, loginRepositoryProvider.getLoginBlocking()) } + + fun loadData( + login: String, + repo: String, + number: Int, + reload: Boolean = false + ) { + if (reload) { + pageInfo = null + list.clear() + } + val pageInfo = pageInfo + if (!reload && (pageInfo != null && !pageInfo.hasNextPage)) return + val cursor = if (hasNext()) pageInfo?.endCursor else null + if (pageInfo == null) { + issueUseCase.login = login + issueUseCase.repo = repo + issueUseCase.number = number + justSubscribe(issueUseCase.buildObservable() + .flatMap { loadTimeline(login, repo, number, cursor) } + .map { mapToUserNames(it.second) }) + } else { + justSubscribe(loadTimeline(login, repo, number, cursor) + .map { mapToUserNames(it.second) }) + } + } + + private fun loadTimeline( + login: String, + repo: String, + number: Int, + cursor: String? + ): Observable>> { + timelineUseCase.login = login + timelineUseCase.repo = repo + timelineUseCase.number = number + timelineUseCase.page = Input.optional(cursor) + return timelineUseCase.buildObservable() + .doOnNext { + this.pageInfo = it.first + list.addAll(it.second) + timeline.postValue(ArrayList(list)) + } + } + + fun closeOpenIssue( + login: String, + repo: String, + number: Int + ) { + closeOpenIssuePrUseCase.repo = repo + closeOpenIssuePrUseCase.login = login + closeOpenIssuePrUseCase.number = number + justSubscribe(closeOpenIssuePrUseCase.buildObservable() + .doOnNext { + addTimeline(it) + }) + } + + fun lockUnlockIssue( + login: String, + repo: String, + number: Int, + lockReason: LockReason? = null, + isLock: Boolean + ) { + lockUnlockIssuePrUseCase.repo = repo + lockUnlockIssuePrUseCase.login = login + lockUnlockIssuePrUseCase.number = number + lockUnlockIssuePrUseCase.lockReason = lockReason + lockUnlockIssuePrUseCase.lock = isLock + justSubscribe(lockUnlockIssuePrUseCase.buildObservable() + .doOnNext { + addTimeline(it) + }) + } + + fun createComment( + login: String, + repo: String, + number: Int, + comment: String + ) { + createIssueCommentUseCase.login = login + createIssueCommentUseCase.repo = repo + createIssueCommentUseCase.number = number + createIssueCommentUseCase.body = comment + add(createIssueCommentUseCase.buildObservable() + .doOnSubscribe { commentProgress.postValue(true) } + .subscribe({ + addTimeline(it) + commentProgress.postValue(false) + }, { + commentProgress.postValue(false) + handleError(it) + }) + ) + } + + fun addTimeline(it: TimelineModel) { + list.add(it) + timeline.postValue(ArrayList(list)) + } + + fun hasNext() = pageInfo?.hasNextPage ?: false + + private fun mapToUserNames(list: List) { + val _list = userNamesLiveData.value ?: arrayListOf() + _list.addAll(list.map { it.comment?.author?.login ?: it.comment?.author?.name ?: "" }) + userNamesLiveData.postValue(_list) + } + + fun editIssue( + login: String, + repo: String, + number: Int, + title: String?, + description: String? + ) { + editIssuePrUseCase.login = login + editIssuePrUseCase.repo = repo + editIssuePrUseCase.number = number + editIssuePrUseCase.title = title + editIssuePrUseCase.description = description + justSubscribe(editIssuePrUseCase.buildObservable()) + } + + fun deleteComment( + login: String, + repo: String, + commentId: Long + ) { + deleteCommentUseCase.commentId = commentId + deleteCommentUseCase.login = login + deleteCommentUseCase.repo = repo + justSubscribe(deleteCommentUseCase.buildObservable() + .map { + val index = list.indexOfFirst { it.comment?.databaseId?.toLong() == commentId } + if (index != -1) { + list.removeAt(index) + } + return@map list + } + .doOnNext { list -> + timeline.postValue(ArrayList(list)) + }) + } + + fun editComment( + login: String, + repo: String, + comment: String?, + commentId: Long? + ) { + if (!comment.isNullOrBlank() && commentId != null) { + editCommentUseCase.comment = comment + editCommentUseCase.login = login + editCommentUseCase.repo = repo + editCommentUseCase.commentId = commentId + justSubscribe(editCommentUseCase.buildObservable() + .map { + val index = list.indexOfFirst { it.comment?.databaseId?.toLong() == commentId } + val item = list.getOrNull(index) ?: return@map list + item.comment?.body = comment + list[index] = item + Timber.e("${list[index]}") + return@map list + } + .doOnNext { list -> + timeline.postValue(ArrayList(list)) + forceAdapterUpdate.postValue(true) + }) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/BaseIssuePrTimelineFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/BaseIssuePrTimelineFragment.kt new file mode 100644 index 000000000..1d8306530 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/BaseIssuePrTimelineFragment.kt @@ -0,0 +1,441 @@ +package com.fastaccess.github.ui.modules.issuesprs + +import android.app.Activity +import android.content.Intent +import android.graphics.Color +import android.os.Bundle +import android.os.Parcelable +import android.text.Editable +import android.view.View +import android.widget.EditText +import androidx.core.os.bundleOf +import androidx.core.view.isVisible +import androidx.recyclerview.widget.RecyclerView +import androidx.recyclerview.widget.SimpleItemAnimator +import com.fastaccess.data.model.CommentModel +import com.fastaccess.data.model.ShortUserModel +import com.fastaccess.data.model.TimelineModel +import com.fastaccess.data.model.TimelineType +import com.fastaccess.data.model.parcelable.EditIssuePrBundleModel +import com.fastaccess.data.model.parcelable.LabelModel +import com.fastaccess.data.model.parcelable.LoginRepoParcelableModel +import com.fastaccess.data.model.parcelable.MilestoneModel +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.isConnected +import com.fastaccess.github.base.utils.EDITOR_DEEP_LINK +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.base.utils.EXTRA_THREE +import com.fastaccess.github.base.utils.EXTRA_TWO +import com.fastaccess.github.editor.comment.CommentActivity +import com.fastaccess.github.editor.presenter.MentionsPresenter +import com.fastaccess.github.extensions.* +import com.fastaccess.github.ui.modules.issuesprs.edit.EditIssuePrActivity +import com.fastaccess.github.ui.modules.issuesprs.edit.assignees.AssigneesFragment +import com.fastaccess.github.ui.modules.issuesprs.edit.labels.LabelsFragment +import com.fastaccess.github.ui.modules.issuesprs.edit.lockunlock.LockUnlockFragment +import com.fastaccess.github.ui.modules.issuesprs.edit.milestone.MilestoneFragment +import com.fastaccess.github.ui.modules.multipurpose.MultiPurposeBottomSheetDialog +import com.fastaccess.markdown.MarkdownProvider +import com.fastaccess.markdown.spans.LabelSpan +import com.fastaccess.markdown.widget.SpannableBuilder +import com.google.android.material.appbar.AppBarLayout +import com.otaliastudios.autocomplete.Autocomplete +import com.otaliastudios.autocomplete.AutocompleteCallback +import com.otaliastudios.autocomplete.CharPolicy +import github.type.IssueState +import github.type.LockReason +import kotlinx.android.synthetic.main.issue_header_row_item.* +import timber.log.Timber +import javax.inject.Inject + +/** + * Created by Kosh on 2019-08-17. + */ +abstract class BaseIssuePrTimelineFragment : com.fastaccess.github.base.BaseFragment(), + LockUnlockFragment.OnLockReasonSelected, + LabelsFragment.OnLabelSelected, + AssigneesFragment.OnAssigneesSelected, + MilestoneFragment.OnMilestoneChanged { + + @Inject lateinit var mentionsPresenter: MentionsPresenter + + protected val login by lazy { arguments?.getString(EXTRA) ?: "" } + protected val repo by lazy { arguments?.getString(EXTRA_TWO) ?: "" } + protected val number by lazy { arguments?.getInt(EXTRA_THREE) ?: 0 } + + abstract val adapter: RecyclerView.Adapter + abstract fun reload(refresh: Boolean = false) + abstract fun isPr(): Boolean + abstract fun sendComment(comment: String) + abstract fun lockIssuePr(lockReason: LockReason?, isLock: Boolean = true) + abstract fun onMilestoneAdd(timeline: TimelineModel) + abstract fun editIssuerPr( + title: String? = null, + description: String? = null + ) + + override fun onFragmentCreatedWithUser( + view: View, + savedInstanceState: Bundle? + ) { + setupToolbar("", R.menu.issue_menu) + if (isPr()) { + toolbar?.title = SpannableBuilder.builder() + .append(getString(R.string.pull_request)) + .bold("#$number") + } else { + toolbar?.title = SpannableBuilder.builder() + .append(getString(R.string.issue)) + .bold("#$number") + } + toolbar?.subtitle = "$login/$repo" + swipeRefresh.appBarLayout = appBar + appBar?.addOnOffsetChangedListener(AppBarLayout.OnOffsetChangedListener { _, p1 -> + val scrollTop = toolbar?.menu?.findItem(R.id.scrollTop) + val isVisible = p1 < 0 + onAppBarScrollChanged(isVisible) + if (isVisible && scrollTop?.isVisible == false) { + scrollTop.isVisible = true + } else if (!isVisible && scrollTop?.isVisible == true) { + scrollTop.isVisible = false + } + }) + (recyclerView.itemAnimator as? SimpleItemAnimator)?.supportsChangeAnimations = false + recyclerView.setEmptyView(emptyLayout) + fastScroller.attachRecyclerView(recyclerView, appBar) + recyclerView.adapter = adapter + recyclerView.addOnLoadMore { isConnected().isTrue { reload() } } + if (savedInstanceState == null) { + isConnected().isTrue { reload(true) } + } + swipeRefresh.setOnRefreshListener { + if (isConnected()) { + recyclerView.resetScrollState() + reload(true) + } else { + swipeRefresh.isRefreshing = false + } + } + setupEditText() + } + + override fun onResume() { + activity?.hideKeyboard() + super.onResume() + } + + override fun onDestroyView() { + mentionsPresenter.onDispose() + super.onDestroyView() + } + + override fun onActivityResult( + requestCode: Int, + resultCode: Int, + data: Intent? + ) { + super.onActivityResult(requestCode, resultCode, data) + if (resultCode == Activity.RESULT_OK) { + when (requestCode) { + COMMENT_REQUEST_CODE -> { + view?.findViewById(R.id.commentText)?.let { commentText -> + commentText.setText(data?.getStringExtra(EXTRA)) + view?.findViewById(R.id.sendComment)?.callOnClick() + } + } + EDIT_ISSUE_REQUEST_CODE -> { + val model = data?.getParcelableExtra(EXTRA) ?: return + editIssuerPr(model.title, model.description) + } + EDIT_COMMENT_REQUEST_CODE, EDIT_REVIEW_COMMENT_REQUEST_CODE, + EDIT_REVIEW_BODY_REQUEST_CODE, EDIT_COMMIT_COMMENT_REQUEST_CODE -> { + val comment = data?.getStringExtra(EXTRA) + val commentId = data?.getIntExtra(EXTRA_TWO, 0) + onEditComment( + comment, commentId, when (requestCode) { + EDIT_COMMENT_REQUEST_CODE -> TimelineType.ISSUE + EDIT_REVIEW_COMMENT_REQUEST_CODE -> TimelineType.REVIEW + EDIT_REVIEW_BODY_REQUEST_CODE -> TimelineType.REVIEW_BODY + EDIT_COMMIT_COMMENT_REQUEST_CODE -> TimelineType.COMMIT + else -> TimelineType.ISSUE + } + ) + } + else -> Timber.e("nothing yet for requestCode($requestCode)") + } + } + } + + override fun onLockReasonSelected(lockReason: LockReason?) { + lockIssuePr(lockReason) + } + + override fun onLabelsSelected(labelList: List?) { + labelsLayout.isVisible = !labelList.isNullOrEmpty() + val builder = SpannableBuilder.builder() + labelList?.forEach { + builder.append(it.name ?: "", LabelSpan(Color.parseColor("#${it.color}"))) + .append(" ") + } + labels.text = builder + } + + override fun onAssigneesSelected(assigneesList: List?) { + assigneesLayout.isVisible = !assigneesList.isNullOrEmpty() + val builder = SpannableBuilder.builder() + assigneesList?.forEachIndexed { index, item -> + builder.clickable("@${item.login ?: item.name ?: ""}", View.OnClickListener { + route(item.url) + }).append(if (index == assigneesList.size.minus(1)) "" else ", ") + } + assignees.text = builder + } + + override fun onMilestoneAdded( + timeline: TimelineModel, + model: MilestoneModel + ) { + onMilestoneAdd(timeline) + model.let { + milestoneLayout.isVisible = true + milestone.text = when { + it.title != null -> "${it.title}" + it.description != null -> "${it.description}" + else -> "" + } + } + } + + protected fun menuClick( + url: String?, + labels: List?, + assignees: List?, + title: String?, + body: String?, + isOwner: Boolean + ) { + toolbar?.setOnMenuItemClickListener { item -> + when (item.itemId) { + R.id.scrollTop -> { + appBar?.setExpanded(true, true) + recyclerView.scrollToPosition(0) + } + R.id.refresh -> { + reload(true) + appBar?.setExpanded(true, true) + recyclerView.scrollToPosition(0) + } + R.id.closeIssue -> closeOpenIssuePr() + R.id.share -> requireActivity().shareUrl(url) + R.id.lockIssue -> if (item.title == getString(R.string.lock_issue)) { + MultiPurposeBottomSheetDialog.show(childFragmentManager, MultiPurposeBottomSheetDialog.BottomSheetFragmentType.LOCK_UNLOCK) + } else { + lockIssuePr(null, false) + } + R.id.labels -> MultiPurposeBottomSheetDialog.show( + childFragmentManager, + MultiPurposeBottomSheetDialog.BottomSheetFragmentType.LABELS, LoginRepoParcelableModel(login, repo, labels, number) + ) + R.id.assignees -> MultiPurposeBottomSheetDialog.show( + childFragmentManager, + MultiPurposeBottomSheetDialog.BottomSheetFragmentType.ASSIGNEES, LoginRepoParcelableModel(login, repo, assignees, number) + ) + R.id.milestone -> MultiPurposeBottomSheetDialog.show( + childFragmentManager, + MultiPurposeBottomSheetDialog.BottomSheetFragmentType.MILESTONE, LoginRepoParcelableModel( + login, repo, null as? List, number, isPr() + ) + ) + R.id.edit -> startEditingIssue(title, body, isOwner) + R.id.merge -> onMergePullRequest() + } + return@setOnMenuItemClickListener true + } + } + + protected fun initAssignees(assigneesList: List?) { + assigneesLayout.isVisible = !assigneesList.isNullOrEmpty() + val builder = SpannableBuilder.builder() + assigneesList?.forEachIndexed { index, item -> + builder.clickable("@${item.login ?: item.name ?: ""}", View.OnClickListener { + route(item.url) + }).append(if (index == assigneesList.size.minus(1)) "" else ", ") + } + assignees.text = builder + } + + protected fun initMilestone(model: MilestoneModel?) { + model?.let { + milestoneLayout.isVisible = true + milestone.text = when { + it.title != null -> "${it.title}" + it.description != null -> "${it.description}" + else -> "" + } + } ?: run { milestoneLayout.isVisible = false } + } + + protected fun initLabels(labelList: List?) { + labelsLayout.isVisible = !labelList.isNullOrEmpty() + val builder = SpannableBuilder.builder() + labelList?.forEach { + builder.append(it.name ?: "", LabelSpan(Color.parseColor("#${it.color}"))) + .append(" ") + } + labels.text = builder + } + + protected fun initToolbarMenu( + isOwner: Boolean, + canUpdate: Boolean, + viewerDidAuthor: Boolean? = null, + isLocked: Boolean? = null, + isMerged: Boolean? = null, + state: String? = null + ) { + toolbar?.menu?.let { + it.findItem(R.id.edit).isVisible = viewerDidAuthor == true || canUpdate + it.findItem(R.id.assignees).isVisible = isOwner + it.findItem(R.id.milestone).isVisible = isOwner + it.findItem(R.id.labels).isVisible = isOwner + it.findItem(R.id.closeIssue).isVisible = isOwner + it.findItem(R.id.lockIssue).isVisible = isOwner + it.findItem(R.id.closeIssue).title = if (!IssueState.OPEN.rawValue().equals(state, true)) { + getString(R.string.re_open) + } else { + getString(R.string.close) + } + it.findItem(R.id.merge).isVisible = isOwner && isMerged == false + it.findItem(R.id.lockIssue).title = if (isLocked == true) getString(R.string.unlock_issue) else getString(R.string.lock_issue) + } + } + + protected open fun onCommentClicked(): (position: Int, comment: CommentModel) -> Unit = { position, comment -> + CommentActivity.startActivity( + this, COMMENT_REQUEST_CODE, comment.body ?: "", + comment.author?.login ?: comment.author?.name, comment.author?.avatarUrl + ) + } + + protected open fun onEditCommentClicked(): (position: Int, timeline: TimelineModel) -> Unit = { _, timeline -> + val databaseId = when { + timeline.comment != null -> timeline.comment?.databaseId + timeline.commitThread != null -> timeline.commitThread?.comment?.databaseId + timeline.review != null -> if (timeline.review?.isReviewBody == true) { + timeline.review?.databaseId + } else { + timeline.review?.comment?.databaseId + } + else -> 0 + } + val body = when { + timeline.comment != null -> timeline.comment?.body + timeline.commitThread != null -> timeline.commitThread?.comment?.body + timeline.review != null -> if (timeline.review?.isReviewBody == true) { + timeline.review?.body + } else { + timeline.review?.comment?.body + } + else -> null + } + val requestCode = when { + timeline.comment != null -> EDIT_COMMENT_REQUEST_CODE + timeline.commitThread != null -> EDIT_COMMIT_COMMENT_REQUEST_CODE + timeline.review != null -> if (timeline.review?.isReviewBody == true) { + EDIT_REVIEW_BODY_REQUEST_CODE + } else { + EDIT_REVIEW_COMMENT_REQUEST_CODE + } + else -> 0 + } + if (databaseId != 0) { + routeForResult( + EDITOR_DEEP_LINK, requestCode, bundleOf( + EXTRA to body, + EXTRA_TWO to databaseId + ) + ) + } + } + + protected open fun onDeleteCommentClicked(): (position: Int, timeline: TimelineModel) -> Unit = { position, timeline -> + val databaseId = when { + timeline.comment != null -> timeline.comment?.databaseId + timeline.commitThread != null -> timeline.commitThread?.comment?.databaseId + timeline.review != null -> if (timeline.review?.isReviewBody == true) { + timeline.review?.databaseId + } else { + timeline.review?.comment?.databaseId + } + else -> 0 + } + val type = when { + timeline.comment != null -> TimelineType.ISSUE + timeline.commitThread != null -> TimelineType.COMMIT + timeline.review != null -> if (timeline.review?.isReviewBody == true) { + TimelineType.REVIEW_BODY + } else { + TimelineType.REVIEW + } + else -> TimelineType.ISSUE + } + if (databaseId != null && databaseId != 0) { + deleteComment( + login, repo, databaseId.toLong(), type + ) + } + } + + protected open fun deleteComment(login: String, repo: String, commentId: Long, type: TimelineType) = Unit + protected open fun onEditComment(comment: String?, commentId: Int?, type: TimelineType = TimelineType.ISSUE) = Unit + protected open fun closeOpenIssuePr() = Unit + protected open fun onMergePullRequest() = Unit + protected open fun onAppBarScrollChanged(show:Boolean) = Unit + + private fun setupEditText() { + val commentText = view?.findViewById(R.id.commentText) ?: return + Autocomplete.on(commentText) + .with(CharPolicy('@')) + .with(mentionsPresenter) + .with(requireContext().getDrawableCompat(R.drawable.popup_window_background)) + .with(object : AutocompleteCallback { + override fun onPopupItemClicked( + editable: Editable?, + item: String? + ): Boolean = MarkdownProvider.replaceMention(editable, item) + + override fun onPopupVisibilityChanged(shown: Boolean) {} + }) + .build() + view?.findViewById(R.id.sendComment)?.setOnClickListener { + val comment = commentText.text?.toString() + if (!comment.isNullOrEmpty()) { + sendComment(comment) + } + } + view?.findViewById(R.id.toggleFullScreen)?.setOnClickListener { + routeForResult(EDITOR_DEEP_LINK, COMMENT_REQUEST_CODE, bundleOf(EXTRA to commentText.text?.toString())) + } + } + + private fun startEditingIssue( + title: String?, + body: String?, + isOwner: Boolean + ) { + EditIssuePrActivity.startForResult( + this, EditIssuePrBundleModel( + login, repo, number, title, body, false, isOwner = isOwner + ), EDIT_ISSUE_REQUEST_CODE + ) + } + + companion object { + const val COMMENT_REQUEST_CODE = 1001 + const val EDIT_ISSUE_REQUEST_CODE = 1002 + const val EDIT_COMMENT_REQUEST_CODE = 1003 + const val EDIT_REVIEW_COMMENT_REQUEST_CODE = 1004 + const val EDIT_REVIEW_BODY_REQUEST_CODE = 1005 + const val EDIT_COMMIT_COMMENT_REQUEST_CODE = 1006 + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/EditIssuePrActivity.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/EditIssuePrActivity.kt new file mode 100644 index 000000000..4591fed6c --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/EditIssuePrActivity.kt @@ -0,0 +1,49 @@ +package com.fastaccess.github.ui.modules.issuesprs.edit + +import android.content.Context +import android.content.Intent +import android.os.Bundle +import androidx.fragment.app.Fragment +import com.fastaccess.data.model.parcelable.EditIssuePrBundleModel +import com.fastaccess.github.R +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.replace + +/** + * Created by Kosh on 2019-07-27. + */ +class EditIssuePrActivity : com.fastaccess.github.base.BaseActivity() { + + override fun layoutRes(): Int = R.layout.fragment_activity_layout + + override fun onActivityCreatedWithUser(savedInstanceState: Bundle?) { + (savedInstanceState == null).isTrue { + val bundle = intent.extras ?: return@isTrue run { + finish() + } + replace(R.id.container, EditIssuePrFragment.newInstance(bundle)) + } + } + + companion object { + fun startForResult( + fragment: Fragment, + model: EditIssuePrBundleModel, + requestCode: Int + ) { + fragment.startActivityForResult(Intent(fragment.requireContext(), EditIssuePrActivity::class.java).apply { + putExtra(EXTRA, model) + }, requestCode) + } + + fun start( + context: Context, + model: EditIssuePrBundleModel + ) { + context.startActivity(Intent(context, EditIssuePrActivity::class.java).apply { + putExtra(EXTRA, model) + }) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/EditIssuePrFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/EditIssuePrFragment.kt new file mode 100644 index 000000000..1d41e65af --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/EditIssuePrFragment.kt @@ -0,0 +1,138 @@ +package com.fastaccess.github.ui.modules.issuesprs.edit + +import android.app.Activity +import android.content.Intent +import android.os.Bundle +import android.view.MotionEvent +import android.view.View +import androidx.core.os.bundleOf +import androidx.core.view.isVisible +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.data.model.parcelable.EditIssuePrBundleModel +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.asString +import com.fastaccess.github.base.extensions.beginDelayedTransition +import com.fastaccess.github.base.utils.EDITOR_DEEP_LINK +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.extensions.route +import com.fastaccess.github.extensions.routeForResult +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import io.noties.markwon.Markwon +import kotlinx.android.synthetic.main.edit_issue_pr_fragment_layout.* +import timber.log.Timber +import javax.inject.Inject + +/** + * Created by Kosh on 2019-07-27. + */ +class EditIssuePrFragment : com.fastaccess.github.base.BaseFragment() { + + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + @Inject lateinit var markwon: Markwon + + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(EditIssuePrViewModel::class.java) } + private val model by lazy { + arguments?.getParcelable(EXTRA) as? EditIssuePrBundleModel ?: throw NullPointerException("EditIssuePrBundleModel is null") + } + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = null + override fun layoutRes(): Int = R.layout.edit_issue_pr_fragment_layout + + override fun onFragmentCreatedWithUser( + view: View, + savedInstanceState: Bundle? + ) { + + observeChanges() + + toolbar?.title = if (model.isCreate) getString(R.string.create_issue) else getString(R.string.edit) + toolbar?.subtitle = "${model.login}/${model.repo}/${getString(R.string.issue)}${if (model.isCreate) "" else "#${model.number}"}" + setToolbarNavigationIcon(R.drawable.ic_clear) + toolbar?.inflateMenu(R.menu.submit_menu) + toolbar?.setNavigationOnClickListener { activity?.onBackPressed() } + toolbar?.setOnMenuItemClickListener { + if (viewModel.progress.value == true) return@setOnMenuItemClickListener true + val title = titleEditText.asString() + val description = model.description + if (title.isEmpty() || model.login.isEmpty() || model.repo.isEmpty()) { + titleInput.error = getString(R.string.required_field) + } else { + titleInput.error = null + if (model.isCreate) { + viewModel.createIssue(model.login, model.repo, title, description) + } else { + model.title = title + val intent = Intent().apply { + putExtra(EXTRA, model) + } + requireActivity().let { + it.setResult(Activity.RESULT_OK, intent) + it.finish() + } + } + } + return@setOnMenuItemClickListener true + } + + if (savedInstanceState == null) { + titleEditText.setText(model.title) + val description = model.description + if (!description.isNullOrEmpty()) { + descriptionEditText.post { markwon.setMarkdown(descriptionEditText, description) } + } else { + viewModel.loadTemplate(model.login, model.repo) + } + } + descriptionEditText.setOnTouchListener { _, event -> + if (event.action == MotionEvent.ACTION_UP) { + routeForResult(EDITOR_DEEP_LINK, COMMENT_REQUEST_CODE, bundleOf(EXTRA to model.description)) + return@setOnTouchListener true + } + return@setOnTouchListener false + } + } + + override fun onActivityResult( + requestCode: Int, + resultCode: Int, + data: Intent? + ) { + super.onActivityResult(requestCode, resultCode, data) + if (resultCode == Activity.RESULT_OK) { + when (requestCode) { + COMMENT_REQUEST_CODE -> { + model.description = data?.getStringExtra(EXTRA) + descriptionEditText.post { markwon.setMarkdown(descriptionEditText, model.description ?: "") } + } + else -> Timber.e("nothing yet for requestCode($requestCode)") + } + } + } + + private fun observeChanges() { + viewModel.progress.observeNotNull(this) { + container.beginDelayedTransition() + progressBar.isVisible = it + toolbar?.menu?.findItem(R.id.submit)?.isVisible = !it + } + viewModel.templateLiveData.observeNotNull(this) { + if (model.description.isNullOrEmpty()) { + model.description = it + descriptionEditText.post { markwon.setMarkdown(descriptionEditText, it) } + } + } + viewModel.issueUrlLiveData.observeNotNull(this) { + route(it) + activity?.finish() + } + } + + + companion object { + private const val COMMENT_REQUEST_CODE = 1001 + fun newInstance(bundle: Bundle) = EditIssuePrFragment().apply { + arguments = bundle + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/EditIssuePrViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/EditIssuePrViewModel.kt new file mode 100644 index 000000000..5d162f07d --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/EditIssuePrViewModel.kt @@ -0,0 +1,49 @@ +package com.fastaccess.github.ui.modules.issuesprs.edit + +import androidx.lifecycle.MutableLiveData +import com.fastaccess.github.base.BaseViewModel +import com.fastaccess.github.usecase.files.GetFileContentUseCase +import com.fastaccess.github.usecase.issuesprs.CreateIssueUseCase +import javax.inject.Inject + +/** + * Created by Kosh on 2019-07-30. + */ +class EditIssuePrViewModel @Inject constructor( + private val getFileContentUseCase: GetFileContentUseCase, + private val createIssueUseCase: CreateIssueUseCase +) : com.fastaccess.github.base.BaseViewModel() { + + val templateLiveData = MutableLiveData() + val issueUrlLiveData = MutableLiveData() + + fun loadTemplate( + login: String, + repo: String + ) { + getFileContentUseCase.login = login + getFileContentUseCase.repo = repo + getFileContentUseCase.path = "master:.github/ISSUE_TEMPLATE.md" + justSubscribe(getFileContentUseCase.buildObservable() + .map { + it.text?.replace(Regex("(?s)"), "")?.replace("<>", "") ?: "" // replace all comments! keep the text small! + } + .doOnNext { templateLiveData.postValue(it) }) + } + + fun createIssue( + login: String, + repo: String, + title: String, + description: String? + ) { + createIssueUseCase.login = login + createIssueUseCase.repo = repo + createIssueUseCase.title = title + createIssueUseCase.description = description + justSubscribe( + createIssueUseCase.buildObservable() + .doOnNext { issueUrlLiveData.postValue(it) } + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/assignees/AssigneesFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/assignees/AssigneesFragment.kt new file mode 100644 index 000000000..dd180739f --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/assignees/AssigneesFragment.kt @@ -0,0 +1,117 @@ +package com.fastaccess.github.ui.modules.issuesprs.edit.assignees + +import android.content.Context +import android.os.Bundle +import android.view.MenuItem +import android.view.View +import androidx.core.os.bundleOf +import androidx.lifecycle.ViewModelProvider +import com.evernote.android.state.State +import com.fastaccess.data.model.ShortUserModel +import com.fastaccess.data.model.parcelable.LoginRepoParcelableModel +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.isConnected +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.github.ui.adapter.AssigneesAdapter +import com.fastaccess.github.ui.modules.issuesprs.edit.assignees.viewmodel.AssigneesViewModel + +import javax.inject.Inject + +/** + * Created by Kosh on 2018-11-26. + */ +class AssigneesFragment : com.fastaccess.github.base.BaseFragment() { + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + @State var selection = hashSetOf() + @State var deselection = hashSetOf() + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(AssigneesViewModel::class.java) } + private val model by lazy { arguments?.getParcelable(EXTRA) as? LoginRepoParcelableModel } + private val adapter by lazy { + AssigneesAdapter(selection, deselection).apply { + model?.items?.forEach { this.selection.add(it) } + } + } + + private var callback: OnAssigneesSelected? = null + + override fun onAttach(context: Context) { + super.onAttach(context) + callback = when { + context is OnAssigneesSelected -> context + parentFragment is OnAssigneesSelected -> parentFragment as OnAssigneesSelected + parentFragment?.parentFragment is OnAssigneesSelected -> parentFragment?.parentFragment as OnAssigneesSelected // deep hierarchy + else -> null + } + } + + override fun onDetach() { + super.onDetach() + callback = null + } + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = viewModel + override fun layoutRes(): Int = R.layout.rounded_toolbar_fragment_list_layout + + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + val login = model?.login + val repo = model?.repo + val number = model?.number + + if (login == null || repo == null || number == null) { + dismiss() + return + } + setupToolbar(R.string.assignees, R.menu.edit_submit_menu) { item: MenuItem -> + when (item.itemId) { + R.id.submit -> { + if (adapter.selection.toList() != model?.items) { + viewModel.addAssignees(login, repo, number, + adapter.selection.toList().map { it.login ?: "" }, + adapter.deselection.toList().map { it.login ?: "" }) + } + } + } + } + toolbar?.menu?.findItem(R.id.add)?.isVisible = false + recyclerView.adapter = adapter + recyclerView.setEmptyView(emptyLayout) + fastScroller.attachRecyclerView(recyclerView) + if (savedInstanceState == null) isConnected().isTrue { viewModel.load(login, repo, true) } + swipeRefresh.setOnRefreshListener { + if (isConnected()) { + recyclerView.resetScrollState() + viewModel.load(login, repo, true) + } else { + swipeRefresh.isRefreshing = false + } + } + recyclerView.addOnLoadMore { isConnected().isTrue { viewModel.load(login, repo) } } + listenToChanges() + } + + private fun listenToChanges() { + viewModel.data.observeNotNull(this) { + adapter.submitList(it) + } + viewModel.additionLiveData.observeNotNull(this) { + if (it == true) { + callback?.onAssigneesSelected(adapter.selection.toList()) + dismiss() + } + } + } + + + companion object { + fun newInstance(model: LoginRepoParcelableModel?) = AssigneesFragment().apply { + arguments = bundleOf(EXTRA to model) + } + } + + interface OnAssigneesSelected { + fun onAssigneesSelected(assignees: List?) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/assignees/viewmodel/AssigneesViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/assignees/viewmodel/AssigneesViewModel.kt new file mode 100644 index 000000000..8413845fd --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/assignees/viewmodel/AssigneesViewModel.kt @@ -0,0 +1,60 @@ +package com.fastaccess.github.ui.modules.issuesprs.edit.assignees.viewmodel + +import androidx.lifecycle.MutableLiveData +import com.apollographql.apollo.api.Input +import com.fastaccess.data.model.PageInfoModel +import com.fastaccess.data.model.ShortUserModel +import com.fastaccess.github.base.BaseViewModel +import com.fastaccess.github.usecase.issuesprs.AddAssigneesUseCase +import com.fastaccess.github.usecase.issuesprs.GetAssigneesUseCase +import javax.inject.Inject + +/** + * Created by Kosh on 2018-11-26. + */ +class AssigneesViewModel @Inject constructor( + private val usecase: GetAssigneesUseCase, + private val addAssigneesUseCase: AddAssigneesUseCase +) : com.fastaccess.github.base.BaseViewModel() { + + private var pageInfo: PageInfoModel? = null + private val list = ArrayList() + val data = MutableLiveData>() + val additionLiveData = MutableLiveData() + + fun load(login: String, repo: String, reload: Boolean = false) { + if (reload) { + pageInfo = null + list.clear() + } + + val pageInfo = pageInfo + if (!reload && (pageInfo != null && !pageInfo.hasNextPage)) return + val cursor = if (hasNext()) pageInfo?.endCursor else null + + usecase.login = login + usecase.repo = repo + usecase.page = Input.optional(cursor) + justSubscribe(callApi(usecase.buildObservable()) + .doOnNext { + this.pageInfo = it.first + list.addAll(it.second) + data.postValue(ArrayList(list)) + }) + } + + fun hasNext() = pageInfo?.hasNextPage == true + + fun addAssignees(login: String, repo: String, number: Int, assignees: List?, + toRemove: List?) { + addAssigneesUseCase.login = login + addAssigneesUseCase.repo = repo + addAssigneesUseCase.number = number + addAssigneesUseCase.assignees = assignees + addAssigneesUseCase.toRemove = toRemove // remove all assignees and re-add them just in case. + justSubscribe(addAssigneesUseCase.buildObservable() + .doOnNext { + additionLiveData.postValue(it) + }) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/labels/LabelsFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/labels/LabelsFragment.kt new file mode 100644 index 000000000..6ceaeb116 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/labels/LabelsFragment.kt @@ -0,0 +1,130 @@ +package com.fastaccess.github.ui.modules.issuesprs.edit.labels + +import android.content.Context +import android.os.Bundle +import android.view.MenuItem +import android.view.View +import androidx.core.os.bundleOf +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.evernote.android.state.State +import com.fastaccess.data.model.parcelable.LabelModel +import com.fastaccess.data.model.parcelable.LoginRepoParcelableModel +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.isConnected +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.extensions.show +import com.fastaccess.github.ui.adapter.LabelsAdapter +import com.fastaccess.github.ui.modules.issuesprs.edit.labels.create.CreateLabelFragment +import com.fastaccess.github.ui.modules.issuesprs.edit.labels.viewmodel.LabelsViewModel + +import javax.inject.Inject + +/** + * Created by Kosh on 2018-11-26. + */ +class LabelsFragment : com.fastaccess.github.base.BaseFragment(), CreateLabelFragment.OnCreateLabelCallback { + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + @State var selection = hashSetOf() + @State var deselection = hashSetOf() + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(LabelsViewModel::class.java) } + private val model by lazy { arguments?.getParcelable(EXTRA) as? LoginRepoParcelableModel } + private val adapter by lazy { + LabelsAdapter(selection, deselection).apply { + model?.items?.forEach { this.selection.add(it) } + } + } + + private var callback: OnLabelSelected? = null + + override fun onAttach(context: Context) { + super.onAttach(context) + callback = when { + context is OnLabelSelected -> context + parentFragment is OnLabelSelected -> parentFragment as OnLabelSelected + parentFragment?.parentFragment is OnLabelSelected -> parentFragment?.parentFragment as OnLabelSelected // deep hierarchy + else -> null + } + } + + override fun onDetach() { + super.onDetach() + callback = null + } + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = viewModel + override fun layoutRes(): Int = R.layout.rounded_toolbar_fragment_list_layout + + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + val login = model?.login + val repo = model?.repo + val number = model?.number + + if (login == null || repo == null || number == null) { + dismiss() + return + } + setupToolbar(R.string.labels, R.menu.edit_submit_menu) { item: MenuItem -> + when (item.itemId) { + R.id.submit -> { + if (adapter.selection.toList() != model?.items) { + viewModel.putLabels(login, repo, number, adapter.selection, adapter.deselection) + } else { + dismiss() + } + } + R.id.add -> { + CreateLabelFragment.newInstance().show(childFragmentManager) + } + } + } + recyclerView.adapter = adapter + recyclerView.setEmptyView(emptyLayout) + fastScroller.attachRecyclerView(recyclerView) + if (savedInstanceState == null) isConnected().isTrue { viewModel.load(login, repo, true) } + swipeRefresh.setOnRefreshListener { + if (isConnected()) { + recyclerView.resetScrollState() + viewModel.load(login, repo, true) + } else { + swipeRefresh.isRefreshing = false + } + } + recyclerView.addOnLoadMore { isConnected().isTrue { viewModel.load(login, repo) } } + listenToChanges() + } + + override fun onCreateLabel(name: String, color: String) { + val login = model?.login + val repo = model?.repo + + if (login == null || repo == null) { + dismiss() + return + } + viewModel.addLabel(login, repo, name, color) + } + + private fun listenToChanges() { + viewModel.data.observeNotNull(this) { + adapter.submitList(it) + } + viewModel.putLabelsLiveData.observeNotNull(this) { + callback?.onLabelsSelected(adapter.selection.toList()) + dismiss() + } + } + + + companion object { + fun newInstance(model: LoginRepoParcelableModel?) = LabelsFragment().apply { + arguments = bundleOf(EXTRA to model) + } + } + + interface OnLabelSelected { + fun onLabelsSelected(labels: List?) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/labels/create/CreateLabelFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/labels/create/CreateLabelFragment.kt new file mode 100644 index 000000000..08a72047a --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/labels/create/CreateLabelFragment.kt @@ -0,0 +1,61 @@ +package com.fastaccess.github.ui.modules.issuesprs.edit.labels.create + +import android.content.Context +import android.os.Bundle +import android.view.View +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.asString +import com.fastaccess.github.ui.adapter.LabelColorAdapter +import kotlinx.android.synthetic.main.add_label_layout.* + +/** + * Created by Kosh on 07.03.19. + */ +class CreateLabelFragment : com.fastaccess.github.base.BaseDialogFragment() { + + private var callback: OnCreateLabelCallback? = null + + private val adapter by lazy { + LabelColorAdapter(resources.getStringArray(R.array.label_colors).toList()) { + color.editText?.setText(it) + } + } + + override fun onAttach(context: Context) { + super.onAttach(context) + callback = when { + parentFragment is OnCreateLabelCallback -> parentFragment as OnCreateLabelCallback + context is OnCreateLabelCallback -> context + else -> throw IllegalAccessError("$context must impl OnCreateLabelCallback") + } + } + + override fun onDetach() { + callback = null + super.onDetach() + } + + override fun layoutRes(): Int = R.layout.add_label_layout + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + recycler.adapter = adapter + setupToolbar(getString(R.string.create_label), R.menu.submit_menu) { + val colorText = color.editText?.asString() + val nameText = name.editText?.asString() + color.error = if (colorText.isNullOrEmpty()) getString(R.string.required_field) else null + name.error = if (nameText.isNullOrEmpty()) getString(R.string.required_field) else null + if (!colorText.isNullOrEmpty() && !nameText.isNullOrEmpty()) { + callback?.onCreateLabel(nameText, colorText.replace("#", "")) + dismissDialog() + } + } + } + + companion object { + fun newInstance() = CreateLabelFragment() + } + + interface OnCreateLabelCallback { + fun onCreateLabel(name: String, color: String) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/labels/viewmodel/LabelsViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/labels/viewmodel/LabelsViewModel.kt new file mode 100644 index 000000000..6492667f8 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/labels/viewmodel/LabelsViewModel.kt @@ -0,0 +1,75 @@ +package com.fastaccess.github.ui.modules.issuesprs.edit.labels.viewmodel + +import androidx.lifecycle.MutableLiveData +import com.apollographql.apollo.api.Input +import com.fastaccess.data.model.PageInfoModel +import com.fastaccess.data.model.parcelable.LabelModel +import com.fastaccess.github.base.BaseViewModel +import com.fastaccess.github.usecase.issuesprs.CreateLabelUseCase +import com.fastaccess.github.usecase.issuesprs.GetLabelsUseCase +import com.fastaccess.github.usecase.issuesprs.PutLabelsUseCase +import javax.inject.Inject + +/** + * Created by Kosh on 2018-11-26. + */ +class LabelsViewModel @Inject constructor( + private val usecase: GetLabelsUseCase, + private val createLabelUseCase: CreateLabelUseCase, + private val putLabelsUseCase: PutLabelsUseCase +) : com.fastaccess.github.base.BaseViewModel() { + + private var pageInfo: PageInfoModel? = null + private val list = ArrayList() + val data = MutableLiveData>() + val putLabelsLiveData = MutableLiveData() + + fun load(login: String, repo: String, reload: Boolean = false) { + if (reload) { + pageInfo = null + list.clear() + } + + val pageInfo = pageInfo + if (!reload && (pageInfo != null && !pageInfo.hasNextPage)) return + val cursor = if (hasNext()) pageInfo?.endCursor else null + + usecase.login = login + usecase.repo = repo + usecase.page = Input.optional(cursor) + justSubscribe(callApi(usecase.buildObservable()) + .doOnNext { + this.pageInfo = it.first + list.addAll(it.second) + data.postValue(ArrayList(list)) + }) + } + + fun hasNext() = pageInfo?.hasNextPage == true + + fun addLabel(login: String, repo: String, name: String, color: String) { + createLabelUseCase.login = login + createLabelUseCase.repo = repo + createLabelUseCase.name = name + createLabelUseCase.color = color + justSubscribe(createLabelUseCase.buildObservable() + .doOnNext { + list.add(0, it) + data.postValue(ArrayList(list)) + }) + } + + fun putLabels(login: String, repo: String, number: Int, + selection: HashSet, + deselection: HashSet) { + putLabelsUseCase.login = login + putLabelsUseCase.repo = repo + putLabelsUseCase.number = number + putLabelsUseCase.toAdd = selection.toList().map { it.name ?: "" } + putLabelsUseCase.toRemove = deselection.toList().map { it.name ?: "" } + justSubscribe(putLabelsUseCase.buildObservable() + .doOnNext { + putLabelsLiveData.postValue(true) + }) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/lockunlock/LockUnlockFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/lockunlock/LockUnlockFragment.kt new file mode 100644 index 000000000..e3352350e --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/lockunlock/LockUnlockFragment.kt @@ -0,0 +1,56 @@ +package com.fastaccess.github.ui.modules.issuesprs.edit.lockunlock + +import android.content.Context +import android.os.Bundle +import android.view.View +import com.fastaccess.github.R +import github.type.LockReason +import kotlinx.android.synthetic.main.lock_unlock_issue_pr_layout.* + +/** + * Created by Kosh on 23.02.19. + */ +class LockUnlockFragment : com.fastaccess.github.base.BaseFragment() { + + private var callback: OnLockReasonSelected? = null + + override fun onAttach(context: Context) { + super.onAttach(context) + callback = when { + context is OnLockReasonSelected -> context + parentFragment is OnLockReasonSelected -> parentFragment as OnLockReasonSelected + parentFragment?.parentFragment is OnLockReasonSelected -> parentFragment?.parentFragment as OnLockReasonSelected // deep hierarchy + else -> null + } + } + + override fun onDetach() { + super.onDetach() + callback = null + } + + override fun layoutRes(): Int = R.layout.lock_unlock_issue_pr_layout + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = null + + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + toolbarTitle?.text = getString(R.string.lock_issue) + submit.setOnClickListener { + callback?.onLockReasonSelected(when (reason.checkedChipId) { + R.id.spam -> LockReason.SPAM + R.id.tooHeated -> LockReason.TOO_HEATED + R.id.offTopic -> LockReason.OFF_TOPIC + R.id.resolved -> LockReason.RESOLVED + else -> null + }) + dismiss() + } + } + + interface OnLockReasonSelected { + fun onLockReasonSelected(lockReason: LockReason?) + } + + companion object { + fun newInstance() = LockUnlockFragment() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/milestone/CreateMilestoneDialogFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/milestone/CreateMilestoneDialogFragment.kt new file mode 100644 index 000000000..e7c5d5559 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/milestone/CreateMilestoneDialogFragment.kt @@ -0,0 +1,70 @@ +package com.fastaccess.github.ui.modules.issuesprs.edit.milestone + +import android.content.Context +import android.os.Bundle +import android.view.MotionEvent +import android.view.View +import com.fastaccess.datetimepicker.DatePickerFragmentDialog +import com.fastaccess.datetimepicker.callback.DatePickerCallback +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.asString +import com.fastaccess.github.extensions.DatePrettifier +import com.fastaccess.github.extensions.show +import kotlinx.android.synthetic.main.add_milestone_layout.* +import java.util.* + +/** + * Created by Kosh on 30.03.19. + */ +class CreateMilestoneDialogFragment : com.fastaccess.github.base.BaseDialogFragment(), DatePickerCallback { + private var callback: OnAddNewMilestone? = null + + override fun layoutRes(): Int = R.layout.add_milestone_layout + + override fun onAttach(context: Context) { + super.onAttach(context) + callback = when { + parentFragment is OnAddNewMilestone -> parentFragment as OnAddNewMilestone + context is OnAddNewMilestone -> context + else -> throw IllegalAccessException("woops, your $context or $parentFragment must impl OnAddNewMilestone") + } + } + + override fun onDetach() { + callback = null + super.onDetach() + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + setupToolbar(getString(R.string.create_milestone), R.menu.submit_menu) { + if (it.itemId == R.id.submit) { + val timestamp = dueOn.tag as? Long + val title = milestoneTitle.editText?.asString() + val description = milestoneDescription.editText?.asString() + milestoneTitle.error = if (title.isNullOrEmpty()) getString(R.string.required_field) else null + dueOn.error = if (timestamp == null) getString(R.string.required_field) else null + if (timestamp != null && !title.isNullOrEmpty()) { + callback?.addNewMilestone(title, Date(timestamp), description) + dismissDialog() + } + } + } + dueOn.editText?.setOnTouchListener { _, event -> + if (event.action == MotionEvent.ACTION_UP) { + DatePickerFragmentDialog.newInstance().show(childFragmentManager) + return@setOnTouchListener true + } + return@setOnTouchListener false + } + } + + override fun onDateSet(date: Long) { + dueOn.tag = date + dueOn.editText?.setText(DatePrettifier.prettifyDate(date)) + } + + interface OnAddNewMilestone { + fun addNewMilestone(title: String, dueOn: Date, description: String?) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/milestone/MilestoneFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/milestone/MilestoneFragment.kt new file mode 100644 index 000000000..ad8906f16 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/milestone/MilestoneFragment.kt @@ -0,0 +1,127 @@ +package com.fastaccess.github.ui.modules.issuesprs.edit.milestone + +import android.content.Context +import android.os.Bundle +import android.view.MenuItem +import android.view.View +import androidx.core.os.bundleOf +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.data.model.TimelineModel +import com.fastaccess.data.model.parcelable.LabelModel +import com.fastaccess.data.model.parcelable.LoginRepoParcelableModel +import com.fastaccess.data.model.parcelable.MilestoneModel +import com.fastaccess.github.R +import com.fastaccess.github.base.BaseFragment +import com.fastaccess.github.base.extensions.addDivider +import com.fastaccess.github.base.extensions.isConnected +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.extensions.show +import com.fastaccess.github.ui.adapter.MilestonesAdapter +import com.fastaccess.github.ui.modules.issuesprs.edit.milestone.viewmodel.MilestoneViewModel +import java.util.* +import javax.inject.Inject + +/** + * Created by Kosh on 2018-11-26. + */ +class MilestoneFragment : BaseFragment(), CreateMilestoneDialogFragment.OnAddNewMilestone { + + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(MilestoneViewModel::class.java) } + private val model by lazy { arguments?.getParcelable(EXTRA) as? LoginRepoParcelableModel } + private val adapter by lazy { + MilestonesAdapter { + val login = model?.login + val repo = model?.repo + val number = model?.number + if (login == null || repo == null || number == null) { + dismiss() + return@MilestonesAdapter + } + viewModel.onSubmit(login, repo, number, it, model?.isPr == true) + } + } + + private var callback: OnMilestoneChanged? = null + + override fun onAttach(context: Context) { + super.onAttach(context) + callback = when { + context is OnMilestoneChanged -> context + parentFragment is OnMilestoneChanged -> parentFragment as OnMilestoneChanged + parentFragment?.parentFragment is OnMilestoneChanged -> parentFragment?.parentFragment as OnMilestoneChanged // deep hierarchy + else -> null + } + } + + override fun onDetach() { + super.onDetach() + callback = null + } + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = viewModel + override fun layoutRes(): Int = R.layout.rounded_toolbar_fragment_list_layout + + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + val login = model?.login + val repo = model?.repo + val number = model?.number + + if (login == null || repo == null || number == null) { + dismiss() + return + } + setupToolbar(R.string.milestones, R.menu.edit_submit_menu) { item: MenuItem -> + when (item.itemId) { + R.id.add -> { + CreateMilestoneDialogFragment().show(childFragmentManager) + } + } + } + toolbar?.menu?.findItem(R.id.submit)?.isVisible = false + recyclerView.addDivider() + recyclerView.adapter = adapter + recyclerView.setEmptyView(emptyLayout) + fastScroller.attachRecyclerView(recyclerView) + if (savedInstanceState == null) isConnected().isTrue { viewModel.load(login, repo, true) } + swipeRefresh.setOnRefreshListener { + if (isConnected()) { + recyclerView.resetScrollState() + viewModel.load(login, repo, true) + } else { + swipeRefresh.isRefreshing = false + } + } + recyclerView.addOnLoadMore { isConnected().isTrue { viewModel.load(login, repo) } } + listenToChanges() + } + + override fun addNewMilestone(title: String, dueOn: Date, description: String?) { + viewModel.addMilestone(title, dueOn, description, model?.login, model?.repo) + } + + private fun listenToChanges() { + viewModel.data.observeNotNull(this) { + adapter.submitList(it) + } + viewModel.response.observeNotNull(this) { + callback?.onMilestoneAdded(it.first, it.second) + dismiss() + } + } + + companion object { + fun newInstance( + model: LoginRepoParcelableModel? + ) = MilestoneFragment().apply { + arguments = bundleOf(EXTRA to model) + } + } + + interface OnMilestoneChanged { + fun onMilestoneAdded(timeline: TimelineModel, milestone: MilestoneModel) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/milestone/viewmodel/MilestoneViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/milestone/viewmodel/MilestoneViewModel.kt new file mode 100644 index 000000000..3f881846a --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/edit/milestone/viewmodel/MilestoneViewModel.kt @@ -0,0 +1,89 @@ +package com.fastaccess.github.ui.modules.issuesprs.edit.milestone.viewmodel + +import androidx.lifecycle.MutableLiveData +import com.apollographql.apollo.api.Input +import com.fastaccess.data.model.PageInfoModel +import com.fastaccess.data.model.TimelineModel +import com.fastaccess.data.model.parcelable.MilestoneModel +import com.fastaccess.github.extensions.DatePrettifier +import com.fastaccess.github.usecase.issuesprs.CreateMilestoneUseCase +import com.fastaccess.github.usecase.issuesprs.GetMilestonesUseCase +import com.fastaccess.github.usecase.issuesprs.MilestoneIssuePrUseCase +import java.util.* +import javax.inject.Inject + +/** + * Created by Kosh on 2018-11-26. + */ +class MilestoneViewModel @Inject constructor( + private val usecase: GetMilestonesUseCase, + private val createMilestoneUseCase: CreateMilestoneUseCase, + private val milestoneIssuePrUseCase: MilestoneIssuePrUseCase +) : com.fastaccess.github.base.BaseViewModel() { + + private var pageInfo: PageInfoModel? = null + private val list = ArrayList() + val data = MutableLiveData>() + val response = MutableLiveData>() + + fun load(login: String, repo: String, reload: Boolean = false) { + if (reload) { + pageInfo = null + list.clear() + } + + val pageInfo = pageInfo + if (!reload && (pageInfo != null && !pageInfo.hasNextPage)) return + val cursor = if (hasNext()) pageInfo?.endCursor else null + + usecase.login = login + usecase.repo = repo + usecase.page = Input.optional(cursor) + justSubscribe(callApi(usecase.buildObservable()) + .doOnNext { + this.pageInfo = it.first + list.addAll(it.second) + data.postValue(ArrayList(list)) + }) + } + + fun hasNext() = pageInfo?.hasNextPage == true + + fun onSubmit( + login: String, + repo: String, + number: Int, + milestone: MilestoneModel, + isPr: Boolean + ) { + milestoneIssuePrUseCase.login = login + milestoneIssuePrUseCase.repo = repo + milestoneIssuePrUseCase.number = number + milestoneIssuePrUseCase.milestone = milestone.number ?: -1 + milestoneIssuePrUseCase.isPr = isPr + justSubscribe(milestoneIssuePrUseCase.buildObservable() + .doOnNext { + response.postValue(it) + }) + } + + fun addMilestone( + title: String, + dueOn: Date, + description: String?, + login: String?, + repo: String? + ) { + createMilestoneUseCase.login = login ?: "" + createMilestoneUseCase.repo = repo ?: "" + createMilestoneUseCase.title = title + createMilestoneUseCase.description = description + createMilestoneUseCase.dueOn = DatePrettifier.toGithubDate(dueOn) + justSubscribe(createMilestoneUseCase.buildObservable() + .doOnNext { + list.add(0, MilestoneModel(title = title, description = description, dueOn = dueOn)) + data.postValue(ArrayList(list)) + }) + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/filter/FilterIssuesPrsBottomSheet.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/filter/FilterIssuesPrsBottomSheet.kt new file mode 100644 index 000000000..de9039aa8 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/filter/FilterIssuesPrsBottomSheet.kt @@ -0,0 +1,123 @@ +package com.fastaccess.github.ui.modules.issuesprs.filter + +import android.content.Context +import android.os.Bundle +import android.view.View +import androidx.core.os.bundleOf +import androidx.core.view.isVisible +import com.fastaccess.data.model.parcelable.FilterIssuesPrsModel +import com.fastaccess.github.R +import com.fastaccess.github.base.utils.EXTRA +import kotlinx.android.synthetic.main.filter_issue_pr_layout.* + +/** + * Created by Kosh on 19.01.19. + */ +class FilterIssuesPrsBottomSheet : com.fastaccess.github.base.BaseFragment() { + + private val model by lazy { (arguments?.getParcelable(EXTRA) as? FilterIssuesPrsModel) ?: FilterIssuesPrsModel() } + private var callback: FilterIssuesPrsCallback? = null + + override fun onAttach(context: Context) { + super.onAttach(context) + callback = when { + context is FilterIssuesPrsCallback -> context + parentFragment is FilterIssuesPrsCallback -> parentFragment as FilterIssuesPrsCallback + parentFragment?.parentFragment is FilterIssuesPrsCallback -> parentFragment?.parentFragment as FilterIssuesPrsCallback // deep hierarchy + else -> null + } + } + + override fun onDetach() { + callback = null + super.onDetach() + } + + override fun layoutRes(): Int = R.layout.filter_issue_pr_layout + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = null + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + setupToolbar(R.string.filter) + reviewRequest.isVisible = model.isPr + + if (savedInstanceState == null) { + initState() + } + + assignCheckListener() + + submit.setOnClickListener { + callback?.onFilterApplied(model) + (parentFragment as? com.fastaccess.github.base.BaseBottomSheetDialogFragment)?.dismiss() + } + } + + private fun initState() { + filter.check(when (model.searchBy) { + FilterIssuesPrsModel.SearchBy.CREATED -> R.id.created + FilterIssuesPrsModel.SearchBy.ASSIGNED -> R.id.assigned + FilterIssuesPrsModel.SearchBy.MENTIONED -> R.id.mentioned + FilterIssuesPrsModel.SearchBy.REVIEW_REQUESTS -> R.id.reviewRequest + }) + type.check(when (model.searchType) { + FilterIssuesPrsModel.SearchType.OPEN -> R.id.open + FilterIssuesPrsModel.SearchType.CLOSED -> R.id.closed + }) + visibility.check(when (model.searchVisibility) { + FilterIssuesPrsModel.SearchVisibility.BOTH -> R.id.bothVisibility + FilterIssuesPrsModel.SearchVisibility.PUBLIC -> R.id.publicRepos + FilterIssuesPrsModel.SearchVisibility.PRIVATE -> R.id.privateRepos + }) + sort.check(when (model.searchSortBy) { + FilterIssuesPrsModel.SearchSortBy.NEWEST -> R.id.newest + FilterIssuesPrsModel.SearchSortBy.OLDEST -> R.id.oldest + FilterIssuesPrsModel.SearchSortBy.MOST_COMMENTED -> R.id.mostCommented + FilterIssuesPrsModel.SearchSortBy.LEAST_COMMENTED -> R.id.leastCommented + FilterIssuesPrsModel.SearchSortBy.RECENTLY_UPDATED -> R.id.recentlyUpdated + FilterIssuesPrsModel.SearchSortBy.LEAST_RECENTLY_UPDATED -> R.id.leastRecentlyUpdated + }) + } + + private fun assignCheckListener() { + filter.setOnCheckedChangeListener { _, id -> + when (id) { + R.id.created -> model.searchBy = FilterIssuesPrsModel.SearchBy.CREATED + R.id.assigned -> model.searchBy = FilterIssuesPrsModel.SearchBy.ASSIGNED + R.id.mentioned -> model.searchBy = FilterIssuesPrsModel.SearchBy.MENTIONED + R.id.reviewRequest -> model.searchBy = FilterIssuesPrsModel.SearchBy.REVIEW_REQUESTS + } + } + type.setOnCheckedChangeListener { _, id -> + when (id) { + R.id.open -> model.searchType = FilterIssuesPrsModel.SearchType.OPEN + R.id.closed -> model.searchType = FilterIssuesPrsModel.SearchType.CLOSED + } + } + visibility.setOnCheckedChangeListener { _, id -> + when (id) { + R.id.bothVisibility -> model.searchVisibility = FilterIssuesPrsModel.SearchVisibility.BOTH + R.id.privateRepos -> model.searchVisibility = FilterIssuesPrsModel.SearchVisibility.PRIVATE + R.id.publicRepos -> model.searchVisibility = FilterIssuesPrsModel.SearchVisibility.PUBLIC + } + } + sort.setOnCheckedChangeListener { _, id -> + when (id) { + R.id.newest -> model.searchSortBy = FilterIssuesPrsModel.SearchSortBy.NEWEST + R.id.oldest -> model.searchSortBy = FilterIssuesPrsModel.SearchSortBy.OLDEST + R.id.mostCommented -> model.searchSortBy = FilterIssuesPrsModel.SearchSortBy.MOST_COMMENTED + R.id.leastCommented -> model.searchSortBy = FilterIssuesPrsModel.SearchSortBy.LEAST_COMMENTED + R.id.recentlyUpdated -> model.searchSortBy = FilterIssuesPrsModel.SearchSortBy.RECENTLY_UPDATED + R.id.leastRecentlyUpdated -> model.searchSortBy = FilterIssuesPrsModel.SearchSortBy.LEAST_RECENTLY_UPDATED + } + } + } + + companion object { + fun newInstance(model: FilterIssuesPrsModel) = FilterIssuesPrsBottomSheet().apply { + arguments = bundleOf(EXTRA to model) + } + } + + interface FilterIssuesPrsCallback { + fun onFilterApplied(model: FilterIssuesPrsModel) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/fragment/FilterIssuePullRequestsFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/fragment/FilterIssuePullRequestsFragment.kt new file mode 100644 index 000000000..ddf4b7a1d --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/fragment/FilterIssuePullRequestsFragment.kt @@ -0,0 +1,95 @@ +package com.fastaccess.github.ui.modules.issuesprs.fragment + +import android.os.Bundle +import android.view.View +import androidx.core.os.bundleOf +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.data.model.ActivityType +import com.fastaccess.data.model.FragmentType +import com.fastaccess.data.model.parcelable.FilterIssuesPrsModel +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.isConnected +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.extensions.route +import com.fastaccess.github.ui.adapter.MyIssuesPrsAdapter +import com.fastaccess.github.ui.modules.issuesprs.filter.FilterIssuesPrsBottomSheet +import com.fastaccess.github.ui.modules.issuesprs.fragment.viewmodel.FilterIssuePullRequestsViewModel +import com.fastaccess.github.ui.modules.multipurpose.MultiPurposeBottomSheetDialog +import kotlinx.android.synthetic.main.issues_prs_fragment_layout.* +import javax.inject.Inject + +/** + * Created by Kosh on 20.10.18. + */ +class FilterIssuePullRequestsFragment : com.fastaccess.github.base.BaseFragment(), FilterIssuesPrsBottomSheet.FilterIssuesPrsCallback { + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(FilterIssuePullRequestsViewModel::class.java) } + private val adapter by lazy { + MyIssuesPrsAdapter { + route("${it.url}") + } + } + private val fragmentType by lazy { arguments?.getSerializable(EXTRA) as? FragmentType } + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = viewModel + override fun layoutRes(): Int = R.layout.issues_prs_fragment_layout + + override fun onFragmentCreatedWithUser( + view: View, + savedInstanceState: Bundle? + ) { + setupToolbar( + when (fragmentType) { + FragmentType.FILTER_PRS -> R.string.pull_requests + else -> R.string.issues + } + ) + + viewModel.isPr = fragmentType == FragmentType.FILTER_PRS + recyclerView.adapter = adapter + recyclerView.setEmptyView(emptyLayout) + fastScroller.attachRecyclerView(recyclerView, appBar) + if (savedInstanceState == null) isConnected().isTrue { viewModel.loadData(true) } + swipeRefresh.setOnRefreshListener { + if (isConnected()) { + recyclerView.resetScrollState() + viewModel.loadData(true) + } else { + swipeRefresh.isRefreshing = false + } + } + recyclerView.addOnLoadMore { isConnected().isTrue { viewModel.loadData() } } + filter.setOnClickListener { + val item = viewModel.filterModel.copy() // mutability! + MultiPurposeBottomSheetDialog.show( + childFragmentManager, + MultiPurposeBottomSheetDialog.BottomSheetFragmentType.FILTER_ISSUES, item + ) + } + listenToChanges() + } + + override fun onFilterApplied(model: FilterIssuesPrsModel) { + viewModel.filter(model) + } + + private fun listenToChanges() { + viewModel.data.observeNotNull(this) { + adapter.submitList(it) + } + } + + companion object { + fun newInstance(activityType: ActivityType) = FilterIssuePullRequestsFragment().apply { + arguments = bundleOf( + EXTRA to when (activityType) { + ActivityType.FILTER_PR -> FragmentType.FILTER_PRS + else -> FragmentType.FILTER_ISSUES + } + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/fragment/viewmodel/FilterIssuePullRequestsViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/fragment/viewmodel/FilterIssuePullRequestsViewModel.kt new file mode 100644 index 000000000..c30c275fc --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/issuesprs/fragment/viewmodel/FilterIssuePullRequestsViewModel.kt @@ -0,0 +1,75 @@ +package com.fastaccess.github.ui.modules.issuesprs.fragment.viewmodel + +import androidx.lifecycle.MutableLiveData +import com.apollographql.apollo.api.Input +import com.fastaccess.data.model.PageInfoModel +import com.fastaccess.data.model.parcelable.FilterIssuesPrsModel +import com.fastaccess.data.persistence.models.MyIssuesPullsModel +import com.fastaccess.github.base.BaseViewModel +import com.fastaccess.github.usecase.issuesprs.FilterIssuesUseCase +import com.fastaccess.github.usecase.issuesprs.FilterPullRequestsUseCase +import javax.inject.Inject + +/** + * Created by Kosh on 20.10.18. + */ +class FilterIssuePullRequestsViewModel @Inject constructor( + private val filterIssuesUseCase: FilterIssuesUseCase, + private val filterPullRequestsUseCase: FilterPullRequestsUseCase +) : com.fastaccess.github.base.BaseViewModel() { + + private var pageInfo: PageInfoModel? = null + var filterModel = FilterIssuesPrsModel() + var isPr = true + set(value) { + field = value + filterModel.isPr = field + } + val list = arrayListOf() + val data = MutableLiveData>() + + override fun onCleared() { + super.onCleared() + filterIssuesUseCase.dispose() + filterPullRequestsUseCase.dispose() + } + + fun loadData(reload: Boolean = false) { + if (reload) { + this.list.clear() + pageInfo = null + } + val pageInfo = pageInfo + if (!reload && (pageInfo != null && !pageInfo.hasNextPage)) return + val cursor = if (hasNext()) pageInfo?.endCursor else null + if (isPr) { + filterPullRequestsUseCase.cursor = Input.optional(cursor) + filterPullRequestsUseCase.filterModel = filterModel + justSubscribe(filterPullRequestsUseCase.buildObservable() + .doOnNext { + onRequestFinished(it) + }) + } else { + filterIssuesUseCase.cursor = Input.optional(cursor) + filterIssuesUseCase.filterModel = filterModel + justSubscribe(filterIssuesUseCase.buildObservable() + .doOnNext { + onRequestFinished(it) + }) + } + } + + private fun onRequestFinished(pair: Pair>) { + this.pageInfo = pair.first + this.list.addAll(pair.second) + this.data.postValue(ArrayList(list)) // create new copy of list as submitList will never be notified + } + + fun filter(model: FilterIssuesPrsModel) { + if (model == filterModel) return + this.filterModel = model + loadData(true) + } + + fun hasNext() = pageInfo?.hasNextPage ?: false +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/main/MainActivity.kt b/app/src/main/java/com/fastaccess/github/ui/modules/main/MainActivity.kt new file mode 100644 index 000000000..cf05527dc --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/main/MainActivity.kt @@ -0,0 +1,24 @@ +package com.fastaccess.github.ui.modules.main + +import android.os.Bundle +import com.fastaccess.github.R +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.replace +import com.fastaccess.github.ui.modules.main.fragment.MainFragment + +class MainActivity : com.fastaccess.github.base.BaseActivity() { + + override fun layoutRes(): Int = R.layout.activity_main + + override fun onActivityCreatedWithUser(savedInstanceState: Bundle?) { + if (savedInstanceState == null) { + replace(R.id.container, MainFragment.newInstance(), MainFragment.TAG) + } + } + + override fun onBackPressed() { + (supportFragmentManager.findFragmentByTag(MainFragment.TAG) as? MainFragment)?.onBackPressed()?.isTrue { + super.onBackPressed() + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/main/fragment/MainFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/main/fragment/MainFragment.kt new file mode 100644 index 000000000..a939abd2e --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/main/fragment/MainFragment.kt @@ -0,0 +1,154 @@ +package com.fastaccess.github.ui.modules.main.fragment + +import android.os.Bundle +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.data.model.MainScreenModel +import com.fastaccess.data.model.parcelable.EditIssuePrBundleModel +import com.fastaccess.data.persistence.models.LoginModel +import com.fastaccess.data.storage.FastHubSharedPreference +import com.fastaccess.fasthub.commit.dialog.CommitListCallback +import com.fastaccess.github.R +import com.fastaccess.github.base.BaseFragment +import com.fastaccess.github.base.BaseViewModel +import com.fastaccess.github.base.dialog.IconDialogFragment +import com.fastaccess.github.base.extensions.isConnected +import com.fastaccess.github.base.extensions.otpCode +import com.fastaccess.github.base.extensions.token +import com.fastaccess.github.base.utils.LOGIN_DEEP_LINK +import com.fastaccess.github.base.utils.NOTIFICATION_LINK +import com.fastaccess.github.base.utils.SEARCH_LINK +import com.fastaccess.github.base.utils.TRENDING_LINK +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.github.extensions.* +import com.fastaccess.github.platform.extension.onClick +import com.fastaccess.github.ui.adapter.MainScreenAdapter +import com.fastaccess.github.ui.modules.issuesprs.edit.EditIssuePrActivity +import com.fastaccess.github.ui.modules.main.fragment.viewmodel.MainFragmentViewModel +import com.fastaccess.github.ui.modules.multipurpose.MultiPurposeBottomSheetDialog +import kotlinx.android.synthetic.main.bottm_bar_menu_layout.* +import kotlinx.android.synthetic.main.main_fragment_front_layout.* +import kotlinx.android.synthetic.main.main_fragment_layout.* +import javax.inject.Inject + +/** + * Created by Kosh on 12.06.18. + */ +class MainFragment : BaseFragment(), IconDialogFragment.IconDialogClickListener, CommitListCallback { + + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + @Inject lateinit var preference: FastHubSharedPreference + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(MainFragmentViewModel::class.java) } + private val adapter by lazy { MainScreenAdapter(onClickListener()) } + + override fun layoutRes(): Int = R.layout.main_fragment_layout + override fun viewModel(): BaseViewModel? = viewModel + + override fun onFragmentCreatedWithUser( + view: View, + savedInstanceState: Bundle? + ) { + if (savedInstanceState == null) { + isConnected().isTrue { viewModel.load() } + } + setupToolbar(R.string.app_name) + toolbar?.navigationIcon = null + swipeRefresh.setOnRefreshListener { + if (isConnected()) { + viewModel.load() + } else { + swipeRefresh.isRefreshing = false + } + } + recyclerView.adapter = adapter + toolbar?.inflateMenu(R.menu.main_bottom_bar_menu) + listenToDataChanges() + initClicks() + } + + override fun onBackPressed(): Boolean { + return true + } + + override fun onClick(positive: Boolean) { + positive.isTrue { viewModel.logout() } + } + + override fun onCommitClicked(url: String) { + route(url) + } + + private fun initClicks() { +// toolbar?.setNavigationOnClickListener { addDisposal(viewModel.login.subscribe({ route(it?.htmlUrl) }, ::print)) } + toolbar?.setOnMenuItemClickListener { item -> + when (item.itemId) { + R.id.notifications -> route(NOTIFICATION_LINK) + R.id.search -> route(SEARCH_LINK) + } + return@setOnMenuItemClickListener true + } + + navigationView.setNavigationItemSelectedListener { + backdropContainer.close() + when (it.itemId) { + R.id.logout -> IconDialogFragment.show( + childFragmentManager, R.drawable.ic_info_outline, getString(R.string.logout), + getString(R.string.confirm_message), getString(R.string.logout), getString(R.string.cancel) + ) + R.id.add_account -> activity?.routeClearTop(LOGIN_DEEP_LINK, null, false) + R.id.reportBug -> EditIssuePrActivity.start(requireContext(), EditIssuePrBundleModel("k0shk0sh", "FastHub", 0, isCreate = true)) + } + return@setNavigationItemSelectedListener true + } + starred.setOnClickListener { onUserRetrieved { route(it?.toStarred()) } } + repos.setOnClickListener { onUserRetrieved { route(it?.toRepos()) } } + gists.setOnClickListener { onUserRetrieved { route(it?.toGists()) } } + orgs.setOnClickListener { + MultiPurposeBottomSheetDialog.show( + childFragmentManager, + MultiPurposeBottomSheetDialog.BottomSheetFragmentType.ORGANIZATIONS + ) + } + trending.setOnClickListener { route(TRENDING_LINK) } + } + + private fun onUserRetrieved(action: (user: LoginModel?) -> Unit) { + addDisposal( + viewModel.login.subscribe({ action(it) }, ::print) + ) + } + + private fun listenToDataChanges() { + viewModel.progress.observeNotNull(this) { + swipeRefresh.isRefreshing = it == true + } + viewModel.list.observeNotNull(this) { + adapter.submitList(it) + } + viewModel.logoutProcess.observeNotNull(this) { + if (it) { + preference.token = null + preference.otpCode = null + activity?.routeClearTop(LOGIN_DEEP_LINK) + } + } + viewModel.unreadNotificationLiveData.observeNotNull(this) { + toolbar?.menu?.findItem(R.id.notifications)?.icon = if (it > 0) { + getDrawable(R.drawable.ic_notification_unread) + } else { + getDrawable(R.drawable.ic_notifications_none) + } + } + } + + private fun onClickListener(): (MainScreenModel) -> Unit { + return { model: MainScreenModel -> + model.onClick(this) + } + } + + companion object { + const val TAG = "MainFragment" + fun newInstance(): MainFragment = MainFragment() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/main/fragment/viewmodel/MainFragmentViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/main/fragment/viewmodel/MainFragmentViewModel.kt new file mode 100644 index 000000000..bade995b8 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/main/fragment/viewmodel/MainFragmentViewModel.kt @@ -0,0 +1,135 @@ +package com.fastaccess.github.ui.modules.main.fragment.viewmodel + +import androidx.lifecycle.LiveData +import com.fastaccess.data.model.FastHubErrors +import com.fastaccess.data.model.MainScreenModel +import com.fastaccess.data.model.MainScreenModelRowType +import com.fastaccess.data.persistence.db.FastHubDatabase +import com.fastaccess.data.persistence.models.FeedModel +import com.fastaccess.data.repository.* +import com.fastaccess.github.base.BaseViewModel +import com.fastaccess.github.extensions.map +import com.fastaccess.github.extensions.switchMap +import com.fastaccess.github.usecase.main.FeedsMainScreenUseCase +import com.fastaccess.github.usecase.main.IssuesMainScreenUseCase +import com.fastaccess.github.usecase.main.PullRequestsMainScreenUseCase +import com.fastaccess.github.usecase.notification.NotificationUseCase +import io.reactivex.Observable +import javax.inject.Inject + +@Suppress("HasPlatformType") +/** + * Created by Kosh on 16.06.18. + */ +class MainFragmentViewModel @Inject constructor( + private val issuesMainScreenUseCase: IssuesMainScreenUseCase, + private val pullRequestsMainScreenUseCase: PullRequestsMainScreenUseCase, + private val notificationUseCase: NotificationUseCase, + private val feedsMainScreenUseCase: FeedsMainScreenUseCase, + private val feedsRepositoryProvider: FeedsRepository, + private val myIssuesPullsRepo: MyIssuesPullsRepository, + private val notificationRepositoryProvider: NotificationRepository, + private val fasthubDatabase: FastHubDatabase, + private val loginProvider: LoginRepository, + private val schedulerProvider: SchedulerProvider +) : com.fastaccess.github.base.BaseViewModel() { + + val login = loginProvider.getLogin() + + val list: LiveData> by lazy { + feedsRepositoryProvider.getMainFeedsAsLiveData() + .map(mapFeed()) + .switchMap(mapNotifications()) + .switchMap(mapIssues()) + .switchMap(mapPulls()) + } + + val unreadNotificationLiveData = notificationRepositoryProvider.countUnread() + + fun load() { + feedsMainScreenUseCase.executeSafely(callApi( + feedsMainScreenUseCase.buildObservable() + .flatMap { notificationUseCase.buildObservable() } + .flatMap { issuesMainScreenUseCase.buildObservable() } + .flatMap { pullRequestsMainScreenUseCase.buildObservable() } + ).subscribeOn(schedulerProvider.ioThread()).observeOn(schedulerProvider.uiThread())) + } + + fun logout() { + add(Observable.fromCallable { + fasthubDatabase.clearAll() + loginProvider.logoutAll() + } + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .subscribe({ logoutProcess.postValue(true) }, + { error.postValue(FastHubErrors(FastHubErrors.ErrorType.OTHER, it.message)) }) + ) + } + + override fun onCleared() { + super.onCleared() + notificationUseCase.dispose() + issuesMainScreenUseCase.dispose() + pullRequestsMainScreenUseCase.dispose() + feedsMainScreenUseCase.dispose() + } + + /** + * Fixes Cannot infer a type for this parameter. Please specify it explicitly. 🤷‍🤷‍🤷‍🤷‍🤷‍🤷‍ + */ + private fun mapPulls(): (ArrayList) -> LiveData> { + return { list -> + myIssuesPullsRepo.getMainScreenPulls().map { prs -> + if (prs.isEmpty()) return@map list + list.add(MainScreenModel(MainScreenModelRowType.PRS_TITLE)) + list.addAll(prs.asSequence().map { MainScreenModel(MainScreenModelRowType.PRS, issuesPullsModel = it) }.toList()) + return@map list + } + } + } + + /** + * Fixes Cannot infer a type for this parameter. Please specify it explicitly. 🤷‍🤷‍🤷‍🤷‍🤷‍🤷‍ + */ + private fun mapIssues(): (ArrayList) -> LiveData> { + return { list -> + myIssuesPullsRepo.getMainScreenIssues().map { issues -> + if (issues.isEmpty()) return@map list + list.add(MainScreenModel(MainScreenModelRowType.ISSUES_TITLE)) + list.addAll(issues.asSequence().map { MainScreenModel(MainScreenModelRowType.ISSUES, issuesPullsModel = it) }.toList()) + return@map list + } + } + } + + /** + * Fixes Cannot infer a type for this parameter. Please specify it explicitly. 🤷‍🤷‍🤷‍🤷‍🤷‍🤷‍ + */ + private fun mapNotifications(): (ArrayList) -> LiveData> { + return { list -> + notificationRepositoryProvider.getMainNotifications().map { notifications -> + if (notifications.isEmpty()) return@map list + list.add(MainScreenModel(MainScreenModelRowType.NOTIFICATION_TITLE, + hasBubble = notifications.firstOrNull { it.unread == true } != null)) + list.addAll(notifications.asSequence().map { MainScreenModel(MainScreenModelRowType.NOTIFICATION, notificationModel = it) }.toList()) + return@map list + } + } + } + + /** + * Fixes Cannot infer a type for this parameter. Please specify it explicitly. 🤷‍🤷‍🤷‍🤷‍🤷‍🤷‍ + */ + private fun mapFeed(): (List) -> ArrayList { + return { feeds -> + val list = arrayListOf() + if (feeds.isNotEmpty()) { + list.add(MainScreenModel(MainScreenModelRowType.FEED_TITLE)) + list.addAll(feeds.asSequence().map { MainScreenModel(MainScreenModelRowType.FEED, feed = it) }.toList()) + } + list + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/multipurpose/MultiPurposeActivity.kt b/app/src/main/java/com/fastaccess/github/ui/modules/multipurpose/MultiPurposeActivity.kt new file mode 100644 index 000000000..d155be0cc --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/multipurpose/MultiPurposeActivity.kt @@ -0,0 +1,51 @@ +package com.fastaccess.github.ui.modules.multipurpose + +import android.os.Bundle +import com.evernote.android.state.State +import com.fastaccess.data.model.ActivityType +import com.fastaccess.github.R +import com.fastaccess.github.base.deeplink.AppDeepLink +import com.fastaccess.github.ui.modules.feed.fragment.FeedsFragment +import com.fastaccess.github.ui.modules.issuesprs.fragment.FilterIssuePullRequestsFragment +import com.fastaccess.github.ui.modules.notifications.NotificationPagerFragment +import com.fastaccess.github.ui.modules.search.fragment.SearchFragment +import com.fastaccess.github.extensions.fromDeepLink +import com.fastaccess.github.extensions.replace + +/** + * Created by Kosh on 20.10.18. + */ +@AppDeepLink("/me/{what}") +class MultiPurposeActivity : com.fastaccess.github.base.BaseActivity() { + + @State var activityType: ActivityType? = null + + override fun layoutRes(): Int = R.layout.fragment_activity_layout + + override fun onActivityCreatedWithUser(savedInstanceState: Bundle?) { + if (savedInstanceState == null) { + if (!fromDeepLink()) { + finish() + return + } + activityType = ActivityType.getTypeSafely(intent?.getStringExtra("what")) + activityType?.let { activityType -> + when (activityType) { + ActivityType.FEEDS -> replace(R.id.container, FeedsFragment.newInstance()) + ActivityType.NOTIFICATION -> replace(R.id.container, NotificationPagerFragment.newInstance()) + ActivityType.FILTER_ISSUE, ActivityType.FILTER_PR -> replace(R.id.container, + FilterIssuePullRequestsFragment.newInstance(activityType)) + ActivityType.SEARCH -> replace(R.id.container, SearchFragment.newInstance()) + } + } ?: run { + finish() + return@run + } + } + val activityType = activityType + if (activityType == null) { + finish() + return + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/multipurpose/MultiPurposeBottomSheetDialog.kt b/app/src/main/java/com/fastaccess/github/ui/modules/multipurpose/MultiPurposeBottomSheetDialog.kt new file mode 100644 index 000000000..f83ca9ee0 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/multipurpose/MultiPurposeBottomSheetDialog.kt @@ -0,0 +1,78 @@ +package com.fastaccess.github.ui.modules.multipurpose + +import android.os.Bundle +import android.os.Parcelable +import android.view.View +import androidx.core.os.bundleOf +import androidx.fragment.app.FragmentManager +import androidx.fragment.app.commit +import com.fastaccess.data.model.parcelable.FilterIssuesPrsModel +import com.fastaccess.data.model.parcelable.FilterSearchModel +import com.fastaccess.data.model.parcelable.FilterTrendingModel +import com.fastaccess.github.R +import com.fastaccess.github.extensions.show +import com.fastaccess.github.ui.modules.issuesprs.edit.lockunlock.LockUnlockFragment +import com.fastaccess.github.ui.modules.issuesprs.edit.assignees.AssigneesFragment +import com.fastaccess.github.ui.modules.issuesprs.edit.labels.LabelsFragment +import com.fastaccess.github.ui.modules.issuesprs.edit.milestone.MilestoneFragment +import com.fastaccess.github.ui.modules.issuesprs.filter.FilterIssuesPrsBottomSheet +import com.fastaccess.github.ui.modules.multipurpose.MultiPurposeBottomSheetDialog.BottomSheetFragmentType.* +import com.fastaccess.github.ui.modules.profile.orgs.userorgs.UserOrgsFragment +import com.fastaccess.github.ui.modules.search.filter.FilterSearchBottomSheet +import com.fastaccess.github.ui.modules.trending.filter.FilterTrendingBottomSheet +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.base.utils.EXTRA_TWO + +/** + * Created by Kosh on 2018-11-25. + */ +class MultiPurposeBottomSheetDialog : com.fastaccess.github.base.BaseBottomSheetDialogFragment() { + + override fun layoutRes(): Int = R.layout.fragment_activity_layout + private val type by lazy { arguments?.getSerializable(EXTRA) as? BottomSheetFragmentType? } + + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + if (savedInstanceState == null) { + childFragmentManager.commit { + when (type) { + ORGANIZATIONS -> replace(R.id.container, UserOrgsFragment.newInstance(), "UserOrgsFragment") + FILTER_ISSUES, FILTER_PRS -> + replace(R.id.container, FilterIssuesPrsBottomSheet + .newInstance(arguments?.getParcelable(EXTRA_TWO) ?: FilterIssuesPrsModel()), "FilterIssuesPrsBottomSheet") + FILTER_SEARCH -> replace(R.id.container, FilterSearchBottomSheet + .newInstance(arguments?.getParcelable(EXTRA_TWO) ?: FilterSearchModel()), "FilterSearchBottomSheet") + TRENDING -> replace(R.id.container, + FilterTrendingBottomSheet.newInstance(arguments?.getParcelable(EXTRA_TWO) + ?: FilterTrendingModel()), "FilterTrendingBottomSheet") + LOCK_UNLOCK -> replace(R.id.container, LockUnlockFragment.newInstance(), "LockUnlockFragment") + LABELS -> replace(R.id.container, + LabelsFragment.newInstance(arguments?.getParcelable(EXTRA_TWO)), "LabelsFragment") + ASSIGNEES -> replace(R.id.container, + AssigneesFragment.newInstance(arguments?.getParcelable(EXTRA_TWO)), "AssigneesFragment") + MILESTONE -> replace(R.id.container, + MilestoneFragment.newInstance(arguments?.getParcelable(EXTRA_TWO)), "MilestoneFragment") + null -> dialog?.dismiss() + } + } + } + } + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = null + + companion object { + fun show(fragmentManager: FragmentManager, type: BottomSheetFragmentType, parcelable: Parcelable? = null) { + MultiPurposeBottomSheetDialog() + .apply { + arguments = bundleOf(EXTRA to type).apply { + if (parcelable != null) putParcelable(EXTRA_TWO, parcelable) + } + show(fragmentManager) + } + } + } + + enum class BottomSheetFragmentType { + ORGANIZATIONS, FILTER_ISSUES, FILTER_PRS, FILTER_SEARCH, + TRENDING, LOCK_UNLOCK, LABELS, ASSIGNEES, MILESTONE + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/notifications/NotificationPagerFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/notifications/NotificationPagerFragment.kt new file mode 100644 index 000000000..fd2cc15de --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/notifications/NotificationPagerFragment.kt @@ -0,0 +1,60 @@ +package com.fastaccess.github.ui.modules.notifications + +import android.os.Bundle +import android.view.MenuItem +import android.view.View +import androidx.core.os.bundleOf +import androidx.viewpager.widget.ViewPager +import com.fastaccess.data.model.FragmentType +import com.fastaccess.data.model.ViewPagerModel +import com.fastaccess.github.R +import com.fastaccess.github.base.BaseFragment +import com.fastaccess.github.base.adapter.PagerAdapter +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.ui.modules.notifications.fragment.read.AllNotificationsFragment +import com.fastaccess.github.ui.modules.notifications.fragment.unread.UnreadNotificationsFragment + +/** + * Created by Kosh on 04.11.18. + */ +class NotificationPagerFragment : com.fastaccess.github.base.BasePagerFragment() { + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = null + override fun layoutRes(): Int = R.layout.toolbar_fragment_pager_layout + override fun onPageSelected(page: Int) = (pager.adapter?.instantiateItem(pager, page) as? BaseFragment)?.onScrollToTop() ?: Unit + + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + setupToolbar(R.string.notifications, R.menu.notification_menu) { item: MenuItem -> + if (item.itemId == R.id.markAllAsRead) { + (pager.adapter?.instantiateItem(pager, 0) as? UnreadNotificationsFragment)?.markAllAsRead() + } + } + + pager.isEnabled = false + pager.adapter = PagerAdapter( + childFragmentManager, arrayListOf( + ViewPagerModel(getString(R.string.unread), UnreadNotificationsFragment.newInstance(), FragmentType.UNREAD_NOTIFICATIONS), + ViewPagerModel(getString(R.string.read), AllNotificationsFragment.newInstance(), FragmentType.ALL_NOTIFICATIONS) + ) + ) + tabs.setupWithViewPager(pager) + if (savedInstanceState == null) { + FragmentType.getTypeSafely(arguments?.getString(EXTRA) ?: "")?.let { + val index = (pager.adapter as PagerAdapter).getIndex(it) + if (index >= 0) pager.currentItem = index + } + } + pager.addOnPageChangeListener(object : ViewPager.SimpleOnPageChangeListener() { + override fun onPageSelected(position: Int) { + super.onPageSelected(position) + toolbar?.menu?.findItem(R.id.markAllAsRead)?.isVisible = position == 0 + } + }) + toolbar?.menu?.findItem(R.id.markAllAsRead)?.isVisible = pager.currentItem == 0 + } + + companion object { + fun newInstance(page: String? = FragmentType.UNREAD_NOTIFICATIONS.tabName) = NotificationPagerFragment().apply { + arguments = bundleOf(Pair(EXTRA, page)) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/notifications/fragment/read/AllNotificationsFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/notifications/fragment/read/AllNotificationsFragment.kt new file mode 100644 index 000000000..d9823cada --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/notifications/fragment/read/AllNotificationsFragment.kt @@ -0,0 +1,52 @@ +package com.fastaccess.github.ui.modules.notifications.fragment.read + +import android.os.Bundle +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.isConnected +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.github.ui.adapter.AllNotificationsAdapter +import com.fastaccess.github.ui.modules.notifications.NotificationPagerFragment + +import javax.inject.Inject + +/** + * Created by Kosh on 04.11.18. + */ +class AllNotificationsFragment : com.fastaccess.github.base.BaseFragment() { + + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(AllNotificationsViewModel::class.java) } + private val adapter by lazy { AllNotificationsAdapter() } + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = viewModel + override fun layoutRes(): Int = R.layout.simple_refresh_list_layout + + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + recyclerView.adapter = adapter + recyclerView.setEmptyView(emptyLayout) + fastScroller.attachRecyclerView(recyclerView, (parentFragment as? NotificationPagerFragment)?.view?.findViewById(R.id.appBar)) + if (savedInstanceState == null) isConnected().isTrue { viewModel.loadNotifications() } + swipeRefresh.setOnRefreshListener { + if (isConnected()) { + viewModel.loadNotifications() + } else { + swipeRefresh.isRefreshing = false + } + } + listenToChanges() + } + + private fun listenToChanges() { + viewModel.data.observeNotNull(this) { + adapter.submitList(it) + } + } + + companion object { + fun newInstance() = AllNotificationsFragment() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/notifications/fragment/read/AllNotificationsViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/notifications/fragment/read/AllNotificationsViewModel.kt new file mode 100644 index 000000000..320b6eb73 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/notifications/fragment/read/AllNotificationsViewModel.kt @@ -0,0 +1,25 @@ +package com.fastaccess.github.ui.modules.notifications.fragment.read + +import androidx.lifecycle.LiveData +import com.fastaccess.data.model.GroupedNotificationsModel +import com.fastaccess.data.repository.NotificationRepository +import com.fastaccess.github.base.BaseViewModel +import com.fastaccess.github.usecase.notification.NotificationUseCase +import javax.inject.Inject + +/** + * Created by Kosh on 04.11.18. + */ +class AllNotificationsViewModel @Inject constructor( + provider: NotificationRepository, + private val usecase: NotificationUseCase +) : com.fastaccess.github.base.BaseViewModel() { + + val data: LiveData> = provider.getAllNotifications() + + fun loadNotifications() { + usecase.all = true + add(callApi(usecase.buildObservable()) + .subscribe({}, ::println)) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/notifications/fragment/unread/UnreadNotificationsFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/notifications/fragment/unread/UnreadNotificationsFragment.kt new file mode 100644 index 000000000..9e8adb401 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/notifications/fragment/unread/UnreadNotificationsFragment.kt @@ -0,0 +1,92 @@ +package com.fastaccess.github.ui.modules.notifications.fragment.unread + +import android.os.Bundle +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import androidx.recyclerview.widget.ItemTouchHelper +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.isConnected +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.platform.works.MarkAsReadNotificationWorker +import com.fastaccess.github.ui.adapter.UnreadNotificationsAdapter +import com.fastaccess.github.base.adapter.CurrentState +import com.fastaccess.github.ui.modules.notifications.NotificationPagerFragment +import com.fastaccess.github.ui.modules.notifications.fragment.unread.viewmodel.UnreadNotificationsViewModel +import com.fastaccess.github.base.widget.recyclerview.SwipeToDeleteCallback + +import javax.inject.Inject + +/** + * Created by Kosh on 21.10.18. + */ +class UnreadNotificationsFragment : com.fastaccess.github.base.BaseFragment() { + + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(UnreadNotificationsViewModel::class.java) } + private val adapter by lazy { UnreadNotificationsAdapter() } + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = viewModel + override fun layoutRes(): Int = R.layout.simple_refresh_list_layout + + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + recyclerView.adapter = adapter + recyclerView.setEmptyView(emptyLayout) + fastScroller.attachRecyclerView(recyclerView, (parentFragment as? NotificationPagerFragment)?.view?.findViewById(R.id.appBar)) + if (savedInstanceState == null) isConnected().isTrue { viewModel.loadNotifications(true) } + swipeRefresh.setOnRefreshListener { + if (isConnected()) { + recyclerView.resetScrollState() + viewModel.loadNotifications(true) + } else { + swipeRefresh.isRefreshing = false + } + } + recyclerView.addOnLoadMore { isConnected().isTrue { viewModel.loadNotifications() } } + listenToChanges() + + val swipeCallback = SwipeToDeleteCallback { viewHolder, _ -> + adapter.getValue(viewHolder.adapterPosition)?.let { + if (it.unread == true) { + MarkAsReadNotificationWorker.enqueue(it.id) + viewModel.markAsRead(it.id) + } + } + } + + val itemTouchHelper = ItemTouchHelper(swipeCallback) + itemTouchHelper.attachToRecyclerView(recyclerView) + } + + fun markAllAsRead() { + addDisposal(viewModel.getAllUnreadNotifications() + .subscribe({ list -> + if (list.isNullOrEmpty()) return@subscribe + list.map { it.id }.toTypedArray().let { + MarkAsReadNotificationWorker.enqueue(ids = it) + } + viewModel.markAllAsRead() + }, { + it.printStackTrace() + }) + ) + } + + private fun listenToChanges() { + + viewModel.progress.observeNotNull(this) { + adapter.currentState = if (it) CurrentState.LOADING else CurrentState.DONE + } + + viewModel.notifications().observeNotNull(this) { + adapter.currentState = CurrentState.DONE + adapter.submitList(it) + } + } + + companion object { + fun newInstance() = UnreadNotificationsFragment() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/notifications/fragment/unread/viewmodel/UnreadNotificationsViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/notifications/fragment/unread/viewmodel/UnreadNotificationsViewModel.kt new file mode 100644 index 000000000..6578e545a --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/notifications/fragment/unread/viewmodel/UnreadNotificationsViewModel.kt @@ -0,0 +1,51 @@ +package com.fastaccess.github.ui.modules.notifications.fragment.unread.viewmodel + +import androidx.lifecycle.LiveData +import androidx.paging.LivePagedListBuilder +import androidx.paging.PagedList +import com.fastaccess.data.persistence.models.NotificationModel +import com.fastaccess.data.repository.NotificationRepository +import com.fastaccess.github.usecase.notification.NotificationUseCase +import javax.inject.Inject + +/** + * Created by Kosh on 31.10.18. + */ +class UnreadNotificationsViewModel @Inject constructor( + private val provider: NotificationRepository, + private val usecase: NotificationUseCase +) : com.fastaccess.github.base.BaseViewModel() { + + private var currentPage = 0 + private var isLastPage = false + + fun notifications(): LiveData> { + val dataSourceFactory = provider.getNotifications(true) + val config = PagedList.Config.Builder() + .setPrefetchDistance(com.fastaccess.github.base.utils.PRE_FETCH_SIZE) + .setPageSize(com.fastaccess.github.base.utils.PAGE_SIZE) + .build() + return LivePagedListBuilder(dataSourceFactory, config) + .build() + } + + fun loadNotifications(reload: Boolean = false) { + if (reload) { + currentPage = 0 + isLastPage = false + } + currentPage++ + if (!reload && isLastPage) return + usecase.page = currentPage + add(callApi(usecase.buildObservable()) + .subscribe({ + isLastPage = it.last == currentPage + }, ::println)) + } + + fun markAsRead(id: String) = add(provider.markAsRead(id).subscribe()) + fun markAllAsRead() = add(provider.markAllAsRead().subscribe({}, { it.printStackTrace() })) + fun getAllUnreadNotifications() = provider.getAllNotificationsAsMaybe(true) + + fun hasNext() = isLastPage +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/pr/PullRequestActivity.kt b/app/src/main/java/com/fastaccess/github/ui/modules/pr/PullRequestActivity.kt new file mode 100644 index 000000000..70bf419f5 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/pr/PullRequestActivity.kt @@ -0,0 +1,44 @@ +package com.fastaccess.github.ui.modules.pr + +import android.os.Bundle +import com.fastaccess.fasthub.reviews.PullRequestReviewsActivity +import com.fastaccess.github.R +import com.fastaccess.github.base.deeplink.WebDeepLink +import com.fastaccess.github.extensions.getEncodedFragmentFromDeepLink +import com.fastaccess.github.extensions.replace +import com.fastaccess.github.extensions.route +import com.fastaccess.github.ui.modules.issue.fragment.IssueFragment +import com.fastaccess.github.ui.modules.pr.fragment.PullRequestFragment + +/** + * Created by Kosh on 28.01.19. + */ +@WebDeepLink( + "/{login}/{repo}/pull/{number}", + "/{login}/{repo}/pulls/{number}" +) +class PullRequestActivity : com.fastaccess.github.base.BaseActivity() { + + override fun layoutRes(): Int = R.layout.activity_main + override fun onActivityCreatedWithUser(savedInstanceState: Bundle?) { + if (savedInstanceState == null && intent != null) { + val login = intent?.extras?.getString("login") + val repo = intent?.extras?.getString("repo") + val number = intent?.extras?.getString("number")?.toIntOrNull() + if (login == null || repo == null || number == null) { + finish() + return + } + replace(R.id.container, PullRequestFragment.newInstance(login, repo, number), IssueFragment.TAG) + getEncodedFragmentFromDeepLink()?.let { + if (it.contains("pullrequestreview-") || it.contains("discussion_r")) { + route(PullRequestReviewsActivity.getUrl(login, repo, number)) + } + } + } + } + + override fun onBackPressed() { + super.onBackPressed() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/pr/fragment/PullRequestFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/pr/fragment/PullRequestFragment.kt new file mode 100644 index 000000000..783af870c --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/pr/fragment/PullRequestFragment.kt @@ -0,0 +1,261 @@ +package com.fastaccess.github.ui.modules.pr.fragment + +import android.annotation.SuppressLint +import android.os.Bundle +import android.view.View +import android.widget.EditText +import androidx.core.os.bundleOf +import androidx.core.view.isVisible +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.data.model.TimelineModel +import com.fastaccess.data.model.TimelineType +import com.fastaccess.data.persistence.models.LoginModel +import com.fastaccess.data.persistence.models.PullRequestModel +import com.fastaccess.data.storage.FastHubSharedPreference +import com.fastaccess.fasthub.reviews.PullRequestReviewsActivity +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.hideKeyboard +import com.fastaccess.github.base.extensions.theme +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.base.utils.EXTRA_THREE +import com.fastaccess.github.base.utils.EXTRA_TWO +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.extensions.route +import com.fastaccess.github.extensions.timeAgo +import com.fastaccess.github.ui.adapter.IssueTimelineAdapter +import com.fastaccess.github.ui.modules.issuesprs.BaseIssuePrTimelineFragment +import com.fastaccess.github.ui.modules.pr.fragment.viewmodel.PullRequestTimelineViewModel +import com.fastaccess.github.ui.modules.quickmsg.QuickMessageBottomSheetDialog +import com.fastaccess.github.ui.modules.quickmsg.QuickMessageBottomSheetDialog.QuickMessageCallback +import com.fastaccess.markdown.widget.SpannableBuilder +import github.type.CommentAuthorAssociation +import github.type.LockReason +import github.type.PullRequestState +import io.noties.markwon.Markwon +import io.noties.markwon.utils.NoCopySpannableFactory +import kotlinx.android.synthetic.main.pr_header_row_item.* +import kotlinx.android.synthetic.main.pr_view_layout.* +import timber.log.Timber +import javax.inject.Inject + +/** + * Created by Kosh on 28.01.19. + */ +class PullRequestFragment : BaseIssuePrTimelineFragment(), QuickMessageCallback { + + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + @Inject lateinit var markwon: Markwon + @Inject lateinit var preference: FastHubSharedPreference + + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(PullRequestTimelineViewModel::class.java) } + + override val adapter by lazy { + IssueTimelineAdapter( + markwon, preference.theme, onCommentClicked(), + onDeleteCommentClicked(), + onEditCommentClicked(), + { model -> route(PullRequestReviewsActivity.getUrl(login, repo, number)) } + ) + } + + override fun layoutRes(): Int = R.layout.pr_fragment_layout + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = viewModel + override fun isPr(): Boolean = true + override fun lockIssuePr(lockReason: LockReason?, isLock: Boolean) = viewModel.lockUnlockIssue(login, repo, number, lockReason, isLock) + override fun onMilestoneAdd(timeline: TimelineModel) = viewModel.addTimeline(timeline) + override fun reload(refresh: Boolean) = viewModel.loadData(login, repo, number, refresh) + override fun sendComment(comment: String) = viewModel.createComment(login, repo, number, comment) + + override fun onFragmentCreatedWithUser( + view: View, + savedInstanceState: Bundle? + ) { + super.onFragmentCreatedWithUser(view, savedInstanceState) + observeChanges() + } + + override fun onDestroyView() { + mentionsPresenter.onDispose() + super.onDestroyView() + } + + override fun editIssuerPr( + title: String?, + description: String? + ) = viewModel.editIssue(login, repo, number, title, description) + + override fun closeOpenIssuePr() = viewModel.closeOpenIssue(login, repo, number) + + override fun onMessageEntered(msg: String, bundle: Bundle?) { + val commentId = bundle?.getLong(EXTRA_TWO) ?: return + viewModel.deleteComment(login, repo, commentId, TimelineType.REVIEW_BODY, number, msg) + } + + private fun observeChanges() { + viewModel.getPullRequest(login, repo, number).observeNotNull(this) { + initIssue(it.first, it.second) + } + viewModel.timeline.observeNotNull(this) { timeline -> + adapter.submitList(timeline) + } + viewModel.userNamesLiveData.observeNotNull(this) { + mentionsPresenter.setUsers(it) + } + viewModel.commentProgress.observeNotNull(this) { + view?.findViewById(R.id.commentProgress)?.isVisible = it + view?.findViewById(R.id.sendComment)?.isVisible = !it + if (!it) { + view?.findViewById(R.id.commentText)?.let { commentText -> + commentText.setText("") + commentText.hideKeyboard() + } + recyclerView.scrollToPosition(adapter.itemCount) + } + } + viewModel.forceAdapterUpdate.observeNotNull(this) { + it.isTrue { adapter.notifyDataSetChanged() } + } + } + + @SuppressLint("DefaultLocale") + private fun initIssue( + model: PullRequestModel, + me: LoginModel? + ) { + view?.findViewById(R.id.commentLayout)?.isVisible = model.locked == false + issueHeaderWrapper.isVisible = true + title.text = model.title + + opener.text = if (model.merged == true) { + SpannableBuilder.builder() + .bold(model.mergedBy?.login) + .space() + .append(getString(R.string.merged).toLowerCase()) + .space() + .bold(model.headRefName) + .space() + .append(getString(R.string.to)) + .space() + .bold(model.baseRefName) + .space() + .append(model.mergedAt?.timeAgo()) + } else { + SpannableBuilder.builder() + .bold(model.author?.login) + .space() + .append(getString(R.string.want_to_merge)) + .space() + .bold(model.headRefName) + .space() + .append(getString(R.string.to)) + .space() + .bold(model.baseRefName) + .space() + .append(model.createdAt?.timeAgo()) + } + + userIcon.loadAvatar(model.author?.avatarUrl, model.author?.url ?: "") + author.text = model.author?.login + association.text = if (CommentAuthorAssociation.NONE.rawValue() == model.authorAssociation) { + model.updatedAt?.timeAgo() + } else { + "${model.authorAssociation?.toLowerCase()?.replace("_", "")} ${model.updatedAt?.timeAgo()}" + } + + description.post { + val bodyMd = model.body +// description.setMovementMethod(LinkMovementMethod.getInstance()) + description.setSpannableFactory(NoCopySpannableFactory.getInstance()) + markwon.setMarkdown( + description, if (!bodyMd.isNullOrEmpty()) bodyMd else "**${getString(R.string.no_description_provided)}**" + ) + } + + state.text = model.state?.toLowerCase() + state.setChipBackgroundColorResource( + when { + PullRequestState.OPEN.rawValue().equals(model.state, true) -> R.color.material_green_500 + PullRequestState.CLOSED.rawValue().equals(model.state, true) -> R.color.material_red_500 + else -> R.color.material_blue_700 + } + ) + + adaptiveEmoticon.init(requireNotNull(model.id), model.reactionGroups) { + adaptiveEmoticon.initReactions(model.reactionGroups) + } + val isAuthor = model.viewerCanUpdate == true + initLabels(model.labels) + initAssignees(model.assignees) + initMilestone(model.milestone) + initToolbarMenu( + isAuthor, + model.viewerCanUpdate == true, + model.viewerDidAuthor, + model.locked, + model.merged == true, + model.state + ) + menuClick(model.url, model.labels, model.assignees, model.title, model.body, isAuthor) + initDashboard(model) + recyclerView.removeEmptyView() + reviewFab.show() + } + + private fun initDashboard(model: PullRequestModel) { + commits.text = getString(R.string.commits_with_count, model.dashboard?.commits ?: 0) + files.text = getString(R.string.files_with_count, model.dashboard?.changedFiles ?: 0) + addition.text = getString(R.string.addition_with_count, model.dashboard?.additions ?: 0) + deletion.text = getString(R.string.deletion_with_count, model.dashboard?.deletions ?: 0) + approved.text = getString(R.string.approved_with_count, model.dashboard?.approvedReviews ?: 0) + commented.text = getString(R.string.commented_with_count, model.dashboard?.commentedReviews ?: 0) + changes.text = getString(R.string.changes_with_count, model.dashboard?.changeRequestedReviews ?: 0) + commitsCard.setOnClickListener { + it.context.route("${model.url}/commits") + } + reviewsCard.setOnClickListener { + addDisposal( + viewModel.hasCommentableReviews() + .subscribe { if (it) route(PullRequestReviewsActivity.getUrl(login, repo, number)) else Timber.e("no reviews") } + ) + } + } + + override fun deleteComment(login: String, repo: String, commentId: Long, type: TimelineType) { + if (type == TimelineType.REVIEW_BODY) { + QuickMessageBottomSheetDialog.show( + childFragmentManager, bundleOf( + EXTRA to getString(R.string.dismiss_review), + EXTRA_TWO to commentId + ) + ) + } else { + viewModel.deleteComment(login, repo, commentId, type, number) + } + } + + override fun onEditComment(comment: String?, commentId: Int?, type: TimelineType) { + viewModel.editComment(login, repo, comment, commentId?.toLong(), type, number) + } + + override fun onAppBarScrollChanged(show: Boolean) { + if (!reviewFab.isVisible) return + if (show) { + reviewFab.shrink() + } else { + reviewFab.extend() + } + } + + companion object { + const val TAG = "IssueFragment" + fun newInstance( + login: String, + repo: String, + number: Int + ) = PullRequestFragment().apply { + arguments = bundleOf(EXTRA to login, EXTRA_TWO to repo, EXTRA_THREE to number) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/pr/fragment/viewmodel/PullRequestTimelineViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/pr/fragment/viewmodel/PullRequestTimelineViewModel.kt new file mode 100644 index 000000000..917920dd0 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/pr/fragment/viewmodel/PullRequestTimelineViewModel.kt @@ -0,0 +1,271 @@ +package com.fastaccess.github.ui.modules.pr.fragment.viewmodel + +import androidx.lifecycle.MutableLiveData +import com.apollographql.apollo.api.Input +import com.fastaccess.data.model.PageInfoModel +import com.fastaccess.data.model.TimelineModel +import com.fastaccess.data.model.TimelineType +import com.fastaccess.data.repository.LoginRepository +import com.fastaccess.data.repository.PullRequestRepository +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.github.base.BaseViewModel +import com.fastaccess.github.editor.usecase.CreateIssueCommentUseCase +import com.fastaccess.github.editor.usecase.DeleteCommentUseCase +import com.fastaccess.github.editor.usecase.EditCommentUseCase +import com.fastaccess.github.extensions.filterNull +import com.fastaccess.github.extensions.map +import com.fastaccess.github.extensions.toArrayList +import com.fastaccess.github.usecase.issuesprs.* +import github.type.LockReason +import io.reactivex.Maybe +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 20.10.18. + */ +class PullRequestTimelineViewModel @Inject constructor( + private val issueUseCase: GetPullRequestUseCase, + private val timelineUseCase: GetPullRequestTimelineUseCase, + private val issueRepositoryProvider: PullRequestRepository, + private val closeOpenIssuePrUseCase: CloseOpenIssuePrUseCase, + private val lockUnlockIssuePrUseCase: LockUnlockIssuePrUseCase, + private val loginRepositoryProvider: LoginRepository, + private val createIssueCommentUseCase: CreateIssueCommentUseCase, + private val editIssuePrUseCase: EditIssuePrUseCase, + private val deleteCommentUseCase: DeleteCommentUseCase, + private val editCommentUseCase: EditCommentUseCase, + private val schedulerProvider: SchedulerProvider +) : BaseViewModel() { + + private var pageInfo: PageInfoModel? = null + private val list = arrayListOf() + val forceAdapterUpdate = MutableLiveData() + val timeline = MutableLiveData>() + val userNamesLiveData = MutableLiveData>() + val commentProgress = MutableLiveData() + + fun getPullRequest( + login: String, + repo: String, + number: Int + ) = issueRepositoryProvider.getPullRequestByNumber("$login/$repo", number) + .filterNull() + .map { Pair(it, loginRepositoryProvider.getLoginBlocking()) } + + fun loadData( + login: String, + repo: String, + number: Int, + reload: Boolean = false + ) { + if (reload) { + pageInfo = null + list.clear() + } + val pageInfo = pageInfo + if (!reload && (pageInfo != null && !pageInfo.hasNextPage)) return + val cursor = if (hasNext()) pageInfo?.endCursor else null + if (pageInfo == null) { + issueUseCase.login = login + issueUseCase.repo = repo + issueUseCase.number = number + justSubscribe(issueUseCase.buildObservable() + .flatMap { loadTimeline(login, repo, number, cursor) } + .map { mapToUserNames(it.second) }) + } else { + justSubscribe(loadTimeline(login, repo, number, cursor) + .map { mapToUserNames(it.second) }) + } + } + + private fun loadTimeline( + login: String, + repo: String, + number: Int, + cursor: String? + ): Observable>> { + timelineUseCase.login = login + timelineUseCase.repo = repo + timelineUseCase.number = number + timelineUseCase.page = Input.optional(cursor) + return timelineUseCase.buildObservable() + .doOnNext { + this.pageInfo = it.first + list.addAll(it.second) + timeline.postValue(list.toArrayList()) + } + } + + fun closeOpenIssue( + login: String, + repo: String, + number: Int + ) { + closeOpenIssuePrUseCase.isPr = true + closeOpenIssuePrUseCase.repo = repo + closeOpenIssuePrUseCase.login = login + closeOpenIssuePrUseCase.number = number + justSubscribe(closeOpenIssuePrUseCase.buildObservable() + .doOnNext { + addTimeline(it) + }) + } + + fun lockUnlockIssue( + login: String, + repo: String, + number: Int, + lockReason: LockReason? = null, + isLock: Boolean + ) { + lockUnlockIssuePrUseCase.repo = repo + lockUnlockIssuePrUseCase.login = login + lockUnlockIssuePrUseCase.number = number + lockUnlockIssuePrUseCase.lockReason = lockReason + lockUnlockIssuePrUseCase.lock = isLock + lockUnlockIssuePrUseCase.isPr = true + justSubscribe(lockUnlockIssuePrUseCase.buildObservable() + .doOnNext { + addTimeline(it) + }) + } + + fun createComment( + login: String, + repo: String, + number: Int, + comment: String + ) { + createIssueCommentUseCase.login = login + createIssueCommentUseCase.repo = repo + createIssueCommentUseCase.number = number + createIssueCommentUseCase.body = comment + add(createIssueCommentUseCase.buildObservable() + .doOnSubscribe { commentProgress.postValue(true) } + .subscribe({ + addTimeline(it) + commentProgress.postValue(false) + }, { + commentProgress.postValue(false) + handleError(it) + }) + ) + } + + fun addTimeline(it: TimelineModel) { + list.add(it) + timeline.postValue(list.toArrayList()) + } + + fun hasNext() = pageInfo?.hasNextPage ?: false + + private fun mapToUserNames(list: List) { + val _list = userNamesLiveData.value ?: arrayListOf() + _list.addAll(list.map { it.comment?.author?.login ?: it.comment?.author?.name ?: "" }) + userNamesLiveData.postValue(_list) + } + + fun editIssue( + login: String, + repo: String, + number: Int, + title: String?, + description: String? + ) { + editIssuePrUseCase.login = login + editIssuePrUseCase.repo = repo + editIssuePrUseCase.number = number + editIssuePrUseCase.title = title + editIssuePrUseCase.description = description + editIssuePrUseCase.isPr = true + justSubscribe(editIssuePrUseCase.buildObservable()) + } + + fun deleteComment( + login: String, + repo: String, + commentId: Long, + type: TimelineType = TimelineType.ISSUE, + number: Int, + msg: String? = null + ) { + deleteCommentUseCase.commentId = commentId + deleteCommentUseCase.login = login + deleteCommentUseCase.repo = repo + deleteCommentUseCase.type = type + deleteCommentUseCase.number = number + deleteCommentUseCase.msg = msg + justSubscribe(deleteCommentUseCase.buildObservable() + .map { + val index = getIndexOfComment(type, commentId) + if (index != -1) { + if (type == TimelineType.REVIEW) { + val item = list.getOrNull(index) ?: return@map list + item.review?.comment = null + list[index] = item + } else { + list.removeAt(index) + } + } + return@map list + } + .doOnNext { list -> + timeline.postValue(list.toArrayList()) + }) + } + + fun editComment( + login: String, + repo: String, + comment: String?, + commentId: Long?, + type: TimelineType = TimelineType.ISSUE, + number: Int + ) { + if (!comment.isNullOrBlank() && commentId != null) { + editCommentUseCase.comment = comment + editCommentUseCase.login = login + editCommentUseCase.repo = repo + editCommentUseCase.commentId = commentId + editCommentUseCase.type = type + editCommentUseCase.number = number + justSubscribe(editCommentUseCase.buildObservable() + .map { + val index = getIndexOfComment(type, commentId) + val item = list.getOrNull(index) ?: return@map list + when (type) { + TimelineType.ISSUE -> item.comment?.body = comment + TimelineType.REVIEW -> item.review?.comment?.body = comment + TimelineType.REVIEW_BODY -> item.review?.body = comment + TimelineType.COMMIT -> item.commitThread?.comment?.body = comment + else -> { + } + } + list[index] = item + return@map list + } + .doOnNext { list -> + timeline.postValue(list.toArrayList()) + forceAdapterUpdate.postValue(true) + }) + } + } + + fun hasCommentableReviews(): Maybe = Maybe.create { emitter -> + emitter.onSuccess(list.any { timelineModel -> + return@any timelineModel.review?.comment?.path != null + }) + emitter.onComplete() + }.subscribeOn(schedulerProvider.ioThread()).observeOn(schedulerProvider.uiThread()) + + private fun getIndexOfComment(type: TimelineType, commentId: Long?): Int = list.indexOfFirst { + return@indexOfFirst when (type) { + TimelineType.ISSUE -> it.comment?.databaseId?.toLong() == commentId + TimelineType.REVIEW_BODY -> it.review?.databaseId?.toLong() == commentId + TimelineType.REVIEW -> it.review?.comment?.databaseId?.toLong() == commentId + TimelineType.COMMIT -> it.commitThread?.comment?.databaseId?.toLong() == commentId + else -> false + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/profile/ProfileActivity.kt b/app/src/main/java/com/fastaccess/github/ui/modules/profile/ProfileActivity.kt new file mode 100644 index 000000000..6819dbe19 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/profile/ProfileActivity.kt @@ -0,0 +1,34 @@ +package com.fastaccess.github.ui.modules.profile + +import android.os.Bundle +import com.fastaccess.github.R +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.replace +import com.fastaccess.github.base.deeplink.WebDeepLink +import com.fastaccess.github.ui.modules.profile.fragment.ProfileFragment + +/** + * Created by Kosh on 18.08.18. + */ +@WebDeepLink("/{login}", "/users/{login}") +class ProfileActivity : com.fastaccess.github.base.BaseActivity() { + override fun layoutRes(): Int = R.layout.activity_main + + override fun onActivityCreatedWithUser(savedInstanceState: Bundle?) { + if (savedInstanceState == null && intent != null) { + val login = intent?.extras?.getString("login") + val tab = intent?.extras?.getString("tab") + if (login == null) { + finish() + return + } + replace(R.id.container, ProfileFragment.newInstance(login, tab), ProfileFragment.TAG) + } + } + + override fun onBackPressed() { + (supportFragmentManager.findFragmentByTag(ProfileFragment.TAG) as? ProfileFragment)?.onBackPressed()?.isTrue { + super.onBackPressed() + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/profile/feeds/ProfileFeedFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/profile/feeds/ProfileFeedFragment.kt new file mode 100644 index 000000000..fd96ea3d0 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/profile/feeds/ProfileFeedFragment.kt @@ -0,0 +1,83 @@ +package com.fastaccess.github.ui.modules.profile.feeds + +import android.os.Bundle +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.data.model.FragmentType +import com.fastaccess.fasthub.commit.dialog.CommitListCallback +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.CurrentState +import com.fastaccess.github.base.extensions.addDivider +import com.fastaccess.github.base.extensions.isConnected +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.extensions.route +import com.fastaccess.github.platform.extension.onClick +import com.fastaccess.github.ui.adapter.ProfileFeedsAdapter +import com.fastaccess.github.ui.modules.profile.feeds.viewmodel.ProfileFeedsViewModel +import javax.inject.Inject + +/** + * Created by Kosh on 20.10.18. + */ +class ProfileFeedFragment : com.fastaccess.github.base.BaseFragment(), CommitListCallback { + + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(ProfileFeedsViewModel::class.java) } + private val loginBundle: String by lazy { arguments?.getString(EXTRA) ?: "" } + private val adapter by lazy { + ProfileFeedsAdapter { + it.onClick(this) + } + } + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = viewModel + override fun layoutRes(): Int = R.layout.simple_refresh_list_layout + + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + recyclerView.adapter = adapter + recyclerView.addDivider() + recyclerView.setEmptyView(emptyLayout) + fastScroller.attachRecyclerView(recyclerView) + if (savedInstanceState == null) isConnected().isTrue { viewModel.loadFeeds(loginBundle, true) } + swipeRefresh.setOnRefreshListener { + if (isConnected()) { + recyclerView.resetScrollState() + viewModel.loadFeeds(loginBundle, true) + } else { + swipeRefresh.isRefreshing = false + } + } + recyclerView.addOnLoadMore { isConnected().isTrue { viewModel.loadFeeds(loginBundle) } } + listenToChanges() + } + + override fun onCommitClicked(url: String) { + route(url) + } + + private fun listenToChanges() { + viewModel.progress.observeNotNull(this) { + adapter.currentState = if (it) CurrentState.LOADING else CurrentState.DONE + } + + viewModel.feeds(loginBundle).observeNotNull(this) { + adapter.currentState = CurrentState.DONE + adapter.submitList(it) + } + + viewModel.counter.observeNotNull(this) { + postCount(FragmentType.FEEDS, it) + } + } + + companion object { + fun newInstance(login: String) = ProfileFeedFragment().apply { + arguments = Bundle().apply { + putString(EXTRA, login) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/profile/feeds/viewmodel/ProfileFeedsViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/profile/feeds/viewmodel/ProfileFeedsViewModel.kt new file mode 100644 index 000000000..cb0694216 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/profile/feeds/viewmodel/ProfileFeedsViewModel.kt @@ -0,0 +1,48 @@ +package com.fastaccess.github.ui.modules.profile.feeds.viewmodel + +import androidx.lifecycle.LiveData +import androidx.paging.LivePagedListBuilder +import androidx.paging.PagedList +import com.fastaccess.data.persistence.models.FeedModel +import com.fastaccess.data.repository.FeedsRepository +import com.fastaccess.github.usecase.user.UserFeedsUseCase +import javax.inject.Inject + +/** + * Created by Kosh on 20.10.18. + */ +class ProfileFeedsViewModel @Inject constructor( + private val provider: FeedsRepository, + private val usecase: UserFeedsUseCase +) : com.fastaccess.github.base.BaseViewModel() { + + private var currentPage = 0 + private var isLastPage = false + + fun feeds(login: String): LiveData> { + val dataSourceFactory = provider.getFeeds(login) + val config = PagedList.Config.Builder() + .setPrefetchDistance(com.fastaccess.github.base.utils.PRE_FETCH_SIZE) + .setPageSize(com.fastaccess.github.base.utils.PAGE_SIZE) + .build() + return LivePagedListBuilder(dataSourceFactory, config) + .build() + } + + fun loadFeeds(login: String, reload: Boolean = false) { + if (reload) { + currentPage = 0 + isLastPage = false + } + currentPage++ + if (!reload && isLastPage) return + usecase.page = currentPage + usecase.login = login + add(callApi(usecase.buildObservable()) + .subscribe({ + isLastPage = it.last == currentPage + }, ::println)) + } + + fun hasNext() = isLastPage +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/profile/followersandfollowings/ProfileFollowersFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/profile/followersandfollowings/ProfileFollowersFragment.kt new file mode 100644 index 000000000..289aa3ea3 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/profile/followersandfollowings/ProfileFollowersFragment.kt @@ -0,0 +1,83 @@ +package com.fastaccess.github.ui.modules.profile.followersandfollowings + +import android.os.Bundle +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.data.model.FragmentType +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.addKeyLineDivider +import com.fastaccess.github.base.extensions.isConnected +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.base.utils.EXTRA_TWO +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.extensions.route +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.github.ui.adapter.ProfileFollowingFollowersAdapter +import com.fastaccess.github.base.adapter.CurrentState +import com.fastaccess.github.ui.modules.profile.followersandfollowings.viewmodel.FollowersFollowingViewModel + +import javax.inject.Inject + +/** + * Created by Kosh on 15.10.18. + */ +class ProfileFollowersFragment : com.fastaccess.github.base.BaseFragment() { + + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(FollowersFollowingViewModel::class.java) } + private val loginBundle: String by lazy { arguments?.getString(EXTRA) ?: "" } + private val isFollowers: Boolean by lazy { arguments?.getBoolean(EXTRA_TWO) ?: false } + private val adapter by lazy { ProfileFollowingFollowersAdapter { url -> route(url) } } + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = viewModel + override fun layoutRes(): Int = R.layout.simple_refresh_list_layout + + override fun onFragmentCreatedWithUser( + view: View, + savedInstanceState: Bundle? + ) { + recyclerView.adapter = adapter + recyclerView.addKeyLineDivider() + recyclerView.setEmptyView(emptyLayout) + fastScroller.attachRecyclerView(recyclerView) + if (savedInstanceState == null) isConnected().isTrue { viewModel.loadUsers(loginBundle, isFollowers, true) } + swipeRefresh.setOnRefreshListener { + if (isConnected()) { + recyclerView.resetScrollState() + viewModel.loadUsers(loginBundle, isFollowers, true) + } else { + swipeRefresh.isRefreshing = false + } + } + recyclerView.addOnLoadMore { isConnected().isTrue { viewModel.loadUsers(loginBundle, isFollowers) } } + listenToChanges() + } + + private fun listenToChanges() { + viewModel.progress.observeNotNull(this) { + adapter.currentState = if (it) CurrentState.LOADING else CurrentState.DONE + } + + viewModel.getUsers(loginBundle, isFollowers).observeNotNull(this) { + adapter.currentState = CurrentState.DONE + adapter.submitList(it) + } + + viewModel.counter.observeNotNull(this) { + postCount(if (isFollowers) FragmentType.FOLLOWERS else FragmentType.FOLLOWINGS, it) + } + } + + companion object { + fun newInstance( + login: String, + isFollowers: Boolean + ) = ProfileFollowersFragment().apply { + arguments = Bundle().apply { + putString(EXTRA, login) + putBoolean(EXTRA_TWO, isFollowers) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/profile/followersandfollowings/viewmodel/FollowersFollowingViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/profile/followersandfollowings/viewmodel/FollowersFollowingViewModel.kt new file mode 100644 index 000000000..a883a8e4c --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/profile/followersandfollowings/viewmodel/FollowersFollowingViewModel.kt @@ -0,0 +1,50 @@ +package com.fastaccess.github.ui.modules.profile.followersandfollowings.viewmodel + +import androidx.lifecycle.LiveData +import androidx.paging.LivePagedListBuilder +import androidx.paging.PagedList +import com.fastaccess.data.model.PageInfoModel +import com.fastaccess.data.persistence.models.FollowingFollowerModel +import com.fastaccess.data.repository.FollowersFollowingRepository +import javax.inject.Inject + +/** + * Created by Kosh on 15.10.18. + */ +class FollowersFollowingViewModel @Inject constructor( + private val provider: FollowersFollowingRepository +) : com.fastaccess.github.base.BaseViewModel() { + + private var pageInfo: PageInfoModel? = null + + fun getUsers(login: String, isFollowers: Boolean): LiveData> { + val dataSourceFactory = provider.getFollowersOrFollowing(login, isFollowers) + val config = PagedList.Config.Builder() + .setPrefetchDistance(com.fastaccess.github.base.utils.PRE_FETCH_SIZE) + .setPageSize(com.fastaccess.github.base.utils.PAGE_SIZE) + .build() + return LivePagedListBuilder(dataSourceFactory, config) + .build() + } + + fun loadUsers(login: String, isFollowers: Boolean, reload: Boolean = false) { + if (reload) { + pageInfo = null + } + val pageInfo = pageInfo + if (!reload && (pageInfo != null && !pageInfo.hasNextPage)) return + val cursor = if (hasNext()) pageInfo?.endCursor else null + val observable = if (isFollowers) { + provider.getFollowersFromRemote(login, cursor) + } else { + provider.getFollowingFromRemote(login, cursor) + } + add(callApi(observable) + .subscribe({ + this.pageInfo = it.pageInfo + postCounter(it.totalCount) + }, { it.printStackTrace() })) + } + + fun hasNext() = pageInfo?.hasNextPage == true +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/profile/fragment/ProfileFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/profile/fragment/ProfileFragment.kt new file mode 100644 index 000000000..504d9652f --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/profile/fragment/ProfileFragment.kt @@ -0,0 +1,209 @@ +package com.fastaccess.github.ui.modules.profile.fragment + +import android.annotation.SuppressLint +import android.os.Bundle +import android.view.View +import androidx.core.view.isVisible +import androidx.core.widget.NestedScrollView +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.data.model.FragmentType +import com.fastaccess.data.model.ViewPagerModel +import com.fastaccess.data.persistence.models.UserModel +import com.fastaccess.data.repository.LoginRepository +import com.fastaccess.github.R +import com.fastaccess.github.base.adapter.PagerAdapter +import com.fastaccess.github.base.extensions.addDivider +import com.fastaccess.github.base.extensions.isConnected +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.base.utils.EXTRA_TWO +import com.fastaccess.github.base.widget.recyclerview.lm.SafeGridLayoutManager +import com.fastaccess.github.extensions.getDrawable +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.extensions.timeAgo +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.github.ui.adapter.ProfileOrgsAdapter +import com.fastaccess.github.ui.adapter.ProfilePinnedReposAdapter +import com.fastaccess.github.ui.modules.profile.feeds.ProfileFeedFragment +import com.fastaccess.github.ui.modules.profile.followersandfollowings.ProfileFollowersFragment +import com.fastaccess.github.ui.modules.profile.fragment.viewmodel.ProfileViewModel +import com.fastaccess.github.ui.modules.profile.gists.ProfileGistsFragment +import com.fastaccess.github.ui.modules.profile.repos.ProfileReposFragment +import com.fastaccess.github.ui.modules.profile.starred.ProfileStarredReposFragment +import com.fastaccess.github.ui.widget.AnchorSheetBehavior +import com.google.android.material.tabs.TabLayout +import kotlinx.android.synthetic.main.profile_bottom_sheet.* +import kotlinx.android.synthetic.main.profile_fragment_layout.* +import javax.inject.Inject + +/** + * Created by Kosh on 18.08.18. + */ +class ProfileFragment : com.fastaccess.github.base.BasePagerFragment() { + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + @Inject lateinit var loginRepositoryProvider: LoginRepository + + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(ProfileViewModel::class.java) } + private val behaviour by lazy { AnchorSheetBehavior.from(bottomSheet) } + private val adapter by lazy { + PagerAdapter( + childFragmentManager, arrayListOf( + ViewPagerModel(getString(R.string.feeds), ProfileFeedFragment.newInstance(loginBundle), FragmentType.FEEDS), + ViewPagerModel(getString(R.string.repos), ProfileReposFragment.newInstance(loginBundle), FragmentType.REPOS), + ViewPagerModel(getString(R.string.starred), ProfileStarredReposFragment.newInstance(loginBundle), FragmentType.STARRED), + ViewPagerModel(getString(R.string.gists), ProfileGistsFragment.newInstance(loginBundle), FragmentType.GISTS), + ViewPagerModel(getString(R.string.followers), ProfileFollowersFragment.newInstance(loginBundle, true), FragmentType.FOLLOWERS), + ViewPagerModel(getString(R.string.following), ProfileFollowersFragment.newInstance(loginBundle, false), FragmentType.FOLLOWINGS) + ) + ) + } + private val pinnedReposAdapter by lazy { ProfilePinnedReposAdapter(arrayListOf()) } + private val orgsAdapter by lazy { ProfileOrgsAdapter(arrayListOf()) } + private val loginBundle: String by lazy { arguments?.getString(EXTRA) ?: "" } + private val tabBundle: String? by lazy { + val tabPosition = arguments?.getString(EXTRA_TWO) + arguments?.remove(EXTRA_TWO) // get this only once and then remove it from the bundle. + return@lazy tabPosition + } + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = viewModel + override fun layoutRes(): Int = R.layout.profile_fragment_layout + override fun onPageSelected(page: Int) = (pager.adapter?.instantiateItem(pager, page) as? com.fastaccess.github.base.BaseFragment)?.onScrollToTop() ?: Unit + + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + setupToolbar(R.string.profile) + username.text = loginBundle + toolbar?.navigationIcon = getDrawable(R.drawable.ic_back) + swipeRefresh.setOnRefreshListener { + if (isConnected()) { + viewModel.getUserFromRemote(loginBundle) + } else { + swipeRefresh.isRefreshing = false + } + } + + (organizationList.layoutManager as SafeGridLayoutManager).setIconSize(resources.getDimensionPixelSize(R.dimen.header_icon_zie)) + organizationList.adapter = orgsAdapter + pinnedList.adapter = pinnedReposAdapter + pinnedList.addDivider() + observeChanges() + behaviour.state = AnchorSheetBehavior.STATE_ANCHOR + + toggleArrow.setOnClickListener { + if (behaviour.state != AnchorSheetBehavior.STATE_EXPANDED) { + behaviour.state = AnchorSheetBehavior.STATE_EXPANDED + } else { + behaviour.state = AnchorSheetBehavior.STATE_COLLAPSED + } + } + + tabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener { + override fun onTabReselected(p0: TabLayout.Tab?) = expandBottomSheet() + override fun onTabUnselected(p0: TabLayout.Tab?) {} + override fun onTabSelected(p0: TabLayout.Tab?) = expandBottomSheet() + + private fun expandBottomSheet() { + if (viewModel.isFirstLaunch) { + viewModel.isFirstLaunch = false + return + } + (behaviour.state != AnchorSheetBehavior.STATE_EXPANDED).isTrue { + behaviour.state = AnchorSheetBehavior.STATE_EXPANDED + } + } + }) + scrollView.setOnScrollChangeListener { _: NestedScrollView?, _: Int, _: Int, _: Int, _: Int -> + (behaviour.state != AnchorSheetBehavior.STATE_COLLAPSED).isTrue { + behaviour.state = AnchorSheetBehavior.STATE_COLLAPSED + } + } + followers.setOnClickListener { if (pager.adapter != null) selectTab(FragmentType.FOLLOWERS) } + following.setOnClickListener { if (pager.adapter != null) selectTab(FragmentType.FOLLOWINGS) } + viewModel.getUserFromRemote(loginBundle) + } + + override fun onBackPressed(): Boolean { + return if (behaviour.state == AnchorSheetBehavior.STATE_COLLAPSED) { + true + } else { + behaviour.state = AnchorSheetBehavior.STATE_COLLAPSED + false + } + } + + private fun observeChanges() { + viewModel.getUser(loginBundle).observeNotNull(this) { user -> + initUI(user) + } + + viewModel.isBlocked.observeNotNull(this) { + blockBtn.isEnabled = true + blockBtn.text = if (it) getString(R.string.unblock) else getString(R.string.block) + } + } + + @SuppressLint("SetTextI18n") + private fun initUI(user: UserModel) { + addDisposal(loginRepositoryProvider.isMe(loginBundle) { isMe -> + actionsHolder.isVisible = !isMe + blockBtn.isVisible = !isMe + blockBtn.isEnabled = false + if (!isMe) viewModel.checkBlockingState(loginBundle) + }) + following.text = "${getString(R.string.following)}: ${user.following?.totalCount ?: 0}" + followers.text = "${getString(R.string.followers)}: ${user.followers?.totalCount ?: 0}" + swipeRefresh.isRefreshing = false + followBtn.setText(if (user.viewerIsFollowing == true) R.string.unfollow else R.string.follow) + followBtn.setOnClickListener { viewModel.followUnfollowUser(loginBundle, user.viewerIsFollowing) } + description.isVisible = user.bio?.isNotEmpty() == true + description.text = user.bio ?: "" + email.isVisible = user.email?.isNotEmpty() == true + email.text = user.email + company.isVisible = user.company?.isNotEmpty() == true + company.text = user.company ?: "" + joined.text = user.createdAt?.timeAgo() ?: "" + joined.isVisible = true + location.isVisible = user.location?.isNotEmpty() == true + location.text = user.location ?: "" + name.isVisible = user.name?.isNotEmpty() == true + name.text = user.name ?: "" + developerProgram.isVisible = user.isDeveloperProgramMember == true + user.organizations?.nodes?.let { orgs -> + organizationHolder.isVisible = orgs.isNotEmpty() + orgsAdapter.insertNew(orgs) + } + user.pinnedRepositories?.pinnedRepositories?.let { nodes -> + pinnedHolder.isVisible = nodes.isNotEmpty() + pinnedReposAdapter.insertNew(nodes) + } + blockBtn.setOnClickListener { viewModel.blockUnblockUser(loginBundle) } + userImageView.loadAvatar(user.avatarUrl) + + if (pager.adapter == null) { + pager.offscreenPageLimit = 5 + pager.adapter = adapter + tabs.setupWithViewPager(pager) + val type = FragmentType.getTypeSafely(tabBundle ?: "") + selectTab(type) + } + } + + private fun selectTab(type: FragmentType?) { + type?.let { + val index = adapter.getIndex(it) + if (index == -1) return + pager.currentItem = index + } + } + + companion object { + const val TAG = "ProfileFragment" + + fun newInstance(login: String, tab: String? = null) = ProfileFragment().apply { + arguments = Bundle().apply { + putString(EXTRA, login) + putString(EXTRA_TWO, tab) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/profile/fragment/viewmodel/ProfileViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/profile/fragment/viewmodel/ProfileViewModel.kt new file mode 100644 index 000000000..915af34e8 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/profile/fragment/viewmodel/ProfileViewModel.kt @@ -0,0 +1,71 @@ +package com.fastaccess.github.ui.modules.profile.fragment.viewmodel + +import androidx.lifecycle.MutableLiveData +import com.fastaccess.github.base.BaseViewModel +import com.fastaccess.github.usecase.user.BlockUnblockUserUseCase +import com.fastaccess.github.usecase.user.FollowUnfollowUserUseCase +import com.fastaccess.github.usecase.user.IsUserBlockedUseCase +import com.fastaccess.github.usecase.user.UserUseCase +import javax.inject.Inject + +/** + * Created by Kosh on 26.08.18. + */ +class ProfileViewModel @Inject constructor( + private val userUseCase: UserUseCase, + private val unblockUserUseCase: BlockUnblockUserUseCase, + private val blockedUseCase: IsUserBlockedUseCase, + private val followUnfollowUserUseCase: FollowUnfollowUserUseCase +) : com.fastaccess.github.base.BaseViewModel() { + + var isFirstLaunch = true + val isBlocked = MutableLiveData() + + fun getUser(login: String) = userUseCase.getUser(login) + + fun getUserFromRemote(login: String) { + userUseCase.login = login + add( + callApi(userUseCase.buildObservable()) + .subscribe({}, { it.printStackTrace() }) + ) + } + + fun checkBlockingState(login: String) { + blockedUseCase.login = login + add( + blockedUseCase.buildObservable() + .subscribe({ + isBlocked.postValue(it) + }, { + isBlocked.postValue(false) + it.printStackTrace() + }) + ) + } + + fun blockUnblockUser(login: String) { + unblockUserUseCase.login = login + unblockUserUseCase.block = isBlocked.value == false + add( + callApi(unblockUserUseCase.buildObservable()) + .subscribe({ isBlocked.postValue(it) }, { it.printStackTrace() }) + ) + } + + fun followUnfollowUser( + login: String, + viewerIsFollowing: Boolean? + ) { + followUnfollowUserUseCase.login = login + followUnfollowUserUseCase.follow = viewerIsFollowing == false + justSubscribe(followUnfollowUserUseCase.buildObservable()) + } + + override fun onCleared() { + super.onCleared() + userUseCase.dispose() + unblockUserUseCase.dispose() + blockedUseCase.dispose() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/profile/gists/ProfileGistsFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/profile/gists/ProfileGistsFragment.kt new file mode 100644 index 000000000..eb73f22ba --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/profile/gists/ProfileGistsFragment.kt @@ -0,0 +1,73 @@ +package com.fastaccess.github.ui.modules.profile.gists + +import android.os.Bundle +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.data.model.FragmentType +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.addDivider +import com.fastaccess.github.base.extensions.isConnected +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.ui.adapter.ProfileGistsAdapter +import com.fastaccess.github.base.adapter.CurrentState +import com.fastaccess.github.ui.modules.profile.gists.viewmodel.ProfileGistsViewModel +import com.fastaccess.github.extensions.observeNotNull + +import javax.inject.Inject + +/** + * Created by Kosh on 14.10.18. + */ +class ProfileGistsFragment : com.fastaccess.github.base.BaseFragment() { + + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(ProfileGistsViewModel::class.java) } + private val loginBundle: String by lazy { arguments?.getString(EXTRA) ?: "" } + private val adapter by lazy { ProfileGistsAdapter() } + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = viewModel + override fun layoutRes(): Int = R.layout.simple_refresh_list_layout + + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + recyclerView.adapter = adapter + recyclerView.addDivider() + recyclerView.setEmptyView(emptyLayout) + fastScroller.attachRecyclerView(recyclerView) + if (savedInstanceState == null) isConnected().isTrue { viewModel.loadGists(loginBundle, true) } + swipeRefresh.setOnRefreshListener { + if (isConnected()) { + recyclerView.resetScrollState() + viewModel.loadGists(loginBundle, true) + } else { + swipeRefresh.isRefreshing = false + } + } + recyclerView.addOnLoadMore { isConnected().isTrue { viewModel.loadGists(loginBundle) } } + listenToChanges() + } + + private fun listenToChanges() { + viewModel.progress.observeNotNull(this) { + adapter.currentState = if (it) CurrentState.LOADING else CurrentState.DONE + } + + viewModel.getGists(loginBundle).observeNotNull(this) { + adapter.currentState = CurrentState.DONE + adapter.submitList(it) + } + + viewModel.counter.observeNotNull(this) { + postCount(FragmentType.GISTS, it) + } + } + + companion object { + fun newInstance(login: String) = ProfileGistsFragment().apply { + arguments = Bundle().apply { + putString(EXTRA, login) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/profile/gists/viewmodel/ProfileGistsViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/profile/gists/viewmodel/ProfileGistsViewModel.kt new file mode 100644 index 000000000..e0c61e196 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/profile/gists/viewmodel/ProfileGistsViewModel.kt @@ -0,0 +1,48 @@ +package com.fastaccess.github.ui.modules.profile.gists.viewmodel + +import androidx.lifecycle.LiveData +import androidx.paging.LivePagedListBuilder +import androidx.paging.PagedList +import com.fastaccess.data.model.PageInfoModel +import com.fastaccess.data.persistence.models.ProfileGistModel +import com.fastaccess.data.repository.UserGistsRepository +import javax.inject.Inject + +/** + * Created by Kosh on 14.10.18. + */ +class ProfileGistsViewModel @Inject constructor( + private val reposProvider: UserGistsRepository +) : com.fastaccess.github.base.BaseViewModel() { + + private var pageInfo: PageInfoModel? = null + + fun getGists(login: String): LiveData> { + val dataSourceFactory = reposProvider.getGists(login) + val config = PagedList.Config.Builder() + .setPrefetchDistance(com.fastaccess.github.base.utils.PRE_FETCH_SIZE) + .setPageSize(com.fastaccess.github.base.utils.PAGE_SIZE) + .build() + return LivePagedListBuilder(dataSourceFactory, config) + .build() + } + + fun loadGists( + login: String, + reload: Boolean = false + ) { + if (reload) { + pageInfo = null + } + val pageInfo = pageInfo + if (!reload && (pageInfo != null && !pageInfo.hasNextPage)) return + add(callApi(reposProvider.getGistsFromRemote(login, if (hasNext()) pageInfo?.endCursor else null)) + .subscribe({ + this.pageInfo = it.pageInfo + postCounter(it.totalCount) + }, { it.printStackTrace() }) + ) + } + + fun hasNext() = pageInfo?.hasNextPage == true +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/profile/orgs/userorgs/UserOrgsFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/profile/orgs/userorgs/UserOrgsFragment.kt new file mode 100644 index 000000000..b252b3ac2 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/profile/orgs/userorgs/UserOrgsFragment.kt @@ -0,0 +1,68 @@ +package com.fastaccess.github.ui.modules.profile.orgs.userorgs + +import android.os.Bundle +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.addDivider +import com.fastaccess.github.base.extensions.isConnected +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.github.ui.adapter.OrganizationsAdapter +import com.fastaccess.github.base.adapter.CurrentState +import com.fastaccess.github.ui.modules.profile.orgs.userorgs.viewmodel.UserOrgsViewModel + +import timber.log.Timber +import javax.inject.Inject + +/** + * Created by Kosh on 2018-11-26. + */ +class UserOrgsFragment : com.fastaccess.github.base.BaseFragment() { + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(UserOrgsViewModel::class.java) } + private val adapter by lazy { + OrganizationsAdapter { url -> + Timber.e(url) + } + } + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = viewModel + override fun layoutRes(): Int = R.layout.rounded_toolbar_fragment_list_layout + + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + setupToolbar(R.string.organizations) + recyclerView.adapter = adapter + recyclerView.addDivider() + recyclerView.setEmptyView(emptyLayout) + fastScroller.attachRecyclerView(recyclerView) + if (savedInstanceState == null) isConnected().isTrue { viewModel.loadOrgs(true) } + swipeRefresh.setOnRefreshListener { + if (isConnected()) { + recyclerView.resetScrollState() + viewModel.loadOrgs(true) + } else { + swipeRefresh.isRefreshing = false + } + } + recyclerView.addOnLoadMore { isConnected().isTrue { viewModel.loadOrgs() } } + listenToChanges() + } + + private fun listenToChanges() { + viewModel.progress.observeNotNull(this) { + adapter.currentState = if (it) CurrentState.LOADING else CurrentState.DONE + } + + viewModel.getOrgs().observeNotNull(this) { + adapter.currentState = CurrentState.DONE + adapter.submitList(it) + } + } + + + companion object { + fun newInstance() = UserOrgsFragment() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/profile/orgs/userorgs/viewmodel/UserOrgsViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/profile/orgs/userorgs/viewmodel/UserOrgsViewModel.kt new file mode 100644 index 000000000..580ced23e --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/profile/orgs/userorgs/viewmodel/UserOrgsViewModel.kt @@ -0,0 +1,42 @@ +package com.fastaccess.github.ui.modules.profile.orgs.userorgs.viewmodel + +import androidx.lifecycle.LiveData +import androidx.paging.LivePagedListBuilder +import androidx.paging.PagedList +import com.fastaccess.data.model.PageInfoModel +import com.fastaccess.data.persistence.models.OrganizationModel +import com.fastaccess.data.repository.OrgRepository +import javax.inject.Inject + +/** + * Created by Kosh on 2018-11-26. + */ +class UserOrgsViewModel @Inject constructor( + private val provider: OrgRepository +) : com.fastaccess.github.base.BaseViewModel() { + + private var pageInfo: PageInfoModel? = null + + fun getOrgs(): LiveData> { + val dataSourceFactory = provider.getOrgs() + val config = PagedList.Config.Builder() + .setPrefetchDistance(com.fastaccess.github.base.utils.PRE_FETCH_SIZE) + .setPageSize(com.fastaccess.github.base.utils.PAGE_SIZE) + .build() + return LivePagedListBuilder(dataSourceFactory, config) + .build() + } + + fun loadOrgs(reload: Boolean = false) { + val pageInfo = pageInfo + if (!reload && (pageInfo != null && !pageInfo.hasNextPage)) return + val cursor = if (hasNext()) pageInfo?.endCursor else null + + justSubscribe(callApi(provider.getOrgFromRemote(cursor)) + .doOnNext { + this.pageInfo = it.pageInfo + }) + } + + fun hasNext() = pageInfo?.hasNextPage == true +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/profile/repos/ProfileReposFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/profile/repos/ProfileReposFragment.kt new file mode 100644 index 000000000..626b8bff2 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/profile/repos/ProfileReposFragment.kt @@ -0,0 +1,73 @@ +package com.fastaccess.github.ui.modules.profile.repos + +import android.os.Bundle +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.data.model.FragmentType +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.addDivider +import com.fastaccess.github.base.extensions.isConnected +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.github.ui.adapter.ProfileReposAdapter +import com.fastaccess.github.base.adapter.CurrentState +import com.fastaccess.github.ui.modules.profile.repos.viewmodel.ProfileReposViewModel + +import javax.inject.Inject + +/** + * Created by Kosh on 06.10.18. + */ +class ProfileReposFragment : com.fastaccess.github.base.BaseFragment() { + + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(ProfileReposViewModel::class.java) } + private val loginBundle: String by lazy { arguments?.getString(EXTRA) ?: "" } + private val adapter by lazy { ProfileReposAdapter() } + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = viewModel + override fun layoutRes(): Int = R.layout.simple_refresh_list_layout + + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + recyclerView.adapter = adapter + recyclerView.addDivider() + recyclerView.setEmptyView(emptyLayout) + fastScroller.attachRecyclerView(recyclerView) + if (savedInstanceState == null) isConnected().isTrue { viewModel.loadRepos(loginBundle, true) } + swipeRefresh.setOnRefreshListener { + if (isConnected()) { + recyclerView.resetScrollState() + viewModel.loadRepos(loginBundle, true) + } else { + swipeRefresh.isRefreshing = false + } + } + recyclerView.addOnLoadMore { isConnected().isTrue { viewModel.loadRepos(loginBundle) } } + listenToChanges() + } + + private fun listenToChanges() { + viewModel.progress.observeNotNull(this) { + adapter.currentState = if (it) CurrentState.LOADING else CurrentState.DONE + } + + viewModel.repos(loginBundle).observeNotNull(this) { + adapter.currentState = CurrentState.DONE + adapter.submitList(it) + } + + viewModel.counter.observeNotNull(this) { + postCount(FragmentType.REPOS, it) + } + } + + companion object { + fun newInstance(login: String) = ProfileReposFragment().apply { + arguments = Bundle().apply { + putString(EXTRA, login) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/profile/repos/viewmodel/ProfileReposViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/profile/repos/viewmodel/ProfileReposViewModel.kt new file mode 100644 index 000000000..3d82aff1e --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/profile/repos/viewmodel/ProfileReposViewModel.kt @@ -0,0 +1,47 @@ +package com.fastaccess.github.ui.modules.profile.repos.viewmodel + +import androidx.lifecycle.LiveData +import androidx.paging.LivePagedListBuilder +import androidx.paging.PagedList +import com.fastaccess.data.model.PageInfoModel +import com.fastaccess.data.persistence.models.ProfileRepoModel +import com.fastaccess.data.repository.UserReposRepository +import javax.inject.Inject + +/** + * Created by Kosh on 08.10.18. + */ +class ProfileReposViewModel @Inject constructor( + private val reposProvider: UserReposRepository +) : com.fastaccess.github.base.BaseViewModel() { + + private var pageInfo: PageInfoModel? = null + + fun repos(login: String): LiveData> { + val dataSourceFactory = reposProvider.getRepos(login) + val config = PagedList.Config.Builder() + .setPrefetchDistance(com.fastaccess.github.base.utils.PRE_FETCH_SIZE) + .setPageSize(com.fastaccess.github.base.utils.PAGE_SIZE) + .build() + return LivePagedListBuilder(dataSourceFactory, config) + .build() + } + + fun loadRepos( + login: String, + reload: Boolean = false + ) { + if (reload) { + pageInfo = null + } + val pageInfo = pageInfo + if (!reload && (pageInfo != null && !pageInfo.hasNextPage)) return + justSubscribe(reposProvider.getReposFromRemote(login, if (hasNext()) pageInfo?.endCursor else null) + .doOnNext { + this.pageInfo = it.pageInfo + postCounter(it.totalCount) + }) + } + + fun hasNext() = pageInfo?.hasNextPage == true +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/profile/starred/ProfileStarredReposFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/profile/starred/ProfileStarredReposFragment.kt new file mode 100644 index 000000000..91bdf43a0 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/profile/starred/ProfileStarredReposFragment.kt @@ -0,0 +1,73 @@ +package com.fastaccess.github.ui.modules.profile.starred + +import android.os.Bundle +import android.view.View +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.data.model.FragmentType +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.addDivider +import com.fastaccess.github.base.extensions.isConnected +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.ui.adapter.ProfileStarredReposAdapter +import com.fastaccess.github.base.adapter.CurrentState +import com.fastaccess.github.ui.modules.profile.starred.viewmodel.ProfileStarredReposViewModel + +import javax.inject.Inject + +/** + * Created by Kosh on 13.10.18. + */ +class ProfileStarredReposFragment : com.fastaccess.github.base.BaseFragment() { + + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(ProfileStarredReposViewModel::class.java) } + private val loginBundle: String by lazy { arguments?.getString(EXTRA) ?: "" } + private val adapter by lazy { ProfileStarredReposAdapter() } + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = viewModel + override fun layoutRes(): Int = R.layout.simple_refresh_list_layout + + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + recyclerView.adapter = adapter + recyclerView.addDivider() + recyclerView.setEmptyView(emptyLayout) + fastScroller.attachRecyclerView(recyclerView) + if (savedInstanceState == null) isConnected().isTrue { viewModel.loadStarredRepos(loginBundle, true) } + swipeRefresh.setOnRefreshListener { + if (isConnected()) { + recyclerView.resetScrollState() + viewModel.loadStarredRepos(loginBundle, true) + } else { + swipeRefresh.isRefreshing = false + } + } + recyclerView.addOnLoadMore { isConnected().isTrue { viewModel.loadStarredRepos(loginBundle) } } + listenToChanges() + } + + private fun listenToChanges() { + viewModel.progress.observeNotNull(this) { + adapter.currentState = if (it) CurrentState.LOADING else CurrentState.DONE + } + + viewModel.starredRepos(loginBundle).observeNotNull(this) { + adapter.currentState = CurrentState.DONE + adapter.submitList(it) + } + + viewModel.counter.observeNotNull(this) { + postCount(FragmentType.STARRED, it) + } + } + + companion object { + fun newInstance(login: String) = ProfileStarredReposFragment().apply { + arguments = Bundle().apply { + putString(EXTRA, login) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/profile/starred/viewmodel/ProfileStarredReposViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/profile/starred/viewmodel/ProfileStarredReposViewModel.kt new file mode 100644 index 000000000..d9b65d7de --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/profile/starred/viewmodel/ProfileStarredReposViewModel.kt @@ -0,0 +1,51 @@ +package com.fastaccess.github.ui.modules.profile.starred.viewmodel + +import androidx.lifecycle.LiveData +import androidx.paging.LivePagedListBuilder +import androidx.paging.PagedList +import com.fastaccess.data.model.PageInfoModel +import com.fastaccess.data.persistence.models.ProfileStarredRepoModel +import com.fastaccess.data.repository.UserStarredReposRepository +import javax.inject.Inject + +/** + * Created by Kosh on 13.10.18. + */ +class ProfileStarredReposViewModel @Inject constructor( + private val reposProvider: UserStarredReposRepository +) : com.fastaccess.github.base.BaseViewModel() { + + private var pageInfo: PageInfoModel? = null + + fun starredRepos(login: String): LiveData> { + val dataSourceFactory = reposProvider.getStarredRepos(login) + val config = PagedList.Config.Builder() + .setPrefetchDistance(com.fastaccess.github.base.utils.PRE_FETCH_SIZE) + .setPageSize(com.fastaccess.github.base.utils.PAGE_SIZE) + .build() + return LivePagedListBuilder(dataSourceFactory, config) + .build() + } + + fun loadStarredRepos( + login: String, + reload: Boolean = false + ) { + if (reload) { + pageInfo = null + } + val pageInfo = pageInfo + if (!reload && (pageInfo != null && !pageInfo.hasNextPage)) return + add( + callApi(reposProvider.getStarredReposFromRemote(login, if (hasNext()) pageInfo?.endCursor else null)) + .subscribe({ + this.pageInfo = it.pageInfo + postCounter(it.totalCount) + }, { + it.printStackTrace() + }) + ) + } + + fun hasNext() = pageInfo?.hasNextPage == true +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/quickmsg/QuickMessageBottomSheetDialog.kt b/app/src/main/java/com/fastaccess/github/ui/modules/quickmsg/QuickMessageBottomSheetDialog.kt new file mode 100644 index 000000000..c236273e0 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/quickmsg/QuickMessageBottomSheetDialog.kt @@ -0,0 +1,57 @@ +package com.fastaccess.github.ui.modules.quickmsg + +import android.content.Context +import android.os.Bundle +import android.view.View +import androidx.fragment.app.FragmentManager +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.asString +import com.fastaccess.github.base.utils.EXTRA +import kotlinx.android.synthetic.main.quick_input_layout.* + +class QuickMessageBottomSheetDialog : com.fastaccess.github.base.BaseBottomSheetDialogFragment() { + + private var callback: QuickMessageCallback? = null + + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = null + override fun layoutRes(): Int = R.layout.quick_input_layout + override fun isFullScreen(): Boolean = true + + override fun onAttach(context: Context) { + super.onAttach(context) + callback = when { + parentFragment is QuickMessageCallback -> parentFragment as QuickMessageCallback + context is QuickMessageCallback -> context + else -> throw IllegalAccessException("your $parentFragment or $context must implement QuickMessageCallback") + } + } + + override fun onDetach() { + callback = null + super.onDetach() + } + + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + toolbarTitle.text = arguments?.getString(EXTRA) ?: getString(R.string.message) + submit.setOnClickListener { + val text = editText.asString() + if (text.isNotEmpty()) { + callback?.onMessageEntered(text, arguments) + dismiss() + } + } + } + + companion object { + fun show(fragmentManager: FragmentManager, bundle: Bundle) { + QuickMessageBottomSheetDialog().apply { + arguments = bundle + show(fragmentManager, "QuickMessageBottomSheetDialog") + } + } + } + + interface QuickMessageCallback { + fun onMessageEntered(msg: String, bundle: Bundle?) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/routing/RoutingActivity.kt b/app/src/main/java/com/fastaccess/github/ui/modules/routing/RoutingActivity.kt new file mode 100644 index 000000000..2cb944abd --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/routing/RoutingActivity.kt @@ -0,0 +1,42 @@ +package com.fastaccess.github.ui.modules.routing + +import android.app.Activity +import android.os.Bundle +import com.airbnb.deeplinkdispatch.DeepLinkHandler +import com.fastaccess.fasthub.deeplink.CommitDeepLinkModule +import com.fastaccess.fasthub.deeplink.CommitDeepLinkModuleLoader +import com.fastaccess.fasthub.deeplink.ReviewDeepLinkModule +import com.fastaccess.fasthub.deeplink.ReviewDeepLinkModuleLoader +import com.fastaccess.github.editor.deeplink.EditorDeepLinkModule +import com.fastaccess.github.editor.deeplink.EditorDeepLinkModuleLoader +import timber.log.Timber + +/** + * Created by Kosh on 26.09.18. + */ +@DeepLinkHandler( + value = [ + RoutingModule::class, + CommitDeepLinkModule::class, + EditorDeepLinkModule::class, + ReviewDeepLinkModule::class + ] +) +class RoutingActivity : Activity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + val delegate = DeepLinkDelegate( + RoutingModuleLoader(), + CommitDeepLinkModuleLoader(), + EditorDeepLinkModuleLoader(), + ReviewDeepLinkModuleLoader() + ) + .dispatchFrom(this) + Timber.e("$delegate") + if (!delegate.isSuccessful) { + //TODO FIXME (launch chrometab) + } + finish() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/routing/RoutingModule.kt b/app/src/main/java/com/fastaccess/github/ui/modules/routing/RoutingModule.kt new file mode 100644 index 000000000..3e4000cfa --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/routing/RoutingModule.kt @@ -0,0 +1,9 @@ +package com.fastaccess.github.ui.modules.routing + +import com.airbnb.deeplinkdispatch.DeepLinkModule + +/** + * Created by Kosh on 26.09.18. + */ +@DeepLinkModule +class RoutingModule \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/search/filter/FilterSearchBottomSheet.kt b/app/src/main/java/com/fastaccess/github/ui/modules/search/filter/FilterSearchBottomSheet.kt new file mode 100644 index 000000000..9ed132c22 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/search/filter/FilterSearchBottomSheet.kt @@ -0,0 +1,247 @@ +package com.fastaccess.github.ui.modules.search.filter + +import android.content.Context +import android.os.Bundle +import android.view.View +import androidx.core.os.bundleOf +import androidx.core.view.isVisible +import com.evernote.android.state.State +import com.fastaccess.data.model.parcelable.FilterByRepo +import com.fastaccess.data.model.parcelable.FilterIssuesPrsModel +import com.fastaccess.data.model.parcelable.FilterSearchModel +import com.fastaccess.github.R +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.extensions.isTrue +import com.google.android.material.chip.Chip +import kotlinx.android.synthetic.main.filter_search_layout.* + +/** + * Created by Kosh on 19.01.19. + */ +class FilterSearchBottomSheet : com.fastaccess.github.base.BaseFragment() { + + @State lateinit var model: FilterSearchModel + private var callback: FilterSearchCallback? = null + + override fun onAttach(context: Context) { + super.onAttach(context) + callback = when { + context is FilterSearchCallback -> context + parentFragment is FilterSearchCallback -> parentFragment as FilterSearchCallback + parentFragment?.parentFragment is FilterSearchCallback -> parentFragment?.parentFragment as FilterSearchCallback // deep hierarchy + else -> null + } + } + + override fun onDetach() { + callback = null + super.onDetach() + } + + override fun layoutRes(): Int = R.layout.filter_search_layout + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = null + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + if (savedInstanceState == null) { + model = (arguments?.getParcelable(EXTRA) as? FilterSearchModel) ?: FilterSearchModel() + } + setupToolbar(R.string.filter) + submit.setOnClickListener { + model.filterByRepo.name = limitByEditText.text?.toString() + model.filterByRepo.language = languageEditText.text?.toString() + callback?.onFilterApplied(model) + (parentFragment as? com.fastaccess.github.base.BaseBottomSheetDialogFragment)?.dismiss() + } + initState() + } + + private fun initState() { + when (model.searchBy) { + FilterSearchModel.SearchBy.REPOS -> { + filterIssuesPr.isVisible = false + filterRepos.isVisible = true + initRepoCheckState() + initRepoCheckListener() + } + FilterSearchModel.SearchBy.ISSUES -> { + filterRepos.isVisible = false + filterIssuesPr.isVisible = true + reviewRequest.isVisible = false + searchType.check(R.id.issues) + initIssuePrCheckState() + initIssuesPrsCheckListener() + } + FilterSearchModel.SearchBy.PRS -> { + filterRepos.isVisible = false + filterIssuesPr.isVisible = true + reviewRequest.isVisible = true + searchType.check(R.id.prs) + initIssuePrCheckState() + initIssuesPrsCheckListener() + } + FilterSearchModel.SearchBy.USERS -> { + searchType.check(R.id.users) + filterIssuesPr.isVisible = false + filterRepos.isVisible = false + } + FilterSearchModel.SearchBy.NONE -> { + filterIssuesPr.isVisible = false + filterRepos.isVisible = false + } + } + + searchType.setOnCheckedChangeListener { _, id -> + when (id) { + -1 -> model = FilterSearchModel() + R.id.repos -> { + filterIssuesPr.isVisible = false + filterRepos.isVisible = true + model.searchBy = FilterSearchModel.SearchBy.REPOS + initRepoCheckListener() + } + R.id.prs, R.id.issues -> { + filterIssuesPr.isVisible = true + reviewRequest.isVisible = false + model.searchBy = FilterSearchModel.SearchBy.ISSUES + (id == R.id.prs).isTrue { + model.searchBy = FilterSearchModel.SearchBy.PRS + model.filterIssuesPrsModel.isPr = true + reviewRequest.isVisible = true + } + filterRepos.isVisible = false + initIssuesPrsCheckListener() + } + R.id.users -> { + model.searchBy = FilterSearchModel.SearchBy.USERS + filterIssuesPr.isVisible = false + filterRepos.isVisible = false + } + } + } + } + + private fun initRepoCheckState() { + searchType.check(R.id.repos) + model.filterByRepo.let { model -> + searchIn.check(when (model.filterByRepoIn) { + FilterByRepo.FilterByRepoIn.ALL -> R.id.all + FilterByRepo.FilterByRepoIn.NAME -> R.id.name + FilterByRepo.FilterByRepoIn.DESCRIPTION -> R.id.description + FilterByRepo.FilterByRepoIn.README -> R.id.readme + }) + model.filterByRepoLimitBy?.let { limit -> + limitBy.check(when (limit) { + FilterByRepo.FilterByRepoLimitBy.USERNAME -> R.id.username + FilterByRepo.FilterByRepoLimitBy.ORG -> R.id.org + }) + limitByText.isVisible = true + } + + limitByEditText.setText(model.name ?: "") + languageEditText.setText(model.language ?: "") + } + } + + private fun initIssuePrCheckState() { + model.filterIssuesPrsModel.let { model -> + reviewRequest.isVisible = model.isPr == true + filter.check(when (model.searchBy) { + FilterIssuesPrsModel.SearchBy.CREATED -> R.id.created + FilterIssuesPrsModel.SearchBy.ASSIGNED -> R.id.assigned + FilterIssuesPrsModel.SearchBy.MENTIONED -> R.id.mentioned + FilterIssuesPrsModel.SearchBy.REVIEW_REQUESTS -> R.id.reviewRequest + }) + type.check(when (model.searchType) { + FilterIssuesPrsModel.SearchType.OPEN -> R.id.open + FilterIssuesPrsModel.SearchType.CLOSED -> R.id.closed + }) + visibility.check(when (model.searchVisibility) { + FilterIssuesPrsModel.SearchVisibility.BOTH -> R.id.bothVisibility + FilterIssuesPrsModel.SearchVisibility.PUBLIC -> R.id.publicRepos + FilterIssuesPrsModel.SearchVisibility.PRIVATE -> R.id.privateRepos + }) + sort.check(when (model.searchSortBy) { + FilterIssuesPrsModel.SearchSortBy.NEWEST -> R.id.newest + FilterIssuesPrsModel.SearchSortBy.OLDEST -> R.id.oldest + FilterIssuesPrsModel.SearchSortBy.MOST_COMMENTED -> R.id.mostCommented + FilterIssuesPrsModel.SearchSortBy.LEAST_COMMENTED -> R.id.leastCommented + FilterIssuesPrsModel.SearchSortBy.RECENTLY_UPDATED -> R.id.recentlyUpdated + FilterIssuesPrsModel.SearchSortBy.LEAST_RECENTLY_UPDATED -> R.id.leastRecentlyUpdated + }) + } + } + + private fun initRepoCheckListener() { + searchIn.setOnCheckedChangeListener { _, id -> + when (id) { + R.id.all -> model.filterByRepo.filterByRepoIn = FilterByRepo.FilterByRepoIn.ALL + R.id.name -> model.filterByRepo.filterByRepoIn = FilterByRepo.FilterByRepoIn.NAME + R.id.description -> model.filterByRepo.filterByRepoIn = FilterByRepo.FilterByRepoIn.DESCRIPTION + R.id.readme -> model.filterByRepo.filterByRepoIn = FilterByRepo.FilterByRepoIn.README + } + } + limitBy.setOnCheckedChangeListener { group, id -> + when (id) { + R.id.username -> model.filterByRepo.filterByRepoLimitBy = FilterByRepo.FilterByRepoLimitBy.USERNAME + R.id.org -> model.filterByRepo.filterByRepoLimitBy = FilterByRepo.FilterByRepoLimitBy.ORG + -1 -> { + model.filterByRepo.filterByRepoLimitBy = null + limitByText.editText?.setText("") + } + } + limitByText.isVisible = group.checkedChipId != -1 + } + languages.setOnCheckedChangeListener { chipGroup, id -> + if (id != -1) { + languageEditText.setText(chipGroup.findViewById(id).text) + } else { + languageEditText.setText("") + } + } + } + + private fun initIssuesPrsCheckListener() { + model.filterIssuesPrsModel.let { model -> + filter.setOnCheckedChangeListener { _, id -> + when (id) { + R.id.created -> model.searchBy = FilterIssuesPrsModel.SearchBy.CREATED + R.id.assigned -> model.searchBy = FilterIssuesPrsModel.SearchBy.ASSIGNED + R.id.mentioned -> model.searchBy = FilterIssuesPrsModel.SearchBy.MENTIONED + R.id.reviewRequest -> model.searchBy = FilterIssuesPrsModel.SearchBy.REVIEW_REQUESTS + } + } + type.setOnCheckedChangeListener { _, id -> + when (id) { + R.id.open -> model.searchType = FilterIssuesPrsModel.SearchType.OPEN + R.id.closed -> model.searchType = FilterIssuesPrsModel.SearchType.CLOSED + } + } + visibility.setOnCheckedChangeListener { _, id -> + when (id) { + R.id.bothVisibility -> model.searchVisibility = FilterIssuesPrsModel.SearchVisibility.BOTH + R.id.privateRepos -> model.searchVisibility = FilterIssuesPrsModel.SearchVisibility.PRIVATE + R.id.publicRepos -> model.searchVisibility = FilterIssuesPrsModel.SearchVisibility.PUBLIC + } + } + sort.setOnCheckedChangeListener { _, id -> + when (id) { + R.id.newest -> model.searchSortBy = FilterIssuesPrsModel.SearchSortBy.NEWEST + R.id.oldest -> model.searchSortBy = FilterIssuesPrsModel.SearchSortBy.OLDEST + R.id.mostCommented -> model.searchSortBy = FilterIssuesPrsModel.SearchSortBy.MOST_COMMENTED + R.id.leastCommented -> model.searchSortBy = FilterIssuesPrsModel.SearchSortBy.LEAST_COMMENTED + R.id.recentlyUpdated -> model.searchSortBy = FilterIssuesPrsModel.SearchSortBy.RECENTLY_UPDATED + R.id.leastRecentlyUpdated -> model.searchSortBy = FilterIssuesPrsModel.SearchSortBy.LEAST_RECENTLY_UPDATED + } + } + } + } + + companion object { + fun newInstance(model: FilterSearchModel) = FilterSearchBottomSheet().apply { + arguments = bundleOf(EXTRA to model) + } + } + + interface FilterSearchCallback { + fun onFilterApplied(model: FilterSearchModel) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/search/fragment/SearchFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/search/fragment/SearchFragment.kt new file mode 100644 index 000000000..9ea224bdb --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/search/fragment/SearchFragment.kt @@ -0,0 +1,150 @@ +package com.fastaccess.github.ui.modules.search.fragment + +import android.os.Bundle +import android.text.Editable +import android.view.View +import android.view.inputmethod.EditorInfo +import android.widget.ArrayAdapter +import androidx.core.view.isVisible +import androidx.core.widget.doAfterTextChanged +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.data.model.parcelable.FilterSearchModel +import com.fastaccess.data.persistence.models.SuggestionsModel +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.addDivider +import com.fastaccess.github.base.extensions.asString +import com.fastaccess.github.base.extensions.hideKeyboard +import com.fastaccess.github.base.extensions.isConnected +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.extensions.observeNull +import com.fastaccess.github.extensions.route +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.github.ui.adapter.MyIssuesPrsAdapter +import com.fastaccess.github.ui.adapter.SearchReposAdapter +import com.fastaccess.github.ui.adapter.ShortUsersAdapter +import com.fastaccess.github.ui.modules.multipurpose.MultiPurposeBottomSheetDialog +import com.fastaccess.github.ui.modules.multipurpose.MultiPurposeBottomSheetDialog.BottomSheetFragmentType.FILTER_SEARCH +import com.fastaccess.github.ui.modules.search.filter.FilterSearchBottomSheet +import com.fastaccess.github.ui.modules.search.fragment.viewmodel.FilterSearchViewModel +import kotlinx.android.synthetic.main.search_fragment_layout.* +import javax.inject.Inject + +/** + * Created by Kosh on 20.01.19. + */ +class SearchFragment : com.fastaccess.github.base.BaseFragment(), FilterSearchBottomSheet.FilterSearchCallback { + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(FilterSearchViewModel::class.java) } + private val issuesPrsAdapter by lazy { + MyIssuesPrsAdapter { + route(it.url) + } + } + private val reposAdapter by lazy { SearchReposAdapter() } + private val usersAdapter by lazy { + ShortUsersAdapter { url -> + requireContext().route(url) + } + } + + override fun layoutRes(): Int = R.layout.search_fragment_layout + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = viewModel + + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + recyclerView.addDivider() + recyclerView.setEmptyView(emptyLayout) + fastScroller.attachRecyclerView(recyclerView) + if (savedInstanceState == null) isConnected().isTrue { viewModel.loadData(true) } + swipeRefresh.setOnRefreshListener { + if (isConnected()) { + recyclerView.resetScrollState() + viewModel.loadData(true) + } else { + swipeRefresh.isRefreshing = false + } + } + recyclerView.addOnLoadMore { isConnected().isTrue { viewModel.loadData() } } + backBtn.setOnClickListener { activity?.onBackPressed() } + clear.setOnClickListener { searchEditText.setText("") } + filter.setOnClickListener { + val model = viewModel.filterModel.copy() + MultiPurposeBottomSheetDialog.show(childFragmentManager, FILTER_SEARCH, model) + } + + searchEditText.setAdapter(ArrayAdapter(requireContext(), android.R.layout.simple_list_item_1)) + + searchEditText.setOnEditorActionListener { v, actionId, _ -> + return@setOnEditorActionListener if (actionId == EditorInfo.IME_ACTION_DONE || + actionId == EditorInfo.IME_ACTION_SEARCH || + actionId == EditorInfo.IME_ACTION_GO) { + v.hideKeyboard() + if (viewModel.filterModel.searchBy == FilterSearchModel.SearchBy.NONE) { + filter.callOnClick() + } else { + onFilterApplied(viewModel.filterModel) + } + true + } else { + false + } + } + searchEditText.doAfterTextChanged { text -> + val show = !text.isNullOrEmpty() + if (show != clear.isVisible) { // prevent multiple hide/show + clear.isVisible = show + } + searchSuggestions(text) + } + + listenToChanges() + } + + override fun onFilterApplied(model: FilterSearchModel) { + if (searchEditText.asString().isEmpty()) { + viewModel.filterModel = model + searchEditText.error = getString(R.string.required_field) + } else { + model.searchQuery = searchEditText.asString() + searchEditText.error = null + isConnected().isTrue { viewModel.filter(model) } + } + } + + private fun listenToChanges() { + viewModel.issuesPrsData.observeNotNull(this) { + if (recyclerView.adapter !is MyIssuesPrsAdapter) { + recyclerView.adapter = issuesPrsAdapter + } + (recyclerView.adapter as? MyIssuesPrsAdapter)?.submitList(it) + } + viewModel.reposData.observeNotNull(this) { + if (recyclerView.adapter !is SearchReposAdapter) { + recyclerView.adapter = reposAdapter + } + (recyclerView.adapter as? SearchReposAdapter)?.submitList(it) + } + viewModel.usersData.observeNotNull(this) { + if (recyclerView.adapter !is ShortUsersAdapter) { + recyclerView.adapter = usersAdapter + } + (recyclerView.adapter as? ShortUsersAdapter)?.submitList(it) + } + } + + @Suppress("UNCHECKED_CAST") + private fun searchSuggestions(text: Editable?) { + if (!text.isNullOrEmpty()) { + viewModel.querySuggestion(text.toString()).observeNull(this) { + val adapter = searchEditText?.adapter as? ArrayAdapter ?: return@observeNull + adapter.clear() + it?.let { list -> adapter.addAll(list) } + } + } + } + + companion object { + fun newInstance() = SearchFragment() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/search/fragment/viewmodel/FilterSearchViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/search/fragment/viewmodel/FilterSearchViewModel.kt new file mode 100644 index 000000000..c85069f87 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/search/fragment/viewmodel/FilterSearchViewModel.kt @@ -0,0 +1,132 @@ +package com.fastaccess.github.ui.modules.search.fragment.viewmodel + +import androidx.lifecycle.MutableLiveData +import com.apollographql.apollo.api.Input +import com.fastaccess.data.model.PageInfoModel +import com.fastaccess.data.model.ShortRepoModel +import com.fastaccess.data.model.ShortUserModel +import com.fastaccess.data.model.parcelable.FilterSearchModel +import com.fastaccess.data.persistence.models.MyIssuesPullsModel +import com.fastaccess.data.repository.SuggestionRepository +import com.fastaccess.github.usecase.issuesprs.FilterIssuesUseCase +import com.fastaccess.github.usecase.issuesprs.FilterPullRequestsUseCase +import com.fastaccess.github.usecase.search.FilterSearchReposUseCase +import com.fastaccess.github.editor.usecase.FilterSearchUsersUseCase +import io.reactivex.internal.observers.EmptyCompletableObserver +import javax.inject.Inject + +/** + * Created by Kosh on 20.10.18. + */ +class FilterSearchViewModel @Inject constructor( + private val filterIssuesUseCase: FilterIssuesUseCase, + private val filterPullRequestsUseCase: FilterPullRequestsUseCase, + private val filterSearchReposUseCase: FilterSearchReposUseCase, + private val filterSearchUsersUseCase: FilterSearchUsersUseCase, + private val suggestionRepositoryProvider: SuggestionRepository +) : com.fastaccess.github.base.BaseViewModel() { + + private var pageInfo: PageInfoModel? = null + var filterModel = FilterSearchModel() + val issuesPrsList = arrayListOf() + val issuesPrsData = MutableLiveData>() + val reposList = arrayListOf() + val reposData = MutableLiveData>() + val usersList = arrayListOf() + val usersData = MutableLiveData>() + + override fun onCleared() { + super.onCleared() + filterIssuesUseCase.dispose() + filterPullRequestsUseCase.dispose() + filterSearchReposUseCase.dispose() + filterSearchUsersUseCase.dispose() + } + + + fun querySuggestion(query: String) = suggestionRepositoryProvider.getSuggestions(query) + + fun loadData(reload: Boolean = false) { + if (reload) { + this.issuesPrsList.clear() + this.reposList.clear() + this.usersList.clear() + pageInfo = null + } + val pageInfo = pageInfo + if (!reload && (pageInfo != null && !pageInfo.hasNextPage)) return + val cursor = if (hasNext()) pageInfo?.endCursor else null + when (filterModel.searchBy) { + FilterSearchModel.SearchBy.REPOS -> searchByRepo(filterModel, cursor) + FilterSearchModel.SearchBy.ISSUES -> searchByIssue(filterModel, cursor) + FilterSearchModel.SearchBy.PRS -> searchByPr(filterModel, cursor) + FilterSearchModel.SearchBy.USERS -> searchByUser(filterModel, cursor) + FilterSearchModel.SearchBy.NONE -> { + // Nothing! + } + } + suggestionRepositoryProvider.upsert(filterModel.searchQuery).subscribe(EmptyCompletableObserver()) + } + + private fun searchByRepo(filterModel: FilterSearchModel, cursor: String?) { + filterSearchReposUseCase.cursor = Input.optional(cursor) + filterSearchReposUseCase.keyword = filterModel.searchQuery + filterSearchReposUseCase.filterModel = filterModel.filterByRepo + justSubscribe(filterSearchReposUseCase.buildObservable() + .doOnNext { + this.usersData.postValue(null) + this.issuesPrsData.postValue(null) + this.pageInfo = it.first + this.reposList.addAll(it.second) + this.reposData.postValue(ArrayList(reposList)) + }) + } + + private fun searchByPr(filterModel: FilterSearchModel, cursor: String?) { + filterPullRequestsUseCase.cursor = Input.optional(cursor) + filterPullRequestsUseCase.filterModel = filterModel.filterIssuesPrsModel + filterPullRequestsUseCase.keyword = filterModel.searchQuery + justSubscribe(filterPullRequestsUseCase.buildObservable() + .doOnNext { + onRequestFinished(it) + }) + } + + private fun searchByIssue(filterModel: FilterSearchModel, cursor: String?) { + filterIssuesUseCase.cursor = Input.optional(cursor) + filterIssuesUseCase.filterModel = filterModel.filterIssuesPrsModel + filterIssuesUseCase.keyword = filterModel.searchQuery + justSubscribe(filterIssuesUseCase.buildObservable() + .doOnNext { + onRequestFinished(it) + }) + } + + private fun searchByUser(filterModel: FilterSearchModel, cursor: String?) { + filterSearchUsersUseCase.cursor = Input.optional(cursor) + filterSearchUsersUseCase.keyword = filterModel.searchQuery + justSubscribe(filterSearchUsersUseCase.buildObservable() + .doOnNext { + this.reposData.postValue(null) + this.issuesPrsData.postValue(null) + this.pageInfo = it.first + this.usersList.addAll(it.second) + this.usersData.postValue(ArrayList(usersList)) + }) + } + + private fun onRequestFinished(pair: Pair>) { + this.reposData.postValue(null) + this.usersData.postValue(null) + this.pageInfo = pair.first + this.issuesPrsList.addAll(pair.second) + this.issuesPrsData.postValue(ArrayList(issuesPrsList)) // create new copy of list as submitList will never be notified + } + + fun filter(model: FilterSearchModel) { + this.filterModel = model + loadData(true) + } + + fun hasNext() = pageInfo?.hasNextPage ?: false +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/trending/TrendingActivity.kt b/app/src/main/java/com/fastaccess/github/ui/modules/trending/TrendingActivity.kt new file mode 100644 index 000000000..eec092de3 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/trending/TrendingActivity.kt @@ -0,0 +1,24 @@ +package com.fastaccess.github.ui.modules.trending + +import android.os.Bundle +import com.fastaccess.github.R +import com.fastaccess.github.extensions.replace +import com.fastaccess.github.base.deeplink.WebDeepLink +import com.fastaccess.github.ui.modules.trending.fragment.TrendingFragment + +/** + * Created by Kosh on 18.08.18. + */ +@WebDeepLink("/trending", "/trending/{lang}") +class TrendingActivity : com.fastaccess.github.base.BaseActivity() { + override fun layoutRes(): Int = R.layout.activity_main + + override fun onActivityCreatedWithUser(savedInstanceState: Bundle?) { + if (savedInstanceState == null && intent != null) { + val lan = intent?.extras?.getString("lang") + val since = intent?.extras?.getString("since") + + replace(R.id.container, TrendingFragment.newInstance(lan, since)) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/trending/filter/FilterTrendingBottomSheet.kt b/app/src/main/java/com/fastaccess/github/ui/modules/trending/filter/FilterTrendingBottomSheet.kt new file mode 100644 index 000000000..e733a416b --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/trending/filter/FilterTrendingBottomSheet.kt @@ -0,0 +1,95 @@ +package com.fastaccess.github.ui.modules.trending.filter + +import android.content.Context +import android.os.Bundle +import android.view.View +import androidx.core.os.bundleOf +import com.fastaccess.data.model.LanguageColorsModel +import com.fastaccess.data.model.parcelable.FilterTrendingModel +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.addDivider +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.ui.adapter.LanguagesAdapter +import com.google.android.material.chip.Chip +import com.google.gson.Gson +import kotlinx.android.synthetic.main.filter_trending_layout.* +import javax.inject.Inject + +/** + * Created by Kosh on 23.01.19. + */ +class FilterTrendingBottomSheet : com.fastaccess.github.base.BaseFragment() { + + @Inject lateinit var gson: Gson + @Inject lateinit var schedulerProvider: SchedulerProvider + + private var callback: FilterTrendingCallback? = null + private val adapter by lazy { LanguagesAdapter() } + private val model by lazy { arguments?.getParcelable(EXTRA) ?: FilterTrendingModel() } + + + override fun layoutRes(): Int = R.layout.filter_trending_layout + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = null + + override fun onAttach(context: Context) { + super.onAttach(context) + callback = when { + context is FilterTrendingCallback -> context + parentFragment is FilterTrendingCallback -> parentFragment as FilterTrendingCallback + parentFragment?.parentFragment is FilterTrendingCallback -> parentFragment?.parentFragment as FilterTrendingCallback // deep hierarchy + else -> null + } + } + + override fun onDetach() { + callback = null + super.onDetach() + } + + override fun onFragmentCreatedWithUser( + view: View, + savedInstanceState: Bundle? + ) { + setupToolbar(R.string.filter) + adapter.checkedLanguage = model.lang + languageRecyclerView.adapter = adapter + languageRecyclerView.addDivider() + sinceGroup.check( + when (model.since) { + FilterTrendingModel.TrendingSince.DAILY -> R.id.daily + FilterTrendingModel.TrendingSince.WEEKLY -> R.id.weekly + FilterTrendingModel.TrendingSince.MONTHLY -> R.id.monthly + } + ) + addDisposal(LanguageColorsModel.newInstance(gson, requireContext()) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .subscribe({ adapter.submitList(it) }, { showSnackBar(view, message = it.message) }) + ) + + submit.setOnClickListener { + model.lang = adapter.checkedLanguage + model.since = if (sinceGroup.checkedChipId != -1) { + FilterTrendingModel.TrendingSince.getSince(sinceGroup.findViewById(sinceGroup.checkedChipId)?.text?.toString()) + } else { + FilterTrendingModel.TrendingSince.DAILY + } + callback?.onFilterApplied(model) + dismiss() + } + } + + + companion object { + fun newInstance(model: FilterTrendingModel): FilterTrendingBottomSheet { + return FilterTrendingBottomSheet().apply { + arguments = bundleOf(EXTRA to model) + } + } + } + + interface FilterTrendingCallback { + fun onFilterApplied(model: FilterTrendingModel) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/trending/fragment/TrendingFragment.kt b/app/src/main/java/com/fastaccess/github/ui/modules/trending/fragment/TrendingFragment.kt new file mode 100644 index 000000000..4cc4e6b3f --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/trending/fragment/TrendingFragment.kt @@ -0,0 +1,82 @@ +package com.fastaccess.github.ui.modules.trending.fragment + +import android.os.Bundle +import android.view.View +import androidx.core.os.bundleOf +import androidx.lifecycle.ViewModelProvider +import com.fastaccess.data.model.parcelable.FilterTrendingModel +import com.fastaccess.github.R +import com.fastaccess.github.base.extensions.addDivider +import com.fastaccess.github.base.extensions.isConnected +import com.fastaccess.github.base.utils.EXTRA +import com.fastaccess.github.base.viewmodel.ViewModelProviders +import com.fastaccess.github.extensions.isTrue +import com.fastaccess.github.extensions.observeNotNull +import com.fastaccess.github.ui.adapter.TrendingsAdapter +import com.fastaccess.github.ui.modules.multipurpose.MultiPurposeBottomSheetDialog +import com.fastaccess.github.ui.modules.trending.filter.FilterTrendingBottomSheet +import com.fastaccess.github.ui.modules.trending.fragment.viewmodel.TrendingViewModel +import com.google.gson.Gson +import kotlinx.android.synthetic.main.trending_fragment_layout.* +import java.util.* +import javax.inject.Inject + +/** + * Created by Kosh on 23.01.19. + */ +class TrendingFragment : com.fastaccess.github.base.BaseFragment(), FilterTrendingBottomSheet.FilterTrendingCallback { + + @Inject lateinit var viewModelFactory: ViewModelProvider.Factory + @Inject lateinit var gson: Gson + + private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(TrendingViewModel::class.java) } + private val adapter by lazy { TrendingsAdapter() } + + override fun layoutRes(): Int = R.layout.trending_fragment_layout + override fun viewModel(): com.fastaccess.github.base.BaseViewModel? = viewModel + + override fun onFragmentCreatedWithUser(view: View, savedInstanceState: Bundle?) { + setupToolbar(R.string.trending) + recyclerView.adapter = adapter + recyclerView.addDivider() + recyclerView.setEmptyView(emptyLayout) + fastScroller.attachRecyclerView(recyclerView, appBar) + swipeRefresh.setOnRefreshListener { + if (isConnected()) { + recyclerView.resetScrollState() + viewModel.load(viewModel.filterTrendingModel, Locale.ENGLISH) + } else { + swipeRefresh.isRefreshing = false + } + } + filterTrending.setOnClickListener { + val modelCopy = viewModel.filterTrendingModel.copy() + MultiPurposeBottomSheetDialog.show( + childFragmentManager, + MultiPurposeBottomSheetDialog.BottomSheetFragmentType.TRENDING, modelCopy + ) + } + listenToChanges() + if (savedInstanceState == null) { + val model = arguments?.getParcelable(EXTRA) ?: FilterTrendingModel() + isConnected().isTrue { viewModel.load(model, Locale.ENGLISH) } + } + } + + override fun onFilterApplied(model: FilterTrendingModel) { + viewModel.filterTrendingModel = model + isConnected().isTrue { viewModel.load(model, Locale.ENGLISH) } + } + + private fun listenToChanges() { + viewModel.trendingLiveData.observeNotNull(this) { + adapter.submitList(it) + } + } + + companion object { + fun newInstance(lan: String? = null, since: String? = null) = TrendingFragment().apply { + arguments = bundleOf(EXTRA to FilterTrendingModel(lan ?: "", FilterTrendingModel.TrendingSince.getSince(since))) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/modules/trending/fragment/viewmodel/TrendingViewModel.kt b/app/src/main/java/com/fastaccess/github/ui/modules/trending/fragment/viewmodel/TrendingViewModel.kt new file mode 100644 index 000000000..335edff80 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/modules/trending/fragment/viewmodel/TrendingViewModel.kt @@ -0,0 +1,85 @@ +package com.fastaccess.github.ui.modules.trending.fragment.viewmodel + +import android.annotation.SuppressLint +import androidx.lifecycle.MutableLiveData +import com.fastaccess.data.model.FirebaseTrendingConfigModel +import com.fastaccess.data.model.TrendingModel +import com.fastaccess.data.model.parcelable.FilterTrendingModel +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.services.ScrapService +import com.github.b3er.rxfirebase.database.RxFirebaseDatabase +import com.google.firebase.database.DatabaseReference +import org.jsoup.Jsoup +import timber.log.Timber +import java.util.* +import javax.inject.Inject +import javax.inject.Named + +/** + * Created by Kosh on 20.10.18. + */ +class TrendingViewModel @Inject constructor( + @Named(value = "github_trending") private val databaseReference: DatabaseReference, + private val service: ScrapService, + private val schedulerProvider: SchedulerProvider +) : com.fastaccess.github.base.BaseViewModel() { + + private var trendingModel: FirebaseTrendingConfigModel? = null + val trendingLiveData = MutableLiveData>() + var filterTrendingModel = FilterTrendingModel() + + @SuppressLint("DefaultLocale") fun load( + model: FilterTrendingModel, + locale: Locale + ) { + val firebaseTrendingConfigModel = trendingModel + + if (firebaseTrendingConfigModel == null) { + justSubscribe( + RxFirebaseDatabase.data(databaseReference) + .doOnError { loadTrendings(model, locale, FirebaseTrendingConfigModel()) } + .doOnSuccess { + @Suppress("UNCHECKED_CAST") + Timber.e("${it.value}") + trendingModel = FirebaseTrendingConfigModel.map(it.value as? HashMap) + loadTrendings(model, locale, requireNotNull(trendingModel)) + }) + } else { + loadTrendings(model, locale, firebaseTrendingConfigModel) + } + } + + private fun loadTrendings( + model: FilterTrendingModel, + locale: Locale, + trendingModel: FirebaseTrendingConfigModel + ) { + val language = if (model.lang == "All") "" else model.lang.replace(" ", "_").toLowerCase(locale) + trendingModel.pathUrl += language + justSubscribe(service.getTrending(trendingModel.pathUrl, model.since.name.toLowerCase(locale)) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { html -> + val document = Jsoup.parse(html, "") + val list = document.select(trendingModel.listName) + val trendingList = arrayListOf() + list.select(trendingModel.listNameSublistTag)?.let { li -> + trendingList.addAll(li.map { body -> + val trendingLang = kotlin.runCatching { body.select(trendingModel.language).text() } + .getOrNull() ?: kotlin.runCatching { body.select(trendingModel.languageFallback).text() }.getOrNull() + val todayStars = kotlin.runCatching { body.select(trendingModel.todayStars).text() } + .getOrNull() ?: kotlin.runCatching { body.select(trendingModel.todayStarsFallback).text() }.getOrNull() + val title = kotlin.runCatching { body.select(trendingModel.title).text() }.getOrNull() + val description = kotlin.runCatching { body.select(trendingModel.description).text() }.getOrNull() + val stars = kotlin.runCatching { body.select(trendingModel.stars).text() }.getOrNull() + val forks = kotlin.runCatching { body.select(trendingModel.forks).text() }.getOrNull() + TrendingModel(title, description, trendingLang, stars, forks, todayStars) + }) + } + return@map trendingList + } + .doOnNext { + trendingLiveData.postValue(it) + }) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/widget/AnchorSheetBehavior.java b/app/src/main/java/com/fastaccess/github/ui/widget/AnchorSheetBehavior.java new file mode 100644 index 000000000..979371c0c --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/widget/AnchorSheetBehavior.java @@ -0,0 +1,962 @@ +/* + * Copyright (c) 2016 HERE Europe B.V. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.fastaccess.github.ui.widget; + +import android.content.Context; +import android.content.res.TypedArray; +import android.os.Parcel; +import android.os.Parcelable; +import android.util.AttributeSet; +import android.util.TypedValue; +import android.view.MotionEvent; +import android.view.VelocityTracker; +import android.view.View; +import android.view.ViewConfiguration; +import android.view.ViewGroup; +import android.view.ViewParent; + +import com.fastaccess.github.R; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.ref.WeakReference; + +import androidx.annotation.IntDef; +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; +import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.math.MathUtils; +import androidx.customview.view.AbsSavedState; +import androidx.customview.widget.ViewDragHelper; + +import static androidx.core.view.ViewCompat.NestedScrollType; +import static androidx.core.view.ViewCompat.SCROLL_AXIS_VERTICAL; +import static androidx.core.view.ViewCompat.ScrollAxis; +import static androidx.core.view.ViewCompat.getFitsSystemWindows; +import static androidx.core.view.ViewCompat.isAttachedToWindow; +import static androidx.core.view.ViewCompat.isNestedScrollingEnabled; +import static androidx.core.view.ViewCompat.offsetTopAndBottom; +import static androidx.core.view.ViewCompat.postOnAnimation; + +/** + * An interaction behavior plugin for a child view of {@link CoordinatorLayout} to make it work as + * a bottom sheet. + *

+ * Modification of the {@link } with an Anchor state. + */ +public class AnchorSheetBehavior extends CoordinatorLayout.Behavior { + + /** + * Callback for monitoring events about bottom sheets. + */ + public abstract static class AnchorSheetCallback { + + /** + * Called when the bottom sheet changes its state. + * + * @param bottomSheet + * The bottom sheet view. + * @param newState + * The new state. This will be one of {@link #STATE_DRAGGING}, + * {@link #STATE_SETTLING}, {@link #STATE_EXPANDED}, + * {@link #STATE_COLLAPSED}, or {@link #STATE_HIDDEN}. + */ + public abstract void onStateChanged(@NonNull View bottomSheet, @State int newState); + + /** + * Called when the bottom sheet is being dragged. + * + * @param bottomSheet + * The bottom sheet view. + * @param slideOffset + * The new offset of this bottom sheet within [-1,1] range. Offset + * increases as this bottom sheet is moving upward. From 0 to 1 the sheet + * is between collapsed and expanded states and from -1 to 0 it is + * between hidden and collapsed states. + */ + public abstract void onSlide(@NonNull View bottomSheet, float slideOffset); + } + + /** + * The bottom sheet is dragging. + */ + public static final int STATE_DRAGGING = 1; + + /** + * The bottom sheet is settling. + */ + public static final int STATE_SETTLING = 2; + + /** + * The bottom sheet is expanded. + */ + public static final int STATE_EXPANDED = 3; + + /** + * The bottom sheet is collapsed. + */ + public static final int STATE_COLLAPSED = 4; + + /** + * The bottom sheet is hidden. + */ + public static final int STATE_HIDDEN = 5; + + /** + * The bottom sheet is anchor. + */ + public static final int STATE_ANCHOR = 6; + + /** + * The bottom sheet is forced to be hidden programmatically. + */ + public static final int STATE_FORCE_HIDDEN = 7; + + /** + * @hide + */ + @IntDef({ + STATE_EXPANDED, + STATE_COLLAPSED, + STATE_DRAGGING, + STATE_SETTLING, + STATE_HIDDEN, + STATE_ANCHOR, + STATE_FORCE_HIDDEN + }) + @Retention(RetentionPolicy.SOURCE) + public @interface State { + } + + /** + * Peek at the 16:9 ratio keyline of its parent. + *

+ *

This can be used as a parameter for {@link #setPeekHeight(int)}. + * {@link #getPeekHeight()} will return this when the value is set.

+ */ + public static final int PEEK_HEIGHT_AUTO = -1; + + private static final float HIDE_THRESHOLD = 0.5f; + + private static final float HIDE_FRICTION = 0.1f; + + private static final float ANCHOR_THRESHOLD = 0.50f; + + private float mAnchorThreshold = ANCHOR_THRESHOLD; + + private float mMaximumVelocity; + + private int mPeekHeight; + + private boolean mPeekHeightAuto; + + private int mPeekHeightMin; + + private int mMinOffset; + + private int mMaxOffset; + + private int mAnchorOffset; + + private boolean mHideable; + + private boolean mSkipCollapsed; + + @State + private int mState = STATE_COLLAPSED; + + private ViewDragHelper mViewDragHelper; + + private boolean mIgnoreEvents; + + private int mLastNestedScrollDy; + + private boolean mNestedScrolled; + + private int mParentHeight; + + private WeakReference mViewRef; + + private WeakReference mNestedScrollingChildRef; + + private AnchorSheetCallback mCallback; + + private VelocityTracker mVelocityTracker; + + private int mActivePointerId; + + private int mInitialY; + + private boolean mTouchingScrollingChild; + + /** + * Default constructor for instantiating AnchorSheetBehavior. + */ + public AnchorSheetBehavior() { + } + + /** + * Default constructor for inflating AnchorSheetBehavior from layout. + * + * @param context + * The {@link Context}. + * @param attrs + * The {@link AttributeSet}. + */ + public AnchorSheetBehavior(Context context, AttributeSet attrs) { + super(context, attrs); + TypedArray a = context.obtainStyledAttributes(attrs, + R.styleable.BottomSheetBehavior_Layout); + TypedValue value = a.peekValue( + R.styleable.BottomSheetBehavior_Layout_behavior_peekHeight); + if (value != null && value.data == PEEK_HEIGHT_AUTO) { + setPeekHeight(value.data); + } else { + setPeekHeight(a.getDimensionPixelSize( + R.styleable.BottomSheetBehavior_Layout_behavior_peekHeight, + PEEK_HEIGHT_AUTO + )); + } + setHideable(a.getBoolean( + R.styleable.BottomSheetBehavior_Layout_behavior_hideable, false)); + setSkipCollapsed(a.getBoolean( + R.styleable.BottomSheetBehavior_Layout_behavior_skipCollapsed, false)); + a.recycle(); + ViewConfiguration configuration = ViewConfiguration.get(context); + mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); + } + + @Override + public Parcelable onSaveInstanceState(CoordinatorLayout parent, V child) { + return new SavedState(super.onSaveInstanceState(parent, child), mState); + } + + @Override + public void onRestoreInstanceState(CoordinatorLayout parent, V child, Parcelable state) { + SavedState ss = (SavedState) state; + super.onRestoreInstanceState(parent, child, ss.getSuperState()); + // Intermediate states are restored as collapsed state + if (ss.state == STATE_DRAGGING || ss.state == STATE_SETTLING) { + mState = STATE_COLLAPSED; + } else { + mState = ss.state; + } + } + + @Override + public boolean onLayoutChild(CoordinatorLayout parent, V child, int layoutDirection) { + if (getFitsSystemWindows(parent) && !getFitsSystemWindows(child)) { + child.setFitsSystemWindows(true); + } + int savedTop = child.getTop(); + // First let the parent lay it out + parent.onLayoutChild(child, layoutDirection); + // Offset the bottom sheet + mParentHeight = parent.getHeight(); + int peekHeight; + if (mPeekHeightAuto) { + if (mPeekHeightMin == 0) { + mPeekHeightMin = parent.getResources().getDimensionPixelSize( + R.dimen.design_bottom_sheet_peek_height_min); + } + peekHeight = Math.max(mPeekHeightMin, mParentHeight - parent.getWidth() * 9 / 16); + } else { + peekHeight = mPeekHeight; + } + mMinOffset = Math.max(0, mParentHeight - child.getHeight()); + mMaxOffset = Math.max(mParentHeight - peekHeight, mMinOffset); + mAnchorOffset = (int) Math.max(mParentHeight * mAnchorThreshold, mMinOffset); + if (mState == STATE_EXPANDED) { + offsetTopAndBottom(child, mMinOffset); + } else if (mState == STATE_ANCHOR) { + offsetTopAndBottom(child, mAnchorOffset); + } else if ((mHideable && mState == STATE_HIDDEN) || mState == STATE_FORCE_HIDDEN) { + offsetTopAndBottom(child, mParentHeight); + } else if (mState == STATE_COLLAPSED) { + offsetTopAndBottom(child, mMaxOffset); + } else if (mState == STATE_DRAGGING || mState == STATE_SETTLING) { + offsetTopAndBottom(child, savedTop - child.getTop()); + } + if (mViewDragHelper == null) { + mViewDragHelper = ViewDragHelper.create(parent, mDragCallback); + } + mViewRef = new WeakReference<>(child); + mNestedScrollingChildRef = new WeakReference<>(findScrollingChild(child)); + return true; + } + + @Override + public boolean onInterceptTouchEvent(CoordinatorLayout parent, V child, MotionEvent event) { + if (!child.isShown()) { + mIgnoreEvents = true; + return false; + } + int action = event.getActionMasked(); + // Record the velocity + if (action == MotionEvent.ACTION_DOWN) { + reset(); + } + if (mVelocityTracker == null) { + mVelocityTracker = VelocityTracker.obtain(); + } + mVelocityTracker.addMovement(event); + switch (action) { + case MotionEvent.ACTION_UP: + case MotionEvent.ACTION_CANCEL: + mTouchingScrollingChild = false; + mActivePointerId = MotionEvent.INVALID_POINTER_ID; + // Reset the ignore flag + if (mIgnoreEvents) { + mIgnoreEvents = false; + return false; + } + break; + case MotionEvent.ACTION_DOWN: + int initialX = (int) event.getX(); + mInitialY = (int) event.getY(); + View scroll = mNestedScrollingChildRef != null + ? mNestedScrollingChildRef.get() : null; + if (scroll != null && parent.isPointInChildBounds(scroll, initialX, mInitialY)) { + mActivePointerId = event.getPointerId(event.getActionIndex()); + mTouchingScrollingChild = true; + } + mIgnoreEvents = mActivePointerId == MotionEvent.INVALID_POINTER_ID && + !parent.isPointInChildBounds(child, initialX, mInitialY); + break; + } + if (!mIgnoreEvents && mViewDragHelper.shouldInterceptTouchEvent(event)) { + return true; + } + // We have to handle cases that the ViewDragHelper does not capture the bottom sheet because + // it is not the top most view of its parent. This is not necessary when the touch event is + // happening over the scrolling content as nested scrolling logic handles that case. + View scroll = mNestedScrollingChildRef.get(); + return action == MotionEvent.ACTION_MOVE && scroll != null && + !mIgnoreEvents && mState != STATE_DRAGGING && + !parent.isPointInChildBounds(scroll, (int) event.getX(), (int) event.getY()) && + Math.abs(mInitialY - event.getY()) > mViewDragHelper.getTouchSlop(); + } + + @Override + public boolean onTouchEvent(CoordinatorLayout parent, V child, MotionEvent event) { + if (!child.isShown() || mViewDragHelper == null) { + return false; + } + int action = event.getActionMasked(); + if (mState == STATE_DRAGGING && action == MotionEvent.ACTION_DOWN) { + return true; + } + mViewDragHelper.processTouchEvent(event); + // Record the velocity + if (action == MotionEvent.ACTION_DOWN) { + reset(); + } + if (mVelocityTracker == null) { + mVelocityTracker = VelocityTracker.obtain(); + } + mVelocityTracker.addMovement(event); + // The ViewDragHelper tries to capture only the top-most View. We have to explicitly tell it + // to capture the bottom sheet in case it is not captured and the touch slop is passed. + if (action == MotionEvent.ACTION_MOVE && !mIgnoreEvents) { + if (Math.abs(mInitialY - event.getY()) > mViewDragHelper.getTouchSlop()) { + mViewDragHelper.captureChildView(child, event.getPointerId(event.getActionIndex())); + } + } + return !mIgnoreEvents; + } + + @Override + public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, + @NonNull V child, + @NonNull View directTargetChild, + @NonNull View target, + @ScrollAxis int nestedScrollAxes, + @NestedScrollType int type) { + mLastNestedScrollDy = 0; + mNestedScrolled = false; + return (nestedScrollAxes & SCROLL_AXIS_VERTICAL) != 0; + } + + @Override + public void onNestedPreScroll(@NonNull CoordinatorLayout coordinatorLayout, + @NonNull V child, + @NonNull View target, + int dx, + int dy, + @NonNull int[] consumed, + @NestedScrollType int type) { + View scrollingChild = mNestedScrollingChildRef.get(); + if (target != scrollingChild) { + return; + } + int currentTop = child.getTop(); + int newTop = currentTop - dy; + if (dy > 0) { // Upward + if (newTop < mMinOffset) { + consumed[1] = currentTop - mMinOffset; + offsetTopAndBottom(child, -consumed[1]); + setStateInternal(STATE_EXPANDED); + } else { + consumed[1] = dy; + offsetTopAndBottom(child, -dy); + setStateInternal(STATE_DRAGGING); + } + } else if (dy < 0) { // Downward + if (!target.canScrollVertically(-1)) { + if (newTop <= mMaxOffset || mHideable) { + consumed[1] = dy; + offsetTopAndBottom(child, -dy); + setStateInternal(STATE_DRAGGING); + } else { + consumed[1] = currentTop - mMaxOffset; + offsetTopAndBottom(child, -consumed[1]); + setStateInternal(STATE_COLLAPSED); + } + } + } + dispatchOnSlide(child.getTop()); + mLastNestedScrollDy = dy; + mNestedScrolled = true; + } + + @Override + public void onStopNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, + @NonNull V child, + @NonNull View target, + @NestedScrollType int type) { + if (child.getTop() == mMinOffset) { + setStateInternal(STATE_EXPANDED); + return; + } + if (mNestedScrollingChildRef == null || target != mNestedScrollingChildRef.get() + || !mNestedScrolled) { + return; + } + int top; + int targetState; + if (mLastNestedScrollDy > 0) { + int currentTop = child.getTop(); + if (Math.abs(currentTop - mMinOffset) < Math.abs(currentTop - mAnchorOffset)) { + top = mMinOffset; + targetState = STATE_EXPANDED; + } else { + top = mAnchorOffset; + targetState = STATE_ANCHOR; + } + } else if (mHideable && shouldHide(child, getYVelocity())) { + top = mParentHeight; + targetState = STATE_HIDDEN; + } else if (mLastNestedScrollDy == 0) { + int currentTop = child.getTop(); + if (Math.abs(currentTop - mAnchorOffset) < Math.abs(currentTop - mMinOffset)) { + top = mAnchorOffset; + targetState = STATE_ANCHOR; + } else if (Math.abs(currentTop - mMinOffset) < Math.abs(currentTop - mMaxOffset)) { + top = mMinOffset; + targetState = STATE_EXPANDED; + } else { + top = mMaxOffset; + targetState = STATE_COLLAPSED; + } + } else { + int currentTop = child.getTop(); + if (Math.abs(currentTop - mAnchorOffset) < Math.abs(currentTop - mMaxOffset)) { + top = mAnchorOffset; + targetState = STATE_ANCHOR; + } else { + top = mMaxOffset; + targetState = STATE_COLLAPSED; + } + } + if (mViewDragHelper.smoothSlideViewTo(child, child.getLeft(), top)) { + setStateInternal(STATE_SETTLING); + postOnAnimation(child, new SettleRunnable(child, targetState)); + } else { + setStateInternal(targetState); + } + mNestedScrolled = false; + } + + @Override + public boolean onNestedPreFling(@NonNull CoordinatorLayout coordinatorLayout, + @NonNull V child, + @NonNull View target, + float velocityX, + float velocityY) { + return target == mNestedScrollingChildRef.get() && + (mState != STATE_EXPANDED || + super.onNestedPreFling(coordinatorLayout, child, target, + velocityX, velocityY)); + } + + /** + * Sets the height of the bottom sheet when it is collapsed. + * + * @param peekHeight + * The height of the collapsed bottom sheet in pixels. + * @attr ref R.styleable#AnchorBehavior_Params_behavior_peekHeight + */ + public final void setPeekHeight(int peekHeight) { + boolean layout = false; + if (peekHeight == PEEK_HEIGHT_AUTO) { + if (!mPeekHeightAuto) { + mPeekHeightAuto = true; + layout = true; + } + } else if (mPeekHeightAuto || mPeekHeight != peekHeight) { + mPeekHeightAuto = false; + mPeekHeight = Math.max(0, peekHeight); + mMaxOffset = mParentHeight - peekHeight; + layout = true; + } + if (layout && mState == STATE_COLLAPSED && mViewRef != null) { + V view = mViewRef.get(); + if (view != null) { + view.requestLayout(); + } + } + } + + /** + * Gets the height of the bottom sheet when it is collapsed. + * + * @return The height of the collapsed bottom sheet in pixels, or {@link #PEEK_HEIGHT_AUTO} + * if the sheet is configured to peek automatically at 16:9 ratio keyline + * @attr ref R.styleable#BottomSheetBehavior_Layout_behavior_peekHeight + */ + public final int getPeekHeight() { + return mPeekHeightAuto ? PEEK_HEIGHT_AUTO : mPeekHeight; + } + + /** + * Gets the offset from the panel till the top + * + * @return the offset in pixel size + */ + public final int getPanelOffset() { + if (mState == STATE_EXPANDED) { + return mMinOffset; + } else if (mState == STATE_ANCHOR) { + return mAnchorOffset; + } else if (mHideable && mState == STATE_HIDDEN) { + return mParentHeight; + } + return mMaxOffset; + } + + /** + * Get the size in pixels from the anchor state to the top of the parent (Expanded state) + * + * @return pixel size of the anchor state + */ + public int getAnchorOffset() { + return mAnchorOffset; + } + + /** + * The multiplier between 0..1 to calculate the Anchor offset + * + * @return float between 0..1 + */ + public float getAnchorThreshold() { + return mAnchorThreshold; + } + + /** + * Set the offset for the anchor state. Number between 0..1 + * i.e: Anchor the panel at 1/3 of the screen: setAnchorOffset(0.25) + * + * @param threshold + * {@link Float} from 0..1 + */ + public void setAnchorOffset(float threshold) { + this.mAnchorThreshold = threshold; + this.mAnchorOffset = (int) Math.max(mParentHeight * mAnchorThreshold, mMinOffset); + } + + /** + * Sets whether this bottom sheet can hide when it is swiped down. + * + * @param hideable + * {@code true} to make this bottom sheet hideable. + * @attr ref R.styleable#BottomSheetBehavior_Layout_behavior_hideable + */ + public void setHideable(boolean hideable) { + mHideable = hideable; + } + + /** + * Gets whether this bottom sheet can hide when it is swiped down. + * + * @return {@code true} if this bottom sheet can hide. + * @attr ref R.styleable#AnchorBehavior_Params_behavior_hideable + */ + public boolean isHideable() { + return mHideable; + } + + /** + * Sets whether this bottom sheet should skip the collapsed state when it is being hidden + * after it is expanded once. Setting this to true has no effect unless the sheet is hideable. + * + * @param skipCollapsed + * True if the bottom sheet should skip the collapsed state. + * @attr ref R.styleable#BottomSheetBehavior_Layout_behavior_skipCollapsed + */ + public void setSkipCollapsed(boolean skipCollapsed) { + mSkipCollapsed = skipCollapsed; + } + + /** + * Sets whether this bottom sheet should skip the collapsed state when it is being hidden + * after it is expanded once. + * + * @return Whether the bottom sheet should skip the collapsed state. + * @attr ref R.styleable#BottomSheetBehavior_Layout_behavior_skipCollapsed + */ + public boolean getSkipCollapsed() { + return mSkipCollapsed; + } + + /** + * Sets a callback to be notified of bottom sheet events. + * + * @param callback + * The callback to notify when bottom sheet events occur. + */ + public void setAnchorSheetCallback(AnchorSheetCallback callback) { + mCallback = callback; + } + + /** + * Sets the state of the bottom sheet. The bottom sheet will transition to that state with + * animation. + * + * @param state + * One of {@link #STATE_COLLAPSED}, {@link #STATE_EXPANDED}, or + * {@link #STATE_HIDDEN}. + */ + public final void setState(@State final int state) { + if (state == mState) { + return; + } + if (mViewRef == null) { + // The view is not laid out yet; modify mState and let onLayoutChild handle it later + if (state == STATE_COLLAPSED || state == STATE_EXPANDED || state == STATE_ANCHOR || + ((mHideable && state == STATE_HIDDEN) || state == STATE_FORCE_HIDDEN)) { + mState = state; + } + return; + } + final V child = mViewRef.get(); + if (child == null) { + return; + } + // Start the animation; wait until a pending layout if there is one. + ViewParent parent = child.getParent(); + if (parent != null && parent.isLayoutRequested() && isAttachedToWindow(child)) { + child.post(new Runnable() { + @Override + public void run() { + startSettlingAnimation(child, state); + } + }); + } else { + startSettlingAnimation(child, state); + } + } + + /** + * Gets the current state of the bottom sheet. + * + * @return One of {@link #STATE_EXPANDED}, {@link #STATE_COLLAPSED}, {@link #STATE_DRAGGING}, + * and {@link #STATE_SETTLING}. + */ + @State + public final int getState() { + return mState; + } + + private void setStateInternal(@State int state) { + if (mState == state) { + return; + } + mState = state; + View bottomSheet = mViewRef.get(); + if (bottomSheet != null && mCallback != null) { + mCallback.onStateChanged(bottomSheet, state); + } + } + + private void reset() { + mActivePointerId = ViewDragHelper.INVALID_POINTER; + if (mVelocityTracker != null) { + mVelocityTracker.recycle(); + mVelocityTracker = null; + } + } + + boolean shouldHide(View child, float yvel) { + if (mSkipCollapsed) { + return true; + } + if (child.getTop() < mMaxOffset) { + // It should not hide, but collapse. + return false; + } + final float newTop = child.getTop() + yvel * HIDE_FRICTION; + return Math.abs(newTop - mMaxOffset) / (float) mPeekHeight > HIDE_THRESHOLD; + } + + @VisibleForTesting + View findScrollingChild(View view) { + if (isNestedScrollingEnabled(view)) { + return view; + } + if (view instanceof ViewGroup) { + ViewGroup group = (ViewGroup) view; + for (int i = 0, count = group.getChildCount(); i < count; i++) { + View scrollingChild = findScrollingChild(group.getChildAt(i)); + if (scrollingChild != null) { + return scrollingChild; + } + } + } + return null; + } + + private float getYVelocity() { + mVelocityTracker.computeCurrentVelocity(1000, mMaximumVelocity); + return mVelocityTracker.getYVelocity(mActivePointerId); + } + + void startSettlingAnimation(View child, int state) { + int top; + if (state == STATE_ANCHOR) { + top = mAnchorOffset; + } else if (state == STATE_COLLAPSED) { + top = mMaxOffset; + } else if (state == STATE_EXPANDED) { + top = mMinOffset; + } else if ((mHideable && state == STATE_HIDDEN) || state == STATE_FORCE_HIDDEN) { + top = mParentHeight; + } else { + throw new IllegalArgumentException("Illegal state argument: " + state); + } + if (mViewDragHelper.smoothSlideViewTo(child, child.getLeft(), top)) { + setStateInternal(STATE_SETTLING); + postOnAnimation(child, new SettleRunnable(child, state)); + } else { + setStateInternal(state); + } + } + + private final ViewDragHelper.Callback mDragCallback = new ViewDragHelper.Callback() { + + @Override + public boolean tryCaptureView(View child, int pointerId) { + if (mState == STATE_DRAGGING) { + return false; + } + if (mTouchingScrollingChild) { + return false; + } + if (mState == STATE_EXPANDED && mActivePointerId == pointerId) { + View scroll = mNestedScrollingChildRef.get(); + if (scroll != null && scroll.canScrollVertically(-1)) { + // Let the content scroll up + return false; + } + } + return mViewRef != null && mViewRef.get() == child; + } + + @Override + public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) { + dispatchOnSlide(top); + } + + @Override + public void onViewDragStateChanged(int state) { + if (state == ViewDragHelper.STATE_DRAGGING) { + setStateInternal(STATE_DRAGGING); + } + } + + @Override + public void onViewReleased(View releasedChild, float xvel, float yvel) { + int top; + @State int targetState; + if (yvel < 0) { // Moving up + int currentTop = releasedChild.getTop(); + if (Math.abs(currentTop - mMinOffset) < Math.abs(currentTop - mAnchorOffset)) { + top = mMinOffset; + targetState = STATE_EXPANDED; + } else { + top = mAnchorOffset; + targetState = STATE_ANCHOR; + } + } else if (mHideable && shouldHide(releasedChild, yvel)) { + top = mParentHeight; + targetState = STATE_HIDDEN; + } else if (yvel == 0.f) { + int currentTop = releasedChild.getTop(); + if (Math.abs(currentTop - mMinOffset) < Math.abs(currentTop - mAnchorOffset)) { + top = mMinOffset; + targetState = STATE_EXPANDED; + } else if (Math.abs(currentTop - mAnchorOffset) < Math.abs(currentTop - mMaxOffset)) { + top = mAnchorOffset; + targetState = STATE_ANCHOR; + } else { + top = mMaxOffset; + targetState = STATE_COLLAPSED; + } + } else { + top = mMaxOffset; + targetState = STATE_COLLAPSED; + } + if (mViewDragHelper.settleCapturedViewAt(releasedChild.getLeft(), top)) { + setStateInternal(STATE_SETTLING); + postOnAnimation(releasedChild, + new SettleRunnable(releasedChild, targetState)); + } else { + setStateInternal(targetState); + } + } + + @Override + public int clampViewPositionVertical(View child, int top, int dy) { + return MathUtils.clamp(top, mMinOffset, mHideable ? mParentHeight : mMaxOffset); + } + + @Override + public int clampViewPositionHorizontal(View child, int left, int dx) { + return child.getLeft(); + } + + @Override + public int getViewVerticalDragRange(View child) { + if (mHideable) { + return mParentHeight - mMinOffset; + } else { + return mMaxOffset - mMinOffset; + } + } + }; + + void dispatchOnSlide(int top) { + View bottomSheet = mViewRef.get(); + if (bottomSheet != null && mCallback != null) { + if (top > mMaxOffset) { + mCallback.onSlide(bottomSheet, (float) (mMaxOffset - top) / + (mParentHeight - mMaxOffset)); + } else { + mCallback.onSlide(bottomSheet, + (float) (mMaxOffset - top) / ((mMaxOffset - mMinOffset))); + } + } + } + + @VisibleForTesting + int getPeekHeightMin() { + return mPeekHeightMin; + } + + private class SettleRunnable implements Runnable { + + private final View mView; + + @State + private final int mTargetState; + + SettleRunnable(View view, @State int targetState) { + mView = view; + mTargetState = targetState; + } + + @Override + public void run() { + if (mViewDragHelper != null && mViewDragHelper.continueSettling(true)) { + postOnAnimation(mView, this); + } else { + setStateInternal(mTargetState); + } + } + } + + static class SavedState extends AbsSavedState { + @State final int state; + + public SavedState(Parcel source) { + this(source, null); + } + + public SavedState(Parcel source, ClassLoader loader) { + super(source, loader); + //noinspection ResourceType + state = source.readInt(); + } + + public SavedState(Parcelable superState, @State int state) { + super(superState); + this.state = state; + } + + @Override + public void writeToParcel(Parcel out, int flags) { + super.writeToParcel(out, flags); + out.writeInt(state); + } + + public static final Creator CREATOR = new ClassLoaderCreator() { + @Override + public SavedState createFromParcel(Parcel in, ClassLoader loader) { + return new SavedState(in, loader); + } + + @Override + public SavedState createFromParcel(Parcel in) { + return new SavedState(in, null); + } + + @Override + public SavedState[] newArray(int size) { + return new SavedState[size]; + } + }; + } + + /** + * A utility function to get the {@link AnchorSheetBehavior} associated with the {@code view}. + * + * @param view + * The {@link View} with {@link AnchorSheetBehavior}. + * @return The {@link AnchorSheetBehavior} associated with the {@code view}. + */ + @SuppressWarnings("unchecked") + public static AnchorSheetBehavior from(V view) { + ViewGroup.LayoutParams params = view.getLayoutParams(); + if (!(params instanceof CoordinatorLayout.LayoutParams)) { + throw new IllegalArgumentException("The view is not a child of CoordinatorLayout"); + } + CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) params).getBehavior(); + if (!(behavior instanceof AnchorSheetBehavior)) { + throw new IllegalArgumentException("The view is not associated with AnchorSheetBehavior"); + } + return (AnchorSheetBehavior) behavior; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/ui/widget/AppBarBottomSheetBehaviour.kt b/app/src/main/java/com/fastaccess/github/ui/widget/AppBarBottomSheetBehaviour.kt new file mode 100644 index 000000000..aac8d5b0b --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/ui/widget/AppBarBottomSheetBehaviour.kt @@ -0,0 +1,39 @@ +package com.fastaccess.github.ui.widget + +import android.content.Context +import android.util.AttributeSet +import android.view.MotionEvent +import android.view.View +import androidx.coordinatorlayout.widget.CoordinatorLayout +import com.fastaccess.github.R +import com.google.android.material.appbar.AppBarLayout +import com.google.android.material.bottomsheet.BottomSheetBehavior + +class AppBarBottomSheetBehaviour(context: Context, attrs: AttributeSet?) : AppBarLayout.Behavior(context, attrs) { + private var hasBottomSheet = false + + override fun onStartNestedScroll(parent: CoordinatorLayout, child: AppBarLayout, directTargetChild: View, target: View, nestedScrollAxes: Int, + type: Int): Boolean { + val bottomSheet = parent.findViewById(R.id.bottomSheet) + hasBottomSheet = isOpen(bottomSheet) + return !hasBottomSheet && super.onStartNestedScroll(parent, child, directTargetChild, target, nestedScrollAxes, type) + } + + override fun onInterceptTouchEvent(parent: CoordinatorLayout, child: AppBarLayout, ev: MotionEvent): Boolean { + if (ev.actionMasked == MotionEvent.ACTION_CANCEL) { + hasBottomSheet = false + } + return !hasBottomSheet && super.onInterceptTouchEvent(parent, child, ev) + } + + private fun isOpen(bottomSheet: View?): Boolean = getBottomSheetState(bottomSheet) != BottomSheetBehavior.STATE_COLLAPSED + + private fun getBottomSheetState(bottomSheet: View?): Int? { + val view = bottomSheet ?: return null + return try { + BottomSheetBehavior.from(view).state + } catch (e: Exception) { + AnchorSheetBehavior.from(view)?.state + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/auth/GetAccessTokenUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/auth/GetAccessTokenUseCase.kt new file mode 100644 index 000000000..67636171d --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/auth/GetAccessTokenUseCase.kt @@ -0,0 +1,36 @@ +package com.fastaccess.github.usecase.auth + +import com.fastaccess.data.repository.LoginRepository +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.BuildConfig +import com.fastaccess.domain.response.AccessTokenResponse +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import com.fastaccess.github.base.utils.REDIRECT_URL +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 12.05.18. + */ +class GetAccessTokenUseCase @Inject constructor( + private val loginRepository: LoginRepository, + private val schedulerProvider: SchedulerProvider +) : + BaseObservableUseCase() { + + var code: String? = null + + override fun buildObservable(): Observable { + val observable = code?.let { + loginRepository.getAccessToken( + it, BuildConfig.GITHUB_CLIENT_ID, BuildConfig.GITHUB_SECRET, + com.fastaccess.github.BuildConfig.APPLICATION_ID, REDIRECT_URL + ) + } ?: Observable.empty() + + return observable + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/auth/LoginUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/auth/LoginUseCase.kt new file mode 100644 index 000000000..e2c27c638 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/auth/LoginUseCase.kt @@ -0,0 +1,41 @@ +package com.fastaccess.github.usecase.auth + +import com.fastaccess.data.repository.LoginRepository +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.response.AccessTokenResponse +import com.fastaccess.domain.response.AuthBodyModel +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import com.fastaccess.github.BuildConfig +import com.fastaccess.github.base.utils.REDIRECT_URL +import com.fastaccess.github.base.utils.SCOPE_LIST +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 12.05.18. + */ +class LoginUseCase @Inject constructor( + private val loginRemoteRepository: LoginRepository, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + private var authBodyModel: AuthBodyModel? = null + + override fun buildObservable(): Observable = authBodyModel?.let { + loginRemoteRepository.login(it) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + } ?: Observable.empty() + + fun setAuthBody(twoFactorCode: String? = null) { + this.authBodyModel = AuthBodyModel().apply { + clientId = com.fastaccess.domain.BuildConfig.GITHUB_CLIENT_ID + clientSecret = com.fastaccess.domain.BuildConfig.GITHUB_SECRET + redirectUri = REDIRECT_URL + scopes = SCOPE_LIST.split(",") + state = BuildConfig.APPLICATION_ID + note = BuildConfig.APPLICATION_ID + noteUrl = "fasthub://login" + otpCode = twoFactorCode + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/auth/LoginWithAccessTokenUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/auth/LoginWithAccessTokenUseCase.kt new file mode 100644 index 000000000..08ea01e6d --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/auth/LoginWithAccessTokenUseCase.kt @@ -0,0 +1,35 @@ +package com.fastaccess.github.usecase.auth + +import com.fastaccess.data.persistence.models.LoginModel +import com.fastaccess.data.repository.LoginRepository +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import com.google.gson.Gson +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 12.05.18. + */ +class LoginWithAccessTokenUseCase @Inject constructor( + private val loginRepository: LoginRepository, + private val gson: Gson, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + override fun buildObservable(): Observable = loginRepository.loginAccessToken() + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { gson.fromJson(gson.toJson(it), LoginModel::class.java) } + + fun insertUser(loginModel: LoginModel): Observable = Observable.fromCallable { + loginRepository.logoutAll() + loginRepository.insert(loginModel) + val login = loginRepository.getLoginBlocking() + return@fromCallable if (login?.id == loginModel.id) { + login + } else { + null + } + }.subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/feed/FeedsUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/feed/FeedsUseCase.kt new file mode 100644 index 000000000..0604c479b --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/feed/FeedsUseCase.kt @@ -0,0 +1,22 @@ +package com.fastaccess.github.usecase.feed + +import com.fastaccess.data.repository.FeedsRepository +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.response.FeedResponse +import com.fastaccess.domain.response.PageableResponse +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 26.06.18. + */ +class FeedsUseCase @Inject constructor( + private val feedsRepositoryProvider: FeedsRepository, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + var page: Int = 0 + override fun buildObservable(): Observable> = feedsRepositoryProvider.getReceivedEvents(page) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/files/GetFileContentUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/files/GetFileContentUseCase.kt new file mode 100644 index 000000000..557106208 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/files/GetFileContentUseCase.kt @@ -0,0 +1,40 @@ +package com.fastaccess.github.usecase.files + +import com.apollographql.apollo.ApolloClient +import com.apollographql.apollo.rx2.Rx2Apollo +import com.fastaccess.data.model.FileConentModel +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import github.GetFileContentQuery +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 2019-07-30. + */ +class GetFileContentUseCase @Inject constructor( + private val apolloClient: ApolloClient, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var repo: String = "" + var login: String = "" + var path: String = "" + + override fun buildObservable(): Observable = Rx2Apollo.from( + apolloClient.query( + GetFileContentQuery.builder() + .login(login) + .repo(repo) + .path(path) + .build() + ) + ) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { + val response = it.data()?.repositoryOwner?.repository?.`object` as? GetFileContentQuery.AsBlob + return@map FileConentModel(response?.text, response?.isBinary, response?.isTruncated, response?.byteSize) + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/AddAssigneesUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/AddAssigneesUseCase.kt new file mode 100644 index 000000000..5201f56b7 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/AddAssigneesUseCase.kt @@ -0,0 +1,35 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.services.IssuePrService +import com.fastaccess.domain.response.body.AssigneesBodyModel +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 16.02.19. + */ +class AddAssigneesUseCase @Inject constructor( + private val service: IssuePrService, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var repo: String = "" + var login: String = "" + var number: Int = 0 + var assignees: List? = null + var toRemove: List? = null + + override fun buildObservable(): Observable = when (toRemove.isNullOrEmpty()) { + true -> service.addAssignees(login, repo, number, AssigneesBodyModel(assignees)) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { true } + else -> service.removeAssignees(login, repo, number, AssigneesBodyModel(toRemove)) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .flatMap { service.addAssignees(login, repo, number, AssigneesBodyModel(assignees)) } + .map { true } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/BaseTimelineUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/BaseTimelineUseCase.kt new file mode 100644 index 000000000..1a55313b5 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/BaseTimelineUseCase.kt @@ -0,0 +1,214 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.fastaccess.data.model.* +import com.fastaccess.data.model.parcelable.LabelModel +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import com.fastaccess.extension.* +import github.fragment.* + +abstract class BaseTimelineUseCase : BaseObservableUseCase() { + + + protected fun getTransferred(node: Transferred): TimelineModel = TimelineModel( + transferredEventModel = TransferredEventModel( + node.createdAt, node.actor?.fragments?.shortActor?.toUser(), node.fromRepository?.nameWithOwner + ) + ) + + protected fun getRenamed(node: Renamed): TimelineModel = TimelineModel( + renamedEventModel = RenamedEventModel( + node.createdAt, node.actor?.fragments?.shortActor?.toUser(), node.currentTitle, node.previousTitle + ) + ) + + protected fun getDemilestoned(node: Demilestoned): TimelineModel = TimelineModel( + milestoneEventModel = MilestoneDemilestonedEventModel( + node.createdAt, node.actor?.fragments?.shortActor?.toUser(), node.milestoneTitle, false + ) + ) + + protected fun getMilestone(node: Milestoned): TimelineModel = TimelineModel( + milestoneEventModel = MilestoneDemilestonedEventModel( + node.createdAt, node.actor?.fragments?.shortActor?.toUser(), node.milestoneTitle, true + ) + ) + + protected fun getUnassigned( + node: UnAssigned, + list: ArrayList + ): TimelineModel? { + var shouldAdd = true + list.filter { it.assignedEventModel != null }.map { + if (it.assignedEventModel?.createdAt?.time == node.createdAt.time) { + it.assignedEventModel?.users?.add(ShortUserModel(node.user?.login, node.user?.login, avatarUrl = node.user?.avatarUrl?.toString())) + shouldAdd = false + } + } + if (shouldAdd) { + return TimelineModel( + assignedEventModel = AssignedUnAssignedEventModel( + node.createdAt, node.actor?.fragments?.shortActor?.toUser(), false, + arrayListOf(ShortUserModel(node.user?.login, node.user?.login, avatarUrl = node.user?.avatarUrl?.toString())) + ) + ) + } + return null + } + + protected fun getAssigned( + node: Assigned, + list: ArrayList + ): TimelineModel? { + var shouldAdd = true + list.filter { it.assignedEventModel != null }.map { + if (it.assignedEventModel?.createdAt?.time == node.createdAt.time) { + it.assignedEventModel?.users?.add(ShortUserModel(node.user?.login, node.user?.login, avatarUrl = node.user?.avatarUrl?.toString())) + shouldAdd = false + } + } + if (shouldAdd) { + return TimelineModel( + assignedEventModel = AssignedUnAssignedEventModel( + node.createdAt, node.actor?.fragments?.shortActor?.toUser(), true, + arrayListOf(ShortUserModel(node.user?.login, node.user?.login, avatarUrl = node.user?.avatarUrl?.toString())) + ) + ) + } + return null + } + + protected fun getUnsubscribed( + node: Unsubscribed + ): TimelineModel = TimelineModel( + subscribedUnsubscribedEvent = SubscribedUnsubscribedEventModel( + node.createdAt, node.actor?.fragments?.shortActor?.toUser(), false + ) + ) + + protected fun getSubscribed(node: Subscribed): TimelineModel = TimelineModel( + subscribedUnsubscribedEvent = SubscribedUnsubscribedEventModel( + node.createdAt, node.actor?.fragments?.shortActor?.toUser(), false + ) + ) + + protected fun getUnlabeled( + node: UnLabeled, + list: ArrayList + ): TimelineModel? { + var shouldAdd = true + list.filter { it.labelUnlabeledEvent != null }.map { + if (it.labelUnlabeledEvent?.createdAt?.time == node.createdAt.time) { + it.labelUnlabeledEvent?.labels?.add(constructLabel(node.label)) + shouldAdd = false + } + } + if (shouldAdd) { + return TimelineModel( + labelUnlabeledEvent = LabelUnlabeledEventModel( + node.createdAt, node.actor?.fragments?.shortActor?.toUser(), false, arrayListOf(constructLabel(node.label)) + ) + ) + } + return null + } + + protected fun getLabel( + node: Labeled, + list: ArrayList + ): TimelineModel? { + var shouldAdd = true + list.filter { it.labelUnlabeledEvent != null }.map { + if (it.labelUnlabeledEvent?.createdAt?.time == node.createdAt.time) { + it.labelUnlabeledEvent?.labels?.add(constructLabel(node.label)) + shouldAdd = false + } + } + if (shouldAdd) { + return TimelineModel( + labelUnlabeledEvent = LabelUnlabeledEventModel( + node.createdAt, node.actor?.fragments?.shortActor?.toUser(), true, arrayListOf(constructLabel(node.label)) + ) + ) + } + return null + } + + protected fun constructLabel(m: Any): LabelModel { + return when (m) { + is Labels -> LabelModel(m.name, m.color) + is Labeled -> LabelModel(m.label.name, m.label.color) + is Labeled.Label -> LabelModel(m.name, m.color) + is UnLabeled.Label -> LabelModel(m.fragments.labels.name, m.fragments.labels.color) + else -> throw IllegalArgumentException("$m is not instance of any Label") + } + } + + + protected fun getUnlocked(node: Unlocked): TimelineModel = TimelineModel( + lockUnlockEventModel = LockUnlockEventModel( + node.createdAt, node.actor?.fragments?.shortActor?.toUser(), null, node.lockable.activeLockReason?.rawValue() + ) + ) + + protected fun getLock(node: Locked): TimelineModel = TimelineModel( + lockUnlockEventModel = LockUnlockEventModel( + node.createdAt, node.actor?.fragments?.shortActor?.toUser(), node.lockReason?.rawValue(), node.lockable.activeLockReason?.rawValue(), true + ) + ) + + protected fun getReopened(node: Reopened): TimelineModel { + return TimelineModel( + closeOpenEventModel = CloseOpenEventModel( + node.createdAt, node.actor?.fragments?.shortActor?.toUser() + ) + ) + } + + protected fun getClosed(node: Closed): TimelineModel { + val commit = node.closer?.fragments?.commitFragment?.toCommit() + val pr = node.closer?.fragments?.shortPullRequestRowItem?.toPullRequest() + return TimelineModel( + closeOpenEventModel = CloseOpenEventModel( + node.createdAt, node.actor?.fragments?.shortActor?.toUser(), commit, pr, true + ) + ) + } + + protected fun getReference(node: Referenced): TimelineModel { + val issueModel = node.subject.fragments.shortIssueRowItem?.toIssue() + val pullRequest = node.subject.fragments.shortPullRequestRowItem?.toPullRequest() + return TimelineModel( + referencedEventModel = ReferencedEventModel( + node.commitRepository.nameWithOwner, node.createdAt, ShortUserModel( + node.actor?.fragments?.shortActor?.login, node.actor?.fragments?.shortActor?.login, + node.actor?.fragments?.shortActor?.url?.toString(), + avatarUrl = node.actor?.fragments?.shortActor?.avatarUrl?.toString() + ), node.isCrossRepository, node.isDirectReference, + node.commit?.fragments?.commitFragment?.toCommit(), issueModel, pullRequest + ) + ) + } + + protected fun getCrossReference(node: CrossReferenced): TimelineModel { + val actor = node.actor?.fragments?.shortActor?.toUser() + val issueModel = node.source.fragments.shortIssueRowItem?.toIssue() + val pullRequest = node.source.fragments.shortPullRequestRowItem?.toPullRequest() + return TimelineModel( + crossReferencedEventModel = CrossReferencedEventModel( + node.createdAt, node.referencedAt, + node.isCrossRepository, node.isWillCloseTarget, actor, issueModel, pullRequest + ) + ) + } + + protected fun getComment(node: Comment) = TimelineModel( + comment = CommentModel( + node.id, node.databaseId, + ShortUserModel(node.author?.login, node.author?.login, node.author?.url?.toString(), avatarUrl = node.author?.avatarUrl.toString()), + node.body, CommentAuthorAssociation.fromName(node.authorAssociation.rawValue()), + node.reactionGroups?.map { it.fragments.reactions.toReactionGroup() }, node.createdAt, node.updatedAt, + node.isViewerCanReact, node.isViewerCanDelete, node.isViewerCanUpdate, node.isViewerDidAuthor, node.isViewerCanMinimize + ) + ) + +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/CloseOpenIssuePrUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/CloseOpenIssuePrUseCase.kt new file mode 100644 index 000000000..6eda57cc6 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/CloseOpenIssuePrUseCase.kt @@ -0,0 +1,80 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.fastaccess.data.model.CloseOpenEventModel +import com.fastaccess.data.model.TimelineModel +import com.fastaccess.data.persistence.models.MyIssuesPullsModel +import com.fastaccess.data.repository.IssueRepository +import com.fastaccess.data.repository.LoginRepository +import com.fastaccess.data.repository.PullRequestRepository +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.response.IssueRequestModel +import com.fastaccess.domain.services.IssuePrService +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import com.fastaccess.extension.me +import io.reactivex.Observable +import java.util.* +import javax.inject.Inject + +/** + * Created by Kosh on 16.02.19. + */ +class CloseOpenIssuePrUseCase @Inject constructor( + private val issueRepositoryProvider: IssueRepository, + private val pullRequestRepository: PullRequestRepository, + private val issuePrService: IssuePrService, + private val loginRepositoryProvider: LoginRepository, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var repo: String = "" + var login: String = "" + var number: Int = -1 + var isPr: Boolean = false + + override fun buildObservable(): Observable = if (isPr) { + pullRequestRepository.getPullRequestByNumberMaybe("$login/$repo", number) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .flatMapObservable { issue -> + issuePrService.editIssue(login, repo, number, IssueRequestModel(state = if ("closed".equals(issue.state, true)) "open" else "closed")) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { + issue.state = it.issueState + pullRequestRepository.upsert(issue) + val me = loginRepositoryProvider.getLoginBlocking()?.me() + return@map TimelineModel( + closeOpenEventModel = CloseOpenEventModel( + Date(), me, null, + MyIssuesPullsModel( + issue.id, issue.databaseId, issue.number, issue.title, issue.repo?.nameWithOwner, + 0, it.issueState, issue.url, true + ), it.issueState?.equals("closed", true) + ) + ) + } + } + } else { + issueRepositoryProvider.getIssueByNumberMaybe("$login/$repo", number) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .flatMapObservable { issue -> + issuePrService.editIssue(login, repo, number, IssueRequestModel(state = if ("closed".equals(issue.state, true)) "open" else "closed")) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { + issue.state = it.issueState + issueRepositoryProvider.upsert(issue) + val me = loginRepositoryProvider.getLoginBlocking()?.me() + return@map TimelineModel( + closeOpenEventModel = CloseOpenEventModel( + Date(), me, null, + MyIssuesPullsModel( + issue.id, issue.databaseId, issue.number, issue.title, issue.repo?.nameWithOwner, 0, it.issueState, issue.url + ), it.issueState?.equals("closed", true) + ) + ) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/CreateIssueUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/CreateIssueUseCase.kt new file mode 100644 index 000000000..df7e207b3 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/CreateIssueUseCase.kt @@ -0,0 +1,27 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.services.IssuePrService +import com.fastaccess.domain.response.IssueRequestModel +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 16.02.19. + */ +class CreateIssueUseCase @Inject constructor( + private val issuePrService: IssuePrService, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var repo: String = "" + var login: String = "" + var title: String = "" + var description: String? = null + + override fun buildObservable(): Observable = issuePrService.createIssue(login, repo, IssueRequestModel(title, description)) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { it.htmlUrl } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/CreateLabelUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/CreateLabelUseCase.kt new file mode 100644 index 000000000..f6dd5910c --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/CreateLabelUseCase.kt @@ -0,0 +1,30 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.fastaccess.data.model.parcelable.LabelModel +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.services.RepoService +import com.fastaccess.domain.response.LabelResponse +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 16.02.19. + */ +class CreateLabelUseCase @Inject constructor( + private val repoService: RepoService, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var repo: String = "" + var login: String = "" + var name: String = "" + var color: String = "" + + override fun buildObservable(): Observable = repoService.addLabel(login, repo, LabelResponse(color = color, name = name)) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { + LabelModel(it.name, it.color, it.url) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/CreateMilestoneUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/CreateMilestoneUseCase.kt new file mode 100644 index 000000000..788f42391 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/CreateMilestoneUseCase.kt @@ -0,0 +1,28 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.services.RepoService +import com.fastaccess.domain.response.body.MilestoneBodyModel +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 16.02.19. + */ +class CreateMilestoneUseCase @Inject constructor( + private val repoService: RepoService, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var repo: String = "" + var login: String = "" + var title: String = "" + var description: String? = null + var dueOn: String = "" + + override fun buildObservable(): Observable = repoService.createMilestone(login, repo, MilestoneBodyModel(title, description, dueOn)) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { true } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/EditIssuePrUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/EditIssuePrUseCase.kt new file mode 100644 index 000000000..387229a22 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/EditIssuePrUseCase.kt @@ -0,0 +1,60 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.fastaccess.data.repository.IssueRepository +import com.fastaccess.data.repository.PullRequestRepository +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.response.IssueRequestModel +import com.fastaccess.domain.services.IssuePrService +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 16.02.19. + */ +class EditIssuePrUseCase @Inject constructor( + private val issueRepositoryProvider: IssueRepository, + private val pullRequestRepository: PullRequestRepository, + private val issuePrService: IssuePrService, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var repo: String = "" + var login: String = "" + var number: Int = -1 + var title: String? = null + var description: String? = null + var isPr: Boolean = false + + override fun buildObservable(): Observable = if (isPr) { + pullRequestRepository.getPullRequestByNumberMaybe("$login/$repo", number) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .flatMapObservable { issue -> + issuePrService.editIssue(login, repo, number, IssueRequestModel(title = title, body = description)) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { + issue.title = it.title + issue.body = it.body + pullRequestRepository.upsert(issue) + return@map true + } + } + } else { + issueRepositoryProvider.getIssueByNumberMaybe("$login/$repo", number) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .flatMapObservable { issue -> + issuePrService.editIssue(login, repo, number, IssueRequestModel(title = title, body = description)) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { + issue.title = it.title + issue.body = it.body + issueRepositoryProvider.upsert(issue) + return@map true + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/FilterIssuesUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/FilterIssuesUseCase.kt new file mode 100644 index 000000000..4dd75d633 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/FilterIssuesUseCase.kt @@ -0,0 +1,125 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.apollographql.apollo.ApolloClient +import com.apollographql.apollo.api.Input +import com.apollographql.apollo.rx2.Rx2Apollo +import com.fastaccess.data.model.PageInfoModel +import com.fastaccess.data.model.parcelable.FilterIssuesPrsModel +import com.fastaccess.data.persistence.models.MyIssuesPullsModel +import com.fastaccess.data.repository.LoginRepository +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import github.SearchIssuesQuery +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 20.01.19. + */ +class FilterIssuesUseCase @Inject constructor( + private val loginRepository: LoginRepository, + private val apolloClient: ApolloClient, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var cursor: Input = Input.absent() + var filterModel = FilterIssuesPrsModel() + var keyword: String? = null + + override fun buildObservable(): Observable>> { + val query = keyword + return if (query.isNullOrEmpty()) { + loginRepository.getLogin() + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .flatMapObservable { user -> + return@flatMapObservable user.login?.let { login -> + searchObservable(login = login) + } ?: Observable.empty() + } + } else { + searchObservable(query = query) + } + } + + private fun searchObservable( + login: String? = null, + query: String? = null + ): Observable>> { + return Rx2Apollo.from(apolloClient.query(SearchIssuesQuery(constructQuery(filterModel, login, query), cursor))) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { it.data()?.search } + .map { search -> + val list = search.nodes?.asSequence()?.mapNotNull { it.fragments.shortIssueRowItem } + ?.map { + MyIssuesPullsModel( + it.id, it.databaseId, it.number, it.title, + it.repository.nameWithOwner, it.comments.totalCount, it.issueState.rawValue(), it.url.toString() + ) + } + ?.toList() ?: arrayListOf() + val pageInfo = PageInfoModel( + search.pageInfo.startCursor, search.pageInfo.endCursor, + search.pageInfo.isHasNextPage, search.pageInfo.isHasPreviousPage + ) + return@map Pair(pageInfo, list) + } + } + + + /** + * Example: is:open is:issue author:k0shk0sh archived:false sort:created-desc + */ + private fun constructQuery( + model: FilterIssuesPrsModel, + login: String? = null, + query: String? = null + ): String { + return StringBuilder() + .append(if (query.isNullOrEmpty()) "" else "$query ") + .append( + "is:${when (model.searchType) { + FilterIssuesPrsModel.SearchType.OPEN -> "open" + FilterIssuesPrsModel.SearchType.CLOSED -> "closed" + }}" + ) + .append(" ") + .append("is:issue") + .append(" ") + .append("archived:false") + .append(" ") + .append( + "sort:${when (model.searchSortBy) { + FilterIssuesPrsModel.SearchSortBy.NEWEST -> "created-desc" + FilterIssuesPrsModel.SearchSortBy.OLDEST -> "created-asc" + FilterIssuesPrsModel.SearchSortBy.MOST_COMMENTED -> "comments-desc" + FilterIssuesPrsModel.SearchSortBy.LEAST_COMMENTED -> "comments-asc" + FilterIssuesPrsModel.SearchSortBy.RECENTLY_UPDATED -> "updated-desc" + FilterIssuesPrsModel.SearchSortBy.LEAST_RECENTLY_UPDATED -> "updated-asc" + }}" + ) + .append(" ") + .apply { + if (!login.isNullOrEmpty()) { + append( + "${when (model.searchBy) { + FilterIssuesPrsModel.SearchBy.ASSIGNED -> "assignee" + FilterIssuesPrsModel.SearchBy.MENTIONED -> "mentions" + else -> "author" + }}:$login" + ).append(" ") + } + if (model.searchVisibility != FilterIssuesPrsModel.SearchVisibility.BOTH) { + append( + "is:${when (model.searchVisibility) { + FilterIssuesPrsModel.SearchVisibility.PUBLIC -> "public" + FilterIssuesPrsModel.SearchVisibility.PRIVATE -> "private" + else -> "" + }}" + ) + } + } + .toString() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/FilterPullRequestsUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/FilterPullRequestsUseCase.kt new file mode 100644 index 000000000..120390288 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/FilterPullRequestsUseCase.kt @@ -0,0 +1,125 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.apollographql.apollo.ApolloClient +import com.apollographql.apollo.api.Input +import com.apollographql.apollo.rx2.Rx2Apollo +import com.fastaccess.data.model.PageInfoModel +import com.fastaccess.data.model.parcelable.FilterIssuesPrsModel +import com.fastaccess.data.persistence.models.MyIssuesPullsModel +import com.fastaccess.data.repository.LoginRepository +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import github.SearchPullRequestsQuery +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 20.01.19. + */ +class FilterPullRequestsUseCase @Inject constructor( + private val loginRepository: LoginRepository, + private val apolloClient: ApolloClient, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var cursor: Input = Input.absent() + var filterModel = FilterIssuesPrsModel() + var keyword: String? = null + + override fun buildObservable(): Observable>> { + val query = keyword + return if (query.isNullOrEmpty()) { + loginRepository.getLogin() + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .flatMapObservable { user -> + return@flatMapObservable user.login?.let { login -> + searchObservable(login = login) + } ?: Observable.empty() + } + } else { + searchObservable(query = query) + } + } + + private fun searchObservable( + login: String? = null, + query: String? = null + ): Observable>> { + return Rx2Apollo.from(apolloClient.query(SearchPullRequestsQuery(constructQuery(filterModel, login, query), cursor))) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { it.data()?.search } + .map { search -> + val list = search.nodes?.asSequence()?.mapNotNull { it.fragments.shortPullRequestRowItem } + ?.map { + MyIssuesPullsModel( + it.id, it.databaseId, it.number, it.title, + it.repository.nameWithOwner, it.comments.totalCount, it.state.name, it.url.toString(), true + ) + } + ?.toList() ?: arrayListOf() + val pageInfo = PageInfoModel( + search.pageInfo.startCursor, search.pageInfo.endCursor, + search.pageInfo.isHasNextPage, search.pageInfo.isHasPreviousPage + ) + return@map Pair(pageInfo, list) + } + } + + /** + * Example: is:open is:pr author:k0shk0sh archived:false sort:created-desc + */ + private fun constructQuery( + model: FilterIssuesPrsModel, + login: String? = null, + query: String? = null + ): String { + return StringBuilder() + .append(if (query.isNullOrEmpty()) "" else "$query ") + .append( + "is:${when (model.searchType) { + FilterIssuesPrsModel.SearchType.OPEN -> "open" + FilterIssuesPrsModel.SearchType.CLOSED -> "closed" + }}" + ) + .append(" ") + .append("is:pr") + .append(" ") + .append("archived:false") + .append(" ") + .append( + "sort:${when (model.searchSortBy) { + FilterIssuesPrsModel.SearchSortBy.NEWEST -> "created-desc" + FilterIssuesPrsModel.SearchSortBy.OLDEST -> "created-asc" + FilterIssuesPrsModel.SearchSortBy.MOST_COMMENTED -> "comments-desc" + FilterIssuesPrsModel.SearchSortBy.LEAST_COMMENTED -> "comments-asc" + FilterIssuesPrsModel.SearchSortBy.RECENTLY_UPDATED -> "updated-desc" + FilterIssuesPrsModel.SearchSortBy.LEAST_RECENTLY_UPDATED -> "updated-asc" + }}" + ) + .append(" ") + .apply { + if (!login.isNullOrEmpty()) { + append( + "${when (model.searchBy) { + FilterIssuesPrsModel.SearchBy.ASSIGNED -> "assignee" + FilterIssuesPrsModel.SearchBy.MENTIONED -> "mentions" + FilterIssuesPrsModel.SearchBy.REVIEW_REQUESTS -> "review-requested" + else -> "author" + }}:$login" + ).append(" ") + } + if (model.searchVisibility != FilterIssuesPrsModel.SearchVisibility.BOTH) { + append( + "is:${when (model.searchVisibility) { + FilterIssuesPrsModel.SearchVisibility.PUBLIC -> "public" + FilterIssuesPrsModel.SearchVisibility.PRIVATE -> "private" + else -> "" + }}" + ) + } + } + .toString() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetAssigneesUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetAssigneesUseCase.kt new file mode 100644 index 000000000..955d68824 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetAssigneesUseCase.kt @@ -0,0 +1,46 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.apollographql.apollo.ApolloClient +import com.apollographql.apollo.api.Input +import com.apollographql.apollo.rx2.Rx2Apollo +import com.fastaccess.data.model.PageInfoModel +import com.fastaccess.data.model.ShortUserModel +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import com.fastaccess.extension.toUser +import github.GetAssigneesQuery +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 27.01.19. + */ +class GetAssigneesUseCase @Inject constructor( + private val apolloClient: ApolloClient, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var login: String? = null + var repo: String? = null + var page: Input = Input.absent() + + override fun buildObservable(): Observable>> { + val login = login + val repo = repo + + if (login.isNullOrEmpty() || repo.isNullOrEmpty()) { + return Observable.error(Throwable("this should never happen ;)")) + } + return Rx2Apollo.from(apolloClient.query(GetAssigneesQuery(login, repo, page))) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { it.data()?.repositoryOwner?.repository?.assignableUsers } + .map { data -> + val pageInfo = PageInfoModel( + data.pageInfo.startCursor, data.pageInfo.endCursor, + data.pageInfo.isHasNextPage, data.pageInfo.isHasPreviousPage + ) + return@map Pair(pageInfo, data.nodes?.map { it.fragments.shortUserRowItem.toUser() } ?: listOf()) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetIssueTimelineUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetIssueTimelineUseCase.kt new file mode 100644 index 000000000..2f3f9307c --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetIssueTimelineUseCase.kt @@ -0,0 +1,75 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.apollographql.apollo.ApolloClient +import com.apollographql.apollo.api.Input +import com.apollographql.apollo.rx2.Rx2Apollo +import com.fastaccess.data.model.* +import com.fastaccess.data.model.parcelable.LabelModel +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import com.fastaccess.extension.* +import com.fastaccess.github.extensions.addIfNotNull +import github.GetIssueTimelineQuery +import github.GetIssueTimelineQuery.* +import github.fragment.* +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 27.01.19. + */ +class GetIssueTimelineUseCase @Inject constructor( + private val apolloClient: ApolloClient, + private val schedulerProvider: SchedulerProvider +) : BaseTimelineUseCase() { + + var login: String? = null + var repo: String? = null + var number: Int? = null + var page: Input = Input.absent() + + override fun buildObservable(): Observable>> { + val login = login + val repo = repo + val number = number + + if (login.isNullOrEmpty() || repo.isNullOrEmpty() || number == null) { + return Observable.error(Throwable("this should never happen ;)")) + } + + return Rx2Apollo.from(apolloClient.query(GetIssueTimelineQuery(login, repo, number, page))) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { it.data()?.repositoryOwner?.repository?.issue } + .map { issue -> + val list = arrayListOf() + val timeline = issue.timelineItems + val pageInfo = PageInfoModel( + timeline.pageInfo.startCursor, timeline.pageInfo.endCursor, + timeline.pageInfo.isHasNextPage, timeline.pageInfo.isHasPreviousPage + ) + timeline.nodes?.forEach { node -> + when (node) { + is AsIssueComment -> node.fragments.comment?.let { list.add(getComment(it)) } + is AsCrossReferencedEvent -> node.fragments.crossReferenced?.let { list.add(getCrossReference(it)) } + is AsClosedEvent -> node.fragments.closed?.let { list.add(getClosed(it)) } + is AsReopenedEvent -> node.fragments.reopened?.let { list.add(getReopened(it)) } + is AsSubscribedEvent -> node.fragments.subscribed?.let { list.add(getSubscribed(it)) } + is AsUnsubscribedEvent -> node.fragments.unsubscribed?.let { list.add(getUnsubscribed(it)) } + is AsReferencedEvent -> node.fragments.referenced?.let { list.add(getReference(it)) } + is AsAssignedEvent -> node.fragments.assigned?.let { list.addIfNotNull(getAssigned(it, list)) } + is AsUnassignedEvent -> node.fragments.unAssigned?.let { list.addIfNotNull(getUnassigned(it, list)) } + is AsLabeledEvent -> node.fragments.labeled?.let { list.addIfNotNull(getLabel(it, list)) } + is AsUnlabeledEvent -> node.fragments.unLabeled?.let { list.addIfNotNull(getUnlabeled(it, list)) } + is AsMilestonedEvent -> node.fragments.milestoned?.let { list.add(getMilestone(it)) } + is AsDemilestonedEvent -> node.fragments.demilestoned?.let { list.add(getDemilestoned(it)) } + is AsRenamedTitleEvent -> node.fragments.renamed?.let { list.add(getRenamed(it)) } + is AsLockedEvent -> node.fragments.locked?.let { list.add(getLock(it)) } + is AsUnlockedEvent -> node.fragments.unlocked?.let { list.add(getUnlocked(it)) } + is AsTransferredEvent -> node.fragments.transferred?.let { list.add(getTransferred(it)) } + } + } + return@map Pair(pageInfo, list) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetIssueUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetIssueUseCase.kt new file mode 100644 index 000000000..9d3a3c051 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetIssueUseCase.kt @@ -0,0 +1,62 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.apollographql.apollo.ApolloClient +import com.apollographql.apollo.rx2.Rx2Apollo +import com.fastaccess.data.model.CountModel +import com.fastaccess.data.model.EmbeddedRepoModel +import com.fastaccess.data.model.ShortUserModel +import com.fastaccess.data.persistence.models.IssueModel +import com.fastaccess.data.repository.IssueRepository +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import com.fastaccess.extension.toLabels +import com.fastaccess.extension.toMilestone +import com.fastaccess.extension.toReactionGroup +import com.fastaccess.extension.toUser +import github.GetIssueQuery +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 27.01.19. + */ +class GetIssueUseCase @Inject constructor( + private val issueRepositoryProvider: IssueRepository, + private val apolloClient: ApolloClient, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var login: String? = null + var repo: String? = null + var number: Int? = null + + override fun buildObservable(): Observable<*> { + val login = login + val repo = repo + val number = number + + if (login.isNullOrEmpty() || repo.isNullOrEmpty() || number == null) { + return Observable.error(Throwable("this should never happen ;)")) + } + + return Rx2Apollo.from(apolloClient.query(GetIssueQuery(login, repo, number))) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { it.data()?.repositoryOwner?.repository?.issue?.fragments?.fullIssue } + .map { issue -> + issueRepositoryProvider.upsert(IssueModel(issue.id, issue.databaseId, issue.number, issue.activeLockReason?.rawValue(), + issue.body, issue.bodyHTML.toString(), issue.closedAt, issue.createdAt, issue.updatedAt, issue.state.rawValue(), + issue.title, issue.viewerSubscription?.rawValue(), ShortUserModel( + issue.author?.login, issue.author?.login, + issue.author?.url?.toString(), avatarUrl = issue.author?.avatarUrl?.toString() + ), + EmbeddedRepoModel(issue.repository.nameWithOwner), CountModel(issue.userContentEdits?.totalCount), + issue.reactionGroups?.map { it.fragments.reactions.toReactionGroup() }, + issue.viewerCannotUpdateReasons.map { it.rawValue() }, issue.isClosed, issue.isCreatedViaEmail, issue.isLocked, + issue.isViewerCanReact, issue.isViewerCanSubscribe, issue.isViewerCanUpdate, issue.isViewerDidAuthor, + issue.authorAssociation.rawValue(), issue.url.toString(), issue.labels?.nodes?.map { it.fragments.labels.toLabels() }, + issue.milestone?.toMilestone(), issue.assignees.nodes?.map { it.fragments }?.map { it.shortUserRowItem.toUser() }) + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetLabelsUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetLabelsUseCase.kt new file mode 100644 index 000000000..7c252042e --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetLabelsUseCase.kt @@ -0,0 +1,48 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.apollographql.apollo.ApolloClient +import com.apollographql.apollo.api.Input +import com.apollographql.apollo.rx2.Rx2Apollo +import com.fastaccess.data.model.PageInfoModel +import com.fastaccess.data.model.parcelable.LabelModel +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import com.fastaccess.extension.toLabels +import github.GetLabelsQuery +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 27.01.19. + */ +class GetLabelsUseCase @Inject constructor( + private val apolloClient: ApolloClient, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var login: String? = null + var repo: String? = null + var page: Input = Input.absent() + + override fun buildObservable(): Observable>> { + val login = login + val repo = repo + + if (login.isNullOrEmpty() || repo.isNullOrEmpty()) { + return Observable.error>>(Throwable("this should never happen ;)")) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + } + return Rx2Apollo.from(apolloClient.query(GetLabelsQuery(login, repo, page))) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { it.data()?.repositoryOwner?.repository?.labels } + .map { data -> + val pageInfo = PageInfoModel( + data.pageInfo.startCursor, data.pageInfo.endCursor, + data.pageInfo.isHasNextPage, data.pageInfo.isHasPreviousPage + ) + return@map Pair(pageInfo, data.nodes?.map { it.fragments.labels.toLabels() } ?: listOf()) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetMilestonesUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetMilestonesUseCase.kt new file mode 100644 index 000000000..7bc0dd615 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetMilestonesUseCase.kt @@ -0,0 +1,51 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.apollographql.apollo.ApolloClient +import com.apollographql.apollo.api.Input +import com.apollographql.apollo.rx2.Rx2Apollo +import com.fastaccess.data.model.PageInfoModel +import com.fastaccess.data.model.parcelable.MilestoneModel +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import github.GetMilestonesQuery +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 27.01.19. + */ +class GetMilestonesUseCase @Inject constructor( + private val apolloClient: ApolloClient, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var login: String? = null + var repo: String? = null + var page: Input = Input.absent() + + override fun buildObservable(): Observable>> { + val login = login + val repo = repo + + if (login.isNullOrEmpty() || repo.isNullOrEmpty()) { + return Observable.error(Throwable("this should never happen ;)")) + } + return Rx2Apollo.from(apolloClient.query(GetMilestonesQuery(login, repo, page))) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { it.data()?.repositoryOwner?.repository?.milestones } + .map { data -> + val pageInfo = PageInfoModel( + data.pageInfo.startCursor, data.pageInfo.endCursor, + data.pageInfo.isHasNextPage, data.pageInfo.isHasPreviousPage + ) + return@map Pair(pageInfo, data.nodes?.map { it.fragments.milestoneFragment } + ?.map { + MilestoneModel( + it.id, it.title, it.description, it.state.toString(), + it.url.toString(), it.number, it.isClosed, it.dueOn + ) + } ?: listOf()) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetPullRequestTimelineUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetPullRequestTimelineUseCase.kt new file mode 100644 index 000000000..7a2cc7593 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetPullRequestTimelineUseCase.kt @@ -0,0 +1,252 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.apollographql.apollo.ApolloClient +import com.apollographql.apollo.api.Input +import com.apollographql.apollo.rx2.Rx2Apollo +import com.fastaccess.data.model.* +import com.fastaccess.data.persistence.models.MyIssuesPullsModel +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.extension.toReactionGroup +import com.fastaccess.extension.toUser +import com.fastaccess.github.extensions.addIfNotNull +import github.GetPullRequestTimelineQuery +import github.GetPullRequestTimelineQuery.* +import github.type.PullRequestState +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 27.01.19. + */ +class GetPullRequestTimelineUseCase @Inject constructor( + private val apolloClient: ApolloClient, + private val schedulerProvider: SchedulerProvider +) : BaseTimelineUseCase() { + + var login: String? = null + var repo: String? = null + var number: Int? = null + var page: Input = Input.absent() + + override fun buildObservable(): Observable>> { + val login = login + val repo = repo + val number = number + + if (login.isNullOrEmpty() || repo.isNullOrEmpty() || number == null) { + return Observable.error(Throwable("this should never happen ;)")) + } + + val observable = Rx2Apollo.from(apolloClient.query(GetPullRequestTimelineQuery(login, repo, number, page))) + .map { it.data()?.repositoryOwner?.repository?.pullRequest } + .map { pullRequest -> + val list = arrayListOf() + val timeline = pullRequest.timelineItems + val pageInfo = PageInfoModel( + timeline.pageInfo.startCursor, timeline.pageInfo.endCursor, + timeline.pageInfo.isHasNextPage, timeline.pageInfo.isHasPreviousPage + ) + timeline.nodes?.forEach { node -> + when (node) { + is AsIssueComment -> node.fragments.comment?.let { list.add(getComment(it)) } + is AsCrossReferencedEvent -> node.fragments.crossReferenced?.let { list.add(getCrossReference(it)) } + is AsClosedEvent -> node.fragments.closed?.let { + list.add( + if (PullRequestState.MERGED == pullRequest.state) { + getClosed(it).apply { + closeOpenEventModel?.pullRequest = MyIssuesPullsModel(state = pullRequest.state.rawValue(), isPr = true) + } + } else { + getClosed(it) + } + ) + } + is AsReopenedEvent -> node.fragments.reopened?.let { list.add(getReopened(it)) } + is AsSubscribedEvent -> node.fragments.subscribed?.let { list.add(getSubscribed(it)) } + is AsUnsubscribedEvent -> node.fragments.unsubscribed?.let { list.add(getUnsubscribed(it)) } + is AsReferencedEvent -> node.fragments.referenced?.let { list.add(getReference(it)) } + is AsAssignedEvent -> node.fragments.assigned?.let { list.addIfNotNull(getAssigned(it, list)) } + is AsUnassignedEvent -> node.fragments.unAssigned?.let { list.addIfNotNull(getUnassigned(it, list)) } + is AsLabeledEvent -> node.fragments.labeled?.let { list.addIfNotNull(getLabel(it, list)) } + is AsUnlabeledEvent -> node.fragments.unLabeled?.let { list.addIfNotNull(getUnlabeled(it, list)) } + is AsMilestonedEvent -> node.fragments.milestoned?.let { list.add(getMilestone(it)) } + is AsDemilestonedEvent -> node.fragments.demilestoned?.let { list.add(getDemilestoned(it)) } + is AsRenamedTitleEvent -> node.fragments.renamed?.let { list.add(getRenamed(it)) } + is AsLockedEvent -> node.fragments.locked?.let { list.add(getLock(it)) } + is AsUnlockedEvent -> node.fragments.unlocked?.let { list.add(getUnlocked(it)) } + is AsTransferredEvent -> node.fragments.transferred?.let { list.add(getTransferred(it)) } + is AsBaseRefChangedEvent -> list.add(getBaseRefChanged(node)) + is AsBaseRefForcePushedEvent -> list.add(getBaseRefForcePush(node)) + is AsHeadRefForcePushedEvent -> list.add(getHeadRefForcePush(node)) + is AsHeadRefRestoredEvent -> list.add(getHeadRestored(node)) + is AsHeadRefDeletedEvent -> list.add(getHeadRefDeleted(node)) + is AsReviewRequestedEvent -> list.add(getRequestForReview(node)) + is AsReviewDismissedEvent -> list.add(getDismissedReview(node)) + is AsReviewRequestRemovedEvent -> list.add(getReviewRemoved(node)) + is AsPullRequestReview -> list.add(getPullRequestReview(node)) + is AsPullRequestCommitCommentThread -> list.add(getCommitThread(node)) + } + } + return@map Pair(pageInfo, list) + } + + return observable.subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + } + + private fun getCommitThread(node: AsPullRequestCommitCommentThread) = TimelineModel( + commitThread = CommitThreadModel( + node.path, node.position, + node.tComment.nodes?.map { + CommentModel( + it.id, + it.databaseId, + ShortUserModel(it.author?.login, it.author?.login, it.author?.url?.toString(), avatarUrl = it.author?.avatarUrl?.toString()), + it.body, CommentAuthorAssociation.fromName(it.authorAssociation.rawValue()), + it.reactionGroups?.map { it.fragments.reactions.toReactionGroup() }, + it.updatedAt, it.updatedAt, it.isViewerCanReact, it.isViewerCanDelete, + it.isViewerCanUpdate, it.isViewerDidAuthor, false, + it.path, it.position + ) + }?.firstOrNull() + ) + ) + + private fun getPullRequestReview(node: AsPullRequestReview) = TimelineModel( + review = ReviewModel( + node.id, + node.databaseId, + ShortUserModel(node.author?.login, node.author?.login, node.author?.url?.toString(), avatarUrl = node.author?.avatarUrl?.toString()), + node.body, + node.authorAssociation.rawValue(), + node.state.rawValue(), + node.createdAt, + node.comments.nodes + ?.map { it.fragments.pullRequestReviewCommentFragment } + ?.map { + CommentModel( + it.id, + it.databaseId, + ShortUserModel(it.author?.login, it.author?.login, it.author?.url?.toString(), avatarUrl = it.author?.avatarUrl?.toString()), + it.body, CommentAuthorAssociation.fromName(it.authorAssociation.rawValue()), + it.reactionGroups?.map { it.fragments.reactions.toReactionGroup() }, + it.updatedAt, it.updatedAt, it.isViewerCanReact, it.isViewerCanDelete, + it.isViewerCanUpdate, it.isViewerDidAuthor, false, + it.path, it.originalPosition, it.isOutdated, it.diffHunk + ) + }?.firstOrNull(), + node.isViewerCanReact, + node.isViewerCanDelete, + node.isViewerCanUpdate, + node.isViewerDidAuthor, + false, + node.reactionGroups?.map { it.fragments.reactions.toReactionGroup() } + ) + ) + +// private fun getPullRequestCommit(node: AsPullRequestCommit) = TimelineModel( +// pullRequestCommit = PullRequestCommitModel( +// node.id, +// node.url.toString(), +// CommitModel( +// node.prCommit.oid.toString(), +// ShortUserModel( +// node.prCommit.author?.name, +// node.prCommit.author?.name, +// node.prCommit.author?.user?.url.toString(), +// avatarUrl = node.prCommit.author?.avatarUrl?.toString() ?: node.prCommit.author?.user?.avatarUrl?.toString() +// ), +// node.prCommit.message, +// node.prCommit.abbreviatedOid, +// node.prCommit.commitUrl.toString(), +// node.prCommit.authoredDate, +// node.prCommit.isCommittedViaWeb, +// node.prCommit.history.nodes?.lastOrNull()?.status?.state?.rawValue() +// ) +// ) +// ) + + private fun getReviewRemoved(node: AsReviewRequestRemovedEvent) = TimelineModel( + reviewRequestRemoved = ReviewRequestRemovedModel( + node.actor?.fragments?.shortActor?.toUser(), + when (val m = node.requestedReviewer) { + is AsUser1 -> ShortUserModel(m.login, m.login, m.url.toString(), avatarUrl = m.userAvatar.toString()) + is AsTeam1 -> ShortUserModel(m.name, m.name, m.url.toString(), avatarUrl = m.teamAvatar.toString()) + is AsMannequin1 -> ShortUserModel(m.login, m.login, m.url.toString(), avatarUrl = m.monnequinAvatar.toString()) + else -> null + }, + node.createdAt, + node.requestedReviewer is AsUser1, + node.requestedReviewer is AsTeam1, + node.requestedReviewer is AsMannequin1 + ) + ) + + private fun getDismissedReview(node: AsReviewDismissedEvent) = TimelineModel( + reviewDismissed = ReviewDismissedModel( + node.actor?.fragments?.shortActor?.toUser(), + node.createdAt, + node.dismissalMessage, + node.previousReviewState.rawValue(), + node.url.toString() + ) + ) + + private fun getRequestForReview(node: AsReviewRequestedEvent) = TimelineModel( + reviewRequested = ReviewRequestedModel( + node.actor?.fragments?.shortActor?.toUser(), + when (val m = node.requestedReviewer) { + is AsUser -> ShortUserModel(m.login, m.login, m.url.toString(), avatarUrl = m.userAvatar.toString()) + is AsTeam -> ShortUserModel(m.name, m.name, m.url.toString(), avatarUrl = m.teamAvatar.toString()) + is AsMannequin -> ShortUserModel(m.login, m.login, m.url.toString(), avatarUrl = m.monnequinAvatar.toString()) + else -> null + }, + node.createdAt, + node.requestedReviewer is AsUser, + node.requestedReviewer is AsTeam, + node.requestedReviewer is AsMannequin + ) + ) + + private fun getHeadRefDeleted(node: AsHeadRefDeletedEvent) = TimelineModel( + headRefDeleted = HeadRefDeletedModel( + node.actor?.fragments?.shortActor?.toUser(), + node.headRefName, + node.createdAt + ) + ) + + private fun getHeadRestored(node: AsHeadRefRestoredEvent) = TimelineModel( + headRefRestored = HeadRefRestoredModel( + node.actor?.fragments?.shortActor?.toUser(), + node.createdAt + ) + ) + + private fun getHeadRefForcePush(node: AsHeadRefForcePushedEvent): TimelineModel = TimelineModel( + baseRefForcePush = BaseRefForcePushModel( + node.actor?.fragments?.shortActor?.toUser(), + node.beforeCommit?.abbreviatedOid, + node.afterCommit?.abbreviatedOid, + node.createdAt, + false + ) + ) + + private fun getBaseRefForcePush(node: AsBaseRefForcePushedEvent) = TimelineModel( + baseRefForcePush = BaseRefForcePushModel( + node.actor?.fragments?.shortActor?.toUser(), + node.beforeCommit?.abbreviatedOid, + node.afterCommit?.abbreviatedOid, + node.createdAt + ) + ) + + private fun getBaseRefChanged(node: AsBaseRefChangedEvent) = TimelineModel( + baseRefChangedEvent = BaseRefChangedModel( + node.databaseId, + node.actor?.fragments?.shortActor?.toUser(), + node.createdAt + ) + ) +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetPullRequestUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetPullRequestUseCase.kt new file mode 100644 index 000000000..2e62c1be1 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/GetPullRequestUseCase.kt @@ -0,0 +1,78 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.apollographql.apollo.ApolloClient +import com.apollographql.apollo.rx2.Rx2Apollo +import com.fastaccess.data.model.CountModel +import com.fastaccess.data.model.EmbeddedRepoModel +import com.fastaccess.data.model.PullRequestDashboard +import com.fastaccess.data.model.ShortUserModel +import com.fastaccess.data.persistence.models.PullRequestModel +import com.fastaccess.data.repository.PullRequestRepository +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import com.fastaccess.extension.toLabels +import com.fastaccess.extension.toMilestone +import com.fastaccess.extension.toReactionGroup +import com.fastaccess.extension.toUser +import github.GetPullRequestQuery +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 27.01.19. + */ +class GetPullRequestUseCase @Inject constructor( + private val repoProvider: PullRequestRepository, + private val apolloClient: ApolloClient, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var login: String? = null + var repo: String? = null + var number: Int? = null + + override fun buildObservable(): Observable<*> { + val login = login + val repo = repo + val number = number + + if (login.isNullOrEmpty() || repo.isNullOrEmpty() || number == null) { + return Observable.error(Throwable("this should never happen ;)")) + } + + return Rx2Apollo.from(apolloClient.query(GetPullRequestQuery(login, repo, number))) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { it.data()?.repositoryOwner?.repository?.pullRequest?.fragments?.fullPullRequest } + .map { issue -> + repoProvider.upsert( + PullRequestModel( + issue.id, issue.databaseId, issue.number, issue.activeLockReason?.rawValue(), + issue.body, issue.bodyHTML.toString(), issue.closedAt, issue.createdAt, issue.updatedAt, issue.state.rawValue(), + issue.title, issue.viewerSubscription?.rawValue(), ShortUserModel( + issue.author?.login, issue.author?.login, + issue.author?.url?.toString(), avatarUrl = issue.author?.avatarUrl?.toString() + ), + EmbeddedRepoModel(issue.repository.nameWithOwner), ShortUserModel( + issue.mergedBy?.login, issue.mergedBy?.login, + issue.mergedBy?.url?.toString(), avatarUrl = issue.mergedBy?.avatarUrl?.toString() + ), + CountModel(issue.userContentEdits?.totalCount), + issue.reactionGroups?.map { it.fragments.reactions.toReactionGroup() }, + issue.viewerCannotUpdateReasons.map { it.rawValue() }, issue.isClosed, issue.isCreatedViaEmail, issue.isLocked, + issue.isViewerCanReact, issue.isViewerCanSubscribe, issue.isViewerCanUpdate, issue.isViewerDidAuthor, + issue.mergeable.rawValue(), issue.isMerged, issue.mergedAt, + issue.authorAssociation.rawValue(), issue.url.toString(), issue.labels?.nodes?.map { it.fragments.labels.toLabels() }, + issue.milestone?.toMilestone(), issue.assignees.nodes?.map { it.fragments }?.map { it.shortUserRowItem.toUser() }, + issue.headRefName, issue.baseRefName, + PullRequestDashboard( + issue.changedFiles, issue.additions, issue.deletions, + issue.commits.totalCount, issue.commentedReviews?.totalCount ?: 0, + issue.approvedReviews?.totalCount ?: 0, + issue.changeRequestedReviews?.totalCount ?: 0 + ) + ) + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/LockUnlockIssuePrUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/LockUnlockIssuePrUseCase.kt new file mode 100644 index 000000000..1df7593ea --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/LockUnlockIssuePrUseCase.kt @@ -0,0 +1,89 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.apollographql.apollo.ApolloClient +import com.apollographql.apollo.rx2.Rx2Apollo +import com.fastaccess.data.model.LockUnlockEventModel +import com.fastaccess.data.model.TimelineModel +import com.fastaccess.data.repository.IssueRepository +import com.fastaccess.data.repository.LoginRepository +import com.fastaccess.data.repository.PullRequestRepository +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import com.fastaccess.extension.me +import github.LockMutation +import github.UnlockMutation +import github.type.LockReason +import io.reactivex.Observable +import java.util.* +import javax.inject.Inject + +/** + * Created by Kosh on 16.02.19. + */ +class LockUnlockIssuePrUseCase @Inject constructor( + private val issueRepositoryProvider: IssueRepository, + private val pullRequestRepository: PullRequestRepository, + private val apolloClient: ApolloClient, + private val loginRepositoryProvider: LoginRepository, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var repo: String = "" + var login: String = "" + var number: Int = -1 + var lockReason: LockReason? = null + var lock: Boolean = false + var isPr: Boolean = false + + override fun buildObservable(): Observable = if (isPr) { + pullRequestRepository.getPullRequestByNumberMaybe("$login/$repo", number) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .flatMapObservable { issue -> + val lockReason = lockReason + if (lockReason != null) { + Rx2Apollo.from(apolloClient.mutate(LockMutation(issue.id, lockReason))) + } else { + Rx2Apollo.from(apolloClient.mutate(UnlockMutation(issue.id))) + } + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { + issue.locked = lock == true + issue.activeLockReason = lockReason?.rawValue() + pullRequestRepository.upsert(issue) + val me = loginRepositoryProvider.getLoginBlocking()?.me() + return@map if (lock) { + TimelineModel(lockUnlockEventModel = LockUnlockEventModel(Date(), me, lockReason?.rawValue(), null, true)) + } else { + TimelineModel(lockUnlockEventModel = LockUnlockEventModel(Date(), me, null, null, false)) + } + } + } + } else { + issueRepositoryProvider.getIssueByNumberMaybe("$login/$repo", number) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .flatMapObservable { issue -> + val lockReason = lockReason + if (lockReason != null) { + Rx2Apollo.from(apolloClient.mutate(LockMutation(issue.id, lockReason))) + } else { + Rx2Apollo.from(apolloClient.mutate(UnlockMutation(issue.id))) + } + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { + issue.locked = lock == true + issue.activeLockReason = lockReason?.rawValue() + issueRepositoryProvider.upsert(issue) + val me = loginRepositoryProvider.getLoginBlocking()?.me() + return@map if (lock) { + TimelineModel(lockUnlockEventModel = LockUnlockEventModel(Date(), me, lockReason?.rawValue(), null, true)) + } else { + TimelineModel(lockUnlockEventModel = LockUnlockEventModel(Date(), me, null, null, false)) + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/MilestoneIssuePrUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/MilestoneIssuePrUseCase.kt new file mode 100644 index 000000000..088fba8ef --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/MilestoneIssuePrUseCase.kt @@ -0,0 +1,85 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.fastaccess.data.model.MilestoneDemilestonedEventModel +import com.fastaccess.data.model.TimelineModel +import com.fastaccess.data.model.parcelable.MilestoneModel +import com.fastaccess.data.repository.IssueRepository +import com.fastaccess.data.repository.LoginRepository +import com.fastaccess.data.repository.PullRequestRepository +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.response.IssueRequestModel +import com.fastaccess.domain.services.IssuePrService +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import com.fastaccess.extension.me +import io.reactivex.Observable +import java.util.* +import javax.inject.Inject + +/** + * Created by Kosh on 16.02.19. + */ +class MilestoneIssuePrUseCase @Inject constructor( + private val issueRepositoryProvider: IssueRepository, + private val pullRequestRepository: PullRequestRepository, + private val issuePrService: IssuePrService, + private val loginRepositoryProvider: LoginRepository, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var repo: String = "" + var login: String = "" + var number: Int = -1 + var milestone: Int = -1 + var isPr: Boolean = false + + override fun buildObservable(): Observable> { + val observable = issuePrService.editIssue(login, repo, number, IssueRequestModel(milestone = milestone)) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + return observable.flatMapMaybe { + return@flatMapMaybe if (isPr) { + issueRepositoryProvider.getIssueByNumberMaybe("$login/$repo", number) + .map { issue -> + val milestone = MilestoneModel( + it.milestone?.id?.toString(), + it.milestone?.title, it.milestone?.description, + it.milestone?.state, it.milestone?.url, + it.milestone?.number, it.milestone?.closedAt != null, + it.milestone?.dueOn + ) + issue.milestone = milestone + issueRepositoryProvider.upsert(issue) + val me = loginRepositoryProvider.getLoginBlocking()?.me() + return@map Pair( + TimelineModel( + milestoneEventModel = MilestoneDemilestonedEventModel( + Date(), me, it.milestone?.title ?: it.milestone?.number?.toString(), true + ) + ), milestone + ) + } + } else { + pullRequestRepository.getPullRequestByNumberMaybe("$login/$repo", number) + .map { issue -> + val milestone = MilestoneModel( + it.milestone?.id?.toString(), + it.milestone?.title, it.milestone?.description, + it.milestone?.state, it.milestone?.url, + it.milestone?.number, it.milestone?.closedAt != null, + it.milestone?.dueOn + ) + issue.milestone = milestone + pullRequestRepository.upsert(issue) + val me = loginRepositoryProvider.getLoginBlocking()?.me() + return@map Pair( + TimelineModel( + milestoneEventModel = MilestoneDemilestonedEventModel( + Date(), me, it.milestone?.title ?: it.milestone?.number?.toString(), true + ) + ), milestone + ) + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/issuesprs/PutLabelsUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/PutLabelsUseCase.kt new file mode 100644 index 000000000..16a12426f --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/issuesprs/PutLabelsUseCase.kt @@ -0,0 +1,38 @@ +package com.fastaccess.github.usecase.issuesprs + +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.services.IssuePrService +import com.fastaccess.domain.response.body.LabelsBodyModel +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 16.02.19. + */ +class PutLabelsUseCase @Inject constructor( + private val issueService: IssuePrService, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var repo: String = "" + var login: String = "" + var number: Int = 0 + var toAdd: List? = null + var toRemove: List? = null + + override fun buildObservable(): Observable = when (toRemove.isNullOrEmpty()) { + true -> issueService.addLabelsToIssue(login, repo, number, LabelsBodyModel(toAdd)) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { true } + else -> issueService.addLabelsToIssue(login, repo, number, LabelsBodyModel(toAdd)) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .flatMap { Observable.fromIterable(toRemove) } + .flatMap { issueService.removeLabelsToIssue(login, repo, number, it) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread())} + .map { true } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/main/FeedsMainScreenUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/main/FeedsMainScreenUseCase.kt new file mode 100644 index 000000000..9fb451569 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/main/FeedsMainScreenUseCase.kt @@ -0,0 +1,19 @@ +package com.fastaccess.github.usecase.main + +import com.fastaccess.data.repository.FeedsRepository +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 26.06.18. + */ +class FeedsMainScreenUseCase @Inject constructor( + private val feedsRepositoryProvider: FeedsRepository, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + override fun buildObservable(): Observable<*> = feedsRepositoryProvider.getMainFeeds() + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/main/IssuesMainScreenUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/main/IssuesMainScreenUseCase.kt new file mode 100644 index 000000000..52dca0d10 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/main/IssuesMainScreenUseCase.kt @@ -0,0 +1,51 @@ +package com.fastaccess.github.usecase.main + +import com.apollographql.apollo.ApolloClient +import com.apollographql.apollo.rx2.Rx2Apollo +import com.fastaccess.data.persistence.models.MyIssuesPullsModel +import com.fastaccess.data.repository.LoginRepository +import com.fastaccess.data.repository.MyIssuesPullsRepository +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import github.GetIssuesWithoutStateQuery +import github.type.IssueState +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 16.06.18. + */ +class IssuesMainScreenUseCase @Inject constructor( + private val loginRepository: LoginRepository, + private val myIssues: MyIssuesPullsRepository, + private val apolloClient: ApolloClient, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var state: IssueState = IssueState.OPEN + + override fun buildObservable(): Observable<*> = loginRepository.getLogin() + .flatMapObservable { it -> + return@flatMapObservable it.login?.let { login -> + Rx2Apollo.from( + apolloClient.query( + GetIssuesWithoutStateQuery.builder() + .login(login) + .count(5) + .build() + ) + ) + .map { it.data()?.user?.issues?.nodes } + .map { value -> + myIssues.deleteAllIssues() + myIssues.insert(value.asSequence().map { it.fragments.shortIssueRowItem }.map { + MyIssuesPullsModel( + it.id, it.databaseId, it.number, it.title, + it.repository.nameWithOwner, it.comments.totalCount, it.issueState.rawValue(), it.url.toString() + ) + }.toList()) + } + } ?: Observable.empty() + }.subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/main/PullRequestsMainScreenUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/main/PullRequestsMainScreenUseCase.kt new file mode 100644 index 000000000..5ee0a327f --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/main/PullRequestsMainScreenUseCase.kt @@ -0,0 +1,50 @@ +package com.fastaccess.github.usecase.main + +import com.apollographql.apollo.ApolloClient +import com.apollographql.apollo.rx2.Rx2Apollo +import com.fastaccess.data.persistence.models.MyIssuesPullsModel +import com.fastaccess.data.repository.LoginRepository +import com.fastaccess.data.repository.MyIssuesPullsRepository +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import github.GetPullRequestsQuery +import github.type.IssueState +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 16.06.18. + */ +class PullRequestsMainScreenUseCase @Inject constructor( + private val loginRepository: LoginRepository, + private val myIssues: MyIssuesPullsRepository, + private val apolloClient: ApolloClient, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + var state: IssueState = IssueState.OPEN + + override fun buildObservable(): Observable<*> = loginRepository.getLogin() + .flatMapObservable { loginModel -> + return@flatMapObservable loginModel.login?.let { login -> + Rx2Apollo.from( + apolloClient.query( + GetPullRequestsQuery.builder() + .login(login) + .count(5) + .build() + ) + ) + .map { it.data()?.user?.pullRequests?.nodes } + .map { value -> + myIssues.deleteAllPrs() + myIssues.insert(value.asSequence().map { it.fragments.shortPullRequestRowItem }.map { + MyIssuesPullsModel( + it.id, it.databaseId, it.number, it.title, + it.repository.nameWithOwner, it.comments.totalCount, it.state.name, it.url.toString(), true + ) + }.toList()) + } + } ?: Observable.empty() + }.subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/notification/NotificationUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/notification/NotificationUseCase.kt new file mode 100644 index 000000000..f3fe9444d --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/notification/NotificationUseCase.kt @@ -0,0 +1,59 @@ +package com.fastaccess.github.usecase.notification + +import com.fastaccess.data.persistence.models.NotificationModel +import com.fastaccess.data.repository.NotificationRepository +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.response.NotificationResponse +import com.fastaccess.domain.response.PageableResponse +import com.fastaccess.domain.services.NotificationService +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import com.google.gson.Gson +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 22.06.18. + */ + +class NotificationUseCase @Inject constructor( + private val notificationRepositoryProvider: NotificationRepository, + private val notificationService: NotificationService, + private val gson: Gson, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var page: Int? = null + var all: Boolean? = null + + override fun buildObservable(): Observable> { + val page = page + val all = all + val observable = if (all == true) { + notificationService.getAllNotifications() + } else { + if (page == null) { + notificationService.getMainNotifications() + } else { + notificationService.getNotifications(page) + } + } + return observable + .map { it -> + it.items?.let { items -> + if (all == true) { + notificationRepositoryProvider.deleteAll(false) + val list = items.asSequence().filter { it.unread == false }.toList() + notificationRepositoryProvider.insert(NotificationModel.convert(gson, list)) + return@map it + } + if (page ?: 0 <= 1) { + notificationRepositoryProvider.deleteAll(true) + } + notificationRepositoryProvider.insert(NotificationModel.convert(gson, items)) + } + return@map it + } + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/search/FilterSearchReposUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/search/FilterSearchReposUseCase.kt new file mode 100644 index 000000000..f456bb528 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/search/FilterSearchReposUseCase.kt @@ -0,0 +1,78 @@ +package com.fastaccess.github.usecase.search + +import com.apollographql.apollo.ApolloClient +import com.apollographql.apollo.api.Input +import com.apollographql.apollo.rx2.Rx2Apollo +import com.fastaccess.data.model.CountModel +import com.fastaccess.data.model.PageInfoModel +import com.fastaccess.data.model.ShortRepoModel +import com.fastaccess.data.model.parcelable.FilterByRepo +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import github.SearchReposQuery +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 20.01.19. + */ +class FilterSearchReposUseCase @Inject constructor( + private val apolloClient: ApolloClient, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + + var cursor: Input = Input.absent() + var filterModel = FilterByRepo() + var keyword: String = "" + + override fun buildObservable(): Observable>> = Rx2Apollo + .from(apolloClient.query(SearchReposQuery(constructQuery(keyword), cursor))) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + .map { it.data()?.search } + .map { search -> + val list = search.nodes + ?.mapNotNull { it.fragments.shortRepoRowItem } + ?.map { repo -> + ShortRepoModel( + repo.id, repo.databaseId, repo.name, + CountModel(repo.stargazers.totalCount), CountModel(repo.issues.totalCount), + CountModel(repo.pullRequests.totalCount), repo.forkCount, repo.isFork, repo.isPrivate + ) + } ?: arrayListOf() + return@map Pair( + PageInfoModel( + search.pageInfo.startCursor, search.pageInfo.endCursor, + search.pageInfo.isHasNextPage, search.pageInfo.isHasPreviousPage + ), list + ) + } + + + private fun constructQuery(keyword: String): String { + return StringBuilder() + .apply { + append(keyword).append(" ") + when (filterModel.filterByRepoIn) { + FilterByRepo.FilterByRepoIn.NAME -> append("in:name").append(" ") + FilterByRepo.FilterByRepoIn.DESCRIPTION -> append("in:description").append(" ") + FilterByRepo.FilterByRepoIn.README -> append("in:readme").append(" ") + FilterByRepo.FilterByRepoIn.ALL -> { + //ignored for now! + } + } + if (!filterModel.name.isNullOrEmpty()) { + when (filterModel.filterByRepoLimitBy) { + FilterByRepo.FilterByRepoLimitBy.USERNAME -> append("user:${filterModel.name}").append(" ") + FilterByRepo.FilterByRepoLimitBy.ORG -> append("org:${filterModel.name}").append(" ") + null -> { + } + } + } + if (!filterModel.language.isNullOrEmpty()) { + append("language:${filterModel.language}").append(" ") + } + } + .toString() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/user/BlockUnblockUserUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/user/BlockUnblockUserUseCase.kt new file mode 100644 index 000000000..d1ef3a27a --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/user/BlockUnblockUserUseCase.kt @@ -0,0 +1,31 @@ +package com.fastaccess.github.usecase.user + +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.data.repository.UserRepository +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 10.06.18. + */ +class BlockUnblockUserUseCase @Inject constructor( + private val userRepository: UserRepository, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + var login: String? = null + var block: Boolean = false + + override fun buildObservable(): Observable = login?.let { login -> + userRepository.blockUnblockUser(login, block) + .map { + val isSuccess = it.isSuccessful && it.code() == 204 + if (isSuccess) { + return@map block + } + return@map isSuccess + } + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + } ?: Observable.empty() +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/user/FollowUnfollowUserUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/user/FollowUnfollowUserUseCase.kt new file mode 100644 index 000000000..e81c4071b --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/user/FollowUnfollowUserUseCase.kt @@ -0,0 +1,35 @@ +package com.fastaccess.github.usecase.user + +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.data.repository.UserRepository +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 10.06.18. + */ +class FollowUnfollowUserUseCase @Inject constructor( + private val userRepository: UserRepository, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + var login: String? = null + var follow: Boolean = false + + override fun buildObservable(): Observable = login?.let { login -> + userRepository.followUnfollowUser(login, follow) + .map { response -> + val isSuccess = response.isSuccessful && response.code() == 204 + if (isSuccess) { + userRepository.getUserBlocking(login)?.let { + it.viewerIsFollowing = follow + userRepository.updateUser(it) + } + return@map follow + } + return@map isSuccess + } + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + } ?: Observable.empty() +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/user/IsUserBlockedUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/user/IsUserBlockedUseCase.kt new file mode 100644 index 000000000..214768e3c --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/user/IsUserBlockedUseCase.kt @@ -0,0 +1,24 @@ +package com.fastaccess.github.usecase.user + +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.data.repository.UserRepository +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 10.06.18. + */ +class IsUserBlockedUseCase @Inject constructor( + private val userRepository: UserRepository, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + var login: String? = null + + override fun buildObservable(): Observable = login?.let { login -> + userRepository.isUserBlocked(login) + .map { it.isSuccessful && it.code() == 204 } + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + } ?: Observable.empty() +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/user/UserFeedsUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/user/UserFeedsUseCase.kt new file mode 100644 index 000000000..f34201097 --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/user/UserFeedsUseCase.kt @@ -0,0 +1,27 @@ +package com.fastaccess.github.usecase.user + +import com.fastaccess.data.repository.FeedsRepository +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.domain.response.FeedResponse +import com.fastaccess.domain.response.PageableResponse +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 20.10.18. + */ +class UserFeedsUseCase @Inject constructor( + private val feedsRepositoryProvider: FeedsRepository, + private val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + var page: Int = 0 + var login: String? = null + + override fun buildObservable(): Observable> = when { + login.isNullOrEmpty() -> Observable.empty() + else -> feedsRepositoryProvider.getFeeds(login ?: "", page) + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.ioThread()) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/github/usecase/user/UserUseCase.kt b/app/src/main/java/com/fastaccess/github/usecase/user/UserUseCase.kt new file mode 100644 index 000000000..c5f95053b --- /dev/null +++ b/app/src/main/java/com/fastaccess/github/usecase/user/UserUseCase.kt @@ -0,0 +1,27 @@ +package com.fastaccess.github.usecase.user + +import com.fastaccess.data.persistence.models.UserModel +import com.fastaccess.data.repository.SchedulerProvider +import com.fastaccess.data.repository.UserRepository +import com.fastaccess.domain.usecase.base.BaseObservableUseCase +import io.reactivex.Observable +import javax.inject.Inject + +/** + * Created by Kosh on 10.06.18. + */ +class UserUseCase @Inject constructor( + private val userRepository: UserRepository, + val schedulerProvider: SchedulerProvider +) : BaseObservableUseCase() { + var login: String? = null + + override fun buildObservable(): Observable { + val observable = login?.let { userRepository.getUserFromRemote(it) } ?: Observable.empty() + return observable + .subscribeOn(schedulerProvider.ioThread()) + .observeOn(schedulerProvider.uiThread()) + } + + fun getUser(login: String) = userRepository.getUser(login) +} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/helper/ActivityHelper.java b/app/src/main/java/com/fastaccess/helper/ActivityHelper.java deleted file mode 100644 index dbea0d11e..000000000 --- a/app/src/main/java/com/fastaccess/helper/ActivityHelper.java +++ /dev/null @@ -1,266 +0,0 @@ -package com.fastaccess.helper; - -import android.Manifest; -import android.app.Activity; -import android.content.ActivityNotFoundException; -import android.content.ComponentName; -import android.content.Context; -import android.content.ContextWrapper; -import android.content.Intent; -import android.content.pm.ActivityInfo; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.net.Uri; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.browser.customtabs.CustomTabsIntent; -import androidx.core.app.ActivityCompat; -import androidx.core.app.ActivityOptionsCompat; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentManager; -import androidx.core.app.ShareCompat; -import androidx.core.util.Pair; -import android.view.View; -import android.widget.Toast; - -import com.fastaccess.App; -import com.fastaccess.R; -import com.fastaccess.ui.modules.main.drawer.AccountDrawerFragment; -import com.fastaccess.ui.modules.main.drawer.MainDrawerFragment; -import com.fastaccess.ui.modules.parser.LinksParserActivity; - -import java.util.ArrayList; -import java.util.List; - -import es.dmoral.toasty.Toasty; - -/** - * Created by Kosh on 12/12/15 10:51 PM - */ -public class ActivityHelper { - - @Nullable public static Activity getActivity(@Nullable Context content) { - if (content == null) return null; - else if (content instanceof Activity) return (Activity) content; - else if (content instanceof ContextWrapper) return getActivity(((ContextWrapper) content).getBaseContext()); - return null; - } - - public static void startCustomTab(@NonNull Activity context, @NonNull Uri url) { - String packageNameToUse = CustomTabsHelper.getPackageNameToUse(context); - if (packageNameToUse != null) { - CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder() - .setToolbarColor(ViewHelper.getPrimaryColor(context)) - .setShowTitle(true) - .build(); - customTabsIntent.intent.setPackage(packageNameToUse); - try { - customTabsIntent.launchUrl(context, url); - } catch (ActivityNotFoundException ignored) { - openChooser(context, url, true); - } - } else { - openChooser(context, url, true); - } - } - - public static void startCustomTab(@NonNull Activity context, @NonNull String url) { - startCustomTab(context, Uri.parse(url)); - } - - public static void openChooser(@NonNull Context context, @NonNull Uri url) { - openChooser(context, url, false); - } - - private static void openChooser(@NonNull Context context, @NonNull Uri url, boolean fromCustomTab) { - Intent i = new Intent(Intent.ACTION_VIEW, url); - i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - Intent finalIntent = chooserIntent(context, i, url); - if (finalIntent != null) { - try { - context.startActivity(finalIntent); - } catch (ActivityNotFoundException ignored) { - } - } else { - if (!fromCustomTab) { - Activity activity = ActivityHelper.getActivity(context); - if (activity == null) { - try { - context.startActivity(i); - } catch (ActivityNotFoundException ignored) { - } - return; - } - startCustomTab(activity, url); - } else { - try { - context.startActivity(i); - } catch (ActivityNotFoundException ignored) { - } - } - } - } - - public static void openChooser(@NonNull Context context, @NonNull String url) { - openChooser(context, Uri.parse(url)); - } - - @SafeVarargs public static void start(@NonNull Activity activity, Class cl, Pair... sharedElements) { - Intent intent = new Intent(activity, cl); - ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, sharedElements); - activity.startActivity(intent, options.toBundle()); - } - - public static void start(@NonNull Activity activity, Intent intent, @NonNull View sharedElement) { - ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, - sharedElement, ViewHelper.getTransitionName(sharedElement)); - activity.startActivity(intent, options.toBundle()); - } - - public static void startReveal(@NonNull Activity activity, Intent intent, @NonNull View sharedElement, int requestCode) { - if (!PrefGetter.isAppAnimationDisabled()) { - ActivityOptionsCompat options = ActivityOptionsCompat.makeClipRevealAnimation(sharedElement, sharedElement.getWidth() / 2, - sharedElement.getHeight() / 2, - sharedElement.getWidth(), sharedElement.getHeight()); - activity.startActivityForResult(intent, requestCode, options.toBundle()); - } else { - activity.startActivityForResult(intent, requestCode); - } - } - - public static void startReveal(@NonNull Fragment fragment, Intent intent, @NonNull View sharedElement, int requestCode) { - if (!PrefGetter.isAppAnimationDisabled()) { - ActivityOptionsCompat options = ActivityOptionsCompat.makeClipRevealAnimation(sharedElement, sharedElement.getWidth() / 2, - sharedElement.getHeight() / 2, - sharedElement.getWidth(), sharedElement.getHeight()); - fragment.startActivityForResult(intent, requestCode, options.toBundle()); - } else { - fragment.startActivityForResult(intent, requestCode); - } - } - - public static void startReveal(@NonNull Activity activity, Intent intent, @NonNull View sharedElement) { - if (!PrefGetter.isAppAnimationDisabled()) { - ActivityOptionsCompat options = ActivityOptionsCompat.makeClipRevealAnimation(sharedElement, sharedElement.getWidth() / 2, - sharedElement.getHeight() / 2, - sharedElement.getWidth(), sharedElement.getHeight()); - activity.startActivity(intent, options.toBundle()); - } else { - activity.startActivity(intent); - } - } - - @SafeVarargs public static void start(@NonNull Activity activity, @NonNull Intent intent, - @NonNull Pair... sharedElements) { - ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, sharedElements); - activity.startActivity(intent, options.toBundle()); - - } - - public static void shareUrl(@NonNull Context context, @NonNull String url) { - Activity activity = getActivity(context); - if (activity == null) throw new IllegalArgumentException("Context given is not an instance of activity " + context.getClass().getName()); - try { - ShareCompat.IntentBuilder.from(activity) - .setChooserTitle(context.getString(R.string.share)) - .setType("text/plain") - .setText(url) - .startChooser(); - } catch (ActivityNotFoundException e) { - Toasty.error(App.getInstance(), e.getMessage(), Toast.LENGTH_LONG).show(); - } - } - - @SuppressWarnings("RestrictedApi") - @Nullable public static Fragment getVisibleFragment(@NonNull FragmentManager manager) { - List fragments = manager.getFragments(); - if (fragments != null && !fragments.isEmpty()) { - for (Fragment fragment : fragments) { - if (fragment != null && fragment.isVisible() && - !(fragment instanceof MainDrawerFragment || fragment instanceof AccountDrawerFragment)) { - return fragment; - } - } - } - return null; - } - - private static boolean isPermissionGranted(@NonNull Context context, @NonNull String permission) { - return ActivityCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED; - } - - private static boolean isExplanationNeeded(@NonNull Activity context, @NonNull String permissionName) { - return ActivityCompat.shouldShowRequestPermissionRationale(context, permissionName); - } - - private static boolean isReadWritePermissionIsGranted(@NonNull Context context) { - return isPermissionGranted(context, Manifest.permission.READ_EXTERNAL_STORAGE) - && isPermissionGranted(context, Manifest.permission.WRITE_EXTERNAL_STORAGE); - } - - private static void requestReadWritePermission(@NonNull Activity context) { - ActivityCompat.requestPermissions(context, new String[]{ - Manifest.permission.READ_EXTERNAL_STORAGE, - Manifest.permission.WRITE_EXTERNAL_STORAGE, - }, 1); - } - - public static boolean checkAndRequestReadWritePermission(@NonNull Activity activity) { - if (!isReadWritePermissionIsGranted(activity)) { - requestReadWritePermission(activity); - return false; - } else if (isExplanationNeeded(activity, Manifest.permission.READ_EXTERNAL_STORAGE) - || isExplanationNeeded(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { - Toasty.error(App.getInstance(), activity.getString(R.string.read_write_permission_explanation), Toast.LENGTH_LONG).show(); - return false; - } - return true; - } - - private static Intent chooserIntent(@NonNull Context context, @NonNull Intent intent, @NonNull Uri uri) { - final PackageManager pm = context.getPackageManager(); - final List activities = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); - final ArrayList chooserIntents = new ArrayList<>(); - final String ourPackageName = context.getPackageName(); - for (ResolveInfo resInfo : activities) { - ActivityInfo info = resInfo.activityInfo; - if (!info.enabled || !info.exported) { - continue; - } - if (info.packageName.equals(ourPackageName)) { - continue; - } - Intent targetIntent = new Intent(intent); - targetIntent.setPackage(info.packageName); - targetIntent.setDataAndType(uri, intent.getType()); - chooserIntents.add(targetIntent); - } - if (chooserIntents.isEmpty()) { - return null; - } - final Intent lastIntent = chooserIntents.remove(chooserIntents.size() - 1); - if (chooserIntents.isEmpty()) { - return lastIntent; - } - Intent chooserIntent = Intent.createChooser(lastIntent, null); - chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, chooserIntents.toArray(new Intent[chooserIntents.size()])); - return chooserIntent; - } - - public static void activateLinkInterceptorActivity(Context context, boolean activate) { - final PackageManager pm = context.getPackageManager(); - final int flag = activate ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED; - pm.setComponentEnabledSetting(new ComponentName(context, LinksParserActivity.class), flag, PackageManager.DONT_KILL_APP); - } - - public static Intent editBundle(@NonNull Intent intent, boolean isEnterprise) { - Bundle bundle = intent.getExtras(); - if (bundle != null) { - bundle.putBoolean(BundleConstant.IS_ENTERPRISE, isEnterprise); - intent.putExtras(bundle); - } - return intent; - } - -} diff --git a/app/src/main/java/com/fastaccess/helper/AnimHelper.java b/app/src/main/java/com/fastaccess/helper/AnimHelper.java deleted file mode 100644 index 631b381bc..000000000 --- a/app/src/main/java/com/fastaccess/helper/AnimHelper.java +++ /dev/null @@ -1,208 +0,0 @@ -package com.fastaccess.helper; - -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.animation.ObjectAnimator; -import android.app.Dialog; -import android.graphics.Rect; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.UiThread; -import com.google.android.material.floatingactionbutton.FloatingActionButton; -import androidx.fragment.app.DialogFragment; -import androidx.core.view.ViewCompat; -import androidx.interpolator.view.animation.FastOutLinearInInterpolator; -import androidx.interpolator.view.animation.LinearOutSlowInInterpolator; -import android.view.View; -import android.view.ViewAnimationUtils; -import android.view.ViewPropertyAnimator; -import android.view.ViewTreeObserver; -import android.view.animation.AccelerateInterpolator; -import android.view.animation.Interpolator; -import android.view.animation.LinearInterpolator; -import android.widget.PopupWindow; - -import java.util.Arrays; -import java.util.List; - - -/** - * Created by Kosh on 27 May 2016, 9:04 PM - */ - -public class AnimHelper { - - private static final Interpolator FAST_OUT_LINEAR_IN_INTERPOLATOR = new FastOutLinearInInterpolator(); - private static final Interpolator LINEAR_OUT_SLOW_IN_INTERPOLATOR = new LinearOutSlowInInterpolator(); - private static final Interpolator interpolator = new LinearInterpolator(); - - @UiThread private static void animateVisibility(@Nullable final View view, final boolean show, int visibility) { - if (view == null) { - return; - } - if (!ViewCompat.isAttachedToWindow(view)) { - view.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { - @Override public boolean onPreDraw() { - view.getViewTreeObserver().removeOnPreDrawListener(this); - animateSafeVisibility(show, view, visibility); - return true; - } - }); - } else { - animateSafeVisibility(show, view, visibility); - } - } - - @UiThread public static void animateVisibility(@Nullable final View view, final boolean show) { - animateVisibility(view, show, View.GONE); - } - - @UiThread private static void animateSafeVisibility(final boolean show, @NonNull final View view, int visibility) { - view.animate().cancel(); - ViewPropertyAnimator animator = view.animate().setDuration(200).alpha(show ? 1F : 0F).setInterpolator(new AccelerateInterpolator()) - .setListener(new AnimatorListenerAdapter() { - @Override public void onAnimationStart(Animator animation) { - super.onAnimationStart(animation); - if (show) { - view.setScaleX(1); - view.setScaleY(1); - view.setVisibility(View.VISIBLE); - } - } - - @Override public void onAnimationEnd(@NonNull Animator animation) { - super.onAnimationEnd(animation); - if (!show) { - view.setVisibility(visibility); - view.setScaleX(0); - view.setScaleY(0); - } - animation.removeListener(this); - view.clearAnimation(); - } - }); - animator.scaleX(show ? 1 : 0).scaleY(show ? 1 : 0); - } - - @UiThread @NonNull private static List getBeats(@NonNull View view) { - ObjectAnimator[] animator = new ObjectAnimator[]{ - ObjectAnimator.ofFloat(view, "scaleY", 1, 1.1f, 1), - ObjectAnimator.ofFloat(view, "scaleX", 1, 1.1f, 1) - }; - return Arrays.asList(animator); - } - - @UiThread public static void startBeatsAnimation(@NonNull View view) { - view.clearAnimation(); - if (view.getAnimation() != null) { - view.getAnimation().cancel(); - } - List animators = getBeats(view); - for (ObjectAnimator anim : animators) { - anim.setDuration(300).start(); - anim.setInterpolator(interpolator); - } - } - - @UiThread public static void revealPopupWindow(@NonNull PopupWindow popupWindow, @NonNull View from) { - Rect rect = ViewHelper.getLayoutPosition(from); - int x = (int) rect.exactCenterX(); - int y = (int) rect.exactCenterY(); - if (popupWindow.getContentView() != null) { - View view = popupWindow.getContentView(); - if (view != null) { - popupWindow.showAsDropDown(from); - view.post(() -> { - if (ViewCompat.isAttachedToWindow(view)) { - Animator animator = ViewAnimationUtils.createCircularReveal(view, x, y, 0, - (float) Math.hypot(rect.width(), rect.height())); - animator.setDuration(view.getResources().getInteger(android.R.integer.config_shortAnimTime)); - animator.start(); - } - }); - } - } - } - - @UiThread public static void revealDialog(@NonNull Dialog dialog, int animDuration) { - if (dialog.getWindow() != null) { - View view = dialog.getWindow().getDecorView(); - if (view != null) { - view.post(() -> { - if (ViewCompat.isAttachedToWindow(view)) { - int centerX = view.getWidth() / 2; - int centerY = view.getHeight() / 2; - Animator animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, 20, view.getHeight()); - animator.setDuration(animDuration); - animator.start(); - } - }); - } - } - } - - @UiThread public static void dismissDialog(@NonNull DialogFragment dialogFragment, int duration, AnimatorListenerAdapter listenerAdapter) { - Dialog dialog = dialogFragment.getDialog(); - if (dialog != null) { - if (dialog.getWindow() != null) { - View view = dialog.getWindow().getDecorView(); - if (view != null) { - int centerX = view.getWidth() / 2; - int centerY = view.getHeight() / 2; - float radius = (float) Math.sqrt(view.getWidth() * view.getWidth() / 4 + view.getHeight() * view.getHeight() / 4); - view.post(() -> { - if (ViewCompat.isAttachedToWindow(view)) { - Animator animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, radius, 0); - animator.setDuration(duration); - animator.addListener(listenerAdapter); - animator.start(); - } else { - listenerAdapter.onAnimationEnd(null); - } - }); - } - } - } else { - listenerAdapter.onAnimationEnd(null); - } - } - - @UiThread public static void mimicFabVisibility(boolean show, @NonNull View view, - @Nullable FloatingActionButton.OnVisibilityChangedListener listener) { - if (show) { - view.animate().cancel(); - if (ViewCompat.isLaidOut(view)) { - if (view.getVisibility() != View.VISIBLE) { - view.setAlpha(0f); - view.setScaleY(0f); - view.setScaleX(0f); - } - view.animate() - .scaleX(1f) - .scaleY(1f) - .alpha(1f) - .setDuration(200) - .setInterpolator(LINEAR_OUT_SLOW_IN_INTERPOLATOR) - .withStartAction(() -> { - view.setVisibility(View.VISIBLE); - if (listener != null) listener.onShown(null); - }); - } else { - view.setVisibility(View.VISIBLE); - view.setAlpha(1f); - view.setScaleY(1f); - view.setScaleX(1f); - if (listener != null) listener.onShown(null); - } - } else { - view.animate() - .scaleX(0f) - .scaleY(0f) - .alpha(0f) - .setDuration(40) - .setInterpolator(FAST_OUT_LINEAR_IN_INTERPOLATOR); - view.setVisibility(View.GONE); - if (listener != null) listener.onHidden(null); - } - } -} diff --git a/app/src/main/java/com/fastaccess/helper/AppHelper.java b/app/src/main/java/com/fastaccess/helper/AppHelper.java deleted file mode 100644 index 5c593a7ea..000000000 --- a/app/src/main/java/com/fastaccess/helper/AppHelper.java +++ /dev/null @@ -1,200 +0,0 @@ -package com.fastaccess.helper; - -import android.app.NotificationManager; -import android.content.ClipData; -import android.content.ClipboardManager; -import android.content.Context; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageManager; -import android.content.res.Configuration; -import android.content.res.Resources; -import android.net.ConnectivityManager; -import android.os.Build; -import android.provider.Settings; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentManager; -import android.view.View; -import android.view.inputmethod.InputMethodManager; - -import com.fastaccess.App; -import com.fastaccess.BuildConfig; -import com.fastaccess.R; -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.GoogleApiAvailability; - -import java.util.Locale; - -import es.dmoral.toasty.Toasty; - -/** - * Created by kosh20111 on 18 Oct 2016, 9:29 PM - */ - -public class AppHelper { - - public static void hideKeyboard(@NonNull View view) { - InputMethodManager inputManager = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); - if (inputManager != null) { - inputManager.hideSoftInputFromWindow(view.getWindowToken(), 0); - } - } - - @Nullable public static Fragment getFragmentByTag(@NonNull FragmentManager fragmentManager, @NonNull String tag) { - return fragmentManager.findFragmentByTag(tag); - } - - public static void cancelNotification(@NonNull Context context) { - cancelNotification(context, BundleConstant.REQUEST_CODE); - } - - public static void cancelNotification(@NonNull Context context, int id) { - NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - if (notificationManager != null) { - notificationManager.cancel(id); - } - } - - public static void cancelAllNotifications(@NonNull Context context) { - NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - if (notificationManager != null) { - notificationManager.cancelAll(); - } - } - - public static void copyToClipboard(@NonNull Context context, @NonNull String uri) { - ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); - ClipData clip = ClipData.newPlainText(context.getString(R.string.app_name), uri); - if (clipboard != null) { - clipboard.setPrimaryClip(clip); - Toasty.success(App.getInstance(), context.getString(R.string.success_copied)).show(); - } - } - - public static boolean isNightMode(@NonNull Resources resources) { - @PrefGetter.ThemeType int themeType = PrefGetter.getThemeType(resources); - return themeType != PrefGetter.LIGHT; - } - - public static String getFastHubIssueTemplate(boolean enterprise) { - String brand = (!isEmulator()) ? Build.BRAND : "Android Emulator"; - String model = (!isEmulator()) ? DeviceNameGetter.getInstance().getDeviceName() : "Android Emulator"; - StringBuilder builder = new StringBuilder() - .append("**FastHub Version: ").append(BuildConfig.VERSION_NAME).append(enterprise ? " Enterprise**" : "**").append(" \n") - .append(!isInstalledFromPlaySore(App.getInstance()) ? "**APK Source: Unknown** \n" : "") - .append("**Android Version: ").append(String.valueOf(Build.VERSION.RELEASE)).append(" (SDK: ") - .append(String.valueOf(Build.VERSION.SDK_INT)).append(")**").append(" \n") - .append("**Device Information:**").append(" \n") - .append("- **") - .append(!model.equalsIgnoreCase(brand) ? "Manufacturer" : "Manufacturer&Brand") - .append(":** ") - .append(Build.MANUFACTURER) - .append(" \n"); - if (!(model.equalsIgnoreCase(brand) || "google".equals(Build.BRAND))) { - builder.append("- **Brand:** ").append(brand).append(" \n"); - } - builder.append("- **Model:** ").append(model).append(" \n") - .append("---").append("\n\n"); - if (!Locale.getDefault().getLanguage().equals(new Locale("en").getLanguage())) { - builder.append("") - .append("\n"); - } - return builder.toString(); - } - - public static void updateAppLanguage(@NonNull Context context) { - String lang = PrefGetter.getAppLanguage(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - updateResources(context, lang); - } - updateResourcesLegacy(context, lang); - } - - private static void updateResources(Context context, String language) { - Locale locale = getLocale(language); - Locale.setDefault(locale); - Configuration configuration = context.getResources().getConfiguration(); - configuration.setLocale(locale); - context.createConfigurationContext(configuration); - } - - @SuppressWarnings("deprecation") - private static void updateResourcesLegacy(Context context, String language) { - Locale locale = getLocale(language); - Locale.setDefault(locale); - Resources resources = context.getResources(); - Configuration configuration = resources.getConfiguration(); - configuration.locale = locale; - resources.updateConfiguration(configuration, resources.getDisplayMetrics()); - } - - @NonNull private static Locale getLocale(String language) { - Locale locale = null; - if (language.equalsIgnoreCase("zh-rCN")) { - locale = Locale.SIMPLIFIED_CHINESE; - } else if (language.equalsIgnoreCase("zh-rTW")) { - locale = Locale.TRADITIONAL_CHINESE; - } - if (locale != null) return locale; - String[] split = language.split("-"); - if (split.length > 1) { - locale = new Locale(split[0], split[1]); - } else { - locale = new Locale(language); - } - return locale; - } - - public static String getDeviceName() { - if (isEmulator()) { - return "Android Emulator"; - } - return DeviceNameGetter.getInstance().getDeviceName(); - } - - public static boolean isEmulator() { - return Build.FINGERPRINT.startsWith("generic") - || Build.FINGERPRINT.startsWith("unknown") - || Build.MODEL.contains("google_sdk") - || Build.MODEL.contains("Emulator") - || Build.MODEL.contains("Android SDK built for x86") - || Build.MANUFACTURER.contains("Genymotion") - || (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic")) - || "google_sdk".equals(Build.PRODUCT); - } - - private static boolean isInstalledFromPlaySore(@NonNull Context context) { - final String ipn = context.getPackageManager().getInstallerPackageName(BuildConfig.APPLICATION_ID); - return !InputHelper.isEmpty(ipn); - } - - public static boolean isGoogleAvailable(@NonNull Context context) { - ApplicationInfo applicationInfo = null; - try { - applicationInfo = context.getPackageManager().getApplicationInfo("com.google.android.gms", 0); - } catch (PackageManager.NameNotFoundException e) { - e.printStackTrace(); - } - return applicationInfo != null && applicationInfo.enabled && - GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS; - } - - public static boolean isDeviceAnimationEnabled(@NonNull Context context) { - float duration = Settings.Global.getFloat(context.getContentResolver(), Settings.Global.ANIMATOR_DURATION_SCALE, 1); - float transition = Settings.Global.getFloat(context.getContentResolver(), Settings.Global.TRANSITION_ANIMATION_SCALE, 1); - return (duration != 0 && transition != 0); - } - - public static boolean isDataPlan() { - final ConnectivityManager connectivityManager = (ConnectivityManager) App.getInstance().getSystemService(Context.CONNECTIVITY_SERVICE); - if (connectivityManager != null) { - final android.net.NetworkInfo mobile = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); - return mobile.isConnectedOrConnecting(); - } - return false; - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/helper/BundleConstant.java b/app/src/main/java/com/fastaccess/helper/BundleConstant.java deleted file mode 100644 index bd2ddc3d6..000000000 --- a/app/src/main/java/com/fastaccess/helper/BundleConstant.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.fastaccess.helper; - -import androidx.annotation.StringDef; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -import static com.fastaccess.helper.BundleConstant.ExtraType.EDIT_COMMIT_COMMENT_EXTRA; -import static com.fastaccess.helper.BundleConstant.ExtraType.EDIT_GIST_COMMENT_EXTRA; -import static com.fastaccess.helper.BundleConstant.ExtraType.EDIT_ISSUE_COMMENT_EXTRA; -import static com.fastaccess.helper.BundleConstant.ExtraType.EDIT_REVIEW_COMMENT_EXTRA; -import static com.fastaccess.helper.BundleConstant.ExtraType.FOR_RESULT_EXTRA; -import static com.fastaccess.helper.BundleConstant.ExtraType.NEW_COMMIT_COMMENT_EXTRA; -import static com.fastaccess.helper.BundleConstant.ExtraType.NEW_GIST_COMMENT_EXTRA; -import static com.fastaccess.helper.BundleConstant.ExtraType.NEW_ISSUE_COMMENT_EXTRA; -import static com.fastaccess.helper.BundleConstant.ExtraType.NEW_REVIEW_COMMENT_EXTRA; - -/** - * Created by Kosh on 12 Nov 2016, 3:55 PM - */ - -public class BundleConstant { - public static final String ITEM = "item"; - public static final String ID = "id"; - public static final String EXTRA = "extra"; - public static final String EXTRA_TWO = "extra2_id"; - public static final String EXTRA_THREE = "extra3_id"; - public static final String EXTRA_FOUR = "extra4_id"; - public static final String EXTRA_FIVE = "extra5_id"; - public static final String EXTRA_SIX = "extra6_id"; - public static final String EXTRA_SEVEN = "extra7_id"; - public static final String EXTRA_EIGHT = "extra8_id"; - public static final String EXTRA_TYPE = "extra_type"; - public static final String YES_NO_EXTRA = "yes_no_extra"; - public static final String NOTIFICATION_ID = "notification_id"; - public static final String IS_ENTERPRISE = "is_enterprise"; - public static final String REVIEW_EXTRA = "review_extra"; - public static final String SCHEME_URL = "scheme_url"; - public static final int REQUEST_CODE = 2016; - public static final int REVIEW_REQUEST_CODE = 2017; - public static int REFRESH_CODE = 64; - - - @StringDef({ - FOR_RESULT_EXTRA, - EDIT_GIST_COMMENT_EXTRA, - NEW_GIST_COMMENT_EXTRA, - EDIT_ISSUE_COMMENT_EXTRA, - NEW_ISSUE_COMMENT_EXTRA, - EDIT_COMMIT_COMMENT_EXTRA, - NEW_COMMIT_COMMENT_EXTRA, - NEW_REVIEW_COMMENT_EXTRA, - EDIT_REVIEW_COMMENT_EXTRA - }) - - @Retention(RetentionPolicy.SOURCE) public @interface ExtraType { - String FOR_RESULT_EXTRA = "for_result_extra"; - String EDIT_GIST_COMMENT_EXTRA = "edit_comment_extra"; - String NEW_GIST_COMMENT_EXTRA = "new_gist_comment_extra"; - String EDIT_ISSUE_COMMENT_EXTRA = "edit_issue_comment_extra"; - String NEW_ISSUE_COMMENT_EXTRA = "new_issue_comment_extra"; - String EDIT_COMMIT_COMMENT_EXTRA = "edit_commit_comment_extra"; - String NEW_COMMIT_COMMENT_EXTRA = "new_commit_comment_extra"; - String NEW_REVIEW_COMMENT_EXTRA = "new_review_comment_extra"; - String EDIT_REVIEW_COMMENT_EXTRA = "edit_review_comment_extra"; - } -} diff --git a/app/src/main/java/com/fastaccess/helper/Bundler.java b/app/src/main/java/com/fastaccess/helper/Bundler.java deleted file mode 100644 index 216352fc5..000000000 --- a/app/src/main/java/com/fastaccess/helper/Bundler.java +++ /dev/null @@ -1,239 +0,0 @@ -package com.fastaccess.helper; - -import android.os.Bundle; -import android.os.IBinder; -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; -import android.util.SparseArray; - -import java.io.Serializable; -import java.util.ArrayList; - -/** - * Created by Kosh on 23 May 2016, 3:37 PM - */ - -public class Bundler { - - private final Bundle bundle; - - private Bundler() { - bundle = new Bundle(); - } - - public static Bundler start() { - return new Bundler(); - } - - public Bundler put(@NonNull String key, boolean value) { - bundle.putBoolean(key, value); - return this; - } - - public Bundler put(@NonNull String key, boolean[] value) { - bundle.putBooleanArray(key, value); - return this; - } - - public Bundler put(@NonNull String key, IBinder value) { - // Uncommment this line if your minimum sdk version is API level 18 - //start.putBinder(key, value); - return this; - } - - public Bundler put(@NonNull String key, int value) { - bundle.putInt(key, value); - return this; - } - - public Bundler put(@NonNull String key, int[] value) { - bundle.putIntArray(key, value); - return this; - } - - public Bundler putIntegerArrayList(@NonNull String key, ArrayList value) { - bundle.putIntegerArrayList(key, value); - return this; - } - - public Bundler put(@NonNull String key, Bundle value) { - bundle.putBundle(key, value); - return this; - } - - public Bundler put(@NonNull String key, byte value) { - bundle.putByte(key, value); - return this; - } - - public Bundler put(@NonNull String key, byte[] value) { - bundle.putByteArray(key, value); - return this; - } - - public Bundler put(@NonNull String key, String value) { - bundle.putString(key, value); - return this; - } - - public Bundler put(@NonNull String key, String[] value) { - bundle.putStringArray(key, value); - return this; - } - - public Bundler putStringArrayList(@NonNull String key, ArrayList value) { - bundle.putStringArrayList(key, value); - return this; - } - - public Bundler put(@NonNull String key, long value) { - bundle.putLong(key, value); - return this; - } - - public Bundler put(@NonNull String key, long[] value) { - bundle.putLongArray(key, value); - return this; - } - - public Bundler put(@NonNull String key, float value) { - bundle.putFloat(key, value); - return this; - } - - public Bundler put(@NonNull String key, float[] value) { - bundle.putFloatArray(key, value); - return this; - } - - public Bundler put(@NonNull String key, char value) { - bundle.putChar(key, value); - return this; - } - - public Bundler put(@NonNull String key, char[] value) { - bundle.putCharArray(key, value); - return this; - } - - public Bundler put(@NonNull String key, CharSequence value) { - bundle.putCharSequence(key, value); - return this; - } - - public Bundler put(@NonNull String key, CharSequence[] value) { - bundle.putCharSequenceArray(key, value); - return this; - } - - public Bundler putCharSequenceArrayList(@NonNull String key, ArrayList value) { - bundle.putCharSequenceArrayList(key, value); - return this; - } - - public Bundler put(@NonNull String key, double value) { - bundle.putDouble(key, value); - return this; - } - - public Bundler put(@NonNull String key, double[] value) { - bundle.putDoubleArray(key, value); - return this; - } - - public Bundler put(@NonNull String key, Parcelable value) { - Bundle safeBundle = new Bundle(); - safeBundle.putParcelable(key, value); - if (isValidBundleSize(safeBundle)) { - bundle.putParcelable(key, value); - } - clearBundle(safeBundle); - return this; - } - - public Bundler put(@NonNull String key, Parcelable[] value) { - Bundle safeBundle = new Bundle(); - safeBundle.putParcelableArray(key, value); - if (isValidBundleSize(safeBundle)) { - bundle.putParcelableArray(key, value); - } - clearBundle(safeBundle); - return this; - } - - public Bundler putParcelableArrayList(@NonNull String key, ArrayList value) { - Bundle safeBundle = new Bundle(); - safeBundle.putParcelableArrayList(key, value); - if (isValidBundleSize(safeBundle)) { - bundle.putParcelableArrayList(key, value); - } - clearBundle(safeBundle); - return this; - } - - public Bundler putSparseParcelableArray(@NonNull String key, SparseArray value) { - Bundle safeBundle = new Bundle(); - safeBundle.putSparseParcelableArray(key, value); - if (isValidBundleSize(safeBundle)) { - bundle.putSparseParcelableArray(key, value); - } - clearBundle(safeBundle); - return this; - } - - public Bundler put(@NonNull String key, short value) { - bundle.putShort(key, value); - return this; - } - - public Bundler put(@NonNull String key, short[] value) { - bundle.putShortArray(key, value); - return this; - } - - public Bundler put(@NonNull String key, Serializable value) { - Bundle safeBundle = new Bundle(); - safeBundle.putSerializable(key, value); - if (isValidBundleSize(safeBundle)) { - bundle.putSerializable(key, value); - } - clearBundle(safeBundle); - return this; - } - - public Bundler putAll(Bundle map) { - bundle.putAll(map); - return this; - } - - /** - * Get the underlying start. - */ - private Bundle get() { - return bundle; - } - - @NonNull public Bundle end() { - Parcel parcel = Parcel.obtain(); - bundle.writeToParcel(parcel, 0); - int size = parcel.dataSize(); - Logger.e(size); - if (size > 500000) { - bundle.clear(); - } - return get(); - } - - public static boolean isValidBundleSize(@NonNull Bundle bundle) { - Parcel parcel = Parcel.obtain(); - bundle.writeToParcel(parcel, 0); - return parcel.dataSize() < 500000; - } - - private void clearBundle(Bundle safeBundle) { - safeBundle.clear(); - safeBundle = null; - } - -} diff --git a/app/src/main/java/com/fastaccess/helper/CustomTabsHelper.java b/app/src/main/java/com/fastaccess/helper/CustomTabsHelper.java deleted file mode 100644 index 722820ed4..000000000 --- a/app/src/main/java/com/fastaccess/helper/CustomTabsHelper.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.fastaccess.helper; - -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.net.Uri; -import android.text.TextUtils; -import android.util.Log; - -import java.util.ArrayList; -import java.util.List; - -class CustomTabsHelper { - private static final String TAG = "CustomTabsHelper"; - private static final String STABLE_PACKAGE = "com.android.chrome"; - private static final String BETA_PACKAGE = "com.chrome.beta"; - private static final String DEV_PACKAGE = "com.chrome.dev"; - private static final String LOCAL_PACKAGE = "com.google.android.apps.chrome"; - private static final String ACTION_CUSTOM_TABS_CONNECTION = - "android.support.customtabs.action.CustomTabsService"; - - private static String sPackageNameToUse; - - private CustomTabsHelper() {} - - /** - * Goes through all apps that handle VIEW intents and have a warmup service. Picks - * the one chosen by the user if there is one, otherwise makes a best effort to return a - * valid package name. - *

- * This is not threadsafe. - * - * @param context - * {@link Context} to use for accessing {@link PackageManager}. - * @return The package name recommended to use for connecting to custom tabs related components. - */ - static String getPackageNameToUse(Context context) { - if (sPackageNameToUse != null) return sPackageNameToUse; - - PackageManager pm = context.getPackageManager(); - // Get default VIEW intent handler. - Intent activityIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.example.com")); - ResolveInfo defaultViewHandlerInfo = pm.resolveActivity(activityIntent, 0); - String defaultViewHandlerPackageName = null; - if (defaultViewHandlerInfo != null) { - defaultViewHandlerPackageName = defaultViewHandlerInfo.activityInfo.packageName; - } - - // Get all apps that can handle VIEW intents. - List resolvedActivityList = pm.queryIntentActivities(activityIntent, 0); - List packagesSupportingCustomTabs = new ArrayList<>(); - for (ResolveInfo info : resolvedActivityList) { - Intent serviceIntent = new Intent(); - serviceIntent.setAction(ACTION_CUSTOM_TABS_CONNECTION); - serviceIntent.setPackage(info.activityInfo.packageName); - if (pm.resolveService(serviceIntent, 0) != null) { - packagesSupportingCustomTabs.add(info.activityInfo.packageName); - } - } - - // Now packagesSupportingCustomTabs contains all apps that can handle both VIEW intents - // and service calls. - if (packagesSupportingCustomTabs.isEmpty()) { - sPackageNameToUse = null; - } else if (packagesSupportingCustomTabs.size() == 1) { - sPackageNameToUse = packagesSupportingCustomTabs.get(0); - } else if (!TextUtils.isEmpty(defaultViewHandlerPackageName) - && !hasSpecializedHandlerIntents(context, activityIntent) - && packagesSupportingCustomTabs.contains(defaultViewHandlerPackageName)) { - sPackageNameToUse = defaultViewHandlerPackageName; - } else if (packagesSupportingCustomTabs.contains(STABLE_PACKAGE)) { - sPackageNameToUse = STABLE_PACKAGE; - } else if (packagesSupportingCustomTabs.contains(BETA_PACKAGE)) { - sPackageNameToUse = BETA_PACKAGE; - } else if (packagesSupportingCustomTabs.contains(DEV_PACKAGE)) { - sPackageNameToUse = DEV_PACKAGE; - } else if (packagesSupportingCustomTabs.contains(LOCAL_PACKAGE)) { - sPackageNameToUse = LOCAL_PACKAGE; - } - return sPackageNameToUse; - } - - /** - * Used to check whether there is a specialized handler for a given intent. - * - * @param intent - * The intent to check with. - * @return Whether there is a specialized handler for the given intent. - */ - private static boolean hasSpecializedHandlerIntents(Context context, Intent intent) { - try { - PackageManager pm = context.getPackageManager(); - List handlers = pm.queryIntentActivities( - intent, - PackageManager.GET_RESOLVED_FILTER); - if (handlers == null || handlers.size() == 0) { - return false; - } - for (ResolveInfo resolveInfo : handlers) { - IntentFilter filter = resolveInfo.filter; - if (filter == null) continue; - if (filter.countDataAuthorities() == 0 || filter.countDataPaths() == 0) continue; - if (resolveInfo.activityInfo == null) continue; - return true; - } - } catch (RuntimeException e) { - Log.e(TAG, "Runtime exception while getting specialized handlers"); - } - return false; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/helper/DeviceNameGetter.java b/app/src/main/java/com/fastaccess/helper/DeviceNameGetter.java deleted file mode 100644 index 57f7cd020..000000000 --- a/app/src/main/java/com/fastaccess/helper/DeviceNameGetter.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.fastaccess.helper; - -import android.os.Build; - -import com.fastaccess.App; -import com.jaredrummler.android.device.DeviceName; - -import io.reactivex.Observable; - -/** - * Created by Front Desk on 8/7/2017. - */ - -public class DeviceNameGetter { - private static final DeviceNameGetter ourInstance = new DeviceNameGetter(); - private String deviceName; - - public static DeviceNameGetter getInstance() { - return ourInstance; - } - - private DeviceNameGetter() {} - - public void loadDevice() { - DeviceName.with(App.getInstance()) - .request((info, error) -> { - if (error == null && null != info) { - deviceName = info.marketName; - } - }); - } - - String getDeviceName() { - if (deviceName == null) { - deviceName = blockingDeviceName(); - } - return deviceName; - } - - private String blockingDeviceName() { - return (String) Observable.fromPublisher(s -> { - DeviceName.with(App.getInstance()) - .request((info, error) -> { - if (error == null && info != null) s.onNext(info.marketName); - else s.onError(error); - }); - s.onComplete(); - }).blockingFirst(Build.MODEL); - } -} diff --git a/app/src/main/java/com/fastaccess/helper/FileHelper.java b/app/src/main/java/com/fastaccess/helper/FileHelper.java deleted file mode 100644 index d59b9a6cb..000000000 --- a/app/src/main/java/com/fastaccess/helper/FileHelper.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.fastaccess.helper; - -import android.content.Context; -import android.database.Cursor; -import android.media.Ringtone; -import android.media.RingtoneManager; -import android.net.Uri; -import android.os.Environment; -import android.provider.DocumentsContract; -import android.provider.MediaStore; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.R; -import com.fastaccess.data.dao.NotificationSoundModel; - -import java.io.File; -import java.util.ArrayList; - -/** - * Created by kosh20111 on 10/7/2015. CopyRights @ - */ -public class FileHelper { - - public static final String PATH = Environment.getExternalStorageDirectory() + File.separator + "FastHub"; - - public static final long ONE_MB = 1048576L; - - @Nullable public static String getPath(@NonNull Context context, @NonNull Uri uri) { - String filePath = null; - try { - String wholeID = DocumentsContract.getDocumentId(uri); - String id = wholeID.split(":")[1]; - String[] column = {MediaStore.Images.Media.DATA}; - String sel = MediaStore.Images.Media._ID + "=?"; - try (Cursor cursor = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, - column, sel, new String[]{id}, null)) { - if (cursor != null) { - int columnIndex = cursor.getColumnIndex(column[0]); - if (cursor.moveToFirst()) { - filePath = cursor.getString(columnIndex); - } - } - } - } catch (Exception ignored) {} - return filePath; - } - - @NonNull public static String getRingtoneName(@NonNull Context context, @Nullable Uri uri) { - String title = context.getString(R.string.sound_chooser_summary); - if (uri != null) { - Ringtone ringtone = RingtoneManager.getRingtone(context, uri); - if (ringtone != null) { - return ringtone.getTitle(context); - } else { - try (Cursor cur = context.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, - new String[]{MediaStore.Audio.Media.TITLE}, MediaStore.Audio.Media._ID + " =?", - new String[]{uri.getLastPathSegment()}, null)) { - if (cur != null) { - title = cur.getString(1); - if (InputHelper.isEmpty(title)) { - title = cur.getString(cur.getColumnIndex(MediaStore.Audio.Media.TITLE)); - } - } - } catch (Exception ignored) {} - } - } - return title; - } - - public static ArrayList getNotificationSounds(Context context, @Nullable String defaultValue) { - ArrayList notificationSounds = new ArrayList<>(); - RingtoneManager ringtoneManager = new RingtoneManager(context); - ringtoneManager.setType(RingtoneManager.TYPE_NOTIFICATION); - try (Cursor ringsCursor = ringtoneManager.getCursor()) { - while (ringsCursor.moveToNext()) { - String title = ringsCursor.getString(RingtoneManager.TITLE_COLUMN_INDEX); - Uri uri = Uri.parse(ringsCursor.getString(RingtoneManager.URI_COLUMN_INDEX) + "/" - + ringsCursor.getString(RingtoneManager.ID_COLUMN_INDEX)); - boolean selected = defaultValue != null && (uri.toString().contains(defaultValue) || - title.equalsIgnoreCase(defaultValue) || defaultValue.contains(title)); - Logger.e(defaultValue, title, uri, selected); - notificationSounds.add(new NotificationSoundModel(title, uri, selected)); - } - } - return notificationSounds; - } - - -} diff --git a/app/src/main/java/com/fastaccess/helper/GithubConfigHelper.java b/app/src/main/java/com/fastaccess/helper/GithubConfigHelper.java deleted file mode 100644 index ebe7a7454..000000000 --- a/app/src/main/java/com/fastaccess/helper/GithubConfigHelper.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.fastaccess.helper; - -import com.fastaccess.BuildConfig; - -/** - * Created by thermatk on 12.04.17. - */ - -public class GithubConfigHelper { - private static final String REDIRECT_URL = "fasthub://login"; - - public static String getRedirectUrl() { - return REDIRECT_URL; - } - - public static String getClientId() { - return BuildConfig.GITHUB_CLIENT_ID; - } - - public static String getSecret() { - return BuildConfig.GITHUB_SECRET; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/helper/InputHelper.java b/app/src/main/java/com/fastaccess/helper/InputHelper.java deleted file mode 100644 index 51f9171aa..000000000 --- a/app/src/main/java/com/fastaccess/helper/InputHelper.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.fastaccess.helper; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.textfield.TextInputLayout; -import android.text.TextUtils; -import android.widget.EditText; -import android.widget.TextView; - -/** - * Created by kosh20111 on 3/11/2015. CopyRights @ - *

- * Input Helper to validate stuff related to input fields. - */ -public class InputHelper { - - public static final String SPACE = "\u202F\u202F"; - - private static boolean isWhiteSpaces(@Nullable String s) { - return s != null && s.matches("\\s+"); - } - - public static boolean isEmpty(@Nullable String text) { - return text == null || TextUtils.isEmpty(text) || isWhiteSpaces(text) || text.equalsIgnoreCase("null"); - } - - public static boolean isEmpty(@Nullable Object text) { - return text == null || isEmpty(text.toString()); - } - - public static boolean isEmpty(@Nullable EditText text) { - return text == null || isEmpty(text.getText().toString()); - } - - public static boolean isEmpty(@Nullable TextView text) { - return text == null || isEmpty(text.getText().toString()); - } - - public static boolean isEmpty(@Nullable TextInputLayout txt) { - return txt == null || isEmpty(txt.getEditText()); - } - - public static String toString(@NonNull EditText editText) { - return editText.getText().toString(); - } - - public static String toString(@NonNull TextView editText) { - return editText.getText().toString(); - } - - public static String toString(@NonNull TextInputLayout textInputLayout) { - return textInputLayout.getEditText() != null ? toString(textInputLayout.getEditText()) : ""; - } - - @NonNull public static String toNA(@Nullable String value) { - return isEmpty(value) ? "N/A" : value; - } - - @NonNull public static String toString(@Nullable Object object) { - return !isEmpty(object) ? object.toString() : ""; - } - - public static long toLong(@NonNull TextView textView) { - return toLong(toString(textView)); - } - - public static long toLong(@NonNull String text) { - if (!isEmpty(text)) { - try { - return Long.valueOf(text.replaceAll("[^0-9]", "")); - } catch (NumberFormatException ignored) {} - } - return 0; - } - - public static int getSafeIntId(long id) { - return id > Integer.MAX_VALUE ? (int) (id - Integer.MAX_VALUE) : (int) id; - } - - public static String capitalizeFirstLetter(String s) { - if (isEmpty(s)) { - return ""; - } - char first = s.charAt(0); - if (Character.isUpperCase(first)) { - return s; - } else { - return Character.toUpperCase(first) + s.substring(1); - } - } -} diff --git a/app/src/main/java/com/fastaccess/helper/Logger.java b/app/src/main/java/com/fastaccess/helper/Logger.java deleted file mode 100644 index 64953a7c7..000000000 --- a/app/src/main/java/com/fastaccess/helper/Logger.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.fastaccess.helper; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.util.Log; - -import com.fastaccess.BuildConfig; - -import java.util.Arrays; -import java.util.List; - -/** - * Created by Kosh on 04/12/15 11:52 PM. copyrights @ - */ -public class Logger { - - private final static String TAG = Logger.class.getSimpleName(); - - private static final boolean DEBUG = BuildConfig.DEBUG; - - private static void e(@NonNull String tag, @Nullable Object text) { - if (!DEBUG) return; - Log.e(tag, text != null ? text.toString() : "LOGGER IS NULL");//avoid null - } - - private static void d(@NonNull String tag, @Nullable Object text) { - if (!DEBUG) return; - Log.d(tag, text != null ? text.toString() : "LOGGER IS NULL");//avoid null - } - - private static void i(@NonNull String tag, @Nullable Object text) { - if (!DEBUG) return; - Log.i(tag, text != null ? text.toString() : "LOGGER IS NULL");//avoid null - } - - public static void d(@Nullable Object text) { - d(getCurrentClassName() + " || " + getCurrentMethodName(), text);//avoid null - } - - public static void i(@Nullable Object text) { - i(getCurrentClassName() + " || " + getCurrentMethodName(), text);//avoid null - } - - public static void e(Object... objects) { - if (objects != null && objects.length > 0) { - e(getCurrentClassName() + " || " + getCurrentMethodName(), Arrays.toString(objects)); - } else { - e(getCurrentClassName() + " || " + getCurrentMethodName(), getCurrentMethodName()); - } - } - - public static void e(List objects) { - if (objects != null) { - e(getCurrentClassName() + " || " + getCurrentMethodName(), Arrays.toString(objects.toArray())); - } else { - e(TAG, null); - } - } - - private static String getCurrentMethodName() { - try { - return Thread.currentThread().getStackTrace()[4].getMethodName() + "()"; - } catch (Exception ignored) {} - return TAG; - } - - private static String getCurrentClassName() { - try { - String className = Thread.currentThread().getStackTrace()[4].getClassName(); - String[] temp = className.split("[.]"); - className = temp[temp.length - 1]; - return className; - } catch (Exception ignored) {} - return TAG; - } -} diff --git a/app/src/main/java/com/fastaccess/helper/ObjectsCompat.java b/app/src/main/java/com/fastaccess/helper/ObjectsCompat.java deleted file mode 100644 index f5c56b6c8..000000000 --- a/app/src/main/java/com/fastaccess/helper/ObjectsCompat.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.fastaccess.helper; - -import androidx.annotation.Nullable; - -/** - * Created by Kosh on 18 Apr 2017, 10:57 PM - */ - -public class ObjectsCompat { - - public static boolean nonNull(@Nullable Object obj) { - return obj != null; - } -} diff --git a/app/src/main/java/com/fastaccess/helper/ParcelableHelper.kt b/app/src/main/java/com/fastaccess/helper/ParcelableHelper.kt deleted file mode 100644 index 1cc7c582f..000000000 --- a/app/src/main/java/com/fastaccess/helper/ParcelableHelper.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.fastaccess.helper - -import android.os.Parcel -import android.os.Parcelable - -interface KotlinParcelable : Parcelable { - override fun describeContents() = 0 - override fun writeToParcel(dest: Parcel, flags: Int) -} - -inline fun parcelableCreator(crossinline create: (Parcel) -> T) = object : Parcelable.Creator { - override fun createFromParcel(source: Parcel) = create(source) - override fun newArray(size: Int) = arrayOfNulls(size) -} - -fun Parcel.readBooleanCompat() = readInt() != 0 - -fun Parcel.writeBooleanCompat(value: Boolean) = writeInt(if (value) 1 else 0) diff --git a/app/src/main/java/com/fastaccess/helper/ParseDateFormat.java b/app/src/main/java/com/fastaccess/helper/ParseDateFormat.java deleted file mode 100644 index c3587cf2e..000000000 --- a/app/src/main/java/com/fastaccess/helper/ParseDateFormat.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.fastaccess.helper; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.text.format.DateUtils; - -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.Locale; -import java.util.TimeZone; - -public class ParseDateFormat { - - private static final ParseDateFormat INSTANCE = new ParseDateFormat(); - - private final Object lock = new Object(); - - private final DateFormat dateFormat; - - private ParseDateFormat() { - dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ENGLISH); - dateFormat.setTimeZone(TimeZone.getDefault()); - } - - @NonNull public String format(Date date) { - synchronized (lock) { - return dateFormat.format(date); - } - } - - - @NonNull public static CharSequence getTimeAgo(@Nullable String toParse) { - try { - Date parsedDate = getInstance().dateFormat.parse(toParse); - long now = System.currentTimeMillis(); - return DateUtils.getRelativeTimeSpanString(parsedDate.getTime(), now, DateUtils.SECOND_IN_MILLIS); - } catch (Exception e) { - e.printStackTrace(); - } - return "N/A"; - } - - @NonNull public static CharSequence getTimeAgo(@Nullable Date parsedDate) { - if (parsedDate != null) { - long now = System.currentTimeMillis(); - return DateUtils.getRelativeTimeSpanString(parsedDate.getTime(), now, DateUtils.SECOND_IN_MILLIS); - } - return "N/A"; - } - - @NonNull public static String toGithubDate(@NonNull Date date) { - return getInstance().format(date); - } - - @NonNull public static String prettifyDate(long timestamp) { - return new SimpleDateFormat("dd-MM-yyyy", Locale.ENGLISH).format(new Date(timestamp)); - } - - @Nullable public static Date getDateFromString(@NonNull String date) { - try { - return new SimpleDateFormat("dd-MM-yyyy", Locale.US).parse(date); - } catch (ParseException e) { - e.printStackTrace(); - } - return null; - } - - @NonNull private static ParseDateFormat getInstance() { - return INSTANCE; - } - - private static String getDateByDays(int days) { - Calendar cal = Calendar.getInstance(); - SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ENGLISH); - cal.add(Calendar.DAY_OF_YEAR, days); - return s.format(new Date(cal.getTimeInMillis())); - } - - public static String getLastWeekDate() { - return getDateByDays(-7); - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/helper/PrefGetter.java b/app/src/main/java/com/fastaccess/helper/PrefGetter.java deleted file mode 100644 index af09693db..000000000 --- a/app/src/main/java/com/fastaccess/helper/PrefGetter.java +++ /dev/null @@ -1,519 +0,0 @@ -package com.fastaccess.helper; - -import android.content.Context; -import android.content.res.Resources; -import android.media.RingtoneManager; -import android.net.Uri; -import androidx.annotation.IntDef; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.App; -import com.fastaccess.BuildConfig; -import com.fastaccess.R; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -/** - * Created by Kosh on 10 Nov 2016, 3:43 PM - */ - -public class PrefGetter { - - public static final int LIGHT = 1; - public static final int DARK = 2; - public static final int AMLOD = 3; - public static final int BLUISH = 4; - public static final int MID_NIGHT_BLUE = 5; - - public static final int RED = 1; - public static final int PINK = 2; - public static final int PURPLE = 3; - public static final int DEEP_PURPLE = 4; - public static final int INDIGO = 5; - public static final int BLUE = 6; - public static final int LIGHT_BLUE = 7; - public static final int CYAN = 8; - public static final int TEAL = 9; - public static final int GREEN = 10; - public static final int LIGHT_GREEN = 11; - public static final int LIME = 12; - public static final int YELLOW = 13; - public static final int AMBER = 14; - public static final int ORANGE = 15; - public static final int DEEP_ORANGE = 16; - - @IntDef({ - LIGHT, - DARK, - AMLOD, - MID_NIGHT_BLUE, - BLUISH - }) - @Retention(RetentionPolicy.SOURCE) public @interface ThemeType {} - - @IntDef({ - RED, - PINK, - PURPLE, - DEEP_PURPLE, - INDIGO, - BLUE, - LIGHT_BLUE, - CYAN, - TEAL, - GREEN, - LIGHT_GREEN, - LIME, - YELLOW, - AMBER, - ORANGE, - DEEP_ORANGE - }) - @Retention(RetentionPolicy.SOURCE) @interface ThemeColor {} - - - private static final String WHATS_NEW_VERSION = "whats_new"; - private static final String ADS = "enable_ads"; - private static final String TOKEN = "token"; - private static final String ENTERPRISE_TOKEN = "enterprise_token"; - private static final String USER_ICON_GUIDE = "user_icon_guide"; - private static final String RELEASE_GUIDE = "release_guide"; - private static final String FILE_OPTION_GUIDE = "file_option_guide"; - private static final String COMMENTS_GUIDE = "comments_guide"; - private static final String REPO_GUIDE = "repo_guide"; - private static final String MARKDOWNDOWN_GUIDE = "markdowndown_guide"; - private static final String HOME_BUTTON_GUIDE = "home_button_guide"; - private static final String NAV_DRAWER_GUIDE = "nav_drawer_guide"; - private static final String ACC_NAV_DRAWER_GUIDE = "acc_nav_drawer_guide"; - private static final String FAB_LONG_PRESS_REPO_GUIDE = "fab_long_press_repo_guide"; - private static final String WRAP_CODE = "wrap_code"; - private static final String OTP_CODE = "otp_code"; - private static final String ENTERPRISE_OTP_CODE = "enterprise_otp_code"; - private static final String APP_LANGUAGE = "app_language"; - private static final String SENT_VIA = "fasthub_signature"; - private static final String SENT_VIA_BOX = "sent_via_enabled"; - private static final String PROFILE_BACKGROUND_URL = "profile_background_url"; - private static final String AMLOD_THEME_ENABLED = "amlod_theme_enabled"; - private static final String MIDNIGHTBLUE_THEME_ENABLED = "midnightblue_theme_enabled"; - private static final String BLUISH_THEME_ENABLED = "bluish_theme_enabled"; - private static final String PRO_ITEMS = "fasth_pro_items"; - private static final String ENTERPRISE_ITEM = "enterprise_item"; - private static final String CODE_THEME = "code_theme"; - private static final String ENTERPRISE_URL = "enterprise_url"; - private static final String NOTIFICATION_SOUND_PATH = "notification_sound_path"; - private static final String DISABLE_AUTO_LOAD_IMAGE = "disable_auto_loading_image"; - private static final String PLAY_STORE_REVIEW_ACTIVITY = "play_store_review_activity"; - - public static void setToken(@Nullable String token) { - PrefHelper.set(TOKEN, token); - } - - public static void setTokenEnterprise(@Nullable String token) { - PrefHelper.set(ENTERPRISE_TOKEN, token); - } - - public static String getToken() { - return PrefHelper.getString(TOKEN); - } - - public static String getEnterpriseToken() { - return PrefHelper.getString(ENTERPRISE_TOKEN); - } - - public static String getEnterpriseOtpCode() { - return PrefHelper.getString(ENTERPRISE_OTP_CODE); - } - - public static void setEnterpriseOtpCode(@Nullable String otp) { - PrefHelper.set(ENTERPRISE_OTP_CODE, otp); - } - - public static String getOtpCode() { - return PrefHelper.getString(OTP_CODE); - } - - public static void setOtpCode(@Nullable String otp) { - PrefHelper.set(OTP_CODE, otp); - } - - public static boolean isAdsEnabled() { - return PrefHelper.getBoolean(ADS); - } - - public static void setAdsEnabled(boolean isEnabled) { - PrefHelper.set(ADS, isEnabled); - } - - public static void clear() { - PrefHelper.clearPrefs(); - } - - @SuppressWarnings("BooleanMethodIsAlwaysInverted") public static boolean isUserIconGuideShowed() { - boolean isShowed = PrefHelper.getBoolean(USER_ICON_GUIDE); - PrefHelper.set(USER_ICON_GUIDE, true); - return isShowed; - } - - public static boolean isReleaseHintShow() { - boolean isShowed = PrefHelper.getBoolean(RELEASE_GUIDE); - PrefHelper.set(RELEASE_GUIDE, true); - return isShowed; - } - - public static boolean isFileOptionHintShow() { - boolean isShowed = PrefHelper.getBoolean(FILE_OPTION_GUIDE); - PrefHelper.set(FILE_OPTION_GUIDE, true); - return isShowed; - } - - public static boolean isCommentHintShowed() { - boolean isShowed = PrefHelper.getBoolean(COMMENTS_GUIDE); - PrefHelper.set(COMMENTS_GUIDE, true); - return isShowed; - } - - public static boolean isHomeButoonHintShowed() { - boolean isShowed = PrefHelper.getBoolean(HOME_BUTTON_GUIDE); - PrefHelper.set(HOME_BUTTON_GUIDE, true); - return isShowed; - } - - public static boolean isRepoGuideShowed() { - boolean isShowed = PrefHelper.getBoolean(REPO_GUIDE); - PrefHelper.set(REPO_GUIDE, true); - return isShowed; - } - - public static boolean isEditorHintShowed() { - boolean isShowed = PrefHelper.getBoolean(MARKDOWNDOWN_GUIDE); - PrefHelper.set(MARKDOWNDOWN_GUIDE, true); - return isShowed; - } - - public static boolean isNavDrawerHintShowed() { - boolean isShowed = PrefHelper.getBoolean(NAV_DRAWER_GUIDE); - PrefHelper.set(NAV_DRAWER_GUIDE, true); - return isShowed; - } - - public static boolean isAccountNavDrawerHintShowed() { - boolean isShowed = PrefHelper.getBoolean(ACC_NAV_DRAWER_GUIDE); - PrefHelper.set(ACC_NAV_DRAWER_GUIDE, true); - return isShowed; - } - - public static boolean isRepoFabHintShowed() { - boolean isShowed = PrefHelper.getBoolean(FAB_LONG_PRESS_REPO_GUIDE); - PrefHelper.set(FAB_LONG_PRESS_REPO_GUIDE, true); - return isShowed; - } - - public static boolean isRVAnimationEnabled() { - return PrefHelper.getBoolean("recylerViewAnimation"); - } - - public static int getNotificationTaskDuration() { - if (PrefHelper.isExist("notificationEnabled") && PrefHelper.getBoolean("notificationEnabled")) { - String prefValue = PrefHelper.getString("notificationTime"); - if (prefValue != null) { - return notificationDurationMillis(prefValue); - } - } - return -1; - } - - public static int notificationDurationMillis(@NonNull String prefValue) { - if (!InputHelper.isEmpty(prefValue)) { - switch (prefValue) { - case "1": - return 60; - case "5": - return 5 * 60; - case "10": - return 10 * 60; - case "20": - return 20 * 60; - case "30": - return 30 * 60; - case "60": - return 60 * 60; // 1 hour - case "120": - return (60 * 2) * 60; // 2 hours - case "180": - return (60 * 3) * 60; // 3 hours - } - } - return -1; - } - - public static boolean isTwiceBackButtonDisabled() { - return PrefHelper.getBoolean("back_button"); - } - - public static boolean isRectAvatar() { - return PrefHelper.getBoolean("rect_avatar"); - } - - @SuppressWarnings("BooleanMethodIsAlwaysInverted") public static boolean isMarkAsReadEnabled() { - return PrefHelper.getBoolean("markNotificationAsRead"); - } - - public static boolean isWrapCode() { - return PrefHelper.getBoolean(WRAP_CODE); - } - - public static boolean isSentViaEnabled() { - return PrefHelper.getBoolean(SENT_VIA); - } - - public static boolean isSentViaBoxEnabled() { - return PrefHelper.getBoolean(SENT_VIA_BOX); - } - - @ThemeType public static int getThemeType(@NonNull Context context) { - return getThemeType(context.getResources()); - } - - @ThemeType public static int getThemeType() { - return getThemeType(App.getInstance().getResources()); - } - - @ThemeColor public static int getThemeColor(@NonNull Context context) { - return getThemeColor(context.getResources()); - } - - @ThemeType static int getThemeType(@NonNull Resources resources) { - String appTheme = PrefHelper.getString("appTheme"); - if (!InputHelper.isEmpty(appTheme)) { - if (appTheme.equalsIgnoreCase(resources.getString(R.string.dark_theme_mode))) { - return DARK; - } else if (appTheme.equalsIgnoreCase(resources.getString(R.string.light_theme_mode))) { - return LIGHT; - } else if (appTheme.equalsIgnoreCase(resources.getString(R.string.amlod_theme_mode))) { - return AMLOD; - } else if (appTheme.equalsIgnoreCase(resources.getString(R.string.mid_night_blue_theme_mode))) { - return MID_NIGHT_BLUE; - } else if (appTheme.equalsIgnoreCase(resources.getString(R.string.bluish_theme))) { - return BLUISH; - } - } - return LIGHT; - } - - @ThemeColor private static int getThemeColor(@NonNull Resources resources) { - String appColor = PrefHelper.getString("appColor"); - return getThemeColor(resources, appColor); - } - - // used for color picker to get the index of the color (enum) from the name of the color - public static int getThemeColor(@NonNull Resources resources, String appColor) { - if (!InputHelper.isEmpty(appColor)) { - if (appColor.equalsIgnoreCase(resources.getString(R.string.red_theme_mode))) - return RED; - if (appColor.equalsIgnoreCase(resources.getString(R.string.pink_theme_mode))) - return PINK; - if (appColor.equalsIgnoreCase(resources.getString(R.string.purple_theme_mode))) - return PURPLE; - if (appColor.equalsIgnoreCase(resources.getString(R.string.deep_purple_theme_mode))) - return DEEP_PURPLE; - if (appColor.equalsIgnoreCase(resources.getString(R.string.indigo_theme_mode))) - return INDIGO; - if (appColor.equalsIgnoreCase(resources.getString(R.string.blue_theme_mode))) - return BLUE; - if (appColor.equalsIgnoreCase(resources.getString(R.string.light_blue_theme_mode))) - return LIGHT_BLUE; - if (appColor.equalsIgnoreCase(resources.getString(R.string.cyan_theme_mode))) - return CYAN; - if (appColor.equalsIgnoreCase(resources.getString(R.string.teal_theme_mode))) - return TEAL; - if (appColor.equalsIgnoreCase(resources.getString(R.string.green_theme_mode))) - return GREEN; - if (appColor.equalsIgnoreCase(resources.getString(R.string.light_green_theme_mode))) - return LIGHT_GREEN; - if (appColor.equalsIgnoreCase(resources.getString(R.string.lime_theme_mode))) - return LIME; - if (appColor.equalsIgnoreCase(resources.getString(R.string.yellow_theme_mode))) - return YELLOW; - if (appColor.equalsIgnoreCase(resources.getString(R.string.amber_theme_mode))) - return AMBER; - if (appColor.equalsIgnoreCase(resources.getString(R.string.orange_theme_mode))) - return ORANGE; - if (appColor.equalsIgnoreCase(resources.getString(R.string.deep_orange_theme_mode))) - return DEEP_ORANGE; - } - return BLUE; - } - - @NonNull public static String getAppLanguage() { - String appLanguage = PrefHelper.getString(APP_LANGUAGE); - return appLanguage == null ? "en" : appLanguage; - } - - public static void setAppLangauge(@Nullable String language) { - PrefHelper.set(APP_LANGUAGE, language == null ? "en" : language); - } - - public static void setProfileBackgroundUrl(@Nullable String url) { - if (url == null) { - PrefHelper.clearKey(PROFILE_BACKGROUND_URL); - } else { - PrefHelper.set(PROFILE_BACKGROUND_URL, url); - } - } - - @Nullable public static String getProfileBackgroundUrl() { - return PrefHelper.getString(PROFILE_BACKGROUND_URL); - } - - public static void setWhatsNewVersion() { - PrefHelper.set(WHATS_NEW_VERSION, BuildConfig.VERSION_CODE); - } - - public static boolean showWhatsNew() { - return PrefHelper.getInt(WHATS_NEW_VERSION) != BuildConfig.VERSION_CODE; - } - - public static boolean isNotificationSoundEnabled() { - return PrefHelper.getBoolean("notificationSound"); - } - - public static void enableAmlodTheme() { - PrefHelper.set(AMLOD_THEME_ENABLED, true); - } - - public static boolean isAmlodEnabled() { - return PrefHelper.getBoolean(AMLOD_THEME_ENABLED); - } - - public static void enableMidNightBlueTheme() { - PrefHelper.set(MIDNIGHTBLUE_THEME_ENABLED, true); - } - - public static boolean isMidNightBlueThemeEnabled() { - return PrefHelper.getBoolean(MIDNIGHTBLUE_THEME_ENABLED); - } - - public static boolean isBluishEnabled() { - return PrefHelper.getBoolean(BLUISH_THEME_ENABLED); - } - - public static void enableBluishTheme() { - PrefHelper.set(BLUISH_THEME_ENABLED, true); - } - - public static void setProItems() { - PrefHelper.set(PRO_ITEMS, true); - enableAmlodTheme(); - enableBluishTheme(); - enableMidNightBlueTheme(); - } - - public static void setEnterpriseItem() { - PrefHelper.set(ENTERPRISE_ITEM, true); - } - - public static boolean isEnterpriseEnabled() { - return PrefHelper.getBoolean(ENTERPRISE_ITEM); - } - - public static boolean isAllFeaturesUnlocked() { - return isProEnabled() && isEnterprise(); - } - - public static boolean isProEnabled() { - return PrefHelper.getBoolean(PRO_ITEMS); - } - - public static boolean hasSupported() { - return isProEnabled() || isAmlodEnabled() || isBluishEnabled(); - } - - public static String getCodeTheme() { - return PrefHelper.getString(CODE_THEME); - } - - public static void setCodeTheme(@NonNull String theme) { - PrefHelper.set(CODE_THEME, theme); - } - - public static String getEnterpriseUrl() { - return PrefHelper.getString(ENTERPRISE_URL); - } - - public static void setEnterpriseUrl(@Nullable String value) { - PrefHelper.set(ENTERPRISE_URL, value); - } - - public static boolean isEnterprise() { - return !InputHelper.isEmpty(getEnterpriseUrl()); - } - - public static boolean isNavBarTintingDisabled() { - return PrefHelper.getBoolean("navigation_color"); - } - - public static void resetEnterprise() { - PrefGetter.setTokenEnterprise(null); - PrefGetter.setEnterpriseOtpCode(null); - PrefGetter.setEnterpriseUrl(null); - } - - @Nullable public static Uri getNotificationSound() { - String nsp = PrefHelper.getString(NOTIFICATION_SOUND_PATH); - return !InputHelper.isEmpty(nsp) ? Uri.parse(nsp) : RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); - } - - public static void setNotificationSound(@NonNull Uri uri) { - PrefHelper.set(NOTIFICATION_SOUND_PATH, uri.toString()); - } - - public static boolean isAutoImageDisabled() { - return PrefHelper.getBoolean(DISABLE_AUTO_LOAD_IMAGE) && AppHelper.isDataPlan(); - } - - public static boolean isAppAnimationDisabled() { - return PrefHelper.getBoolean("app_animation"); - } - - public static boolean isPlayStoreWarningShowed() { - return PrefHelper.getBoolean(PLAY_STORE_REVIEW_ACTIVITY); - } - - public static void setPlayStoreWarningShowed() { - PrefHelper.set(PLAY_STORE_REVIEW_ACTIVITY, true); - } - - public static void clearPurchases() { - PrefHelper.set(PRO_ITEMS, false); - PrefHelper.set(BLUISH_THEME_ENABLED, false); - PrefHelper.set(AMLOD_THEME_ENABLED, false); - setEnterpriseUrl(null); - } - - public static boolean isFeedsHintShowed() { - boolean isFeedsHitShowed = PrefHelper.getBoolean("feeds_hint"); - if (!isFeedsHitShowed) { - PrefHelper.set("feeds_hint", true); - } - return isFeedsHitShowed; - } - - public static boolean isIssuesLongPressHintShowed() { - boolean isIssuesLongPressHintShowed = PrefHelper.getBoolean("issues_long_press_hint"); - if (!isIssuesLongPressHintShowed) { - PrefHelper.set("issues_long_press_hint", true); - } - return isIssuesLongPressHintShowed; - } - - public static boolean isPRLongPressHintShowed() { - boolean isPRLongPressHintShowed = PrefHelper.getBoolean("pr_long_press_hint"); - if (!isPRLongPressHintShowed) { - PrefHelper.set("pr_long_press_hint", true); - } - return isPRLongPressHintShowed; - } - -} diff --git a/app/src/main/java/com/fastaccess/helper/PrefHelper.java b/app/src/main/java/com/fastaccess/helper/PrefHelper.java deleted file mode 100644 index 10fee73d4..000000000 --- a/app/src/main/java/com/fastaccess/helper/PrefHelper.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.fastaccess.helper; - -import android.annotation.SuppressLint; -import android.content.SharedPreferences; -import android.preference.PreferenceManager; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.App; - -import java.util.Map; - -/** - * Created by kosh20111 on 19 Feb 2017, 2:01 AM - */ -public class PrefHelper { - - /** - * @param key - * ( the Key to used to retrieve this data later ) - * @param value - * ( any kind of primitive values ) - *

- * non can be null!!! - */ - @SuppressLint("ApplySharedPref") public static void set(@NonNull String key, @Nullable T value) { - if (InputHelper.isEmpty(key)) { - throw new NullPointerException("Key must not be null! (key = " + key + "), (value = " + value + ")"); - } - SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(App.getInstance()).edit(); - if (InputHelper.isEmpty(value)) { - clearKey(key); - return; - } - if (value instanceof String) { - edit.putString(key, (String) value); - } else if (value instanceof Integer) { - edit.putInt(key, (Integer) value); - } else if (value instanceof Long) { - edit.putLong(key, (Long) value); - } else if (value instanceof Boolean) { - edit.putBoolean(key, (Boolean) value); - } else if (value instanceof Float) { - edit.putFloat(key, (Float) value); - } else { - edit.putString(key, value.toString()); - } - edit.commit();//apply on UI - } - - @Nullable public static String getString(@NonNull String key) { - return PreferenceManager.getDefaultSharedPreferences(App.getInstance()).getString(key, null); - } - - public static boolean getBoolean(@NonNull String key) { - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(App.getInstance()); - return preferences.getAll().get(key) instanceof Boolean && preferences.getBoolean(key, false); - } - - public static int getInt(@NonNull String key) { - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(App.getInstance()); - return preferences.getAll().get(key) instanceof Integer ? preferences.getInt(key, 0) : -1; - } - - public static long getLong(@NonNull String key) { - return PreferenceManager.getDefaultSharedPreferences(App.getInstance()).getLong(key, 0); - } - - public static float getFloat(@NonNull String key) { - return PreferenceManager.getDefaultSharedPreferences(App.getInstance()).getFloat(key, 0); - } - - public static void clearKey(@NonNull String key) { - PreferenceManager.getDefaultSharedPreferences(App.getInstance()).edit().remove(key).apply(); - } - - public static boolean isExist(@NonNull String key) { - return PreferenceManager.getDefaultSharedPreferences(App.getInstance()).contains(key); - } - - public static void clearPrefs() { - PreferenceManager.getDefaultSharedPreferences(App.getInstance()).edit().clear().apply(); - } - - public static Map getAll() { - return PreferenceManager.getDefaultSharedPreferences(App.getInstance()).getAll(); - } -} diff --git a/app/src/main/java/com/fastaccess/helper/RxHelper.java b/app/src/main/java/com/fastaccess/helper/RxHelper.java deleted file mode 100644 index 698c1883a..000000000 --- a/app/src/main/java/com/fastaccess/helper/RxHelper.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.fastaccess.helper; - -import androidx.annotation.NonNull; - -import io.reactivex.Observable; -import io.reactivex.Single; -import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.schedulers.Schedulers; - - -/** - * Created by Kosh on 11 Nov 2016, 11:53 AM - */ - -public class RxHelper { - public static Observable getObservable(@NonNull Observable observable) { - return observable - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()); - } - - public static Observable safeObservable(@NonNull Observable observable) { - return getObservable(observable) - .doOnError(Throwable::printStackTrace); - } - - public static Single getSingle(@NonNull Single single) { - return single - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()); - } -} diff --git a/app/src/main/java/com/fastaccess/helper/TypeFaceHelper.java b/app/src/main/java/com/fastaccess/helper/TypeFaceHelper.java deleted file mode 100644 index 6cc413711..000000000 --- a/app/src/main/java/com/fastaccess/helper/TypeFaceHelper.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.fastaccess.helper; - -import android.content.Context; -import android.graphics.Typeface; -import android.widget.TextView; - -/** - * Created by Kosh on 17/12/15 10:25 PM - */ -public class TypeFaceHelper { - - private static Typeface typeFace; - - public static void generateTypeface(Context context) { - typeFace = Typeface.createFromAsset(context.getAssets(), "fonts/app_font.ttf"); - } - - public static void applyTypeface(TextView textView) { - textView.setTypeface(typeFace); - } - - public static Typeface getTypeface() { - return typeFace; - } -} diff --git a/app/src/main/java/com/fastaccess/helper/ViewHelper.java b/app/src/main/java/com/fastaccess/helper/ViewHelper.java deleted file mode 100644 index 2861d6252..000000000 --- a/app/src/main/java/com/fastaccess/helper/ViewHelper.java +++ /dev/null @@ -1,212 +0,0 @@ -package com.fastaccess.helper; - -import android.content.Context; -import android.content.res.ColorStateList; -import android.content.res.Configuration; -import android.content.res.Resources; -import android.content.res.TypedArray; -import android.graphics.Color; -import android.graphics.PorterDuff; -import android.graphics.Rect; -import android.graphics.drawable.ColorDrawable; -import android.graphics.drawable.Drawable; -import android.graphics.drawable.RippleDrawable; -import android.graphics.drawable.ShapeDrawable; -import android.graphics.drawable.StateListDrawable; -import android.graphics.drawable.shapes.RoundRectShape; -import androidx.annotation.ColorInt; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.tabs.TabLayout; -import android.text.Layout; -import android.util.TypedValue; -import android.view.View; -import android.view.inputmethod.InputMethodManager; -import android.widget.LinearLayout; -import android.widget.TextView; - -import com.annimon.stream.IntStream; -import com.fastaccess.R; - -import java.util.Arrays; - - -/** - * Created by kosh20111 on 10/7/2015 10:42 PM - */ -public class ViewHelper { - - @ColorInt public static int getPrimaryDarkColor(@NonNull Context context) { - return getColorAttr(context, R.attr.colorPrimaryDark); - } - - @ColorInt public static int getPrimaryColor(@NonNull Context context) { - return getColorAttr(context, R.attr.colorPrimary); - } - - @ColorInt public static int getPrimaryTextColor(@NonNull Context context) { - return getColorAttr(context, android.R.attr.textColorPrimary); - } - - @ColorInt public static int getSecondaryTextColor(@NonNull Context context) { - return getColorAttr(context, android.R.attr.textColorSecondary); - } - - @ColorInt public static int getTertiaryTextColor(@NonNull Context context) { - return getColorAttr(context, android.R.attr.textColorTertiary); - } - - @ColorInt public static int getAccentColor(@NonNull Context context) { - return getColorAttr(context, R.attr.colorAccent); - } - - @ColorInt public static int getIconColor(@NonNull Context context) { - return getColorAttr(context, R.attr.icon_color); - } - - @ColorInt public static int getWindowBackground(@NonNull Context context) { - return getColorAttr(context, android.R.attr.windowBackground); - } - - @ColorInt public static int getListDivider(@NonNull Context context) { - return getColorAttr(context, R.attr.dividerColor); - } - - @ColorInt public static int getCardBackground(@NonNull Context context) { - return getColorAttr(context, R.attr.card_background); - } - - @ColorInt public static int getPatchAdditionColor(@NonNull Context context) { - return getColorAttr(context, R.attr.patch_addition); - } - - @ColorInt public static int getPatchDeletionColor(@NonNull Context context) { - return getColorAttr(context, R.attr.patch_deletion); - } - - @ColorInt public static int getPatchRefColor(@NonNull Context context) { - return getColorAttr(context, R.attr.patch_ref); - } - - @ColorInt private static int getColorAttr(@NonNull Context context, int attr) { - Resources.Theme theme = context.getTheme(); - TypedArray typedArray = theme.obtainStyledAttributes(new int[]{attr}); - final int color = typedArray.getColor(0, Color.LTGRAY); - typedArray.recycle(); - return color; - } - - public static int toPx(@NonNull Context context, int dp) { - return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, dp, context.getResources().getDisplayMetrics()); - } - - public static int dpToPx(Context context, float dp) { - return (int) (dp * context.getResources().getDisplayMetrics().density + 0.5f); - } - - public static void tintDrawable(@NonNull Drawable drawable, @ColorInt int color) { - drawable.mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN); - } - - public static Drawable getDrawableSelector(int normalColor, int pressedColor) { - return new RippleDrawable(ColorStateList.valueOf(pressedColor), getRippleMask(normalColor), getRippleMask(normalColor)); - } - - @NonNull private static Drawable getRippleMask(int color) { - float[] outerRadii = new float[8]; - Arrays.fill(outerRadii, 3); - RoundRectShape r = new RoundRectShape(outerRadii, null, null); - ShapeDrawable shapeDrawable = new ShapeDrawable(r); - shapeDrawable.getPaint().setColor(color); - return shapeDrawable; - } - - @NonNull private static StateListDrawable getStateListDrawable(int normalColor, int pressedColor) { - StateListDrawable states = new StateListDrawable(); - states.addState(new int[]{android.R.attr.state_pressed}, new ColorDrawable(pressedColor)); - states.addState(new int[]{android.R.attr.state_focused}, new ColorDrawable(pressedColor)); - states.addState(new int[]{android.R.attr.state_activated}, new ColorDrawable(pressedColor)); - states.addState(new int[]{android.R.attr.state_selected}, new ColorDrawable(pressedColor)); - states.addState(new int[]{}, new ColorDrawable(normalColor)); - return states; - } - - public static ColorStateList textSelector(int normalColor, int pressedColor) { - return new ColorStateList( - new int[][]{ - new int[]{android.R.attr.state_pressed}, - new int[]{android.R.attr.state_focused}, - new int[]{android.R.attr.state_activated}, - new int[]{android.R.attr.state_selected}, - new int[]{} - }, - new int[]{ - pressedColor, - pressedColor, - pressedColor, - pressedColor, - normalColor - } - ); - } - - private static boolean isTablet(@NonNull Resources resources) { - return (resources.getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE; - } - - @SuppressWarnings("ConstantConditions") public static boolean isTablet(@NonNull Context context) { - return context != null && isTablet(context.getResources()); - } - - public static boolean isLandscape(@NonNull Resources resources) { - return resources.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; - } - - @NonNull @SuppressWarnings("WeakerAccess") public static Rect getLayoutPosition(@NonNull View view) { - Rect myViewRect = new Rect(); - view.getGlobalVisibleRect(myViewRect); - return myViewRect; - } - - @SuppressWarnings("WeakerAccess") @Nullable public static String getTransitionName(@NonNull View view) { - return !InputHelper.isEmpty(view.getTransitionName()) ? view.getTransitionName() : null; - } - - @SuppressWarnings("WeakerAccess") public static void showKeyboard(@NonNull View v, @NonNull Context activity) { - InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); - imm.showSoftInput(v, 0); - } - - public static void showKeyboard(@NonNull View v) { - showKeyboard(v, v.getContext()); - } - - public static void hideKeyboard(@NonNull View view) { - InputMethodManager inputManager = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); - inputManager.hideSoftInputFromWindow(view.getWindowToken(), 0); - } - - @ColorInt public static int generateTextColor(int background) { - return getContrastColor(background); - } - - @ColorInt private static int getContrastColor(@ColorInt int color) { - double a = 1 - (0.299 * Color.red(color) + 0.587 * Color.green(color) + 0.114 * Color.blue(color)) / 255; - return a < 0.5 ? Color.BLACK : Color.WHITE; - } - - public static boolean isEllipsed(@NonNull TextView textView) { - Layout layout = textView.getLayout(); - if (layout != null) { - int lines = layout.getLineCount(); - if (lines > 0) { - return IntStream.range(0, lines).anyMatch(line -> layout.getEllipsisCount(line) > 0); - } - } - return false; - } - - @NonNull public static TextView getTabTextView(@NonNull TabLayout tabs, int tabIndex) { - return (TextView) (((LinearLayout) ((LinearLayout) tabs.getChildAt(0)).getChildAt(tabIndex)).getChildAt(1)); - } -} diff --git a/app/src/main/java/com/fastaccess/provider/colors/ColorsProvider.java b/app/src/main/java/com/fastaccess/provider/colors/ColorsProvider.java deleted file mode 100644 index b11e0c19e..000000000 --- a/app/src/main/java/com/fastaccess/provider/colors/ColorsProvider.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.fastaccess.provider.colors; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.graphics.Color; -import androidx.annotation.ColorInt; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.annimon.stream.Collectors; -import com.annimon.stream.Stream; -import com.fastaccess.App; -import com.fastaccess.data.dao.LanguageColorModel; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.ui.widgets.color.ColorGenerator; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 27 May 2017, 9:50 PM - */ - -public class ColorsProvider { - - private static List POPULAR_LANG = Stream.of("Java", "Kotlin", "JavaScript", "Python", "CSS", "PHP", - "Ruby", "C++", "C", "Go", "Swift").toList();//predefined languages. - - private static Map colors = new LinkedHashMap<>(); - - @SuppressLint("CheckResult") public static void load() { - if (colors.isEmpty()) { - RxHelper.safeObservable(Observable - .create(observableEmitter -> { - try { - Type type = new TypeToken>() {}.getType(); - try (InputStream stream = App.getInstance().getAssets().open("colors.json")) { - Gson gson = new Gson(); - try (JsonReader reader = new JsonReader(new InputStreamReader(stream))) { - colors.putAll(gson.fromJson(reader, type)); - observableEmitter.onNext(""); - } - } - } catch (IOException e) { - e.printStackTrace(); - observableEmitter.onError(e); - } - observableEmitter.onComplete(); - })) - .subscribe(s -> {/**/}, Throwable::printStackTrace); - } - } - - @NonNull public static ArrayList languages() { - ArrayList lang = new ArrayList<>(); - lang.addAll(Stream.of(colors) - .filter(value -> value != null && !InputHelper.isEmpty(value.getKey())) - .map(Map.Entry::getKey) - .collect(Collectors.toCollection(ArrayList::new))); - lang.add(0, "All"); - lang.addAll(1, POPULAR_LANG); - return lang; - } - - @Nullable public static LanguageColorModel getColor(@NonNull String lang) { - return colors.get(lang); - } - - @ColorInt public static int getColorAsColor(@NonNull String lang, @NonNull Context context) { - LanguageColorModel color = getColor(lang); - int langColor = ColorGenerator.getColor(context, lang); - if (color != null && !InputHelper.isEmpty(color.getColor())) { - try {langColor = Color.parseColor(color.getColor());} catch (Exception ignored) {} - } - return langColor; - } -} diff --git a/app/src/main/java/com/fastaccess/provider/emoji/Emoji.java b/app/src/main/java/com/fastaccess/provider/emoji/Emoji.java deleted file mode 100644 index 8f46fdb8f..000000000 --- a/app/src/main/java/com/fastaccess/provider/emoji/Emoji.java +++ /dev/null @@ -1,217 +0,0 @@ -package com.fastaccess.provider.emoji; - -import java.io.UnsupportedEncodingException; -import java.util.Collections; -import java.util.List; -import java.util.Locale; - -/** - * This class represents an emoji.
- *
- * This object is immutable so it can be used safely in a multithreaded context. - * - * @author Vincent DURMONT [vdurmont@gmail.com] - */ -public class Emoji { - private final String description; - private final boolean supportsFitzpatrick; - private final List aliases; - private final List tags; - private String unicode; - private String htmlDec; - private String htmlHex; - - /** - * Constructor for the Emoji. - * - * @param description - * The description of the emoji - * @param supportsFitzpatrick - * Whether the emoji supports Fitzpatrick modifiers - * @param aliases - * the aliases for this emoji - * @param tags - * the tags associated with this emoji - * @param bytes - * the bytes that represent the emoji - */ - protected Emoji( - String description, - boolean supportsFitzpatrick, - List aliases, - List tags, - byte... bytes - ) { - this.description = description; - this.supportsFitzpatrick = supportsFitzpatrick; - this.aliases = Collections.unmodifiableList(aliases); - this.tags = Collections.unmodifiableList(tags); - - int count = 0; - try { - this.unicode = new String(bytes, "UTF-8"); - int stringLength = getUnicode().length(); - String[] pointCodes = new String[stringLength]; - String[] pointCodesHex = new String[stringLength]; - for (int offset = 0; offset < stringLength; ) { - final int codePoint = getUnicode().codePointAt(offset); - pointCodes[count] = String.format(Locale.getDefault(), "&#%d;", codePoint); - pointCodesHex[count++] = String.format("&#x%x;", codePoint); - offset += Character.charCount(codePoint); - } - this.htmlDec = stringJoin(pointCodes, count); - this.htmlHex = stringJoin(pointCodesHex, count); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - } - - /** - * Method to replace String.join, since it was only introduced in java8 - * - * @param array - * the array to be concatenated - * @return concatenated String - */ - private String stringJoin(String[] array, int count) { - String joined = ""; - for (int i = 0; i < count; i++) - joined += array[i]; - return joined; - } - - /** - * Returns the description of the emoji - * - * @return the description - */ - public String getDescription() { - return this.description; - } - - /** - * Returns wether the emoji supports the Fitzpatrick modifiers or not - * - * @return true if the emoji supports the Fitzpatrick modifiers - */ - public boolean supportsFitzpatrick() { - return this.supportsFitzpatrick; - } - - /** - * Returns the aliases of the emoji - * - * @return the aliases (unmodifiable) - */ - public List getAliases() { - return this.aliases; - } - - /** - * Returns the tags of the emoji - * - * @return the tags (unmodifiable) - */ - public List getTags() { - return this.tags; - } - - /** - * Returns the unicode representation of the emoji - * - * @return the unicode representation - */ - public String getUnicode() { - return this.unicode; - } - - /** - * Returns the unicode representation of the emoji associated with the - * provided Fitzpatrick modifier.
- * If the modifier is null, then the result is similar to - * {@link Emoji#getUnicode()} - * - * @param fitzpatrick - * the fitzpatrick modifier or null - * @return the unicode representation - * @throws UnsupportedOperationException - * if the emoji doesn't support the Fitzpatrick modifiers - */ - public String getUnicode(Fitzpatrick fitzpatrick) { - if (!this.supportsFitzpatrick()) { - throw new UnsupportedOperationException( - "Cannot get the unicode with a fitzpatrick modifier, " + - "the emoji doesn't support fitzpatrick." - ); - } else if (fitzpatrick == null) { - return this.getUnicode(); - } - return this.getUnicode() + fitzpatrick.unicode; - } - - /** - * Returns the HTML decimal representation of the emoji - * - * @return the HTML decimal representation - */ - public String getHtmlDecimal() { - return this.htmlDec; - } - - /** - * @return the HTML hexadecimal representation - * @deprecated identical to {@link #getHtmlHexadecimal()} for backwards-compatibility. Use that instead. - */ - public String getHtmlHexidecimal() { - return this.getHtmlHexadecimal(); - } - - /** - * Returns the HTML hexadecimal representation of the emoji - * - * @return the HTML hexadecimal representation - */ - public String getHtmlHexadecimal() { - return this.htmlHex; - } - - @Override - public boolean equals(Object other) { - return !(other == null || !(other instanceof Emoji)) && - ((Emoji) other).getUnicode().equals(getUnicode()); - } - - @Override - public int hashCode() { - return unicode.hashCode(); - } - - /** - * Returns the String representation of the Emoji object.
- *
- * Example:
- * Emoji { - * description='smiling face with open mouth and smiling eyes', - * supportsFitzpatrick=false, - * aliases=[smile], - * tags=[happy, joy, pleased], - * unicode='😄', - * htmlDec='&#128516;', - * htmlHex='&#x1f604;' - * } - * - * @return the string representation - */ - @Override - public String toString() { - return "Emoji{" + - "description='" + description + '\'' + - ", supportsFitzpatrick=" + supportsFitzpatrick + - ", aliases=" + aliases + - ", tags=" + tags + - ", unicode='" + unicode + '\'' + - ", htmlDec='" + htmlDec + '\'' + - ", htmlHex='" + htmlHex + '\'' + - '}'; - } -} diff --git a/app/src/main/java/com/fastaccess/provider/emoji/EmojiLoader.java b/app/src/main/java/com/fastaccess/provider/emoji/EmojiLoader.java deleted file mode 100644 index 5dd884dff..000000000 --- a/app/src/main/java/com/fastaccess/provider/emoji/EmojiLoader.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.fastaccess.provider.emoji; - -import org.json.JSONArray; -import org.json.JSONObject; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * Loads the emojis from a JSON database. - * - * @author Vincent DURMONT [vdurmont@gmail.com] - */ -class EmojiLoader { - private EmojiLoader() {} - - static List loadEmojis(InputStream stream) throws IOException { - try { - JSONArray emojisJSON = new JSONArray(inputStreamToString(stream)); - List emojis = new ArrayList(emojisJSON.length()); - for (int i = 0; i < emojisJSON.length(); i++) { - Emoji emoji = buildEmojiFromJSON(emojisJSON.getJSONObject(i)); - if (emoji != null) { - emojis.add(emoji); - } - } - return emojis; - } catch (Exception e) { - e.printStackTrace(); - } - return Collections.emptyList(); - } - - private static String inputStreamToString(InputStream stream) throws IOException { - StringBuilder sb = new StringBuilder(); - InputStreamReader isr = new InputStreamReader(stream, "UTF-8"); - BufferedReader br = new BufferedReader(isr); - String read; - while ((read = br.readLine()) != null) { - sb.append(read); - } - br.close(); - return sb.toString(); - } - - private static Emoji buildEmojiFromJSON(JSONObject json) throws Exception { - if (!json.has("emoji")) { - return null; - } - byte[] bytes = json.getString("emoji").getBytes("UTF-8"); - String description = null; - if (json.has("description")) { - description = json.getString("description"); - } - boolean supportsFitzpatrick = false; - if (json.has("supports_fitzpatrick")) { - supportsFitzpatrick = json.getBoolean("supports_fitzpatrick"); - } - List aliases = jsonArrayToStringList(json.getJSONArray("aliases")); - List tags = jsonArrayToStringList(json.getJSONArray("tags")); - return new Emoji(description, supportsFitzpatrick, aliases, tags, bytes); - } - - private static List jsonArrayToStringList(JSONArray array) { - List strings = new ArrayList(array.length()); - try { - for (int i = 0; i < array.length(); i++) { - strings.add(array.getString(i)); - } - } catch (Exception e) { - e.printStackTrace(); - } - return strings; - } -} diff --git a/app/src/main/java/com/fastaccess/provider/emoji/EmojiManager.java b/app/src/main/java/com/fastaccess/provider/emoji/EmojiManager.java deleted file mode 100644 index c8283bfc7..000000000 --- a/app/src/main/java/com/fastaccess/provider/emoji/EmojiManager.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.fastaccess.provider.emoji; - -import com.fastaccess.App; -import com.fastaccess.helper.RxHelper; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import io.reactivex.Observable; -import io.reactivex.schedulers.Schedulers; - -/** - * Holds the loaded emojis and provides search functions. - * - * @author Vincent DURMONT [vdurmont@gmail.com] - */ -public class EmojiManager { - private static final String PATH = "emojis.json"; - private static final Map EMOJIS_BY_ALIAS = new HashMap<>(); - private static final Map> EMOJIS_BY_TAG = new HashMap<>(); - private static List ALL_EMOJIS; - private static EmojiTrie EMOJI_TRIE; - - public static void load() { - RxHelper.safeObservable(Observable.fromCallable(() -> { - try { - InputStream stream = App.getInstance().getAssets().open(PATH); - List emojis = EmojiLoader.loadEmojis(stream); - ALL_EMOJIS = emojis; - for (Emoji emoji : emojis) { - for (String tag : emoji.getTags()) { - if (EMOJIS_BY_TAG.get(tag) == null) { - EMOJIS_BY_TAG.put(tag, new HashSet<>()); - } - EMOJIS_BY_TAG.get(tag).add(emoji); - } - for (String alias : emoji.getAliases()) { - EMOJIS_BY_ALIAS.put(alias, emoji); - } - } - EMOJI_TRIE = new EmojiTrie(emojis); - stream.close(); - } catch (IOException e) { - e.printStackTrace(); - } - return ""; - })).subscribeOn(Schedulers.io()).subscribe(); - } - - private EmojiManager() {} - - public static Set getForTag(String tag) { - if (tag == null) { - return null; - } - return EMOJIS_BY_TAG.get(tag); - } - - public static Emoji getForAlias(String alias) { - if (alias == null) { - return null; - } - return EMOJIS_BY_ALIAS.get(trimAlias(alias)); - } - - private static String trimAlias(String alias) { - String result = alias; - if (result.startsWith(":")) { - result = result.substring(1, result.length()); - } - if (result.endsWith(":")) { - result = result.substring(0, result.length() - 1); - } - return result; - } - - public static Emoji getByUnicode(String unicode) { - if (unicode == null) { - return null; - } - return EMOJI_TRIE.getEmoji(unicode); - } - - public static List getAll() { - return ALL_EMOJIS; - } - - public static boolean isEmoji(String string) { - return string != null && - EMOJI_TRIE.isEmoji(string.toCharArray()).exactMatch(); - } - - public static boolean isOnlyEmojis(String string) { - return string != null && EmojiParser.removeAllEmojis(string).isEmpty(); - } - - public static EmojiTrie.Matches isEmoji(char[] sequence) { - return EMOJI_TRIE.isEmoji(sequence); - } - - public static Collection getAllTags() { - return EMOJIS_BY_TAG.keySet(); - } -} diff --git a/app/src/main/java/com/fastaccess/provider/emoji/EmojiParser.java b/app/src/main/java/com/fastaccess/provider/emoji/EmojiParser.java deleted file mode 100644 index 934b0ef5f..000000000 --- a/app/src/main/java/com/fastaccess/provider/emoji/EmojiParser.java +++ /dev/null @@ -1,515 +0,0 @@ -package com.fastaccess.provider.emoji; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Provides methods to parse strings with emojis. - * - * @author Vincent DURMONT [vdurmont@gmail.com] - */ -public class EmojiParser { - private static final Pattern ALIAS_CANDIDATE_PATTERN = - Pattern.compile("(?<=:)\\+?(\\w|\\||\\-)+(?=:)"); - - /** - * See {@link #parseToAliases(String, FitzpatrickAction)} with the action - * "PARSE" - * - * @param input the string to parse - * - * @return the string with the emojis replaced by their alias. - */ - public static String parseToAliases(String input) { - return parseToAliases(input, FitzpatrickAction.PARSE); - } - - /** - * Replaces the emoji's unicode occurrences by one of their alias - * (between 2 ':').
- * Example: 😄 will be replaced by :smile:
- *
- * When a fitzpatrick modifier is present with a PARSE action, a "|" will be - * appendend to the alias, with the fitzpatrick type.
- * Example: 👦🏿 will be replaced by - * :boy|type_6:
- * The fitzpatrick types are: type_1_2, type_3, type_4, type_5, type_6
- *
- * When a fitzpatrick modifier is present with a REMOVE action, the modifier - * will be deleted.
- * Example: 👦🏿 will be replaced by :boy:
- *
- * When a fitzpatrick modifier is present with a IGNORE action, the modifier - * will be ignored.
- * Example: 👦🏿 will be replaced by :boy:🏿
- * - * @param input the string to parse - * @param fitzpatrickAction the action to apply for the fitzpatrick modifiers - * - * @return the string with the emojis replaced by their alias. - */ - private static String parseToAliases( - String input, - final FitzpatrickAction fitzpatrickAction - ) { - EmojiTransformer emojiTransformer = unicodeCandidate -> { - switch (fitzpatrickAction) { - default: - case PARSE: - if (unicodeCandidate.hasFitzpatrick()) { - return ":" + - unicodeCandidate.getEmoji().getAliases().get(0) + - "|" + - unicodeCandidate.getFitzpatrickType() + - ":"; - } - case REMOVE: - return ":" + - unicodeCandidate.getEmoji().getAliases().get(0) + - ":"; - case IGNORE: - return ":" + - unicodeCandidate.getEmoji().getAliases().get(0) + - ":" + - unicodeCandidate.getFitzpatrickUnicode(); - } - }; - - return parseFromUnicode(input, emojiTransformer); - } - - - /** - * Replaces the emoji's aliases (between 2 ':') occurrences and the html - * representations by their unicode.
- * Examples:
- * :smile: will be replaced by 😄
- * &#128516; will be replaced by 😄
- * :boy|type_6: will be replaced by 👦🏿 - * - * @param input the string to parse - * - * @return the string with the aliases and html representations replaced by - * their unicode. - */ - public static String parseToUnicode(String input) { - // Get all the potential aliases - List candidates = getAliasCandidates(input); - - // Replace the aliases by their unicode - String result = input; - for (AliasCandidate candidate : candidates) { - Emoji emoji = EmojiManager.getForAlias(candidate.alias); - if (emoji != null) { - if ( - emoji.supportsFitzpatrick() || - (!emoji.supportsFitzpatrick() && candidate.fitzpatrick == null) - ) { - String replacement = emoji.getUnicode(); - if (candidate.fitzpatrick != null) { - replacement += candidate.fitzpatrick.unicode; - } - result = result.replace( - ":" + candidate.fullString + ":", - replacement - ); - } - } - } - - // Replace the html - for (Emoji emoji : EmojiManager.getAll()) { - result = result.replace(emoji.getHtmlHexadecimal(), emoji.getUnicode()); - result = result.replace(emoji.getHtmlDecimal(), emoji.getUnicode()); - } - - return result; - } - - private static List getAliasCandidates(String input) { - List candidates = new ArrayList(); - - Matcher matcher = ALIAS_CANDIDATE_PATTERN.matcher(input); - matcher = matcher.useTransparentBounds(true); - while (matcher.find()) { - String match = matcher.group(); - if (!match.contains("|")) { - candidates.add(new AliasCandidate(match, match, null)); - } else { - String[] splitted = match.split("\\|"); - if (splitted.length == 2 || splitted.length > 2) { - candidates.add(new AliasCandidate(match, splitted[0], splitted[1])); - } else { - candidates.add(new AliasCandidate(match, match, null)); - } - } - } - return candidates; - } - - /** - * See {@link #parseToHtmlDecimal(String, FitzpatrickAction)} with the action - * "PARSE" - * - * @param input the string to parse - * - * @return the string with the emojis replaced by their html decimal - * representation. - */ - public static String parseToHtmlDecimal(String input) { - return parseToHtmlDecimal(input, FitzpatrickAction.PARSE); - } - - /** - * Replaces the emoji's unicode occurrences by their html representation.
- * Example: 😄 will be replaced by &#128516;
- *
- * When a fitzpatrick modifier is present with a PARSE or REMOVE action, the - * modifier will be deleted from the string.
- * Example: 👦🏿 will be replaced by - * &#128102;
- *
- * When a fitzpatrick modifier is present with a IGNORE action, the modifier - * will be ignored and will remain in the string.
- * Example: 👦🏿 will be replaced by - * &#128102;🏿 - * - * @param input the string to parse - * @param fitzpatrickAction the action to apply for the fitzpatrick modifiers - * - * @return the string with the emojis replaced by their html decimal - * representation. - */ - private static String parseToHtmlDecimal( - String input, - final FitzpatrickAction fitzpatrickAction - ) { - EmojiTransformer emojiTransformer = unicodeCandidate -> { - switch (fitzpatrickAction) { - default: - case PARSE: - case REMOVE: - return unicodeCandidate.getEmoji().getHtmlDecimal(); - case IGNORE: - return unicodeCandidate.getEmoji().getHtmlDecimal() + - unicodeCandidate.getFitzpatrickUnicode(); - } - }; - - return parseFromUnicode(input, emojiTransformer); - } - - /** - * See {@link #parseToHtmlHexadecimal(String, FitzpatrickAction)} with the - * action "PARSE" - * - * @param input the string to parse - * - * @return the string with the emojis replaced by their html hex - * representation. - */ - public static String parseToHtmlHexadecimal(String input) { - return parseToHtmlHexadecimal(input, FitzpatrickAction.PARSE); - } - - /** - * Replaces the emoji's unicode occurrences by their html hex - * representation.
- * Example: 👦 will be replaced by &#x1f466;
- *
- * When a fitzpatrick modifier is present with a PARSE or REMOVE action, the - * modifier will be deleted.
- * Example: 👦🏿 will be replaced by - * &#x1f466;
- *
- * When a fitzpatrick modifier is present with a IGNORE action, the modifier - * will be ignored and will remain in the string.
- * Example: 👦🏿 will be replaced by - * &#x1f466;🏿 - * - * @param input the string to parse - * @param fitzpatrickAction the action to apply for the fitzpatrick modifiers - * - * @return the string with the emojis replaced by their html hex - * representation. - */ - private static String parseToHtmlHexadecimal( - String input, - final FitzpatrickAction fitzpatrickAction - ) { - EmojiTransformer emojiTransformer = unicodeCandidate -> { - switch (fitzpatrickAction) { - default: - case PARSE: - case REMOVE: - return unicodeCandidate.getEmoji().getHtmlHexadecimal(); - case IGNORE: - return unicodeCandidate.getEmoji().getHtmlHexadecimal() + - unicodeCandidate.getFitzpatrickUnicode(); - } - }; - - return parseFromUnicode(input, emojiTransformer); - } - - /** - * Removes all emojis from a String - * - * @param str the string to process - * - * @return the string without any emoji - */ - public static String removeAllEmojis(String str) { - EmojiTransformer emojiTransformer = unicodeCandidate -> ""; - - return parseFromUnicode(str, emojiTransformer); - } - - - /** - * Removes a set of emojis from a String - * - * @param str the string to process - * @param emojisToRemove the emojis to remove from this string - * - * @return the string without the emojis that were removed - */ - public static String removeEmojis( - String str, - final Collection emojisToRemove - ) { - EmojiTransformer emojiTransformer = unicodeCandidate -> { - if (!emojisToRemove.contains(unicodeCandidate.getEmoji())) { - return unicodeCandidate.getEmoji().getUnicode() + - unicodeCandidate.getFitzpatrickUnicode(); - } - return ""; - }; - - return parseFromUnicode(str, emojiTransformer); - } - - /** - * Removes all the emojis in a String except a provided set - * - * @param str the string to process - * @param emojisToKeep the emojis to keep in this string - * - * @return the string without the emojis that were removed - */ - public static String removeAllEmojisExcept( - String str, - final Collection emojisToKeep - ) { - EmojiTransformer emojiTransformer = unicodeCandidate -> { - if (emojisToKeep.contains(unicodeCandidate.getEmoji())) { - return unicodeCandidate.getEmoji().getUnicode() + - unicodeCandidate.getFitzpatrickUnicode(); - } - return ""; - }; - - return parseFromUnicode(str, emojiTransformer); - } - - - /** - * Detects all unicode emojis in input string and replaces them with the - * return value of transformer.transform() - * - * @param input the string to process - * @param transformer emoji transformer to apply to each emoji - * - * @return input string with all emojis transformed - */ - private static String parseFromUnicode( - String input, - EmojiTransformer transformer - ) { - int prev = 0; - StringBuilder sb = new StringBuilder(); - List replacements = getUnicodeCandidates(input); - for (UnicodeCandidate candidate : replacements) { - sb.append(input.substring(prev, candidate.getEmojiStartIndex())); - - sb.append(transformer.transform(candidate)); - prev = candidate.getFitzpatrickEndIndex(); - } - - return sb.append(input.substring(prev)).toString(); - } - - public static List extractEmojis(String input) { - List emojis = getUnicodeCandidates(input); - List result = new ArrayList(); - for (UnicodeCandidate emoji : emojis) { - result.add(emoji.getEmoji().getUnicode()); - } - return result; - } - - - /** - * Generates a list UnicodeCandidates found in input string. A - * UnicodeCandidate is created for every unicode emoticon found in input - * string, additionally if Fitzpatrick modifier follows the emoji, it is - * included in UnicodeCandidate. Finally, it contains start and end index of - * unicode emoji itself (WITHOUT Fitzpatrick modifier whether it is there or - * not!). - * - * @param input String to find all unicode emojis in - * @return List of UnicodeCandidates for each unicode emote in text - */ - private static List getUnicodeCandidates(String input) { - char[] inputCharArray = input.toCharArray(); - List candidates = new ArrayList(); - for (int i = 0; i < input.length(); i++) { - int emojiEnd = getEmojiEndPos(inputCharArray, i); - - if (emojiEnd != -1) { - Emoji emoji = EmojiManager.getByUnicode(input.substring(i, emojiEnd)); - String fitzpatrickString = (emojiEnd + 2 <= input.length()) ? - new String(inputCharArray, emojiEnd, 2) : - null; - UnicodeCandidate candidate = new UnicodeCandidate( - emoji, - fitzpatrickString, - i - ); - candidates.add(candidate); - i = candidate.getFitzpatrickEndIndex() - 1; - } - } - - return candidates; - } - - - /** - * Returns end index of a unicode emoji if it is found in text starting at - * index startPos, -1 if not found. - * This returns the longest matching emoji, for example, in - * "\uD83D\uDC68\u200D\uD83D\uDC69\u200D\uD83D\uDC66" - * it will find alias:family_man_woman_boy, NOT alias:man - * - * @param text the current text where we are looking for an emoji - * @param startPos the position in the text where we should start looking for - * an emoji end - * - * @return the end index of the unicode emoji starting at startPos. -1 if not - * found - */ - private static int getEmojiEndPos(char[] text, int startPos) { - int best = -1; - for (int j = startPos + 1; j <= text.length; j++) { - EmojiTrie.Matches status = EmojiManager.isEmoji(Arrays.copyOfRange( - text, - startPos, - j - )); - - if (status.exactMatch()) { - best = j; - } else if (status.impossibleMatch()) { - return best; - } - } - - return best; - } - - - public static class UnicodeCandidate { - private final Emoji emoji; - private final Fitzpatrick fitzpatrick; - private final int startIndex; - - private UnicodeCandidate(Emoji emoji, String fitzpatrick, int startIndex) { - this.emoji = emoji; - this.fitzpatrick = Fitzpatrick.fitzpatrickFromUnicode(fitzpatrick); - this.startIndex = startIndex; - } - - public Emoji getEmoji() { - return emoji; - } - - public boolean hasFitzpatrick() { - return getFitzpatrick() != null; - } - - public Fitzpatrick getFitzpatrick() { - return fitzpatrick; - } - - public String getFitzpatrickType() { - return hasFitzpatrick() ? fitzpatrick.name().toLowerCase() : ""; - } - - public String getFitzpatrickUnicode() { - return hasFitzpatrick() ? fitzpatrick.unicode : ""; - } - - public int getEmojiStartIndex() { - return startIndex; - } - - public int getEmojiEndIndex() { - return startIndex + emoji.getUnicode().length(); - } - - public int getFitzpatrickEndIndex() { - return getEmojiEndIndex() + (fitzpatrick != null ? 2 : 0); - } - } - - - static class AliasCandidate { - public final String fullString; - public final String alias; - public final Fitzpatrick fitzpatrick; - - private AliasCandidate( - String fullString, - String alias, - String fitzpatrickString - ) { - this.fullString = fullString; - this.alias = alias; - if (fitzpatrickString == null) { - this.fitzpatrick = null; - } else { - this.fitzpatrick = Fitzpatrick.fitzpatrickFromType(fitzpatrickString); - } - } - } - - /** - * Enum used to indicate what should be done when a Fitzpatrick modifier is - * found. - */ - public enum FitzpatrickAction { - /** - * Tries to match the Fitzpatrick modifier with the previous emoji - */ - PARSE, - - /** - * Removes the Fitzpatrick modifier from the string - */ - REMOVE, - - /** - * Ignores the Fitzpatrick modifier (it will stay in the string) - */ - IGNORE - } - - public interface EmojiTransformer { - String transform(UnicodeCandidate unicodeCandidate); - } -} diff --git a/app/src/main/java/com/fastaccess/provider/emoji/EmojiTrie.java b/app/src/main/java/com/fastaccess/provider/emoji/EmojiTrie.java deleted file mode 100644 index 29741953e..000000000 --- a/app/src/main/java/com/fastaccess/provider/emoji/EmojiTrie.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.fastaccess.provider.emoji; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -public class EmojiTrie { - private Node root = new Node(); - - public EmojiTrie(Collection emojis) { - for (Emoji emoji : emojis) { - Node tree = root; - for (char c : emoji.getUnicode().toCharArray()) { - if (!tree.hasChild(c)) { - tree.addChild(c); - } - tree = tree.getChild(c); - } - tree.setEmoji(emoji); - } - } - - - /** - * Checks if sequence of chars contain an emoji. - * - * @param sequence - * Sequence of char that may contain emoji in full or partially. - * @return <li> Matches.EXACTLY if char sequence in its entirety is an emoji </li> <li> Matches.POSSIBLY if char sequence - * matches prefix of an emoji </li> <li> Matches.IMPOSSIBLE if char sequence matches no emoji or prefix of an emoji </li> - */ - public Matches isEmoji(char[] sequence) { - if (sequence == null) { - return Matches.POSSIBLY; - } - - Node tree = root; - for (char c : sequence) { - if (!tree.hasChild(c)) { - return Matches.IMPOSSIBLE; - } - tree = tree.getChild(c); - } - - return tree.isEndOfEmoji() ? Matches.EXACTLY : Matches.POSSIBLY; - } - - - /** - * Finds Emoji instance from emoji unicode - * - * @param unicode - * unicode of emoji to get - * @return Emoji instance if unicode matches and emoji, null otherwise. - */ - public Emoji getEmoji(String unicode) { - Node tree = root; - for (char c : unicode.toCharArray()) { - if (!tree.hasChild(c)) { - return null; - } - tree = tree.getChild(c); - } - return tree.getEmoji(); - } - - public enum Matches { - EXACTLY, POSSIBLY, IMPOSSIBLE; - - public boolean exactMatch() { - return this == EXACTLY; - } - - public boolean impossibleMatch() { - return this == IMPOSSIBLE; - } - - public boolean possibleMatch() { - return this == POSSIBLY; - } - } - - private class Node { - private Map children = new HashMap(); - private Emoji emoji; - - private void setEmoji(Emoji emoji) { - this.emoji = emoji; - } - - private Emoji getEmoji() { - return emoji; - } - - private boolean hasChild(char child) { - return children.containsKey(child); - } - - private void addChild(char child) { - children.put(child, new Node()); - } - - private Node getChild(char child) { - return children.get(child); - } - - private boolean isEndOfEmoji() { - return emoji != null; - } - } -} diff --git a/app/src/main/java/com/fastaccess/provider/emoji/Fitzpatrick.java b/app/src/main/java/com/fastaccess/provider/emoji/Fitzpatrick.java deleted file mode 100644 index 484bcdb3c..000000000 --- a/app/src/main/java/com/fastaccess/provider/emoji/Fitzpatrick.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.fastaccess.provider.emoji; - -/** - * Enum that represents the Fitzpatrick modifiers supported by the emojis. - */ -public enum Fitzpatrick { - /** - * Fitzpatrick modifier of type 1/2 (pale white/white) - */ - TYPE_1_2("\uD83C\uDFFB"), - - /** - * Fitzpatrick modifier of type 3 (cream white) - */ - TYPE_3("\uD83C\uDFFC"), - - /** - * Fitzpatrick modifier of type 4 (moderate brown) - */ - TYPE_4("\uD83C\uDFFD"), - - /** - * Fitzpatrick modifier of type 5 (dark brown) - */ - TYPE_5("\uD83C\uDFFE"), - - /** - * Fitzpatrick modifier of type 6 (black) - */ - TYPE_6("\uD83C\uDFFF"); - - /** - * The unicode representation of the Fitzpatrick modifier - */ - public final String unicode; - - Fitzpatrick(String unicode) { - this.unicode = unicode; - } - - - public static Fitzpatrick fitzpatrickFromUnicode(String unicode) { - for (Fitzpatrick v : values()) { - if (v.unicode.equals(unicode)) { - return v; - } - } - return null; - } - - public static Fitzpatrick fitzpatrickFromType(String type) { - try { - return Fitzpatrick.valueOf(type.toUpperCase()); - } catch (IllegalArgumentException e) { - return null; - } - } -} diff --git a/app/src/main/java/com/fastaccess/provider/fabric/FabricProvider.kt b/app/src/main/java/com/fastaccess/provider/fabric/FabricProvider.kt deleted file mode 100644 index 5e5faa940..000000000 --- a/app/src/main/java/com/fastaccess/provider/fabric/FabricProvider.kt +++ /dev/null @@ -1,44 +0,0 @@ -package com.fastaccess.provider.fabric - -import android.content.Context -import com.crashlytics.android.Crashlytics -import com.crashlytics.android.answers.Answers -import com.crashlytics.android.answers.PurchaseEvent -import com.crashlytics.android.core.CrashlyticsCore -import com.fastaccess.BuildConfig -import io.fabric.sdk.android.Fabric -import java.math.BigDecimal -import java.math.RoundingMode - -/** - * Created by kosh on 14/08/2017. - */ - -object FabricProvider { - - fun initFabric(context: Context) { - val fabric = Fabric.Builder(context) - .kits( - Crashlytics.Builder() - .core(CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()) - .build() - ) - .debuggable(BuildConfig.DEBUG) - .build() - Fabric.with(fabric) - } - - fun logPurchase(productKey: String?, price: Long? = null, priceText: String? = null) { - val purchaseEvent = PurchaseEvent() - .putItemName(productKey) - .putSuccess(true) - - priceText?.let { - purchaseEvent.putItemType(priceText) - } - price?.let { - purchaseEvent.putItemPrice(BigDecimal(price).setScale(2, RoundingMode.CEILING)) - } - Answers.getInstance().logPurchase(purchaseEvent) - } -} diff --git a/app/src/main/java/com/fastaccess/provider/fcm/PushNotificationService.java b/app/src/main/java/com/fastaccess/provider/fcm/PushNotificationService.java deleted file mode 100644 index b6dcfd933..000000000 --- a/app/src/main/java/com/fastaccess/provider/fcm/PushNotificationService.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.fastaccess.provider.fcm; - -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.Context; -import android.content.Intent; -import androidx.core.app.NotificationCompat; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.FastHubNotification; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.modules.main.MainActivity; -import com.google.firebase.messaging.FirebaseMessagingService; -import com.google.firebase.messaging.RemoteMessage; - -import org.json.JSONObject; - -import java.util.Date; - -/** - * Created by Kosh on 16 Apr 2017, 1:17 PM - */ - -public class PushNotificationService extends FirebaseMessagingService { - - @Override public void onMessageReceived(RemoteMessage remoteMessage) { - super.onMessageReceived(remoteMessage); - if (remoteMessage != null) { - if (remoteMessage.getData() != null && !remoteMessage.getData().isEmpty()) { - Date date = new Date(remoteMessage.getSentTime()); - FastHubNotification fastHubNotification = RestProvider.gson - .fromJson(new JSONObject(remoteMessage.getData()).toString(), FastHubNotification.class); - fastHubNotification.setDate(date); - FastHubNotification.save(fastHubNotification); - } else if (remoteMessage.getNotification() != null) { - String title = remoteMessage.getNotification().getTitle(); - String body = remoteMessage.getNotification().getBody(); - if (remoteMessage.getData() != null && !remoteMessage.getData().isEmpty()) { - title = title == null ? remoteMessage.getData().get("title") : title; - body = body == null ? remoteMessage.getData().get("message") : body; - } - Intent intent = new Intent(this, MainActivity.class); - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT); - NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, "In App-Notifications") - .setSmallIcon(R.drawable.ic_notification) - .setContentTitle(title) - .setContentText(body) - .setAutoCancel(true) - .setContentIntent(pendingIntent); - NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - if (notificationManager != null) { - notificationManager.notify(1, notificationBuilder.build()); - } - } - } - } -} diff --git a/app/src/main/java/com/fastaccess/provider/gson/ToGsonProvider.java b/app/src/main/java/com/fastaccess/provider/gson/ToGsonProvider.java deleted file mode 100644 index e3cafe285..000000000 --- a/app/src/main/java/com/fastaccess/provider/gson/ToGsonProvider.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.fastaccess.provider.gson; - -import android.content.Context; -import androidx.annotation.NonNull; - -import com.fastaccess.R; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 26 Mar 2017, 10:07 PM - */ - -public class ToGsonProvider { - - public static Observable getChangelog(@NonNull Context context) { - return Observable.fromCallable(() -> { - try (InputStream is = context.getResources().openRawResource(R.raw.changelog)) { - try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream()) { - byte[] buffer = new byte[is.available()]; - int read = is.read(buffer);//ignore lint - byteStream.write(buffer); - return byteStream.toString(); - } catch (IOException e) { - e.printStackTrace(); - } - } - return null; - }); - } -} diff --git a/app/src/main/java/com/fastaccess/provider/markdown/CachedComments.kt b/app/src/main/java/com/fastaccess/provider/markdown/CachedComments.kt deleted file mode 100644 index 87a90ee19..000000000 --- a/app/src/main/java/com/fastaccess/provider/markdown/CachedComments.kt +++ /dev/null @@ -1,29 +0,0 @@ -package com.fastaccess.provider.markdown - -import java.util.* - -/** - * Created by kosh on 11/08/2017. - */ -class CachedComments private constructor() { - - val map = WeakHashMap() - - fun put(repo: String?, login: String?, number: Any?, comment: CharSequence) { - map.put("$repo/$login/$number", comment) - } - - fun get(repo: String?, login: String?, number: Any?): CharSequence? { - return map["$repo/$login/$number"] - } - - fun clear() = map.clear() - - private object Holder { - val INSTANCE = CachedComments() - } - - companion object { - val instance: CachedComments by lazy { Holder.INSTANCE } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/provider/markdown/MarkDownProvider.java b/app/src/main/java/com/fastaccess/provider/markdown/MarkDownProvider.java deleted file mode 100644 index b98e6e44a..000000000 --- a/app/src/main/java/com/fastaccess/provider/markdown/MarkDownProvider.java +++ /dev/null @@ -1,339 +0,0 @@ -package com.fastaccess.provider.markdown; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.text.Html; -import android.view.ViewTreeObserver; -import android.webkit.MimeTypeMap; -import android.widget.EditText; -import android.widget.TextView; - -import com.annimon.stream.IntStream; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.Logger; -import com.fastaccess.provider.markdown.extension.emoji.EmojiExtension; -import com.fastaccess.provider.markdown.extension.mention.MentionExtension; -import com.fastaccess.provider.timeline.HtmlHelper; - -import org.commonmark.Extension; -import org.commonmark.ext.autolink.AutolinkExtension; -import org.commonmark.ext.front.matter.YamlFrontMatterExtension; -import org.commonmark.ext.gfm.strikethrough.StrikethroughExtension; -import org.commonmark.ext.gfm.tables.TablesExtension; -import org.commonmark.ext.ins.InsExtension; -import org.commonmark.node.Node; -import org.commonmark.parser.Parser; -import org.commonmark.renderer.html.HtmlRenderer; - -import java.util.Arrays; -import java.util.List; - -/** - * Created by Kosh on 24 Nov 2016, 7:43 PM - */ - -public class MarkDownProvider { - - private static final String[] IMAGE_EXTENSIONS = {".png", ".jpg", ".jpeg", ".gif", ".svg"}; - - private static final String[] MARKDOWN_EXTENSIONS = { - ".md", ".mkdn", ".mdwn", ".mdown", ".markdown", ".mkd", ".mkdown", ".ron", ".rst", "adoc" - }; - - private static final String[] ARCHIVE_EXTENSIONS = { - ".zip", ".7z", ".rar", ".tar.gz", ".tgz", ".tar.Z", ".tar.bz2", ".tbz2", ".tar.lzma", ".tlz", ".apk", ".jar", - ".dmg", ".pdf", ".ico", ".docx", ".doc", ".xlsx", ".hwp", ".pptx", ".show", ".mp3", ".ogg", ".ipynb" - }; - - private MarkDownProvider() {} - - public static void setMdText(@NonNull TextView textView, String markdown) { - if (!InputHelper.isEmpty(markdown)) { - int width = textView.getMeasuredWidth(); - if (width > 0) { - render(textView, markdown, width); - } else { - textView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { - @Override public boolean onPreDraw() { - textView.getViewTreeObserver().removeOnPreDrawListener(this); - render(textView, markdown, textView.getMeasuredWidth()); - return true; - } - }); - } - } - } - - public static void setMdText(@NonNull TextView textView, String markdown, int width) { - if (!InputHelper.isEmpty(markdown)) { - render(textView, markdown, width); - } - } - - protected static void render(@NonNull TextView textView, String markdown, int width) { - List extensions = Arrays.asList( - StrikethroughExtension.create(), - AutolinkExtension.create(), - TablesExtension.create(), - InsExtension.create(), - EmojiExtension.create(), - MentionExtension.create(), - YamlFrontMatterExtension.create()); - Parser parser = Parser.builder() - .extensions(extensions) - .build(); - try { - Node node = parser.parse(markdown); - String rendered = HtmlRenderer - .builder() - .extensions(extensions) - .build() - .render(node); - HtmlHelper.htmlIntoTextView(textView, rendered, (width - (textView.getPaddingStart() + textView.getPaddingEnd()))); - } catch (Exception ignored) { - HtmlHelper.htmlIntoTextView(textView, markdown, (width - (textView.getPaddingStart() + textView.getPaddingEnd()))); - } - } - - public static void stripMdText(@NonNull TextView textView, String markdown) { - if (!InputHelper.isEmpty(markdown)) { - Parser parser = Parser.builder().build(); - Node node = parser.parse(markdown); - textView.setText(stripHtml(HtmlRenderer.builder().build().render(node))); - } - } - - @NonNull public static String stripMdText(String markdown) { - if (!InputHelper.isEmpty(markdown)) { - Parser parser = Parser.builder().build(); - Node node = parser.parse(markdown); - return stripHtml(HtmlRenderer.builder().build().render(node)); - } - return ""; - } - - public static String stripHtml(String html) { - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { - return Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY).toString(); - } else { - return Html.fromHtml(html).toString(); - } - } - - public static void addList(@NonNull EditText editText, @NonNull String list) { - String tag = list + " "; - String source = editText.getText().toString(); - int selectionStart = editText.getSelectionStart(); - int selectionEnd = editText.getSelectionEnd(); - String substring = source.substring(0, selectionStart); - int line = substring.lastIndexOf(10); - if (line != -1) { - selectionStart = line + 1; - } else { - selectionStart = 0; - } - substring = source.substring(selectionStart, selectionEnd); - String[] split = substring.split("\n"); - StringBuilder stringBuffer = new StringBuilder(); - if (split.length > 0) - for (String s : split) { - if (s.length() == 0 && stringBuffer.length() != 0) { - stringBuffer.append("\n"); - continue; - } - if (!s.trim().startsWith(tag)) { - if (stringBuffer.length() > 0) stringBuffer.append("\n"); - stringBuffer.append(tag).append(s); - } else { - if (stringBuffer.length() > 0) stringBuffer.append("\n"); - stringBuffer.append(s); - } - } - - if (stringBuffer.length() == 0) { - stringBuffer.append(tag); - } - editText.getText().replace(selectionStart, selectionEnd, stringBuffer.toString()); - editText.setSelection(stringBuffer.length() + selectionStart); - } - - public static void addHeader(@NonNull EditText editText, int level) { - String source = editText.getText().toString(); - int selectionStart = editText.getSelectionStart(); - int selectionEnd = editText.getSelectionEnd(); - StringBuilder result = new StringBuilder(); - String substring = source.substring(selectionStart, selectionEnd); - if (!hasNewLine(source, selectionStart)) - result.append("\n"); - IntStream.range(0, level).forEach(integer -> result.append("#")); - result.append(" ").append(substring); - editText.getText().replace(selectionStart, selectionEnd, result.toString()); - editText.setSelection(selectionStart + result.length()); - - } - - public static void addItalic(@NonNull EditText editText) { - String source = editText.getText().toString(); - int selectionStart = editText.getSelectionStart(); - int selectionEnd = editText.getSelectionEnd(); - String substring = source.substring(selectionStart, selectionEnd); - String result = "_" + substring + "_ "; - editText.getText().replace(selectionStart, selectionEnd, result); - editText.setSelection(result.length() + selectionStart - 2); - - } - - public static void addBold(@NonNull EditText editText) { - String source = editText.getText().toString(); - int selectionStart = editText.getSelectionStart(); - int selectionEnd = editText.getSelectionEnd(); - String substring = source.substring(selectionStart, selectionEnd); - String result = "**" + substring + "** "; - editText.getText().replace(selectionStart, selectionEnd, result); - editText.setSelection(result.length() + selectionStart - 3); - - } - - public static void addCode(@NonNull EditText editText) { - try { - String source = editText.getText().toString(); - int selectionStart = editText.getSelectionStart(); - int selectionEnd = editText.getSelectionEnd(); - String substring = source.substring(selectionStart, selectionEnd); - String result; - if (hasNewLine(source, selectionStart)) - result = "```\n" + substring + "\n```\n"; - else - result = "\n```\n" + substring + "\n```\n"; - - editText.getText().replace(selectionStart, selectionEnd, result); - editText.setSelection(result.length() + selectionStart - 5); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void addInlinleCode(@NonNull EditText editText) { - String source = editText.getText().toString(); - int selectionStart = editText.getSelectionStart(); - int selectionEnd = editText.getSelectionEnd(); - String substring = source.substring(selectionStart, selectionEnd); - String result = "`" + substring + "` "; - editText.getText().replace(selectionStart, selectionEnd, result); - editText.setSelection(result.length() + selectionStart - 2); - - } - - public static void addStrikeThrough(@NonNull EditText editText) { - String source = editText.getText().toString(); - int selectionStart = editText.getSelectionStart(); - int selectionEnd = editText.getSelectionEnd(); - String substring = source.substring(selectionStart, selectionEnd); - String result = "~~" + substring + "~~ "; - editText.getText().replace(selectionStart, selectionEnd, result); - editText.setSelection(result.length() + selectionStart - 3); - - } - - public static void addQuote(@NonNull EditText editText) { - String source = editText.getText().toString(); - int selectionStart = editText.getSelectionStart(); - int selectionEnd = editText.getSelectionEnd(); - String substring = source.substring(selectionStart, selectionEnd); - String result; - if (hasNewLine(source, selectionStart)) { - result = "> " + substring; - } else { - result = "\n> " + substring; - - } - editText.getText().replace(selectionStart, selectionEnd, result); - editText.setSelection(result.length() + selectionStart); - - } - - public static void addDivider(@NonNull EditText editText) { - String source = editText.getText().toString(); - int selectionStart = editText.getSelectionStart(); - String result; - if (hasNewLine(source, selectionStart)) { - result = "-------\n"; - } else { - result = "\n-------\n"; - } - editText.getText().replace(selectionStart, selectionStart, result); - editText.setSelection(result.length() + selectionStart); - - } - - public static void addPhoto(@NonNull EditText editText, @NonNull String title, @NonNull String link) { - String result = "![" + InputHelper.toString(title) + "](" + InputHelper.toString(link) + ")"; - insertAtCursor(editText, result); - } - - public static void addLink(@NonNull EditText editText, @NonNull String title, @NonNull String link) { - String result = "[" + InputHelper.toString(title) + "](" + InputHelper.toString(link) + ")"; - insertAtCursor(editText, result); - } - - private static boolean hasNewLine(@NonNull String source, int selectionStart) { - try { - if (source.isEmpty()) return true; - source = source.substring(0, selectionStart); - return source.charAt(source.length() - 1) == 10; - } catch (StringIndexOutOfBoundsException e) { - return false; - } - } - - public static boolean isImage(@Nullable String name) { - if (InputHelper.isEmpty(name)) return false; - name = name.toLowerCase(); - for (String value : IMAGE_EXTENSIONS) { - String extension = MimeTypeMap.getFileExtensionFromUrl(name); - if ((extension != null && value.replace(".", "").equals(extension)) || name.endsWith(value)) return true; - } - return false; - } - - public static boolean isMarkdown(@Nullable String name) { - if (InputHelper.isEmpty(name)) return false; - name = name.toLowerCase(); - for (String value : MARKDOWN_EXTENSIONS) { - String extension = MimeTypeMap.getFileExtensionFromUrl(name); - if ((extension != null && value.replace(".", "").equals(extension)) || - name.equalsIgnoreCase("README") || name.endsWith(value)) - return true; - } - return false; - } - - public static boolean isArchive(@Nullable String name) { - if (InputHelper.isEmpty(name)) return false; - name = name.toLowerCase(); - for (String value : ARCHIVE_EXTENSIONS) { - String extension = MimeTypeMap.getFileExtensionFromUrl(name); - if ((extension != null && value.replace(".", "").equals(extension)) || name.endsWith(value)) return true; - } - - return false; - } - - public static void insertAtCursor(@NonNull EditText editText, @NonNull String text) { - String oriContent = editText.getText().toString(); - int start = editText.getSelectionStart(); - int end = editText.getSelectionEnd(); - Logger.e(start, end); - if (start >= 0 && end > 0 && start != end) { - editText.setText(editText.getText().replace(start, end, text)); - } else { - int index = editText.getSelectionStart() >= 0 ? editText.getSelectionStart() : 0; - Logger.e(start, end, index); - StringBuilder builder = new StringBuilder(oriContent); - builder.insert(index, text); - editText.setText(builder.toString()); - editText.setSelection(index + text.length()); - } - } -} diff --git a/app/src/main/java/com/fastaccess/provider/markdown/extension/emoji/Emoji.java b/app/src/main/java/com/fastaccess/provider/markdown/extension/emoji/Emoji.java deleted file mode 100644 index 7af55f486..000000000 --- a/app/src/main/java/com/fastaccess/provider/markdown/extension/emoji/Emoji.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.fastaccess.provider.markdown.extension.emoji; - -import org.commonmark.node.CustomNode; -import org.commonmark.node.Delimited; - -/** - * Created by kosh on 20/08/2017. - */ - -public class Emoji extends CustomNode implements Delimited { - - private static final String DELIMITER = ":"; - - @Override public String getOpeningDelimiter() { - return DELIMITER; - } - - @Override public String getClosingDelimiter() { - return DELIMITER; - } -} diff --git a/app/src/main/java/com/fastaccess/provider/markdown/extension/emoji/EmojiExtension.java b/app/src/main/java/com/fastaccess/provider/markdown/extension/emoji/EmojiExtension.java deleted file mode 100644 index 1414f486f..000000000 --- a/app/src/main/java/com/fastaccess/provider/markdown/extension/emoji/EmojiExtension.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.fastaccess.provider.markdown.extension.emoji; - -import com.fastaccess.provider.markdown.extension.emoji.internal.EmojiDelimiterProcessor; -import com.fastaccess.provider.markdown.extension.emoji.internal.EmojiNodeRenderer; - -import org.commonmark.Extension; -import org.commonmark.parser.Parser; -import org.commonmark.renderer.html.HtmlRenderer; - -/** - * Created by kosh on 20/08/2017. - */ - -public class EmojiExtension implements Parser.ParserExtension, HtmlRenderer.HtmlRendererExtension { - private EmojiExtension() {} - - public static Extension create() { - return new EmojiExtension(); - } - - @Override public void extend(Parser.Builder parserBuilder) { - parserBuilder.customDelimiterProcessor(new EmojiDelimiterProcessor()); - } - - @Override public void extend(HtmlRenderer.Builder rendererBuilder) { - rendererBuilder.nodeRendererFactory(EmojiNodeRenderer::new); - } -} diff --git a/app/src/main/java/com/fastaccess/provider/markdown/extension/emoji/internal/EmojiDelimiterProcessor.java b/app/src/main/java/com/fastaccess/provider/markdown/extension/emoji/internal/EmojiDelimiterProcessor.java deleted file mode 100644 index 2a80257d7..000000000 --- a/app/src/main/java/com/fastaccess/provider/markdown/extension/emoji/internal/EmojiDelimiterProcessor.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.fastaccess.provider.markdown.extension.emoji.internal; - -import com.fastaccess.provider.markdown.extension.emoji.Emoji; - -import org.commonmark.node.Node; -import org.commonmark.node.Text; -import org.commonmark.parser.delimiter.DelimiterProcessor; -import org.commonmark.parser.delimiter.DelimiterRun; - -public class EmojiDelimiterProcessor implements DelimiterProcessor { - - @Override public char getOpeningCharacter() { - return ':'; - } - - @Override public char getClosingCharacter() { - return ':'; - } - - @Override public int getMinLength() { - return 1; - } - - @Override public int getDelimiterUse(DelimiterRun opener, DelimiterRun closer) { - if (opener.length() >= 1 && closer.length() >= 1) { - return 1; - } else { - return 0; - } - } - - @Override public void process(Text opener, Text closer, int delimiterCount) { - Node emoji = new Emoji(); - Node tmp = opener.getNext(); - while (tmp != null && tmp != closer) { - Node next = tmp.getNext(); - emoji.appendChild(tmp); - tmp = next; - } - opener.insertAfter(emoji); - } -} diff --git a/app/src/main/java/com/fastaccess/provider/markdown/extension/emoji/internal/EmojiNodeRenderer.java b/app/src/main/java/com/fastaccess/provider/markdown/extension/emoji/internal/EmojiNodeRenderer.java deleted file mode 100644 index bbef8b818..000000000 --- a/app/src/main/java/com/fastaccess/provider/markdown/extension/emoji/internal/EmojiNodeRenderer.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.fastaccess.provider.markdown.extension.emoji.internal; - -import org.commonmark.node.Node; -import org.commonmark.renderer.NodeRenderer; -import org.commonmark.renderer.html.HtmlNodeRendererContext; -import org.commonmark.renderer.html.HtmlWriter; - -import java.util.Collections; -import java.util.Map; -import java.util.Set; - -public class EmojiNodeRenderer implements NodeRenderer { - - private final HtmlNodeRendererContext context; - private final HtmlWriter html; - - public EmojiNodeRenderer(HtmlNodeRendererContext context) { - this.context = context; - this.html = context.getWriter(); - } - - @Override public Set> getNodeTypes() { - return Collections.singleton(com.fastaccess.provider.markdown.extension.emoji.Emoji.class); - } - - @Override public void render(Node node) { - Map attributes = context.extendAttributes(node, "emoji", Collections.emptyMap()); - html.tag("emoji", attributes); - renderChildren(node); - html.tag("/emoji"); - } - - private void renderChildren(Node parent) { - Node node = parent.getFirstChild(); - while (node != null) { - Node next = node.getNext(); - context.render(node); - node = next; - } - } -} diff --git a/app/src/main/java/com/fastaccess/provider/markdown/extension/mention/Mention.java b/app/src/main/java/com/fastaccess/provider/markdown/extension/mention/Mention.java deleted file mode 100644 index c2d148c72..000000000 --- a/app/src/main/java/com/fastaccess/provider/markdown/extension/mention/Mention.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.fastaccess.provider.markdown.extension.mention; - -import org.commonmark.node.CustomNode; -import org.commonmark.node.Delimited; - -/** - * Created by kosh on 20/08/2017. - */ - -public class Mention extends CustomNode implements Delimited { - - private static final String DELIMITER = "@"; - - @Override public String getOpeningDelimiter() { - return DELIMITER; - } - - @Override public String getClosingDelimiter() { - return " "; - } -} diff --git a/app/src/main/java/com/fastaccess/provider/markdown/extension/mention/MentionExtension.java b/app/src/main/java/com/fastaccess/provider/markdown/extension/mention/MentionExtension.java deleted file mode 100644 index 5a8fa103b..000000000 --- a/app/src/main/java/com/fastaccess/provider/markdown/extension/mention/MentionExtension.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.fastaccess.provider.markdown.extension.mention; - -import com.fastaccess.provider.markdown.extension.mention.internal.MentionDelimiterProcessor; -import com.fastaccess.provider.markdown.extension.mention.internal.MentionNodeRenderer; - -import org.commonmark.Extension; -import org.commonmark.parser.Parser; -import org.commonmark.renderer.html.HtmlRenderer; - -/** - * Created by kosh on 20/08/2017. - */ - -public class MentionExtension implements Parser.ParserExtension, HtmlRenderer.HtmlRendererExtension { - private MentionExtension() {} - - public static Extension create() { - return new MentionExtension(); - } - - @Override public void extend(Parser.Builder parserBuilder) { - parserBuilder.customDelimiterProcessor(new MentionDelimiterProcessor()); - } - - @Override public void extend(HtmlRenderer.Builder rendererBuilder) { - rendererBuilder.nodeRendererFactory(MentionNodeRenderer::new); - } -} diff --git a/app/src/main/java/com/fastaccess/provider/markdown/extension/mention/internal/MentionDelimiterProcessor.java b/app/src/main/java/com/fastaccess/provider/markdown/extension/mention/internal/MentionDelimiterProcessor.java deleted file mode 100644 index 5b3f6d0da..000000000 --- a/app/src/main/java/com/fastaccess/provider/markdown/extension/mention/internal/MentionDelimiterProcessor.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.fastaccess.provider.markdown.extension.mention.internal; - -import com.fastaccess.provider.markdown.extension.mention.Mention; - -import org.commonmark.node.Node; -import org.commonmark.node.Text; -import org.commonmark.parser.delimiter.DelimiterProcessor; -import org.commonmark.parser.delimiter.DelimiterRun; - -public class MentionDelimiterProcessor implements DelimiterProcessor { - - @Override public char getOpeningCharacter() { - return '@'; - } - - @Override public char getClosingCharacter() { - return ' '; - } - - @Override public int getMinLength() { - return 1; - } - - @Override public int getDelimiterUse(DelimiterRun opener, DelimiterRun closer) { - if (opener.length() >= 1 && closer.length() >= 1) { - return 1; - } else { - return 0; - } - } - - @Override public void process(Text opener, Text closer, int delimiterCount) { - Node mention = new Mention(); - Node tmp = opener.getNext(); - while (tmp != null && tmp != closer) { - Node next = tmp.getNext(); - mention.appendChild(tmp); - tmp = next; - } - opener.insertAfter(mention); - } -} diff --git a/app/src/main/java/com/fastaccess/provider/markdown/extension/mention/internal/MentionNodeRenderer.java b/app/src/main/java/com/fastaccess/provider/markdown/extension/mention/internal/MentionNodeRenderer.java deleted file mode 100644 index c09fe0fd1..000000000 --- a/app/src/main/java/com/fastaccess/provider/markdown/extension/mention/internal/MentionNodeRenderer.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.fastaccess.provider.markdown.extension.mention.internal; - -import com.fastaccess.provider.markdown.extension.mention.Mention; - -import org.commonmark.node.Node; -import org.commonmark.renderer.NodeRenderer; -import org.commonmark.renderer.html.HtmlNodeRendererContext; -import org.commonmark.renderer.html.HtmlWriter; - -import java.util.Collections; -import java.util.Map; -import java.util.Set; - -public class MentionNodeRenderer implements NodeRenderer { - - private final HtmlNodeRendererContext context; - private final HtmlWriter html; - - public MentionNodeRenderer(HtmlNodeRendererContext context) { - this.context = context; - this.html = context.getWriter(); - } - - @Override public Set> getNodeTypes() { - return Collections.singleton(Mention.class); - } - - @Override public void render(Node node) { - Map attributes = context.extendAttributes(node, "mention", Collections.emptyMap()); - html.tag("mention", attributes); - renderChildren(node); - html.tag("/mention"); - } - - private void renderChildren(Node parent) { - Node node = parent.getFirstChild(); - while (node != null) { - Node next = node.getNext(); - context.render(node); - node = next; - } - } -} diff --git a/app/src/main/java/com/fastaccess/provider/rest/ApolloProdivder.kt b/app/src/main/java/com/fastaccess/provider/rest/ApolloProdivder.kt deleted file mode 100644 index 230843348..000000000 --- a/app/src/main/java/com/fastaccess/provider/rest/ApolloProdivder.kt +++ /dev/null @@ -1,23 +0,0 @@ -package com.fastaccess.provider.rest - -import com.apollographql.apollo.ApolloClient -import com.fastaccess.BuildConfig -import com.fastaccess.helper.PrefGetter -import com.fastaccess.provider.scheme.LinkParserHelper - -/** - * Created by Hashemsergani on 12.09.17. - */ - -object ApolloProdivder { - - fun getApollo(enterprise: Boolean) = ApolloClient.builder() - .serverUrl("${if (enterprise && PrefGetter.isEnterprise()) { - "${LinkParserHelper.getEndpoint(PrefGetter.getEnterpriseUrl())}/" - } else { - BuildConfig.REST_URL - }}graphql") - .okHttpClient(RestProvider.provideOkHttpClient()) - .build() - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/provider/rest/ImgurProvider.java b/app/src/main/java/com/fastaccess/provider/rest/ImgurProvider.java deleted file mode 100644 index ce68f47b0..000000000 --- a/app/src/main/java/com/fastaccess/provider/rest/ImgurProvider.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.fastaccess.provider.rest; - -import androidx.annotation.NonNull; - -import com.fastaccess.BuildConfig; -import com.fastaccess.data.service.ImgurService; -import com.fastaccess.provider.rest.converters.GithubResponseConverter; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -import java.lang.reflect.Modifier; - -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.logging.HttpLoggingInterceptor; -import retrofit2.Retrofit; -import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; - -/** - * Created by Kosh on 15 Apr 2017, 7:59 PM - */ - -public class ImgurProvider { - - public final static Gson gson = new GsonBuilder() - .excludeFieldsWithModifiers(Modifier.FINAL, Modifier.TRANSIENT, Modifier.STATIC) - .setPrettyPrinting() - .create(); - - private ImgurProvider() {} - - private static OkHttpClient provideOkHttpClient() { - OkHttpClient.Builder client = new OkHttpClient.Builder(); - if (BuildConfig.DEBUG) { - client.addInterceptor(new HttpLoggingInterceptor() - .setLevel(HttpLoggingInterceptor.Level.BODY)); - } - client.addInterceptor(chain -> { - Request original = chain.request(); - Request.Builder requestBuilder = original.newBuilder(); - requestBuilder.header("Authorization", "Client-ID " + BuildConfig.IMGUR_CLIENT_ID); - requestBuilder.method(original.method(), original.body()); - Request request = requestBuilder.build(); - return chain.proceed(request); - }); - return client.build(); - } - - private static Retrofit provideRetrofit() { - return new Retrofit.Builder() - .baseUrl(BuildConfig.IMGUR_URL) - .client(provideOkHttpClient()) - .addConverterFactory(new GithubResponseConverter(gson)) - .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) - .build(); - } - - @NonNull public static ImgurService getImgurService() { - return provideRetrofit().create(ImgurService.class); - } - -} diff --git a/app/src/main/java/com/fastaccess/provider/rest/LoginProvider.java b/app/src/main/java/com/fastaccess/provider/rest/LoginProvider.java deleted file mode 100644 index af3156793..000000000 --- a/app/src/main/java/com/fastaccess/provider/rest/LoginProvider.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.fastaccess.provider.rest; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.BuildConfig; -import com.fastaccess.data.service.LoginRestService; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.rest.converters.GithubResponseConverter; -import com.fastaccess.provider.rest.interceptors.AuthenticationInterceptor; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.google.gson.FieldNamingPolicy; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -import java.lang.reflect.Modifier; - -import okhttp3.OkHttpClient; -import okhttp3.logging.HttpLoggingInterceptor; -import retrofit2.Retrofit; -import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; - -/** - * Created by Kosh on 08 Feb 2017, 8:37 PM - */ - -public class LoginProvider { - - private final static Gson gson = new GsonBuilder() - .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) - .excludeFieldsWithModifiers(Modifier.FINAL, Modifier.TRANSIENT, Modifier.STATIC) - .setDateFormat("yyyy-MM-dd HH:mm:ss") - .setPrettyPrinting() - .create(); - - private static OkHttpClient provideOkHttpClient(@Nullable String authToken, @Nullable String otp) { - OkHttpClient.Builder client = new OkHttpClient.Builder(); - if (BuildConfig.DEBUG) { - client.addInterceptor(new HttpLoggingInterceptor() - .setLevel(HttpLoggingInterceptor.Level.BODY)); - } - client.addInterceptor(new AuthenticationInterceptor(authToken, otp)); - return client.build(); - } - - private static Retrofit provideRetrofit(@Nullable String authToken, @Nullable String otp, @Nullable String enterpriseUrl) { - return new Retrofit.Builder() - .baseUrl(InputHelper.isEmpty(enterpriseUrl) ? BuildConfig.REST_URL : LinkParserHelper.getEndpoint(enterpriseUrl)) - .client(provideOkHttpClient(authToken, otp)) - .addConverterFactory(new GithubResponseConverter(gson)) - .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) - .build(); - } - - public static LoginRestService getLoginRestService() { - return new Retrofit.Builder() - .baseUrl("https://github.com/login/oauth/") - .client(provideOkHttpClient(null, null)) - .addConverterFactory(new GithubResponseConverter(gson)) - .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) - .build() - .create(LoginRestService.class); - } - - @NonNull public static LoginRestService getLoginRestService(@NonNull String authToken, @Nullable String otp, - @Nullable String endpoint) { - return provideRetrofit(authToken, otp, endpoint).create(LoginRestService.class); - } -} diff --git a/app/src/main/java/com/fastaccess/provider/rest/RepoQueryProvider.java b/app/src/main/java/com/fastaccess/provider/rest/RepoQueryProvider.java deleted file mode 100644 index 955668526..000000000 --- a/app/src/main/java/com/fastaccess/provider/rest/RepoQueryProvider.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.fastaccess.provider.rest; - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.types.IssueState; - -/** - * Created by Kosh on 23 Mar 2017, 7:26 PM - */ - -public class RepoQueryProvider { - @NonNull public static String getIssuesPullRequestQuery(@NonNull String owner, @NonNull String repo, - @NonNull IssueState issueState, boolean isPr) { - return "+" + "type:" + (isPr ? "pr" : "issue") + - "+" + "repo:" + owner + "/" + - repo + "+" + "is:" + issueState.name(); - } - - @NonNull public static String getMyIssuesPullRequestQuery(@NonNull String username, @NonNull IssueState issueState, boolean isPr) { - return "type:" + (isPr ? "pr" : "issue") + - "+" + "author:" + username + - "+is:" + issueState.name(); - } - - @NonNull public static String getAssigned(@NonNull String username, @NonNull IssueState issueState, boolean isPr) { - return "type:" + (isPr ? "pr" : "issue") + - "+" + "assignee:" + username + - "+is:" + issueState.name(); - } - - @NonNull public static String getMentioned(@NonNull String username, @NonNull IssueState issueState, boolean isPr) { - return "type:" + (isPr ? "pr" : "issue") + - "+" + "mentions:" + username + - "+is:" + issueState.name(); - } - - @NonNull public static String getReviewRequests(@NonNull String username, @NonNull IssueState issueState) { - return "type:pr" + - "+" + "review-requested:" + username + - "+is:" + issueState.name(); - } - - public static String getParticipated(@NonNull String username, @NonNull IssueState issueState, boolean isPr) { - return "type:" + (isPr ? "pr" : "issue") + - "+" + "involves:" + username + - "+is:" + issueState.name(); - } -} diff --git a/app/src/main/java/com/fastaccess/provider/rest/RestProvider.java b/app/src/main/java/com/fastaccess/provider/rest/RestProvider.java deleted file mode 100644 index 2723e8cee..000000000 --- a/app/src/main/java/com/fastaccess/provider/rest/RestProvider.java +++ /dev/null @@ -1,228 +0,0 @@ -package com.fastaccess.provider.rest; - -import android.app.Activity; -import android.app.DownloadManager; -import android.content.Context; -import android.content.Intent; -import android.net.Uri; -import android.os.Environment; -import android.text.TextUtils; - -import com.crashlytics.android.Crashlytics; -import com.fastaccess.BuildConfig; -import com.fastaccess.R; -import com.fastaccess.data.dao.GitHubErrorResponse; -import com.fastaccess.data.dao.GitHubStatusModel; -import com.fastaccess.data.service.ContentService; -import com.fastaccess.data.service.GistService; -import com.fastaccess.data.service.IssueService; -import com.fastaccess.data.service.NotificationService; -import com.fastaccess.data.service.OrganizationService; -import com.fastaccess.data.service.ProjectsService; -import com.fastaccess.data.service.PullRequestService; -import com.fastaccess.data.service.ReactionsService; -import com.fastaccess.data.service.RepoService; -import com.fastaccess.data.service.ReviewService; -import com.fastaccess.data.service.SearchService; -import com.fastaccess.data.service.UserRestService; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.provider.rest.converters.GithubResponseConverter; -import com.fastaccess.provider.rest.interceptors.AuthenticationInterceptor; -import com.fastaccess.provider.rest.interceptors.ContentTypeInterceptor; -import com.fastaccess.provider.rest.interceptors.PaginationInterceptor; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.google.gson.FieldNamingPolicy; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -import java.io.File; -import java.lang.reflect.Modifier; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import io.reactivex.Observable; -import okhttp3.OkHttpClient; -import okhttp3.ResponseBody; -import okhttp3.logging.HttpLoggingInterceptor; -import retrofit2.HttpException; -import retrofit2.Retrofit; -import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; -import tech.linjiang.pandora.Pandora; - -/** - * Created by Kosh on 08 Feb 2017, 8:37 PM - */ - -public class RestProvider { - - public static final int PAGE_SIZE = 30; - - private static OkHttpClient okHttpClient; - public final static Gson gson = new GsonBuilder() - .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) - .excludeFieldsWithModifiers(Modifier.FINAL, Modifier.TRANSIENT, Modifier.STATIC) - .setDateFormat("yyyy-MM-dd HH:mm:ss") - .disableHtmlEscaping() - .setPrettyPrinting() - .create(); - - public static OkHttpClient provideOkHttpClient() { - if (okHttpClient == null) { - OkHttpClient.Builder client = new OkHttpClient.Builder(); - if (BuildConfig.DEBUG) { - client.addInterceptor(new HttpLoggingInterceptor() - .setLevel(HttpLoggingInterceptor.Level.BODY)); - } - client.addInterceptor(new AuthenticationInterceptor()); - client.addInterceptor(new PaginationInterceptor()); - client.addInterceptor(new ContentTypeInterceptor()); - client.addInterceptor(Pandora.get().getInterceptor()); - okHttpClient = client.build(); - } - return okHttpClient; - } - - private static Retrofit provideRetrofit(boolean enterprise) { - return new Retrofit.Builder() - .baseUrl(enterprise && PrefGetter.isEnterprise() ? LinkParserHelper.getEndpoint(PrefGetter.getEnterpriseUrl()) : BuildConfig.REST_URL) - .client(provideOkHttpClient()) - .addConverterFactory(new GithubResponseConverter(gson)) - .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) - .build(); - } - - public static void downloadFile(@NonNull Context context, @NonNull String url) { - downloadFile(context, url, null); - } - - public static void downloadFile(@NonNull Context context, @NonNull String url, @Nullable String extension) { - try { - if (InputHelper.isEmpty(url)) return; - boolean isEnterprise = LinkParserHelper.isEnterprise(url); - if (url.endsWith(".apk")) { - Activity activity = ActivityHelper.getActivity(context); - if (activity != null) { - ActivityHelper.startCustomTab(activity, url); - return; - } - } - Uri uri = Uri.parse(url); - DownloadManager downloadManager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE); - DownloadManager.Request request = new DownloadManager.Request(uri); - String authToken = isEnterprise ? PrefGetter.getEnterpriseToken() : PrefGetter.getToken(); - if (!TextUtils.isEmpty(authToken)) { - request.addRequestHeader("Authorization", authToken.startsWith("Basic") ? authToken : "token " + authToken); - } - String fileName = new File(url).getName(); - if (!InputHelper.isEmpty(extension)) { - fileName += extension; - } - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName); - request.setTitle(fileName); - request.setDescription(context.getString(R.string.downloading_file)); - request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE | DownloadManager.Request.NETWORK_WIFI); - request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); - if (downloadManager != null) { - downloadManager.enqueue(request); - } - } catch (Exception e) { - e.printStackTrace(); - Crashlytics.logException(e); - } - } - - public static int getErrorCode(Throwable throwable) { - if (throwable instanceof HttpException) { - return ((HttpException) throwable).code(); - } - return -1; - } - - @NonNull public static UserRestService getUserService(boolean enterprise) { - return provideRetrofit(enterprise).create(UserRestService.class); - } - - @NonNull public static GistService getGistService(boolean enterprise) { - return provideRetrofit(enterprise).create(GistService.class); - } - - @NonNull public static RepoService getRepoService(boolean enterprise) { - return provideRetrofit(enterprise).create(RepoService.class); - } - - @NonNull public static IssueService getIssueService(boolean enterprise) { - return provideRetrofit(enterprise).create(IssueService.class); - } - - @NonNull public static PullRequestService getPullRequestService(boolean enterprise) { - return provideRetrofit(enterprise).create(PullRequestService.class); - } - - @NonNull public static NotificationService getNotificationService(boolean enterprise) { - return provideRetrofit(enterprise).create(NotificationService.class); - } - - @NonNull public static ReactionsService getReactionsService(boolean enterprise) { - return provideRetrofit(enterprise).create(ReactionsService.class); - } - - @NonNull public static OrganizationService getOrgService(boolean enterprise) { - return provideRetrofit(enterprise).create(OrganizationService.class); - } - - @NonNull public static ReviewService getReviewService(boolean enterprise) { - return provideRetrofit(enterprise).create(ReviewService.class); - } - - @NonNull public static UserRestService getContribution() { - return new Retrofit.Builder() - .baseUrl(BuildConfig.REST_URL) - .addConverterFactory(new GithubResponseConverter(gson)) - .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) - .build() - .create(UserRestService.class); - } - - @NonNull public static SearchService getSearchService(boolean enterprise) { - return provideRetrofit(enterprise).create(SearchService.class); - } - - @NonNull public static ContentService getContentService(boolean enterprise) { - return provideRetrofit(enterprise).create(ContentService.class); - } - - @NonNull public static ProjectsService getProjectsService(boolean enterprise) { - return provideRetrofit(enterprise).create(ProjectsService.class); - } - - @Nullable public static GitHubErrorResponse getErrorResponse(@NonNull Throwable throwable) { - ResponseBody body = null; - if (throwable instanceof HttpException) { - body = ((HttpException) throwable).response().errorBody(); - } - if (body != null) { - try { - return gson.fromJson(body.string(), GitHubErrorResponse.class); - } catch (Exception ignored) {} - } - return null; - } - - @NonNull public static Observable gitHubStatus() { - return new Retrofit.Builder() - .baseUrl("https://kctbh9vrtdwd.statuspage.io/") - .client(provideOkHttpClient()) - .addConverterFactory(new GithubResponseConverter(gson)) - .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) - .build() - .create(ContentService.class) - .checkStatus(); - } - - public static void clearHttpClient() { - okHttpClient = null; - } - -} diff --git a/app/src/main/java/com/fastaccess/provider/rest/converters/GithubResponseConverter.java b/app/src/main/java/com/fastaccess/provider/rest/converters/GithubResponseConverter.java deleted file mode 100644 index ab79636c5..000000000 --- a/app/src/main/java/com/fastaccess/provider/rest/converters/GithubResponseConverter.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.fastaccess.provider.rest.converters; - -import androidx.annotation.NonNull; - -import com.google.gson.Gson; - -import java.io.IOException; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; - -import lombok.AllArgsConstructor; -import okhttp3.RequestBody; -import okhttp3.ResponseBody; -import retrofit2.Converter; -import retrofit2.Retrofit; -import retrofit2.converter.gson.GsonConverterFactory; - - -/** - * call that supports String & Gson and always uses json as its request body - */ -@AllArgsConstructor -public class GithubResponseConverter extends Converter.Factory { - private Gson gson; - - @Override public Converter responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) { - try { - if (type == String.class) { - return new StringResponseConverter(); - } - return GsonConverterFactory.create(gson).responseBodyConverter(type, annotations, retrofit); - } catch (OutOfMemoryError ignored) { - return null; - } - } - - @Override public Converter requestBodyConverter(Type type, Annotation[] parameterAnnotations, - Annotation[] methodAnnotations, Retrofit retrofit) { - return GsonConverterFactory.create(gson).requestBodyConverter(type, parameterAnnotations, methodAnnotations, retrofit); - } - - public static class StringResponseConverter implements Converter { - @Override public String convert(@NonNull ResponseBody value) throws IOException { - return value.string(); - } - } -} diff --git a/app/src/main/java/com/fastaccess/provider/rest/interceptors/AuthenticationInterceptor.kt b/app/src/main/java/com/fastaccess/provider/rest/interceptors/AuthenticationInterceptor.kt deleted file mode 100644 index 9f15342eb..000000000 --- a/app/src/main/java/com/fastaccess/provider/rest/interceptors/AuthenticationInterceptor.kt +++ /dev/null @@ -1,40 +0,0 @@ -package com.fastaccess.provider.rest.interceptors - -import com.fastaccess.helper.Logger -import com.fastaccess.helper.PrefGetter -import com.fastaccess.provider.scheme.LinkParserHelper -import okhttp3.Interceptor -import okhttp3.Response -import java.io.IOException - -class AuthenticationInterceptor : Interceptor { - private var isScrapping: Boolean = false - private var token: String? = null - private var otp: String? = null - - constructor(token: String? = null, otp: String? = null) { - this.token = token - this.otp = otp - } - - @JvmOverloads constructor(isScrapping: Boolean = false) { - this.isScrapping = isScrapping - } - - @Throws(IOException::class) override fun intercept(chain: Interceptor.Chain): Response { - val original = chain.request() - val builder = original.newBuilder() - val isEnterprise = LinkParserHelper.isEnterprise(original.url.host) - val authToken = if (token.isNullOrBlank()) if (isEnterprise) PrefGetter.getEnterpriseToken() else PrefGetter.getToken() else token - val otpCode = if (otp.isNullOrBlank()) if (isEnterprise) PrefGetter.getEnterpriseOtpCode() else PrefGetter.getOtpCode() else otp - if (!authToken.isNullOrBlank()) { - builder.header("Authorization", if (authToken.startsWith("Basic")) authToken else "token $authToken") - } - if (!otpCode.isNullOrBlank()) { - builder.addHeader("X-GitHub-OTP", otpCode.trim()) - } - if (!isScrapping) builder.addHeader("User-Agent", "FastHub") - val request = builder.build() - return chain.proceed(request) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/provider/rest/interceptors/ContentTypeInterceptor.kt b/app/src/main/java/com/fastaccess/provider/rest/interceptors/ContentTypeInterceptor.kt deleted file mode 100644 index 83b3d755b..000000000 --- a/app/src/main/java/com/fastaccess/provider/rest/interceptors/ContentTypeInterceptor.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.fastaccess.provider.rest.interceptors - -import okhttp3.Interceptor -import okhttp3.Response - -/** - * Created by Kosh on 05 Jul 2017, 8:14 PM - */ - -class ContentTypeInterceptor : Interceptor { - override fun intercept(chain: Interceptor.Chain): Response { - val request = chain.request() - return chain.proceed(request.newBuilder() - .addHeader("Accept", "application/vnd.github.v3+json") - .addHeader("Content-type", "application/vnd.github.v3+json") - .method(request.method, request.body) - .build()) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/provider/rest/interceptors/PaginationInterceptor.java b/app/src/main/java/com/fastaccess/provider/rest/interceptors/PaginationInterceptor.java deleted file mode 100644 index 5f5cf54f2..000000000 --- a/app/src/main/java/com/fastaccess/provider/rest/interceptors/PaginationInterceptor.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.fastaccess.provider.rest.interceptors; - -import android.net.Uri; -import androidx.annotation.NonNull; - -import com.fastaccess.helper.InputHelper; - -import java.io.IOException; - -import okhttp3.Headers; -import okhttp3.Interceptor; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; - -public class PaginationInterceptor implements Interceptor { - - @Override public Response intercept(@NonNull Chain chain) throws IOException { - Request request = chain.request(); - Response response = chain.proceed(request); - Headers headers = chain.request().headers(); - if (headers != null) { - if ((headers.values("Accept").contains("application/vnd.github.html") || - headers.values("Accept").contains("application/vnd.github.VERSION.raw"))) { - return response;//return them as they are. - } - } - if (response.isSuccessful()) { - if (response.peekBody(1).string().equals("[")) { - String json = "{"; - String link = response.header("link"); - if (link != null) { - String[] links = link.split(","); - for (String link1 : links) { - String[] pageLink = link1.split(";"); - String page = Uri.parse(pageLink[0].replaceAll("[<>]", "")).getQueryParameter("page"); - String rel = pageLink[1].replaceAll("\"", "").replace("rel=", ""); - if (page != null) json += String.format("\"%s\":\"%s\",", rel.trim(), page); - } - } - json += String.format("\"items\":%s}", response.body().string()); - return response.newBuilder().body(ResponseBody.create(response.body().contentType(), json)).build(); - } else if (response.header("link") != null) { - String link = response.header("link"); - String pagination = ""; - String[] links = link.split(","); - for (String link1 : links) { - String[] pageLink = link1.split(";"); - String page = Uri.parse(pageLink[0].replaceAll("[<>]", "")).getQueryParameter("page"); - String rel = pageLink[1].replaceAll("\"", "").replace("rel=", ""); - if (page != null) pagination += String.format("\"%s\":\"%s\",", rel.trim(), page); - } - if (!InputHelper.isEmpty(pagination)) {//hacking for search pagination. - String body = response.body().string(); - return response.newBuilder().body(ResponseBody.create(response.body().contentType(), - "{" + pagination + body.substring(1, body.length()))).build(); - } - } - } - return response; - } - -} diff --git a/app/src/main/java/com/fastaccess/provider/rest/jsoup/JsoupProvider.java b/app/src/main/java/com/fastaccess/provider/rest/jsoup/JsoupProvider.java deleted file mode 100644 index 09f318448..000000000 --- a/app/src/main/java/com/fastaccess/provider/rest/jsoup/JsoupProvider.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.fastaccess.provider.rest.jsoup; - -import androidx.annotation.NonNull; - -import com.fastaccess.BuildConfig; -import com.fastaccess.data.service.ScrapService; -import com.fastaccess.provider.rest.interceptors.AuthenticationInterceptor; - -import okhttp3.OkHttpClient; -import okhttp3.logging.HttpLoggingInterceptor; -import retrofit2.Retrofit; -import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; -import retrofit2.converter.scalars.ScalarsConverterFactory; -import tech.linjiang.pandora.Pandora; - -/** - * Created by Kosh on 02 Jun 2017, 12:47 PM - */ - -public class JsoupProvider { - - private static OkHttpClient okHttpClient; - - private static OkHttpClient provideOkHttpClient() { - if (okHttpClient == null) { - OkHttpClient.Builder client = new OkHttpClient.Builder(); - if (BuildConfig.DEBUG) { - client.addInterceptor(new HttpLoggingInterceptor() - .setLevel(HttpLoggingInterceptor.Level.BODY)); - } - client.addInterceptor(Pandora.get().getInterceptor()); - client.addInterceptor(new AuthenticationInterceptor(true)); - okHttpClient = client.build(); - } - return okHttpClient; - } - - public static ScrapService getTrendingService(@NonNull String url) { - return new Retrofit.Builder() - .baseUrl(url) - .client(provideOkHttpClient()) - .addConverterFactory(ScalarsConverterFactory.create()) - .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) - .build() - .create(ScrapService.class); - } - - public static ScrapService getWiki() { - return new Retrofit.Builder() - .baseUrl("https://github.com/") - .client(provideOkHttpClient()) - .addConverterFactory(ScalarsConverterFactory.create()) - .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) - .build() - .create(ScrapService.class); - } -} diff --git a/app/src/main/java/com/fastaccess/provider/rest/loadmore/OnLoadMore.java b/app/src/main/java/com/fastaccess/provider/rest/loadmore/OnLoadMore.java deleted file mode 100644 index 654880ec6..000000000 --- a/app/src/main/java/com/fastaccess/provider/rest/loadmore/OnLoadMore.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.fastaccess.provider.rest.loadmore; - -import androidx.annotation.Nullable; - -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.scroll.InfiniteScroll; - -public class OnLoadMore

extends InfiniteScroll { - - private BaseMvp.PaginationListener

presenter; - @Nullable private P parameter; - - public OnLoadMore(BaseMvp.PaginationListener

presenter) { - this(presenter, null); - } - - public OnLoadMore(BaseMvp.PaginationListener

presenter, @Nullable P parameter) { - super(); - this.presenter = presenter; - this.parameter = parameter; - } - - - public void setParameter(@Nullable P parameter) { - this.parameter = parameter; - } - - @Nullable public P getParameter() { - return parameter; - } - - @Override public boolean onLoadMore(int page, int totalItemsCount) { - if (presenter != null) { - presenter.setPreviousTotal(totalItemsCount); - return presenter.onCallApi(page + 1, parameter); - } - return false; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/provider/scheme/LinkParserHelper.java b/app/src/main/java/com/fastaccess/provider/scheme/LinkParserHelper.java deleted file mode 100644 index b02bd103d..000000000 --- a/app/src/main/java/com/fastaccess/provider/scheme/LinkParserHelper.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.fastaccess.provider.scheme; - -import android.net.Uri; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.text.TextUtils; -import android.webkit.MimeTypeMap; - -import com.annimon.stream.Optional; -import com.annimon.stream.Stream; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ObjectsCompat; -import com.fastaccess.helper.PrefGetter; - -import java.util.Arrays; -import java.util.List; - -/** - * Created by Kosh on 11 Apr 2017, 10:02 PM - */ - -public class LinkParserHelper { - public static final String HOST_DEFAULT = "github.com"; - public static final String PROTOCOL_HTTPS = "https"; - static final String HOST_GISTS = "gist.github.com"; - static final String HOST_GISTS_RAW = "gist.githubusercontent.com"; - static final String RAW_AUTHORITY = "raw.githubusercontent.com"; - static final String API_AUTHORITY = "api.github.com"; - static final List IGNORED_LIST = Arrays.asList("notifications", "settings", "blog", - "explore", "dashboard", "repositories", "logout", "sessions", "site", "security", - "contact", "about", "logos", "login", "pricing", ""); - - @SafeVarargs static Optional returnNonNull(@NonNull T... t) { - return Stream.of(t).filter(ObjectsCompat::nonNull).findFirst(); - } - - @NonNull static Uri getBlobBuilder(@NonNull Uri uri) { - boolean isSvg = "svg".equalsIgnoreCase(MimeTypeMap.getFileExtensionFromUrl(uri.toString())); - List segments = uri.getPathSegments(); - if (isSvg) { - Uri svgBlob = Uri.parse(uri.toString().replace("blob/", "")); - return svgBlob.buildUpon().authority(RAW_AUTHORITY).build(); - } - Uri.Builder urlBuilder = new Uri.Builder(); - String owner = segments.get(0); - String repo = segments.get(1); - String branch = segments.get(3); - urlBuilder.scheme("https") - .authority(API_AUTHORITY) - .appendPath("repos") - .appendPath(owner) - .appendPath(repo) - .appendPath("contents"); - for (int i = 4; i < segments.size(); i++) { - urlBuilder.appendPath(segments.get(i)); - } - if (uri.getQueryParameterNames() != null) { - for (String query : uri.getQueryParameterNames()) { - urlBuilder.appendQueryParameter(query, uri.getQueryParameter(query)); - } - } - if (uri.getEncodedFragment() != null) { - urlBuilder.encodedFragment(uri.getEncodedFragment()); - } - urlBuilder.appendQueryParameter("ref", branch); - return urlBuilder.build(); - } - - public static boolean isEnterprise(@Nullable String url) { - if (InputHelper.isEmpty(url) || !PrefGetter.isEnterprise()) return false; - String enterpriseUrl = PrefGetter.getEnterpriseUrl().toLowerCase(); - url = url.toLowerCase(); - return url.equalsIgnoreCase(enterpriseUrl) || url.startsWith(enterpriseUrl) || url.startsWith(getEndpoint(enterpriseUrl)) - || url.contains(enterpriseUrl) || enterpriseUrl.contains(url); - } - - public static String stripScheme(@NonNull String url) { - try { - Uri uri = Uri.parse(url); - return !InputHelper.isEmpty(uri.getAuthority()) ? uri.getAuthority() : url; - } catch (Exception ignored) {} - return url; - } - - @NonNull public static String getEndpoint(@NonNull String url) { - if (url.startsWith("http://")) { - url = url.replace("http://", "https://"); - } - if (!url.startsWith("https://")) { - url = "https://" + url; - } - return getEnterpriseUrl(url); - } - - @NonNull private static String getEnterpriseUrl(@NonNull String url) { - if (url.endsWith("/api/v3/")) { - return url; - } else if (url.endsWith("/api/")) { - return url + "v3/"; - } else if (url.endsWith("/api")) { - return url + "/v3/"; - } else if (url.endsWith("/api/v3")) { - return url + "/"; - } else if (!url.endsWith("/")) { - return url + "/api/v3/"; - } else if (url.endsWith("/")) { - return url + "api/v3/"; - } - return url; - } - - public static String getEnterpriseGistUrl(@NonNull String url, boolean isEnterprise) { - if (isEnterprise) { - Uri uri = Uri.parse(url); - boolean isGist = uri == null || uri.getPathSegments() == null ? url.contains("gist/") : uri.getPathSegments().get(0).equals("gist"); - if (isGist) { - String enterpriseUrl = PrefGetter.getEnterpriseUrl(); - if (!url.contains(enterpriseUrl + "/raw/")) { - url = url.replace(enterpriseUrl, enterpriseUrl + "/raw"); - } - } - } - return url; - } - - @Nullable public static String getGistId(@NonNull Uri uri) { - String gistId = null; - if (uri.toString().contains("raw/gist")) { - if (uri.getPathSegments().size() > 5) { - gistId = uri.getPathSegments().get(5); - } - } else if (uri.getPathSegments() != null) { - if (TextUtils.equals(LinkParserHelper.HOST_GISTS_RAW, uri.getAuthority())) { - if (uri.getPathSegments().size() > 1) { - gistId = uri.getPathSegments().get(1); - } - } - } - return gistId; - } -} diff --git a/app/src/main/java/com/fastaccess/provider/scheme/SchemeParser.java b/app/src/main/java/com/fastaccess/provider/scheme/SchemeParser.java deleted file mode 100644 index 5f1a60a35..000000000 --- a/app/src/main/java/com/fastaccess/provider/scheme/SchemeParser.java +++ /dev/null @@ -1,578 +0,0 @@ -package com.fastaccess.provider.scheme; - -import android.app.Activity; -import android.app.Application; -import android.app.Service; -import android.content.Context; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.text.TextUtils; -import android.webkit.MimeTypeMap; - -import com.annimon.stream.Optional; -import com.annimon.stream.Stream; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.Logger; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.provider.markdown.MarkDownProvider; -import com.fastaccess.ui.modules.code.CodeViewerActivity; -import com.fastaccess.ui.modules.filter.issues.FilterIssuesActivity; -import com.fastaccess.ui.modules.gists.gist.GistActivity; -import com.fastaccess.ui.modules.repos.RepoPagerActivity; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; -import com.fastaccess.ui.modules.repos.code.commit.details.CommitPagerActivity; -import com.fastaccess.ui.modules.repos.code.files.activity.RepoFilesActivity; -import com.fastaccess.ui.modules.repos.code.releases.ReleasesListActivity; -import com.fastaccess.ui.modules.repos.issues.create.CreateIssueActivity; -import com.fastaccess.ui.modules.repos.issues.issue.details.IssuePagerActivity; -import com.fastaccess.ui.modules.repos.projects.details.ProjectPagerActivity; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.PullRequestPagerActivity; -import com.fastaccess.ui.modules.repos.wiki.WikiActivity; -import com.fastaccess.ui.modules.search.SearchActivity; -import com.fastaccess.ui.modules.trending.TrendingActivity; -import com.fastaccess.ui.modules.user.UserPagerActivity; - -import java.util.List; - -import static com.fastaccess.provider.scheme.LinkParserHelper.API_AUTHORITY; -import static com.fastaccess.provider.scheme.LinkParserHelper.HOST_DEFAULT; -import static com.fastaccess.provider.scheme.LinkParserHelper.HOST_GISTS; -import static com.fastaccess.provider.scheme.LinkParserHelper.HOST_GISTS_RAW; -import static com.fastaccess.provider.scheme.LinkParserHelper.IGNORED_LIST; -import static com.fastaccess.provider.scheme.LinkParserHelper.PROTOCOL_HTTPS; -import static com.fastaccess.provider.scheme.LinkParserHelper.RAW_AUTHORITY; -import static com.fastaccess.provider.scheme.LinkParserHelper.getBlobBuilder; -import static com.fastaccess.provider.scheme.LinkParserHelper.returnNonNull; - -/** - * Created by Kosh on 09 Dec 2016, 4:44 PM - */ - -public class SchemeParser { - - public static void launchUri(@NonNull Context context, @NonNull String url) { - launchUri(context, Uri.parse(url), false); - } - - public static void launchUri(@NonNull Context context, @NonNull Uri data) { - launchUri(context, data, false); - } - - public static void launchUri(@NonNull Context context, @NonNull Uri data, boolean showRepoBtn) { - launchUri(context, data, showRepoBtn, false); - } - - public static void launchUri(@NonNull Context context, @NonNull Uri data, boolean showRepoBtn, boolean newDocument) { - Logger.e(data); - Intent intent = convert(context, data, showRepoBtn); - if (intent != null) { - intent.putExtra(BundleConstant.SCHEME_URL, data.toString()); - if (newDocument) { - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); - } - if (context instanceof Service || context instanceof Application) { - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - } - context.startActivity(intent); - } else { - Activity activity = ActivityHelper.getActivity(context); - if (activity != null) { - ActivityHelper.startCustomTab(activity, data); - } else { - ActivityHelper.openChooser(context, data); - } - } - } - - @Nullable private static Intent convert(@NonNull Context context, Uri data, boolean showRepoBtn) { - if (data == null) return null; - if (InputHelper.isEmpty(data.getHost()) || InputHelper.isEmpty(data.getScheme())) { - String host = data.getHost(); - if (InputHelper.isEmpty(host)) host = HOST_DEFAULT; - String scheme = data.getScheme(); - if (InputHelper.isEmpty(scheme)) scheme = PROTOCOL_HTTPS; - String prefix = scheme + "://" + host; - String path = data.getPath(); - if (!InputHelper.isEmpty(path)) { - if (path.charAt(0) == '/') { - data = Uri.parse(prefix + path); - } else { - data = Uri.parse(prefix + '/' + path); - } - } else { - data = Uri.parse(prefix); - } - } - if (data.getPathSegments() != null && !data.getPathSegments().isEmpty()) { - if (IGNORED_LIST.contains(data.getPathSegments().get(0))) return null; - return getIntentForURI(context, data, showRepoBtn); - } - return null; - } - - @Nullable private static Intent getIntentForURI(@NonNull Context context, @NonNull Uri data, boolean showRepoBtn) { - String authority = data.getAuthority(); - boolean isEnterprise = PrefGetter.isEnterprise() && LinkParserHelper.isEnterprise(authority == null ? data.toString() : authority); - if (HOST_GISTS.equals(data.getHost()) || "gist".equalsIgnoreCase(data.getPathSegments().get(0))) { - String extension = MimeTypeMap.getFileExtensionFromUrl(data.toString()); - if (!InputHelper.isEmpty(extension) && !MarkDownProvider.isArchive(data.getLastPathSegment())) { - String url = data.toString(); - return CodeViewerActivity.createIntent(context, url, url); - } - String gist = getGistId(data); - if (gist != null) { - return GistActivity.createIntent(context, gist, isEnterprise); - } - } else if (HOST_GISTS_RAW.equalsIgnoreCase(data.getHost())) { - return getGistFile(context, data); - } else { - if (MarkDownProvider.isArchive(data.toString())) return null; - if (TextUtils.equals(authority, HOST_DEFAULT) || TextUtils.equals(authority, RAW_AUTHORITY) || - TextUtils.equals(authority, API_AUTHORITY) || isEnterprise) { - Intent trending = getTrending(context, data); - Intent projects = getRepoProject(context, data); - Intent userIntent = getUser(context, data); - Intent repoIssues = getRepoIssueIntent(context, data); - Intent repoPulls = getRepoPullRequestIntent(context, data); - Intent createIssueIntent = getCreateIssueIntent(context, data); - Intent pullRequestIntent = getPullRequestIntent(context, data, showRepoBtn); - Intent issueIntent = getIssueIntent(context, data, showRepoBtn); - Intent releasesIntent = getReleases(context, data, isEnterprise); - Intent repoIntent = getRepo(context, data); - Intent repoWikiIntent = getWiki(context, data); - Intent commit = getCommit(context, data, showRepoBtn); - Intent commits = getCommits(context, data, showRepoBtn); - Intent blob = getBlob(context, data); - Intent label = getLabel(context, data); - Intent search = getSearchIntent(context, data); - Optional intentOptional = returnNonNull(trending, projects, search, userIntent, repoIssues, repoPulls, - pullRequestIntent, label, commit, commits, createIssueIntent, issueIntent, releasesIntent, repoIntent, - repoWikiIntent, blob); - Optional empty = Optional.empty(); - if (intentOptional != null && intentOptional.isPresent() && intentOptional != empty) { - Intent intent = intentOptional.get(); - if (isEnterprise) { - if (intent.getExtras() != null) { - Bundle bundle = intent.getExtras(); - bundle.putBoolean(BundleConstant.IS_ENTERPRISE, true); - intent.putExtras(bundle); - } else { - intent.putExtra(BundleConstant.IS_ENTERPRISE, true); - } - } - return intent; - } else { - Intent intent = getGeneralRepo(context, data); - if (isEnterprise) { - if (intent != null && intent.getExtras() != null) { - Bundle bundle = intent.getExtras(); - bundle.putBoolean(BundleConstant.IS_ENTERPRISE, true); - intent.putExtras(bundle); - } else if (intent != null) { - intent.putExtra(BundleConstant.IS_ENTERPRISE, true); - } - } - return intent; - } - } - } - return null; - } - - private static boolean getInvitationIntent(@NonNull Uri uri) { - List segments = uri.getPathSegments(); - return (segments != null && segments.size() == 3) && "invitations".equalsIgnoreCase(uri.getLastPathSegment()); - } - - @Nullable private static Intent getPullRequestIntent(@NonNull Context context, @NonNull Uri uri, boolean showRepoBtn) { - List segments = uri.getPathSegments(); - if (segments == null || segments.size() < 3) return null; - String owner = null; - String repo = null; - String number = null; - String fragment = uri.getEncodedFragment();//#issuecomment-332236665 - Long commentId = null; - if (!InputHelper.isEmpty(fragment) && fragment.split("-").length > 1) { - fragment = fragment.split("-")[1]; - if (!InputHelper.isEmpty(fragment)) { - try { - commentId = Long.parseLong(fragment); - } catch (Exception ignored) {} - } - } - if (segments.size() > 3) { - if (("pull".equals(segments.get(2)) || "pulls".equals(segments.get(2)))) { - owner = segments.get(0); - repo = segments.get(1); - number = segments.get(3); - } else if (("pull".equals(segments.get(3)) || "pulls".equals(segments.get(3))) && segments.size() > 4) { - owner = segments.get(1); - repo = segments.get(2); - number = segments.get(4); - } else { - return null; - } - } - if (InputHelper.isEmpty(number)) return null; - int issueNumber; - try { - issueNumber = Integer.parseInt(number); - } catch (NumberFormatException nfe) { - return null; - } - if (issueNumber < 1) return null; - return PullRequestPagerActivity.createIntent(context, repo, owner, issueNumber, showRepoBtn, - LinkParserHelper.isEnterprise(uri.toString()), commentId == null ? 0 : commentId); - } - - @Nullable private static Intent getIssueIntent(@NonNull Context context, @NonNull Uri uri, boolean showRepoBtn) { - List segments = uri.getPathSegments(); - if (segments == null || segments.size() < 3) return null; - String owner = null; - String repo = null; - String number = null; - String fragment = uri.getEncodedFragment();//#issuecomment-332236665 - Long commentId = null; - if (!InputHelper.isEmpty(fragment) && fragment.split("-").length > 1) { - fragment = fragment.split("-")[1]; - if (!InputHelper.isEmpty(fragment)) { - try { - commentId = Long.parseLong(fragment); - } catch (Exception ignored) {} - } - } - if (segments.size() > 3) { - if (segments.get(2).equalsIgnoreCase("issues")) { - owner = segments.get(0); - repo = segments.get(1); - number = segments.get(3); - } else if (segments.get(3).equalsIgnoreCase("issues") && segments.size() > 4) { - owner = segments.get(1); - repo = segments.get(2); - number = segments.get(4); - } else { - return null; - } - } - if (InputHelper.isEmpty(number)) - return null; - int issueNumber; - try { - issueNumber = Integer.parseInt(number); - } catch (NumberFormatException nfe) { - return null; - } - if (issueNumber < 1) return null; - return IssuePagerActivity.createIntent(context, repo, owner, issueNumber, showRepoBtn, - LinkParserHelper.isEnterprise(uri.toString()), commentId == null ? 0 : commentId); - } - - @Nullable private static Intent getLabel(@NonNull Context context, @NonNull Uri uri) { - List segments = uri.getPathSegments(); - if (segments == null || segments.size() < 3) return null; - String owner = segments.get(0); - String repoName = segments.get(1); - String lastPath = segments.get(2); - if ("labels".equalsIgnoreCase(lastPath)) { - return FilterIssuesActivity.getIntent(context, owner, repoName, "label:\"" + segments.get(3) + "\""); - } - return null; - } - - @Nullable private static Intent getRepo(@NonNull Context context, @NonNull Uri uri) { - List segments = uri.getPathSegments(); - if (segments == null || segments.size() < 2 || segments.size() > 3) return null; - String owner = segments.get(0); - String repoName = segments.get(1); - if (!InputHelper.isEmpty(repoName)) { - if (repoName.endsWith(".git")) repoName = repoName.replace(".git", ""); - } - if (segments.size() == 3) { - String lastPath = uri.getLastPathSegment(); - if ("milestones".equalsIgnoreCase(lastPath)) { - return RepoPagerActivity.createIntent(context, repoName, owner, RepoPagerMvp.CODE, 4); - } else if ("network".equalsIgnoreCase(lastPath)) { - return RepoPagerActivity.createIntent(context, repoName, owner, RepoPagerMvp.CODE, 3); - } else if ("stargazers".equalsIgnoreCase(lastPath)) { - return RepoPagerActivity.createIntent(context, repoName, owner, RepoPagerMvp.CODE, 2); - } else if ("watchers".equalsIgnoreCase(lastPath)) { - return RepoPagerActivity.createIntent(context, repoName, owner, RepoPagerMvp.CODE, 1); - } else if ("labels".equalsIgnoreCase(lastPath)) { - return RepoPagerActivity.createIntent(context, repoName, owner, RepoPagerMvp.CODE, 5); - } else { - return null; - } - } else { - return RepoPagerActivity.createIntent(context, repoName, owner); - } - } - - @Nullable private static Intent getRepoProject(@NonNull Context context, @NonNull Uri uri) { - List segments = uri.getPathSegments(); - if (segments == null || segments.size() < 3) return null; - String owner = segments.get(0); - String repoName = segments.get(1); - if (segments.size() == 3 && "projects".equalsIgnoreCase(segments.get(2))) { - return RepoPagerActivity.createIntent(context, repoName, owner, RepoPagerMvp.PROJECTS); - } else if (segments.size() == 4 && "projects".equalsIgnoreCase(segments.get(2))) { - try { - int projectId = Integer.parseInt(segments.get(segments.size() - 1)); - if (projectId > 0) { - return ProjectPagerActivity.Companion.getIntent(context, owner, repoName, projectId, - LinkParserHelper.isEnterprise(uri.toString())); - } - } catch (Exception ignored) {} - } - return null; - } - - @Nullable private static Intent getWiki(@NonNull Context context, @NonNull Uri uri) { - List segments = uri.getPathSegments(); - if (segments == null || segments.size() < 3) return null; - if ("wiki".equalsIgnoreCase(segments.get(2))) { - String owner = segments.get(0); - String repoName = segments.get(1); - return WikiActivity.Companion.getWiki(context, repoName, owner, - "wiki".equalsIgnoreCase(uri.getLastPathSegment()) ? null : uri.getLastPathSegment()); - } - return null; - } - - /** - * [[k0shk0sh, FastHub, issues], k0shk0sh/fastHub/(issues,pulls,commits, etc)] - */ - @Nullable private static Intent getGeneralRepo(@NonNull Context context, @NonNull Uri uri) { - //TODO parse deeper links to their associate views. meantime fallback to repoPage - if (getInvitationIntent(uri)) { - return null; - } - boolean isEnterprise = PrefGetter.isEnterprise() && Uri.parse(LinkParserHelper.getEndpoint(PrefGetter.getEnterpriseUrl())).getAuthority() - .equalsIgnoreCase(uri.getAuthority()); - if (uri.getAuthority().equals(HOST_DEFAULT) || uri.getAuthority().equals(API_AUTHORITY) || isEnterprise) { - List segments = uri.getPathSegments(); - if (segments == null || segments.isEmpty()) return null; - if (segments.size() == 1) { - return getUser(context, uri); - } else if (segments.size() > 1) { - if (segments.get(0).equalsIgnoreCase("repos") && segments.size() >= 2) { - String owner = segments.get(1); - String repoName = segments.get(2); - return RepoPagerActivity.createIntent(context, repoName, owner); - } else if ("orgs".equalsIgnoreCase(segments.get(0))) { - return null; - } else { - String owner = segments.get(0); - String repoName = segments.get(1); - return RepoPagerActivity.createIntent(context, repoName, owner); - } - } - } - return null; - } - - @Nullable private static Intent getCommits(@NonNull Context context, @NonNull Uri uri, boolean showRepoBtn) { - List segments = Stream.of(uri.getPathSegments()) - .filter(value -> !value.equalsIgnoreCase("api") || !value.equalsIgnoreCase("v3")) - .toList(); - if (segments == null || segments.isEmpty() || segments.size() < 3) return null; - String login = null; - String repoId = null; - String sha = null; - if (segments.size() > 3 && segments.get(3).equals("commits")) { - login = segments.get(1); - repoId = segments.get(2); - sha = segments.get(4); - } else if (segments.size() > 2 && segments.get(2).equals("commits")) { - login = segments.get(0); - repoId = segments.get(1); - sha = uri.getLastPathSegment(); - } - if (login != null && sha != null && repoId != null) { - return CommitPagerActivity.createIntent(context, repoId, login, sha, showRepoBtn); - } - return null; - } - - @Nullable private static Intent getCommit(@NonNull Context context, @NonNull Uri uri, boolean showRepoBtn) { - List segments = Stream.of(uri.getPathSegments()) - .filter(value -> !value.equalsIgnoreCase("api") || !value.equalsIgnoreCase("v3")) - .toList(); - if (segments.size() < 3 || !"commit".equals(segments.get(2))) return null; - String login = segments.get(0); - String repoId = segments.get(1); - String sha = segments.get(3); - return CommitPagerActivity.createIntent(context, repoId, login, sha, showRepoBtn); - } - - @Nullable private static String getGistId(@NonNull Uri uri) { - List segments = uri.getPathSegments(); - if (segments.size() != 1 && segments.size() != 2) return null; - String gistId = segments.get(segments.size() - 1); - if (InputHelper.isEmpty(gistId)) return null; - if (TextUtils.isDigitsOnly(gistId)) return gistId; - else if (gistId.matches("[a-fA-F0-9]+")) return gistId; - else return null; - } - - @Nullable private static Intent getUser(@NonNull Context context, @NonNull Uri uri) { - List segments = uri.getPathSegments(); - if (segments != null && !segments.isEmpty() && segments.size() == 1) { - return UserPagerActivity.createIntent(context, segments.get(0)); - } else if (segments != null && !segments.isEmpty() && segments.size() > 1 && segments.get(0).equalsIgnoreCase("orgs")) { - if ("invitation".equalsIgnoreCase(uri.getLastPathSegment())) { - return null; - } else if ("search".equalsIgnoreCase(uri.getLastPathSegment())) { - String query = uri.getQueryParameter("q"); - return SearchActivity.getIntent(context, query); - } else { - return UserPagerActivity.createIntent(context, segments.get(1), true); - } - } - return null; - } - - @Nullable private static Intent getBlob(@NonNull Context context, @NonNull Uri uri) { - List segments = uri.getPathSegments(); - if (segments == null || segments.size() < 4) return null; - String segmentTwo = segments.get(2); - String extension = MimeTypeMap.getFileExtensionFromUrl(uri.toString()); - if (InputHelper.isEmpty(extension) || TextUtils.isDigitsOnly(extension)) { - Uri urlBuilder = LinkParserHelper.getBlobBuilder(uri); - return RepoFilesActivity.getIntent(context, urlBuilder.toString()); - } - if (segmentTwo.equals("blob") || segmentTwo.equals("tree")) { - Uri urlBuilder = getBlobBuilder(uri); - Logger.e(urlBuilder); - return CodeViewerActivity.createIntent(context, urlBuilder.toString(), uri.toString()); - } else { - String authority = uri.getAuthority(); - if (TextUtils.equals(authority, RAW_AUTHORITY)) { - return CodeViewerActivity.createIntent(context, uri.toString(), uri.toString()); - } - } - return null; - } - - @Nullable private static Intent getRepoIssueIntent(@NonNull Context context, @NonNull Uri uri) { - List segments = uri.getPathSegments(); - if (segments != null && segments.size() == 3 && uri.getLastPathSegment().equalsIgnoreCase("issues")) { - String owner = segments.get(0); - String repo = segments.get(1); - Uri encoded = Uri.parse(uri.toString().replace("utf8=%E2%9C%93&", "")); - if (encoded.getQueryParameter("q") != null) { - String query = encoded.getQueryParameter("q"); - return FilterIssuesActivity.getIntent(context, owner, repo, query); - } - return RepoPagerActivity.createIntent(context, repo, owner, RepoPagerMvp.ISSUES); - } - return null; - } - - @Nullable private static Intent getRepoPullRequestIntent(@NonNull Context context, @NonNull Uri uri) { - List segments = uri.getPathSegments(); - if (segments != null && segments.size() == 3 && uri.getLastPathSegment().equalsIgnoreCase("pulls")) { - String owner = segments.get(0); - String repo = segments.get(1); - Uri encoded = Uri.parse(uri.toString().replace("utf8=%E2%9C%93&", "")); - if (encoded.getQueryParameter("q") != null) { - String query = encoded.getQueryParameter("q"); - return FilterIssuesActivity.getIntent(context, owner, repo, query); - } - return RepoPagerActivity.createIntent(context, repo, owner, RepoPagerMvp.PULL_REQUEST); - } - return null; - } - - @Nullable private static Intent getReleases(@NonNull Context context, @NonNull Uri uri, boolean isEnterprise) { - List segments = uri.getPathSegments(); - if (segments != null && segments.size() > 2) { - if (uri.getPathSegments().get(2).equals("releases")) { - String owner = segments.get(0); - String repo = segments.get(1); - String tag = uri.getLastPathSegment(); - if (tag != null && !repo.equalsIgnoreCase(tag)) { - if (TextUtils.isDigitsOnly(tag)) { - return ReleasesListActivity.getIntent(context, owner, repo, InputHelper.toLong(tag), isEnterprise); - } else { - return ReleasesListActivity.getIntent(context, owner, repo, tag, isEnterprise); - } - } - return ReleasesListActivity.getIntent(context, owner, repo); - } else if (segments.size() > 3 && segments.get(3).equalsIgnoreCase("releases")) { - String owner = segments.get(1); - String repo = segments.get(2); - String tag = uri.getLastPathSegment(); - if (tag != null && !repo.equalsIgnoreCase(tag)) { - if (TextUtils.isDigitsOnly(tag)) { - return ReleasesListActivity.getIntent(context, owner, repo, InputHelper.toLong(tag), isEnterprise); - } else { - return ReleasesListActivity.getIntent(context, owner, repo, tag, isEnterprise); - } - } - return ReleasesListActivity.getIntent(context, owner, repo); - } - return null; - } - return null; - } - - @Nullable private static Intent getTrending(@NonNull Context context, @NonNull Uri uri) { - List segments = uri.getPathSegments(); - if (segments != null && !segments.isEmpty()) { - if (uri.getPathSegments().get(0).equals("trending")) { - String query = ""; - String lang = ""; - if (uri.getPathSegments().size() > 1) { - lang = uri.getPathSegments().get(1); - } - if (uri.getQueryParameterNames() != null && !uri.getQueryParameterNames().isEmpty()) { - query = uri.getQueryParameter("since"); - } - return TrendingActivity.Companion.getTrendingIntent(context, lang, query); - } - return null; - } - return null; - } - - /** - * https://github.com/owner/repo/issues/new - */ - @Nullable private static Intent getCreateIssueIntent(@NonNull Context context, @NonNull Uri uri) { - List segments = uri.getPathSegments(); - if (uri.getLastPathSegment() == null) return null; - if (segments == null || segments.size() < 3 || !uri.getLastPathSegment().equalsIgnoreCase("new")) return null; - if ("issues".equals(segments.get(2))) { - String owner = segments.get(0); - String repo = segments.get(1); - boolean isFeedback = "k0shk0sh/FastHub".equalsIgnoreCase(owner + "/" + repo); - return CreateIssueActivity.getIntent(context, owner, repo, isFeedback); - } - return null; - } - - @Nullable private static Intent getGistFile(@NonNull Context context, @NonNull Uri uri) { - if (HOST_GISTS_RAW.equalsIgnoreCase(uri.getHost())) { - return CodeViewerActivity.createIntent(context, uri.toString(), uri.toString()); - } - return null; - } - - @Nullable private static Intent getSearchIntent(@NonNull Context context, @NonNull Uri uri) { - List segments = uri.getPathSegments(); - if (segments == null || segments.size() > 1) return null; - String search = segments.get(0); - if ("search".equalsIgnoreCase(search)) { - Uri encoded = Uri.parse(uri.toString().replace("utf8=%E2%9C%93&", "")); - String query = encoded.getQueryParameter("q"); - Logger.e(encoded, query); - return SearchActivity.getIntent(context, query); - } - return null; - } -} diff --git a/app/src/main/java/com/fastaccess/provider/tasks/git/GithubActionService.java b/app/src/main/java/com/fastaccess/provider/tasks/git/GithubActionService.java deleted file mode 100644 index 9a655cc3c..000000000 --- a/app/src/main/java/com/fastaccess/provider/tasks/git/GithubActionService.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.fastaccess.provider.tasks.git; - -import android.annotation.SuppressLint; -import android.app.IntentService; -import android.app.NotificationManager; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; - -import androidx.annotation.IntDef; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.core.app.NotificationCompat; - -import com.fastaccess.R; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.RestProvider; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -import io.reactivex.disposables.CompositeDisposable; -import io.reactivex.schedulers.Schedulers; - - -/** - * Created by Kosh on 12 Mar 2017, 2:25 PM - */ -@SuppressWarnings("ResultOfMethodCallIgnored") @SuppressLint("CheckResult") -public class GithubActionService extends IntentService { - - public static final int STAR_REPO = 1; - public static final int UNSTAR_REPO = 2; - public static final int FORK_REPO = 3; - public static final int WATCH_REPO = 4; - public static final int UNWATCH_REPO = 5; - public static final int STAR_GIST = 6; - public static final int UNSTAR_GIST = 7; - public static final int FORK_GIST = 8; - private NotificationCompat.Builder notification; - private NotificationManager notificationManager; - - @IntDef({ - STAR_REPO, - UNSTAR_REPO, - FORK_REPO, - WATCH_REPO, - UNWATCH_REPO, - STAR_GIST, - UNSTAR_GIST, - FORK_GIST, - }) - @Retention(RetentionPolicy.SOURCE) @interface GitActionType {} - - public static void startForRepo(@NonNull Context context, @NonNull String login, @NonNull String repo, - @GitActionType int type, boolean isEnterprise) { - Intent intent = new Intent(context.getApplicationContext(), GithubActionService.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.ID, repo) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.EXTRA_TYPE, type) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .end()); - context.startService(intent); - } - - public static void startForGist(@NonNull Context context, @NonNull String id, @GitActionType int type, boolean isEnterprise) { - Intent intent = new Intent(context.getApplicationContext(), GithubActionService.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.ID, id) - .put(BundleConstant.EXTRA_TYPE, type) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .end()); - context.startService(intent); - } - - public GithubActionService() { - super(GithubActionService.class.getName()); - } - - @Override protected void onHandleIntent(@Nullable Intent intent) { - if (intent != null && intent.getExtras() != null) { - Bundle bundle = intent.getExtras(); - @GitActionType int type = bundle.getInt(BundleConstant.EXTRA_TYPE); - String id = bundle.getString(BundleConstant.ID); - String login = bundle.getString(BundleConstant.EXTRA); - boolean isEnterprise = bundle.getBoolean(BundleConstant.IS_ENTERPRISE); - switch (type) { - case FORK_GIST: - forkGist(id, isEnterprise); - break; - case FORK_REPO: - forkRepo(id, login, isEnterprise); - break; - case STAR_GIST: - starGist(id, isEnterprise); - break; - case STAR_REPO: - starRepo(id, login, isEnterprise); - break; - case UNSTAR_GIST: - unStarGist(id, isEnterprise); - break; - case UNSTAR_REPO: - unStarRepo(id, login, isEnterprise); - break; - case UNWATCH_REPO: - unWatchRepo(id, login, isEnterprise); - break; - case WATCH_REPO: - watchRepo(id, login, isEnterprise); - break; - } - } - } - - @Override public void onDestroy() { - super.onDestroy(); - } - - private void forkGist(@Nullable String id, boolean isEnterprise) { - if (id != null) { - String msg = getString(R.string.forking, getString(R.string.gist)); - RestProvider.getGistService(isEnterprise) - .forkGist(id) - .doOnSubscribe(disposable -> showNotification(msg)) - .subscribeOn(Schedulers.io()) - .subscribe(response -> { - }, throwable -> hideNotification(msg), () -> hideNotification(msg)); - } - } - - private void forkRepo(@Nullable String id, @Nullable String login, boolean isEnterprise) { - if (id != null && login != null) { - String msg = getString(R.string.forking, id); - RestProvider.getRepoService(isEnterprise) - .forkRepo(login, id) - .doOnSubscribe(disposable -> showNotification(msg)) - .subscribeOn(Schedulers.io()) - .subscribe(response -> { - }, throwable -> hideNotification(msg), () -> hideNotification(msg)); - } - } - - private void starGist(@Nullable String id, boolean isEnterprise) { - if (id != null) { - String msg = getString(R.string.starring, getString(R.string.gist)); - RestProvider.getGistService(isEnterprise) - .starGist(id) - .doOnSubscribe(disposable -> showNotification(msg)) - .subscribeOn(Schedulers.io()) - .subscribe(response -> { - }, throwable -> hideNotification(msg), () -> hideNotification(msg)); - } - } - - private void starRepo(@Nullable String id, @Nullable String login, boolean isEnterprise) { - if (id != null && login != null) { - String msg = getString(R.string.starring, id); - RestProvider.getRepoService(isEnterprise) - .starRepo(login, id) - .doOnSubscribe(disposable -> showNotification(msg)) - .subscribeOn(Schedulers.io()) - .subscribe(response -> { - }, throwable -> hideNotification(msg), () -> hideNotification(msg)); - } - } - - private void unStarGist(@Nullable String id, boolean isEnterprise) { - if (id != null) { - String msg = getString(R.string.un_starring, getString(R.string.gist)); - RestProvider.getGistService(isEnterprise) - .unStarGist(id) - .doOnSubscribe(disposable -> showNotification(msg)) - .subscribeOn(Schedulers.io()) - .subscribe(response -> { - }, throwable -> hideNotification(msg), () -> hideNotification(msg)); - } - } - - private void unStarRepo(@Nullable String id, @Nullable String login, boolean isEnterprise) { - if (id != null && login != null) { - String msg = getString(R.string.un_starring, id); - RestProvider.getRepoService(isEnterprise) - .unstarRepo(login, id) - .doOnSubscribe(disposable -> showNotification(msg)) - .subscribeOn(Schedulers.io()) - .subscribe(response -> { - }, throwable -> hideNotification(msg), () -> hideNotification(msg)); - } - } - - private void unWatchRepo(@Nullable String id, @Nullable String login, boolean isEnterprise) { - if (id != null && login != null) { - String msg = getString(R.string.un_watching, id); - RestProvider.getRepoService(isEnterprise) - .unwatchRepo(login, id) - .doOnSubscribe(disposable -> showNotification(msg)) - .subscribeOn(Schedulers.io()) - .subscribe(response -> { - }, throwable -> hideNotification(msg), () -> hideNotification(msg)); - } - } - - private void watchRepo(@Nullable String id, @Nullable String login, boolean isEnterprise) { - if (id != null && login != null) { - String msg = getString(R.string.watching, id); - RestProvider.getRepoService(isEnterprise) - .watchRepo(login, id) - .doOnSubscribe(disposable -> showNotification(msg)) - .subscribeOn(Schedulers.io()) - .subscribe(response -> { - }, throwable -> hideNotification(msg), () -> hideNotification(msg)); - } - } - - private NotificationCompat.Builder getNotification(@NonNull String title) { - if (notification == null) { - notification = new NotificationCompat.Builder(this, title) - .setSmallIcon(R.drawable.ic_sync) - .setProgress(0, 100, true); - } - notification.setContentTitle(title); - return notification; - } - - private NotificationManager getNotificationManager() { - if (notificationManager == null) { - notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); - } - return notificationManager; - } - - private void showNotification(@NonNull String msg) { - getNotificationManager().notify(msg.hashCode(), getNotification(msg).build()); - } - - private void hideNotification(@NonNull String msg) { - getNotificationManager().cancel(msg.hashCode()); - } -} diff --git a/app/src/main/java/com/fastaccess/provider/tasks/notification/NotificationSchedulerJobTask.java b/app/src/main/java/com/fastaccess/provider/tasks/notification/NotificationSchedulerJobTask.java deleted file mode 100644 index d587d10eb..000000000 --- a/app/src/main/java/com/fastaccess/provider/tasks/notification/NotificationSchedulerJobTask.java +++ /dev/null @@ -1,305 +0,0 @@ - -package com.fastaccess.provider.tasks.notification; - -import android.app.NotificationChannel; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.Context; -import android.content.Intent; -import android.graphics.BitmapFactory; -import android.media.AudioManager; -import android.os.Build; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.core.app.NotificationCompat; -import androidx.core.content.ContextCompat; - -import com.annimon.stream.Stream; -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.Notification; -import com.fastaccess.data.dao.model.NotificationQueue; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.provider.markdown.MarkDownProvider; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.modules.notification.NotificationActivity; -import com.firebase.jobdispatcher.Constraint; -import com.firebase.jobdispatcher.FirebaseJobDispatcher; -import com.firebase.jobdispatcher.GooglePlayDriver; -import com.firebase.jobdispatcher.Job; -import com.firebase.jobdispatcher.JobParameters; -import com.firebase.jobdispatcher.JobService; -import com.firebase.jobdispatcher.Lifetime; -import com.firebase.jobdispatcher.RetryStrategy; -import com.firebase.jobdispatcher.Trigger; - -import java.util.List; - -import io.reactivex.Observable; -import io.reactivex.schedulers.Schedulers; - -/** - * Created by Kosh on 19 Feb 2017, 6:32 PM - */ - -public class NotificationSchedulerJobTask extends JobService { - private final static String JOB_ID = "fasthub_notification"; - private final static String SINGLE_JOB_ID = "single_fasthub_notification"; - - private final static int THIRTY_MINUTES = 30 * 60; - private static final String NOTIFICATION_GROUP_ID = "FastHub"; - - @Override public boolean onStartJob(JobParameters job) { - if (!SINGLE_JOB_ID.equalsIgnoreCase(job.getTag())) { - if (PrefGetter.getNotificationTaskDuration() == -1) { - scheduleJob(this, -1, false); - finishJob(job); - return true; - } - } - Login login = null; - try { - login = Login.getUser(); - } catch (Exception ignored) {} - if (login != null) { - RestProvider.getNotificationService(PrefGetter.isEnterprise()) - .getNotifications(ParseDateFormat.getLastWeekDate()) - .subscribeOn(Schedulers.io()) - .subscribe(item -> { - AppHelper.cancelAllNotifications(getApplicationContext()); - if (item != null) { - onSave(item.getItems(), job); - } else { - finishJob(job); - } - }, throwable -> jobFinished(job, true)); - } - return true; - } - - @Override public boolean onStopJob(JobParameters jobParameters) { - return false; - } - - public static void scheduleJob(@NonNull Context context) { - int duration = PrefGetter.getNotificationTaskDuration(); - scheduleJob(context, duration, false); - } - - public static void scheduleJob(@NonNull Context context, int duration, boolean cancel) { - if (AppHelper.isGoogleAvailable(context)) { - FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(context)); - dispatcher.cancel(SINGLE_JOB_ID); - if (cancel) dispatcher.cancel(JOB_ID); - if (duration == -1) { - dispatcher.cancel(JOB_ID); - return; - } - duration = duration <= 0 ? THIRTY_MINUTES : duration; - Job.Builder builder = dispatcher - .newJobBuilder() - .setTag(JOB_ID) - .setRetryStrategy(RetryStrategy.DEFAULT_LINEAR) - .setLifetime(Lifetime.FOREVER) - .setRecurring(true) - .setConstraints(Constraint.ON_ANY_NETWORK) - .setTrigger(Trigger.executionWindow(duration / 2, duration)) - .setService(NotificationSchedulerJobTask.class); - dispatcher.mustSchedule(builder.build()); - } - } - - public static void scheduleOneTimeJob(@NonNull Context context) { - if (AppHelper.isGoogleAvailable(context)) { - FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(context)); - Job.Builder builder = dispatcher - .newJobBuilder() - .setTag(SINGLE_JOB_ID) - .setReplaceCurrent(true) - .setRecurring(false) - .setTrigger(Trigger.executionWindow(30, 60)) - .setConstraints(Constraint.ON_ANY_NETWORK) - .setService(NotificationSchedulerJobTask.class); - dispatcher.mustSchedule(builder.build()); - } - } - - private void onSave(@Nullable List notificationThreadModels, JobParameters job) { - if (notificationThreadModels != null) { - Notification.save(notificationThreadModels); - onNotifyUser(notificationThreadModels, job); - } - } - - private void onNotifyUser(@NonNull List notificationThreadModels, JobParameters job) { - long count = Stream.of(notificationThreadModels) - .filter(Notification::isUnread) - .count(); - if (count == 0) { - AppHelper.cancelAllNotifications(getApplicationContext()); - finishJob(job); - return; - } - Context context = getApplicationContext(); - int accentColor = ContextCompat.getColor(this, R.color.material_blue_700); - Notification first = notificationThreadModels.get(0); - Observable.fromIterable(notificationThreadModels) - .subscribeOn(Schedulers.io()) - .filter(notification -> notification.isUnread() && first.getId() != notification.getId() - && !NotificationQueue.exists(notification.getId())) - .take(10) - .flatMap(notification -> { - if (notification.getSubject() != null && notification.getSubject().getLatestCommentUrl() != null) { - return RestProvider.getNotificationService(PrefGetter.isEnterprise()) - .getComment(notification.getSubject().getLatestCommentUrl()) - .subscribeOn(Schedulers.io()); - } else { - return Observable.empty(); - } - }, (thread, comment) -> { - CustomNotificationModel customNotificationModel = new CustomNotificationModel(); - String url; - if (comment != null && comment.getUser() != null) { - url = comment.getUser().getAvatarUrl(); - if (!InputHelper.isEmpty(thread.getSubject().getLatestCommentUrl())) { - customNotificationModel.comment = comment; - customNotificationModel.url = url; - } - } - customNotificationModel.notification = thread; - return customNotificationModel; - }) - .subscribeOn(Schedulers.io()) - .subscribe(custom -> { - if (custom.comment != null) { - getNotificationWithComment(context, accentColor, custom.notification, custom.comment, custom.url); - } else { - showNotificationWithoutComment(context, accentColor, custom.notification, custom.url); - } - - }, throwable -> finishJob(job), () -> { - if (!NotificationQueue.exists(first.getId())) { - android.app.Notification grouped = getSummaryGroupNotification(first, accentColor, notificationThreadModels.size() > 1); - showNotification(first.getId(), grouped); - } - NotificationQueue.put(notificationThreadModels) - .subscribe(aBoolean -> {/*do nothing*/}, Throwable::printStackTrace, () -> finishJob(job)); - }); - } - - private void finishJob(JobParameters job) { - jobFinished(job, false); - } - - private void showNotificationWithoutComment(Context context, int accentColor, Notification thread, String iconUrl) { - withoutComments(thread, context, accentColor); - } - - private void withoutComments(Notification thread, Context context, int accentColor) { - android.app.Notification toAdd = getNotification(thread.getSubject().getTitle(), thread.getRepository().getFullName(), - thread.getRepository() != null ? thread.getRepository().getFullName() : "general") - .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher)) - .setContentIntent(getPendingIntent(thread.getId(), thread.getSubject().getUrl())) - .addAction(R.drawable.ic_github, context.getString(R.string.open), getPendingIntent(thread.getId(), thread - .getSubject().getUrl())) - .addAction(R.drawable.ic_eye_off, context.getString(R.string.mark_as_read), getReadOnlyPendingIntent(thread.getId(), thread - .getSubject().getUrl())) - .setWhen(thread.getUpdatedAt() != null ? thread.getUpdatedAt().getTime() : System.currentTimeMillis()) - .setShowWhen(true) - .setColor(accentColor) - .setGroup(NOTIFICATION_GROUP_ID) - .build(); - showNotification(thread.getId(), toAdd); - } - - private void getNotificationWithComment(Context context, int accentColor, Notification thread, Comment comment, String url) { - withComments(comment, context, thread, accentColor); - } - - private void withComments(Comment comment, Context context, Notification thread, int accentColor) { - android.app.Notification toAdd = getNotification(comment.getUser() != null ? comment.getUser().getLogin() : "", - MarkDownProvider.stripMdText(comment.getBody()), - thread.getRepository() != null ? thread.getRepository().getFullName() : "general") - .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher)) - .setSmallIcon(R.drawable.ic_notification) - .setStyle(new NotificationCompat.BigTextStyle() - .setBigContentTitle(comment.getUser() != null ? comment.getUser().getLogin() : "") - .bigText(MarkDownProvider.stripMdText(comment.getBody()))) - .setWhen(comment.getCreatedAt().getTime()) - .setShowWhen(true) - .addAction(R.drawable.ic_github, context.getString(R.string.open), getPendingIntent(thread.getId(), - thread.getSubject().getUrl())) - .addAction(R.drawable.ic_eye_off, context.getString(R.string.mark_as_read), getReadOnlyPendingIntent(thread.getId(), - thread.getSubject().getUrl())) - .setContentIntent(getPendingIntent(thread.getId(), thread.getSubject().getUrl())) - .setColor(accentColor) - .setGroup(NOTIFICATION_GROUP_ID) - .build(); - showNotification(thread.getId(), toAdd); - } - - private android.app.Notification getSummaryGroupNotification(@NonNull Notification thread, int accentColor, boolean toNotificationActivity) { - PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, - new Intent(getApplicationContext(), NotificationActivity.class), PendingIntent.FLAG_UPDATE_CURRENT); - NotificationCompat.Builder builder = getNotification(thread.getSubject().getTitle(), thread.getRepository().getFullName(), - thread.getRepository() != null ? thread.getRepository().getFullName() : "general") - .setContentIntent(toNotificationActivity ? pendingIntent : getPendingIntent(thread.getId(), thread.getSubject().getUrl())) - .addAction(R.drawable.ic_github, getString(R.string.open), getPendingIntent(thread.getId(), thread - .getSubject().getUrl())) - .addAction(R.drawable.ic_eye_off, getString(R.string.mark_as_read), getReadOnlyPendingIntent(thread.getId(), thread - .getSubject().getUrl())) - .setWhen(thread.getUpdatedAt() != null ? thread.getUpdatedAt().getTime() : System.currentTimeMillis()) - .setShowWhen(true) - .setSmallIcon(R.drawable.ic_notification) - .setColor(accentColor) - .setGroup(NOTIFICATION_GROUP_ID) - .setGroupSummary(true); - if (PrefGetter.isNotificationSoundEnabled()) { - builder.setDefaults(NotificationCompat.DEFAULT_ALL) - .setSound(PrefGetter.getNotificationSound(), AudioManager.STREAM_NOTIFICATION); - } - return builder.build(); - } - - private NotificationCompat.Builder getNotification(@NonNull String title, @NonNull String message, @NonNull String channelName) { - return new NotificationCompat.Builder(this, channelName) - .setContentTitle(title) - .setContentText(message) - .setAutoCancel(true); - } - - private void showNotification(long id, android.app.Notification notification) { - NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - if (notificationManager != null) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel notificationChannel = new NotificationChannel(notification.getChannelId(), - notification.getChannelId(), NotificationManager.IMPORTANCE_DEFAULT); - notificationChannel.setShowBadge(true); - notificationManager.createNotificationChannel(notificationChannel); - } - notificationManager.notify(InputHelper.getSafeIntId(id), notification); - } - } - - private PendingIntent getReadOnlyPendingIntent(long id, @NonNull String url) { - Intent intent = ReadNotificationService.start(getApplicationContext(), id, url, true); - return PendingIntent.getService(getApplicationContext(), InputHelper.getSafeIntId(id) / 2, intent, - PendingIntent.FLAG_UPDATE_CURRENT); - } - - private PendingIntent getPendingIntent(long id, @NonNull String url) { - Intent intent = ReadNotificationService.start(getApplicationContext(), id, url); - return PendingIntent.getService(getApplicationContext(), InputHelper.getSafeIntId(id), intent, - PendingIntent.FLAG_UPDATE_CURRENT); - } - - private static class CustomNotificationModel { - public String url; - public Notification notification; - public Comment comment; - } -} diff --git a/app/src/main/java/com/fastaccess/provider/tasks/notification/ReadNotificationService.java b/app/src/main/java/com/fastaccess/provider/tasks/notification/ReadNotificationService.java deleted file mode 100644 index 07c751bc0..000000000 --- a/app/src/main/java/com/fastaccess/provider/tasks/notification/ReadNotificationService.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.fastaccess.provider.tasks.notification; - -import android.app.IntentService; -import android.app.Notification; -import android.app.NotificationManager; -import android.content.Context; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.core.app.NotificationCompat; - -import com.annimon.stream.LongStream; -import com.fastaccess.R; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.scheme.SchemeParser; - -import io.reactivex.Observable; -import io.reactivex.schedulers.Schedulers; - -/** - * Created by Kosh on 11 Mar 2017, 12:13 AM - */ - -public class ReadNotificationService extends IntentService { - - public static final int READ_SINGLE = 1; - public static final int READ_ALL = 2; - public static final int OPEN_NOTIFICATION = 3; - public static final int UN_SUBSCRIBE = 4; - private NotificationCompat.Builder notification; - private NotificationManager notificationManager; - - public static void start(@NonNull Context context, long id) { - Intent intent = new Intent(context.getApplicationContext(), ReadNotificationService.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA_TYPE, READ_SINGLE) - .put(BundleConstant.ID, id) - .end()); - context.startService(intent); - } - - public static Intent start(@NonNull Context context, long id, @NonNull String url) { - return start(context, id, url, false); - } - - public static Intent start(@NonNull Context context, long id, @NonNull String url, boolean onlyRead) { - Intent intent = new Intent(context.getApplicationContext(), ReadNotificationService.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA_TYPE, OPEN_NOTIFICATION) - .put(BundleConstant.EXTRA, url) - .put(BundleConstant.ID, id) - .put(BundleConstant.YES_NO_EXTRA, onlyRead) - .end()); - return intent; - } - - public static void unSubscribe(@NonNull Context context, long id) { - Intent intent = new Intent(context.getApplicationContext(), ReadNotificationService.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA_TYPE, UN_SUBSCRIBE) - .put(BundleConstant.ID, id) - .end()); - context.startService(intent); - } - - public static void start(@NonNull Context context, @NonNull long[] ids) { - Intent intent = new Intent(context.getApplicationContext(), ReadNotificationService.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA_TYPE, READ_ALL) - .put(BundleConstant.ID, ids) - .end()); - context.startService(intent); - } - - public ReadNotificationService() { - super(ReadNotificationService.class.getSimpleName()); - } - - @Override public void onCreate() { - super.onCreate(); - notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); - } - - @Override protected void onHandleIntent(@Nullable Intent intent) { - if (intent != null && intent.getExtras() != null) { - Bundle bundle = intent.getExtras(); - int type = bundle.getInt(BundleConstant.EXTRA_TYPE); - if (type == READ_SINGLE) { - markSingleAsRead(bundle.getLong(BundleConstant.ID)); - } else if (type == READ_ALL) { - markMultiAsRead(bundle.getLongArray(BundleConstant.ID)); - } else if (type == OPEN_NOTIFICATION) { - openNotification(bundle.getLong(BundleConstant.ID), bundle.getString(BundleConstant.EXTRA), - bundle.getBoolean(BundleConstant.YES_NO_EXTRA)); - } else if (type == UN_SUBSCRIBE) { - unSubscribeFromThread(bundle.getLong(BundleConstant.ID)); - } - } - } - - private void unSubscribeFromThread(long id) { - RestProvider.getNotificationService(PrefGetter.isEnterprise()) - .unSubscribe(id) - .doOnSubscribe(disposable -> notify(id, getNotification().build())) - .subscribeOn(Schedulers.io()) - .flatMap(notification1 -> Observable.create(subscriber -> markSingleAsRead(id))) - .subscribe(booleanResponse -> cancel(id), throwable -> cancel(id)); - } - - private void openNotification(long id, @Nullable String url, boolean readOnly) { - if (id > 0 && url != null) { - AppHelper.cancelNotification(this, InputHelper.getSafeIntId(id)); - if (readOnly) { - markSingleAsRead(id); - } else if (!PrefGetter.isMarkAsReadEnabled()) { - markSingleAsRead(id); - } - if (!readOnly) { - SchemeParser.launchUri(getApplicationContext(), Uri.parse(url), true, true); - } - } - } - - private void markMultiAsRead(@Nullable long[] ids) { - if (ids != null && ids.length > 0) { - LongStream.of(ids).forEach(this::markSingleAsRead); - } - } - - private void markSingleAsRead(long id) { - com.fastaccess.data.dao.model.Notification.markAsRead(id); - RestProvider.getNotificationService(PrefGetter.isEnterprise()) - .markAsRead(String.valueOf(id)) - .doOnSubscribe(disposable -> notify(id, getNotification().build())) - .subscribeOn(Schedulers.io()) - .subscribe(booleanResponse -> cancel(id), throwable -> cancel(id)); - } - - private NotificationCompat.Builder getNotification() { - if (notification == null) { - notification = new NotificationCompat.Builder(this, "read-notification") - .setContentTitle(getString(R.string.marking_as_read)) - .setSmallIcon(R.drawable.ic_sync) - .setProgress(0, 100, true); - } - return notification; - } - - private void notify(long id, Notification notification) { - notificationManager.notify(InputHelper.getSafeIntId(id), notification); - } - - private void cancel(long id) { - notificationManager.cancel(InputHelper.getSafeIntId(id)); - } -} diff --git a/app/src/main/java/com/fastaccess/provider/tasks/version/CheckVersionService.kt b/app/src/main/java/com/fastaccess/provider/tasks/version/CheckVersionService.kt deleted file mode 100644 index a40a753bc..000000000 --- a/app/src/main/java/com/fastaccess/provider/tasks/version/CheckVersionService.kt +++ /dev/null @@ -1,28 +0,0 @@ -package com.fastaccess.provider.tasks.version - -import android.app.IntentService -import android.content.Intent -import android.widget.Toast -import com.fastaccess.App -import com.fastaccess.BuildConfig -import com.fastaccess.R -import com.fastaccess.data.dao.model.Release -import com.fastaccess.helper.RxHelper -import com.fastaccess.provider.rest.RestProvider - -/** - * Created by Kosh on 09 Jun 2017, 9:02 PM - */ -class CheckVersionService : IntentService("CheckVersionService") { - - override fun onHandleIntent(p0: Intent?) { - RxHelper.getObservable(RestProvider.getRepoService(false) - .getLatestRelease("k0shk0sh", "FastHub")) - .subscribe({ t: Release? -> - t?.let { - Toast.makeText(App.getInstance(), if (BuildConfig.VERSION_NAME.contains(it.tagName)) - R.string.up_to_date else R.string.new_version, Toast.LENGTH_LONG).show() - } - }, { throwable -> throwable.printStackTrace() }) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/provider/theme/ThemeEngine.kt b/app/src/main/java/com/fastaccess/provider/theme/ThemeEngine.kt deleted file mode 100644 index 7dab67f55..000000000 --- a/app/src/main/java/com/fastaccess/provider/theme/ThemeEngine.kt +++ /dev/null @@ -1,270 +0,0 @@ -package com.fastaccess.provider.theme - -import android.app.Activity -import android.app.ActivityManager -import android.graphics.BitmapFactory -import androidx.annotation.StyleRes -import com.danielstone.materialaboutlibrary.MaterialAboutActivity -import com.fastaccess.R -import com.fastaccess.helper.Logger -import com.fastaccess.helper.PrefGetter -import com.fastaccess.helper.ViewHelper -import com.fastaccess.ui.base.BaseActivity -import com.fastaccess.ui.modules.login.LoginActivity -import com.fastaccess.ui.modules.login.chooser.LoginChooserActivity -import com.fastaccess.ui.modules.main.donation.DonateActivity - -/** - * Created by Kosh on 07 Jun 2017, 6:52 PM - */ - -object ThemeEngine { - - fun apply(activity: BaseActivity<*, *>) { - if (hasTheme(activity)) { - return - } - val themeMode = PrefGetter.getThemeType(activity) - val themeColor = PrefGetter.getThemeColor(activity) - activity.setTheme(getTheme(themeMode, themeColor)) - setTaskDescription(activity) - applyNavBarColor(activity) - } - - private fun applyNavBarColor(activity: Activity) { - if (!PrefGetter.isNavBarTintingDisabled() && PrefGetter.getThemeType() != PrefGetter.LIGHT) { - activity.window.navigationBarColor = ViewHelper.getPrimaryColor(activity) - } - } - - fun applyForAbout(activity: MaterialAboutActivity) { - val themeMode = PrefGetter.getThemeType(activity) - when (themeMode) { - PrefGetter.LIGHT -> activity.setTheme(R.style.AppTheme_AboutActivity_Light) - PrefGetter.DARK -> activity.setTheme(R.style.AppTheme_AboutActivity_Dark) - PrefGetter.AMLOD -> activity.setTheme(R.style.AppTheme_AboutActivity_Amlod) - PrefGetter.MID_NIGHT_BLUE -> activity.setTheme(R.style.AppTheme_AboutActivity_Midnight) - PrefGetter.BLUISH -> activity.setTheme(R.style.AppTheme_AboutActivity_Bluish) - } - setTaskDescription(activity) - } - - fun applyDialogTheme(activity: BaseActivity<*, *>) { - val themeMode = PrefGetter.getThemeType(activity) - val themeColor = PrefGetter.getThemeColor(activity) - activity.setTheme(getDialogTheme(themeMode, themeColor)) - setTaskDescription(activity) - } - - @StyleRes private fun getTheme(themeMode: Int, themeColor: Int): Int { - Logger.e(themeMode, themeColor) - // I wish if I could simplify this :'( too many cases for the love of god. - when (themeMode) { - PrefGetter.LIGHT -> when (themeColor) { - PrefGetter.RED -> return R.style.ThemeLight_Red - PrefGetter.PINK -> return R.style.ThemeLight_Pink - PrefGetter.PURPLE -> return R.style.ThemeLight_Purple - PrefGetter.DEEP_PURPLE -> return R.style.ThemeLight_DeepPurple - PrefGetter.INDIGO -> return R.style.ThemeLight_Indigo - PrefGetter.BLUE -> return R.style.ThemeLight - PrefGetter.LIGHT_BLUE -> return R.style.ThemeLight_LightBlue - PrefGetter.CYAN -> return R.style.ThemeLight_Cyan - PrefGetter.TEAL -> return R.style.ThemeLight_Teal - PrefGetter.GREEN -> return R.style.ThemeLight_Green - PrefGetter.LIGHT_GREEN -> return R.style.ThemeLight_LightGreen - PrefGetter.LIME -> return R.style.ThemeLight_Lime - PrefGetter.YELLOW -> return R.style.ThemeLight_Yellow - PrefGetter.AMBER -> return R.style.ThemeLight_Amber - PrefGetter.ORANGE -> return R.style.ThemeLight_Orange - PrefGetter.DEEP_ORANGE -> return R.style.ThemeLight_DeepOrange - else -> return R.style.ThemeLight - } - PrefGetter.DARK -> when (themeColor) { - PrefGetter.RED -> return R.style.ThemeDark_Red - PrefGetter.PINK -> return R.style.ThemeDark_Pink - PrefGetter.PURPLE -> return R.style.ThemeDark_Purple - PrefGetter.DEEP_PURPLE -> return R.style.ThemeDark_DeepPurple - PrefGetter.INDIGO -> return R.style.ThemeDark_Indigo - PrefGetter.BLUE -> return R.style.ThemeDark - PrefGetter.LIGHT_BLUE -> return R.style.ThemeDark_LightBlue - PrefGetter.CYAN -> return R.style.ThemeDark_Cyan - PrefGetter.GREEN -> return R.style.ThemeDark_Green - PrefGetter.TEAL -> return R.style.ThemeDark_Teal - PrefGetter.LIGHT_GREEN -> return R.style.ThemeDark_LightGreen - PrefGetter.LIME -> return R.style.ThemeDark_Lime - PrefGetter.YELLOW -> return R.style.ThemeDark_Yellow - PrefGetter.AMBER -> return R.style.ThemeDark_Amber - PrefGetter.ORANGE -> return R.style.ThemeDark_Orange - PrefGetter.DEEP_ORANGE -> return R.style.ThemeDark_DeepOrange - else -> return R.style.ThemeDark - } - PrefGetter.AMLOD -> when (themeColor) { - PrefGetter.RED -> return R.style.ThemeAmlod_Red - PrefGetter.PINK -> return R.style.ThemeAmlod_Pink - PrefGetter.PURPLE -> return R.style.ThemeAmlod_Purple - PrefGetter.DEEP_PURPLE -> return R.style.ThemeAmlod_DeepPurple - PrefGetter.INDIGO -> return R.style.ThemeAmlod_Indigo - PrefGetter.BLUE -> return R.style.ThemeAmlod - PrefGetter.LIGHT_BLUE -> return R.style.ThemeAmlod_LightBlue - PrefGetter.CYAN -> return R.style.ThemeAmlod_Cyan - PrefGetter.TEAL -> return R.style.ThemeAmlod_Teal - PrefGetter.GREEN -> return R.style.ThemeAmlod_Green - PrefGetter.LIGHT_GREEN -> return R.style.ThemeAmlod_LightGreen - PrefGetter.LIME -> return R.style.ThemeAmlod_Lime - PrefGetter.YELLOW -> return R.style.ThemeAmlod_Yellow - PrefGetter.AMBER -> return R.style.ThemeAmlod_Amber - PrefGetter.ORANGE -> return R.style.ThemeAmlod_Orange - PrefGetter.DEEP_ORANGE -> return R.style.ThemeAmlod_DeepOrange - else -> return R.style.ThemeAmlod - } - PrefGetter.MID_NIGHT_BLUE -> when (themeColor) { - PrefGetter.RED -> return R.style.ThemeMidnight_Red - PrefGetter.PINK -> return R.style.ThemeMidnight_Pink - PrefGetter.PURPLE -> return R.style.ThemeMidnight_Purple - PrefGetter.DEEP_PURPLE -> return R.style.ThemeMidnight_DeepPurple - PrefGetter.INDIGO -> return R.style.ThemeMidnight_Indigo - PrefGetter.BLUE -> return R.style.ThemeMidnight - PrefGetter.LIGHT_BLUE -> return R.style.ThemeMidnight_LightBlue - PrefGetter.CYAN -> return R.style.ThemeMidnight_Cyan - PrefGetter.TEAL -> return R.style.ThemeMidnight_Teal - PrefGetter.GREEN -> return R.style.ThemeMidnight_Green - PrefGetter.LIGHT_GREEN -> return R.style.ThemeMidnight_LightGreen - PrefGetter.LIME -> return R.style.ThemeMidnight_Lime - PrefGetter.YELLOW -> return R.style.ThemeMidnight_Yellow - PrefGetter.AMBER -> return R.style.ThemeMidnight_Amber - PrefGetter.ORANGE -> return R.style.ThemeMidnight_Orange - PrefGetter.DEEP_ORANGE -> return R.style.ThemeMidnight_DeepOrange - else -> return R.style.ThemeMidnight - } - PrefGetter.BLUISH -> when (themeColor) { - PrefGetter.RED -> return R.style.ThemeBluish_Red - PrefGetter.PINK -> return R.style.ThemeBluish_Pink - PrefGetter.PURPLE -> return R.style.ThemeBluish_Purple - PrefGetter.DEEP_PURPLE -> return R.style.ThemeBluish_DeepPurple - PrefGetter.INDIGO -> return R.style.ThemeBluish_Indigo - PrefGetter.BLUE -> return R.style.ThemeBluish - PrefGetter.LIGHT_BLUE -> return R.style.ThemeBluish_LightBlue - PrefGetter.CYAN -> return R.style.ThemeBluish_Cyan - PrefGetter.TEAL -> return R.style.ThemeBluish_Teal - PrefGetter.GREEN -> return R.style.ThemeBluish_Green - PrefGetter.LIGHT_GREEN -> return R.style.ThemeBluish_LightGreen - PrefGetter.LIME -> return R.style.ThemeBluish_Lime - PrefGetter.YELLOW -> return R.style.ThemeBluish_Yellow - PrefGetter.AMBER -> return R.style.ThemeBluish_Amber - PrefGetter.ORANGE -> return R.style.ThemeBluish_Orange - PrefGetter.DEEP_ORANGE -> return R.style.ThemeBluish_DeepOrange - else -> return R.style.ThemeBluish - } - } - return R.style.ThemeLight - } - - @StyleRes private fun getDialogTheme(themeMode: Int, themeColor: Int): Int { - when (themeMode) { - PrefGetter.LIGHT -> when (themeColor) { - PrefGetter.RED -> return R.style.DialogThemeLight_Red - PrefGetter.PINK -> return R.style.DialogThemeLight_Pink - PrefGetter.PURPLE -> return R.style.DialogThemeLight_Purple - PrefGetter.DEEP_PURPLE -> return R.style.DialogThemeLight_DeepPurple - PrefGetter.INDIGO -> return R.style.DialogThemeLight_Indigo - PrefGetter.BLUE -> return R.style.DialogThemeLight - PrefGetter.LIGHT_BLUE -> return R.style.DialogThemeLight_LightBlue - PrefGetter.CYAN -> return R.style.DialogThemeLight_Cyan - PrefGetter.TEAL -> return R.style.DialogThemeLight_Teal - PrefGetter.GREEN -> return R.style.DialogThemeLight_Green - PrefGetter.LIGHT_GREEN -> return R.style.DialogThemeLight_LightGreen - PrefGetter.LIME -> return R.style.DialogThemeLight_Lime - PrefGetter.YELLOW -> return R.style.DialogThemeLight_Yellow - PrefGetter.AMBER -> return R.style.DialogThemeLight_Amber - PrefGetter.ORANGE -> return R.style.DialogThemeLight_Orange - PrefGetter.DEEP_ORANGE -> return R.style.DialogThemeLight_DeepOrange - else -> return R.style.DialogThemeLight - } - PrefGetter.DARK -> when (themeColor) { - PrefGetter.RED -> return R.style.DialogThemeDark_Red - PrefGetter.PINK -> return R.style.DialogThemeDark_Pink - PrefGetter.PURPLE -> return R.style.DialogThemeDark_Purple - PrefGetter.DEEP_PURPLE -> return R.style.DialogThemeDark_DeepPurple - PrefGetter.INDIGO -> return R.style.DialogThemeDark_Indigo - PrefGetter.BLUE -> return R.style.DialogThemeDark - PrefGetter.LIGHT_BLUE -> return R.style.DialogThemeDark_LightBlue - PrefGetter.CYAN -> return R.style.DialogThemeDark_Cyan - PrefGetter.TEAL -> return R.style.DialogThemeDark_Teal - PrefGetter.GREEN -> return R.style.DialogThemeDark_Green - PrefGetter.LIGHT_GREEN -> return R.style.DialogThemeDark_LightGreen - PrefGetter.LIME -> return R.style.DialogThemeDark_Lime - PrefGetter.YELLOW -> return R.style.DialogThemeDark_Yellow - PrefGetter.AMBER -> return R.style.DialogThemeDark_Amber - PrefGetter.ORANGE -> return R.style.DialogThemeDark_Orange - PrefGetter.DEEP_ORANGE -> return R.style.DialogThemeDark_DeepOrange - else -> return R.style.DialogThemeDark - } - PrefGetter.AMLOD -> when (themeColor) { - PrefGetter.RED -> return R.style.DialogThemeAmlod_Red - PrefGetter.PINK -> return R.style.DialogThemeAmlod_Pink - PrefGetter.PURPLE -> return R.style.DialogThemeAmlod_Purple - PrefGetter.DEEP_PURPLE -> return R.style.DialogThemeAmlod_DeepPurple - PrefGetter.INDIGO -> return R.style.DialogThemeAmlod_Indigo - PrefGetter.BLUE -> return R.style.DialogThemeAmlod - PrefGetter.LIGHT_BLUE -> return R.style.DialogThemeAmlod_LightBlue - PrefGetter.CYAN -> return R.style.DialogThemeAmlod_Cyan - PrefGetter.TEAL -> return R.style.DialogThemeAmlod_Teal - PrefGetter.GREEN -> return R.style.DialogThemeAmlod_Green - PrefGetter.LIGHT_GREEN -> return R.style.DialogThemeAmlod_LightGreen - PrefGetter.LIME -> return R.style.DialogThemeAmlod_Lime - PrefGetter.YELLOW -> return R.style.DialogThemeAmlod_Yellow - PrefGetter.AMBER -> return R.style.DialogThemeAmlod_Amber - PrefGetter.ORANGE -> return R.style.DialogThemeAmlod_Orange - PrefGetter.DEEP_ORANGE -> return R.style.DialogThemeAmlod_DeepOrange - else -> return R.style.DialogThemeAmlod - } - PrefGetter.MID_NIGHT_BLUE -> when (themeColor) { - PrefGetter.RED -> return R.style.DialogThemeMidnight_Red - PrefGetter.PINK -> return R.style.DialogThemeMidnight_Pink - PrefGetter.PURPLE -> return R.style.DialogThemeMidnight_Purple - PrefGetter.DEEP_PURPLE -> return R.style.DialogThemeMidnight_DeepPurple - PrefGetter.INDIGO -> return R.style.DialogThemeMidnight_Indigo - PrefGetter.BLUE -> return R.style.DialogThemeMidnight - PrefGetter.LIGHT_BLUE -> return R.style.DialogThemeMidnight_LightBlue - PrefGetter.CYAN -> return R.style.DialogThemeMidnight_Cyan - PrefGetter.TEAL -> return R.style.DialogThemeMidnight_Teal - PrefGetter.GREEN -> return R.style.DialogThemeMidnight_Green - PrefGetter.LIGHT_GREEN -> return R.style.DialogThemeMidnight_LightGreen - PrefGetter.LIME -> return R.style.DialogThemeMidnight_Lime - PrefGetter.YELLOW -> return R.style.DialogThemeMidnight_Yellow - PrefGetter.AMBER -> return R.style.DialogThemeMidnight_Amber - PrefGetter.ORANGE -> return R.style.DialogThemeMidnight_Orange - PrefGetter.DEEP_ORANGE -> return R.style.DialogThemeMidnight_DeepOrange - else -> return R.style.DialogThemeLight - } - PrefGetter.BLUISH -> when (themeColor) { - PrefGetter.RED -> return R.style.DialogThemeBluish_Red - PrefGetter.PINK -> return R.style.DialogThemeBluish_Pink - PrefGetter.PURPLE -> return R.style.DialogThemeBluish_Purple - PrefGetter.DEEP_PURPLE -> return R.style.DialogThemeBluish_DeepPurple - PrefGetter.INDIGO -> return R.style.DialogThemeBluish_Indigo - PrefGetter.BLUE -> return R.style.DialogThemeBluish - PrefGetter.LIGHT_BLUE -> return R.style.DialogThemeBluish_LightBlue - PrefGetter.CYAN -> return R.style.DialogThemeBluish_Cyan - PrefGetter.TEAL -> return R.style.DialogThemeBluish_Teal - PrefGetter.GREEN -> return R.style.DialogThemeBluish_Green - PrefGetter.LIGHT_GREEN -> return R.style.DialogThemeBluish_LightGreen - PrefGetter.LIME -> return R.style.DialogThemeBluish_Lime - PrefGetter.YELLOW -> return R.style.DialogThemeBluish_Yellow - PrefGetter.AMBER -> return R.style.DialogThemeBluish_Amber - PrefGetter.ORANGE -> return R.style.DialogThemeBluish_Orange - PrefGetter.DEEP_ORANGE -> return R.style.DialogThemeBluish_DeepOrange - else -> return R.style.DialogThemeBluish - } - } - return R.style.DialogThemeLight - } - - private fun setTaskDescription(activity: Activity) { - activity.setTaskDescription(ActivityManager.TaskDescription(activity.getString(R.string.app_name), - BitmapFactory.decodeResource(activity.resources, R.mipmap.ic_launcher), ViewHelper.getPrimaryColor(activity))) - } - - private fun hasTheme(activity: BaseActivity<*, *>) = (activity is LoginChooserActivity || activity is LoginActivity || - activity is DonateActivity) -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/provider/timeline/CommentsHelper.java b/app/src/main/java/com/fastaccess/provider/timeline/CommentsHelper.java deleted file mode 100644 index 9b9dba3f9..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/CommentsHelper.java +++ /dev/null @@ -1,193 +0,0 @@ -package com.fastaccess.provider.timeline; - -import android.view.View; -import android.widget.TextView; - -import com.annimon.stream.Collectors; -import com.annimon.stream.Stream; -import com.fastaccess.data.dao.ReactionsModel; -import com.fastaccess.data.dao.TimelineModel; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.types.ReactionTypes; -import com.fastaccess.ui.widgets.SpannableBuilder; - -import java.util.ArrayList; -import java.util.List; - -import androidx.annotation.NonNull; - -/** - * Created by Kosh on 30 Mar 2017, 6:44 PM - */ - -public class CommentsHelper { - - private static final int LAUGH = 0x1F601; - private static final int SAD = 0x1F615; - private static final int THUMBS_UP = 0x1f44d; - private static final int THUMBS_DOWN = 0x1f44e; - private static final int HOORAY = 0x1f389; - private static final int HEART = 0x2764; - private static final int ROCKET = 0x1f680; - private static final int EYES = 0x1f440; - - - public static boolean isOwner(@NonNull String currentLogin, @NonNull String repoOwner, @NonNull String commentUser) { - return currentLogin.equalsIgnoreCase(repoOwner) || currentLogin.equalsIgnoreCase(commentUser); - } - - private static String getEmojiByUnicode(int unicode) { - return new String(Character.toChars(unicode)); - } - - public static String getEmoji(@NonNull ReactionTypes reactionTypes) { - switch (reactionTypes) { - case HEART: - return getHeart(); - case HOORAY: - return getHooray(); - case MINUS_ONE: - return getThumbsDown(); - case CONFUSED: - return getSad(); - case LAUGH: - return getLaugh(); - case ROCKET: - return getRocket(); - case EYES: - return getEyes(); - default: - return getThumbsUp(); - } - } - - public static String getLaugh() { - return getEmojiByUnicode(LAUGH); - } - - public static String getSad() { - return getEmojiByUnicode(SAD); - } - - public static String getThumbsUp() { - return getEmojiByUnicode(THUMBS_UP); - } - - public static String getThumbsDown() { - return getEmojiByUnicode(THUMBS_DOWN); - } - - public static String getHooray() { - return getEmojiByUnicode(HOORAY); - } - - public static String getHeart() { - return getEmojiByUnicode(HEART); - } - - public static String getRocket() { - return getEmojiByUnicode(ROCKET); - } - - public static String getEyes() { - return getEmojiByUnicode(EYES); - } - - @NonNull public static ArrayList getUsers(@NonNull List comments) { - return Stream.of(comments) - .filter(comment -> comment.getUser() != null) - .map(comment -> comment.getUser().getLogin()) - .distinct() - .collect(Collectors.toCollection(ArrayList::new)); - } - - @NonNull public static ArrayList getUsersByTimeline(@NonNull List comments) { - return Stream.of(comments) - .filter(timelineModel -> timelineModel.getComment() != null && timelineModel.getComment().getUser() != null) - .map(comment -> comment.getComment().getUser().getLogin()) - .distinct() - .collect(Collectors.toCollection(ArrayList::new)); - } - - public static void appendEmojies( - @NonNull ReactionsModel reaction, @NonNull TextView thumbsUp, - @NonNull TextView thumbsUpReaction, @NonNull TextView thumbsDown, - @NonNull TextView thumbsDownReaction, @NonNull TextView hurray, - @NonNull TextView hurrayReaction, @NonNull TextView sad, - @NonNull TextView sadReaction, @NonNull TextView laugh, - @NonNull TextView laughReaction, @NonNull TextView heart, - @NonNull TextView heartReaction, @NonNull TextView rocket, - @NonNull TextView rocketReaction, @NonNull TextView eye, - @NonNull TextView eyeReaction, @NonNull View reactionsList - ) { - SpannableBuilder spannableBuilder = SpannableBuilder.builder() - .append(CommentsHelper.getThumbsUp()).append(" ") - .append(String.valueOf(reaction.getPlusOne())) - .append(" "); - thumbsUp.setText(spannableBuilder); - thumbsUpReaction.setText(spannableBuilder); - thumbsUpReaction.setVisibility(reaction.getPlusOne() > 0 ? View.VISIBLE : View.GONE); - spannableBuilder = SpannableBuilder.builder() - .append(CommentsHelper.getThumbsDown()).append(" ") - .append(String.valueOf(reaction.getMinusOne())) - .append(" "); - thumbsDown.setText(spannableBuilder); - thumbsDownReaction.setText(spannableBuilder); - thumbsDownReaction.setVisibility(reaction.getMinusOne() > 0 ? View.VISIBLE : View.GONE); - spannableBuilder = SpannableBuilder.builder() - .append(CommentsHelper.getHooray()).append(" ") - .append(String.valueOf(reaction.getHooray())) - .append(" "); - hurray.setText(spannableBuilder); - hurrayReaction.setText(spannableBuilder); - hurrayReaction.setVisibility(reaction.getHooray() > 0 ? View.VISIBLE : View.GONE); - spannableBuilder = SpannableBuilder.builder() - .append(CommentsHelper.getSad()).append(" ") - .append(String.valueOf(reaction.getConfused())) - .append(" "); - sad.setText(spannableBuilder); - sadReaction.setText(spannableBuilder); - sadReaction.setVisibility(reaction.getConfused() > 0 ? View.VISIBLE : View.GONE); - spannableBuilder = SpannableBuilder.builder() - .append(CommentsHelper.getLaugh()).append(" ") - .append(String.valueOf(reaction.getLaugh())) - .append(" "); - laugh.setText(spannableBuilder); - laughReaction.setText(spannableBuilder); - laughReaction.setVisibility(reaction.getLaugh() > 0 ? View.VISIBLE : View.GONE); - spannableBuilder = SpannableBuilder.builder() - .append(CommentsHelper.getHeart()).append(" ") - .append(String.valueOf(reaction.getHeart())) - .append(" "); - heart.setText(spannableBuilder); - heartReaction.setText(spannableBuilder); - heartReaction.setVisibility(reaction.getHeart() > 0 ? View.VISIBLE : View.GONE); - - spannableBuilder = SpannableBuilder.builder() - .append(CommentsHelper.getRocket()).append(" ") - .append(String.valueOf(reaction.getRocket())) - .append(" "); - rocket.setText(spannableBuilder); - rocketReaction.setText(spannableBuilder); - rocketReaction.setVisibility(reaction.getRocket() > 0 ? View.VISIBLE : View.GONE); - - spannableBuilder = SpannableBuilder.builder() - .append(CommentsHelper.getEyes()).append(" ") - .append(String.valueOf(reaction.getEyes())); - eye.setText(spannableBuilder); - eyeReaction.setText(spannableBuilder); - eyeReaction.setVisibility(reaction.getEyes() > 0 ? View.VISIBLE : View.GONE); - - if (reaction.getPlusOne() > 0 || reaction.getMinusOne() > 0 - || reaction.getLaugh() > 0 || reaction.getHooray() > 0 - || reaction.getConfused() > 0 || reaction.getHeart() > 0) { - reactionsList.setVisibility(View.VISIBLE); - reactionsList.setTag(true); - } else { - reactionsList.setVisibility(View.GONE); - reactionsList.setTag(false); - } - } - - -} diff --git a/app/src/main/java/com/fastaccess/provider/timeline/HtmlHelper.java b/app/src/main/java/com/fastaccess/provider/timeline/HtmlHelper.java deleted file mode 100644 index 828e76437..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/HtmlHelper.java +++ /dev/null @@ -1,207 +0,0 @@ -package com.fastaccess.provider.timeline; - - -import android.graphics.Color; -import android.graphics.drawable.Drawable; -import android.net.Uri; -import androidx.annotation.ColorInt; -import androidx.annotation.NonNull; -import androidx.core.content.ContextCompat; -import android.view.HapticFeedbackConstants; -import android.widget.PopupMenu; -import android.widget.TextView; - -import com.fastaccess.R; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.provider.timeline.handler.BetterLinkMovementExtended; -import com.fastaccess.provider.timeline.handler.DrawableHandler; -import com.fastaccess.provider.timeline.handler.EmojiHandler; -import com.fastaccess.provider.timeline.handler.HeaderHandler; -import com.fastaccess.provider.timeline.handler.HrHandler; -import com.fastaccess.provider.timeline.handler.ItalicHandler; -import com.fastaccess.provider.timeline.handler.LinkHandler; -import com.fastaccess.provider.timeline.handler.ListsHandler; -import com.fastaccess.provider.timeline.handler.MarginHandler; -import com.fastaccess.provider.timeline.handler.PreTagHandler; -import com.fastaccess.provider.timeline.handler.QuoteHandler; -import com.fastaccess.provider.timeline.handler.StrikethroughHandler; -import com.fastaccess.provider.timeline.handler.SubScriptHandler; -import com.fastaccess.provider.timeline.handler.SuperScriptHandler; -import com.fastaccess.provider.timeline.handler.TableHandler; -import com.fastaccess.provider.timeline.handler.UnderlineHandler; - -import net.nightwhistler.htmlspanner.HtmlSpanner; -import net.nightwhistler.htmlspanner.handlers.BoldHandler; - - -/** - * Created by Kosh on 21 Apr 2017, 11:24 PM - */ - -public class HtmlHelper { - - public static void htmlIntoTextView(@NonNull TextView textView, @NonNull String html, int width) { - registerClickEvent(textView); - textView.setText(initHtml(textView, width).fromHtml(format(html).toString())); - } - - private static void registerClickEvent(@NonNull TextView textView) { - BetterLinkMovementExtended betterLinkMovementMethod = BetterLinkMovementExtended.linkifyHtml(textView); - betterLinkMovementMethod.setOnLinkClickListener((view, url) -> { - SchemeParser.launchUri(view.getContext(), Uri.parse(url)); - return true; - }); - betterLinkMovementMethod.setOnLinkLongClickListener((view, url) -> { - view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); - PopupMenu menu = new PopupMenu(view.getContext(), view); - menu.setOnMenuItemClickListener(menuItem -> { - switch (menuItem.getItemId()) { - case R.id.copy: - AppHelper.copyToClipboard(view.getContext(), url); - return true; - case R.id.open: - SchemeParser.launchUri(view.getContext(), Uri.parse(url)); - return true; - case R.id.open_new_window: - SchemeParser.launchUri(view.getContext(), Uri.parse(url), false, true); - return true; - default: - return false; - } - }); - menu.inflate(R.menu.link_popup_menu); - menu.show(); - return true; - }); - } - - private static HtmlSpanner initHtml(@NonNull TextView textView, int width) { - @PrefGetter.ThemeType int theme = PrefGetter.getThemeType(); - @ColorInt int windowBackground = getWindowBackground(theme); - Drawable checked = ContextCompat.getDrawable(textView.getContext(), R.drawable.ic_checkbox_small); - Drawable unchecked = ContextCompat.getDrawable(textView.getContext(), R.drawable.ic_checkbox_empty_small); - HtmlSpanner mySpanner = new HtmlSpanner(); - mySpanner.setStripExtraWhiteSpace(true); - mySpanner.registerHandler("pre", new PreTagHandler(windowBackground, true, theme)); - mySpanner.registerHandler("code", new PreTagHandler(windowBackground, false, theme)); - mySpanner.registerHandler("img", new DrawableHandler(textView, width)); - mySpanner.registerHandler("g-emoji", new EmojiHandler()); - mySpanner.registerHandler("blockquote", new QuoteHandler(windowBackground)); - mySpanner.registerHandler("b", new BoldHandler()); - mySpanner.registerHandler("strong", new BoldHandler()); - mySpanner.registerHandler("i", new ItalicHandler()); - mySpanner.registerHandler("em", new ItalicHandler()); - mySpanner.registerHandler("ul", new MarginHandler()); - mySpanner.registerHandler("ol", new MarginHandler()); - mySpanner.registerHandler("li", new ListsHandler(checked, unchecked)); - mySpanner.registerHandler("u", new UnderlineHandler()); - mySpanner.registerHandler("strike", new StrikethroughHandler()); - mySpanner.registerHandler("ins", new UnderlineHandler()); - mySpanner.registerHandler("del", new StrikethroughHandler()); - mySpanner.registerHandler("sub", new SubScriptHandler()); - mySpanner.registerHandler("sup", new SuperScriptHandler()); - mySpanner.registerHandler("a", new LinkHandler()); - mySpanner.registerHandler("hr", new HrHandler(windowBackground, width, false)); - mySpanner.registerHandler("emoji", new EmojiHandler()); - mySpanner.registerHandler("mention", new LinkHandler()); - mySpanner.registerHandler("h1", new HeaderHandler(1.5F)); - mySpanner.registerHandler("h2", new HeaderHandler(1.4F)); - mySpanner.registerHandler("h3", new HeaderHandler(1.3F)); - mySpanner.registerHandler("h4", new HeaderHandler(1.2F)); - mySpanner.registerHandler("h5", new HeaderHandler(1.1F)); - mySpanner.registerHandler("h6", new HeaderHandler(1.0F)); - if (width > 0) { - TableHandler tableHandler = new TableHandler(); - tableHandler.setTextColor(ViewHelper.generateTextColor(windowBackground)); - tableHandler.setTableWidth(width); - mySpanner.registerHandler("table", tableHandler); - } - return mySpanner; - } - - @ColorInt public static int getWindowBackground(@PrefGetter.ThemeType int theme) { - if (theme == PrefGetter.AMLOD) { - return Color.parseColor("#0B162A"); - } else if (theme == PrefGetter.BLUISH) { - return Color.parseColor("#111C2C"); - } else if (theme == PrefGetter.DARK) { - return Color.parseColor("#22252A"); - } else { - return Color.parseColor("#EEEEEE"); - } - } - - private static final String TOGGLE_START = ""; - - private static final String TOGGLE_END = ""; - - private static final String REPLY_START = "

"; - - private static final String REPLY_END = "
"; - - private static final String SIGNATURE_START = "
"; - - private static final String SIGNATURE_END = "
"; - - private static final String HIDDEN_REPLY_START = "
"; - - private static final String HIDDEN_REPLY_END = "
"; - - private static final String BREAK = "
"; - - private static final String PARAGRAPH_START = "

"; - - private static final String PARAGRAPH_END = "

"; - - //https://github.com/k0shk0sh/GitHubSdk/blob/master/library/src/main/java/com/meisolsson/githubsdk/core/HtmlUtils.java - @NonNull public static CharSequence format(final String html) { - if (html == null || html.length() == 0) return ""; - StringBuilder formatted = new StringBuilder(html); - strip(formatted, TOGGLE_START, TOGGLE_END); - strip(formatted, SIGNATURE_START, SIGNATURE_END); - strip(formatted, REPLY_START, REPLY_END); - strip(formatted, HIDDEN_REPLY_START, HIDDEN_REPLY_END); - if (replace(formatted, PARAGRAPH_START, BREAK)) replace(formatted, PARAGRAPH_END, BREAK); - trim(formatted); - return formatted; - } - - private static void strip(final StringBuilder input, final String prefix, final String suffix) { - int start = input.indexOf(prefix); - while (start != -1) { - int end = input.indexOf(suffix, start + prefix.length()); - if (end == -1) - end = input.length(); - input.delete(start, end + suffix.length()); - start = input.indexOf(prefix, start); - } - } - - private static boolean replace(final StringBuilder input, final String from, final String to) { - int start = input.indexOf(from); - if (start == -1) return false; - final int fromLength = from.length(); - final int toLength = to.length(); - while (start != -1) { - input.replace(start, start + fromLength, to); - start = input.indexOf(from, start + toLength); - } - return true; - } - - private static void trim(final StringBuilder input) { - int length = input.length(); - int breakLength = BREAK.length(); - while (length > 0) { - if (input.indexOf(BREAK) == 0) input.delete(0, breakLength); - else if (length >= breakLength && input.lastIndexOf(BREAK) == length - breakLength) input.delete(length - breakLength, length); - else if (Character.isWhitespace(input.charAt(0))) input.deleteCharAt(0); - else if (Character.isWhitespace(input.charAt(length - 1))) input.deleteCharAt(length - 1); - else break; - length = input.length(); - } - } -} diff --git a/app/src/main/java/com/fastaccess/provider/timeline/ReactionsProvider.java b/app/src/main/java/com/fastaccess/provider/timeline/ReactionsProvider.java deleted file mode 100644 index ab93b529e..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/ReactionsProvider.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.fastaccess.provider.timeline; - -import androidx.annotation.IdRes; -import androidx.annotation.IntDef; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.PostReactionModel; -import com.fastaccess.data.dao.ReactionsModel; -import com.fastaccess.data.dao.types.ReactionTypes; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.util.LinkedHashMap; -import java.util.Map; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 09 Apr 2017, 10:40 AM - */ - -public class ReactionsProvider { - - public static final int HEADER = 0; - public static final int COMMENT = 1; - public static final int REVIEW_COMMENT = 2; - public static final int COMMIT = 3; - - @IntDef({ - HEADER, - COMMENT, - REVIEW_COMMENT, - COMMIT - }) - @Retention(RetentionPolicy.SOURCE) public @interface ReactionType {} - - private Map reactionsMap = new LinkedHashMap<>(); - - @Nullable public Observable onHandleReaction(@IdRes int viewId, long idOrNumber, @Nullable String login, - @Nullable String repoId, @ReactionType int reactionType, boolean isEnterprise) { - if (!InputHelper.isEmpty(login) && !InputHelper.isEmpty(repoId)) { - if (!isPreviouslyReacted(idOrNumber, viewId)) { - ReactionTypes reactionTypes = ReactionTypes.get(viewId); - if (reactionTypes != null) { - Observable observable = null; - switch (reactionType) { - case COMMENT: - observable = RestProvider.getReactionsService(isEnterprise) - .postIssueCommentReaction(new PostReactionModel(reactionTypes.getPostContent()), login, repoId, idOrNumber); - break; - case HEADER: - observable = RestProvider.getReactionsService(isEnterprise) - .postIssueReaction(new PostReactionModel(reactionTypes.getPostContent()), login, repoId, idOrNumber); - break; - case REVIEW_COMMENT: - observable = RestProvider.getReactionsService(isEnterprise) - .postCommentReviewReaction(new PostReactionModel(reactionTypes.getPostContent()), login, repoId, idOrNumber); - break; - case COMMIT: - observable = RestProvider.getReactionsService(isEnterprise) - .postCommitReaction(new PostReactionModel(reactionTypes.getPostContent()), login, repoId, idOrNumber); - break; - } - if (observable == null) return null; - return RxHelper.safeObservable(observable) - .doOnNext(response -> getReactionsMap().put(idOrNumber, response)); - } - } else { - ReactionsModel reactionsModel = getReactionsMap().get(idOrNumber); - if (reactionsModel != null) { - return RxHelper.safeObservable(RestProvider.getReactionsService(isEnterprise).delete(reactionsModel.getId())) - .doOnNext(booleanResponse -> { - if (booleanResponse.code() == 204) { - getReactionsMap().remove(idOrNumber); - } - }); - } - } - } - return null; - } - - - public boolean isPreviouslyReacted(long idOrNumber, @IdRes int vId) { - ReactionsModel reactionsModel = getReactionsMap().get(idOrNumber); - if (reactionsModel == null || InputHelper.isEmpty(reactionsModel.getContent())) { - return false; - } - ReactionTypes type = ReactionTypes.get(vId); - return type != null && (type.getContent().equals(reactionsModel.getContent()) || type.getPostContent().equals(reactionsModel.getContent())); - } - - public boolean isCallingApi(long id, int vId) { - ReactionsModel reactionsModel = getReactionsMap().get(id); - if (reactionsModel == null || InputHelper.isEmpty(reactionsModel.getContent())) { - return false; - } - ReactionTypes type = ReactionTypes.get(vId); - return type != null && (type.getContent().equals(reactionsModel.getContent()) || type.getPostContent().equals(reactionsModel.getContent())) - && reactionsModel.isCallingApi(); - } - - @NonNull private Map getReactionsMap() { - return reactionsMap; - } -} diff --git a/app/src/main/java/com/fastaccess/provider/timeline/TimelineConverter.kt b/app/src/main/java/com/fastaccess/provider/timeline/TimelineConverter.kt deleted file mode 100644 index f6bed9074..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/TimelineConverter.kt +++ /dev/null @@ -1,133 +0,0 @@ -package com.fastaccess.provider.timeline - -import com.fastaccess.data.dao.* -import com.fastaccess.data.dao.model.Comment -import com.fastaccess.data.dao.timeline.GenericEvent -import com.fastaccess.data.dao.timeline.PullRequestCommitModel -import com.fastaccess.data.dao.types.IssueEventType -import com.fastaccess.helper.InputHelper -import com.fastaccess.provider.rest.RestProvider -import com.google.gson.Gson -import com.google.gson.JsonObject -import io.reactivex.Observable - -/** - * Created by kosh on 26/07/2017. - */ - -object TimelineConverter { - - fun convert(jsonObjects: List?): Observable { - if (jsonObjects == null) return Observable.empty() - val gson = RestProvider.gson - return Observable.fromIterable(jsonObjects) - .map { jsonObject -> - val event = jsonObject.get("event").asString - val timeline = TimelineModel() - if (!InputHelper.isEmpty(event)) { - val type = IssueEventType.getType(event) - timeline.event = type - if (type != null) { - if (type == IssueEventType.commented) { - timeline.comment = getComment(jsonObject, gson) - } else { - timeline.genericEvent = getGenericEvent(jsonObject, gson) - } - } - } else { - timeline.genericEvent = getGenericEvent(jsonObject, gson) - } - timeline - } - .filter { filterEvents(it.event) } - } - - fun convert(jsonObjects: List?, comments: Pageable?): List { - val list = arrayListOf() - if (jsonObjects == null) return list - val gson = RestProvider.gson - jsonObjects.onEach { jsonObject -> - val event = jsonObject.get("event").asString - val timeline = TimelineModel() - if (!InputHelper.isEmpty(event)) { - val type = IssueEventType.getType(event) - timeline.event = type - if (type != null) { - if (type == IssueEventType.commented) { - timeline.comment = getComment(jsonObject, gson) - list.add(timeline) - } else if (type == IssueEventType.commit_commented) { - val commit = getCommit(jsonObject, gson) - if (commit != null) { - val comment = commit.comments?.firstOrNull() - comment?.let { - commit.path = it.path - commit.position = it.position - commit.line = it.line - commit.login = it.user?.login - } - timeline.commit = commit - list.add(timeline) - } - } else if (type == IssueEventType.reviewed || type == IssueEventType - .changes_requested) { - val review = getReview(jsonObject, gson) - if (review != null) { - timeline.review = review - list.add(timeline) - val reviewsList = arrayListOf() - comments?.items?.filter { it.pullRequestReviewId == review.id } - ?.onEach { - val grouped = GroupedReviewModel() - grouped.diffText = it.diffHunk - grouped.path = it.path - grouped.position = it.position - grouped.comments = arrayListOf(it) - grouped.id = it.id - val groupTimeline = TimelineModel() - groupTimeline.event = IssueEventType.GROUPED - groupTimeline.groupedReviewModel = grouped - reviewsList.add(groupTimeline) - } - comments?.items?.filter { it.pullRequestReviewId != review.id }?.onEach { - reviewsList.onEach { reviews -> - if (it.path == reviews.groupedReviewModel.path && it.position == reviews.groupedReviewModel.position) { - reviews.groupedReviewModel.comments.add(it) - } - } - } - list.addAll(reviewsList) - } - } else { - timeline.genericEvent = getGenericEvent(jsonObject, gson) - list.add(timeline) - } - } - } else { - timeline.genericEvent = getGenericEvent(jsonObject, gson) - list.add(timeline) - } - } - return list.filter({filterEvents(it.event)}) - } - - private fun getCommit(jsonObject: JsonObject, gson: Gson): PullRequestCommitModel? { - return gson.fromJson(jsonObject, PullRequestCommitModel::class.java) - } - - private fun getGenericEvent(jsonObject: JsonObject, gson: Gson): GenericEvent { - return gson.fromJson(jsonObject, GenericEvent::class.java) - } - - private fun getComment(jsonObject: JsonObject, gson: Gson): Comment { - return gson.fromJson(jsonObject, Comment::class.java) - } - - private fun filterEvents(type: IssueEventType?): Boolean { - return type != null && type != IssueEventType.subscribed && type != IssueEventType.unsubscribed && type != IssueEventType.mentioned - } - - private fun getReview(jsonObject: JsonObject, gson: Gson): ReviewModel? { - return gson.fromJson(jsonObject, ReviewModel::class.java) - } -} diff --git a/app/src/main/java/com/fastaccess/provider/timeline/TimelineProvider.java b/app/src/main/java/com/fastaccess/provider/timeline/TimelineProvider.java deleted file mode 100644 index 114357e1f..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/TimelineProvider.java +++ /dev/null @@ -1,208 +0,0 @@ -package com.fastaccess.provider.timeline; - -import android.content.Context; -import android.graphics.Color; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.text.style.BackgroundColorSpan; - -import com.fastaccess.R; -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.data.dao.timeline.GenericEvent; -import com.fastaccess.data.dao.timeline.SourceModel; -import com.fastaccess.data.dao.types.IssueEventType; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.zzhoujay.markdown.style.CodeSpan; - -import java.util.Date; - -/** - * Created by Kosh on 20 Apr 2017, 7:18 PM - */ - -public class TimelineProvider { - - @NonNull public static SpannableBuilder getStyledEvents(@NonNull GenericEvent issueEventModel, - @NonNull Context context, boolean isMerged) { - IssueEventType event = issueEventModel.getEvent(); - SpannableBuilder spannableBuilder = SpannableBuilder.builder(); - Date date = issueEventModel.getCreatedAt() != null - ? issueEventModel.getCreatedAt() - : issueEventModel.getAuthor() != null - ? issueEventModel.getAuthor().getDate() : null; - if (event != null) { - String to = context.getString(R.string.to); - String from = context.getString(R.string.from); - String thisString = context.getString(R.string.this_value); - String in = context.getString(R.string.in_value); - if (event == IssueEventType.labeled || event == IssueEventType.unlabeled) { - spannableBuilder.bold(issueEventModel.getActor() != null ? issueEventModel.getActor().getLogin() : "anonymous"); - spannableBuilder.append(" ").append(event.name().replaceAll("_", " ")); - LabelModel labelModel = issueEventModel.getLabel(); - int color = Color.parseColor("#" + labelModel.getColor()); - spannableBuilder.append(" ").append(" " + labelModel.getName() + " ", new CodeSpan(color, ViewHelper.generateTextColor(color), 5)); - spannableBuilder.append(" ").append(getDate(issueEventModel.getCreatedAt())); - } else if (event == IssueEventType.committed) { - spannableBuilder.append(issueEventModel.getMessage().replaceAll("\n", " ")) - .append(" ") - .url(substring(issueEventModel.getSha())); - } else { - User user = null; - if (issueEventModel.getAssignee() != null && issueEventModel.getAssigner() != null) { - user = issueEventModel.getAssigner(); - } else if (issueEventModel.getActor() != null) { - user = issueEventModel.getActor(); - } else if (issueEventModel.getAuthor() != null) { - user = issueEventModel.getAuthor(); - } - if (user != null) { - spannableBuilder.bold(user.getLogin()); - } - if ((event == IssueEventType.review_requested || (event == IssueEventType.review_dismissed || - event == IssueEventType.review_request_removed)) && user != null) { - appendReviews(issueEventModel, event, spannableBuilder, from, issueEventModel.getReviewRequester()); - } else if (event == IssueEventType.closed || event == IssueEventType.reopened) { - if (isMerged) { - spannableBuilder.append(" ").append(IssueEventType.merged.name()); - } else { - spannableBuilder - .append(" ") - .append(event.name().replaceAll("_", " ")) - .append(" ") - .append(thisString); - } - if (issueEventModel.getCommitId() != null) { - spannableBuilder - .append(" ") - .append(in) - .append(" ") - .url(substring(issueEventModel.getCommitId())); - } - } else if (event == IssueEventType.assigned || event == IssueEventType.unassigned) { - spannableBuilder - .append(" "); - if ((user != null && issueEventModel.getAssignee() != null) && user.getLogin() - .equalsIgnoreCase(issueEventModel.getAssignee().getLogin())) { - spannableBuilder - .append(event == IssueEventType.assigned ? "self-assigned this" : "removed their assignment"); - } else { - spannableBuilder - .append(event == IssueEventType.assigned ? "assigned" : "unassigned"); - spannableBuilder - .append(" ") - .bold(issueEventModel.getAssignee() != null ? issueEventModel.getAssignee().getLogin() : ""); - } - } else if (event == IssueEventType.locked || event == IssueEventType.unlocked) { - spannableBuilder - .append(" ") - .append(event == IssueEventType.locked ? "locked and limited conversation to collaborators" : "unlocked this " + - "conversation"); - } else if (event == IssueEventType.head_ref_deleted || event == IssueEventType.head_ref_restored) { - spannableBuilder.append(" ").append(event.name().replaceAll("_", " "), - new BackgroundColorSpan(HtmlHelper.getWindowBackground(PrefGetter.getThemeType()))); - } else if (event == IssueEventType.milestoned || event == IssueEventType.demilestoned) { - spannableBuilder.append(" ") - .append(event == IssueEventType.milestoned ? "added this to the" : "removed this from the") - .append(" ") - .bold(issueEventModel.getMilestone().getTitle()) - .append(" ") - .append("milestone"); - } else if (event == IssueEventType.deployed) { - spannableBuilder.append(" ") - .bold("deployed"); - } else { - spannableBuilder.append(" ").append(event.name().replaceAll("_", " ")); - } - if (event == IssueEventType.renamed) { - spannableBuilder - .append(" ") - .append(from) - .append(" ") - .bold(issueEventModel.getRename().getFromValue()) - .append(" ") - .append(to) - .append(" ") - .bold(issueEventModel.getRename().getToValue()); - } else if (event == IssueEventType.referenced || event == IssueEventType.merged) { - spannableBuilder - .append(" ") - .append("commit") - .append(" ") - .url(substring(issueEventModel.getCommitId())); - } else if (event == IssueEventType.cross_referenced) { - SourceModel sourceModel = issueEventModel.getSource(); - if (sourceModel != null) { - String type = sourceModel.getType(); - SpannableBuilder title = SpannableBuilder.builder(); - if (sourceModel.getPullRequest() != null) { - if (sourceModel.getIssue() != null) title.url("#" + sourceModel.getIssue().getNumber()); - type = "pull request"; - } else if (sourceModel.getIssue() != null) { - title.url("#" + sourceModel.getIssue().getNumber()); - } else if (sourceModel.getCommit() != null) { - title.url(substring(sourceModel.getCommit().getSha())); - } else if (sourceModel.getRepository() != null) { - title.url(sourceModel.getRepository().getName()); - } - if (!InputHelper.isEmpty(title)) { - spannableBuilder.append(" ") - .append(thisString) - .append(" in ") - .append(type) - .append(" ") - .append(title); - } - } - } - spannableBuilder.append(" ").append(getDate(date)); - } - } - return spannableBuilder; - } - - private static void appendReviews(@NonNull GenericEvent issueEventModel, @NonNull IssueEventType event, - @NonNull SpannableBuilder spannableBuilder, @NonNull String from, - @NonNull User user) { - spannableBuilder.append(" "); - User reviewer = issueEventModel.getRequestedReviewer(); - if (reviewer != null && user.getLogin().equalsIgnoreCase(reviewer.getLogin())) { - spannableBuilder - .append(event == IssueEventType.review_requested - ? "self-requested a review" : "removed their request for review"); - } else { - spannableBuilder - .append(event == IssueEventType.review_requested ? "Requested a review" : "dismissed the review") - .append(" ") - .append(reviewer != null && !reviewer.getLogin().equalsIgnoreCase(user.getLogin()) ? from : " ") - .append(reviewer != null && !reviewer.getLogin().equalsIgnoreCase(user.getLogin()) ? " " : ""); - } - if (issueEventModel.getRequestedTeam() != null) { - String name = !InputHelper.isEmpty(issueEventModel.getRequestedTeam().getName()) - ? issueEventModel.getRequestedTeam().getName() : issueEventModel.getRequestedTeam().getSlug(); - spannableBuilder - .bold(name) - .append(" ") - .append("team"); - } else if (reviewer != null && !user.getLogin().equalsIgnoreCase(reviewer.getLogin())) { - spannableBuilder.bold(issueEventModel.getRequestedReviewer().getLogin()); - } - } - - @NonNull private static CharSequence getDate(@Nullable Date date) { - return ParseDateFormat.getTimeAgo(date); - } - - @NonNull private static String substring(@Nullable String value) { - if (value == null) { - return ""; - } - if (value.length() <= 7) return value; - else return value.substring(0, 7); - } - -} diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/BetterLinkMovementExtended.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/BetterLinkMovementExtended.java deleted file mode 100644 index 3d64b5766..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/BetterLinkMovementExtended.java +++ /dev/null @@ -1,267 +0,0 @@ -package com.fastaccess.provider.timeline.handler; - -import android.content.Context; -import android.graphics.RectF; -import android.text.Layout; -import android.text.Selection; -import android.text.Spannable; -import android.text.Spanned; -import android.text.method.LinkMovementMethod; -import android.text.style.BackgroundColorSpan; -import android.text.style.ClickableSpan; -import android.text.style.URLSpan; -import android.text.util.Linkify; -import android.view.GestureDetector; -import android.view.MotionEvent; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - - -/** - * Created by Kosh on 23 Apr 2017, 12:09 PM - *

- * credit to to https://github.com/Saketme/Better-Link-Movement-Method - */ - -public class BetterLinkMovementExtended extends LinkMovementMethod { - private static final Class SPAN_CLASS = ClickableSpan.class; - private static final int LINKIFY_NONE = -2; - private BetterLinkMovementExtended.OnLinkClickListener onLinkClickListener; - private BetterLinkMovementExtended.OnLinkLongClickListener onLinkLongClickListener; - private final RectF touchedLineBounds = new RectF(); - private boolean isUrlHighlighted; - private boolean touchStartedOverLink; - private int activeTextViewHashcode; - - private final GestureDetector gestureDetector; - private final LinkClickGestureListener clickGestureListener = new LinkClickGestureListener(); - - private BetterLinkMovementExtended(Context context) { - gestureDetector = new GestureDetector(context, clickGestureListener); - } - - private final class LinkClickGestureListener extends GestureDetector.SimpleOnGestureListener { - private GestureDetector.SimpleOnGestureListener listener = null; - - @Override public boolean onDown(MotionEvent e) { - if(listener != null) listener.onDown(e); - return true; - } - - @Override public boolean onSingleTapUp(MotionEvent e) { - return listener == null || listener.onSingleTapUp(e); - } - - @Override public void onLongPress(MotionEvent e) { - if(listener != null) listener.onLongPress(e); - } - } - - private static BetterLinkMovementExtended linkify(int linkifyMask, TextView textView) { - BetterLinkMovementExtended movementMethod = new BetterLinkMovementExtended(textView.getContext()); - addLinks(linkifyMask, movementMethod, textView); - return movementMethod; - } - - public static BetterLinkMovementExtended linkifyHtml(TextView textView) { - return linkify(LINKIFY_NONE, textView); - } - - private static BetterLinkMovementExtended linkify(int linkifyMask, ViewGroup viewGroup) { - BetterLinkMovementExtended movementMethod = new BetterLinkMovementExtended(viewGroup.getContext()); - rAddLinks(linkifyMask, viewGroup, movementMethod); - return movementMethod; - } - - public static BetterLinkMovementExtended linkifyHtml(ViewGroup viewGroup) { - return linkify(LINKIFY_NONE, viewGroup); - } - - public void setOnLinkClickListener(OnLinkClickListener onLinkClickListener) { - this.onLinkClickListener = onLinkClickListener; - } - - public void setOnLinkLongClickListener(OnLinkLongClickListener onLinkLongClickListener) { - this.onLinkLongClickListener = onLinkLongClickListener; - } - - private static void rAddLinks(int linkifyMask, ViewGroup viewGroup, BetterLinkMovementExtended movementMethod) { - for (int i = 0; i < viewGroup.getChildCount(); ++i) { - View child = viewGroup.getChildAt(i); - if (child instanceof ViewGroup) { - rAddLinks(linkifyMask, (ViewGroup) child, movementMethod); - } else if (child instanceof TextView) { - TextView textView = (TextView) child; - addLinks(linkifyMask, movementMethod, textView); - } - } - - } - - private static void addLinks(int linkifyMask, BetterLinkMovementExtended movementMethod, TextView textView) { - textView.setMovementMethod(movementMethod); - if (linkifyMask != LINKIFY_NONE) { - Linkify.addLinks(textView, linkifyMask); - } - - } - - public boolean onTouchEvent(TextView view, Spannable text, MotionEvent event) { - if (this.activeTextViewHashcode != view.hashCode()) { - this.activeTextViewHashcode = view.hashCode(); - view.setAutoLinkMask(0); - } - - BetterLinkMovementExtended.ClickableSpanWithText touchedClickableSpan = this.findClickableSpanUnderTouch(view, text, event); - if (touchedClickableSpan != null) { - this.highlightUrl(view, touchedClickableSpan, text); - } else { - this.removeUrlHighlightColor(view); - } - - clickGestureListener.listener = new GestureDetector.SimpleOnGestureListener() { - @Override public boolean onDown(MotionEvent e) { - touchStartedOverLink = touchedClickableSpan != null; - return true; - } - - @Override public boolean onSingleTapUp(MotionEvent e) { - if (touchedClickableSpan != null && touchStartedOverLink) { - dispatchUrlClick(view, touchedClickableSpan); - removeUrlHighlightColor(view); - } - - touchStartedOverLink = false; - return true; - } - - @Override public void onLongPress(MotionEvent e) { - if (touchedClickableSpan != null && touchStartedOverLink) { - dispatchUrlLongClick(view, touchedClickableSpan); - removeUrlHighlightColor(view); - } - - touchStartedOverLink = false; - } - }; - - boolean ret = gestureDetector.onTouchEvent(event); - - if(!ret && event.getAction() == MotionEvent.ACTION_UP) { - clickGestureListener.listener = null; - removeUrlHighlightColor(view); - this.touchStartedOverLink = false; - ret = true; - } - - return ret; - } - - private BetterLinkMovementExtended.ClickableSpanWithText findClickableSpanUnderTouch(TextView textView, Spannable text, MotionEvent event) { - int touchX = (int) event.getX(); - int touchY = (int) event.getY(); - touchX -= textView.getTotalPaddingLeft(); - touchY -= textView.getTotalPaddingTop(); - touchX += textView.getScrollX(); - touchY += textView.getScrollY(); - Layout layout = textView.getLayout(); - int touchedLine = layout.getLineForVertical(touchY); - int touchOffset = layout.getOffsetForHorizontal(touchedLine, (float) touchX); - this.touchedLineBounds.left = layout.getLineLeft(touchedLine); - this.touchedLineBounds.top = (float) layout.getLineTop(touchedLine); - this.touchedLineBounds.right = layout.getLineWidth(touchedLine) + this.touchedLineBounds.left; - this.touchedLineBounds.bottom = (float) layout.getLineBottom(touchedLine); - if (this.touchedLineBounds.contains((float) touchX, (float) touchY)) { - Object[] spans = text.getSpans(touchOffset, touchOffset, SPAN_CLASS); - for (Object span : spans) { - if (span instanceof ClickableSpan) { - return ClickableSpanWithText.ofSpan(textView, (ClickableSpan) span); - } - } - return null; - } else { - return null; - } - } - - private void highlightUrl(TextView textView, BetterLinkMovementExtended.ClickableSpanWithText spanWithText, Spannable text) { - if (!this.isUrlHighlighted) { - this.isUrlHighlighted = true; - int spanStart = text.getSpanStart(spanWithText.span()); - int spanEnd = text.getSpanEnd(spanWithText.span()); - Selection.removeSelection(text); - text.setSpan(new BackgroundColorSpan(textView.getHighlightColor()), spanStart, spanEnd, Spanned.SPAN_INCLUSIVE_INCLUSIVE); - textView.setText(text); - Selection.setSelection(text, spanStart, spanEnd); - } - } - - private void removeUrlHighlightColor(TextView textView) { - if (this.isUrlHighlighted) { - this.isUrlHighlighted = false; - Spannable text = (Spannable) textView.getText(); - BackgroundColorSpan[] highlightSpans = text.getSpans(0, text.length(), BackgroundColorSpan.class); - for (BackgroundColorSpan highlightSpan : highlightSpans) { - text.removeSpan(highlightSpan); - } - try { - textView.setText(text); - Selection.removeSelection(text); - } catch (Exception ignored) {} - } - } - - private void dispatchUrlClick(TextView textView, BetterLinkMovementExtended.ClickableSpanWithText spanWithText) { - String spanUrl = spanWithText.text(); - boolean handled = this.onLinkClickListener != null && this.onLinkClickListener.onClick(textView, spanUrl); - if (!handled) { - spanWithText.span().onClick(textView); - } - - } - - private void dispatchUrlLongClick(TextView textView, BetterLinkMovementExtended.ClickableSpanWithText spanWithText) { - String spanUrl = spanWithText.text(); - if(onLinkLongClickListener != null) onLinkLongClickListener.onLongClick(textView, spanUrl); - } - - static class ClickableSpanWithText { - private ClickableSpan span; - private String text; - - static BetterLinkMovementExtended.ClickableSpanWithText ofSpan(TextView textView, ClickableSpan span) { - Spanned s = (Spanned) textView.getText(); - String text; - if (span instanceof URLSpan) { - text = ((URLSpan) span).getURL(); - } else { - int start = s.getSpanStart(span); - int end = s.getSpanEnd(span); - text = s.subSequence(start, end).toString(); - } - return new BetterLinkMovementExtended.ClickableSpanWithText(span, text); - } - - private ClickableSpanWithText(ClickableSpan span, String text) { - this.span = span; - this.text = text; - } - - ClickableSpan span() { - return this.span; - } - - String text() { - return this.text; - } - } - - public interface OnLinkClickListener { - boolean onClick(TextView view, String link); - } - - public interface OnLinkLongClickListener { - boolean onLongClick(TextView view, String link); - } -} diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/CodeBackgroundRoundedSpan.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/CodeBackgroundRoundedSpan.java deleted file mode 100644 index 4a7a0e1cd..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/CodeBackgroundRoundedSpan.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.fastaccess.provider.timeline.handler; - -import android.graphics.Canvas; -import android.graphics.Paint; -import android.graphics.RectF; -import android.graphics.Typeface; -import android.text.Layout; -import android.text.TextPaint; -import android.text.style.LeadingMarginSpan; -import android.text.style.LineBackgroundSpan; -import android.text.style.MetricAffectingSpan; - -public class CodeBackgroundRoundedSpan extends MetricAffectingSpan implements LeadingMarginSpan, LineBackgroundSpan { - private final int color; - - private final RectF rect = new RectF(); - - CodeBackgroundRoundedSpan(int color) { - this.color = color; - } - - @Override public void updateMeasureState(TextPaint paint) { - apply(paint); - } - - @Override public void updateDrawState(TextPaint paint) { - apply(paint); - } - - private void apply(TextPaint paint) { - paint.setTypeface(Typeface.MONOSPACE); - } - - @Override public void drawBackground(Canvas c, Paint p, int left, int right, int top, int baseline, int bottom, - CharSequence text, int start, int end, int lnum) { - Paint.Style style = p.getStyle(); - int color = p.getColor(); - p.setStyle(Paint.Style.FILL); - p.setColor(this.color); - rect.set(left, top, right, bottom); - c.drawRect(rect, p); - p.setColor(color); - p.setStyle(style); - } - - @Override public int getLeadingMargin(boolean first) { - return 30; - } - - @Override public void drawLeadingMargin(Canvas c, Paint p, int x, int dir, int top, int baseline, int bottom, - CharSequence text, int start, int end, boolean first, Layout layout) {} -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/DrawableHandler.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/DrawableHandler.java deleted file mode 100644 index d0b3abe52..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/DrawableHandler.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.fastaccess.provider.timeline.handler; - -import android.text.SpannableStringBuilder; -import android.text.style.ImageSpan; -import android.widget.TextView; - -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.provider.timeline.handler.drawable.DrawableGetter; -import com.fastaccess.ui.widgets.SpannableBuilder; - -import net.nightwhistler.htmlspanner.TagNodeHandler; -import net.nightwhistler.htmlspanner.spans.CenterSpan; - -import org.htmlcleaner.TagNode; - -import lombok.AllArgsConstructor; - -import static android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE; - -/** - * Created by Kosh on 22 Apr 2017, 1:09 PM - */ - -@AllArgsConstructor public class DrawableHandler extends TagNodeHandler { - - private TextView textView; - private int width; - - @SuppressWarnings("ConstantConditions") private boolean isNull() { - return textView == null; - } - - @Override public void handleTagNode(TagNode node, SpannableStringBuilder builder, int start, int end) { - String src = node.getAttributeByName("src"); - if (!InputHelper.isEmpty(src)) { - if (!PrefGetter.isAutoImageDisabled()) { - builder.append(""); - if (isNull()) return; - builder.append("\n"); - DrawableGetter imageGetter = new DrawableGetter(textView, width); - builder.setSpan(new ImageSpan(imageGetter.getDrawable(src)), start, builder.length(), SPAN_EXCLUSIVE_EXCLUSIVE); - builder.append("\n"); - } else { - builder.append(SpannableBuilder.builder().clickable("Image", v -> SchemeParser.launchUri(v.getContext(), src))); - builder.append("\n"); - } - } - } -} diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/EmojiHandler.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/EmojiHandler.java deleted file mode 100644 index 8960fd22b..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/EmojiHandler.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.fastaccess.provider.timeline.handler; - -import android.text.SpannableStringBuilder; - -import com.fastaccess.helper.Logger; -import com.fastaccess.provider.emoji.Emoji; -import com.fastaccess.provider.emoji.EmojiManager; - -import net.nightwhistler.htmlspanner.TagNodeHandler; - -import org.htmlcleaner.TagNode; - -/** - * Created by Kosh on 27 May 2017, 4:54 PM - */ - -public class EmojiHandler extends TagNodeHandler { - - @Override public void handleTagNode(TagNode node, SpannableStringBuilder builder, int start, int end) { - String emoji = node.getAttributeByName("alias"); - if (emoji != null) { - Emoji unicode = EmojiManager.getForAlias(emoji); - if (unicode != null && unicode.getUnicode() != null) { - builder.replace(start, end, " " + unicode.getUnicode() + " "); - } - } else if (node.getText() != null) { - Logger.e(node.getText()); - Emoji unicode = EmojiManager.getForAlias(node.getText().toString()); - if (unicode != null && unicode.getUnicode() != null) { - builder.replace(start, end, " " + unicode.getUnicode() + " "); - } - } - } - - @Override public void beforeChildren(TagNode node, SpannableStringBuilder builder) { - super.beforeChildren(node, builder); - } -} diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/HeaderHandler.kt b/app/src/main/java/com/fastaccess/provider/timeline/handler/HeaderHandler.kt deleted file mode 100644 index 32c61f8ee..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/HeaderHandler.kt +++ /dev/null @@ -1,33 +0,0 @@ -package com.fastaccess.provider.timeline.handler - -import android.text.SpannableStringBuilder -import android.text.style.RelativeSizeSpan -import net.nightwhistler.htmlspanner.TagNodeHandler -import net.nightwhistler.htmlspanner.spans.FontFamilySpan -import org.htmlcleaner.TagNode - -/** - * Created by Kosh on 29.09.17. - */ -class HeaderHandler(val size: Float) : TagNodeHandler() { - - override fun beforeChildren(node: TagNode?, builder: SpannableStringBuilder?) { - appendNewLine(builder) - } - - override fun handleTagNode(node: TagNode, builder: SpannableStringBuilder, start: Int, end: Int) { - builder.setSpan(RelativeSizeSpan(this.size), start, end, 33) - val originalSpan = this.getFontFamilySpan(builder, start, end) - val boldSpan: FontFamilySpan - if (originalSpan == null) { - boldSpan = FontFamilySpan(this.spanner.defaultFont) - } else { - boldSpan = FontFamilySpan(originalSpan.fontFamily) - boldSpan.isItalic = originalSpan.isItalic - } - - boldSpan.isBold = true - builder.setSpan(boldSpan, start, end, 33) - appendNewLine(builder) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/HrHandler.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/HrHandler.java deleted file mode 100644 index 21a75d3b0..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/HrHandler.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.fastaccess.provider.timeline.handler; - -import android.text.SpannableStringBuilder; -import android.text.Spanned; - -import net.nightwhistler.htmlspanner.TagNodeHandler; -import net.nightwhistler.htmlspanner.spans.CenterSpan; - -import org.htmlcleaner.TagNode; - -import lombok.AllArgsConstructor; - -/** - * Created by kosh on 30/07/2017. - */ - -@AllArgsConstructor public class HrHandler extends TagNodeHandler { - - private final int color; - private final int width; - private final boolean isHeader; - - @Override public void handleTagNode(TagNode tagNode, SpannableStringBuilder spannableStringBuilder, int i, int i1) { - spannableStringBuilder.append("\n"); - SpannableStringBuilder builder = new SpannableStringBuilder("$"); - HrSpan hrSpan = new HrSpan(color, width); - builder.setSpan(hrSpan, 0, builder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - builder.setSpan(new CenterSpan(), 0, builder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - builder.append("\n"); - spannableStringBuilder.append(builder); - } - -} diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/HrSpan.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/HrSpan.java deleted file mode 100644 index 3bd13a092..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/HrSpan.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.fastaccess.provider.timeline.handler; - -import android.graphics.Canvas; -import android.graphics.Paint; -import android.graphics.Rect; -import android.graphics.drawable.ColorDrawable; -import android.graphics.drawable.Drawable; -import androidx.annotation.NonNull; -import android.text.style.LineHeightSpan; -import android.text.style.ReplacementSpan; - -public class HrSpan extends ReplacementSpan implements LineHeightSpan { - - private final int width; - private final int color; - - HrSpan(int color, int width) { - this.color = color; - this.width = width; - Drawable drawable = new ColorDrawable(color); - } - - @Override public int getSize(@NonNull Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fm) { - return (int) paint.measureText(text, start, end); - } - - @Override public void draw(@NonNull Canvas canvas, CharSequence text, int start, int end, float x, int top, - int y, int bottom, @NonNull Paint paint) { - final int currentColor = paint.getColor(); - paint.setColor(color); - paint.setStyle(Paint.Style.FILL); - int height = 10; - canvas.drawRect(new Rect(0, bottom - height, (int) x + width, bottom), paint); - paint.setColor(currentColor); - } - - @Override public void chooseHeight(CharSequence text, int start, int end, int spanstartv, int v, Paint.FontMetricsInt fm) { - fm.top /= 3; - fm.ascent /= 3; - fm.bottom /= 3; - fm.descent /= 3; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/ItalicHandler.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/ItalicHandler.java deleted file mode 100644 index a1c625511..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/ItalicHandler.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.fastaccess.provider.timeline.handler; - -import android.graphics.Typeface; -import android.text.SpannableStringBuilder; - -import com.zzhoujay.markdown.style.FontSpan; - -import net.nightwhistler.htmlspanner.TagNodeHandler; - -import org.htmlcleaner.TagNode; - -/** - * Created by Kosh on 06 May 2017, 11:02 AM - */ - -public class ItalicHandler extends TagNodeHandler { - - public void handleTagNode(TagNode node, SpannableStringBuilder builder, int start, int end) { - builder.setSpan(new FontSpan(1, Typeface.ITALIC), start, builder.length(), 33); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/LinkHandler.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/LinkHandler.java deleted file mode 100644 index 5cd9de55e..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/LinkHandler.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.fastaccess.provider.timeline.handler; - -import android.graphics.Color; -import android.text.SpannableStringBuilder; - -import com.zzhoujay.markdown.style.LinkSpan; - -import net.nightwhistler.htmlspanner.TagNodeHandler; - -import org.htmlcleaner.TagNode; - -/** - * Created by Kosh on 10 May 2017, 8:46 PM - */ - -public class LinkHandler extends TagNodeHandler { - private final static int linkColor = Color.parseColor("#4078C0"); - - @Override public void handleTagNode(TagNode node, SpannableStringBuilder spannableStringBuilder, int start, int end) { - String href = node.getAttributeByName("href"); - if (href != null) { - spannableStringBuilder.setSpan(new LinkSpan(href, linkColor), start, end, 33); - } else if (node.getText() != null) { - spannableStringBuilder.setSpan(new LinkSpan("https://github.com/" + node.getText().toString(), linkColor), start, end, 33); - } - } -} diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/ListsHandler.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/ListsHandler.java deleted file mode 100644 index 2d830c962..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/ListsHandler.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.fastaccess.provider.timeline.handler; - -import android.graphics.drawable.Drawable; -import androidx.annotation.Nullable; -import android.text.SpannableStringBuilder; - -import com.fastaccess.helper.Logger; -import com.fastaccess.ui.widgets.SpannableBuilder; - -import net.nightwhistler.htmlspanner.TagNodeHandler; - -import org.htmlcleaner.TagNode; - -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; - -@NoArgsConstructor @AllArgsConstructor public class ListsHandler extends TagNodeHandler { - - @Nullable private Drawable checked; - @Nullable private Drawable unchecked; - - private int getMyIndex(TagNode node) { - if (node.getParent() == null) { - return -1; - } else { - int i = 1; - for (Object child : node.getParent().getChildren()) { - if (child == node) { - return i; - } - if (child instanceof TagNode) { - TagNode childNode = (TagNode) child; - if ("li".equals(childNode.getName())) { - ++i; - } - } - } - return -1; - } - } - - private String getParentName(TagNode node) { - return node.getParent() == null ? null : node.getParent().getName(); - } - - @Override public void beforeChildren(TagNode node, SpannableStringBuilder builder) { - TodoItems todoItem = null; - if (node.getChildTags() != null && node.getChildTags().length > 0) { - for (TagNode tagNode : node.getChildTags()) { - Logger.e(tagNode.getName(), tagNode.getText()); - if (tagNode.getName() != null && tagNode.getName().equals("input")) { - todoItem = new TodoItems(); - todoItem.isChecked = tagNode.getAttributeByName("checked") != null; - break; - } - } - } - if ("ol".equals(getParentName(node))) { - builder.append(String.valueOf(getMyIndex(node))).append(". "); - } else if ("ul".equals(getParentName(node))) { - if (todoItem != null) { - if (checked == null || unchecked == null) { - builder.append(todoItem.isChecked ? "☑" : "☐"); - } else { - builder.append(SpannableBuilder.builder() - .append(todoItem.isChecked ? checked : unchecked)) - .append(" "); - } - } else { - builder.append("\u2022 "); - } - } - } - - @Override public void handleTagNode(TagNode tagNode, SpannableStringBuilder spannableStringBuilder, int i, int i1) { - appendNewLine(spannableStringBuilder); - } - - static class TodoItems { - boolean isChecked; - } -} diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/MarginHandler.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/MarginHandler.java deleted file mode 100644 index 3fec4aa40..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/MarginHandler.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.fastaccess.provider.timeline.handler; - -import android.text.Spannable; -import android.text.SpannableStringBuilder; -import android.text.style.LeadingMarginSpan; - -import net.nightwhistler.htmlspanner.TagNodeHandler; - -import org.htmlcleaner.TagNode; - -/** - * Created by Kosh on 29 Apr 2017, 11:59 PM - */ - -public class MarginHandler extends TagNodeHandler { - - public void beforeChildren(TagNode node, SpannableStringBuilder builder) { - if (builder.length() > 0 && builder.charAt(builder.length() - 1) != 10) { //'10 = \n' - this.appendNewLine(builder); - } - } - - public void handleTagNode(TagNode node, SpannableStringBuilder builder, int start, int end) { - builder.setSpan(new LeadingMarginSpan.Standard(30), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - this.appendNewLine(builder); - } -} diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/PreTagHandler.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/PreTagHandler.java deleted file mode 100644 index 9010e0465..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/PreTagHandler.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.fastaccess.provider.timeline.handler; - -import android.graphics.Color; -import androidx.annotation.ColorInt; -import android.text.SpannableStringBuilder; -import android.text.style.BackgroundColorSpan; -import android.text.style.ForegroundColorSpan; -import android.text.style.TypefaceSpan; - -import com.fastaccess.helper.PrefGetter; - -import net.nightwhistler.htmlspanner.handlers.PreHandler; - -import org.htmlcleaner.ContentNode; -import org.htmlcleaner.TagNode; - -import lombok.AllArgsConstructor; - -import static android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE; - -/** - * Created by Kosh on 22 Apr 2017, 1:07 PM - */ - -@AllArgsConstructor public class PreTagHandler extends PreHandler { - - @ColorInt private final int color; - private final boolean isPre; - @PrefGetter.ThemeType private int theme; - - private void getPlainText(StringBuffer buffer, Object node) { - if (node instanceof ContentNode) { - ContentNode contentNode = (ContentNode) node; - String text = contentNode.getContent().toString(); - buffer.append(text); - } else if (node instanceof TagNode) { - TagNode tagNode = (TagNode) node; - for (Object child : tagNode.getChildren()) { - this.getPlainText(buffer, child); - } - } - } - - private String replace(String text) { - return text.replaceAll(" ", "\u00A0") - .replaceAll("&", "&") - .replaceAll(""", "\"") - .replaceAll("¢", "¢") - .replaceAll("<", "<") - .replaceAll(">", ">") - .replaceAll("§", "§") - .replaceAll("“", "“") - .replaceAll("”", "”") - .replaceAll("‘", "‘") - .replaceAll("’", "’") - .replaceAll("–", "\u2013") - .replaceAll("—", "\u2014") - .replaceAll("―", "\u2015"); - } - - @Override public void handleTagNode(TagNode node, SpannableStringBuilder builder, int start, int end) { - if (isPre) { - StringBuffer buffer = new StringBuffer(); - buffer.append("\n");//fake padding top + make sure, pre is always by itself - getPlainText(buffer, node); - buffer.append("\n");//fake padding bottom + make sure, pre is always by itself - builder.append(replace(buffer.toString())); - builder.append("\n"); - builder.setSpan(new CodeBackgroundRoundedSpan(color), start, builder.length(), SPAN_EXCLUSIVE_EXCLUSIVE); - builder.append("\n"); - this.appendNewLine(builder); - this.appendNewLine(builder); - } else { - CharSequence text = node.getText(); - builder.append(" "); - builder.append(replace(text.toString())); - builder.append(" "); - final int stringStart = start + 1; - final int stringEnd = builder.length() - 1; - builder.setSpan(new BackgroundColorSpan(color), stringStart, stringEnd, SPAN_EXCLUSIVE_EXCLUSIVE); - if (theme == PrefGetter.LIGHT) { - builder.setSpan(new ForegroundColorSpan(Color.RED), stringStart, stringEnd, SPAN_EXCLUSIVE_EXCLUSIVE); - } - builder.setSpan(new TypefaceSpan("monospace"), stringStart, stringEnd, SPAN_EXCLUSIVE_EXCLUSIVE); - } - } -} diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/QuoteHandler.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/QuoteHandler.java deleted file mode 100644 index b1492f0f8..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/QuoteHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.fastaccess.provider.timeline.handler; - -import androidx.annotation.ColorInt; - -import android.text.SpannableStringBuilder; - -import com.zzhoujay.markdown.style.MarkDownQuoteSpan; - -import net.nightwhistler.htmlspanner.TagNodeHandler; - -import org.htmlcleaner.TagNode; - -import lombok.AllArgsConstructor; - -/** - * Created by Kosh on 23 Apr 2017, 11:30 AM - */ - -@AllArgsConstructor public class QuoteHandler extends TagNodeHandler { - - @ColorInt private int color; - - @Override - public void handleTagNode(TagNode node, SpannableStringBuilder builder, int start, int end) { - try { - builder.setSpan(new MarkDownQuoteSpan(color), start + 1, builder.length(), 33); - } catch (IndexOutOfBoundsException e) { - builder.setSpan(new MarkDownQuoteSpan(color), start, builder.length(), 33); - } - } -} diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/StrikethroughHandler.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/StrikethroughHandler.java deleted file mode 100644 index 51eb388ab..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/StrikethroughHandler.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.fastaccess.provider.timeline.handler; - -import android.text.SpannableStringBuilder; -import android.text.style.StrikethroughSpan; - -import net.nightwhistler.htmlspanner.TagNodeHandler; - -import org.htmlcleaner.TagNode; - -public class StrikethroughHandler extends TagNodeHandler { - - @Override public void handleTagNode(TagNode node, SpannableStringBuilder builder, int start, int end) { - builder.setSpan(new StrikethroughSpan(), start, end, 33); - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/SubScriptHandler.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/SubScriptHandler.java deleted file mode 100644 index 4b252c2e4..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/SubScriptHandler.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.fastaccess.provider.timeline.handler; - -import android.text.SpannableStringBuilder; -import android.text.style.RelativeSizeSpan; -import android.text.style.SubscriptSpan; - -import net.nightwhistler.htmlspanner.TagNodeHandler; - -import org.htmlcleaner.TagNode; - -public class SubScriptHandler extends TagNodeHandler { - - @Override public void handleTagNode(TagNode node, SpannableStringBuilder builder, int start, int end) { - builder.setSpan(new SubscriptSpan(), start, end, 33); - builder.setSpan(new RelativeSizeSpan(0.8f), start, end, 33); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/SuperScriptHandler.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/SuperScriptHandler.java deleted file mode 100644 index 1900bdf4b..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/SuperScriptHandler.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.fastaccess.provider.timeline.handler; - -import android.text.SpannableStringBuilder; -import android.text.style.RelativeSizeSpan; -import android.text.style.SuperscriptSpan; - -import net.nightwhistler.htmlspanner.TagNodeHandler; - -import org.htmlcleaner.TagNode; - -public class SuperScriptHandler extends TagNodeHandler { - - @Override public void handleTagNode(TagNode node, SpannableStringBuilder builder, int start, int end) { - builder.setSpan(new SuperscriptSpan(), start, end, 33); - builder.setSpan(new RelativeSizeSpan(0.8f), start, end, 33); - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/TableHandler.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/TableHandler.java deleted file mode 100644 index 4f4326487..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/TableHandler.java +++ /dev/null @@ -1,252 +0,0 @@ -package com.fastaccess.provider.timeline.handler; - -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.ColorFilter; -import android.graphics.Paint; -import android.graphics.Paint.Style; -import android.graphics.PixelFormat; -import android.graphics.Typeface; -import android.graphics.drawable.Drawable; -import androidx.annotation.NonNull; -import android.text.Layout.Alignment; -import android.text.Spannable; -import android.text.SpannableStringBuilder; -import android.text.Spanned; -import android.text.StaticLayout; -import android.text.TextPaint; -import android.text.style.AlignmentSpan; -import android.text.style.ImageSpan; - -import net.nightwhistler.htmlspanner.TagNodeHandler; - -import org.htmlcleaner.TagNode; - -import java.util.ArrayList; -import java.util.List; - -/** - * Handles simple HTML tables. - *

- * Since it renders these tables itself, it needs to know things like font size - * and text colour to use. - * - * @author Alex Kuiper - */ -public class TableHandler extends TagNodeHandler { - - private int tableWidth = 500; - private Typeface typeFace = Typeface.DEFAULT; - private float textSize = 28f; - private int textColor = Color.BLACK; - private static final int PADDING = 20; - - @Override public boolean rendersContent() { - return true; - } - - @Override public void handleTagNode(TagNode node, SpannableStringBuilder builder, int start, int end) { - Table table = getTable(node); - for (int i = 0; i < table.getRows().size(); i++) { - List row = table.getRows().get(i); - builder.append("\uFFFC"); - TableRowDrawable drawable = new TableRowDrawable(row, table.isDrawBorder()); - drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), - drawable.getIntrinsicHeight()); - builder.setSpan(new ImageSpan(drawable), start + i, builder.length(), 33); - - } - builder.append("\uFFFC"); - Drawable drawable = new TableRowDrawable(new ArrayList(), table.isDrawBorder()); - drawable.setBounds(0, 0, tableWidth, 1); - builder.setSpan(new ImageSpan(drawable), builder.length() - 1, builder.length(), - Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - builder.setSpan((AlignmentSpan) () -> Alignment.ALIGN_CENTER, start, builder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - builder.append("\n"); - } - - public void setTableWidth(int tableWidth) { - this.tableWidth = tableWidth; - } - - public void setTextColor(int textColor) { - this.textColor = textColor; - } - - private void readNode(Object node, Table table) { - if (node instanceof TagNode) { - TagNode tagNode = (TagNode) node; - if (tagNode.getName().equals("td") || tagNode.getName().equals("th")) { - Spanned result = this.getSpanner().fromTagNode(tagNode); - table.addCell(result); - return; - } - if (tagNode.getName().equals("tr")) { - table.addRow(); - } - for (Object child : tagNode.getChildTags()) { - readNode(child, table); - } - } - - } - - private Table getTable(TagNode node) { - - String border = node.getAttributeByName("border"); - - boolean drawBorder = !"0".equals(border); - - Table result = new Table(drawBorder); - - readNode(node, result); - - return result; - } - - private TextPaint getTextPaint() { - TextPaint textPaint = new TextPaint(); - textPaint.setColor(this.textColor); - textPaint.linkColor = this.textColor; - textPaint.setAntiAlias(true); - textPaint.setTextSize(this.textSize); - textPaint.setTypeface(this.typeFace); - - return textPaint; - } - - private int calculateRowHeight(List row) { - - if (row.size() == 0) { - return 0; - } - - TextPaint textPaint = getTextPaint(); - - int columnWidth = tableWidth / row.size(); - - int rowHeight = 0; - - for (Spanned cell : row) { - - StaticLayout layout = new StaticLayout(cell, textPaint, columnWidth - - 2 * PADDING, Alignment.ALIGN_NORMAL, 1.5f, 0.5f, true); - - if (layout.getHeight() > rowHeight) { - rowHeight = layout.getHeight(); - } - } - - return rowHeight; - } - - private class TableRowDrawable extends Drawable { - - private List tableRow; - - private int rowHeight; - private boolean paintBorder; - - TableRowDrawable(List tableRow, boolean paintBorder) { - this.tableRow = tableRow; - this.rowHeight = calculateRowHeight(tableRow); - this.paintBorder = paintBorder; - } - - @Override public void draw(@NonNull Canvas canvas) { - Paint paint = new Paint(); - paint.setColor(textColor); - paint.setStyle(Style.STROKE); - - int numberOfColumns = tableRow.size(); - - if (numberOfColumns == 0) { - return; - } - - int columnWidth = tableWidth / numberOfColumns; - - int offset; - - for (int i = 0; i < numberOfColumns; i++) { - - offset = i * columnWidth; - - if (paintBorder) { - // The rect is open at the bottom, so there's a single line - // between rows. - canvas.drawRect(offset, 0, offset + columnWidth, rowHeight, paint); - } - - StaticLayout layout = new StaticLayout(tableRow.get(i), - getTextPaint(), (columnWidth - 2 * PADDING), - Alignment.ALIGN_NORMAL, 1.5f, 0.5f, true); - - canvas.translate(offset + PADDING, 0); - layout.draw(canvas); - canvas.translate(-1 * (offset + PADDING), 0); - - } - } - - @Override - public int getIntrinsicHeight() { - return rowHeight; - } - - @Override - public int getIntrinsicWidth() { - return tableWidth; - } - - @Override - public int getOpacity() { - return PixelFormat.OPAQUE; - } - - @Override - public void setAlpha(int alpha) { - - } - - @Override - public void setColorFilter(ColorFilter cf) { - - } - } - - private class Table { - - private boolean drawBorder; - private List> content = new ArrayList<>(); - - private Table(boolean drawBorder) { - this.drawBorder = drawBorder; - } - - boolean isDrawBorder() { - return drawBorder; - } - - void addRow() { - content.add(new ArrayList<>()); - } - - List getBottomRow() { - return content.get(content.size() - 1); - } - - List> getRows() { - return content; - } - - void addCell(Spanned text) { - if (content.isEmpty()) { - throw new IllegalStateException("No rows added yet"); - } - - getBottomRow().add(text); - } - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/UnderlineHandler.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/UnderlineHandler.java deleted file mode 100644 index 1f7ab595a..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/UnderlineHandler.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.fastaccess.provider.timeline.handler; - -import android.text.SpannableStringBuilder; -import android.text.style.UnderlineSpan; - -import net.nightwhistler.htmlspanner.TagNodeHandler; - -import org.htmlcleaner.TagNode; - -public class UnderlineHandler extends TagNodeHandler { - - @Override public void handleTagNode(TagNode tagNode, SpannableStringBuilder spannableStringBuilder, int start, int end) { - spannableStringBuilder.setSpan(new UnderlineSpan(), start, end, 33); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/drawable/DrawableGetter.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/drawable/DrawableGetter.java deleted file mode 100644 index 7dc256666..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/drawable/DrawableGetter.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.fastaccess.provider.timeline.handler.drawable; - -import android.content.Context; -import android.graphics.drawable.Drawable; -import androidx.annotation.NonNull; -import androidx.core.content.ContextCompat; -import android.text.Html; -import android.widget.TextView; - -import com.bumptech.glide.Glide; -import com.bumptech.glide.RequestBuilder; -import com.fastaccess.App; -import com.fastaccess.GlideApp; -import com.fastaccess.R; - -import java.lang.ref.WeakReference; -import java.util.HashSet; -import java.util.Set; - -/** - * Created by Kosh on 22 Apr 2017, 7:44 PM - */ - -public class DrawableGetter implements Html.ImageGetter, Drawable.Callback { - private WeakReference container; - private final Set cachedTargets; - private final int width; - - public DrawableGetter(TextView tv, int width) { - tv.setTag(R.id.drawable_callback, this); - this.container = new WeakReference<>(tv); - this.cachedTargets = new HashSet<>(); - this.width = width; - } - - @Override public Drawable getDrawable(@NonNull String url) { - final UrlDrawable urlDrawable = new UrlDrawable(); - if (container != null && container.get() != null) { - Context context = container.get().getContext(); - final RequestBuilder load = Glide.with(context) - .load(url) - .placeholder(ContextCompat.getDrawable(context, R.drawable.ic_image)) - .dontAnimate(); - - final GlideDrawableTarget target = new GlideDrawableTarget(urlDrawable, container, width); - load.into(target); - cachedTargets.add(target); - } - return urlDrawable; - } - - @Override public void invalidateDrawable(@NonNull Drawable drawable) { - if (container != null && container.get() != null) { - container.get().invalidate(); - } - } - - @Override public void scheduleDrawable(@NonNull Drawable drawable, @NonNull Runnable runnable, long l) {} - - @Override public void unscheduleDrawable(@NonNull Drawable drawable, @NonNull Runnable runnable) {} - - public void clear(@NonNull DrawableGetter drawableGetter) { - if (drawableGetter.cachedTargets != null) { - for (GlideDrawableTarget target : drawableGetter.cachedTargets) { - GlideApp.with(App.getInstance()).clear(target); - } - } - } -} diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/drawable/GlideDrawableTarget.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/drawable/GlideDrawableTarget.java deleted file mode 100644 index 1f7d31251..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/drawable/GlideDrawableTarget.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.fastaccess.provider.timeline.handler.drawable; - -import android.graphics.Rect; -import android.graphics.drawable.Animatable; -import android.graphics.drawable.Drawable; -import android.widget.TextView; - -import com.bumptech.glide.load.resource.gif.GifDrawable; -import com.bumptech.glide.request.target.SimpleTarget; -import com.bumptech.glide.request.transition.Transition; -import com.fastaccess.R; - -import java.lang.ref.WeakReference; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -class GlideDrawableTarget extends SimpleTarget { - private final UrlDrawable urlDrawable; - private final WeakReference container; - private final int width; - - GlideDrawableTarget(UrlDrawable urlDrawable, WeakReference container, int width) { - this.urlDrawable = urlDrawable; - this.container = container; - this.width = width; - } - - @Override public void onResourceReady(final @NonNull Drawable resource, @Nullable Transition transition) { - if (container != null && container.get() != null) { - TextView textView = container.get(); - textView.post(() -> { - float width; - float height; - if (resource.getIntrinsicWidth() >= this.width) { - float downScale = (float) resource.getIntrinsicWidth() / this.width; - width = (float) (resource.getIntrinsicWidth() / downScale / 1.3); - height = (float) (resource.getIntrinsicHeight() / downScale / 1.3); - } else { - width = (float) resource.getIntrinsicWidth(); - height = (float) resource.getIntrinsicHeight(); - } - Rect rect = new Rect(0, 0, Math.round(width), Math.round(height)); - resource.setBounds(rect); - urlDrawable.setBounds(rect); - urlDrawable.setDrawable(resource); - if (resource instanceof GifDrawable) { - urlDrawable.setCallback((Drawable.Callback) textView.getTag(R.id.drawable_callback)); - ((GifDrawable) resource).setLoopCount(GifDrawable.LOOP_FOREVER); - ((GifDrawable) resource).start(); - } - textView.setText(textView.getText()); - textView.invalidate(); - }); - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/provider/timeline/handler/drawable/UrlDrawable.java b/app/src/main/java/com/fastaccess/provider/timeline/handler/drawable/UrlDrawable.java deleted file mode 100644 index a76f28c33..000000000 --- a/app/src/main/java/com/fastaccess/provider/timeline/handler/drawable/UrlDrawable.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.fastaccess.provider.timeline.handler.drawable; - -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; - -import androidx.annotation.NonNull; - -import com.bumptech.glide.load.resource.gif.GifDrawable; -import com.crashlytics.android.Crashlytics; - -class UrlDrawable extends BitmapDrawable implements Drawable.Callback { - private Drawable drawable; - - @SuppressWarnings("deprecation") UrlDrawable() {} - - @Override public void draw(Canvas canvas) { - if (drawable != null) { - try { - drawable.draw(canvas); - } catch (Exception e) { - Crashlytics.logException(e); - e.printStackTrace(); - } - if (drawable instanceof GifDrawable) { - if (!((GifDrawable) drawable).isRunning()) { - ((GifDrawable) drawable).start(); - } - } - } - } - - public Drawable getDrawable() { - return drawable; - } - - public void setDrawable(Drawable drawable) { - if (this.drawable != null) { - this.drawable.setCallback(null); - } - drawable.setCallback(this); - this.drawable = drawable; - } - - @Override public void invalidateDrawable(@NonNull Drawable who) { - if (getCallback() != null) { - getCallback().invalidateDrawable(who); - } - } - - @Override public void scheduleDrawable(@NonNull Drawable who, @NonNull Runnable what, long when) { - if (getCallback() != null) { - getCallback().scheduleDrawable(who, what, when); - } - } - - @Override public void unscheduleDrawable(@NonNull Drawable who, @NonNull Runnable what) { - if (getCallback() != null) { - getCallback().unscheduleDrawable(who, what); - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/AssigneesAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/AssigneesAdapter.java deleted file mode 100644 index 6079b6a25..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/AssigneesAdapter.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.ui.adapter.viewholder.AssigneesViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.List; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class AssigneesAdapter extends BaseRecyclerAdapter> { - - public interface OnSelectAssignee { - boolean isAssigneeSelected(int position); - - void onToggleSelection(int position, boolean select); - } - - private final OnSelectAssignee onSelectAssignee; - - public AssigneesAdapter(@NonNull List data, @Nullable OnSelectAssignee onSelectAssignee) { - super(data); - this.onSelectAssignee = onSelectAssignee; - } - - @Override protected AssigneesViewHolder viewHolder(ViewGroup parent, int viewType) { - return AssigneesViewHolder.newInstance(parent, onSelectAssignee, this); - } - - @Override protected void onBindView(AssigneesViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/BranchesAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/BranchesAdapter.java deleted file mode 100644 index 5c893c115..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/BranchesAdapter.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.widget.AppCompatImageView; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import com.fastaccess.R; -import com.fastaccess.data.dao.BranchesModel; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 09 Apr 2017, 10:55 AM - */ - -public class BranchesAdapter extends BaseRecyclerAdapter> { - - public BranchesAdapter(@NonNull List data, @Nullable BaseViewHolder.OnItemClickListener listener) { - super(data, listener); - } - - @Override protected BranchesViewHolder viewHolder(ViewGroup parent, int viewType) { - return new BranchesViewHolder(BaseViewHolder.getView(parent, R.layout.branches_row_item), this); - } - - @Override protected void onBindView(BranchesViewHolder holder, int position) { - holder.bind(getItem(position)); - } - - - static class BranchesViewHolder extends BaseViewHolder { - @Nullable @BindView(R.id.image) AppCompatImageView image; - @BindView(android.R.id.text1) TextView title; - - BranchesViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter) { - super(itemView, adapter); - } - - @Override public void bind(@NonNull BranchesModel branchesModel) { - if (image != null) { - image.setImageResource(branchesModel.isTag() ? R.drawable.ic_label : R.drawable.ic_branch); - image.setContentDescription(branchesModel.getName()); - } - title.setText(branchesModel.getName()); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/ColumnCardAdapter.kt b/app/src/main/java/com/fastaccess/ui/adapter/ColumnCardAdapter.kt deleted file mode 100644 index 25d939472..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/ColumnCardAdapter.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.fastaccess.ui.adapter - -import android.view.ViewGroup -import com.fastaccess.data.dao.ProjectCardModel -import com.fastaccess.ui.adapter.viewholder.ColumnCardViewHolder -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created by Hashemsergani on 11.09.17. - */ -class ColumnCardAdapter(date: ArrayList, val isOwner: Boolean) : BaseRecyclerAdapter>(date) { - - override fun viewHolder(parent: ViewGroup, viewType: Int): ColumnCardViewHolder = ColumnCardViewHolder.newInstance(parent, this, isOwner) - - override fun onBindView(holder: ColumnCardViewHolder?, position: Int) { - holder?.bind(data[position]) - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/CommentsAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/CommentsAdapter.java deleted file mode 100644 index 802352b2c..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/CommentsAdapter.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.ui.adapter.viewholder.CommentsViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class CommentsAdapter extends BaseRecyclerAdapter> { - - public CommentsAdapter(@NonNull ArrayList eventsModels) { - super(eventsModels); - } - - @Override protected CommentsViewHolder viewHolder(ViewGroup parent, int viewType) { - return CommentsViewHolder.newInstance(parent, this); - } - - @Override protected void onBindView(CommentsViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/CommitCommentsAdapter.kt b/app/src/main/java/com/fastaccess/ui/adapter/CommitCommentsAdapter.kt deleted file mode 100644 index 1b470b0f5..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/CommitCommentsAdapter.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.fastaccess.ui.adapter - -import android.view.ViewGroup -import com.fastaccess.data.dao.model.Comment -import com.fastaccess.ui.adapter.callback.OnToggleView -import com.fastaccess.ui.adapter.viewholder.CommitCommentsViewHolder -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created by kosh on 15/08/2017. - */ -class CommitCommentsAdapter(data: List, - listener: BaseViewHolder.OnItemClickListener, - var onToggleView: OnToggleView) - : BaseRecyclerAdapter>(data, listener) { - - override fun viewHolder(parent: ViewGroup, viewType: Int): CommitCommentsViewHolder { - return CommitCommentsViewHolder.newInstance(parent, this, onToggleView) - } - - override fun onBindView(holder: CommitCommentsViewHolder, position: Int) { - holder.bind(data[position]) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/CommitFilesAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/CommitFilesAdapter.java deleted file mode 100644 index 1deea53d3..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/CommitFilesAdapter.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.CommitFileChanges; -import com.fastaccess.ui.adapter.callback.OnToggleView; -import com.fastaccess.ui.adapter.viewholder.PullRequestFilesViewHolder; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.files.PullRequestFilesMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class CommitFilesAdapter extends BaseRecyclerAdapter> { - - - @NonNull private OnToggleView onToggleView; - @Nullable private PullRequestFilesMvp.OnPatchClickListener onPatchClickListener; - - public CommitFilesAdapter(@NonNull ArrayList eventsModels, - @NonNull OnToggleView onToggleView, - @Nullable PullRequestFilesMvp.OnPatchClickListener onPatchClickListener) { - super(eventsModels); - this.onToggleView = onToggleView; - this.onPatchClickListener = onPatchClickListener; - } - - @Override protected PullRequestFilesViewHolder viewHolder(ViewGroup parent, int viewType) { - return PullRequestFilesViewHolder.newInstance(parent, this, onToggleView, onPatchClickListener); - } - - @Override protected void onBindView(PullRequestFilesViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/CommitLinesAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/CommitLinesAdapter.java deleted file mode 100644 index 808326c3f..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/CommitLinesAdapter.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.CommitLinesModel; -import com.fastaccess.ui.adapter.viewholder.CommitLinesViewHolder; -import com.fastaccess.ui.adapter.viewholder.SimpleViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; - -import java.util.List; - -public class CommitLinesAdapter extends BaseRecyclerAdapter> { - - public CommitLinesAdapter(@NonNull List data, @Nullable CommitLinesViewHolder.OnItemClickListener listener) { - super(data, listener); - } - - @Override protected CommitLinesViewHolder viewHolder(ViewGroup parent, int viewType) { - return CommitLinesViewHolder.newInstance(parent, this); - } - - @Override protected void onBindView(CommitLinesViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/CommitsAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/CommitsAdapter.java deleted file mode 100644 index dcc645652..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/CommitsAdapter.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.model.Commit; -import com.fastaccess.ui.adapter.viewholder.CommitsViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.List; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class CommitsAdapter extends BaseRecyclerAdapter> { - - public CommitsAdapter(@NonNull List data) { - super(data); - } - - @Override protected CommitsViewHolder viewHolder(ViewGroup parent, int viewType) { - return CommitsViewHolder.newInstance(parent, this); - } - - @Override protected void onBindView(CommitsViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/EmojiAdapter.kt b/app/src/main/java/com/fastaccess/ui/adapter/EmojiAdapter.kt deleted file mode 100644 index debe140ef..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/EmojiAdapter.kt +++ /dev/null @@ -1,58 +0,0 @@ -package com.fastaccess.ui.adapter - -import android.view.ViewGroup -import android.widget.Filter -import android.widget.Filterable -import com.fastaccess.provider.emoji.Emoji -import com.fastaccess.ui.adapter.viewholder.EmojiViewHolder -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created by kosh on 17/08/2017. - */ -class EmojiAdapter(listener: BaseViewHolder.OnItemClickListener) - : BaseRecyclerAdapter>(listener), Filterable { - - var copiedList = mutableListOf() - - override fun viewHolder(parent: ViewGroup, viewType: Int): EmojiViewHolder { - return EmojiViewHolder.newInstance(parent, this) - } - - override fun onBindView(holder: EmojiViewHolder, position: Int) { - holder.bind(data[position]) - } - - override fun getFilter(): Filter { - return object : Filter() { - override fun performFiltering(constraint: CharSequence): Filter.FilterResults { - if (copiedList.isEmpty()) { - copiedList.addAll(data) - } - val text = constraint.toString().toLowerCase() - val filteredResults: List = if (text.isNotBlank()) { - val data = data.filter { - text in it.tags || it.description.contains(text) || - it.unicode.contains(text) || text in it.aliases - } - if (data.isNotEmpty()) data - else copiedList - } else { - copiedList - } - val results = FilterResults() - results.values = filteredResults - results.count = filteredResults.size - return results - } - - @Suppress("UNCHECKED_CAST") - override fun publishResults(var1: CharSequence, results: Filter.FilterResults) { - results.values?.let { - insertItems(it as List) - } - } - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/FastHubNotificationsAdapter.kt b/app/src/main/java/com/fastaccess/ui/adapter/FastHubNotificationsAdapter.kt deleted file mode 100644 index bf29a4994..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/FastHubNotificationsAdapter.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.fastaccess.ui.adapter - -import android.view.ViewGroup -import com.fastaccess.R -import com.fastaccess.data.dao.model.FastHubNotification -import com.fastaccess.ui.adapter.viewholder.FastHubNotificationViewHolder -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created by Kosh on 02 Jun 2017, 1:36 PM - */ - -class FastHubNotificationsAdapter(data: List) : BaseRecyclerAdapter>(data) { - - override fun viewHolder(parent: ViewGroup?, viewType: Int): FastHubNotificationViewHolder { - return FastHubNotificationViewHolder(BaseViewHolder.getView(parent!!, R.layout.fasthub_notification_row_item), this) - } - - override fun onBindView(holder: FastHubNotificationViewHolder?, position: Int) { - holder?.bind(getItem(position)) - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/FeedsAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/FeedsAdapter.java deleted file mode 100644 index 07e42cdcb..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/FeedsAdapter.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.model.Event; -import com.fastaccess.ui.adapter.viewholder.FeedsViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class FeedsAdapter extends BaseRecyclerAdapter> { - - private boolean noImage; - - public FeedsAdapter(@NonNull ArrayList events) { - this(events, false); - } - - public FeedsAdapter(@NonNull ArrayList events, boolean noImage) { - super(events); - this.noImage = noImage; - } - - @Override protected FeedsViewHolder viewHolder(ViewGroup parent, int viewType) { - return new FeedsViewHolder(FeedsViewHolder.getView(parent, noImage), this); - } - - @Override protected void onBindView(FeedsViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/FragmentsPagerAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/FragmentsPagerAdapter.java deleted file mode 100644 index 160e0ee49..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/FragmentsPagerAdapter.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentManager; -import androidx.fragment.app.FragmentStatePagerAdapter; - -import com.fastaccess.data.dao.FragmentPagerAdapterModel; - -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 9:25 AM - */ - -public class FragmentsPagerAdapter extends FragmentStatePagerAdapter { - - private List fragments; - - public FragmentsPagerAdapter(FragmentManager fm, List fragments) { - super(fm); - this.fragments = fragments; - } - - @Override public Fragment getItem(int position) { - return fragments.get(position).getFragment(); - } - - @Override public int getCount() { - return fragments.size(); - } - - @Override public CharSequence getPageTitle(int position) { - return fragments.get(position).getTitle(); - } - - @Override public float getPageWidth(int position) { - return super.getPageWidth(position); - } - - public void remove(FragmentPagerAdapterModel model) { - if (fragments != null) { - fragments.remove(model); - notifyDataSetChanged(); - } - } - - public void remove(int position) { - if (fragments != null) { - fragments.remove(position); - notifyDataSetChanged(); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/GistFilesAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/GistFilesAdapter.java deleted file mode 100644 index a27e3fe55..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/GistFilesAdapter.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.FilesListModel; -import com.fastaccess.ui.adapter.viewholder.GistFilesViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.List; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class GistFilesAdapter extends BaseRecyclerAdapter> { - private boolean isOwner; - - public GistFilesAdapter(@NonNull List data, - @Nullable BaseViewHolder.OnItemClickListener listener, boolean isOwner) { - super(data, listener); - this.isOwner = isOwner; - } - - public void setOwner(boolean owner) { - isOwner = owner; - } - - @Override protected GistFilesViewHolder viewHolder(ViewGroup parent, int viewType) { - return GistFilesViewHolder.newInstance(parent, this, isOwner); - } - - @Override protected void onBindView(GistFilesViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/GistsAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/GistsAdapter.java deleted file mode 100644 index fb9acb65a..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/GistsAdapter.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.ui.adapter.viewholder.GistsViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class GistsAdapter extends BaseRecyclerAdapter> { - - private boolean isForProfile; - - public GistsAdapter(@NonNull ArrayList gistModels) { - this(gistModels, false); - } - - public GistsAdapter(@NonNull ArrayList gistsModels, boolean isForProfile) { - super(gistsModels); - this.isForProfile = isForProfile; - } - - @Override protected GistsViewHolder viewHolder(ViewGroup parent, int viewType) { - return GistsViewHolder.newInstance(parent, this, isForProfile); - } - - @Override protected void onBindView(GistsViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/IssuesAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/IssuesAdapter.java deleted file mode 100644 index 9d1faed72..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/IssuesAdapter.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.ui.adapter.viewholder.IssuesViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.List; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class IssuesAdapter extends BaseRecyclerAdapter> { - - private boolean withAvatar; - private boolean showRepoName; - private boolean showState; - - public IssuesAdapter(@NonNull List data) { - this(data, false); - } - - public IssuesAdapter(@NonNull List data, boolean withAvatar) { - super(data); - this.withAvatar = withAvatar; - } - - public IssuesAdapter(@NonNull List data, boolean withAvatar, boolean showRepoName) { - super(data); - this.withAvatar = withAvatar; - this.showRepoName = showRepoName; - } - - public IssuesAdapter(@NonNull List data, boolean withAvatar, boolean showRepoName, boolean showState) { - super(data); - this.withAvatar = withAvatar; - this.showRepoName = showRepoName; - this.showState = showState; - } - - @Override protected IssuesViewHolder viewHolder(ViewGroup parent, int viewType) { - return IssuesViewHolder.newInstance(parent, this, withAvatar, showRepoName, showState); - } - - @Override protected void onBindView(IssuesViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/IssuesTimelineAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/IssuesTimelineAdapter.java deleted file mode 100644 index fdcde66d5..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/IssuesTimelineAdapter.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.StaggeredGridLayoutManager; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.TimelineModel; -import com.fastaccess.ui.adapter.callback.OnToggleView; -import com.fastaccess.ui.adapter.callback.ReactionsCallback; -import com.fastaccess.ui.adapter.viewholder.CommitThreadViewHolder; -import com.fastaccess.ui.adapter.viewholder.GroupedReviewsViewHolder; -import com.fastaccess.ui.adapter.viewholder.IssueDetailsViewHolder; -import com.fastaccess.ui.adapter.viewholder.IssueTimelineViewHolder; -import com.fastaccess.ui.adapter.viewholder.PullStatusViewHolder; -import com.fastaccess.ui.adapter.viewholder.ReviewsViewHolder; -import com.fastaccess.ui.adapter.viewholder.TimelineCommentsViewHolder; -import com.fastaccess.ui.adapter.viewholder.UnknownTypeViewHolder; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.timeline.timeline.PullRequestTimelineMvp.ReviewCommentCallback; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.List; - -/** - * Created by Kosh on 13 Dec 2016, 1:44 AM - */ - -public class IssuesTimelineAdapter extends BaseRecyclerAdapter> { - - private final OnToggleView onToggleView; - private final boolean showEmojies; - private final ReactionsCallback reactionsCallback; - private final boolean isMerged; - private final ReviewCommentCallback reviewCommentCallback; - private final String repoOwner; - private final String poster; - - public IssuesTimelineAdapter(@NonNull List data, OnToggleView onToggleView, boolean showEmojies, - ReactionsCallback reactionsCallback, boolean isMerged, - ReviewCommentCallback reviewCommentCallback, String repoOwner, String poster) { - super(data); - this.onToggleView = onToggleView; - this.showEmojies = showEmojies; - this.reactionsCallback = reactionsCallback; - this.isMerged = isMerged; - this.reviewCommentCallback = reviewCommentCallback; - this.repoOwner = repoOwner; - this.poster = poster; - } - - public IssuesTimelineAdapter(@NonNull List data, OnToggleView onToggleView, boolean showEmojies, - ReactionsCallback reactionsCallback, String repoOwner, String poster) { - this(data, onToggleView, showEmojies, reactionsCallback, false, null, repoOwner, poster); - } - - @Override protected BaseViewHolder viewHolder(ViewGroup parent, int viewType) { - if (viewType == 0) { - return new UnknownTypeViewHolder(BaseViewHolder.getView(parent, R.layout.unknown_row_item)); - } else if (viewType == TimelineModel.HEADER) { - return IssueDetailsViewHolder.newInstance(parent, this, onToggleView, reactionsCallback, repoOwner, poster); - } else if (viewType == TimelineModel.EVENT) { - return IssueTimelineViewHolder.newInstance(parent, this, isMerged); - } else if (viewType == TimelineModel.REVIEW) { - return ReviewsViewHolder.Companion.newInstance(parent, this); - } else if (viewType == TimelineModel.GROUP) { - return GroupedReviewsViewHolder.newInstance(parent, this, onToggleView, reactionsCallback, - reviewCommentCallback, repoOwner, poster); - } else if (viewType == TimelineModel.COMMIT_COMMENTS) { - return CommitThreadViewHolder.Companion.newInstance(parent, this, onToggleView); - } else if (viewType == TimelineModel.STATUS) { - return PullStatusViewHolder.newInstance(parent); - } - return TimelineCommentsViewHolder.newInstance(parent, this, onToggleView, showEmojies, - reactionsCallback, repoOwner, poster); - } - - @Override protected void onBindView(BaseViewHolder holder, int position) { - TimelineModel model = getItem(position); - if (model.getType() == TimelineModel.HEADER) { - ((IssueDetailsViewHolder) holder).bind(model); - } else if (model.getType() == TimelineModel.EVENT) { - ((IssueTimelineViewHolder) holder).bind(model); - } else if (model.getType() == TimelineModel.COMMENT) { - ((TimelineCommentsViewHolder) holder).bind(model); - } else if (model.getType() == TimelineModel.GROUP) { - ((GroupedReviewsViewHolder) holder).bind(model); - } else if (model.getType() == TimelineModel.REVIEW) { - ((ReviewsViewHolder) holder).bind(model); - } else if (model.getType() == TimelineModel.COMMIT_COMMENTS) { - ((CommitThreadViewHolder) holder).bind(model); - } else if (model.getType() == TimelineModel.STATUS && model.getStatus() != null) { - ((PullStatusViewHolder) holder).bind(model.getStatus()); - } - if (model.getType() != TimelineModel.COMMENT) { - StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) holder.itemView.getLayoutParams(); - layoutParams.setFullSpan(true); - } - } - - @Override public int getItemViewType(int position) { - TimelineModel timelineModel = getData().get(position); - return timelineModel != null ? timelineModel.getType() : super.getItemViewType(position); - } - - -} - diff --git a/app/src/main/java/com/fastaccess/ui/adapter/LabelColorsAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/LabelColorsAdapter.java deleted file mode 100644 index 03340443e..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/LabelColorsAdapter.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.ViewGroup; - -import com.fastaccess.ui.adapter.viewholder.LabelColorsViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.List; - -/** - * Created by Kosh on 02 Apr 2017, 5:19 PM - */ - -public class LabelColorsAdapter extends BaseRecyclerAdapter> { - - public LabelColorsAdapter(@NonNull List data, @Nullable BaseViewHolder.OnItemClickListener listener) { - super(data, listener); - } - - @Override protected LabelColorsViewHolder viewHolder(ViewGroup parent, int viewType) { - return LabelColorsViewHolder.newInstance(parent, this); - } - - @Override protected void onBindView(LabelColorsViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/LabelsAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/LabelsAdapter.java deleted file mode 100644 index 9ac84a53d..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/LabelsAdapter.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.ui.adapter.viewholder.LabelsViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.List; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class LabelsAdapter extends BaseRecyclerAdapter> { - - public interface OnSelectLabel { - boolean isLabelSelected(LabelModel labelModel); - - void onToggleSelection(LabelModel labelModel, boolean select); - } - - @Nullable private OnSelectLabel onSelectLabel; - - public LabelsAdapter(@NonNull List eventsModels, @Nullable OnSelectLabel onSelectLabel) { - super(eventsModels); - this.onSelectLabel = onSelectLabel; - } - - @Override protected LabelsViewHolder viewHolder(ViewGroup parent, int viewType) { - return LabelsViewHolder.newInstance(parent, onSelectLabel, this); - } - - @Override protected void onBindView(LabelsViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/LoginAdapter.kt b/app/src/main/java/com/fastaccess/ui/adapter/LoginAdapter.kt deleted file mode 100644 index df05ca4c9..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/LoginAdapter.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.fastaccess.ui.adapter - -import android.view.ViewGroup -import com.fastaccess.data.dao.model.Login -import com.fastaccess.ui.adapter.viewholder.LoginViewHolder -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created by Kosh on 09 Jul 2017, 5:00 PM - */ -class LoginAdapter constructor(private val small: Boolean = false) - : BaseRecyclerAdapter>() { - - override fun onBindView(holder: LoginViewHolder, position: Int) { - holder.bind(getItem(position)) - } - - override fun viewHolder(parent: ViewGroup, viewType: Int): LoginViewHolder { - return LoginViewHolder.Companion.newInstance(parent, this, small) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/MilestonesAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/MilestonesAdapter.java deleted file mode 100644 index 070985069..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/MilestonesAdapter.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.ui.adapter.viewholder.MilestonesViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class MilestonesAdapter extends BaseRecyclerAdapter> { - - public MilestonesAdapter(@NonNull ArrayList eventsModels) { - super(eventsModels); - } - - @Override protected MilestonesViewHolder viewHolder(ViewGroup parent, int viewType) { - return MilestonesViewHolder.newInstance(parent, this); - } - - @Override protected void onBindView(MilestonesViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/NotificationsAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/NotificationsAdapter.java deleted file mode 100644 index 820b2a196..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/NotificationsAdapter.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.StaggeredGridLayoutManager; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.GroupedNotificationModel; -import com.fastaccess.ui.adapter.viewholder.NotificationsHeaderViewHolder; -import com.fastaccess.ui.adapter.viewholder.NotificationsViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class NotificationsAdapter extends BaseRecyclerAdapter> { - private boolean showUnreadState; - private boolean hideClear; - - public NotificationsAdapter(@NonNull ArrayList eventsModels, boolean showUnreadState) { - super(eventsModels); - this.showUnreadState = showUnreadState; - } - - public NotificationsAdapter(@NonNull ArrayList eventsModels, boolean showUnreadState, boolean hideClear) { - super(eventsModels); - this.showUnreadState = showUnreadState; - this.hideClear = hideClear; - } - - @Override protected BaseViewHolder viewHolder(ViewGroup parent, int viewType) { - if (viewType == GroupedNotificationModel.HEADER) { - return NotificationsHeaderViewHolder.newInstance(parent, this); - } else { - return NotificationsViewHolder.newInstance(parent, this, showUnreadState); - } - } - - @Override protected void onBindView(BaseViewHolder holder, int position) { - if (getItemViewType(position) == GroupedNotificationModel.HEADER) { - ((NotificationsHeaderViewHolder) holder).bind(getItem(position)); - if (hideClear) - if (getItem(Math.min(position + 1, getItemCount() - 1)).getNotification().isUnread()) { - (((NotificationsHeaderViewHolder) holder).itemView).findViewById(R.id.markAsRead).setVisibility(View.VISIBLE); - } - } else { - ((NotificationsViewHolder) holder).bind(getItem(position)); - } - if (getItem(position).getType() == GroupedNotificationModel.HEADER) { - StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) holder.itemView.getLayoutParams(); - layoutParams.setFullSpan(true); - } - } - - @Override public int getItemViewType(int position) { - return getItem(position).getType(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/PinnedReposAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/PinnedReposAdapter.java deleted file mode 100644 index b715a44bb..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/PinnedReposAdapter.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.model.PinnedRepos; -import com.fastaccess.ui.adapter.viewholder.PinnedReposViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.List; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class PinnedReposAdapter extends BaseRecyclerAdapter> { - - private boolean singleLine; - - public PinnedReposAdapter(boolean singleLine) { - this.singleLine = singleLine; - } - - public PinnedReposAdapter(@NonNull List data, @Nullable BaseViewHolder.OnItemClickListener listener) { - super(data, listener); - } - - @Override protected PinnedReposViewHolder viewHolder(ViewGroup parent, int viewType) { - return PinnedReposViewHolder.newInstance(parent, this, singleLine); - } - - @Override protected void onBindView(PinnedReposViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/ProfileOrgsAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/ProfileOrgsAdapter.java deleted file mode 100644 index 5d956bfac..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/ProfileOrgsAdapter.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.fastaccess.ui.adapter; - -import android.view.ViewGroup; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.ui.adapter.viewholder.ProfileOrgsViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -/** - * Created by Kosh on 21 May 2017, 12:30 PM - */ - -public class ProfileOrgsAdapter extends BaseRecyclerAdapter> { - - @Override protected ProfileOrgsViewHolder viewHolder(ViewGroup parent, int viewType) { - return ProfileOrgsViewHolder.newInstance(parent); - } - - @Override protected void onBindView(ProfileOrgsViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/ProfilePinnedReposAdapter.kt b/app/src/main/java/com/fastaccess/ui/adapter/ProfilePinnedReposAdapter.kt deleted file mode 100644 index de64981ff..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/ProfilePinnedReposAdapter.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.fastaccess.ui.adapter - -import android.view.ViewGroup -import com.fastaccess.ui.adapter.viewholder.ProfilePinnedReposViewHolder -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder -import github.GetPinnedReposQuery -import java.text.NumberFormat - -/** - * Created by kosh on 09/08/2017. - */ - -class ProfilePinnedReposAdapter(data: List) : BaseRecyclerAdapter>(data) { - - private val numberFormat = NumberFormat.getNumberInstance()!! - - override fun viewHolder(parent: ViewGroup, viewType: Int): ProfilePinnedReposViewHolder { - return ProfilePinnedReposViewHolder.newInstance(parent, this) - } - - override fun onBindView(holder: ProfilePinnedReposViewHolder, position: Int) { - holder.bind(data[position], numberFormat) - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/ProjectsAdapter.kt b/app/src/main/java/com/fastaccess/ui/adapter/ProjectsAdapter.kt deleted file mode 100644 index b56807ddf..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/ProjectsAdapter.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.fastaccess.ui.adapter - -import android.view.ViewGroup -import com.fastaccess.ui.adapter.viewholder.ProjectViewHolder -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder -import github.RepoProjectsOpenQuery - -/** - * Created by kosh on 09/09/2017. - */ -class ProjectsAdapter(data: ArrayList) : - BaseRecyclerAdapter>(data) { - - override fun viewHolder(parent: ViewGroup, viewType: Int): ProjectViewHolder = ProjectViewHolder.newInstance(parent, this) - - override fun onBindView(holder: ProjectViewHolder?, position: Int) { - holder?.bind(data[position]) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/PullRequestAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/PullRequestAdapter.java deleted file mode 100644 index 61b5af45e..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/PullRequestAdapter.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.ui.adapter.viewholder.PullRequestViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.List; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class PullRequestAdapter extends BaseRecyclerAdapter> { - - private boolean showRepoName; - private boolean withAvatar; - - public PullRequestAdapter(@NonNull List data) { - this(data, false); - } - - public PullRequestAdapter(@NonNull List data, boolean withAvatar) { - super(data); - this.withAvatar = withAvatar; - } - - public PullRequestAdapter(@NonNull List data, boolean withAvatar, boolean showRepoName) { - super(data); - this.withAvatar = withAvatar; - this.showRepoName = showRepoName; - } - - @Override protected PullRequestViewHolder viewHolder(ViewGroup parent, int viewType) { - return PullRequestViewHolder.newInstance(parent, this, withAvatar, showRepoName); - } - - @Override protected void onBindView(PullRequestViewHolder holder, int position) { - holder.bind(getItem(position)); - } - - -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/ReleasesAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/ReleasesAdapter.java deleted file mode 100644 index 322b60b9d..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/ReleasesAdapter.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.model.Release; -import com.fastaccess.ui.adapter.viewholder.ReleasesViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.List; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class ReleasesAdapter extends BaseRecyclerAdapter> { - - public ReleasesAdapter(@NonNull List data) { - super(data); - } - - @Override protected ReleasesViewHolder viewHolder(ViewGroup parent, int viewType) { - return ReleasesViewHolder.newInstance(parent, this); - } - - @Override protected void onBindView(ReleasesViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/RepoFilePathsAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/RepoFilePathsAdapter.java deleted file mode 100644 index 51b782972..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/RepoFilePathsAdapter.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.model.RepoFile; -import com.fastaccess.ui.adapter.viewholder.RepoFilePathsViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class RepoFilePathsAdapter extends BaseRecyclerAdapter> { - - - public RepoFilePathsAdapter(@NonNull ArrayList eventsModels) { - super(eventsModels); - } - - @Override protected RepoFilePathsViewHolder viewHolder(ViewGroup parent, int viewType) { - return RepoFilePathsViewHolder.newInstance(parent, this); - } - - @Override protected void onBindView(RepoFilePathsViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/RepoFilesAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/RepoFilesAdapter.java deleted file mode 100644 index e5f5a6862..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/RepoFilesAdapter.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.model.RepoFile; -import com.fastaccess.ui.adapter.viewholder.RepoFilesViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class RepoFilesAdapter extends BaseRecyclerAdapter> { - - - public RepoFilesAdapter(@NonNull ArrayList eventsModels) { - super(eventsModels); - } - - @Override protected RepoFilesViewHolder viewHolder(ViewGroup parent, int viewType) { - return RepoFilesViewHolder.newInstance(parent, this); - } - - @Override protected void onBindView(RepoFilesViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/ReposAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/ReposAdapter.java deleted file mode 100644 index f3bf3b779..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/ReposAdapter.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.ui.adapter.viewholder.ReposViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.List; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class ReposAdapter extends BaseRecyclerAdapter> { - private boolean isStarred; - private boolean withImage; - - public ReposAdapter(@NonNull List data, boolean isStarred) { - this(data, isStarred, false); - } - - public ReposAdapter(@NonNull List data, boolean isStarred, boolean withImage) { - super(data); - this.isStarred = isStarred; - this.withImage = withImage; - } - - @Override protected ReposViewHolder viewHolder(ViewGroup parent, int viewType) { - return ReposViewHolder.newInstance(parent, this, isStarred, withImage); - } - - @Override protected void onBindView(ReposViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/ReviewCommentsAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/ReviewCommentsAdapter.java deleted file mode 100644 index 38c499a8c..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/ReviewCommentsAdapter.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.ReviewCommentModel; -import com.fastaccess.ui.adapter.callback.OnToggleView; -import com.fastaccess.ui.adapter.callback.ReactionsCallback; -import com.fastaccess.ui.adapter.viewholder.ReviewCommentsViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.List; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class ReviewCommentsAdapter extends BaseRecyclerAdapter> { - - private final OnToggleView onToggleView; - private final ReactionsCallback reactionsCallback; - private final String repoOwner; - private final String poster; - - public ReviewCommentsAdapter(@NonNull List data, - @Nullable BaseViewHolder.OnItemClickListener listener, - OnToggleView onToggleView, ReactionsCallback reactionsCallback, String repoOwner, String poster) { - super(data, listener); - this.onToggleView = onToggleView; - this.reactionsCallback = reactionsCallback; - this.repoOwner = repoOwner; - this.poster = poster; - } - - - @Override protected ReviewCommentsViewHolder viewHolder(ViewGroup parent, int viewType) { - return ReviewCommentsViewHolder.newInstance(parent, this, onToggleView, - reactionsCallback, repoOwner, poster); - } - - @Override protected void onBindView(ReviewCommentsViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/SearchCodeAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/SearchCodeAdapter.java deleted file mode 100644 index 114db6e52..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/SearchCodeAdapter.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.SearchCodeModel; -import com.fastaccess.ui.adapter.viewholder.SearchCodeViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.List; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class SearchCodeAdapter extends BaseRecyclerAdapter> { - - private boolean showRepoName; - - public SearchCodeAdapter(@NonNull List data) { - super(data); - this.showRepoName = showRepoName; - } - - @Override protected SearchCodeViewHolder viewHolder(ViewGroup parent, int viewType) { - return SearchCodeViewHolder.newInstance(parent, this); - } - - @Override protected void onBindView(SearchCodeViewHolder holder, int position) { - holder.bind(getItem(position), showRepoName); - } - - public void showRepoName(boolean showRepoName) { - this.showRepoName = showRepoName; - notifyDataSetChanged(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/SettingsAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/SettingsAdapter.java deleted file mode 100644 index 4a4296bd0..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/SettingsAdapter.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.fastaccess.ui.adapter; - -import android.content.Context; -import androidx.annotation.NonNull; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.BaseAdapter; - -import com.fastaccess.R; -import com.fastaccess.data.dao.SettingsModel; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.ForegroundImageView; - -import java.util.ArrayList; - -import butterknife.BindView; -import butterknife.ButterKnife; - -/** - * Created by JediB on 5/12/2017. - */ - -public class SettingsAdapter extends BaseAdapter { - - private ArrayList settings; - private final LayoutInflater inflater; - - public SettingsAdapter(@NonNull Context context, @NonNull ArrayList settings) { - this.settings = settings; - this.inflater = LayoutInflater.from(context); - } - - @Override public int getCount() { - return settings.size(); - } - - @Override public SettingsModel getItem(int position) { - return settings.get(position); - } - - @Override public long getItemId(int position) { - return position; - } - - @Override public View getView(int position, View convertView, ViewGroup parent) { - ViewHolder viewHolder; - View row = convertView; - if (row == null) { - row = inflater.inflate(R.layout.icon_row_item, parent, false); - viewHolder = new ViewHolder(row); - row.setTag(viewHolder); - } else { - viewHolder = (ViewHolder) row.getTag(); - } - SettingsModel model = getItem(position); - viewHolder.title.setText(model.getTitle()); - viewHolder.image.setImageResource(model.getImage()); - viewHolder.summary.setVisibility(View.GONE); - return row; - } - - static class ViewHolder { - @BindView(R.id.iconItemImage) ForegroundImageView image; - @BindView(R.id.iconItemTitle) FontTextView title; - @BindView(R.id.iconItemSummary) FontTextView summary; - - ViewHolder(View view) {ButterKnife.bind(this, view);} - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/SimpleListAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/SimpleListAdapter.java deleted file mode 100644 index 39425e96e..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/SimpleListAdapter.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.ui.adapter.viewholder.SimpleViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.List; - -public class SimpleListAdapter extends BaseRecyclerAdapter, - SimpleViewHolder.OnItemClickListener> { - public SimpleListAdapter(@NonNull List data, @Nullable SimpleViewHolder.OnItemClickListener listener) { - super(data, listener); - } - - @Override protected SimpleViewHolder viewHolder(ViewGroup parent, int viewType) { - return new SimpleViewHolder<>(BaseViewHolder.getView(parent, R.layout.simple_row_item), this); - } - - @Override protected void onBindView(SimpleViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/SpinnerAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/SpinnerAdapter.java deleted file mode 100644 index 7fe7b87ea..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/SpinnerAdapter.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.fastaccess.ui.adapter; - -import android.content.Context; -import androidx.annotation.NonNull; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.BaseAdapter; -import android.widget.TextView; - -import java.util.List; - -import butterknife.BindView; -import butterknife.ButterKnife; - -/** - * Created by Kosh on 09 Apr 2017, 10:55 AM - */ - -public class SpinnerAdapter extends BaseAdapter { - - private List data; - private Context context; - - public SpinnerAdapter(@NonNull Context context, @NonNull List branches) { - this.data = branches; - this.context = context; - } - - @Override public int getCount() { - return data.size(); - } - - @Override public O getItem(int position) { - return data.get(position); - } - - @Override public long getItemId(int position) { - return position; - } - - @Override public View getView(int position, View convertView, ViewGroup parent) { - return getRowView(position, convertView, parent, false); - } - - @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { - return getRowView(position, convertView, parent, true); - } - - @NonNull private View getRowView(int position, View convertView, ViewGroup parent, boolean isDropDown) { - ViewHolder viewHolder; - if (convertView == null) { - if (!isDropDown) { - convertView = LayoutInflater.from(context).inflate(android.R.layout.simple_list_item_1, parent, false); - } else { - convertView = LayoutInflater.from(context).inflate(android.R.layout.simple_dropdown_item_1line, parent, false); - } - viewHolder = new ViewHolder(convertView); - convertView.setTag(viewHolder); - } else { - viewHolder = (ViewHolder) convertView.getTag(); - } - viewHolder.title.setText(getItem(position).toString()); - return convertView; - } - - static class ViewHolder { - @BindView(android.R.id.text1) TextView title; - - ViewHolder(View view) { - ButterKnife.bind(this, view); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/TeamsAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/TeamsAdapter.java deleted file mode 100644 index 6c55294ce..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/TeamsAdapter.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.TeamsModel; -import com.fastaccess.ui.adapter.viewholder.TeamsViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; - -import java.util.List; - -/** - * Created by Kosh on 03 Apr 2017, 7:52 PM - */ - -public class TeamsAdapter extends BaseRecyclerAdapter> { - - public TeamsAdapter(@NonNull List data) { - super(data); - } - - @Override protected TeamsViewHolder viewHolder(ViewGroup parent, int viewType) { - return TeamsViewHolder.newInstance(parent, this); - } - - @Override protected void onBindView(TeamsViewHolder holder, int position) { - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/TopicsAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/TopicsAdapter.java deleted file mode 100644 index ff5f24998..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/TopicsAdapter.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.fastaccess.ui.adapter; - -import android.content.Intent; -import androidx.annotation.ColorInt; -import androidx.annotation.NonNull; -import android.view.ViewGroup; - -import com.fastaccess.App; -import com.fastaccess.R; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.ui.adapter.viewholder.SimpleViewHolder; -import com.fastaccess.ui.modules.search.SearchActivity; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.List; - -/** - * Created by Kosh on 11 May 2017, 6:58 PM - */ - -public class TopicsAdapter extends BaseRecyclerAdapter, BaseViewHolder.OnItemClickListener> { - private boolean isLightTheme = true; - @ColorInt private int cardBackground; - - public TopicsAdapter(@NonNull List data) { - super(data); - } - - @Override protected SimpleViewHolder viewHolder(ViewGroup parent, int viewType) { - isLightTheme = !AppHelper.isNightMode(parent.getResources()); - cardBackground = ViewHelper.getCardBackground(parent.getContext()); - return new SimpleViewHolder<>(BaseViewHolder.getView(parent, R.layout.topics_row_item), null); - } - - @Override protected void onBindView(SimpleViewHolder holder, int position) { - if (isLightTheme) { - holder.itemView.setBackgroundColor(cardBackground); - } - String item = getItem(position); - holder.itemView.setOnClickListener((view) -> { - Intent intent = new Intent(new Intent(App.getInstance().getApplicationContext(), SearchActivity.class)); - intent.putExtra("search", "topic:\"" + item + "\""); - view.getContext().startActivity(intent); - }); - holder.bind(getItem(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/TrendingAdapter.kt b/app/src/main/java/com/fastaccess/ui/adapter/TrendingAdapter.kt deleted file mode 100644 index 252ab5c99..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/TrendingAdapter.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.fastaccess.ui.adapter - -import android.view.ViewGroup -import com.fastaccess.R -import com.fastaccess.data.dao.TrendingModel -import com.fastaccess.ui.adapter.viewholder.TrendingViewHolder -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created by Kosh on 02 Jun 2017, 1:36 PM - */ - -class TrendingAdapter(data: MutableList) : BaseRecyclerAdapter>(data) { - - override fun viewHolder(parent: ViewGroup?, viewType: Int): TrendingViewHolder { - return TrendingViewHolder(BaseViewHolder.getView(parent!!, R.layout.trending_row_item), this) - } - - override fun onBindView(holder: TrendingViewHolder?, position: Int) { - holder?.bind(getItem(position)) - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/UsersAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/UsersAdapter.java deleted file mode 100644 index 6c36f6c00..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/UsersAdapter.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.fastaccess.ui.adapter; - -import androidx.annotation.NonNull; -import android.view.ViewGroup; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.ui.adapter.viewholder.UsersViewHolder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; - -/** - * Created by Kosh on 11 Nov 2016, 2:07 PM - */ - -public class UsersAdapter extends BaseRecyclerAdapter> { - - private boolean isContributor; - private boolean isFilter; - - public UsersAdapter(@NonNull ArrayList list) { - this(list, false); - } - - public UsersAdapter(@NonNull ArrayList list, boolean isContributor) { - this(list, isContributor, false); - } - - public UsersAdapter(@NonNull ArrayList list, boolean isContributor, boolean isFilter) { - super(list); - this.isContributor = isContributor; - this.isFilter = isFilter; - } - - @Override protected UsersViewHolder viewHolder(ViewGroup parent, int viewType) { - return UsersViewHolder.newInstance(parent, this, isFilter); - } - - @Override protected void onBindView(UsersViewHolder holder, int position) { - holder.bind(getItem(position), isContributor); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/callback/OnToggleView.java b/app/src/main/java/com/fastaccess/ui/adapter/callback/OnToggleView.java deleted file mode 100644 index 36c52fe88..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/callback/OnToggleView.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.fastaccess.ui.adapter.callback; - -public interface OnToggleView { - void onToggle(long id, boolean isCollapsed); - - boolean isCollapsed(long id); -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/callback/ReactionsCallback.java b/app/src/main/java/com/fastaccess/ui/adapter/callback/ReactionsCallback.java deleted file mode 100644 index d02aa2729..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/callback/ReactionsCallback.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.fastaccess.ui.adapter.callback; - -/** - * Created by Kosh on 03 Apr 2017, 2:52 PM - */ - -public interface ReactionsCallback { - boolean isPreviouslyReacted(long id, int vId); - - boolean isCallingApi(long id, int vId); -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/AssigneesViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/AssigneesViewHolder.java deleted file mode 100644 index 8c5d9e160..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/AssigneesViewHolder.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.ui.adapter.AssigneesAdapter; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindColor; -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 2:08 PM - */ - -public class AssigneesViewHolder extends BaseViewHolder { - - @BindView(R.id.avatarLayout) AvatarLayout avatar; - @BindView(R.id.title) FontTextView title; - @BindView(R.id.date) FontTextView date; - @BindColor(R.color.light_gray) int lightGray; - private final AssigneesAdapter.OnSelectAssignee onSelectAssignee; - - @Override public void onClick(View v) { - if (onSelectAssignee != null) { - int position = getAdapterPosition(); - onSelectAssignee.onToggleSelection(position, !onSelectAssignee.isAssigneeSelected(position)); - } else { - super.onClick(v); - } - } - - private AssigneesViewHolder(@NonNull View itemView, @Nullable AssigneesAdapter.OnSelectAssignee onSelectAssignee, - @NonNull BaseRecyclerAdapter adapter) { - super(itemView, adapter); - this.onSelectAssignee = onSelectAssignee; - } - - public static AssigneesViewHolder newInstance(@NonNull ViewGroup viewGroup, @Nullable AssigneesAdapter.OnSelectAssignee onSelectAssignee, - @NonNull BaseRecyclerAdapter adapter) { - return new AssigneesViewHolder(getView(viewGroup, R.layout.feeds_row_item), onSelectAssignee, adapter); - } - - @Override public void bind(@NonNull User user) { - avatar.setUrl(user.getAvatarUrl(), user.getLogin(), user.isOrganizationType(), LinkParserHelper.isEnterprise(user.getHtmlUrl())); - title.setText(user.getLogin()); - date.setVisibility(View.GONE); - if (onSelectAssignee != null) { - itemView.setBackgroundColor(onSelectAssignee.isAssigneeSelected(getAdapterPosition()) - ? lightGray : ViewHelper.getWindowBackground(itemView.getContext())); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ColumnCardViewHolder.kt b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ColumnCardViewHolder.kt deleted file mode 100644 index 6ea18f174..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ColumnCardViewHolder.kt +++ /dev/null @@ -1,52 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder - -import android.view.View -import android.view.ViewGroup -import android.widget.TextView -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.data.dao.ProjectCardModel -import com.fastaccess.data.dao.PullsIssuesParser -import com.fastaccess.helper.ParseDateFormat -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created by Hashemsergani on 11.09.17. - */ -class ColumnCardViewHolder private constructor(item: View, adapter: BaseRecyclerAdapter<*, *, *>, val isOwner: Boolean) - : BaseViewHolder(item, adapter) { - - @BindView(R.id.title) lateinit var title: TextView - @BindView(R.id.addedBy) lateinit var addedBy: TextView - @BindView(R.id.editCard) lateinit var editCard: View - - init { - editCard.setOnClickListener(this) - } - - override fun bind(t: ProjectCardModel) { - title.text = if (t.note.isNullOrBlank()) { - val issue = PullsIssuesParser.getForIssue(t.contentUrl) - if (issue != null) { - "${issue.login}/${issue.repoId}/${issue.number}" - } else { - val pr = PullsIssuesParser.getForPullRequest(t.contentUrl) - if (pr != null) { - "${pr.login}/${pr.repoId}/${pr.number}" - } else { - "(FastHub) - to be fixed by GitHub! Sorry!" - } - } - } else { - t.note - } - addedBy.text = itemView.context.getString(R.string.card_added_by, t.creator?.login, ParseDateFormat.getTimeAgo(t.createdAt)) - } - - companion object { - fun newInstance(parent: ViewGroup, adapter: BaseRecyclerAdapter<*, *, *>, isOwner: Boolean): ColumnCardViewHolder { - return ColumnCardViewHolder(getView(parent, R.layout.column_card_row_layout), adapter, isOwner) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/CommentsViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/CommentsViewHolder.java deleted file mode 100644 index 409643d5b..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/CommentsViewHolder.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.widget.AppCompatImageView; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewTreeObserver; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.provider.timeline.HtmlHelper; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 2:08 PM - */ - -public class CommentsViewHolder extends BaseViewHolder { - - @BindView(R.id.avatarView) AvatarLayout avatar; - @BindView(R.id.date) FontTextView date; - @BindView(R.id.name) FontTextView name; - @BindView(R.id.comment) FontTextView comment; - @BindView(R.id.toggleHolder) View toggleHolder; - @BindView(R.id.toggle) AppCompatImageView toggle; - private final ViewGroup viewGroup; - - @Override public void onClick(View v) { - if (v.getId() == R.id.toggleHolder) { - toggle.callOnClick(); - } else { - super.onClick(v); - } - } - - private CommentsViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter, @NonNull ViewGroup viewGroup) { - super(itemView, adapter); - if (adapter != null && adapter.getRowWidth() == 0) { - itemView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { - @Override public boolean onPreDraw() { - itemView.getViewTreeObserver().removeOnPreDrawListener(this); - adapter.setRowWidth(itemView.getWidth() - ViewHelper.dpToPx(itemView.getContext(), 48)); - return false; - } - }); - } - itemView.setOnClickListener(null); - itemView.setOnLongClickListener(null); - toggleHolder.setOnClickListener(this); - toggle.setOnClickListener(this); - toggle.setOnLongClickListener(this); - this.viewGroup = viewGroup; - } - - public static CommentsViewHolder newInstance(@NonNull ViewGroup viewGroup, @Nullable BaseRecyclerAdapter adapter) { - return new CommentsViewHolder(getView(viewGroup, R.layout.no_emojies_comments_row_item), adapter, viewGroup); - } - - @Override public void bind(@NonNull Comment commentsModel) { - if (commentsModel.getUser() != null) { - avatar.setUrl(commentsModel.getUser().getAvatarUrl(), commentsModel.getUser().getLogin(), - commentsModel.getUser().isOrganizationType(), LinkParserHelper.isEnterprise(commentsModel.getUser().getHtmlUrl())); - } else { - avatar.setUrl(null, null, false, false); - } - if (!InputHelper.isEmpty(commentsModel.getBodyHtml())) { - int width = adapter != null ? adapter.getRowWidth() : 0; - HtmlHelper.htmlIntoTextView(comment, commentsModel.getBodyHtml(), width > 0 ? width : viewGroup.getWidth()); - } else { - comment.setText(""); - } - name.setText(commentsModel.getUser() != null ? commentsModel.getUser().getLogin() : "Anonymous"); - if (commentsModel.getCreatedAt().before(commentsModel.getUpdatedAt())) { - date.setText(String.format("%s %s", ParseDateFormat.getTimeAgo(commentsModel.getCreatedAt()), - date.getResources().getString(R.string.edited))); - } else { - date.setText(ParseDateFormat.getTimeAgo(commentsModel.getCreatedAt())); - } - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/CommitCommentsViewHolder.kt b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/CommitCommentsViewHolder.kt deleted file mode 100644 index f6e526cc1..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/CommitCommentsViewHolder.kt +++ /dev/null @@ -1,121 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder - -import androidx.transition.ChangeBounds -import androidx.transition.TransitionManager -import android.view.View -import android.view.ViewGroup -import android.view.ViewTreeObserver -import android.widget.TextView -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.data.dao.model.Comment -import com.fastaccess.helper.InputHelper -import com.fastaccess.helper.ParseDateFormat -import com.fastaccess.helper.ViewHelper -import com.fastaccess.provider.markdown.MarkDownProvider -import com.fastaccess.provider.scheme.LinkParserHelper -import com.fastaccess.provider.timeline.handler.drawable.DrawableGetter -import com.fastaccess.ui.adapter.callback.OnToggleView -import com.fastaccess.ui.widgets.AvatarLayout -import com.fastaccess.ui.widgets.FontTextView -import com.fastaccess.ui.widgets.ForegroundImageView -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created by kosh on 15/08/2017. - */ -class CommitCommentsViewHolder private constructor(view: View, adapter: BaseRecyclerAdapter<*, *, *>, - val viewGroup: ViewGroup, val onToggleView: OnToggleView) - : BaseViewHolder(view, adapter) { - - init { - if (adapter.getRowWidth() == 0) { - itemView.viewTreeObserver.addOnPreDrawListener(object : ViewTreeObserver.OnPreDrawListener { - override fun onPreDraw(): Boolean { - itemView.viewTreeObserver.removeOnPreDrawListener(this) - adapter.setRowWidth(itemView.width - ViewHelper.dpToPx(itemView.context, 48f)) - return false - } - }) - } - itemView.setOnClickListener(null) - itemView.setOnLongClickListener(null) - commentMenu.setOnClickListener(this) - commentMenu.setOnLongClickListener(this) - toggle.visibility = View.GONE - commentMenu.visibility = View.GONE - commentOptions.visibility = View.GONE - } - - @BindView(R.id.avatarView) lateinit var avatar: AvatarLayout - @BindView(R.id.name) lateinit var name: FontTextView - @BindView(R.id.date) lateinit var date: FontTextView - @BindView(R.id.toggle) lateinit var toggle: ForegroundImageView - @BindView(R.id.commentMenu) lateinit var commentMenu: ForegroundImageView - @BindView(R.id.comment) lateinit var comment: FontTextView - @BindView(R.id.commentOptions) lateinit var commentOptions: View - @BindView(R.id.owner) lateinit var owner: TextView - - override fun onClick(v: View) { - if (v.id == R.id.toggle || v.id == R.id.toggleHolder) { - val position = adapterPosition - onToggleView.onToggle(position.toLong(), !onToggleView.isCollapsed(position.toLong())) - onToggle(onToggleView.isCollapsed(position.toLong()), true) - } else { - super.onClick(v) - } - } - - override fun bind(t: Comment) { - val author3 = t.user - if (author3 != null) { - avatar.setUrl(author3.avatarUrl, author3.login, false, LinkParserHelper.isEnterprise(author3.url)) - name.text = author3.login - } else { - avatar.setUrl(null, null, false, false) - name.text = "" - } - if (!InputHelper.isEmpty(t.body)) { - val width = adapter?.getRowWidth() ?: 0 - if (width > 0) { - MarkDownProvider.setMdText(comment, t.body, width) - } else { - MarkDownProvider.setMdText(comment, t.body) - } - } else { - comment.text = "" - } - if (t.authorAssociation != null && !"none".equals(t.authorAssociation, ignoreCase = true)) { - owner.text = t.authorAssociation.toLowerCase() - owner.visibility = View.VISIBLE - } else { - owner.visibility = View.GONE - } - if (t.createdAt == t.updatedAt) { - date.text = String.format("%s %s", ParseDateFormat.getTimeAgo(t.updatedAt), itemView - .resources.getString(R.string.edited)) - } else { - date.text = ParseDateFormat.getTimeAgo(t.createdAt) - } - onToggle(onToggleView.isCollapsed(adapterPosition.toLong()), false) - } - - private fun onToggle(expanded: Boolean, animate: Boolean) { - if (animate) { - TransitionManager.beginDelayedTransition(viewGroup, ChangeBounds()) - } - toggle.rotation = if (!expanded) 0.0f else 180f - } - - override fun onViewIsDetaching() { - val drawableGetter = comment.getTag(R.id.drawable_callback) as DrawableGetter? - drawableGetter?.clear(drawableGetter) - } - - companion object { - fun newInstance(parent: ViewGroup, adapter: BaseRecyclerAdapter<*, *, *>, onToggleView: OnToggleView): CommitCommentsViewHolder { - return CommitCommentsViewHolder(getView(parent, R.layout.comments_row_item), adapter, parent, onToggleView) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/CommitLinesViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/CommitLinesViewHolder.java deleted file mode 100644 index 27bbe9571..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/CommitLinesViewHolder.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import android.graphics.Color; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.core.content.ContextCompat; -import androidx.appcompat.widget.AppCompatTextView; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.CommitLinesModel; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindView; - -/** - * Created by Kosh on 31 Dec 2016, 3:12 PM - */ - -public class CommitLinesViewHolder extends BaseViewHolder { - - @BindView(R.id.textView) AppCompatTextView textView; - @BindView(R.id.leftLinNo) AppCompatTextView leftLinNo; - @BindView(R.id.rightLinNo) AppCompatTextView rightLinNo; - @BindView(R.id.hasComment) View hasComment; - private final int patchAdditionColor; - private final int patchDeletionColor; - private final int patchRefColor; - - private CommitLinesViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter) { - super(itemView, adapter); - patchAdditionColor = ViewHelper.getPatchAdditionColor(itemView.getContext()); - patchDeletionColor = ViewHelper.getPatchDeletionColor(itemView.getContext()); - patchRefColor = ViewHelper.getPatchRefColor(itemView.getContext()); - textView.setOnLongClickListener(this); - } - - public static CommitLinesViewHolder newInstance(@NonNull ViewGroup viewGroup, @NonNull BaseRecyclerAdapter adapter) { - return new CommitLinesViewHolder(getView(viewGroup, R.layout.commit_line_row_item), adapter); - } - - @Override public void bind(@NonNull CommitLinesModel item) { - leftLinNo.setText(item.getLeftLineNo() > 0 ? String.valueOf(item.getLeftLineNo()) : " "); - rightLinNo.setText(item.getRightLineNo() > 0 ? String.valueOf(item.getRightLineNo()) : " "); - hasComment.setVisibility(item.isHasCommentedOn() ? View.VISIBLE : View.GONE); - switch (item.getColor()) { - case CommitLinesModel.ADDITION: - textView.setBackgroundColor(patchAdditionColor); - break; - case CommitLinesModel.DELETION: - textView.setBackgroundColor(patchDeletionColor); - break; - case CommitLinesModel.PATCH: - leftLinNo.setVisibility(View.GONE); - rightLinNo.setVisibility(View.GONE); - textView.setBackgroundColor(patchRefColor); - break; - default: - textView.setBackgroundColor(Color.TRANSPARENT); - } - if (item.isNoNewLine()) { - textView.setText(SpannableBuilder.builder().append(item.getText()).append(" ") - .append(ContextCompat.getDrawable(textView.getContext(), R.drawable.ic_newline))); - } else { - textView.setText(item.getText()); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/CommitThreadViewHolder.kt b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/CommitThreadViewHolder.kt deleted file mode 100644 index 8fcbdac05..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/CommitThreadViewHolder.kt +++ /dev/null @@ -1,83 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder - -import android.annotation.SuppressLint -import android.view.View -import android.view.ViewGroup -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.data.dao.TimelineModel -import com.fastaccess.data.dao.model.Comment -import com.fastaccess.ui.adapter.CommitCommentsAdapter -import com.fastaccess.ui.adapter.callback.OnToggleView -import com.fastaccess.ui.widgets.FontTextView -import com.fastaccess.ui.widgets.SpannableBuilder -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView - -/** - * Created by kosh on 15/08/2017. - */ -class CommitThreadViewHolder private constructor(view: View, - adapter: BaseRecyclerAdapter<*, *, *>, - val onToggleView: OnToggleView) - : BaseViewHolder(view, adapter), BaseViewHolder.OnItemClickListener { - - @BindView(R.id.pathText) lateinit var pathText: FontTextView - @BindView(R.id.toggle) lateinit var toggle: View - @BindView(R.id.toggleHolder) lateinit var toggleHolder: View - @BindView(R.id.commitComments) lateinit var commitComments: DynamicRecyclerView - - init { - toggleHolder.setOnClickListener(this) - toggle.setOnClickListener(this) - itemView.setOnClickListener(null) - itemView.setOnLongClickListener(null) - } - - override fun onClick(v: View) { - if (v.id == R.id.toggle || v.id == R.id.toggleHolder) { - val position = adapterPosition - onToggleView.onToggle(position.toLong(), !onToggleView.isCollapsed(position.toLong())) - onToggle(onToggleView.isCollapsed(position.toLong())) - } - } - - @SuppressLint("SetTextI18n") - override fun bind(model: TimelineModel) { - val t = model.commit - t?.let { - val builder = SpannableBuilder.builder() - pathText.text = builder.append("${if (!it.login.isNullOrBlank()) it.login else ""} commented on") - .append(if (!it.path.isNullOrEmpty()) { - " ${it.path}#L${it.position} in " - } else { - " " - }) - .url(it.commitId.substring(0, 7)) - it.comments?.let { - if (!it.isEmpty()) commitComments.adapter = CommitCommentsAdapter(it, this, onToggleView) - } - } - onToggle(onToggleView.isCollapsed(adapterPosition.toLong())) - } - - - private fun onToggle(expanded: Boolean) { - toggle.rotation = if (!expanded) 0.0f else 180f - commitComments.visibility = if (!expanded) View.GONE - else if (commitComments.adapter != null) View.VISIBLE - else View.GONE - } - - override fun onItemClick(position: Int, v: View?, item: Comment) {} - - override fun onItemLongClick(position: Int, v: View?, item: Comment) {} - - companion object { - fun newInstance(parent: ViewGroup, adapter: BaseRecyclerAdapter<*, *, *>, - onToggleView: OnToggleView): CommitThreadViewHolder { - return CommitThreadViewHolder(getView(parent, R.layout.grouped_commit_comment_row), adapter, onToggleView) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/CommitsViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/CommitsViewHolder.java deleted file mode 100644 index 6052fdc80..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/CommitsViewHolder.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Commit; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.Date; - -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 2:08 PM - */ - -public class CommitsViewHolder extends BaseViewHolder { - - @BindView(R.id.title) FontTextView title; - @BindView(R.id.avatarLayout) AvatarLayout avatarLayout; - @BindView(R.id.details) FontTextView details; - @BindView(R.id.commentsNo) FontTextView commentsNo; - - private CommitsViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter) { - super(itemView, adapter); - } - - public static CommitsViewHolder newInstance(ViewGroup viewGroup, BaseRecyclerAdapter adapter) { - return new CommitsViewHolder(getView(viewGroup, R.layout.issue_row_item), adapter); - } - - @Override public void bind(@NonNull Commit commit) { - title.setText(commit.getGitCommit().getMessage()); - String login = commit.getAuthor() != null ? commit.getAuthor().getLogin() : commit.getGitCommit().getAuthor().getLogin(); - String avatar = commit.getAuthor() != null ? commit.getAuthor().getAvatarUrl() : null; - Date date = commit.getGitCommit().getAuthor().getDate(); - details.setText(SpannableBuilder.builder() - .bold(InputHelper.toNA(login)) - .append(" ") - .append(ParseDateFormat.getTimeAgo(date))); - avatarLayout.setUrl(avatar, login, false, LinkParserHelper - .isEnterprise(commit.getAuthor() != null ? commit.getAuthor().getUrl() : commit.getGitCommit().getAuthor().getHtmlUrl())); - avatarLayout.setVisibility(View.VISIBLE); - if (commit.getGitCommit() != null && commit.getGitCommit().getCommentCount() > 0) { - commentsNo.setText(String.valueOf(commit.getGitCommit() != null ? commit.getGitCommit().getCommentCount() : 0)); - commentsNo.setVisibility(View.VISIBLE); - } else { - commentsNo.setVisibility(View.GONE); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/EmojiViewHolder.kt b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/EmojiViewHolder.kt deleted file mode 100644 index c26bb6e2f..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/EmojiViewHolder.kt +++ /dev/null @@ -1,29 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder - -import android.view.View -import android.view.ViewGroup -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.provider.emoji.Emoji -import com.fastaccess.ui.widgets.FontTextView -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created by kosh on 17/08/2017. - */ -class EmojiViewHolder private constructor(view: View, adapter: BaseRecyclerAdapter<*, *, *>) - : BaseViewHolder(view, adapter) { - - @BindView(R.id.emoji) lateinit var emojiTextView: FontTextView - - override fun bind(t: Emoji) { - emojiTextView.text = t.unicode - } - - companion object { - fun newInstance(parent: ViewGroup, adapter: BaseRecyclerAdapter<*, *, *>): EmojiViewHolder { - return EmojiViewHolder(getView(parent, R.layout.emoji_row_item), adapter) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/FastHubNotificationViewHolder.kt b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/FastHubNotificationViewHolder.kt deleted file mode 100644 index 8be74ceb2..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/FastHubNotificationViewHolder.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder - -import android.view.View -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.data.dao.model.FastHubNotification -import com.fastaccess.helper.ParseDateFormat -import com.fastaccess.ui.widgets.FontTextView -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created: by Kosh on 02 Jun 2017, 1:27 PM - */ - -open class FastHubNotificationViewHolder(itemView: View, adapter: BaseRecyclerAdapter>) : BaseViewHolder(itemView, adapter) { - - @BindView(R.id.title) lateinit var title: FontTextView - @BindView(R.id.date) lateinit var date: FontTextView - @BindView(R.id.type) lateinit var type: FontTextView - - - override fun bind(t: FastHubNotification) { - title.text = t.title - if (t.date != null) { - date.text = ParseDateFormat.getTimeAgo(t.date) - } - type.text = t.type.name.replace("_", " ") - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/FeedsViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/FeedsViewHolder.java deleted file mode 100644 index 81c19bab7..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/FeedsViewHolder.java +++ /dev/null @@ -1,469 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import android.content.res.Resources; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.text.TextUtils; -import android.view.Gravity; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.GitCommitModel; -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.PayloadModel; -import com.fastaccess.data.dao.TeamsModel; -import com.fastaccess.data.dao.WikiModel; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.Event; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.model.Release; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.data.dao.types.EventsType; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.provider.markdown.MarkDownProvider; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 2:08 PM - */ - -public class FeedsViewHolder extends BaseViewHolder { - - @Nullable @BindView(R.id.avatarLayout) AvatarLayout avatar; - @BindView(R.id.description) FontTextView description; - @BindView(R.id.title) FontTextView title; - @BindView(R.id.date) FontTextView date; - private Resources resources; - - public FeedsViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter) { - super(itemView, adapter); - this.resources = itemView.getResources(); - } - - public static View getView(@NonNull ViewGroup viewGroup, boolean noImage) { - if (noImage) { - return getView(viewGroup, R.layout.feeds_row_no_image_item); - } else { - return getView(viewGroup, R.layout.feeds_row_item); - } - } - - @Override public void bind(@NonNull Event eventsModel) { - appendAvatar(eventsModel); - SpannableBuilder spannableBuilder = SpannableBuilder.builder(); - appendActor(eventsModel, spannableBuilder); - description.setMaxLines(2); - description.setText(""); - description.setVisibility(View.GONE); - if (eventsModel.getType() != null) { - EventsType type = eventsModel.getType(); - if (type == EventsType.WatchEvent) { - appendWatch(spannableBuilder, type, eventsModel); - } else if (type == EventsType.CreateEvent) { - appendCreateEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.CommitCommentEvent) { - appendCommitComment(spannableBuilder, eventsModel); - } else if (type == EventsType.DownloadEvent) { - appendDownloadEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.FollowEvent) { - appendFollowEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.ForkEvent) { - appendForkEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.GistEvent) { - appendGistEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.GollumEvent) { - appendGollumEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.IssueCommentEvent) { - appendIssueCommentEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.IssuesEvent) { - appendIssueEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.MemberEvent) { - appendMemberEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.PublicEvent) { - appendPublicEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.PullRequestEvent) { - appendPullRequestEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.PullRequestReviewCommentEvent) { - appendPullRequestReviewCommentEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.PullRequestReviewEvent) { - appendPullRequestReviewCommentEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.RepositoryEvent) { - appendPublicEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.PushEvent) { - appendPushEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.TeamAddEvent) { - appendTeamEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.DeleteEvent) { - appendDeleteEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.ReleaseEvent) { - appendReleaseEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.ForkApplyEvent) { - appendForkApplyEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.OrgBlockEvent) { - appendOrgBlockEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.ProjectCardEvent) { - appendProjectCardEvent(spannableBuilder, eventsModel, false); - } else if (type == EventsType.ProjectColumnEvent) { - appendProjectCardEvent(spannableBuilder, eventsModel, true); - } else if (type == EventsType.OrganizationEvent) { - appendOrganizationEvent(spannableBuilder, eventsModel); - } else if (type == EventsType.ProjectEvent) { - appendProjectCardEvent(spannableBuilder, eventsModel, false); - } - date.setGravity(Gravity.CENTER); - date.setEventsIcon(type.getDrawableRes()); - } - title.setText(spannableBuilder); - date.setText(ParseDateFormat.getTimeAgo(eventsModel.getCreatedAt())); - } - - private void appendOrganizationEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - spannableBuilder.bold(eventsModel.getPayload().getAction().replaceAll("_", "")) - .append(" ") - .append(eventsModel.getPayload().getInvitation() != null ? eventsModel.getPayload().getInvitation().getLogin() + " " : "") - .append(eventsModel.getPayload().getOrganization().getLogin()); - } - - private void appendProjectCardEvent(SpannableBuilder spannableBuilder, Event eventsModel, boolean isColumn) { - spannableBuilder.bold(eventsModel.getPayload().getAction()) - .append(" ") - .append(!isColumn ? "project" : "column") - .append(" ") - .append(eventsModel.getRepo().getName()); - } - - private void appendOrgBlockEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - spannableBuilder.bold(eventsModel.getPayload().getAction()) - .append(" ") - .append(eventsModel.getPayload().getBlockedUser().getLogin()) - .append(" ") - .append(eventsModel.getPayload().getOrganization().getLogin()); - } - - private void appendForkApplyEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - spannableBuilder.bold(eventsModel.getPayload().getHead()) - .append(" ") - .append(eventsModel.getPayload().getBefore()) - .append(" ") - .append(eventsModel.getRepo() != null ? "in " + eventsModel.getRepo().getName() : ""); - } - - private void appendReleaseEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - Release release = eventsModel.getPayload().getRelease(); - spannableBuilder.bold("released") - .append(" ") - .append(release.getName()) - .append(" ") - .append(eventsModel.getRepo().getName()); - } - - private void appendDeleteEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - spannableBuilder.bold("deleted") - .append(" ") - .append(eventsModel.getPayload().getRefType()) - .append(" ") - .append(eventsModel.getPayload().getRef()) - .append(" ") - .bold("at") - .append(" ") - .append(eventsModel.getRepo().getName()); - } - - private void appendTeamEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - TeamsModel teamsModel = eventsModel.getPayload().getTeam(); - User user = eventsModel.getPayload().getUser(); - spannableBuilder.bold("added") - .append(" ") - .append(user != null ? user.getLogin() : eventsModel.getRepo().getName()) - .append(" ") - .bold("in") - .append(" ") - .append(teamsModel.getName() != null ? teamsModel.getName() : teamsModel.getSlug()); - } - - private void appendPushEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - String ref = eventsModel.getPayload().getRef(); - if (ref.startsWith("refs/heads/")) { - ref = ref.substring(11); - } - spannableBuilder.bold("pushed to") - .append(" ") - .append(ref) - .append(" ") - .bold("at") - .append(" ") - .append(eventsModel.getRepo().getName()); - final List commits = eventsModel.getPayload().getCommits(); - int size = commits != null ? commits.size() : -1; - SpannableBuilder spanCommits = SpannableBuilder.builder(); - if (size > 0) { - if (size != 1) spanCommits.append(String.valueOf(eventsModel.getPayload().getSize())).append(" new commits").append("\n"); - else spanCommits.append("1 new commit").append("\n"); - int max = 5; - int appended = 0; - for (GitCommitModel commit : commits) { - if (commit == null) continue; - String sha = commit.getSha(); - if (TextUtils.isEmpty(sha)) continue; - sha = sha.length() > 7 ? sha.substring(0, 7) : sha; - spanCommits.url(sha).append(" ") - .append(commit.getMessage() != null ? commit.getMessage().replaceAll("\\r?\\n|\\r", " ") : "") - .append("\n"); - appended++; - if (appended == max) break; - } - } - if (spanCommits.length() > 0) { - int last = spanCommits.length(); - description.setMaxLines(5); - description.setText(spanCommits.delete(last - 1, last)); - description.setVisibility(View.VISIBLE); - } else { - description.setText(""); - description.setMaxLines(2); - description.setVisibility(View.GONE); - } - } - - private void appendPullRequestReviewCommentEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - PullRequest pullRequest = eventsModel.getPayload().getPullRequest(); - Comment comment = eventsModel.getPayload().getComment(); - spannableBuilder.bold("reviewed") - .append(" ") - .bold("pull request") - .append(" ") - .bold("in") - .append(" ") - .append(eventsModel.getRepo().getName()) - .bold("#") - .bold(String.valueOf(pullRequest.getNumber())); - if (comment.getBody() != null) { - MarkDownProvider.stripMdText(description, comment.getBody().replaceAll("\\r?\\n|\\r", " ")); - description.setVisibility(View.VISIBLE); - } else { - description.setText(""); - description.setVisibility(View.GONE); - } - } - - private void appendPullRequestEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - PullRequest issue = eventsModel.getPayload().getPullRequest(); - String action = eventsModel.getPayload().getAction(); - if ("synchronize".equals(action)) { - action = "updated"; - } - if (eventsModel.getPayload().getPullRequest().isMerged()) { - action = "merged"; - } - spannableBuilder.bold(action) - .append(" ") - .bold("pull request") - .append(" ") - .append(eventsModel.getRepo().getName()) - .bold("#") - .bold(String.valueOf(issue.getNumber())); - if ("opened".equals(action) || "closed".equals(action)) { - if (issue.getTitle() != null) { - MarkDownProvider.stripMdText(description, issue.getTitle().replaceAll("\\r?\\n|\\r", " ")); - description.setVisibility(View.VISIBLE); - } else { - description.setText(""); - description.setVisibility(View.GONE); - } - } - } - - private void appendPublicEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - String action = "public"; - if (eventsModel.getPayload() != null && "privatized".equalsIgnoreCase(eventsModel.getPayload().getAction())) { - action = "private"; - } - spannableBuilder.append("made") - .append(" ") - .append(eventsModel.getRepo().getName()) - .append(" ") - .append(action); - } - - private void appendMemberEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - User user = eventsModel.getPayload().getMember(); - spannableBuilder.bold("added") - .append(" ") - .append(user != null ? user.getLogin() + " " : "") - .append("as a collaborator") - .append(" ") - .append("to") - .append(" ") - .append(eventsModel.getRepo().getName()); - } - - private void appendIssueEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - Issue issue = eventsModel.getPayload().getIssue(); - boolean isLabel = "label".equals(eventsModel.getPayload().getAction()); - LabelModel label = isLabel ? issue.getLabels() != null && !issue.getLabels().isEmpty() - ? issue.getLabels().get(issue.getLabels().size() - 1) : null : null; - spannableBuilder.bold(isLabel && label != null ? ("Labeled " + label.getName()) : eventsModel.getPayload().getAction()) - .append(" ") - .bold("issue") - .append(" ") - .append(eventsModel.getRepo().getName()) - .bold("#") - .bold(String.valueOf(issue.getNumber())); - if (issue.getTitle() != null) { - MarkDownProvider.stripMdText(description, issue.getTitle().replaceAll("\\r?\\n|\\r", " ")); - description.setVisibility(View.VISIBLE); - } else { - description.setText(""); - description.setVisibility(View.GONE); - } - } - - private void appendIssueCommentEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - Comment comment = eventsModel.getPayload().getComment(); - Issue issue = eventsModel.getPayload().getIssue(); - spannableBuilder.bold("commented") - .append(" ") - .bold("on") - .append(" ") - .bold(issue.getPullRequest() != null ? "pull request" : "issue") - .append(" ") - .append(eventsModel.getRepo().getName()) - .bold("#") - .bold(String.valueOf(issue.getNumber())); - if (comment.getBody() != null) { - MarkDownProvider.stripMdText(description, comment.getBody().replaceAll("\\r?\\n|\\r", " ")); - description.setVisibility(View.VISIBLE); - } else { - description.setText(""); - description.setVisibility(View.GONE); - } - } - - private void appendGollumEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - List wiki = eventsModel.getPayload().getPages(); - if (wiki != null && !wiki.isEmpty()) { - for (WikiModel wikiModel : wiki) { - spannableBuilder.bold(wikiModel.getAction()) - .append(" ") - .append(wikiModel.getPageName()) - .append(" "); - } - } else { - spannableBuilder.bold(resources.getString(R.string.gollum)) - .append(" "); - } - spannableBuilder - .append(eventsModel.getRepo().getName()); - - } - - private void appendGistEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - String action = eventsModel.getPayload().getAction(); - action = "create".equals(action) ? "created" : "update".equals(action) ? "updated" : action; - spannableBuilder.bold(action) - .append(" ") - .append(itemView.getResources().getString(R.string.gist)) - .append(" ") - .append(eventsModel.getPayload().getGist().getGistId()); - } - - private void appendForkEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - spannableBuilder.bold("forked") - .append(" ") - .append(eventsModel.getRepo().getName()); - } - - private void appendFollowEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - spannableBuilder.bold("started following") - .append(" ") - .bold(eventsModel.getPayload().getTarget().getLogin()); - } - - private void appendDownloadEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - spannableBuilder.bold("uploaded a file") - .append(" ") - .append(eventsModel.getPayload().getDownload() != null ? eventsModel.getPayload().getDownload().getName() : "") - .append(" ") - .append("to") - .append(" ") - .append(eventsModel.getRepo().getName()); - } - - private void appendCreateEvent(SpannableBuilder spannableBuilder, Event eventsModel) { - PayloadModel payloadModel = eventsModel.getPayload(); - String refType = payloadModel.getRefType(); - spannableBuilder - .bold("created") - .append(" ") - .append(refType) - .append(" ") - .append(!"repository".equalsIgnoreCase(refType) ? payloadModel.getRef() + " " : "") - .bold("at") - .append(" ") - .append(eventsModel.getRepo().getName()); - if (payloadModel.getDescription() != null) { - MarkDownProvider.stripMdText(description, payloadModel.getDescription().replaceAll("\\r?\\n|\\r", " ")); - description.setVisibility(View.VISIBLE); - } else { - description.setText(""); - description.setVisibility(View.GONE); - } - } - - private void appendWatch(SpannableBuilder spannableBuilder, EventsType type, Event eventsModel) { - spannableBuilder.bold(resources.getString(type.getType()).toLowerCase()) - .append(" ") - .append(eventsModel.getRepo().getName()); - } - - private void appendCommitComment(SpannableBuilder spannableBuilder, Event eventsModel) { - Comment comment = eventsModel.getPayload().getCommitComment() == null ? eventsModel.getPayload().getComment() : eventsModel.getPayload() - .getCommitComment(); - String commitId = comment != null && comment.getCommitId() != null && comment.getCommitId().length() > 10 ? - comment.getCommitId().substring(0, 10) : null; - spannableBuilder.bold("commented") - .append(" ") - .bold("on") - .append(" ") - .bold("commit") - .append(" ") - .append(eventsModel.getRepo().getName()) - .url(commitId != null ? "@" + commitId : ""); - if (comment != null && comment.getBody() != null) { - MarkDownProvider.stripMdText(description, comment.getBody().replaceAll("\\r?\\n|\\r", " ")); - description.setVisibility(View.VISIBLE); - } else { - description.setText(""); - description.setVisibility(View.GONE); - } - } - - private void appendActor(@NonNull Event eventsModel, SpannableBuilder spannableBuilder) { - if (eventsModel.getActor() != null) { - spannableBuilder.append(eventsModel.getActor().getLogin()).append(" "); - } - } - - private void appendAvatar(@NonNull Event eventsModel) { - if (avatar != null) { - if (eventsModel.getActor() != null) { - avatar.setUrl(eventsModel.getActor().getAvatarUrl(), eventsModel.getActor().getLogin(), - eventsModel.getActor().isOrganizationType(), - LinkParserHelper.isEnterprise(eventsModel.getActor().getHtmlUrl())); - } else { - avatar.setUrl(null, null, false, false); - } - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/GistFilesViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/GistFilesViewHolder.java deleted file mode 100644 index dadf0c1bb..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/GistFilesViewHolder.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import android.text.format.Formatter; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.FilesListModel; -import com.fastaccess.ui.adapter.GistFilesAdapter; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.ForegroundImageView; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindView; - -/** - * Created by Kosh on 12 Nov 2016, 3:44 PM - */ - -public class GistFilesViewHolder extends BaseViewHolder { - - @BindView(R.id.fileName) FontTextView fileName; - @BindView(R.id.language) FontTextView language; - @BindView(R.id.size) FontTextView size; - @BindView(R.id.delete) ForegroundImageView delete; - @BindView(R.id.edit) ForegroundImageView edit; - private boolean isOwner; - - private GistFilesViewHolder(@NonNull View itemView, GistFilesAdapter adapter, boolean isOwner) { - super(itemView, adapter); - this.isOwner = isOwner; - if (isOwner) { - delete.setOnClickListener(this); - edit.setOnClickListener(this); - } - } - - public static GistFilesViewHolder newInstance(@NonNull ViewGroup parent, GistFilesAdapter adapter, boolean isOwner) { - return new GistFilesViewHolder(getView(parent, R.layout.gist_files_row_item), adapter, isOwner); - } - - @Override public void bind(@NonNull FilesListModel filesListModel) { - fileName.setText(filesListModel.getFilename()); - language.setText(SpannableBuilder.builder().bold(filesListModel.getType())); - size.setText(Formatter.formatFileSize(size.getContext(), filesListModel.getSize())); - delete.setVisibility(isOwner ? View.VISIBLE : View.GONE); - edit.setVisibility(isOwner ? View.VISIBLE : View.GONE); - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/GistsViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/GistsViewHolder.java deleted file mode 100644 index 5d5fed8e8..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/GistsViewHolder.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 2:08 PM - */ - -public class GistsViewHolder extends BaseViewHolder { - - @Nullable @BindView(R.id.avatarLayout) AvatarLayout avatar; - @BindView(R.id.title) FontTextView title; - @BindView(R.id.date) FontTextView date; - private boolean isFromProfile; - - - private GistsViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter, boolean isFromProfile) { - super(itemView, adapter); - title.setMaxLines(2); - this.isFromProfile = isFromProfile; - } - - public static GistsViewHolder newInstance(@NonNull ViewGroup viewGroup, @Nullable BaseRecyclerAdapter adapter, boolean isFromProfile) { - if (!isFromProfile) { - return new GistsViewHolder(getView(viewGroup, R.layout.feeds_row_item), adapter, false); - } else { - return new GistsViewHolder(getView(viewGroup, R.layout.feeds_row_no_image_item), adapter, true); - } - } - - @Override public void bind(@NonNull Gist item) { - if (!isFromProfile) { - if (avatar != null) { - String url = item.getOwner() != null ? item.getOwner().getAvatarUrl() : item.getUser() != null ? item.getUser().getAvatarUrl() : null; - String login = item.getOwner() != null ? item.getOwner().getLogin() : item.getUser() != null ? item.getUser().getLogin() : null; - avatar.setUrl(url, login, false, LinkParserHelper.isEnterprise( - item.getOwner() != null ? item.getOwner().getHtmlUrl() : item.getUser() != null ? item.getUser().getHtmlUrl() : null)); - } - } - title.setText(item.getDisplayTitle(isFromProfile)); - date.setText(ParseDateFormat.getTimeAgo(item.getCreatedAt())); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/GroupedReviewsViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/GroupedReviewsViewHolder.java deleted file mode 100644 index 9bc7fa2bc..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/GroupedReviewsViewHolder.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; -import android.view.ViewGroup; -import android.widget.LinearLayout; - -import com.fastaccess.R; -import com.fastaccess.data.dao.GroupedReviewModel; -import com.fastaccess.data.dao.ReviewCommentModel; -import com.fastaccess.data.dao.TimelineModel; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.ui.adapter.ReviewCommentsAdapter; -import com.fastaccess.ui.adapter.callback.OnToggleView; -import com.fastaccess.ui.adapter.callback.ReactionsCallback; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.timeline.timeline.PullRequestTimelineMvp; -import com.fastaccess.ui.widgets.DiffLineSpan; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.ForegroundImageView; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; - -import butterknife.BindView; - -/** - * Created by Kosh on 13 Dec 2016, 1:42 AM - */ - -public class GroupedReviewsViewHolder extends BaseViewHolder implements BaseViewHolder.OnItemClickListener { - - @BindView(R.id.stateImage) ForegroundImageView stateImage; - @BindView(R.id.nestedRecyclerView) DynamicRecyclerView nestedRecyclerView; - @BindView(R.id.name) FontTextView name; - @BindView(R.id.toggle) ForegroundImageView toggle; - @BindView(R.id.patch) FontTextView patch; - @BindView(R.id.minimized) View minimized; - @BindView(R.id.addCommentPreview) View addCommentPreview; - @BindView(R.id.toggleHolder) LinearLayout toggleHolder; - @BindView(R.id.bottomToggle) View bottomToggle; - - private final int patchAdditionColor; - private final int patchDeletionColor; - private final int patchRefColor; - private OnToggleView onToggleView; - private ReactionsCallback reactionsCallback; - private String pathText; - private PullRequestTimelineMvp.ReviewCommentCallback reviewCommentCallback; - private ViewGroup viewGroup; - private String repoOwner; - private String poster; - - @Override public void onClick(View v) { - if (v.getId() == R.id.toggle || v.getId() == R.id.toggleHolder || v.getId() == R.id.bottomToggle) { - long position = getId(); - onToggleView.onToggle(position, !onToggleView.isCollapsed(position)); - onToggle(onToggleView.isCollapsed(position), true); - } else { - super.onClick(v); - } - } - - private GroupedReviewsViewHolder(@NonNull View itemView, ViewGroup viewGroup, @Nullable BaseRecyclerAdapter adapter, - @NonNull OnToggleView onToggleView, - @NonNull ReactionsCallback reactionsCallback, - @NonNull PullRequestTimelineMvp.ReviewCommentCallback reviewCommentCallback, - String repoOwner, String poster) { - super(itemView, adapter); - this.onToggleView = onToggleView; - this.viewGroup = viewGroup; - this.reactionsCallback = reactionsCallback; - this.reviewCommentCallback = reviewCommentCallback; - patchAdditionColor = ViewHelper.getPatchAdditionColor(itemView.getContext()); - patchDeletionColor = ViewHelper.getPatchDeletionColor(itemView.getContext()); - patchRefColor = ViewHelper.getPatchRefColor(itemView.getContext()); - this.onToggleView = onToggleView; - this.repoOwner = repoOwner; - this.poster = poster; - bottomToggle.setOnClickListener(this); - nestedRecyclerView.setNestedScrollingEnabled(false); - addCommentPreview.setOnClickListener(this); - toggle.setOnClickListener(this); - toggleHolder.setOnClickListener(this); - itemView.setOnClickListener(null); - itemView.setOnLongClickListener(null); - } - - public static GroupedReviewsViewHolder newInstance(ViewGroup viewGroup, BaseRecyclerAdapter adapter, - @NonNull OnToggleView onToggleView, - @NonNull ReactionsCallback reactionsCallback, - @NonNull PullRequestTimelineMvp.ReviewCommentCallback reviewCommentCallback, - String repoOwner, String poster) { - return new GroupedReviewsViewHolder(getView(viewGroup, R.layout.grouped_review_timeline_row_item), viewGroup, adapter, - onToggleView, reactionsCallback, reviewCommentCallback, repoOwner, poster); - } - - @Override public void bind(@NonNull TimelineModel model) { - GroupedReviewModel groupedReviewModel = model.getGroupedReviewModel(); - this.pathText = groupedReviewModel.getDiffText(); - name.setText(groupedReviewModel.getPath()); - stateImage.setImageResource(R.drawable.ic_eye); - if (groupedReviewModel.getComments() == null || groupedReviewModel.getComments().isEmpty()) { - nestedRecyclerView.setVisibility(View.GONE); - nestedRecyclerView.setAdapter(null); - } else { - nestedRecyclerView.setVisibility(View.VISIBLE); - nestedRecyclerView.setAdapter(new ReviewCommentsAdapter(groupedReviewModel.getComments(), this, - onToggleView, reactionsCallback, repoOwner, poster)); - nestedRecyclerView.addDivider(); - } - onToggle(onToggleView.isCollapsed(getId()), false); - } - - - @Override public void onItemClick(int position, View v, ReviewCommentModel item) { - if (reviewCommentCallback != null) { - reviewCommentCallback.onClick(getAdapterPosition(), position, v, item); - } - } - - @Override public void onItemLongClick(int position, View v, ReviewCommentModel item) { - if (reviewCommentCallback != null) { - reviewCommentCallback.onLongClick(getAdapterPosition(), position, v, item); - } - } - - private void onToggle(boolean expanded, boolean animate) { - if (!expanded) { - minimized.setVisibility(View.GONE); - patch.setText(""); - name.setMaxLines(2); - toggle.setRotation(0.0f); - } else { - minimized.setVisibility(View.VISIBLE); - name.setMaxLines(5); - setPatchText(pathText); - toggle.setRotation(180f); - } - } - - private long getId() { - return getAdapterPosition(); - } - - private void setPatchText(@NonNull String text) { - patch.setText(DiffLineSpan.getSpannable(text, patchAdditionColor, patchDeletionColor, patchRefColor, true)); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/IssueDetailsViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/IssueDetailsViewHolder.java deleted file mode 100644 index 354592a26..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/IssueDetailsViewHolder.java +++ /dev/null @@ -1,296 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import android.graphics.Color; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.transition.ChangeBounds; -import androidx.transition.TransitionManager; -import android.text.TextUtils; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import com.fastaccess.R; -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.ReactionsModel; -import com.fastaccess.data.dao.TimelineModel; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.provider.timeline.CommentsHelper; -import com.fastaccess.provider.timeline.HtmlHelper; -import com.fastaccess.provider.timeline.handler.drawable.DrawableGetter; -import com.fastaccess.ui.adapter.callback.OnToggleView; -import com.fastaccess.ui.adapter.callback.ReactionsCallback; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.LabelSpan; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.Date; -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 13 Dec 2016, 1:03 AM - */ - -public class IssueDetailsViewHolder extends BaseViewHolder { - - @BindView(R.id.avatarView) AvatarLayout avatar; - @BindView(R.id.date) FontTextView date; - @BindView(R.id.name) FontTextView name; - @BindView(R.id.comment) FontTextView comment; - @BindView(R.id.thumbsUp) FontTextView thumbsUp; - @BindView(R.id.thumbsDown) FontTextView thumbsDown; - @BindView(R.id.laugh) FontTextView laugh; - @BindView(R.id.sad) FontTextView sad; - @BindView(R.id.hurray) FontTextView hooray; - @BindView(R.id.heart) FontTextView heart; - @BindView(R.id.toggle) View toggle; - @BindView(R.id.commentMenu) View commentMenu; - @BindView(R.id.commentOptions) View commentOptions; - @BindView(R.id.toggleHolder) View toggleHolder; - @BindView(R.id.emojiesList) View emojiesList; - @BindView(R.id.owner) TextView owner; - @BindView(R.id.labels) TextView labels; - @BindView(R.id.labelsHolder) View labelsHolder; - @BindView(R.id.reactionsList) View reactionsList; - @BindView(R.id.thumbsUpReaction) FontTextView thumbsUpReaction; - @BindView(R.id.thumbsDownReaction) FontTextView thumbsDownReaction; - @BindView(R.id.laughReaction) FontTextView laughReaction; - @BindView(R.id.hurrayReaction) FontTextView hurrayReaction; - @BindView(R.id.sadReaction) FontTextView sadReaction; - @BindView(R.id.heartReaction) FontTextView heartReaction; - @BindView(R.id.rocketReaction) FontTextView rocketReaction; - @BindView(R.id.eyeReaction) FontTextView eyeReaction; - @BindView(R.id.rocket) FontTextView rocket; - @BindView(R.id.eyes) FontTextView eyes; - private OnToggleView onToggleView; - private ReactionsCallback reactionsCallback; - private ViewGroup viewGroup; - private String repoOwner; - private String poster; - - private IssueDetailsViewHolder(@NonNull View itemView, @NonNull ViewGroup viewGroup, @Nullable BaseRecyclerAdapter adapter, - @NonNull OnToggleView onToggleView, @NonNull ReactionsCallback reactionsCallback, - String repoOwner, String poster) { - super(itemView, adapter); - this.onToggleView = onToggleView; - this.viewGroup = viewGroup; - this.reactionsCallback = reactionsCallback; - this.repoOwner = repoOwner; - this.poster = poster; - itemView.setOnClickListener(null); - itemView.setOnLongClickListener(null); - commentMenu.setOnClickListener(this); - toggle.setOnClickListener(this); - toggleHolder.setOnClickListener(this); - laugh.setOnClickListener(this); - sad.setOnClickListener(this); - thumbsDown.setOnClickListener(this); - thumbsUp.setOnClickListener(this); - hooray.setOnClickListener(this); - laugh.setOnLongClickListener(this); - sad.setOnLongClickListener(this); - thumbsDown.setOnLongClickListener(this); - thumbsUp.setOnLongClickListener(this); - hooray.setOnLongClickListener(this); - heart.setOnLongClickListener(this); - heart.setOnClickListener(this); - laughReaction.setOnClickListener(this); - sadReaction.setOnClickListener(this); - thumbsDownReaction.setOnClickListener(this); - thumbsUpReaction.setOnClickListener(this); - hurrayReaction.setOnClickListener(this); - heartReaction.setOnClickListener(this); - laughReaction.setOnLongClickListener(this); - sadReaction.setOnLongClickListener(this); - thumbsDownReaction.setOnLongClickListener(this); - thumbsUpReaction.setOnLongClickListener(this); - hurrayReaction.setOnLongClickListener(this); - heartReaction.setOnLongClickListener(this); - rocketReaction.setOnLongClickListener(this); - rocketReaction.setOnClickListener(this); - rocket.setOnLongClickListener(this); - rocket.setOnClickListener(this); - eyeReaction.setOnLongClickListener(this); - eyeReaction.setOnClickListener(this); - eyes.setOnLongClickListener(this); - eyes.setOnClickListener(this); - } - - public static IssueDetailsViewHolder newInstance(@NonNull ViewGroup viewGroup, @Nullable BaseRecyclerAdapter adapter, - @NonNull OnToggleView onToggleView, @NonNull ReactionsCallback reactionsCallback, - @NonNull String repoOwner, @NonNull String poster) { - return new IssueDetailsViewHolder(getView(viewGroup, R.layout.issue_detail_header_row_item), viewGroup, - adapter, onToggleView, reactionsCallback, repoOwner, poster); - } - - @Override public void bind(@NonNull TimelineModel timelineModel) { - if (timelineModel.getIssue() != null) { - bind(timelineModel.getIssue()); - } else if (timelineModel.getPullRequest() != null) { - bind(timelineModel.getPullRequest()); - } - if (onToggleView != null) onToggle(onToggleView.isCollapsed(getAdapterPosition()), false); - } - - @Override public void onClick(View v) { - if (v.getId() == R.id.toggle || v.getId() == R.id.toggleHolder) { - if (onToggleView != null) { - int position = getAdapterPosition(); - onToggleView.onToggle(position, !onToggleView.isCollapsed(position)); - onToggle(onToggleView.isCollapsed(position), true); - } - } else { - addReactionCount(v); - super.onClick(v); - } - } - - private void addReactionCount(View v) { - if (adapter != null) { - TimelineModel timelineModel = (TimelineModel) adapter.getItem(getAdapterPosition()); - if (timelineModel == null) return; - ReactionsModel reactionsModel = null; - PullRequest pullRequest = timelineModel.getPullRequest(); - Issue issue = timelineModel.getIssue(); - int number = 0; - if (pullRequest != null) { - reactionsModel = pullRequest.getReactions(); - number = pullRequest.getNumber(); - } else if (issue != null) { - reactionsModel = issue.getReactions(); - number = issue.getNumber(); - } - if (reactionsModel == null) reactionsModel = new ReactionsModel(); - boolean isReacted = reactionsCallback == null || reactionsCallback.isPreviouslyReacted(number, v.getId()); - boolean isCallingApi = reactionsCallback != null && reactionsCallback.isCallingApi(number, v.getId()); - switch (v.getId()) { - case R.id.heart: - case R.id.heartReaction: - reactionsModel.setHeart(!isReacted ? reactionsModel.getHeart() + 1 : reactionsModel.getHeart() - 1); - break; - case R.id.sad: - case R.id.sadReaction: - reactionsModel.setConfused(!isReacted ? reactionsModel.getConfused() + 1 : reactionsModel.getConfused() - 1); - break; - case R.id.thumbsDown: - case R.id.thumbsDownReaction: - reactionsModel.setMinusOne(!isReacted ? reactionsModel.getMinusOne() + 1 : reactionsModel.getMinusOne() - 1); - break; - case R.id.thumbsUp: - case R.id.thumbsUpReaction: - reactionsModel.setPlusOne(!isReacted ? reactionsModel.getPlusOne() + 1 : reactionsModel.getPlusOne() - 1); - break; - case R.id.laugh: - case R.id.laughReaction: - reactionsModel.setLaugh(!isReacted ? reactionsModel.getLaugh() + 1 : reactionsModel.getLaugh() - 1); - break; - case R.id.hurray: - case R.id.hurrayReaction: - reactionsModel.setHooray(!isReacted ? reactionsModel.getHooray() + 1 : reactionsModel.getHooray() - 1); - break; - case R.id.rocket: - case R.id.rocketReaction: - reactionsModel.setRocket(!isReacted ? reactionsModel.getRocket() + 1 : reactionsModel.getRocket() - 1); - break; - case R.id.eyes: - case R.id.eyeReaction: - reactionsModel.setEyes(!isReacted ? reactionsModel.getEyes() + 1 : reactionsModel.getEyes() - 1); - break; - } - if (pullRequest != null) { - pullRequest.setReactions(reactionsModel); - appendEmojies(reactionsModel); - timelineModel.setPullRequest(pullRequest); - } else if (issue != null) { - issue.setReactions(reactionsModel); - appendEmojies(reactionsModel); - timelineModel.setIssue(issue); - } - } - } - - private void bind(@NonNull Issue issueModel) { - setup(issueModel.getUser(), issueModel.getBodyHtml(), issueModel.getReactions()); - setupDate(issueModel.getCreatedAt(), issueModel.getUpdatedAt()); - setupLabels(issueModel.getLabels()); - } - - private void bind(@NonNull PullRequest pullRequest) { - setup(pullRequest.getUser(), pullRequest.getBodyHtml(), pullRequest.getReactions()); - setupDate(pullRequest.getCreatedAt(), pullRequest.getUpdatedAt()); - setupLabels(pullRequest.getLabels()); - } - - private void setup(User user, String description, ReactionsModel reactionsModel) { - avatar.setUrl(user.getAvatarUrl(), user.getLogin(), user.isOrganizationType(), LinkParserHelper.isEnterprise(user.getHtmlUrl())); - name.setText(user.getLogin()); - boolean isOwner = TextUtils.equals(repoOwner, user.getLogin()); - if (isOwner) { - owner.setVisibility(View.VISIBLE); - owner.setText(R.string.owner); - } else { - owner.setText(""); - owner.setVisibility(View.GONE); - } - if (reactionsModel != null) { - appendEmojies(reactionsModel); - } - if (!InputHelper.isEmpty(description)) { - HtmlHelper.htmlIntoTextView(comment, description, viewGroup.getWidth() - ViewHelper.dpToPx(itemView.getContext(), 24)); - } else { - comment.setText(R.string.no_description_provided); - } - } - - private void setupDate(@NonNull Date createdDate, @NonNull Date updated) { - date.setText(ParseDateFormat.getTimeAgo(createdDate)); - } - - private void setupLabels(@Nullable List labelList) { - if (labelList != null && !labelList.isEmpty()) { - SpannableBuilder builder = SpannableBuilder.builder(); - for (LabelModel labelModel : labelList) { - int color = Color.parseColor("#" + labelModel.getColor()); - builder.append(" ").append(" " + labelModel.getName() + " ", new LabelSpan(color)); - } - labels.setText(builder); - labelsHolder.setVisibility(View.VISIBLE); - } else { - labels.setText(""); - labelsHolder.setVisibility(View.GONE); - } - } - - private void appendEmojies(ReactionsModel reaction) { - CommentsHelper.appendEmojies(reaction, thumbsUp, thumbsUpReaction, thumbsDown, thumbsDownReaction, hooray, hurrayReaction, sad, - sadReaction, laugh, laughReaction, heart, heartReaction, rocket, rocketReaction, eyes, eyeReaction, reactionsList); - } - - private void onToggle(boolean expanded, boolean animate) { - if (animate) { - TransitionManager.beginDelayedTransition(viewGroup, new ChangeBounds()); - } - toggle.setRotation(!expanded ? 0.0F : 180F); - commentOptions.setVisibility(!expanded ? View.GONE : View.VISIBLE); - reactionsList.setVisibility(expanded ? View.GONE : reactionsList.getTag() == null || (!((Boolean) reactionsList.getTag())) - ? View.GONE : View.VISIBLE); - } - - @Override protected void onViewIsDetaching() { - DrawableGetter drawableGetter = (DrawableGetter) comment.getTag(R.id.drawable_callback); - if (drawableGetter != null) { - drawableGetter.clear(drawableGetter); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/IssueTimelineViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/IssueTimelineViewHolder.java deleted file mode 100644 index fe595d0fc..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/IssueTimelineViewHolder.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.TimelineModel; -import com.fastaccess.data.dao.timeline.GenericEvent; -import com.fastaccess.data.dao.types.IssueEventType; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.provider.timeline.TimelineProvider; -import com.fastaccess.provider.timeline.handler.drawable.DrawableGetter; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.ForegroundImageView; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindView; - -/** - * Created by Kosh on 13 Dec 2016, 1:42 AM - */ - -public class IssueTimelineViewHolder extends BaseViewHolder { - - @BindView(R.id.stateImage) ForegroundImageView stateImage; - @BindView(R.id.avatarLayout) AvatarLayout avatarLayout; - @BindView(R.id.stateText) FontTextView stateText; - private boolean isMerged; - - private IssueTimelineViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter, boolean isMerged) { - super(itemView, adapter); - this.isMerged = isMerged; - } - - public static IssueTimelineViewHolder newInstance(ViewGroup viewGroup, BaseRecyclerAdapter adapter, boolean isMerged) { - return new IssueTimelineViewHolder(getView(viewGroup, R.layout.issue_timeline_row_item), adapter, isMerged); - } - - @Override public void bind(@NonNull TimelineModel timelineModel) { - GenericEvent issueEventModel = timelineModel.getGenericEvent(); - IssueEventType event = issueEventModel.getEvent(); - if (issueEventModel.getAssignee() != null && issueEventModel.getAssigner() != null) { - avatarLayout.setUrl(issueEventModel.getAssigner().getAvatarUrl(), issueEventModel.getAssigner().getLogin(), - false, LinkParserHelper.isEnterprise(issueEventModel.getUrl())); - } else { - if (event != IssueEventType.committed) { - avatarLayout.setVisibility(View.VISIBLE); - if (issueEventModel.getActor() != null) { - avatarLayout.setUrl(issueEventModel.getActor().getAvatarUrl(), issueEventModel.getActor().getLogin(), - false, LinkParserHelper.isEnterprise(issueEventModel.getUrl())); - } else if (issueEventModel.getAuthor() != null) { - avatarLayout.setUrl(issueEventModel.getAuthor().getAvatarUrl(), issueEventModel.getAuthor().getLogin(), - false, LinkParserHelper.isEnterprise(issueEventModel.getUrl())); - } - } else { - avatarLayout.setVisibility(View.GONE); - } - } - if (event != null) { - stateImage.setContentDescription(event.name()); - stateImage.setImageResource(event.getIconResId()); - } - if (event != null) { - stateText.setText(TimelineProvider.getStyledEvents(issueEventModel, itemView.getContext(), isMerged)); - } else { - stateText.setText(""); - stateImage.setImageResource(R.drawable.ic_label); - } - } - - @Override protected void onViewIsDetaching() { - DrawableGetter drawableGetter = (DrawableGetter) stateText.getTag(R.id.drawable_callback); - if (drawableGetter != null) { - drawableGetter.clear(drawableGetter); - } - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/IssuesViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/IssuesViewHolder.java deleted file mode 100644 index dd71535e6..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/IssuesViewHolder.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.widget.AppCompatImageView; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.PullsIssuesParser; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindString; -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 2:08 PM - */ - -public class IssuesViewHolder extends BaseViewHolder { - - @BindView(R.id.title) FontTextView title; - @Nullable @BindView(R.id.avatarLayout) AvatarLayout avatarLayout; - @BindView(R.id.issue_state) AppCompatImageView issueState; - @BindView(R.id.details) FontTextView details; - @BindView(R.id.commentsNo) FontTextView commentsNo; - @BindString(R.string.by) String by; - - private boolean withAvatar; - private boolean showRepoName; - private boolean showState; - - private IssuesViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter, - boolean withAvatar, boolean showRepoName) { - this(itemView, adapter, withAvatar, showRepoName, false); - } - - private IssuesViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter, - boolean withAvatar, boolean showRepoName, boolean showState) { - super(itemView, adapter); - this.withAvatar = withAvatar; - this.showRepoName = showRepoName; - this.showState = showState; - } - - public static IssuesViewHolder newInstance(ViewGroup viewGroup, BaseRecyclerAdapter adapter, boolean withAvatar, boolean showRepoName) { - return newInstance(viewGroup, adapter, withAvatar, showRepoName, false); - } - - public static IssuesViewHolder newInstance(ViewGroup viewGroup, BaseRecyclerAdapter adapter, boolean withAvatar, - boolean showRepoName, boolean showState) { - if (withAvatar) { - return new IssuesViewHolder(getView(viewGroup, R.layout.issue_row_item), adapter, true, showRepoName, showState); - } else { - return new IssuesViewHolder(getView(viewGroup, R.layout.issue_no_image_row_item), adapter, false, showRepoName, showState); - } - } - - @Override public void bind(@NonNull Issue issueModel) { - title.setText(issueModel.getTitle()); - if (issueModel.getState() != null) { - CharSequence data = ParseDateFormat.getTimeAgo(issueModel.getState() == IssueState.open - ? issueModel.getCreatedAt() : issueModel.getClosedAt()); - SpannableBuilder builder = SpannableBuilder.builder(); - if (showRepoName) { - PullsIssuesParser parser = PullsIssuesParser.getForIssue(issueModel.getHtmlUrl()); - if (parser != null) builder.bold(parser.getLogin()) - .append("/") - .bold(parser.getRepoId()) - .bold("#") - .bold(String.valueOf(issueModel.getNumber())).append(" ") - .append(" "); - } - if (!showRepoName) { - if (issueModel.getState() == IssueState.closed) { - if (issueModel.getClosedBy() == null) { - builder.bold("#") - .bold(String.valueOf(issueModel.getNumber())).append(" ") - .append(" "); - } else { - builder.append("#") - .append(String.valueOf(issueModel.getNumber())).append(" ") - .append(issueModel.getClosedBy().getLogin()) - .append(" "); - } - } else { - builder.bold("#") - .bold(String.valueOf(issueModel.getNumber())).append(" ") - .append(issueModel.getUser().getLogin()) - .append(" "); - } - } - details.setText(builder - .append(itemView.getResources().getString(issueModel.getState().getStatus()).toLowerCase()) - .append(" ") - .append(data)); - if (issueModel.getComments() > 0) { - commentsNo.setText(String.valueOf(issueModel.getComments())); - commentsNo.setVisibility(View.VISIBLE); - } else { - commentsNo.setVisibility(View.GONE); - } - } - if (showState) { - issueState.setVisibility(View.VISIBLE); - issueState.setImageResource(issueModel.getState() == IssueState.open ? - R.drawable.ic_issue_opened_small : R.drawable.ic_issue_closed_small); - } else { - issueState.setVisibility(View.GONE); - } - if (withAvatar && avatarLayout != null) { - avatarLayout.setUrl(issueModel.getUser().getAvatarUrl(), issueModel.getUser().getLogin(), false, - LinkParserHelper.isEnterprise(issueModel.getUser().getHtmlUrl())); - avatarLayout.setVisibility(View.VISIBLE); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/LabelColorsViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/LabelColorsViewHolder.java deleted file mode 100644 index 117b5b60e..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/LabelColorsViewHolder.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import android.graphics.Color; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindView; - -/** - * Created by Kosh on 02 Apr 2017, 5:19 PM - */ - -public class LabelColorsViewHolder extends BaseViewHolder { - - @BindView(R.id.color) FontTextView color; - - private LabelColorsViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter) { - super(itemView, adapter); - } - - public static LabelColorsViewHolder newInstance(ViewGroup parent, BaseRecyclerAdapter adapter) { - return new LabelColorsViewHolder(getView(parent, R.layout.simple_color_row_item), adapter); - } - - @Override public void bind(@NonNull String labelModel) { - int labelColor = Color.parseColor(labelModel); - itemView.setBackgroundColor(labelColor); - color.setTextColor(ViewHelper.generateTextColor(labelColor)); - color.setText(labelModel); - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/LabelsViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/LabelsViewHolder.java deleted file mode 100644 index cd57af4ab..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/LabelsViewHolder.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import android.graphics.Color; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.widget.AppCompatImageView; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.ui.adapter.LabelsAdapter; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindView; - -/** - * Created by Kosh on 22 Feb 2017, 7:36 PM - */ - -public class LabelsViewHolder extends BaseViewHolder { - - - @BindView(R.id.colorImage) AppCompatImageView colorImage; - @BindView(R.id.name) FontTextView name; - private LabelsAdapter.OnSelectLabel onSelectLabel; - - @Override public void onClick(View v) { - if (onSelectLabel != null) { - int position = getAdapterPosition(); - if (adapter != null) { - LabelModel labelModel = (LabelModel) adapter.getItem(position); - onSelectLabel.onToggleSelection(labelModel, !onSelectLabel.isLabelSelected(labelModel)); - } - } else { - super.onClick(v); - } - } - - private LabelsViewHolder(@NonNull View itemView, LabelsAdapter.OnSelectLabel onSelectLabel, @NonNull BaseRecyclerAdapter adapter) { - super(itemView, adapter); - this.onSelectLabel = onSelectLabel; - } - - public static LabelsViewHolder newInstance(@NonNull ViewGroup parent, @Nullable LabelsAdapter.OnSelectLabel onSelectLabel, - @NonNull BaseRecyclerAdapter adapter) { - return new LabelsViewHolder(getView(parent, R.layout.label_row_item), onSelectLabel, adapter); - } - - @Override public void bind(@NonNull LabelModel labelModel) { - name.setText(labelModel.getName()); - if (labelModel.getColor() != null) { - int color = Color.parseColor(labelModel.getColor().startsWith("#") ? labelModel.getColor() : "#" + labelModel.getColor()); - colorImage.setBackgroundColor(color); - if (onSelectLabel != null) { - if (onSelectLabel.isLabelSelected(labelModel)) { - name.setTextColor(ViewHelper.generateTextColor(color)); - } else { - name.setTextColor(ViewHelper.getPrimaryTextColor(itemView.getContext())); - } - itemView.setBackgroundColor(onSelectLabel.isLabelSelected(labelModel) ? color : 0); - } - } else { - colorImage.setBackgroundColor(0); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/LoginViewHolder.kt b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/LoginViewHolder.kt deleted file mode 100644 index 77945c825..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/LoginViewHolder.kt +++ /dev/null @@ -1,41 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder - -import android.annotation.SuppressLint -import android.net.Uri -import android.view.View -import android.view.ViewGroup -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.data.dao.model.Login -import com.fastaccess.ui.widgets.AvatarLayout -import com.fastaccess.ui.widgets.FontTextView -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created by Kosh on 09 Jul 2017, 4:54 PM - */ - -class LoginViewHolder private constructor(itemView: View, adapter: BaseRecyclerAdapter<*, *, *>?) : - BaseViewHolder(itemView, adapter) { - - val avatarLayout: AvatarLayout? by lazy { itemView.findViewById(R.id.avatarLayout) } - @BindView(R.id.title) lateinit var title: FontTextView - - @SuppressLint("SetTextI18n") - override fun bind(login: Login) { - avatarLayout?.setUrl(login.avatarUrl, null, false, false) - title.text = if (login.isIsEnterprise) { - val uri: String? = Uri.parse(login.enterpriseUrl).authority - "${login.login} ${if (uri.isNullOrBlank()) login.enterpriseUrl else uri}" - } else { - login.login - } - } - - companion object { - fun newInstance(parent: ViewGroup, adapter: BaseRecyclerAdapter<*, *, *>, small: Boolean): LoginViewHolder { - return LoginViewHolder(BaseViewHolder.getView(parent, if (small) R.layout.login_row_item_menu else R.layout.login_row_item), adapter) - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/MilestonesViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/MilestonesViewHolder.java deleted file mode 100644 index f86bfdb7f..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/MilestonesViewHolder.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 2:08 PM - */ - -public class MilestonesViewHolder extends BaseViewHolder { - - @BindView(R.id.title) FontTextView title; - @BindView(R.id.date) FontTextView date; - @BindView(R.id.notificationTitle) FontTextView notificationTitle; - - private MilestonesViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter) { - super(itemView, adapter); - } - - public static MilestonesViewHolder newInstance(@NonNull ViewGroup viewGroup, @Nullable BaseRecyclerAdapter adapter) { - return new MilestonesViewHolder(getView(viewGroup, R.layout.milestone_row_item), adapter); - } - - @Override public void bind(@NonNull MilestoneModel milestoneModel) { - title.setText(milestoneModel.getTitle()); - notificationTitle.setText(milestoneModel.getDescription()); - if (milestoneModel.getDueOn() != null) { - date.setText(ParseDateFormat.getTimeAgo(milestoneModel.getDueOn())); - } else if (milestoneModel.getCreatedAt() != null) { - date.setText(ParseDateFormat.getTimeAgo(milestoneModel.getCreatedAt())); - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/NotificationsHeaderViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/NotificationsHeaderViewHolder.java deleted file mode 100644 index 694b3ffda..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/NotificationsHeaderViewHolder.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.widget.AppCompatImageButton; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.GroupedNotificationModel; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 2:08 PM - */ - -public class NotificationsHeaderViewHolder extends BaseViewHolder { - - @Nullable @BindView(R.id.headerTitle) FontTextView headerTitle; - @BindView(R.id.markAsRead) AppCompatImageButton markAsRead; - - private NotificationsHeaderViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter) { - super(itemView, adapter); - markAsRead.setOnClickListener(this); - } - - public static NotificationsHeaderViewHolder newInstance(@NonNull ViewGroup viewGroup, @Nullable BaseRecyclerAdapter adapter) { - return new NotificationsHeaderViewHolder(getView(viewGroup, R.layout.notification_header_row_item), adapter); - } - - @Override public void bind(@NonNull GroupedNotificationModel model) { - Repo repo = model.getRepo(); - if (repo != null && headerTitle != null) { - headerTitle.setText(repo.getFullName()); - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/NotificationsViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/NotificationsViewHolder.java deleted file mode 100644 index 4a6374476..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/NotificationsViewHolder.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.core.content.ContextCompat; -import androidx.cardview.widget.CardView; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.GroupedNotificationModel; -import com.fastaccess.data.dao.model.Notification; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.ForegroundImageView; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 2:08 PM - */ - -public class NotificationsViewHolder extends BaseViewHolder { - - @BindView(R.id.title) FontTextView title; - @BindView(R.id.date) FontTextView date; - @BindView(R.id.markAsRead) ForegroundImageView markAsRead; - @BindView(R.id.notificationType) ForegroundImageView notificationType; - @BindView(R.id.repoName) FontTextView repoName; - private boolean showUnreadState; - - private NotificationsViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter, boolean showUnreadState) { - super(itemView, adapter); - markAsRead.setOnClickListener(this); - this.showUnreadState = showUnreadState; - } - - public static NotificationsViewHolder newInstance(@NonNull ViewGroup viewGroup, @Nullable BaseRecyclerAdapter adapter, boolean showUnreadState) { - return new NotificationsViewHolder(getView(viewGroup, R.layout.notifications_row_item), adapter, showUnreadState); - } - - @Override public void bind(@NonNull GroupedNotificationModel model) { - Notification thread = model.getNotification(); - if (thread != null && thread.getSubject() != null) { - title.setText(thread.getSubject().getTitle()); - int cardBackground = ViewHelper.getCardBackground(itemView.getContext()); - int color; - date.setText(ParseDateFormat.getTimeAgo(thread.getUpdatedAt())); - markAsRead.setVisibility(thread.isUnread() ? View.VISIBLE : View.GONE); - if (thread.getSubject().getType() != null) { - notificationType.setImageResource(thread.getSubject().getType().getDrawableRes()); - notificationType.setContentDescription(thread.getSubject().getType().name()); - } else { - notificationType.setImageResource(R.drawable.ic_info_outline); - } - if (showUnreadState) { - repoName.setVisibility(View.GONE); - if (AppHelper.isNightMode(itemView.getResources())) { - color = ContextCompat.getColor(itemView.getContext(), R.color.material_blue_grey_800); - } else { - color = ContextCompat.getColor(itemView.getContext(), R.color.material_blue_grey_200); - } - ((CardView) itemView).setCardBackgroundColor(thread.isUnread() ? color : cardBackground); - } else { - repoName.setVisibility(View.VISIBLE); - repoName.setText(thread.getRepository().getFullName()); - } - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/PinnedReposViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/PinnedReposViewHolder.java deleted file mode 100644 index b0d6b5cbf..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/PinnedReposViewHolder.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import android.graphics.Color; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.PinnedRepos; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.provider.colors.ColorsProvider; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.LabelSpan; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.text.NumberFormat; - -import butterknife.BindColor; -import butterknife.BindString; -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 2:08 PM - */ - -public class PinnedReposViewHolder extends BaseViewHolder { - - @BindView(R.id.title) FontTextView title; - @Nullable @BindView(R.id.avatarLayout) AvatarLayout avatarLayout; - @Nullable @BindView(R.id.date) FontTextView date; - @Nullable @BindView(R.id.stars) FontTextView stars; - @Nullable @BindView(R.id.forks) FontTextView forks; - @Nullable @BindView(R.id.language) FontTextView language; - @BindString(R.string.forked) String forked; - @BindString(R.string.private_repo) String privateRepo; - @BindColor(R.color.material_indigo_700) int forkColor; - @BindColor(R.color.material_grey_700) int privateColor; - - private PinnedReposViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter) { - super(itemView, adapter); - } - - public static PinnedReposViewHolder newInstance(ViewGroup viewGroup, BaseRecyclerAdapter adapter, boolean singleLine) { - return new PinnedReposViewHolder(getView(viewGroup, - singleLine ? R.layout.repos_row_item_menu : R.layout.repos_row_item), adapter); - } - - @Override public void bind(@NonNull PinnedRepos pinnedRepos) { - Repo repo = pinnedRepos.getPinnedRepo(); - if (repo == null) return; - if (repo.isFork()) { - title.setText(SpannableBuilder.builder() - .append(" " + forked + " ", new LabelSpan(forkColor)) - .append(" ") - .append(repo.getName(), new LabelSpan(Color.TRANSPARENT))); - } else if (repo.isPrivateX()) { - title.setText(SpannableBuilder.builder() - .append(" " + privateRepo + " ", new LabelSpan(privateColor)) - .append(" ") - .append(repo.getName(), new LabelSpan(Color.TRANSPARENT))); - } else { - title.setText(repo.getFullName()); - } - String avatar = repo.getOwner() != null ? repo.getOwner().getAvatarUrl() : null; - String login = repo.getOwner() != null ? repo.getOwner().getLogin() : null; - boolean isOrg = repo.getOwner() != null && repo.getOwner().isOrganizationType(); - if (avatarLayout != null) { - avatarLayout.setVisibility(View.VISIBLE); - avatarLayout.setUrl(avatar, login, isOrg, LinkParserHelper.isEnterprise(repo.getHtmlUrl())); - } - if (stars != null && forks != null && date != null && language != null) { - NumberFormat numberFormat = NumberFormat.getNumberInstance(); - stars.setText(numberFormat.format(repo.getStargazersCount())); - forks.setText(numberFormat.format(repo.getForks())); - date.setText(ParseDateFormat.getTimeAgo(repo.getUpdatedAt())); - if (!InputHelper.isEmpty(repo.getLanguage())) { - language.setText(repo.getLanguage()); - language.setTextColor(ColorsProvider.getColorAsColor(repo.getLanguage(), language.getContext())); - language.setVisibility(View.VISIBLE); - } - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ProfileOrgsViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ProfileOrgsViewHolder.java deleted file mode 100644 index 49426e833..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ProfileOrgsViewHolder.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindView; - -/** - * Created by Kosh on 21 May 2017, 12:27 PM - */ - -public class ProfileOrgsViewHolder extends BaseViewHolder { - - @BindView(R.id.avatarLayout) AvatarLayout avatarLayout; - @BindView(R.id.name) FontTextView name; - - @Override public void onClick(View v) { - avatarLayout.callOnClick(); - } - - private ProfileOrgsViewHolder(@NonNull View itemView) { - super(itemView); - } - - public static ProfileOrgsViewHolder newInstance(@NonNull ViewGroup parent) { - return new ProfileOrgsViewHolder(getView(parent, R.layout.profile_org_row_item)); - } - - @Override public void bind(@NonNull User user) { - name.setText(user.getLogin()); - avatarLayout.setUrl(user.getAvatarUrl(), user.getLogin(), true, LinkParserHelper.isEnterprise(user.getUrl())); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ProfilePinnedReposViewHolder.kt b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ProfilePinnedReposViewHolder.kt deleted file mode 100644 index e050efcb3..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ProfilePinnedReposViewHolder.kt +++ /dev/null @@ -1,53 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder - -import android.graphics.Color -import android.view.View -import android.view.ViewGroup -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.ui.widgets.FontTextView -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder -import github.GetPinnedReposQuery -import java.text.NumberFormat - -/** - * Created by kosh on 09/08/2017. - */ -class ProfilePinnedReposViewHolder private constructor(view: View, adapter: BaseRecyclerAdapter<*, *, *>) : - BaseViewHolder(view, adapter) { - - @BindView(R.id.title) lateinit var title: FontTextView - @BindView(R.id.issues) lateinit var issues: FontTextView - @BindView(R.id.pullRequests) lateinit var pullRequest: FontTextView - @BindView(R.id.language) lateinit var language: FontTextView - @BindView(R.id.stars) lateinit var stars: FontTextView - @BindView(R.id.forks) lateinit var forks: FontTextView - - override fun bind(t: GetPinnedReposQuery.Node) {} - - fun bind(t: GetPinnedReposQuery.Node, numberFormat: NumberFormat) { - title.text = t.name() - issues.text = numberFormat.format(t.issues().totalCount()) - pullRequest.text = numberFormat.format(t.pullRequests().totalCount()) - forks.text = numberFormat.format(t.forks().totalCount()) - stars.text = numberFormat.format(t.stargazers().totalCount()) - t.primaryLanguage()?.let { - language.text = it.name() - it.color()?.let { - if (it.startsWith("#")) { - language.tintDrawables(Color.parseColor(it)) - } else { - val color = "#$it" - language.tintDrawables(Color.parseColor(color)) - } - } - } - } - - companion object { - fun newInstance(parent: ViewGroup, adapter: BaseRecyclerAdapter<*, *, *>): ProfilePinnedReposViewHolder { - return ProfilePinnedReposViewHolder(getView(parent, R.layout.profile_pinned_repo_row_item), adapter) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ProjectViewHolder.kt b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ProjectViewHolder.kt deleted file mode 100644 index 5a3a8f090..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ProjectViewHolder.kt +++ /dev/null @@ -1,38 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder - -import android.view.View -import android.view.ViewGroup -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.helper.ParseDateFormat -import com.fastaccess.ui.widgets.FontTextView -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder -import github.RepoProjectsOpenQuery - -/** - * Created by kosh on 09/09/2017. - */ -class ProjectViewHolder(view: View, adapter: BaseRecyclerAdapter<*, *, *>) : BaseViewHolder(view, adapter) { - - @BindView(R.id.description) lateinit var description: FontTextView - @BindView(R.id.title) lateinit var title: FontTextView - @BindView(R.id.date) lateinit var date: FontTextView - - override fun bind(t: RepoProjectsOpenQuery.Node) { - title.text = t.name() - if (t.body().isNullOrBlank()) { - description.visibility = View.GONE - } else { - description.visibility = View.VISIBLE - description.text = t.body() - } - date.text = ParseDateFormat.getTimeAgo(t.createdAt().toString()) - } - - companion object { - fun newInstance(parent: ViewGroup, adapter: BaseRecyclerAdapter<*, *, *>): ProjectViewHolder { - return ProjectViewHolder(getView(parent, R.layout.feeds_row_no_image_item), adapter) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/PullRequestFilesViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/PullRequestFilesViewHolder.java deleted file mode 100644 index 9f0eedc75..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/PullRequestFilesViewHolder.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.CommitFileChanges; -import com.fastaccess.data.dao.CommitFileModel; -import com.fastaccess.data.dao.CommitLinesModel; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.ui.adapter.CommitLinesAdapter; -import com.fastaccess.ui.adapter.callback.OnToggleView; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.files.PullRequestFilesMvp; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; - -import butterknife.BindString; -import butterknife.BindView; -import es.dmoral.toasty.Toasty; - -/** - * Created by Kosh on 15 Feb 2017, 10:29 PM - */ - -public class PullRequestFilesViewHolder extends BaseViewHolder implements - BaseViewHolder.OnItemClickListener { - - @BindView(R.id.name) FontTextView name; - @BindView(R.id.patchList) DynamicRecyclerView patch; - @BindView(R.id.changes) FontTextView changes; - @BindView(R.id.addition) FontTextView addition; - @BindView(R.id.deletion) FontTextView deletion; - @BindView(R.id.status) FontTextView status; - @BindView(R.id.toggle) View toggle; - @BindView(R.id.open) View open; - @BindString(R.string.changes) String changesText; - @BindString(R.string.addition) String additionText; - @BindString(R.string.deletion) String deletionText; - @BindString(R.string.status) String statusText; - private OnToggleView onToggleView; - private ViewGroup viewGroup; - @Nullable private PullRequestFilesMvp.OnPatchClickListener onPatchClickListener; - - @Override public void onClick(View v) { - if (v.getId() != R.id.open) { - int position = getAdapterPosition(); - onToggleView.onToggle(position, !onToggleView.isCollapsed(position)); - onToggle(onToggleView.isCollapsed(position), true, position); - } else { - super.onClick(v); - } - } - - private PullRequestFilesViewHolder(@NonNull View itemView, @NonNull ViewGroup viewGroup, @Nullable BaseRecyclerAdapter adapter, - @NonNull OnToggleView onToggleView, @Nullable PullRequestFilesMvp.OnPatchClickListener onPatchClickListener) { - super(itemView, adapter); - this.viewGroup = viewGroup; - this.onToggleView = onToggleView; - this.onPatchClickListener = onPatchClickListener; - open.setOnClickListener(this); - patch.setNestedScrollingEnabled(false); - } - - public static PullRequestFilesViewHolder newInstance(ViewGroup viewGroup, BaseRecyclerAdapter adapter, - @NonNull OnToggleView onToggleView, - @Nullable PullRequestFilesMvp.OnPatchClickListener onPatchClickListener) { - return new PullRequestFilesViewHolder(getView(viewGroup, R.layout.pullrequest_file_row_item), viewGroup, adapter, - onToggleView, onPatchClickListener); - } - - @Override public void bind(@NonNull CommitFileChanges commitFileChanges) { - CommitFileModel commit = commitFileChanges.getCommitFileModel(); - toggle.setVisibility(commit.getPatch() == null ? View.GONE : View.VISIBLE); - name.setText(commit.getFilename()); - changes.setText(SpannableBuilder.builder() - .append(changesText) - .append("\n") - .bold(String.valueOf(commit.getChanges()))); - addition.setText(SpannableBuilder.builder() - .append(additionText) - .append("\n") - .bold(String.valueOf(commit.getAdditions()))); - deletion.setText(SpannableBuilder.builder() - .append(deletionText) - .append("\n") - .bold(String.valueOf(commit.getDeletions()))); - status.setText(SpannableBuilder.builder() - .append(statusText) - .append("\n") - .bold(String.valueOf(commit.getStatus()))); - int position = getAdapterPosition(); - onToggle(onToggleView.isCollapsed(position), false, position); - } - - private void onToggle(boolean expanded, boolean animate, int position) { - if (!expanded) { - patch.swapAdapter(null, true); - patch.setVisibility(View.GONE); - name.setMaxLines(2); - toggle.setRotation(0.0f); - } else { - if (adapter != null) { - CommitFileChanges model = (CommitFileChanges) adapter.getItem(position); - if (model.getLinesModel() != null && !model.getLinesModel().isEmpty()) { - if (model.getLinesModel().size() <= 100) { - patch.setAdapter(new CommitLinesAdapter(model.getLinesModel(), this)); - patch.setVisibility(View.VISIBLE); - } else if (CommitFileChanges.canAttachToBundle(model)) { - if (adapter.getListener() != null) { - //noinspection unchecked - adapter.getListener().onItemClick(position, patch, model); - } - } else { - Toasty.warning(itemView.getContext(), itemView.getResources().getString(R.string.too_large_changes)).show(); - return; - } - } else { - patch.swapAdapter(null, true); - patch.setVisibility(View.GONE); - } - } - name.setMaxLines(5); - toggle.setRotation(180f); - } - } - - @Override public void onItemClick(int position, View v, CommitLinesModel item) { - if (onPatchClickListener != null && adapter != null) { - int groupPosition = getAdapterPosition(); - CommitFileChanges commitFileChanges = (CommitFileChanges) adapter.getItem(groupPosition); - onPatchClickListener.onPatchClicked(groupPosition, position, v, commitFileChanges.getCommitFileModel(), item); - } - } - - @Override public void onItemLongClick(int position, View v, CommitLinesModel item) { - if (adapter == null) return; - int groupPosition = getAdapterPosition(); - CommitFileChanges commitFileChanges = (CommitFileChanges) adapter.getItem(groupPosition); - int lineNo = item.getLeftLineNo() > 0 ? item.getLeftLineNo() : item.getRightLineNo(); - String url = commitFileChanges.getCommitFileModel().getBlobUrl() + "#L" + lineNo; - AppHelper.copyToClipboard(v.getContext(), url); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/PullRequestViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/PullRequestViewHolder.java deleted file mode 100644 index 3675ee0cf..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/PullRequestViewHolder.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindString; -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 2:08 PM - */ - -public class PullRequestViewHolder extends BaseViewHolder { - - @BindView(R.id.title) FontTextView title; - @Nullable @BindView(R.id.avatarLayout) AvatarLayout avatarLayout; - @BindView(R.id.details) FontTextView details; - @BindView(R.id.commentsNo) FontTextView commentsNo; - @BindString(R.string.by) String by; - private boolean withAvatar; - private boolean showRepoName; - - private PullRequestViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter, boolean withAvatar, boolean showRepoName) { - super(itemView, adapter); - this.withAvatar = withAvatar; - this.showRepoName = showRepoName; - } - - public static PullRequestViewHolder newInstance(ViewGroup viewGroup, BaseRecyclerAdapter adapter, boolean withAvatar, - boolean showRepoName) { - if (withAvatar) { - return new PullRequestViewHolder(getView(viewGroup, R.layout.issue_row_item), adapter, true, showRepoName); - } - return new PullRequestViewHolder(getView(viewGroup, R.layout.issue_no_image_row_item), adapter, false, showRepoName); - } - - @Override public void bind(@NonNull PullRequest pullRequest) { - title.setText(pullRequest.getTitle()); - details.setText(PullRequest.getMergeBy(pullRequest, details.getContext(), showRepoName)); - if (pullRequest.getComments() > 0) { - commentsNo.setText(String.valueOf(pullRequest.getComments())); - commentsNo.setVisibility(View.VISIBLE); - } else { - commentsNo.setVisibility(View.GONE); - } - if (withAvatar && avatarLayout != null) { - avatarLayout.setUrl(pullRequest.getUser().getAvatarUrl(), pullRequest.getUser().getLogin(), - false, LinkParserHelper.isEnterprise(pullRequest.getHtmlUrl())); - avatarLayout.setVisibility(View.VISIBLE); - } - } - - -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/PullStatusViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/PullStatusViewHolder.java deleted file mode 100644 index 4051cdf08..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/PullStatusViewHolder.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.core.content.ContextCompat; -import android.text.method.LinkMovementMethod; -import android.view.View; -import android.view.ViewGroup; - -import com.annimon.stream.Stream; -import com.fastaccess.R; -import com.fastaccess.data.dao.PullRequestStatusModel; -import com.fastaccess.data.dao.types.StatusStateType; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.ForegroundImageView; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindColor; -import butterknife.BindView; - -/** - * Created by Kosh on 10 Apr 2017, 3:40 AM - */ - -public class PullStatusViewHolder extends BaseViewHolder { - - @BindView(R.id.stateImage) ForegroundImageView stateImage; - @BindView(R.id.status) FontTextView status; - @BindView(R.id.statuses) FontTextView statuses; - @BindColor(R.color.material_green_700) int green; - @BindColor(R.color.material_red_700) int red; - @BindColor(R.color.material_indigo_700) int indigo; - - private PullStatusViewHolder(@NonNull View itemView) { - super(itemView); - itemView.setOnClickListener(null); - itemView.setOnLongClickListener(null); - } - - public static PullStatusViewHolder newInstance(@NonNull ViewGroup parent) { - return new PullStatusViewHolder(getView(parent, R.layout.pull_status_row_item)); - } - - @Override public void bind(@NonNull PullRequestStatusModel pullRequestStatusModel) { - if (pullRequestStatusModel.getState() != null) { - StatusStateType stateType = pullRequestStatusModel.getState(); - stateImage.setImageResource(stateType.getDrawableRes()); - String mergeableState = pullRequestStatusModel.getMergeableState(); - boolean isBlocked = "blocked".equalsIgnoreCase(mergeableState); - if (stateType == StatusStateType.failure) { - stateImage.tintDrawableColor(red); - if (pullRequestStatusModel.isMergable()) { - status.setText(R.string.checks_failed); - } else { - status.setText(SpannableBuilder.builder() - .append(status.getResources().getString(R.string.checks_failed)) - .append("\n") - .append(status.getResources().getString(R.string.can_not_merge_pr))); - } - } else if (stateType == StatusStateType.pending) { - if (pullRequestStatusModel.isMergable()) { - stateImage.setImageResource(R.drawable.ic_check_small); - stateImage.tintDrawableColor(green); - status.setText(!isBlocked ? R.string.commit_can_be_merged : R.string.can_not_merge_pr); - } else { - stateImage.setImageResource(stateType.getDrawableRes()); - stateImage.tintDrawableColor(indigo); - status.setText(R.string.checks_pending); - } - } else { - stateImage.tintDrawableColor(green); - if (pullRequestStatusModel.isMergable()) { - status.setText(!isBlocked ? R.string.commit_can_be_merged : R.string.can_not_merge_pr); - } else { - status.setText(R.string.checks_passed); - } - } - } - if (pullRequestStatusModel.getStatuses() != null && !pullRequestStatusModel.getStatuses().isEmpty()) { - SpannableBuilder builder = SpannableBuilder.builder(); - Stream.of(pullRequestStatusModel.getStatuses()) - .filter(statusesModel -> statusesModel != null && statusesModel.getState() != null && statusesModel.getTargetUrl() != null) - .forEach(statusesModel -> { - if (!InputHelper.isEmpty(statusesModel.getTargetUrl())) { - builder.append(ContextCompat.getDrawable(statuses.getContext(), statusesModel.getState().getDrawableRes())); - builder.append(" ") - .append(statusesModel.getContext() != null ? statusesModel.getContext() + " " : "") - .url(statusesModel.getDescription(), v -> SchemeParser.launchUri(v.getContext(), statusesModel.getTargetUrl())) - .append("\n"); - } - }); - if (!InputHelper.isEmpty(builder)) { - statuses.setMovementMethod(LinkMovementMethod.getInstance()); - statuses.setText(builder); - statuses.setVisibility(View.VISIBLE); - } else { - statuses.setVisibility(View.GONE); - } - } else { - statuses.setVisibility(View.GONE); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ReleasesViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ReleasesViewHolder.java deleted file mode 100644 index aa1db2dfd..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ReleasesViewHolder.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Release; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.ForegroundImageView; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindString; -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 2:08 PM - */ - -public class ReleasesViewHolder extends BaseViewHolder { - - @BindView(R.id.title) FontTextView title; - @BindView(R.id.details) FontTextView details; - @BindView(R.id.download) ForegroundImageView download; - @BindString(R.string.released) String released; - @BindString(R.string.drafted) String drafted; - - private ReleasesViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter) { - super(itemView, adapter); - download.setOnClickListener(this); - download.setOnLongClickListener(this); - } - - public static ReleasesViewHolder newInstance(ViewGroup viewGroup, BaseRecyclerAdapter adapter) { - return new ReleasesViewHolder(getView(viewGroup, R.layout.releases_row_item), adapter); - } - - @Override public void bind(@NonNull Release item) { - title.setText(SpannableBuilder.builder().bold(!InputHelper.isEmpty(item.getName()) ? item.getName() : item.getTagName())); - if (item.getAuthor() != null) { - details.setText(SpannableBuilder.builder() - .append(item.getAuthor().getLogin()) - .append(" ") - .append(item.isDraft() ? drafted : released) - .append(" ") - .append(ParseDateFormat.getTimeAgo(item.getCreatedAt()))); - } else { - details.setVisibility(View.GONE); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/RepoFilePathsViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/RepoFilePathsViewHolder.java deleted file mode 100644 index ef8d7221f..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/RepoFilePathsViewHolder.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.RepoFile; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindView; - -/** - * Created by Kosh on 18 Feb 2017, 2:53 AM - */ - -public class RepoFilePathsViewHolder extends BaseViewHolder { - - @BindView(R.id.pathName) FontTextView pathName; - - private RepoFilePathsViewHolder(@NonNull View itemView, @NonNull BaseRecyclerAdapter baseAdapter) { - super(itemView, baseAdapter); - } - - public static RepoFilePathsViewHolder newInstance(ViewGroup viewGroup, BaseRecyclerAdapter adapter) { - return new RepoFilePathsViewHolder(getView(viewGroup, R.layout.file_path_row_item), adapter); - } - - @Override public void bind(@NonNull RepoFile filesModel) { - pathName.setText(filesModel.getName()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/RepoFilesViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/RepoFilesViewHolder.java deleted file mode 100644 index d88509dec..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/RepoFilesViewHolder.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import android.text.format.Formatter; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.RepoFile; -import com.fastaccess.data.dao.types.FilesType; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.ForegroundImageView; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindString; -import butterknife.BindView; - -/** - * Created by Kosh on 15 Feb 2017, 10:29 PM - */ - -public class RepoFilesViewHolder extends BaseViewHolder { - - @BindView(R.id.contentTypeImage) ForegroundImageView contentTypeImage; - @BindView(R.id.title) FontTextView title; - @BindView(R.id.size) FontTextView size; - @BindView(R.id.menu) ForegroundImageView menu; - @BindString(R.string.file) String file; - - @Override public void onClick(View v) { - if (v.getId() == R.id.contentTypeImage) { - itemView.callOnClick(); - } else { - super.onClick(v); - } - } - - private RepoFilesViewHolder(@NonNull View itemView, @NonNull BaseRecyclerAdapter adapter) { - super(itemView, adapter); - menu.setOnClickListener(this); - contentTypeImage.setOnClickListener(this); - } - - public static RepoFilesViewHolder newInstance(ViewGroup viewGroup, BaseRecyclerAdapter adapter) { - return new RepoFilesViewHolder(getView(viewGroup, R.layout.repo_files_row_item), adapter); - } - - @Override public void bind(@NonNull RepoFile filesModel) { - contentTypeImage.setContentDescription(String.format("%s %s", filesModel.getName(), file)); - title.setText(filesModel.getName()); - if (filesModel.getType() != null && filesModel.getType().getIcon() != 0) { - contentTypeImage.setImageResource(filesModel.getType().getIcon()); - if (filesModel.getType() == FilesType.file) { - size.setText(Formatter.formatFileSize(size.getContext(), filesModel.getSize())); - size.setVisibility(View.VISIBLE); - } else { - size.setVisibility(View.GONE); - } - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ReposViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ReposViewHolder.java deleted file mode 100644 index 380cfb26c..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ReposViewHolder.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import android.graphics.Color; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.text.format.Formatter; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.provider.colors.ColorsProvider; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.LabelSpan; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.text.NumberFormat; - -import butterknife.BindColor; -import butterknife.BindString; -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 2:08 PM - */ - -public class ReposViewHolder extends BaseViewHolder { - - @BindView(R.id.title) FontTextView title; - @BindView(R.id.date) FontTextView date; - @BindView(R.id.stars) FontTextView stars; - @BindView(R.id.forks) FontTextView forks; - @BindView(R.id.language) FontTextView language; - @BindView(R.id.size) FontTextView size; - @Nullable @BindView(R.id.avatarLayout) AvatarLayout avatarLayout; - @BindString(R.string.forked) String forked; - @BindString(R.string.private_repo) String privateRepo; - @BindColor(R.color.material_indigo_700) int forkColor; - @BindColor(R.color.material_grey_700) int privateColor; - private boolean isStarred; - private boolean withImage; - - private ReposViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter, boolean isStarred, boolean withImage) { - super(itemView, adapter); - this.isStarred = isStarred; - this.withImage = withImage; - } - - public static ReposViewHolder newInstance(ViewGroup viewGroup, BaseRecyclerAdapter adapter, boolean isStarred, boolean withImage) { - if (withImage) { - return new ReposViewHolder(getView(viewGroup, R.layout.repos_row_item), adapter, isStarred, true); - } else { - return new ReposViewHolder(getView(viewGroup, R.layout.repos_row_no_image_item), adapter, isStarred, false); - } - - } - - @Override public void bind(@NonNull Repo repo) { - if (repo.isFork() && !isStarred) { - title.setText(SpannableBuilder.builder() - .append(" " + forked + " ", new LabelSpan(forkColor)) - .append(" ") - .append(repo.getName(), new LabelSpan(Color.TRANSPARENT))); - } else if (repo.isPrivateX()) { - title.setText(SpannableBuilder.builder() - .append(" " + privateRepo + " ", new LabelSpan(privateColor)) - .append(" ") - .append(repo.getName(), new LabelSpan(Color.TRANSPARENT))); - } else { - title.setText(!isStarred ? repo.getName() : repo.getFullName()); - } - if (withImage) { - String avatar = repo.getOwner() != null ? repo.getOwner().getAvatarUrl() : null; - String login = repo.getOwner() != null ? repo.getOwner().getLogin() : null; - boolean isOrg = repo.getOwner() != null && repo.getOwner().isOrganizationType(); - if (avatarLayout != null) { - avatarLayout.setVisibility(View.VISIBLE); - avatarLayout.setUrl(avatar, login, isOrg, LinkParserHelper.isEnterprise(repo.getHtmlUrl())); - } - } - long repoSize = repo.getSize() > 0 ? (repo.getSize() * 1000) : repo.getSize(); - size.setText(Formatter.formatFileSize(size.getContext(), repoSize)); - NumberFormat numberFormat = NumberFormat.getNumberInstance(); - stars.setText(numberFormat.format(repo.getStargazersCount())); - forks.setText(numberFormat.format(repo.getForks())); - date.setText(ParseDateFormat.getTimeAgo(repo.getUpdatedAt())); - if (!InputHelper.isEmpty(repo.getLanguage())) { - language.setText(repo.getLanguage()); - language.setTextColor(ColorsProvider.getColorAsColor(repo.getLanguage(), language.getContext())); - language.setVisibility(View.VISIBLE); - } else { - language.setTextColor(Color.BLACK); - language.setVisibility(View.GONE); - language.setText(""); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ReviewCommentsViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ReviewCommentsViewHolder.java deleted file mode 100644 index d39869045..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ReviewCommentsViewHolder.java +++ /dev/null @@ -1,261 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.transition.ChangeBounds; -import androidx.transition.TransitionManager; -import androidx.appcompat.widget.AppCompatImageView; -import android.text.TextUtils; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewTreeObserver; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.RelativeLayout; - -import com.fastaccess.R; -import com.fastaccess.data.dao.ReactionsModel; -import com.fastaccess.data.dao.ReviewCommentModel; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.provider.timeline.CommentsHelper; -import com.fastaccess.provider.timeline.HtmlHelper; -import com.fastaccess.provider.timeline.handler.drawable.DrawableGetter; -import com.fastaccess.ui.adapter.callback.OnToggleView; -import com.fastaccess.ui.adapter.callback.ReactionsCallback; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindView; - -public class ReviewCommentsViewHolder extends BaseViewHolder { - - @BindView(R.id.avatarView) AvatarLayout avatarView; - @BindView(R.id.name) FontTextView name; - @BindView(R.id.date) FontTextView date; - @BindView(R.id.comment) FontTextView comment; - @BindView(R.id.toggle) AppCompatImageView toggle; - @BindView(R.id.toggleHolder) LinearLayout toggleHolder; - @BindView(R.id.thumbsUp) FontTextView thumbsUp; - @BindView(R.id.thumbsDown) FontTextView thumbsDown; - @BindView(R.id.laugh) FontTextView laugh; - @BindView(R.id.hurray) FontTextView hurray; - @BindView(R.id.sad) FontTextView sad; - @BindView(R.id.heart) FontTextView heart; - @BindView(R.id.commentMenu) ImageView commentMenu; - @BindView(R.id.commentOptions) RelativeLayout commentOptions; - @BindView(R.id.owner) FontTextView owner; - @BindView(R.id.reactionsList) View reactionsList; - @BindView(R.id.thumbsUpReaction) FontTextView thumbsUpReaction; - @BindView(R.id.thumbsDownReaction) FontTextView thumbsDownReaction; - @BindView(R.id.laughReaction) FontTextView laughReaction; - @BindView(R.id.hurrayReaction) FontTextView hurrayReaction; - @BindView(R.id.sadReaction) FontTextView sadReaction; - @BindView(R.id.heartReaction) FontTextView heartReaction; - @BindView(R.id.rocketReaction) FontTextView rocketReaction; - @BindView(R.id.eyeReaction) FontTextView eyeReaction; - @BindView(R.id.rocket) FontTextView rocket; - @BindView(R.id.eyes) FontTextView eyes; - private OnToggleView onToggleView; - private ReactionsCallback reactionsCallback; - private ViewGroup viewGroup; - private String repoOwner; - private String poster; - - @Override public void onClick(View v) { - if (v.getId() == R.id.toggle || v.getId() == R.id.toggleHolder) { - if (onToggleView != null) { - long id = getId(); - onToggleView.onToggle(id, !onToggleView.isCollapsed(id)); - onToggle(onToggleView.isCollapsed(id), true); - } - } else { - addReactionCount(v); - super.onClick(v); - } - } - - private ReviewCommentsViewHolder(@NonNull View itemView, ViewGroup viewGroup, @Nullable BaseRecyclerAdapter adapter, - @NonNull OnToggleView onToggleView, @NonNull ReactionsCallback reactionsCallback, - String repoOwner, String poster) { - super(itemView, adapter); - if (adapter != null && adapter.getRowWidth() == 0) { - itemView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { - @Override public boolean onPreDraw() { - itemView.getViewTreeObserver().removeOnPreDrawListener(this); - adapter.setRowWidth(itemView.getWidth() - ViewHelper.dpToPx(itemView.getContext(), 48)); - return false; - } - }); - } - this.onToggleView = onToggleView; - this.viewGroup = viewGroup; - this.reactionsCallback = reactionsCallback; - this.repoOwner = repoOwner; - this.poster = poster; - itemView.setOnClickListener(null); - itemView.setOnLongClickListener(null); - toggle.setOnClickListener(this); - commentMenu.setOnClickListener(this); - toggleHolder.setOnClickListener(this); - laugh.setOnClickListener(this); - sad.setOnClickListener(this); - thumbsDown.setOnClickListener(this); - thumbsUp.setOnClickListener(this); - hurray.setOnClickListener(this); - laugh.setOnLongClickListener(this); - sad.setOnLongClickListener(this); - thumbsDown.setOnLongClickListener(this); - thumbsUp.setOnLongClickListener(this); - hurray.setOnLongClickListener(this); - heart.setOnLongClickListener(this); - heart.setOnClickListener(this); - laughReaction.setOnClickListener(this); - sadReaction.setOnClickListener(this); - thumbsDownReaction.setOnClickListener(this); - thumbsUpReaction.setOnClickListener(this); - hurrayReaction.setOnClickListener(this); - heartReaction.setOnClickListener(this); - laughReaction.setOnLongClickListener(this); - sadReaction.setOnLongClickListener(this); - thumbsDownReaction.setOnLongClickListener(this); - thumbsUpReaction.setOnLongClickListener(this); - hurrayReaction.setOnLongClickListener(this); - heartReaction.setOnLongClickListener(this); - rocketReaction.setOnLongClickListener(this); - rocketReaction.setOnClickListener(this); - rocket.setOnLongClickListener(this); - rocket.setOnClickListener(this); - eyeReaction.setOnLongClickListener(this); - eyeReaction.setOnClickListener(this); - eyes.setOnLongClickListener(this); - eyes.setOnClickListener(this); - } - - public static ReviewCommentsViewHolder newInstance(ViewGroup viewGroup, BaseRecyclerAdapter adapter, - @NonNull OnToggleView onToggleView, @NonNull ReactionsCallback reactionsCallback, - String repoOwner, String poster) { - return new ReviewCommentsViewHolder(getView(viewGroup, R.layout.review_comments_row_item), - viewGroup, adapter, onToggleView, reactionsCallback, repoOwner, poster); - } - - @Override public void bind(@NonNull ReviewCommentModel commentModel) { - if (commentModel.getUser() != null) { - avatarView.setUrl(commentModel.getUser().getAvatarUrl(), commentModel.getUser().getLogin(), commentModel.getUser() - .isOrganizationType(), LinkParserHelper.isEnterprise(commentModel.getHtmlUrl())); - name.setText(commentModel.getUser().getLogin()); - if (commentModel.getAuthorAssociation() != null && !"none".equalsIgnoreCase(commentModel.getAuthorAssociation())) { - owner.setText(commentModel.getAuthorAssociation().toLowerCase()); - owner.setVisibility(View.VISIBLE); - } else { - boolean isRepoOwner = TextUtils.equals(commentModel.getUser().getLogin(), repoOwner); - if (isRepoOwner) { - owner.setVisibility(View.VISIBLE); - owner.setText(R.string.owner); - } else { - boolean isPoster = TextUtils.equals(commentModel.getUser().getLogin(), poster); - if (isPoster) { - owner.setVisibility(View.VISIBLE); - owner.setText(R.string.original_poster); - } else { - owner.setText(""); - owner.setVisibility(View.GONE); - } - } - } - } - date.setText(ParseDateFormat.getTimeAgo(commentModel.getCreatedAt())); - if (!InputHelper.isEmpty(commentModel.getBodyHtml())) { - int width = adapter != null ? adapter.getRowWidth() : 0; - HtmlHelper.htmlIntoTextView(comment, commentModel.getBodyHtml(), width > 0 ? width : viewGroup.getWidth()); - } else { - comment.setText(""); - } - if (commentModel.getReactions() != null) { - ReactionsModel reaction = commentModel.getReactions(); - appendEmojies(reaction); - } - if (onToggleView != null) onToggle(onToggleView.isCollapsed(getId()), false); - } - - private void addReactionCount(View v) { - if (adapter != null) { - ReviewCommentModel comment = (ReviewCommentModel) adapter.getItem(getAdapterPosition()); - if (comment != null) { - boolean isReacted = reactionsCallback == null || reactionsCallback.isPreviouslyReacted(comment.getId(), v.getId()); - ReactionsModel reactionsModel = comment.getReactions() != null ? comment.getReactions() : new ReactionsModel(); - switch (v.getId()) { - case R.id.heart: - case R.id.heartReaction: - reactionsModel.setHeart(!isReacted ? reactionsModel.getHeart() + 1 : reactionsModel.getHeart() - 1); - break; - case R.id.sad: - case R.id.sadReaction: - reactionsModel.setConfused(!isReacted ? reactionsModel.getConfused() + 1 : reactionsModel.getConfused() - 1); - break; - case R.id.thumbsDown: - case R.id.thumbsDownReaction: - reactionsModel.setMinusOne(!isReacted ? reactionsModel.getMinusOne() + 1 : reactionsModel.getMinusOne() - 1); - break; - case R.id.thumbsUp: - case R.id.thumbsUpReaction: - reactionsModel.setPlusOne(!isReacted ? reactionsModel.getPlusOne() + 1 : reactionsModel.getPlusOne() - 1); - break; - case R.id.laugh: - case R.id.laughReaction: - reactionsModel.setLaugh(!isReacted ? reactionsModel.getLaugh() + 1 : reactionsModel.getLaugh() - 1); - break; - case R.id.hurray: - case R.id.hurrayReaction: - reactionsModel.setHooray(!isReacted ? reactionsModel.getHooray() + 1 : reactionsModel.getHooray() - 1); - break; - case R.id.rocket: - case R.id.rocketReaction: - reactionsModel.setRocket(!isReacted ? reactionsModel.getRocket() + 1 : reactionsModel.getRocket() - 1); - break; - case R.id.eyes: - case R.id.eyeReaction: - reactionsModel.setEyes(!isReacted ? reactionsModel.getEyes() + 1 : reactionsModel.getEyes() - 1); - break; - } - comment.setReactions(reactionsModel); - appendEmojies(reactionsModel); - } - } - } - - private void appendEmojies(ReactionsModel reaction) { - CommentsHelper.appendEmojies(reaction, thumbsUp, thumbsUpReaction, thumbsDown, thumbsDownReaction, hurray, hurrayReaction, sad, - sadReaction, laugh, laughReaction, heart, heartReaction, rocket, rocketReaction, eyes, eyeReaction, reactionsList); - } - - private long getId() { - if (adapter != null) { - ReviewCommentModel comment = (ReviewCommentModel) adapter.getItem(getAdapterPosition()); - return comment.getId(); - } - return -1; - } - - private void onToggle(boolean expanded, boolean animate) { - if (animate) { - TransitionManager.beginDelayedTransition(viewGroup, new ChangeBounds()); - } - toggle.setRotation(!expanded ? 0.0F : 180F); - commentOptions.setVisibility(!expanded ? View.GONE : View.VISIBLE); - reactionsList.setVisibility(expanded ? View.GONE : View.VISIBLE); - reactionsList.setVisibility(expanded ? View.GONE : reactionsList.getTag() == null || (!((Boolean) reactionsList.getTag())) - ? View.GONE : View.VISIBLE); - } - - @Override protected void onViewIsDetaching() { - DrawableGetter drawableGetter = (DrawableGetter) comment.getTag(R.id.drawable_callback); - if (drawableGetter != null) { - drawableGetter.clear(drawableGetter); - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ReviewsViewHolder.kt b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ReviewsViewHolder.kt deleted file mode 100644 index ea898017c..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/ReviewsViewHolder.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder - -import android.view.View -import android.view.ViewGroup -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.data.dao.TimelineModel -import com.fastaccess.helper.ParseDateFormat -import com.fastaccess.provider.timeline.HtmlHelper -import com.fastaccess.ui.widgets.AvatarLayout -import com.fastaccess.ui.widgets.FontTextView -import com.fastaccess.ui.widgets.ForegroundImageView -import com.fastaccess.ui.widgets.SpannableBuilder -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created by Kosh on 13 Dec 2016, 1:42 AM - */ - -class ReviewsViewHolder private constructor(itemView: View, - adapter: BaseRecyclerAdapter<*, *, *>?, - val viewGroup: ViewGroup) - : BaseViewHolder(itemView, adapter) { - - @BindView(R.id.stateImage) lateinit var stateImage: ForegroundImageView - @BindView(R.id.avatarLayout) lateinit var avatarLayout: AvatarLayout - @BindView(R.id.stateText) lateinit var stateText: FontTextView - @BindView(R.id.body) lateinit var body: FontTextView - - init { - itemView.setOnLongClickListener(null) - itemView.setOnClickListener(null) - } - - override fun bind(model: TimelineModel) { - val review = model.review - review?.let { - stateImage.setImageResource(R.drawable.ic_eye) - avatarLayout.setUrl(it.user?.avatarUrl, it.user?.login, false, false) - stateText.text = SpannableBuilder.builder().bold(if (it.user != null) { - it.user.login - } else { - "" - }).append(" ${review.state.replace("_", " ")} ").append(ParseDateFormat.getTimeAgo(it.submittedAt)) - if (!it.bodyHtml.isNullOrBlank()) { - HtmlHelper.htmlIntoTextView(body, it.bodyHtml, viewGroup.width) - body.visibility = View.VISIBLE - } else { - body.text = "" - body.visibility = View.GONE - } - } - } - - companion object { - fun newInstance(viewGroup: ViewGroup, adapter: BaseRecyclerAdapter<*, *, *>): ReviewsViewHolder { - return ReviewsViewHolder(BaseViewHolder.getView(viewGroup, R.layout.review_timeline_row_item), adapter, viewGroup) - } - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/SearchCodeViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/SearchCodeViewHolder.java deleted file mode 100644 index a96a2caa8..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/SearchCodeViewHolder.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.SearchCodeModel; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 2:08 PM - */ - -public class SearchCodeViewHolder extends BaseViewHolder { - - @BindView(R.id.title) FontTextView title; - @BindView(R.id.details) FontTextView details; - @BindView(R.id.commentsNo) View commentsNo; - - private SearchCodeViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter) { - super(itemView, adapter); - } - - public static SearchCodeViewHolder newInstance(ViewGroup viewGroup, BaseRecyclerAdapter adapter) { - return new SearchCodeViewHolder(getView(viewGroup, R.layout.issue_no_image_row_item), adapter); - } - - public void bind(@NonNull SearchCodeModel codeModel, boolean showRepoName) { - if (showRepoName) { - title.setText(codeModel.getRepository() != null ? codeModel.getRepository().getFullName() : "N/A"); - details.setText(codeModel.getName()); - commentsNo.setVisibility(View.GONE); - } else { - title.setText(codeModel.getName()); - details.setText(codeModel.getPath()); - commentsNo.setVisibility(View.GONE); - } - } - - @Override public void bind(@NonNull SearchCodeModel searchCodeModel) {} -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/SimpleViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/SimpleViewHolder.java deleted file mode 100644 index f964a7b1f..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/SimpleViewHolder.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindView; - -/** - * Created by Kosh on 31 Dec 2016, 3:12 PM - */ - -public class SimpleViewHolder extends BaseViewHolder { - - @BindView(R.id.title) FontTextView title; - - public SimpleViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter) { - super(itemView, adapter); - } - - @Override public void bind(@NonNull O o) { - title.setText(o.toString()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/TeamsViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/TeamsViewHolder.java deleted file mode 100644 index 314a270cb..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/TeamsViewHolder.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.TeamsModel; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 2:08 PM - */ - -public class TeamsViewHolder extends BaseViewHolder { - - @BindView(R.id.title) FontTextView title; - @BindView(R.id.date) FontTextView date; - - private TeamsViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter) { - super(itemView, adapter); - } - - public static TeamsViewHolder newInstance(@NonNull ViewGroup viewGroup, @NonNull BaseRecyclerAdapter adapter) { - return new TeamsViewHolder(getView(viewGroup, R.layout.feeds_row_no_image_item), adapter); - } - - @Override public void bind(@NonNull TeamsModel user) { - title.setText(!InputHelper.isEmpty(user.getName()) ? user.getName() : user.getSlug()); - if (!InputHelper.isEmpty(user.getDescription())) { - date.setText(user.getDescription()); - } else { - date.setText(InputHelper.toNA(user.getSlug())); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/TimelineCommentsViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/TimelineCommentsViewHolder.java deleted file mode 100644 index 75616ad5a..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/TimelineCommentsViewHolder.java +++ /dev/null @@ -1,290 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.transition.ChangeBounds; -import androidx.transition.TransitionManager; -import android.text.TextUtils; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewTreeObserver; -import android.widget.HorizontalScrollView; -import android.widget.LinearLayout; -import android.widget.RelativeLayout; - -import com.fastaccess.R; -import com.fastaccess.data.dao.ReactionsModel; -import com.fastaccess.data.dao.TimelineModel; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.provider.timeline.CommentsHelper; -import com.fastaccess.provider.timeline.HtmlHelper; -import com.fastaccess.provider.timeline.handler.drawable.DrawableGetter; -import com.fastaccess.ui.adapter.IssuesTimelineAdapter; -import com.fastaccess.ui.adapter.callback.OnToggleView; -import com.fastaccess.ui.adapter.callback.ReactionsCallback; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.ForegroundImageView; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 2:08 PM - */ - -public class TimelineCommentsViewHolder extends BaseViewHolder { - - - @BindView(R.id.avatarView) AvatarLayout avatar; - @BindView(R.id.name) FontTextView name; - @BindView(R.id.date) FontTextView date; - @BindView(R.id.toggle) ForegroundImageView toggle; - @BindView(R.id.commentMenu) ForegroundImageView commentMenu; - @BindView(R.id.toggleHolder) LinearLayout toggleHolder; - @BindView(R.id.thumbsUp) FontTextView thumbsUp; - @BindView(R.id.thumbsDown) FontTextView thumbsDown; - @BindView(R.id.laugh) FontTextView laugh; - @BindView(R.id.hurray) FontTextView hurray; - @BindView(R.id.sad) FontTextView sad; - @BindView(R.id.heart) FontTextView heart; - @BindView(R.id.emojiesList) HorizontalScrollView emojiesList; - @BindView(R.id.commentOptions) RelativeLayout commentOptions; - @BindView(R.id.comment) FontTextView comment; - @BindView(R.id.owner) FontTextView owner; - @BindView(R.id.pathText) FontTextView pathText; - @BindView(R.id.reactionsList) View reactionsList; - @BindView(R.id.thumbsUpReaction) FontTextView thumbsUpReaction; - @BindView(R.id.thumbsDownReaction) FontTextView thumbsDownReaction; - @BindView(R.id.laughReaction) FontTextView laughReaction; - @BindView(R.id.hurrayReaction) FontTextView hurrayReaction; - @BindView(R.id.sadReaction) FontTextView sadReaction; - @BindView(R.id.heartReaction) FontTextView heartReaction; - @BindView(R.id.rocketReaction) FontTextView rocketReaction; - @BindView(R.id.eyeReaction) FontTextView eyeReaction; - @BindView(R.id.rocket) FontTextView rocket; - @BindView(R.id.eyes) FontTextView eyes; - private OnToggleView onToggleView; - private boolean showEmojies; - private ReactionsCallback reactionsCallback; - private ViewGroup viewGroup; - private String repoOwner; - private String poster; - - @Override public void onClick(View v) { - if (v.getId() == R.id.toggle || v.getId() == R.id.toggleHolder) { - if (onToggleView != null) { - int position = getAdapterPosition(); - onToggleView.onToggle(position, !onToggleView.isCollapsed(position)); - onToggle(onToggleView.isCollapsed(position), true); - } - } else { - super.onClick(v); - addReactionCount(v); - } - } - - private TimelineCommentsViewHolder(@NonNull View itemView, @NonNull ViewGroup viewGroup, @Nullable IssuesTimelineAdapter adapter, - @NonNull OnToggleView onToggleView, boolean showEmojies, @NonNull ReactionsCallback reactionsCallback, - String repoOwner, String poster) { - super(itemView, adapter); - if (adapter != null && adapter.getRowWidth() == 0) { - itemView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { - @Override public boolean onPreDraw() { - itemView.getViewTreeObserver().removeOnPreDrawListener(this); - adapter.setRowWidth(itemView.getWidth() - ViewHelper.dpToPx(itemView.getContext(), 48)); - return false; - } - }); - } - this.viewGroup = viewGroup; - this.onToggleView = onToggleView; - this.showEmojies = showEmojies; - this.reactionsCallback = reactionsCallback; - this.repoOwner = repoOwner; - this.poster = poster; - itemView.setOnClickListener(null); - itemView.setOnLongClickListener(null); - commentMenu.setOnClickListener(this); - commentMenu.setOnLongClickListener(this); - toggleHolder.setOnClickListener(this); - toggle.setOnClickListener(this); - laugh.setOnClickListener(this); - sad.setOnClickListener(this); - thumbsDown.setOnClickListener(this); - thumbsUp.setOnClickListener(this); - hurray.setOnClickListener(this); - heart.setOnClickListener(this); - laugh.setOnLongClickListener(this); - sad.setOnLongClickListener(this); - thumbsDown.setOnLongClickListener(this); - thumbsUp.setOnLongClickListener(this); - hurray.setOnLongClickListener(this); - heart.setOnLongClickListener(this); - laughReaction.setOnClickListener(this); - sadReaction.setOnClickListener(this); - thumbsDownReaction.setOnClickListener(this); - thumbsUpReaction.setOnClickListener(this); - hurrayReaction.setOnClickListener(this); - heartReaction.setOnClickListener(this); - laughReaction.setOnLongClickListener(this); - sadReaction.setOnLongClickListener(this); - thumbsDownReaction.setOnLongClickListener(this); - thumbsUpReaction.setOnLongClickListener(this); - hurrayReaction.setOnLongClickListener(this); - heartReaction.setOnLongClickListener(this); - rocketReaction.setOnLongClickListener(this); - rocketReaction.setOnClickListener(this); - rocket.setOnLongClickListener(this); - rocket.setOnClickListener(this); - eyeReaction.setOnLongClickListener(this); - eyeReaction.setOnClickListener(this); - eyes.setOnLongClickListener(this); - eyes.setOnClickListener(this); - } - - public static TimelineCommentsViewHolder newInstance(@NonNull ViewGroup viewGroup, @Nullable IssuesTimelineAdapter adapter, - @NonNull OnToggleView onToggleView, boolean showEmojies, - @NonNull ReactionsCallback reactionsCallback, String repoOwner, String poster) { - return new TimelineCommentsViewHolder(getView(viewGroup, R.layout.comments_row_item), viewGroup, adapter, - onToggleView, showEmojies, reactionsCallback, repoOwner, poster); - } - - @Override public void bind(@NonNull TimelineModel timelineModel) { - Comment commentsModel = timelineModel.getComment(); - if (commentsModel.getUser() != null) { - avatar.setUrl(commentsModel.getUser().getAvatarUrl(), commentsModel.getUser().getLogin(), - false, LinkParserHelper.isEnterprise(commentsModel.getHtmlUrl())); - name.setText(commentsModel.getUser() != null ? commentsModel.getUser().getLogin() : "Anonymous"); - if (commentsModel.getAuthorAssociation() != null && !"none".equalsIgnoreCase(commentsModel.getAuthorAssociation())) { - owner.setText(commentsModel.getAuthorAssociation().toLowerCase()); - owner.setVisibility(View.VISIBLE); - } else { - boolean isRepoOwner = TextUtils.equals(commentsModel.getUser().getLogin(), repoOwner); - if (isRepoOwner) { - owner.setVisibility(View.VISIBLE); - owner.setText(R.string.owner); - } else { - boolean isPoster = TextUtils.equals(commentsModel.getUser().getLogin(), poster); - if (isPoster) { - owner.setVisibility(View.VISIBLE); - owner.setText(R.string.original_poster); - } else { - owner.setText(""); - owner.setVisibility(View.GONE); - } - } - } - } else { - avatar.setUrl(null, null, false, false); - name.setText(""); - } - if (!InputHelper.isEmpty(commentsModel.getPath()) && commentsModel.getPosition() > 0) { - pathText.setVisibility(View.VISIBLE); - pathText.setText(String.format("Commented on %s#L%s", commentsModel.getPath(), - commentsModel.getLine() > 0 ? commentsModel.getLine() : commentsModel.getPosition())); - } else { - pathText.setText(""); - pathText.setVisibility(View.GONE); - } - if (!InputHelper.isEmpty(commentsModel.getBodyHtml())) { - String body = commentsModel.getBodyHtml(); - int width = adapter != null ? adapter.getRowWidth() : 0; - HtmlHelper.htmlIntoTextView(comment, body, width > 0 ? width : viewGroup.getWidth()); - } else { - comment.setText(""); - } - if (commentsModel.getCreatedAt().before(commentsModel.getUpdatedAt())) { - date.setText(String.format("%s %s", ParseDateFormat.getTimeAgo(commentsModel.getCreatedAt()), itemView - .getResources().getString(R.string.edited))); - } else { - date.setText(ParseDateFormat.getTimeAgo(commentsModel.getCreatedAt())); - } - if (showEmojies) { - if (commentsModel.getReactions() != null) { - ReactionsModel reaction = commentsModel.getReactions(); - appendEmojies(reaction); - } - } - emojiesList.setVisibility(showEmojies ? View.VISIBLE : View.GONE); - if (onToggleView != null) onToggle(onToggleView.isCollapsed(getAdapterPosition()), false); - } - - private void addReactionCount(View v) { - if (adapter != null) { - TimelineModel timelineModel = (TimelineModel) adapter.getItem(getAdapterPosition()); - if (timelineModel == null) return; - Comment comment = timelineModel.getComment(); - if (comment != null) { - boolean isReacted = reactionsCallback == null || reactionsCallback.isPreviouslyReacted(comment.getId(), v.getId()); - boolean isCallingApi = reactionsCallback != null && reactionsCallback.isCallingApi(comment.getId(), v.getId()); -// if (isCallingApi) return; - ReactionsModel reactionsModel = comment.getReactions() != null ? comment.getReactions() : new ReactionsModel(); - switch (v.getId()) { - case R.id.heart: - case R.id.heartReaction: - reactionsModel.setHeart(!isReacted ? reactionsModel.getHeart() + 1 : reactionsModel.getHeart() - 1); - break; - case R.id.sad: - case R.id.sadReaction: - reactionsModel.setConfused(!isReacted ? reactionsModel.getConfused() + 1 : reactionsModel.getConfused() - 1); - break; - case R.id.thumbsDown: - case R.id.thumbsDownReaction: - reactionsModel.setMinusOne(!isReacted ? reactionsModel.getMinusOne() + 1 : reactionsModel.getMinusOne() - 1); - break; - case R.id.thumbsUp: - case R.id.thumbsUpReaction: - reactionsModel.setPlusOne(!isReacted ? reactionsModel.getPlusOne() + 1 : reactionsModel.getPlusOne() - 1); - break; - case R.id.laugh: - case R.id.laughReaction: - reactionsModel.setLaugh(!isReacted ? reactionsModel.getLaugh() + 1 : reactionsModel.getLaugh() - 1); - break; - case R.id.hurray: - case R.id.hurrayReaction: - reactionsModel.setHooray(!isReacted ? reactionsModel.getHooray() + 1 : reactionsModel.getHooray() - 1); - break; - case R.id.rocket: - case R.id.rocketReaction: - reactionsModel.setRocket(!isReacted ? reactionsModel.getRocket() + 1 : reactionsModel.getRocket() - 1); - break; - case R.id.eyes: - case R.id.eyeReaction: - reactionsModel.setEyes(!isReacted ? reactionsModel.getEyes() + 1 : reactionsModel.getEyes() - 1); - break; - } - comment.setReactions(reactionsModel); - appendEmojies(reactionsModel); - timelineModel.setComment(comment); - } - } - } - - private void appendEmojies(ReactionsModel reaction) { - CommentsHelper.appendEmojies(reaction, thumbsUp, thumbsUpReaction, thumbsDown, thumbsDownReaction, hurray, hurrayReaction, sad, - sadReaction, laugh, laughReaction, heart, heartReaction, rocket, rocketReaction, eyes, eyeReaction, reactionsList); - } - - private void onToggle(boolean expanded, boolean animate) { - if (animate) { - TransitionManager.beginDelayedTransition(viewGroup, new ChangeBounds()); - } - toggle.setRotation(!expanded ? 0.0F : 180F); - commentOptions.setVisibility(!expanded ? View.GONE : View.VISIBLE); - reactionsList.setVisibility(expanded ? View.GONE : View.VISIBLE); - reactionsList.setVisibility(expanded ? View.GONE : reactionsList.getTag() == null || (!((Boolean) reactionsList.getTag())) - ? View.GONE : View.VISIBLE); - } - - @Override protected void onViewIsDetaching() { - DrawableGetter drawableGetter = (DrawableGetter) comment.getTag(R.id.drawable_callback); - if (drawableGetter != null) { - drawableGetter.clear(drawableGetter); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/TrendingViewHolder.kt b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/TrendingViewHolder.kt deleted file mode 100644 index 8c1510030..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/TrendingViewHolder.kt +++ /dev/null @@ -1,54 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder - -import android.view.View -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.data.dao.TrendingModel -import com.fastaccess.helper.Logger -import com.fastaccess.provider.colors.ColorsProvider -import com.fastaccess.provider.emoji.EmojiParser -import com.fastaccess.ui.widgets.FontTextView -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created: FontTextView by Kosh on 02 Jun 2017, 1:27 PM - */ - -open class TrendingViewHolder(itemView: View, adapter: BaseRecyclerAdapter>) : BaseViewHolder(itemView, adapter) { - - @BindView(R.id.title) lateinit var title: FontTextView - @BindView(R.id.description) lateinit var description: FontTextView - @BindView(R.id.todayStars) lateinit var todayStars: FontTextView - @BindView(R.id.stars) lateinit var stars: FontTextView - @BindView(R.id.forks) lateinit var fork: FontTextView - @BindView(R.id.language) lateinit var lang: FontTextView - - - override fun bind(t: TrendingModel) { - title.text = t.title - if (t.description.isNullOrBlank()) { - description.visibility = View.GONE - } else { - val descriptionValue: String = EmojiParser.parseToUnicode(t.description) - description.text = descriptionValue - description.visibility = View.VISIBLE - } - todayStars.text = t.todayStars - stars.text = t.stars - fork.text = t.forks - if (t.language.isNullOrBlank()) { - lang.visibility = View.GONE - lang.text = "" - } else { - val color = ColorsProvider.getColorAsColor(t.language!!, itemView.context) - Logger.e(color, t.language) - lang.tintDrawables(color) - lang.setTextColor(color) - lang.text = t.language - lang.visibility = View.VISIBLE - } - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/UnknownTypeViewHolder.kt b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/UnknownTypeViewHolder.kt deleted file mode 100644 index 3fa035890..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/UnknownTypeViewHolder.kt +++ /dev/null @@ -1,11 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder - -import android.view.View -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created by kosh on 07/08/2017. - */ -class UnknownTypeViewHolder(view: View) : BaseViewHolder(view) { - override fun bind(t: Any) {} //DO NOTHING -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/UsersViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/UsersViewHolder.java deleted file mode 100644 index 10ae83e6c..000000000 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/UsersViewHolder.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.fastaccess.ui.adapter.viewholder; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 2:08 PM - */ - -public class UsersViewHolder extends BaseViewHolder { - - @BindView(R.id.avatarLayout) AvatarLayout avatar; - @BindView(R.id.title) FontTextView title; - @BindView(R.id.date) FontTextView date; - private boolean isFilter; - - private UsersViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter, boolean isFilter) { - super(itemView, adapter); - this.isFilter = isFilter; - } - - public static UsersViewHolder newInstance(@NonNull ViewGroup parent, @Nullable BaseRecyclerAdapter adapter, boolean isFilter) { - return new UsersViewHolder(getView(parent, isFilter ? R.layout.users_small_row_item : R.layout.feeds_row_item), adapter, isFilter); - } - - @Override public void onClick(View v) { - if (isFilter) { - super.onClick(v); - } else { - avatar.findViewById(R.id.avatar).callOnClick(); - } - } - - @Override public void bind(@NonNull User user) {} - - public void bind(@NonNull User user, boolean isContributor) { - avatar.setUrl(user.getAvatarUrl(), user.getLogin(), user.isOrganizationType(), - LinkParserHelper.isEnterprise(user.getHtmlUrl())); - title.setText(user.getLogin()); - date.setVisibility(!isContributor ? View.GONE : View.VISIBLE); - if (isContributor) { - date.setText(String.format("%s (%s)", date.getResources().getString(R.string.commits), user.getContributions())); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/base/BaseActivity.java b/app/src/main/java/com/fastaccess/ui/base/BaseActivity.java deleted file mode 100644 index e388278f7..000000000 --- a/app/src/main/java/com/fastaccess/ui/base/BaseActivity.java +++ /dev/null @@ -1,554 +0,0 @@ -package com.fastaccess.ui.base; - -import android.app.ActivityManager; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.DrawableRes; -import androidx.annotation.IdRes; -import androidx.annotation.LayoutRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import com.google.android.material.appbar.AppBarLayout; -import com.google.android.material.navigation.NavigationView; -import androidx.core.view.GravityCompat; -import androidx.viewpager.widget.ViewPager; -import androidx.drawerlayout.widget.DrawerLayout; -import androidx.appcompat.widget.Toolbar; -import android.text.TextUtils; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.ViewTreeObserver; -import android.widget.Toast; - -import com.bumptech.glide.Glide; -import com.evernote.android.state.State; -import com.evernote.android.state.StateSaver; -import com.fastaccess.App; -import com.fastaccess.R; -import com.fastaccess.data.dao.model.FastHubNotification; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.provider.markdown.CachedComments; -import com.fastaccess.provider.theme.ThemeEngine; -import com.fastaccess.ui.adapter.FragmentsPagerAdapter; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.changelog.ChangelogBottomSheetDialog; -import com.fastaccess.ui.modules.gists.gist.GistActivity; -import com.fastaccess.ui.modules.login.chooser.LoginChooserActivity; -import com.fastaccess.ui.modules.main.MainActivity; -import com.fastaccess.ui.modules.main.drawer.MainDrawerFragment; -import com.fastaccess.ui.modules.main.notifications.FastHubNotificationDialog; -import com.fastaccess.ui.modules.main.orgs.OrgListDialogFragment; -import com.fastaccess.ui.modules.main.playstore.PlayStoreWarningActivity; -import com.fastaccess.ui.modules.repos.code.commit.details.CommitPagerActivity; -import com.fastaccess.ui.modules.repos.issues.issue.details.IssuePagerActivity; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.PullRequestPagerActivity; -import com.fastaccess.ui.modules.settings.SettingsActivity; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; -import com.fastaccess.ui.widgets.dialog.ProgressDialogFragment; - -import net.grandcentrix.thirtyinch.TiActivity; - -import java.util.ArrayList; - -import butterknife.BindView; -import butterknife.ButterKnife; -import butterknife.OnClick; -import butterknife.Optional; -import es.dmoral.toasty.Toasty; -import io.reactivex.Observable; - - -/** - * Created by Kosh on 24 May 2016, 8:48 PM - */ - -public abstract class BaseActivity> extends TiActivity implements BaseMvp.FAView { - - @State boolean isProgressShowing; - @Nullable @BindView(R.id.toolbar) protected Toolbar toolbar; - @Nullable @BindView(R.id.appbar) protected AppBarLayout appbar; - @Nullable @BindView(R.id.drawer) protected DrawerLayout drawer; - @Nullable @BindView(R.id.extrasNav) public NavigationView extraNav; - @Nullable @BindView(R.id.drawerViewPager) ViewPager drawerViewPager; - @State String schemeUrl; - - @State Bundle presenterStateBundle = new Bundle(); - - private MainNavDrawer mainNavDrawer; - - private long backPressTimer; - private Toast toast; - - @LayoutRes protected abstract int layout(); - - protected abstract boolean isTransparent(); - - protected abstract boolean canBack(); - - protected abstract boolean isSecured(); - - @Override protected void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - StateSaver.saveInstanceState(this, outState); - getPresenter().onSaveInstanceState(presenterStateBundle); - } - - @Override protected void onCreate(@Nullable Bundle savedInstanceState) { - setTaskName(null); - setupTheme(); - AppHelper.updateAppLanguage(this); - super.onCreate(savedInstanceState); - if (layout() != 0) { - setContentView(layout()); - ButterKnife.bind(this); - } - if (savedInstanceState == null) { - getPresenter().onCheckGitHubStatus(); - if (getIntent() != null) { - schemeUrl = getIntent().getStringExtra(BundleConstant.SCHEME_URL); - } - } - if (!validateAuth()) return; - if (savedInstanceState == null) { - if (showInAppNotifications()) { - FastHubNotificationDialog.Companion.show(getSupportFragmentManager()); - } - } - showChangelog(); - initPresenterBundle(savedInstanceState); - setupToolbarAndStatusBar(toolbar); - initEnterpriseExtra(savedInstanceState); - mainNavDrawer = new MainNavDrawer(this, extraNav); - setupDrawer(); - } - - @Override public boolean onCreateOptionsMenu(Menu menu) { - return super.onCreateOptionsMenu(menu); - } - - @Override public boolean onOptionsItemSelected(MenuItem item) { - if (canBack()) { - if (item.getItemId() == android.R.id.home) { - onBackPressed(); - return true; - } - } - return super.onOptionsItemSelected(item); - } - - @Override public void onDialogDismissed() { - - }//pass - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - if (isOk && bundle != null) { - boolean logout = bundle.getBoolean("logout"); - if (logout) { - onRequireLogin(); - } - } - }//pass - - @Override public void showMessage(@StringRes int titleRes, @StringRes int msgRes) { - showMessage(getString(titleRes), getString(msgRes)); - } - - @Override public void showMessage(@NonNull String titleRes, @NonNull String msgRes) { - hideProgress(); - if (toast != null) toast.cancel(); - Context context = App.getInstance(); // WindowManager$BadTokenException - toast = titleRes.equals(context.getString(R.string.error)) - ? Toasty.error(context, msgRes, Toast.LENGTH_LONG) - : Toasty.info(context, msgRes, Toast.LENGTH_LONG); - toast.show(); - } - - @Override public void showErrorMessage(@NonNull String msgRes) { - showMessage(getString(R.string.error), msgRes); - } - - @Override public boolean isLoggedIn() { - return Login.getUser() != null; - } - - @Override public void showProgress(@StringRes int resId) { - showProgress(resId, true); - } - - @Override public void showBlockingProgress(int resId) { - showProgress(resId, false); - } - - @Override public void hideProgress() { - ProgressDialogFragment fragment = (ProgressDialogFragment) AppHelper.getFragmentByTag(getSupportFragmentManager(), - ProgressDialogFragment.TAG); - if (fragment != null) { - isProgressShowing = false; - fragment.dismiss(); - } - } - - @Override public void onRequireLogin() { - Toasty.warning(App.getInstance(), getString(R.string.unauthorized_user), Toast.LENGTH_LONG).show(); - final Glide glide = Glide.get(App.getInstance()); - getPresenter().manageViewDisposable(RxHelper.getObservable(Observable.fromCallable(() -> { - glide.clearDiskCache(); - PrefGetter.setToken(null); - PrefGetter.setOtpCode(null); - PrefGetter.resetEnterprise(); - Login.logout(); - return true; - })).subscribe(aBoolean -> { - glide.clearMemory(); - Intent intent = new Intent(this, LoginChooserActivity.class); - intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(intent); - finishAffinity(); - })); - } - - @Override public void onBackPressed() { - if (drawer != null && drawer.isDrawerOpen(GravityCompat.START)) { - closeDrawer(); - } else { - boolean clickTwiceToExit = !PrefGetter.isTwiceBackButtonDisabled(); - superOnBackPressed(clickTwiceToExit); - } - } - - @Override public void onLogoutPressed() { - MessageDialogView.newInstance(getString(R.string.logout), getString(R.string.confirm_message), - Bundler.start() - .put(BundleConstant.YES_NO_EXTRA, true) - .put("logout", true) - .end()) - .show(getSupportFragmentManager(), MessageDialogView.TAG); - } - - @Override public void onThemeChanged() { - if (this instanceof MainActivity) { - recreate(); - } else { - Intent intent = new Intent(this, MainActivity.class); - intent.putExtras(Bundler.start().put(BundleConstant.YES_NO_EXTRA, true).end()); - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - startActivity(intent); - finish(); - } - } - - @Override public void onOpenSettings() { - startActivityForResult(new Intent(this, SettingsActivity.class), BundleConstant.REFRESH_CODE); - } - - @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { - if (resultCode == RESULT_OK) { - if (requestCode == BundleConstant.REFRESH_CODE) { - onThemeChanged(); - } - } - super.onActivityResult(requestCode, resultCode, data); - } - - @Override public void onScrollTop(int index) {} - - @Override public boolean isEnterprise() { - return getPresenter() != null && getPresenter().isEnterprise(); - } - - @Override public void onOpenUrlInBrowser() { - if (!InputHelper.isEmpty(schemeUrl)) { - ActivityHelper.startCustomTab(this, schemeUrl); - try { - finish(); - } catch (Exception ignored) {}// fragment might be committed and calling finish will crash the app. - } - } - - @Optional @OnClick(R.id.logout) void onLogoutClicked() { - closeDrawer(); - onLogoutPressed(); - } - - @Override protected void onDestroy() { - clearCachedComments(); - super.onDestroy(); - } - - protected void setTaskName(@Nullable String name) { - setTaskDescription(new ActivityManager.TaskDescription(name, null, ViewHelper.getPrimaryDarkColor(this))); - } - - protected void selectHome(boolean hideRepo) { - Menu menu = getMainDrawerMenu(); - if (menu != null) { - if (hideRepo) { - menu.findItem(R.id.navToRepo).setVisible(false); - menu.findItem(R.id.mainView).setVisible(true); - return; - } - menu.findItem(R.id.navToRepo).setVisible(false); - menu.findItem(R.id.mainView).setCheckable(true); - menu.findItem(R.id.mainView).setChecked(true); - } - } - - protected void selectProfile() { - selectHome(true); - selectMenuItem(R.id.profile); - } - - protected void selectPinned() { - selectMenuItem(R.id.pinnedMenu); - } - - protected void onSelectNotifications() { - selectMenuItem(R.id.notifications); - } - - protected void onSelectTrending() { - selectMenuItem(R.id.trending); - } - - public void onOpenOrgsDialog() { - OrgListDialogFragment.newInstance().show(getSupportFragmentManager(), "OrgListDialogFragment"); - } - - protected void showNavToRepoItem() { - Menu menu = getMainDrawerMenu(); - if (menu != null) { - menu.findItem(R.id.navToRepo).setVisible(true); - } - } - - protected void selectMenuItem(@IdRes int id) { - Menu menu = getMainDrawerMenu(); - if (menu != null) { - menu.findItem(id).setCheckable(true); - menu.findItem(id).setChecked(true); - } - } - - public void onNavToRepoClicked() {} - - private void setupToolbarAndStatusBar(@Nullable Toolbar toolbar) { - changeStatusBarColor(isTransparent()); - if (toolbar != null) { - setSupportActionBar(toolbar); - if (canBack()) { - if (getSupportActionBar() != null) { - getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_back); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - if (canBack()) { - View navIcon = getToolbarNavigationIcon(toolbar); - if (navIcon != null) { - navIcon.setOnLongClickListener(v -> { - Intent intent = new Intent(this, MainActivity.class); - startActivity(intent); - finish(); - return true; - }); - } - } - } - } - } - } - - protected void setToolbarIcon(@DrawableRes int res) { - if (getSupportActionBar() != null) { - getSupportActionBar().setHomeAsUpIndicator(res); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - } - } - - protected void hideShowShadow(boolean show) { - if (appbar != null) { - appbar.setElevation(show ? getResources().getDimension(R.dimen.spacing_micro) : 0.0f); - } - } - - protected void changeStatusBarColor(boolean isTransparent) { - if (!isTransparent) { - getWindow().setStatusBarColor(ViewHelper.getPrimaryDarkColor(this)); - } - } - - private void setupTheme() { - ThemeEngine.INSTANCE.apply(this); - } - - protected void setupNavigationView() { - if (mainNavDrawer != null) { - mainNavDrawer.setupView(); - } - } - - public void closeDrawer() { - if (drawer != null) { - if (drawer.isDrawerOpen(GravityCompat.START)) { - drawer.closeDrawer(GravityCompat.START); - } - } - } - - private void setupDrawer() { - if (drawer != null && !(this instanceof MainActivity)) { - if (!PrefGetter.isNavDrawerHintShowed()) { - drawer.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { - @Override public boolean onPreDraw() { - drawer.openDrawer(GravityCompat.START); - drawer.addDrawerListener(new DrawerLayout.SimpleDrawerListener() { - @Override public void onDrawerOpened(View drawerView) { - super.onDrawerOpened(drawerView); - drawerView.postDelayed(() -> { - if (drawer != null) { - closeDrawer(); - drawer.removeDrawerListener(this); - } - }, 1000); - } - }); - drawer.getViewTreeObserver().removeOnPreDrawListener(this); - return true; - } - }); - } - } - } - - private void superOnBackPressed(boolean didClickTwice) { - if (this instanceof MainActivity) { - if (didClickTwice) { - if (canExit()) { - super.onBackPressed(); - } - } else { - super.onBackPressed(); - } - } else { - super.onBackPressed(); - } - } - - private boolean canExit() { - if (backPressTimer + 2000 > System.currentTimeMillis()) { - return true; - } else { - showMessage(R.string.press_again_to_exit, R.string.press_again_to_exit); - } - backPressTimer = System.currentTimeMillis(); - return false; - } - - @Nullable private View getToolbarNavigationIcon(Toolbar toolbar) { - boolean hadContentDescription = TextUtils.isEmpty(toolbar.getNavigationContentDescription()); - String contentDescription = !hadContentDescription ? String.valueOf(toolbar.getNavigationContentDescription()) : "navigationIcon"; - toolbar.setNavigationContentDescription(contentDescription); - ArrayList potentialViews = new ArrayList<>(); - toolbar.findViewsWithText(potentialViews, contentDescription, View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION); - View navIcon = null; - if (potentialViews.size() > 0) { - navIcon = potentialViews.get(0); - } - if (hadContentDescription) toolbar.setNavigationContentDescription(null); - return navIcon; - } - - public void onRestartApp() { - Intent intent = new Intent(this, MainActivity.class); - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); - startActivity(intent); - finishAndRemoveTask(); - } - - private void showProgress(int resId, boolean cancelable) { - String msg = getString(R.string.in_progress); - if (resId != 0) { - msg = getString(resId); - } - if (!isProgressShowing && !isFinishing()) { - ProgressDialogFragment fragment = (ProgressDialogFragment) AppHelper.getFragmentByTag(getSupportFragmentManager(), - ProgressDialogFragment.TAG); - if (fragment == null) { - isProgressShowing = true; - fragment = ProgressDialogFragment.newInstance(msg, cancelable); - fragment.show(getSupportFragmentManager(), ProgressDialogFragment.TAG); - } - } - } - - /** - * not really needed but meh. - */ - private void clearCachedComments() { - if (this instanceof IssuePagerActivity || this instanceof CommitPagerActivity || - this instanceof PullRequestPagerActivity || this instanceof GistActivity) { - CachedComments.Companion.getInstance().clear(); - } - } - - private boolean validateAuth() { - if (!isSecured()) { - if (!isLoggedIn()) { - onRequireLogin(); - return false; - } - } - return true; - } - - private void initEnterpriseExtra(@Nullable Bundle savedInstanceState) { - if (savedInstanceState == null) { - if (getIntent() != null) { - if (getIntent().getExtras() != null) { - getPresenter().setEnterprise(getIntent().getExtras().getBoolean(BundleConstant.IS_ENTERPRISE)); - } else if (getIntent().hasExtra(BundleConstant.IS_ENTERPRISE)) { - getPresenter().setEnterprise(getIntent().getBooleanExtra(BundleConstant.IS_ENTERPRISE, false)); - } - } - } - } - - private void initPresenterBundle(@Nullable Bundle savedInstanceState) { - if (savedInstanceState != null && !savedInstanceState.isEmpty()) { - StateSaver.restoreInstanceState(this, savedInstanceState); - getPresenter().onRestoreInstanceState(presenterStateBundle); - } - } - - private void showChangelog() { - if (PrefGetter.showWhatsNew() && !(this instanceof PlayStoreWarningActivity)) { - new ChangelogBottomSheetDialog().show(getSupportFragmentManager(), "ChangelogBottomSheetDialog"); - } - } - - private boolean showInAppNotifications() { - return FastHubNotification.hasNotifications(); - } - - private Menu getMainDrawerMenu() { - if (drawerViewPager != null) { - FragmentsPagerAdapter adapter = (FragmentsPagerAdapter) drawerViewPager.getAdapter(); - if (adapter != null) { - MainDrawerFragment fragment = (MainDrawerFragment) adapter.instantiateItem(drawerViewPager, 0); - if (fragment != null) { - return fragment.getMenu(); - } - } - } - return null; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/base/BaseBottomSheetDialog.java b/app/src/main/java/com/fastaccess/ui/base/BaseBottomSheetDialog.java deleted file mode 100644 index 5a9d7ee59..000000000 --- a/app/src/main/java/com/fastaccess/ui/base/BaseBottomSheetDialog.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.fastaccess.ui.base; - -import android.app.Dialog; -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.LayoutRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.bottomsheet.BottomSheetBehavior; -import com.google.android.material.bottomsheet.BottomSheetDialogFragment; -import androidx.appcompat.view.ContextThemeWrapper; -import android.view.KeyEvent; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewTreeObserver; - -import com.evernote.android.state.StateSaver; -import com.fastaccess.R; -import com.fastaccess.helper.ViewHelper; - -import org.jetbrains.annotations.NotNull; - -import butterknife.ButterKnife; -import butterknife.Unbinder; - -/** - * Created by Kosh on 16 Sep 2016, 2:11 PM - */ - -@SuppressWarnings("RestrictedApi") public abstract class BaseBottomSheetDialog extends BottomSheetDialogFragment { - - protected BottomSheetBehavior bottomSheetBehavior; - private final BottomSheetBehavior.BottomSheetCallback bottomSheetCallback = new BottomSheetBehavior.BottomSheetCallback() { - @Override public void onStateChanged(@NonNull View bottomSheet, int newState) { - if (newState == BottomSheetBehavior.STATE_HIDDEN) { - isAlreadyHidden = true; - onHidden(); - } - } - - @Override public void onSlide(@NonNull View bottomSheet, float slideOffset) { - if (slideOffset == -1.0) { - isAlreadyHidden = true; - onDismissedByScrolling(); - } - } - }; - protected boolean isAlreadyHidden; - @Nullable private Unbinder unbinder; - - @LayoutRes protected abstract int layoutRes(); - - @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - } - - @Override public void onSaveInstanceState(@NotNull Bundle outState) { - super.onSaveInstanceState(outState); - StateSaver.saveInstanceState(this, outState); - } - - @Override public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - if (savedInstanceState != null && !savedInstanceState.isEmpty()) { - StateSaver.restoreInstanceState(this, savedInstanceState); - } - } - - @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - final Context contextThemeWrapper = new ContextThemeWrapper(getContext(), requireContext().getTheme()); - LayoutInflater themeAwareInflater = inflater.cloneInContext(contextThemeWrapper); - View view = themeAwareInflater.inflate(layoutRes(), container, false); - unbinder = ButterKnife.bind(this, view); - view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { - @Override public void onGlobalLayout() { - view.getViewTreeObserver().removeOnGlobalLayoutListener(this); - View parent = getDialog().findViewById(R.id.design_bottom_sheet); - if (parent != null) { - bottomSheetBehavior = BottomSheetBehavior.from(parent); - if (bottomSheetBehavior != null) { - bottomSheetBehavior.setBottomSheetCallback(bottomSheetCallback); - bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); - } - } - } - }); - return view; - } - - @Override public void setupDialog(Dialog dialog, int style) { - super.setupDialog(dialog, style); - } - - @Override public void onDestroyView() { - super.onDestroyView(); - if (unbinder != null) unbinder.unbind(); - } - - @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { - final Dialog dialog = super.onCreateDialog(savedInstanceState); - dialog.setOnShowListener(dialogInterface -> { - if (ViewHelper.isTablet(requireContext())) { - if (dialog.getWindow() != null) { - dialog.getWindow().setLayout( - ViewGroup.LayoutParams.WRAP_CONTENT, - ViewGroup.LayoutParams.MATCH_PARENT); - } - } - onDialogIsShowing(); - }); - dialog.setOnKeyListener((dialog1, keyCode, event) -> { - if (keyCode == KeyEvent.KEYCODE_BACK) { - isAlreadyHidden = true; - onDismissedByScrolling(); - } - return false; - }); - return dialog; - } - - @Override public void onDetach() { - if (!isAlreadyHidden) { - onDismissedByScrolling(); - } - super.onDetach(); - } - - protected void onHidden() { - try { - dismiss(); - } catch (IllegalStateException ignored) {} //FML FIXME - } - - protected void onDismissedByScrolling() {} - - private void onDialogIsShowing() {} - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/base/BaseDialogFragment.java b/app/src/main/java/com/fastaccess/ui/base/BaseDialogFragment.java deleted file mode 100644 index e0ddd490d..000000000 --- a/app/src/main/java/com/fastaccess/ui/base/BaseDialogFragment.java +++ /dev/null @@ -1,189 +0,0 @@ -package com.fastaccess.ui.base; - -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.annotation.SuppressLint; -import android.app.Dialog; -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.LayoutRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.appcompat.view.ContextThemeWrapper; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.evernote.android.state.StateSaver; -import com.fastaccess.App; -import com.fastaccess.R; -import com.fastaccess.helper.AnimHelper; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.widgets.dialog.ProgressDialogFragment; - -import net.grandcentrix.thirtyinch.TiDialogFragment; - -import org.jetbrains.annotations.NotNull; - -import butterknife.ButterKnife; -import butterknife.Unbinder; - -/** - * Created by Kosh on 22 Feb 2017, 7:28 PM - */ - -public abstract class BaseDialogFragment> extends TiDialogFragment - implements BaseMvp.FAView { - protected BaseMvp.FAView callback; - - @Nullable private Unbinder unbinder; - protected boolean suppressAnimation = false; - - @LayoutRes protected abstract int fragmentLayout(); - - protected abstract void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState); - - @Override public void onAttach(@NotNull Context context) { - super.onAttach(context); - if (context instanceof BaseMvp.FAView) { - callback = (BaseMvp.FAView) context; - } - } - - @Override public void onDetach() { - super.onDetach(); - callback = null; - } - - @Override public void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - StateSaver.saveInstanceState(this, outState); - getPresenter().onSaveInstanceState(outState); - } - - @Override public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setStyle(STYLE_NO_TITLE, AppHelper.isNightMode(getResources()) ? R.style.DialogThemeDark : R.style.DialogThemeLight); - if (savedInstanceState != null && !savedInstanceState.isEmpty()) { - StateSaver.restoreInstanceState(this, savedInstanceState); - getPresenter().onRestoreInstanceState(savedInstanceState); - } - getPresenter().setEnterprise(isEnterprise()); - } - - @Override public void dismiss() { - if (suppressAnimation) { - super.dismiss(); - return; - } - if (PrefGetter.isAppAnimationDisabled()) { - super.dismiss(); - } else { - AnimHelper.dismissDialog(this, getResources().getInteger(android.R.integer.config_shortAnimTime), - new AnimatorListenerAdapter() { - @Override public void onAnimationEnd(Animator animation) { - super.onAnimationEnd(animation); - BaseDialogFragment.super.dismiss(); - } - }); - } - } - - @SuppressLint("RestrictedApi") @Nullable @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - if (fragmentLayout() != 0) { - final Context contextThemeWrapper = new ContextThemeWrapper(getContext(), requireContext().getTheme()); - LayoutInflater themeAwareInflater = inflater.cloneInContext(contextThemeWrapper); - View view = themeAwareInflater.inflate(fragmentLayout(), container, false); - unbinder = ButterKnife.bind(this, view); - return view; - } - return super.onCreateView(inflater, container, savedInstanceState); - } - - @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { - final Dialog dialog = super.onCreateDialog(savedInstanceState); - if (!PrefGetter.isAppAnimationDisabled() && !(this instanceof ProgressDialogFragment) && !suppressAnimation) { - dialog.setOnShowListener(dialogInterface -> AnimHelper.revealDialog(dialog, - App.getInstance().getResources().getInteger(android.R.integer.config_longAnimTime))); - } - return dialog; - } - - @Override public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - onFragmentCreated(view, savedInstanceState); - } - - @Override public void showProgress(@StringRes int resId) { - callback.showProgress(resId); - } - - @Override public void showBlockingProgress(int resId) { - callback.showBlockingProgress(resId); - } - - @Override public void hideProgress() { - callback.hideProgress(); - } - - @Override public void showMessage(@StringRes int titleRes, @StringRes int msgRes) { - callback.showMessage(titleRes, msgRes); - } - - @Override public void showMessage(@NonNull String titleRes, @NonNull String msgRes) { - callback.showMessage(titleRes, msgRes); - } - - @Override public void showErrorMessage(@NonNull String msgRes) { - callback.showErrorMessage(msgRes); - } - - @Override public boolean isLoggedIn() { - return callback.isLoggedIn(); - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - - } - - @Override public void onRequireLogin() { - callback.onRequireLogin(); - } - - @Override public void onLogoutPressed() { - callback.onLogoutPressed(); - } - - @Override public void onThemeChanged() { - callback.onThemeChanged(); - } - - @Override public void onOpenSettings() { - callback.onOpenSettings(); - } - - @Override public void onDestroyView() { - super.onDestroyView(); - if (unbinder != null) unbinder.unbind(); - } - - @Override public void onScrollTop(int index) {} - - @Override public void onDialogDismissed() { - - } - - @Override public boolean isEnterprise() { - return callback != null && callback.isEnterprise(); - } - - @Override public void onOpenUrlInBrowser() { - callback.onOpenUrlInBrowser(); - } -} - diff --git a/app/src/main/java/com/fastaccess/ui/base/BaseFragment.java b/app/src/main/java/com/fastaccess/ui/base/BaseFragment.java deleted file mode 100644 index b721b593b..000000000 --- a/app/src/main/java/com/fastaccess/ui/base/BaseFragment.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.fastaccess.ui.base; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.LayoutRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.appcompat.view.ContextThemeWrapper; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.evernote.android.state.StateSaver; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import net.grandcentrix.thirtyinch.TiFragment; - -import butterknife.ButterKnife; -import butterknife.Unbinder; - -/** - * Created by Kosh on 27 May 2016, 7:54 PM - */ - -public abstract class BaseFragment> extends TiFragment implements BaseMvp.FAView { - - protected BaseMvp.FAView callback; - - @Nullable private Unbinder unbinder; - - @LayoutRes protected abstract int fragmentLayout(); - - protected abstract void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState); - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (context instanceof BaseMvp.FAView) { - callback = (BaseMvp.FAView) context; - } - } - - @Override public void onDetach() { - super.onDetach(); - callback = null; - } - - @Override public void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - StateSaver.saveInstanceState(this, outState); - getPresenter().onSaveInstanceState(outState); - } - - @Override public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - if (savedInstanceState != null && !savedInstanceState.isEmpty()) { - StateSaver.restoreInstanceState(this, savedInstanceState); - getPresenter().onRestoreInstanceState(savedInstanceState); - } - getPresenter().setEnterprise(isEnterprise()); - } - - @SuppressLint("RestrictedApi") @Nullable @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - if (fragmentLayout() != 0) { - final Context contextThemeWrapper = new ContextThemeWrapper(getContext(), getContext().getTheme()); - LayoutInflater themeAwareInflater = inflater.cloneInContext(contextThemeWrapper); - View view = themeAwareInflater.inflate(fragmentLayout(), container, false); - unbinder = ButterKnife.bind(this, view); - return view; - } - return super.onCreateView(inflater, container, savedInstanceState); - } - - @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - if (Login.getUser() != null) { - onFragmentCreated(view, savedInstanceState); - } - } - - @Override public void onDestroyView() { - super.onDestroyView(); - if (unbinder != null) unbinder.unbind(); - } - - @Override public void showProgress(@StringRes int resId) { - callback.showProgress(resId); - } - - @Override public void showBlockingProgress(int resId) { - callback.showBlockingProgress(resId); - } - - @Override public void hideProgress() { - if (callback != null) callback.hideProgress(); - } - - @Override public void showMessage(@StringRes int titleRes, @StringRes int msgRes) { - callback.showMessage(titleRes, msgRes); - } - - @Override public void showMessage(@NonNull String titleRes, @NonNull String msgRes) { - callback.showMessage(titleRes, msgRes); - } - - @Override public void showErrorMessage(@NonNull String msgRes) { - callback.showErrorMessage(msgRes); - } - - @Override public boolean isLoggedIn() { - return callback.isLoggedIn(); - } - - @Override public void onRequireLogin() { - callback.onRequireLogin(); - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) {} - - @Override public void onDialogDismissed() {} - - @Override public void onLogoutPressed() { - callback.onLogoutPressed(); - } - - @Override public void onThemeChanged() { - callback.onThemeChanged(); - } - - @Override public void onOpenSettings() { - callback.onOpenSettings(); - } - - @Override public void onScrollTop(int index) {} - - @Override public boolean isEnterprise() { - return callback != null && callback.isEnterprise(); - } - - @Override public void onOpenUrlInBrowser() { - callback.onOpenUrlInBrowser(); - } - - protected boolean isSafe() { - return getView() != null && getActivity() != null && !getActivity().isFinishing(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/base/BaseMvpBottomSheetDialogFragment.java b/app/src/main/java/com/fastaccess/ui/base/BaseMvpBottomSheetDialogFragment.java deleted file mode 100644 index 48ba50246..000000000 --- a/app/src/main/java/com/fastaccess/ui/base/BaseMvpBottomSheetDialogFragment.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.fastaccess.ui.base; - -import android.annotation.SuppressLint; -import android.app.Dialog; -import android.content.Context; -import android.graphics.Color; -import android.graphics.drawable.ColorDrawable; -import android.os.Bundle; -import androidx.annotation.LayoutRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import com.google.android.material.bottomsheet.BottomSheetDialog; -import androidx.appcompat.view.ContextThemeWrapper; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.evernote.android.state.StateSaver; -import com.fastaccess.R; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import net.grandcentrix.thirtyinch.TiDialogFragment; - -import butterknife.ButterKnife; -import butterknife.Unbinder; - -/** - * Created by Kosh on 27 May 2017, 1:51 PM - */ - -public abstract class BaseMvpBottomSheetDialogFragment> extends TiDialogFragment - implements BaseMvp.FAView { - - protected BaseMvp.FAView callback; - - @Nullable private Unbinder unbinder; - - @LayoutRes protected abstract int fragmentLayout(); - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (context instanceof BaseMvp.FAView) { - callback = (BaseMvp.FAView) context; - } - } - - @Override public void onDetach() { - super.onDetach(); - callback = null; - } - - @Override public void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - StateSaver.saveInstanceState(this, outState); - getPresenter().onSaveInstanceState(outState); - } - - @Override public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setStyle(STYLE_NO_TITLE, AppHelper.isNightMode(getResources()) ? R.style.DialogThemeDark : R.style.DialogThemeLight); - if (savedInstanceState != null && !savedInstanceState.isEmpty()) { - StateSaver.restoreInstanceState(this, savedInstanceState); - getPresenter().onRestoreInstanceState(savedInstanceState); - } - getPresenter().setEnterprise(isEnterprise()); - } - - @SuppressLint("RestrictedApi") @Nullable @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - if (fragmentLayout() != 0) { - final Context contextThemeWrapper = new ContextThemeWrapper(getContext(), getContext().getTheme()); - LayoutInflater themeAwareInflater = inflater.cloneInContext(contextThemeWrapper); - View view = themeAwareInflater.inflate(fragmentLayout(), container, false); - unbinder = ButterKnife.bind(this, view); - return view; - } - return super.onCreateView(inflater, container, savedInstanceState); - } - - @Override public void showProgress(@StringRes int resId) { - callback.showProgress(resId); - } - - @Override public void showBlockingProgress(int resId) { - callback.showBlockingProgress(resId); - } - - @Override public void hideProgress() { - callback.hideProgress(); - } - - @Override public void showMessage(@StringRes int titleRes, @StringRes int msgRes) { - callback.showMessage(titleRes, msgRes); - } - - @Override public void showMessage(@NonNull String titleRes, @NonNull String msgRes) { - callback.showMessage(titleRes, msgRes); - } - - @Override public void showErrorMessage(@NonNull String msgRes) { - callback.showErrorMessage(msgRes); - } - - @Override public boolean isLoggedIn() { - return callback.isLoggedIn(); - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) {} - - @Override public void onDialogDismissed() { - - } - - @Override public void onRequireLogin() { - callback.onRequireLogin(); - } - - @Override public void onLogoutPressed() { - callback.onLogoutPressed(); - } - - @Override public void onThemeChanged() { - callback.onThemeChanged(); - } - - @Override public void onOpenSettings() { - callback.onOpenSettings(); - } - - @Override public void onScrollTop(int index) { - - } - - @Override public void onDestroyView() { - super.onDestroyView(); - if (unbinder != null) unbinder.unbind(); - } - - @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { - final BottomSheetDialog dialog = new BottomSheetDialog(getContext(), getTheme()); - if (dialog.getWindow() != null) dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); - dialog.setOnShowListener(dialogInterface -> { - if (ViewHelper.isTablet(getActivity())) { - if (dialog.getWindow() != null) { - dialog.getWindow().setLayout( - ViewGroup.LayoutParams.WRAP_CONTENT, - ViewGroup.LayoutParams.MATCH_PARENT); - } - } - }); - return dialog; - } - - @Override public boolean isEnterprise() { - return callback != null && callback.isEnterprise(); - } - - @Override public void onOpenUrlInBrowser() { - callback.onOpenUrlInBrowser(); - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/base/MainNavDrawer.kt b/app/src/main/java/com/fastaccess/ui/base/MainNavDrawer.kt deleted file mode 100644 index 7957363db..000000000 --- a/app/src/main/java/com/fastaccess/ui/base/MainNavDrawer.kt +++ /dev/null @@ -1,50 +0,0 @@ -package com.fastaccess.ui.base - -import com.google.android.material.navigation.NavigationView -import com.google.android.material.tabs.TabLayout -import android.view.View -import android.widget.TextView -import com.fastaccess.R -import com.fastaccess.data.dao.FragmentPagerAdapterModel -import com.fastaccess.data.dao.model.Login -import com.fastaccess.helper.PrefGetter -import com.fastaccess.ui.adapter.FragmentsPagerAdapter -import com.fastaccess.ui.widgets.AvatarLayout -import com.fastaccess.ui.widgets.FontTextView -import com.fastaccess.ui.widgets.ViewPagerView - -/** - * Created by Kosh on 09 Jul 2017, 3:50 PM - */ -class MainNavDrawer(val view: BaseActivity<*, *>, private val extraNav: NavigationView?) { - - - init { - setupView() - val viewpager = view.findViewById(R.id.drawerViewPager) - viewpager?.let { - it.adapter = FragmentsPagerAdapter(view.getSupportFragmentManager(), FragmentPagerAdapterModel.buildForDrawer(view)) - view.findViewById(R.id.drawerTabLayout)?.setupWithViewPager(it) - } - } - - fun setupView() { - val view = extraNav?.getHeaderView(0) ?: return - val userModel: Login? = Login.getUser() - userModel?.let { - (view.findViewById(R.id.navAvatarLayout) as AvatarLayout).setUrl(it.avatarUrl, null, false, - PrefGetter.isEnterprise()) - (view.findViewById(R.id.navUsername) as TextView).text = it.login - val navFullName = view.findViewById(R.id.navFullName) - when (it.name.isNullOrBlank()) { - true -> navFullName.visibility = View.GONE - else -> { - navFullName.visibility = View.VISIBLE - navFullName.text = it.name - } - } - view.findViewById(R.id.donatedIcon).visibility = if (PrefGetter.hasSupported()) View.VISIBLE else View.GONE - view.findViewById(R.id.proTextView).visibility = if (PrefGetter.isProEnabled()) View.VISIBLE else View.GONE - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/base/mvp/BaseMvp.java b/app/src/main/java/com/fastaccess/ui/base/mvp/BaseMvp.java deleted file mode 100644 index fec3eb795..000000000 --- a/app/src/main/java/com/fastaccess/ui/base/mvp/BaseMvp.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.fastaccess.ui.base.mvp; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; - -import com.fastaccess.ui.widgets.dialog.MessageDialogView; - -import net.grandcentrix.thirtyinch.TiView; -import net.grandcentrix.thirtyinch.callonmainthread.CallOnMainThread; - -import io.reactivex.Observable; -import io.reactivex.disposables.Disposable; -import io.reactivex.functions.Consumer; - -/** - * Created by Kosh on 25 May 2016, 9:09 PM - */ - -public interface BaseMvp { - - interface FAView extends TiView, MessageDialogView.MessageDialogViewActionCallback, OnScrollTopListener { - - @CallOnMainThread void showProgress(@StringRes int resId); - - @CallOnMainThread void showBlockingProgress(@StringRes int resId); - - @CallOnMainThread void hideProgress(); - - @CallOnMainThread void showMessage(@StringRes int titleRes, @StringRes int msgRes); - - @CallOnMainThread void showMessage(@NonNull String titleRes, @NonNull String msgRes); - - @CallOnMainThread void showErrorMessage(@NonNull String msgRes); - - boolean isLoggedIn(); - - void onRequireLogin(); - - void onLogoutPressed(); - - void onThemeChanged(); - - void onOpenSettings(); - - boolean isEnterprise(); - - void onOpenUrlInBrowser(); - } - - interface FAPresenter { - - void onSaveInstanceState(Bundle outState); - - void onRestoreInstanceState(Bundle outState); - - void manageDisposable(@Nullable Disposable... disposables); - - void manageObservable(@Nullable Observable observable); - - void manageViewDisposable(@Nullable Disposable... disposables); - - boolean isApiCalled(); - - void onSubscribed(boolean cancelable); - - void onError(@NonNull Throwable throwable); - - void makeRestCall(@NonNull Observable observable, @NonNull Consumer onNext); - - void makeRestCall(@NonNull Observable observable, @NonNull Consumer onNext, boolean cancelable); - - void onCheckGitHubStatus(); - } - - interface PaginationListener

{ - int getCurrentPage(); - - int getPreviousTotal(); - - void setCurrentPage(int page); - - void setPreviousTotal(int previousTotal); - - boolean onCallApi(int page, @Nullable P parameter); - } - - interface OnScrollTopListener { - void onScrollTop(int index); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/base/mvp/presenter/BasePresenter.java b/app/src/main/java/com/fastaccess/ui/base/mvp/presenter/BasePresenter.java deleted file mode 100644 index bce70d9dd..000000000 --- a/app/src/main/java/com/fastaccess/ui/base/mvp/presenter/BasePresenter.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.fastaccess.ui.base.mvp.presenter; - -import android.os.Bundle; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; - -import com.evernote.android.state.StateSaver; -import com.fastaccess.R; -import com.fastaccess.data.dao.GitHubErrorResponse; -import com.fastaccess.data.dao.GithubStatus; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.Logger; -import com.fastaccess.helper.ObjectsCompat; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.BaseMvp; - -import net.grandcentrix.thirtyinch.TiPresenter; -import net.grandcentrix.thirtyinch.rx2.RxTiPresenterDisposableHandler; - -import java.io.IOException; -import java.util.concurrent.TimeoutException; - -import io.reactivex.Observable; -import io.reactivex.disposables.Disposable; -import io.reactivex.functions.Consumer; - - -/** - * Created by Kosh on 25 May 2016, 9:12 PM - */ - -public class BasePresenter extends TiPresenter implements BaseMvp.FAPresenter { - @com.evernote.android.state.State boolean enterprise; - - private boolean apiCalled; - private final RxTiPresenterDisposableHandler subscriptionHandler = new RxTiPresenterDisposableHandler(this); - - @Override public void onSaveInstanceState(Bundle outState) { - StateSaver.saveInstanceState(this, outState); - } - - @Override public void onRestoreInstanceState(Bundle outState) { - if (outState != null) StateSaver.restoreInstanceState(this, outState); - } - - @Override public void manageDisposable(@Nullable Disposable... disposables) { - if (disposables != null) { - subscriptionHandler.manageDisposables(disposables); - } - } - - @Override public void manageObservable(@Nullable Observable observable) { - if (observable != null) { - manageDisposable(RxHelper.getObservable(observable).subscribe(t -> {/**/}, Throwable::printStackTrace)); - } - } - - @Override public void manageViewDisposable(@Nullable Disposable... disposables) { - if (disposables != null) { - if (isViewAttached()) { - subscriptionHandler.manageViewDisposables(disposables); - } else { - sendToView(v -> manageViewDisposable(disposables)); - } - } - } - - @Override public boolean isApiCalled() { - return apiCalled; - } - - @Override public void onSubscribed(boolean cancelable) { - sendToView(v -> { - if (cancelable) { - v.showProgress(R.string.in_progress); - } else { - v.showBlockingProgress(R.string.in_progress); - } - }); - } - - @Override public void onError(@NonNull Throwable throwable) { - apiCalled = true; - throwable.printStackTrace(); - int code = RestProvider.getErrorCode(throwable); - if (code == 401) { - sendToView(BaseMvp.FAView::onRequireLogin); - return; - } - GitHubErrorResponse errorResponse = RestProvider.getErrorResponse(throwable); - if (errorResponse != null && errorResponse.getMessage() != null) { - sendToView(v -> v.showErrorMessage(errorResponse.getMessage())); - } else { - sendToView(v -> v.showMessage(R.string.error, getPrettifiedErrorMessage(throwable))); - } - } - - @Override public void makeRestCall(@NonNull Observable observable, @NonNull Consumer onNext) { - makeRestCall(observable, onNext, true); - } - - @Override public void makeRestCall(@NonNull Observable observable, @NonNull Consumer onNext, boolean cancelable) { - manageDisposable( - RxHelper.getObservable(observable) - .doOnSubscribe(disposable -> onSubscribed(cancelable)) - .subscribe(onNext, this::onError, () -> apiCalled = true) - ); - } - - @StringRes private int getPrettifiedErrorMessage(@Nullable Throwable throwable) { - int resId = R.string.network_error; - if (throwable instanceof IOException) { - resId = R.string.request_error; - } else if (throwable instanceof TimeoutException) { - resId = R.string.unexpected_error; - } - return resId; - } - - public void onCheckGitHubStatus() { - manageObservable(RestProvider.gitHubStatus() - .filter(ObjectsCompat::nonNull) - .doOnNext(gitHubStatusModel -> { - Logger.e(gitHubStatusModel); - GithubStatus status = gitHubStatusModel.getStatus(); - String description = status != null ? status.getDescription() : null; - String indicatorStatus = status != null ? status.getIndicator() : null; - if (!InputHelper.isEmpty(description) && !"none".equalsIgnoreCase(indicatorStatus)) { - sendToView(v -> v.showErrorMessage("Github Status:(" + indicatorStatus + ")\n" + description)); - } - })); - } - - public boolean isEnterprise() { - return enterprise; - } - - public void setEnterprise(boolean enterprise) { - this.enterprise = enterprise; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/about/FastHubAboutActivity.java b/app/src/main/java/com/fastaccess/ui/modules/about/FastHubAboutActivity.java deleted file mode 100644 index 9a18f4566..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/about/FastHubAboutActivity.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.fastaccess.ui.modules.about; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.core.content.ContextCompat; -import android.view.MenuItem; -import android.view.View; -import android.widget.Toast; - -import com.danielstone.materialaboutlibrary.ConvenienceBuilder; -import com.danielstone.materialaboutlibrary.MaterialAboutActivity; -import com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem; -import com.danielstone.materialaboutlibrary.model.MaterialAboutCard; -import com.danielstone.materialaboutlibrary.model.MaterialAboutList; -import com.fastaccess.App; -import com.fastaccess.BuildConfig; -import com.fastaccess.R; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.provider.tasks.version.CheckVersionService; -import com.fastaccess.provider.theme.ThemeEngine; -import com.fastaccess.ui.modules.changelog.ChangelogBottomSheetDialog; -import com.fastaccess.ui.modules.main.donation.DonationActivity; -import com.fastaccess.ui.modules.repos.RepoPagerActivity; -import com.fastaccess.ui.modules.repos.issues.create.CreateIssueActivity; -import com.fastaccess.ui.modules.user.UserPagerActivity; -import com.mikepenz.aboutlibraries.Libs; -import com.mikepenz.aboutlibraries.LibsBuilder; - -import es.dmoral.toasty.Toasty; - -/** - * Created by danielstone on 12 Mar 2017, 1:57 AM - */ -public class FastHubAboutActivity extends MaterialAboutActivity { - - private View malRecyclerview; - - @Override protected void onCreate(@Nullable Bundle savedInstanceState) { - ThemeEngine.INSTANCE.applyForAbout(this); - super.onCreate(savedInstanceState); - malRecyclerview = findViewById(R.id.mal_recyclerview); - } - - @NonNull @Override protected MaterialAboutList getMaterialAboutList(@NonNull Context context) { - MaterialAboutCard.Builder appCardBuilder = new MaterialAboutCard.Builder(); - buildApp(context, appCardBuilder); - MaterialAboutCard.Builder miscCardBuilder = new MaterialAboutCard.Builder(); - buildMisc(context, miscCardBuilder); - MaterialAboutCard.Builder authorCardBuilder = new MaterialAboutCard.Builder(); - buildAuthor(context, authorCardBuilder); - MaterialAboutCard.Builder newLogoAuthor = new MaterialAboutCard.Builder(); - MaterialAboutCard.Builder logoAuthor = new MaterialAboutCard.Builder(); - buildLogo(context, newLogoAuthor, logoAuthor); - return new MaterialAboutList(appCardBuilder.build(), miscCardBuilder.build(), authorCardBuilder.build(), - newLogoAuthor.build(), logoAuthor.build()); - } - - @Override protected CharSequence getActivityTitle() { - return getString(R.string.app_name); - } - - @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (resultCode == RESULT_OK && requestCode == BundleConstant.REQUEST_CODE) { - Toasty.success(App.getInstance(), getString(R.string.thank_you_for_feedback), Toast.LENGTH_SHORT).show(); - } - } - - @Override public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == android.R.id.home) { - finish(); - } - return false;//override - } - - private void buildLogo(Context context, MaterialAboutCard.Builder newLogoAuthor, MaterialAboutCard.Builder logoAuthor) { - newLogoAuthor.title(getString(R.string.logo_designer, "Cookicons")); - newLogoAuthor.addItem(new MaterialAboutActionItem.Builder() - .text(R.string.google_plus) - .icon(ContextCompat.getDrawable(context, R.drawable.ic_profile)) - .setOnClickAction(() -> ActivityHelper.startCustomTab(this, "https://plus.google.com/+CookiconsDesign")) - .build()) - .addItem(new MaterialAboutActionItem.Builder() - .text(R.string.twitter) - .icon(ContextCompat.getDrawable(context, R.drawable.ic_profile)) - .setOnClickAction(() -> ActivityHelper.startCustomTab(this, "https://twitter.com/mcookie")) - .build()) - .addItem(new MaterialAboutActionItem.Builder() - .text(R.string.website) - .icon(ContextCompat.getDrawable(context, R.drawable.ic_brower)) - .setOnClickAction(() -> ActivityHelper.startCustomTab(this, "https://cookicons.co/")) - .build()); - - logoAuthor.title(String.format("Old %s", getString(R.string.logo_designer, "Kevin Aguilar"))); - logoAuthor.addItem(new MaterialAboutActionItem.Builder() - .text(R.string.google_plus) - .icon(ContextCompat.getDrawable(context, R.drawable.ic_profile)) - .setOnClickAction(() -> ActivityHelper.startCustomTab(this, "https://plus.google.com/+KevinAguilarC")) - .build()) - .addItem(new MaterialAboutActionItem.Builder() - .text(R.string.twitter) - .icon(ContextCompat.getDrawable(context, R.drawable.ic_profile)) - .setOnClickAction(() -> ActivityHelper.startCustomTab(this, "https://twitter.com/kevttob")) - .build()) - .addItem(new MaterialAboutActionItem.Builder() - .text(R.string.website) - .icon(ContextCompat.getDrawable(context, R.drawable.ic_brower)) - .setOnClickAction(() -> ActivityHelper.startCustomTab(this, "http://kevaguilar.com/")) - .build()); - } - - private void buildAuthor(Context context, MaterialAboutCard.Builder authorCardBuilder) { - authorCardBuilder.title(R.string.author); - authorCardBuilder.addItem(new MaterialAboutActionItem.Builder() - .text("Kosh Sergani") - .subText("k0shk0sh") - .icon(ContextCompat.getDrawable(context, R.drawable.ic_profile)) - .setOnClickAction(() -> UserPagerActivity.startActivity(context, "k0shk0sh", false, false,0)) - .build()) - .addItem(new MaterialAboutActionItem.Builder() - .text(R.string.fork_github) - .icon(ContextCompat.getDrawable(context, R.drawable.ic_github)) - .setOnClickAction(() -> startActivity(RepoPagerActivity.createIntent(this, "FastHub", "k0shk0sh"))) - .build()) - .addItem(ConvenienceBuilder.createEmailItem(context, ContextCompat.getDrawable(context, R.drawable.ic_email), - getString(R.string.send_email), true, getString(R.string.email_address), getString(R.string.question_concerning_fasthub))); - } - - private void buildMisc(Context context, MaterialAboutCard.Builder miscCardBuilder) { - miscCardBuilder.title(R.string.about) - .addItem(new MaterialAboutActionItem.Builder() - .text(R.string.support_development) - .icon(ContextCompat.getDrawable(context, R.drawable.ic_heart)) - .setOnClickAction(() -> startActivity(new Intent(context, DonationActivity.class))) - .build()) - .addItem(new MaterialAboutActionItem.Builder() - .text(R.string.changelog) - .icon(ContextCompat.getDrawable(context, R.drawable.ic_track_changes)) - .setOnClickAction(() -> new ChangelogBottomSheetDialog().show(getSupportFragmentManager(), "ChangelogBottomSheetDialog")) - .build()) - .addItem(new MaterialAboutActionItem.Builder() - .text(R.string.open_source_libs) - .icon(ContextCompat.getDrawable(context, R.drawable.ic_github)) - .setOnClickAction(() -> new LibsBuilder() - .withActivityStyle(AppHelper.isNightMode(getResources()) ? Libs.ActivityStyle.DARK : Libs.ActivityStyle.LIGHT) - .withAutoDetect(true) - .withActivityTitle(this.getResources().getString(R.string.open_source_libs)) - .withAboutIconShown(true) - .withAboutVersionShown(true) - .start(this)) - .build()); - } - - private void buildApp(Context context, MaterialAboutCard.Builder appCardBuilder) { - appCardBuilder.addItem(new MaterialAboutActionItem.Builder() - .text(getString(R.string.version)) - .icon(ContextCompat.getDrawable(context, R.drawable.ic_update)) - .subText(BuildConfig.VERSION_NAME) - .setOnClickAction(() -> startService(new Intent(this, CheckVersionService.class))) - .build()) - .addItem(ConvenienceBuilder.createRateActionItem(context, ContextCompat.getDrawable(context, R.drawable.ic_star_filled), - getString(R.string.rate_app), null)) - .addItem(new MaterialAboutActionItem.Builder() - .text(R.string.report_issue) - .subText(R.string.report_issue_here) - .icon(ContextCompat.getDrawable(context, R.drawable.ic_bug)) - .setOnClickAction(() -> CreateIssueActivity.startForResult(this, CreateIssueActivity.startForResult(this), malRecyclerview)) - .build()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/changelog/ChangelogBottomSheetDialog.java b/app/src/main/java/com/fastaccess/ui/modules/changelog/ChangelogBottomSheetDialog.java deleted file mode 100644 index 6d972dce8..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/changelog/ChangelogBottomSheetDialog.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.fastaccess.ui.modules.changelog; - -import android.app.Dialog; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; -import android.widget.ProgressBar; - -import com.fastaccess.R; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.ui.base.BaseMvpBottomSheetDialogFragment; -import com.fastaccess.ui.widgets.FontButton; -import com.fastaccess.ui.widgets.FontTextView; -import com.prettifier.pretty.PrettifyWebView; - -import butterknife.BindView; -import butterknife.OnClick; - -/** - * Created by Kosh on 26 Mar 2017, 10:15 PM - */ - -public class ChangelogBottomSheetDialog extends BaseMvpBottomSheetDialogFragment implements - ChangelogMvp.View { - - @BindView(R.id.title) FontTextView title; - @BindView(R.id.message) FontTextView message; - @BindView(R.id.cancel) FontButton cancel; - @BindView(R.id.messageLayout) View messageLayout; - @BindView(R.id.prettifyWebView) PrettifyWebView prettifyWebView; - @BindView(R.id.webProgress) ProgressBar webProgress; - - @OnClick(R.id.ok) void onOk() { - dismiss(); - } - - @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - if (savedInstanceState == null) { - PrefGetter.setWhatsNewVersion(); - } - webProgress.setVisibility(View.VISIBLE); - cancel.setVisibility(View.GONE); - title.setText(R.string.changelog); - if (getPresenter().getHtml() == null) { - getPresenter().onLoadChangelog(); - } else { - showChangelog(getPresenter().getHtml()); - } - } - - @Override protected int fragmentLayout() { - return R.layout.message_dialog; - } - - @Override public void onChangelogLoaded(@Nullable String html) { - showChangelog(html); - } - - @NonNull @Override public ChangelogPresenter providePresenter() { - return new ChangelogPresenter(); - } - - @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { - Dialog dialog = super.onCreateDialog(savedInstanceState); - dialog.setCancelable(false); - dialog.setCanceledOnTouchOutside(false); - return dialog; - } - - private void showChangelog(String html) { - if (prettifyWebView == null) return; - webProgress.setVisibility(View.GONE); - if (html != null) { - message.setVisibility(View.GONE); - prettifyWebView.setVisibility(View.VISIBLE); - prettifyWebView.setGithubContent(html, null, false, false); - prettifyWebView.setNestedScrollingEnabled(false); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/changelog/ChangelogMvp.java b/app/src/main/java/com/fastaccess/ui/modules/changelog/ChangelogMvp.java deleted file mode 100644 index b1f09f38a..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/changelog/ChangelogMvp.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.fastaccess.ui.modules.changelog; - -import androidx.annotation.Nullable; - -import com.fastaccess.ui.base.mvp.BaseMvp; - -/** - * Created by Kosh on 28 May 2017, 10:53 AM - */ - -public interface ChangelogMvp { - - interface View extends BaseMvp.FAView { - void onChangelogLoaded(@Nullable String html); - } - - interface Presenter { - void onLoadChangelog(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/changelog/ChangelogPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/changelog/ChangelogPresenter.java deleted file mode 100644 index 599b9e364..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/changelog/ChangelogPresenter.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.fastaccess.ui.modules.changelog; - -import com.fastaccess.App; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.gson.ToGsonProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import lombok.Getter; - -/** - * Created by Kosh on 28 May 2017, 10:53 AM - */ - -@Getter public class ChangelogPresenter extends BasePresenter implements ChangelogMvp.Presenter { - private String html; - - @Override public void onLoadChangelog() { - manageDisposable(RxHelper.getObservable(ToGsonProvider.getChangelog(App.getInstance())) - .subscribe(s -> { - this.html = s; - sendToView(view -> view.onChangelogLoaded(html)); - }, throwable -> sendToView(view -> view.onChangelogLoaded(null)))); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/code/CodeViewerActivity.java b/app/src/main/java/com/fastaccess/ui/modules/code/CodeViewerActivity.java deleted file mode 100644 index 35b8f128b..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/code/CodeViewerActivity.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.fastaccess.ui.modules.code; - -import android.content.Context; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.Menu; -import android.view.MenuItem; -import android.webkit.MimeTypeMap; - -import com.annimon.stream.Objects; -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.gists.gist.GistActivity; -import com.fastaccess.ui.modules.repos.code.files.activity.RepoFilesActivity; -import com.fastaccess.ui.modules.repos.code.prettifier.ViewerFragment; - -import net.grandcentrix.thirtyinch.TiPresenter; - -/** - * Created by Kosh on 27 Nov 2016, 3:43 PM - */ - -public class CodeViewerActivity extends BaseActivity { - - @State String url; - @State String htmlUrl; - - public static void startActivity(@NonNull Context context, @NonNull String url, @NonNull String htmlUrl) { - if (!InputHelper.isEmpty(url)) { - Intent intent = ActivityHelper.editBundle(createIntent(context, url, htmlUrl), LinkParserHelper.isEnterprise(htmlUrl)); - context.startActivity(intent); - } - } - - public static Intent createIntent(@NonNull Context context, @NonNull String url, @NonNull String htmlUrl) { - Intent intent = new Intent(context, CodeViewerActivity.class); - boolean isEnterprise = LinkParserHelper.isEnterprise(htmlUrl); - url = LinkParserHelper.getEnterpriseGistUrl(url, isEnterprise); - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA_TWO, htmlUrl) - .put(BundleConstant.EXTRA, url) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .end()); - return intent; - } - - @Override protected int layout() { - return R.layout.activity_fragment_layout; - } - - @Override protected boolean isTransparent() { - return true; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @NonNull @Override public TiPresenter providePresenter() { - return new BasePresenter(); - } - - @Override protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - if (savedInstanceState == null) { - Intent intent = Objects.requireNonNull(getIntent(), "Intent is null"); - Bundle bundle = Objects.requireNonNull(intent.getExtras()); - //noinspection ConstantConditions - url = Objects.requireNonNull(bundle.getString(BundleConstant.EXTRA), "Url is null"); - htmlUrl = bundle.getString(BundleConstant.EXTRA_TWO); - getSupportFragmentManager() - .beginTransaction() - .replace(R.id.container, ViewerFragment.newInstance(url, htmlUrl), ViewerFragment.TAG) - .commit(); - } - String title = Uri.parse(url).getLastPathSegment(); - setTitle(title); - if (toolbar != null) toolbar.setSubtitle(MimeTypeMap.getFileExtensionFromUrl(url)); - setTaskName(title); - } - - @Override public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.download_browser_menu, menu); - return super.onCreateOptionsMenu(menu); - } - - @Override public boolean onOptionsItemSelected(MenuItem item) { - if (InputHelper.isEmpty(url)) return super.onOptionsItemSelected(item); - if (item.getItemId() == R.id.viewAsCode) { - ViewerFragment viewerFragment = (ViewerFragment) AppHelper.getFragmentByTag(getSupportFragmentManager(), ViewerFragment.TAG); - if (viewerFragment != null) { - viewerFragment.onViewAsCode(); - } - return true; - } else if (item.getItemId() == R.id.download) { - if (ActivityHelper.checkAndRequestReadWritePermission(this)) { - RestProvider.downloadFile(this, url); - } - return true; - } else if (item.getItemId() == R.id.browser) { - ActivityHelper.openChooser(this, htmlUrl != null ? htmlUrl : url); - return true; - } else if (item.getItemId() == R.id.copy) { - AppHelper.copyToClipboard(this, htmlUrl != null ? htmlUrl : url); - return true; - } else if (item.getItemId() == R.id.share) { - ActivityHelper.shareUrl(this, htmlUrl != null ? htmlUrl : url); - return true; - } else if (item.getItemId() == android.R.id.home) { - Uri uri = Uri.parse(url); - if (uri == null) { - finish(); - return true; - } - String gistId = LinkParserHelper.getGistId(uri); - if (!InputHelper.isEmpty(gistId)) { - startActivity(GistActivity.createIntent(this, gistId, isEnterprise())); - } else { - RepoFilesActivity.startActivity(this, url, isEnterprise()); - } - finish(); - return true; - } - return super.onOptionsItemSelected(item); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/editor/EditorActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/editor/EditorActivity.kt deleted file mode 100644 index 889297442..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/editor/EditorActivity.kt +++ /dev/null @@ -1,241 +0,0 @@ -package com.fastaccess.ui.modules.editor - -import android.annotation.SuppressLint -import android.app.Activity -import android.content.Intent -import android.os.Bundle -import androidx.annotation.StringRes -import androidx.transition.TransitionManager -import androidx.fragment.app.FragmentManager -import android.view.Menu -import android.view.MenuItem -import android.view.View -import android.view.View.GONE -import android.view.ViewGroup -import android.widget.EditText -import android.widget.LinearLayout -import android.widget.ListView -import butterknife.BindView -import butterknife.OnClick -import com.evernote.android.state.State -import com.fastaccess.R -import com.fastaccess.data.dao.EditReviewCommentModel -import com.fastaccess.data.dao.model.Comment -import com.fastaccess.helper.* -import com.fastaccess.provider.emoji.Emoji -import com.fastaccess.provider.markdown.MarkDownProvider -import com.fastaccess.ui.base.BaseActivity -import com.fastaccess.ui.widgets.FontTextView -import com.fastaccess.ui.widgets.dialog.MessageDialogView -import com.fastaccess.ui.widgets.markdown.MarkDownLayout -import com.fastaccess.ui.widgets.markdown.MarkdownEditText -import java.util.* - -/** - * Created by Kosh on 27 Nov 2016, 1:32 AM - */ - -class EditorActivity : BaseActivity(), EditorMvp.View { - - private var participants: ArrayList? = null - private val sentFromFastHub: String by lazy { - "\n\n_" + getString( - R.string.sent_from_fasthub, AppHelper.getDeviceName(), "", - "[" + getString(R.string.app_name) + "](https://play.google.com/store/apps/details?id=com.fastaccess.github)" - ) + "_" - } - - @BindView(R.id.replyQuote) lateinit var replyQuote: LinearLayout - @BindView(R.id.replyQuoteText) lateinit var quote: FontTextView - @BindView(R.id.markDownLayout) lateinit var markDownLayout: MarkDownLayout - @BindView(R.id.editText) lateinit var editText: MarkdownEditText - @BindView(R.id.list_divider) lateinit var listDivider: View - @BindView(R.id.parentView) lateinit var parentView: View - @BindView(R.id.autocomplete) lateinit var mention: ListView - - @State @BundleConstant.ExtraType var extraType: String? = null - @State var itemId: String? = null - @State var login: String? = null - @State var issueNumber: Int = 0 - @State var commentId: Long = 0 - @State var sha: String? = null - @State var reviewComment: EditReviewCommentModel? = null - - override fun layout(): Int = R.layout.editor_layout - - override fun isTransparent(): Boolean = false - - override fun canBack(): Boolean = true - - override fun isSecured(): Boolean = false - - override fun providePresenter(): EditorPresenter = EditorPresenter() - - @OnClick(R.id.replyQuoteText) internal fun onToggleQuote() { - TransitionManager.beginDelayedTransition((parentView as ViewGroup)) - if (quote.maxLines == 3) { - quote.maxLines = Integer.MAX_VALUE - } else { - quote.maxLines = 3 - } - quote.setCompoundDrawablesWithIntrinsicBounds( - 0, 0, - if (quote.maxLines == 3) R.drawable.ic_arrow_drop_down - else R.drawable.ic_arrow_drop_up, 0 - ) - } - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - markDownLayout.markdownListener = this - setToolbarIcon(R.drawable.ic_clear) - if (savedInstanceState == null) { - onCreate() - } - invalidateOptionsMenu() - editText.initListView(mention, listDivider, participants) - editText.requestFocus() - } - - override fun onSendResultAndFinish(commentModel: Comment, isNew: Boolean) { - hideProgress() - val intent = Intent() - intent.putExtras( - Bundler.start() - .put(BundleConstant.ITEM, commentModel) - .put(BundleConstant.EXTRA, isNew) - .end() - ) - setResult(Activity.RESULT_OK, intent) - finish() - } - - override fun onSendMarkDownResult() { - val intent = Intent() - intent.putExtras(Bundler.start().put(BundleConstant.EXTRA, editText.savedText).end()) - setResult(Activity.RESULT_OK, intent) - finish() - } - - override fun onSendReviewResultAndFinish(comment: EditReviewCommentModel, isNew: Boolean) { - hideProgress() - val intent = Intent() - intent.putExtras( - Bundler.start() - .put(BundleConstant.ITEM, comment) - .put(BundleConstant.EXTRA, isNew) - .end() - ) - setResult(Activity.RESULT_OK, intent) - finish() - } - - override fun onCreateOptionsMenu(menu: Menu): Boolean { - menuInflater.inflate(R.menu.done_menu, menu) - return super.onCreateOptionsMenu(menu) - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - if (item.itemId == R.id.submit) { - if (PrefGetter.isSentViaEnabled()) { - val temp = editText.savedText.toString() - if (!temp.contains(sentFromFastHub)) { - editText.savedText = editText.savedText.toString() + sentFromFastHub - } - } - presenter.onHandleSubmission(editText.savedText, extraType, itemId, commentId, login, issueNumber, sha, reviewComment) - return true - } - return super.onOptionsItemSelected(item) - } - - override fun onPrepareOptionsMenu(menu: Menu): Boolean { - if (menu.findItem(R.id.submit) != null) { - menu.findItem(R.id.submit).isEnabled = true - } - if (BundleConstant.ExtraType.FOR_RESULT_EXTRA.equals(extraType, ignoreCase = true)) { - menu.findItem(R.id.submit).setIcon(R.drawable.ic_done) - } - return super.onPrepareOptionsMenu(menu) - } - - override fun showProgress(@StringRes resId: Int) { - super.showProgress(resId) - invalidateOptionsMenu() - } - - override fun hideProgress() { - invalidateOptionsMenu() - super.hideProgress() - } - - override fun onBackPressed() { - if (!InputHelper.isEmpty(editText)) { - ViewHelper.hideKeyboard(editText) - MessageDialogView.newInstance( - getString(R.string.close), getString(R.string.unsaved_data_warning), - Bundler.start() - .put("primary_extra", getString(R.string.discard)) - .put("secondary_extra", getString(R.string.cancel)) - .put(BundleConstant.EXTRA, true) - .end() - ) - .show(supportFragmentManager, MessageDialogView.TAG) - return - - } - super.onBackPressed() - } - - override fun onMessageDialogActionClicked(isOk: Boolean, bundle: Bundle?) { - super.onMessageDialogActionClicked(isOk, bundle) - if (isOk && bundle != null) { - finish() - } - } - - override fun onAppendLink(title: String?, link: String?, isLink: Boolean) { - markDownLayout.onAppendLink(title, link, isLink) - } - - override fun getEditText(): EditText = editText - - override fun getSavedText(): CharSequence? = editText.savedText - - override fun fragmentManager(): FragmentManager = supportFragmentManager - - @SuppressLint("SetTextI18n") - override fun onEmojiAdded(emoji: Emoji?) { - markDownLayout.onEmojiAdded(emoji) - } - - private fun onCreate() { - val intent = intent - if (intent != null && intent.extras != null) { - val bundle = intent.extras - extraType = bundle?.getString(BundleConstant.EXTRA_TYPE) - reviewComment = bundle?.getParcelable(BundleConstant.REVIEW_EXTRA) - itemId = bundle?.getString(BundleConstant.ID) - login = bundle?.getString(BundleConstant.EXTRA_TWO) - if (extraType.equals(BundleConstant.ExtraType.EDIT_COMMIT_COMMENT_EXTRA, ignoreCase = true) - || extraType.equals(BundleConstant.ExtraType.NEW_COMMIT_COMMENT_EXTRA, ignoreCase = true) - ) { - sha = bundle?.getString(BundleConstant.EXTRA_THREE) - } else { - issueNumber = bundle?.getInt(BundleConstant.EXTRA_THREE) ?: -1 - } - commentId = bundle?.getLong(BundleConstant.EXTRA_FOUR) ?: -1 - val textToUpdate = bundle?.getString(BundleConstant.EXTRA) - if (!InputHelper.isEmpty(textToUpdate)) { - editText.setText(String.format("%s ", textToUpdate)) - editText.setSelection(InputHelper.toString(editText).length) - } - if (bundle?.getString("message", "").isNullOrEmpty()) { - replyQuote.visibility = GONE - } else { - MarkDownProvider.setMdText(quote, bundle?.getString("message", "")) - } - participants = bundle?.getStringArrayList("participants") - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/editor/EditorMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/editor/EditorMvp.kt deleted file mode 100644 index 114176171..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/editor/EditorMvp.kt +++ /dev/null @@ -1,44 +0,0 @@ -package com.fastaccess.ui.modules.editor - -import com.fastaccess.data.dao.EditReviewCommentModel -import com.fastaccess.data.dao.model.Comment -import com.fastaccess.helper.BundleConstant -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.modules.editor.emoji.EmojiMvp -import com.fastaccess.ui.modules.editor.popup.EditorLinkImageMvp -import com.fastaccess.ui.widgets.markdown.MarkDownLayout - -/** - * Created by Kosh on 27 Nov 2016, 1:31 AM - */ - -interface EditorMvp { - - interface View : BaseMvp.FAView, EditorLinkImageMvp.EditorLinkCallback, - MarkDownLayout.MarkdownListener, EmojiMvp.EmojiCallback { - fun onSendResultAndFinish(commentModel: Comment, isNew: Boolean) - - fun onSendMarkDownResult() - - fun onSendReviewResultAndFinish(comment: EditReviewCommentModel, isNew: Boolean) - } - - interface Presenter : BaseMvp.FAPresenter { - - fun onEditGistComment(id: Long, savedText: CharSequence?, gistId: String) - - fun onSubmitGistComment(savedText: CharSequence?, gistId: String) - - fun onSubmitIssueComment(savedText: CharSequence, itemId: String, login: String, issueNumber: Int) - - fun onEditIssueComment(savedText: CharSequence, itemId: String, id: Long, login: String, issueNumber: Int) - - fun onSubmitCommitComment(savedText: CharSequence, itemId: String, login: String, sha: String) - - fun onEditCommitComment(savedText: CharSequence, itemId: String, login: String, id: Long) - - fun onHandleSubmission(savedText: CharSequence?, @BundleConstant.ExtraType extraType: String?, - itemId: String?, id: Long, login: String?, issueNumber: Int, sha: String?, - reviewComment: EditReviewCommentModel?) - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/editor/EditorPresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/editor/EditorPresenter.kt deleted file mode 100644 index df35994ba..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/editor/EditorPresenter.kt +++ /dev/null @@ -1,157 +0,0 @@ -package com.fastaccess.ui.modules.editor - -import com.fastaccess.data.dao.CommentRequestModel -import com.fastaccess.data.dao.EditReviewCommentModel -import com.fastaccess.data.dao.model.Comment -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.BundleConstant.ExtraType.* -import com.fastaccess.helper.InputHelper -import com.fastaccess.provider.rest.RestProvider -import com.fastaccess.ui.base.mvp.presenter.BasePresenter - -/** - * Created by Kosh on 27 Nov 2016, 1:31 AM - */ - -class EditorPresenter : BasePresenter(), EditorMvp.Presenter { - - override fun onEditGistComment(id: Long, savedText: CharSequence?, gistId: String) { - if (!InputHelper.isEmpty(savedText)) { - val requestModel = CommentRequestModel() - requestModel.body = savedText!!.toString() - makeRestCall(RestProvider.getGistService(isEnterprise).editGistComment(gistId, id, requestModel), - { comment -> sendToView { view -> view.onSendResultAndFinish(comment, false) } }, false) - } - } - - override fun onSubmitGistComment(savedText: CharSequence?, gistId: String) { - if (!InputHelper.isEmpty(savedText)) { - val requestModel = CommentRequestModel() - requestModel.body = savedText!!.toString() - makeRestCall(RestProvider.getGistService(isEnterprise).createGistComment(gistId, requestModel), - { comment -> sendToView { view -> view.onSendResultAndFinish(comment, true) } }, false) - } - } - - override fun onHandleSubmission(savedText: CharSequence?, @BundleConstant.ExtraType extraType: String?, - itemId: String?, id: Long, login: String?, issueNumber: Int, - sha: String?, reviewComment: EditReviewCommentModel?) { - if (extraType == null) { - throw NullPointerException("extraType is null") - } - when (extraType) { - EDIT_GIST_COMMENT_EXTRA -> { - if (itemId == null) { - throw NullPointerException("itemId is null") - } - onEditGistComment(id, savedText, itemId) - } - NEW_GIST_COMMENT_EXTRA -> { - if (itemId == null) { - throw NullPointerException("itemId is null") - } - onSubmitGistComment(savedText, itemId) - } - FOR_RESULT_EXTRA -> sendToView({ it.onSendMarkDownResult() }) - EDIT_ISSUE_COMMENT_EXTRA -> { - if (itemId == null || login == null) { - throw NullPointerException("itemId or login is null") - } - onEditIssueComment(savedText!!, itemId, id, login, issueNumber) - } - NEW_ISSUE_COMMENT_EXTRA -> { - if (itemId == null || login == null) { - throw NullPointerException("itemId or login is null") - } - onSubmitIssueComment(savedText!!, itemId, login, issueNumber) - } - NEW_COMMIT_COMMENT_EXTRA -> { - if (itemId == null || login == null || sha == null) { - throw NullPointerException("itemId or login is null") - } - onSubmitCommitComment(savedText!!, itemId, login, sha) - } - EDIT_COMMIT_COMMENT_EXTRA -> { - if (itemId == null || login == null) { - throw NullPointerException("itemId or login is null") - } - onEditCommitComment(savedText!!, itemId, login, id) - } - NEW_REVIEW_COMMENT_EXTRA -> { - if (reviewComment == null || itemId == null || login == null || savedText == null) { - throw NullPointerException("reviewComment null") - } - onSubmitReviewComment(reviewComment, savedText, itemId, login, issueNumber) - } - EDIT_REVIEW_COMMENT_EXTRA -> { - if (reviewComment == null || itemId == null || login == null || savedText == null) { - throw NullPointerException("reviewComment null") - } - onEditReviewComment(reviewComment, savedText, itemId, login, issueNumber, id) - } - } - } - - private fun onEditReviewComment(reviewComment: EditReviewCommentModel, savedText: CharSequence, repoId: String, - login: String, @Suppress("UNUSED_PARAMETER") issueNumber: Int, id: Long) { - if (!InputHelper.isEmpty(savedText)) { - val requestModel = CommentRequestModel() - requestModel.body = savedText.toString() - makeRestCall(RestProvider.getReviewService(isEnterprise).editComment(login, repoId, id, requestModel) - .map { comment -> - reviewComment.commentModel = comment - reviewComment - }, { comment -> sendToView { view -> view.onSendReviewResultAndFinish(comment, false) } }, false) - } - } - - private fun onSubmitReviewComment(reviewComment: EditReviewCommentModel, savedText: CharSequence, - repoId: String, login: String, issueNumber: Int) { - if (!InputHelper.isEmpty(savedText)) { - val requestModel = CommentRequestModel() - requestModel.body = savedText.toString() - requestModel.inReplyTo = reviewComment.inReplyTo - makeRestCall(RestProvider.getReviewService(isEnterprise).submitComment(login, repoId, issueNumber.toLong(), requestModel) - .map { comment -> - reviewComment.commentModel = comment - reviewComment - }, { comment -> sendToView { view -> view.onSendReviewResultAndFinish(comment, true) } }, false) - } - } - - override fun onSubmitIssueComment(savedText: CharSequence, itemId: String, login: String, issueNumber: Int) { - if (!InputHelper.isEmpty(savedText)) { - val requestModel = CommentRequestModel() - requestModel.body = savedText.toString() - makeRestCall(RestProvider.getIssueService(isEnterprise).createIssueComment(login, itemId, issueNumber, requestModel) - ) { comment -> sendToView { view -> view.onSendResultAndFinish(comment, true) } } - } - } - - override fun onEditIssueComment(savedText: CharSequence, itemId: String, id: Long, login: String, issueNumber: Int) { - if (!InputHelper.isEmpty(savedText)) { - val requestModel = CommentRequestModel() - requestModel.body = savedText.toString() - makeRestCall(RestProvider.getIssueService(isEnterprise).editIssueComment(login, itemId, id, requestModel), - { comment -> sendToView { view -> view.onSendResultAndFinish(comment, false) } }, false) - } - } - - override fun onSubmitCommitComment(savedText: CharSequence, itemId: String, login: String, sha: String) { - if (!InputHelper.isEmpty(savedText)) { - val requestModel = CommentRequestModel() - requestModel.body = savedText.toString() - makeRestCall(RestProvider.getRepoService(isEnterprise).postCommitComment(login, itemId, sha, requestModel), - { comment -> sendToView { view -> view.onSendResultAndFinish(comment, true) } }, false) - } - } - - override fun onEditCommitComment(savedText: CharSequence, itemId: String, login: String, id: Long) { - if (!InputHelper.isEmpty(savedText)) { - val requestModel = CommentRequestModel() - requestModel.body = savedText.toString() - makeRestCall(RestProvider.getRepoService(isEnterprise).editCommitComment(login, itemId, id, requestModel), - { comment -> sendToView { view -> view.onSendResultAndFinish(comment, false) } }, false) - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/editor/comment/CommentEditorFragment.kt b/app/src/main/java/com/fastaccess/ui/modules/editor/comment/CommentEditorFragment.kt deleted file mode 100644 index 42fe49e49..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/editor/comment/CommentEditorFragment.kt +++ /dev/null @@ -1,174 +0,0 @@ -package com.fastaccess.ui.modules.editor.comment - -import android.annotation.SuppressLint -import android.app.Activity -import android.content.Context -import android.content.Intent -import android.os.Bundle -import androidx.transition.TransitionManager -import androidx.fragment.app.FragmentManager -import android.view.View -import android.view.ViewGroup -import android.widget.EditText -import butterknife.BindView -import butterknife.OnClick -import com.fastaccess.R -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.helper.InputHelper -import com.fastaccess.helper.ViewHelper -import com.fastaccess.provider.emoji.Emoji -import com.fastaccess.ui.base.BaseFragment -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import com.fastaccess.ui.modules.editor.EditorActivity -import com.fastaccess.ui.modules.editor.emoji.EmojiMvp -import com.fastaccess.ui.modules.editor.popup.EditorLinkImageMvp -import com.fastaccess.ui.widgets.markdown.MarkDownLayout -import com.fastaccess.ui.widgets.markdown.MarkdownEditText -import net.yslibrary.android.keyboardvisibilityevent.KeyboardVisibilityEvent -import net.yslibrary.android.keyboardvisibilityevent.Unregistrar - -/** - * Created by kosh on 21/08/2017. - */ -class CommentEditorFragment : BaseFragment>(), MarkDownLayout.MarkdownListener, - EmojiMvp.EmojiCallback, EditorLinkImageMvp.EditorLinkCallback { - - @BindView(R.id.commentBox) lateinit var commentBox: View - @BindView(R.id.markdDownLayout) lateinit var markdDownLayout: MarkDownLayout - @BindView(R.id.commentText) lateinit var commentText: MarkdownEditText - @BindView(R.id.markdownBtnHolder) lateinit var markdownBtnHolder: View - @BindView(R.id.sendComment) lateinit var sendComment: View - @BindView(R.id.toggleButtons) lateinit var toggleButtons: View - private var commentListener: CommentListener? = null - private var keyboardListener: Unregistrar? = null - - @OnClick(R.id.sendComment) internal fun onComment() { - if (!InputHelper.isEmpty(getEditText())) { - commentListener?.onSendActionClicked(InputHelper.toString(getEditText()), arguments?.getBundle(BundleConstant.ITEM)) - ViewHelper.hideKeyboard(getEditText()) - arguments = null - } - } - - @OnClick(R.id.fullScreenComment) internal fun onExpandScreen() { - val intent = Intent(context, EditorActivity::class.java) - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraType.FOR_RESULT_EXTRA) - .put(BundleConstant.EXTRA, getEditText().text.toString()) - .putStringArrayList("participants", commentListener?.getNamesToTag()) - .end()) - startActivityForResult(intent, BundleConstant.REQUEST_CODE) - } - - @OnClick(R.id.toggleButtons) internal fun onToggleButtons(v: View) { - TransitionManager.beginDelayedTransition((view as ViewGroup?)!!) - v.isActivated = !v.isActivated - markdownBtnHolder.visibility = if (markdownBtnHolder.visibility == View.VISIBLE) View.GONE else View.VISIBLE - } - - override fun onAttach(context: Context) { - super.onAttach(context) - if (parentFragment is CommentListener) { - commentListener = parentFragment as CommentListener - } else if (context is CommentListener) { - commentListener = context - } - } - - override fun onDetach() { - commentListener = null - super.onDetach() - } - - override fun providePresenter(): BasePresenter = BasePresenter() - - override fun fragmentLayout(): Int = R.layout.comment_box_layout - - override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { - arguments?.let { - val hideSendButton = it.getBoolean(BundleConstant.YES_NO_EXTRA) - if (hideSendButton) { - sendComment.visibility = View.GONE - } - } - markdDownLayout.markdownListener = this - if (savedInstanceState == null) { - arguments?.getBundle(BundleConstant.ITEM)?.getString(BundleConstant.EXTRA)?.let { commentText.setText(it) } - } - } - - override fun onStart() { - super.onStart() - keyboardListener = KeyboardVisibilityEvent.registerEventListener(activity, { - TransitionManager.beginDelayedTransition((view as ViewGroup?)!!) - toggleButtons.isActivated = it - markdownBtnHolder.visibility = if (!it) View.GONE else View.VISIBLE - }) - } - - override fun onStop() { - keyboardListener?.unregister() - super.onStop() - } - - override fun getEditText(): EditText = commentText - - override fun fragmentManager(): FragmentManager = childFragmentManager - - override fun getSavedText(): CharSequence? = commentText.savedText - - override fun onEmojiAdded(emoji: Emoji?) = markdDownLayout.onEmojiAdded(emoji) - - @SuppressLint("SetTextI18n") - fun onCreateComment(text: String, bundle: Bundle?) { - arguments = Bundler.start().put(BundleConstant.ITEM, bundle).end() - commentText.setText("${if (commentText.text.isNullOrBlank()) "" else "${commentText.text} "}$text") - getEditText().setSelection(getEditText().text.length) - commentText.requestFocus() - ViewHelper.showKeyboard(commentText) - } - - fun onAddUserName(username: String) { - getEditText().setText(if (getEditText().text.isNullOrBlank()) { - "@$username" - } else { - "${getEditText().text} @$username" - }) - getEditText().setSelection(getEditText().text.length) - } - - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - super.onActivityResult(requestCode, resultCode, data) - if (resultCode == Activity.RESULT_OK) { - if (requestCode == BundleConstant.REQUEST_CODE) { - val text = data?.extras?.getCharSequence(BundleConstant.EXTRA) - getEditText().setText(text) - getEditText().setSelection(getEditText().text.length) - } - } - } - - override fun onAppendLink(title: String?, link: String?, isLink: Boolean) { - markdDownLayout.onAppendLink(title, link, isLink) - } - - interface CommentListener { - fun onCreateComment(text: String, bundle: Bundle?) {} - fun onSendActionClicked(text: String, bundle: Bundle?) - fun onTagUser(username: String) - fun onClearEditText() - fun getNamesToTag(): ArrayList? - } - - companion object { - fun newInstance(bundle: Bundle?): CommentEditorFragment { - val fragment = CommentEditorFragment() - bundle?.let { - fragment.arguments = Bundler.start().put(BundleConstant.ITEM, bundle).end() - } - return fragment - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/editor/emoji/EmojiBottomSheet.kt b/app/src/main/java/com/fastaccess/ui/modules/editor/emoji/EmojiBottomSheet.kt deleted file mode 100644 index 0ea734044..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/editor/emoji/EmojiBottomSheet.kt +++ /dev/null @@ -1,76 +0,0 @@ -package com.fastaccess.ui.modules.editor.emoji - -import android.content.Context -import android.os.Bundle -import android.text.Editable -import android.view.View -import butterknife.BindView -import butterknife.OnTextChanged -import com.fastaccess.R -import com.fastaccess.provider.emoji.Emoji -import com.fastaccess.ui.adapter.EmojiAdapter -import com.fastaccess.ui.base.BaseMvpBottomSheetDialogFragment -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView -import com.fastaccess.ui.widgets.recyclerview.layout_manager.GridManager -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller - -/** - * Created by kosh on 17/08/2017. - */ -class EmojiBottomSheet : BaseMvpBottomSheetDialogFragment(), EmojiMvp.View { - - @BindView(R.id.recycler) lateinit var recycler: DynamicRecyclerView - @BindView(R.id.fastScroller) lateinit var fastScroller: RecyclerViewFastScroller - - val adapter: EmojiAdapter by lazy { EmojiAdapter(this) } - - var emojiCallback: EmojiMvp.EmojiCallback? = null - - - @OnTextChanged(value = [(R.id.editText)], callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) - fun onTextChange(text: Editable) { - adapter.filter.filter(text) - } - - override fun onAttach(context: Context) { - super.onAttach(context) - emojiCallback = when { - parentFragment is EmojiMvp.EmojiCallback -> parentFragment as EmojiMvp.EmojiCallback - context is EmojiMvp.EmojiCallback -> context - else -> throw IllegalArgumentException("${context.javaClass.simpleName} must implement EmojiMvp.EmojiCallback") - } - } - - override fun onDetach() { - emojiCallback = null - super.onDetach() - } - - override fun fragmentLayout(): Int = R.layout.emoji_popup_layout - - override fun providePresenter(): EmojiPresenter = EmojiPresenter() - - override fun clearAdapter() { - adapter.clear() - } - - override fun onAddEmoji(emoji: Emoji) { - adapter.addItem(emoji) - } - - override fun onItemClick(position: Int, v: View?, item: Emoji) { - emojiCallback?.onEmojiAdded(item) - dismiss() - } - - override fun onItemLongClick(position: Int, v: View?, item: Emoji?) {} - - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - recycler.adapter = adapter - fastScroller.attachRecyclerView(recycler) - presenter.onLoadEmoji() - val gridManager = recycler.layoutManager as GridManager - gridManager.iconSize = resources.getDimensionPixelSize(R.dimen.header_icon_zie) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/editor/emoji/EmojiMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/editor/emoji/EmojiMvp.kt deleted file mode 100644 index eec2eb1f9..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/editor/emoji/EmojiMvp.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.fastaccess.ui.modules.editor.emoji - -import com.fastaccess.provider.emoji.Emoji -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created by kosh on 17/08/2017. - */ -interface EmojiMvp { - - interface View : BaseMvp.FAView, BaseViewHolder.OnItemClickListener { - fun clearAdapter() - fun onAddEmoji(emoji: Emoji) - } - - interface Presenter { - fun onLoadEmoji() - } - - interface EmojiCallback { - fun onEmojiAdded(emoji: Emoji?) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/editor/emoji/EmojiPresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/editor/emoji/EmojiPresenter.kt deleted file mode 100644 index 3ae507b8f..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/editor/emoji/EmojiPresenter.kt +++ /dev/null @@ -1,29 +0,0 @@ -package com.fastaccess.ui.modules.editor.emoji - -import com.fastaccess.provider.emoji.Emoji -import com.fastaccess.provider.emoji.EmojiManager -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import io.reactivex.Observable - -/** - * Created by kosh on 17/08/2017. - */ - -class EmojiPresenter : BasePresenter(), EmojiMvp.Presenter { - override fun onLoadEmoji() { - manageObservable(Observable.create { e -> - val emojies = EmojiManager.getAll() - emojies?.let { - it.onEach { - if (!e.isDisposed) { - e.onNext(it) - } - } - } - e.onComplete() - } - .doOnSubscribe { sendToView { it.clearAdapter() } } - .doOnNext { emoji -> sendToView { it.onAddEmoji(emoji) } }) - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/editor/popup/EditorLinkImageDialogFragment.java b/app/src/main/java/com/fastaccess/ui/modules/editor/popup/EditorLinkImageDialogFragment.java deleted file mode 100644 index 923401978..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/editor/popup/EditorLinkImageDialogFragment.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.fastaccess.ui.modules.editor.popup; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.textfield.TextInputLayout; -import android.view.View; - -import com.fastaccess.App; -import com.fastaccess.R; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.FileHelper; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.ui.base.BaseDialogFragment; -import com.fastaccess.ui.widgets.FontButton; - -import org.jetbrains.annotations.NotNull; - -import java.io.File; - -import butterknife.BindView; -import butterknife.OnClick; -import es.dmoral.toasty.Toasty; - -/** - * Created by Kosh on 15 Apr 2017, 9:14 PM - */ - -public class EditorLinkImageDialogFragment extends BaseDialogFragment - implements EditorLinkImageMvp.View { - - private EditorLinkImageMvp.EditorLinkCallback callback; - - @BindView(R.id.title) TextInputLayout title; - @BindView(R.id.link) TextInputLayout link; - @BindView(R.id.select) FontButton select; - - public static EditorLinkImageDialogFragment newInstance(boolean isLink, @Nullable String link) { - EditorLinkImageDialogFragment fragment = new EditorLinkImageDialogFragment(); - fragment.setArguments(Bundler - .start() - .put(BundleConstant.YES_NO_EXTRA, isLink) - .put(BundleConstant.ITEM, link) - .end()); - return fragment; - } - - @Override public void onAttach(@NotNull Context context) { - super.onAttach(context); - if (getParentFragment() instanceof EditorLinkImageMvp.EditorLinkCallback) { - callback = (EditorLinkImageMvp.EditorLinkCallback) getParentFragment(); - } else if (context instanceof EditorLinkImageMvp.EditorLinkCallback) { - callback = (EditorLinkImageMvp.EditorLinkCallback) context; - } - } - - @Override public void onDetach() { - callback = null; - super.onDetach(); - } - - @Override public void onUploaded(@Nullable String title, @Nullable String link) { - hideProgress(); - if (callback != null) { - callback.onAppendLink(title, link != null ? link.replace("http:", "https:") : null, isLink()); - } - dismiss(); - } - - @Override protected int fragmentLayout() { - return R.layout.markdown_link_image_dialog_layout; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - select.setVisibility(isLink() ? View.GONE : View.VISIBLE); - if (savedInstanceState == null) { - title.getEditText().setText(getArguments().getString(BundleConstant.ITEM)); - } - } - - @NonNull @Override public EditorLinkImagePresenter providePresenter() { - return new EditorLinkImagePresenter(); - } - - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (resultCode == Activity.RESULT_OK && requestCode == BundleConstant.REQUEST_CODE) { - if (data != null && data.getData() != null) { - String path = FileHelper.getPath(getContext(), data.getData()); - if (!InputHelper.isEmpty(path)) { - getPresenter().onSubmit(InputHelper.toString(title), new File(path)); - } else { - Toasty.error(App.getInstance(), getString(R.string.failed_selecting_image)).show(); - } - } - } - } - - @OnClick(R.id.select) public void onSelectClicked() { - if (ActivityHelper.checkAndRequestReadWritePermission(getActivity())) { - Intent intent = new Intent(); - intent.setType("image/*"); - intent.setAction(Intent.ACTION_GET_CONTENT); - startActivityForResult(Intent.createChooser(intent, getString(R.string.select_picture)), BundleConstant.REQUEST_CODE); - } - } - - @OnClick(R.id.cancel) public void onCancelClicked() { - dismiss(); - } - - @OnClick(R.id.insert) public void onInsertClicked() { - if (callback != null) { - callback.onAppendLink(InputHelper.toString(title), InputHelper.toString(link), isLink()); - } - dismiss(); - } - - private boolean isLink() { - return getArguments() != null && getArguments().getBoolean(BundleConstant.YES_NO_EXTRA); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/editor/popup/EditorLinkImageMvp.java b/app/src/main/java/com/fastaccess/ui/modules/editor/popup/EditorLinkImageMvp.java deleted file mode 100644 index 3510f99bc..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/editor/popup/EditorLinkImageMvp.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.fastaccess.ui.modules.editor.popup; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.ui.base.mvp.BaseMvp; - -import java.io.File; - -/** - * Created by Kosh on 15 Apr 2017, 9:06 PM - */ - -public interface EditorLinkImageMvp { - - interface EditorLinkCallback { - void onAppendLink(@Nullable String title, @Nullable String link, boolean isLink); - } - - interface View extends BaseMvp.FAView { - void onUploaded(@Nullable String title, @Nullable String link); - } - - interface Presenter { - void onSubmit(@Nullable String title, @NonNull File file); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/editor/popup/EditorLinkImagePresenter.java b/app/src/main/java/com/fastaccess/ui/modules/editor/popup/EditorLinkImagePresenter.java deleted file mode 100644 index bbe771be6..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/editor/popup/EditorLinkImagePresenter.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.fastaccess.ui.modules.editor.popup; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.ImgurReponseModel; -import com.fastaccess.provider.rest.ImgurProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.io.File; - -import okhttp3.MediaType; -import okhttp3.RequestBody; - -/** - * Created by Kosh on 15 Apr 2017, 9:08 PM - */ - -public class EditorLinkImagePresenter extends BasePresenter implements EditorLinkImageMvp.Presenter { - @Override public void onSubmit(@Nullable String title, @NonNull File file) { - if (file.exists()) { - RequestBody image = RequestBody.create(MediaType.parse("image/*"), file); - makeRestCall(ImgurProvider.getImgurService().postImage(title, image), - imgurReponseModel -> { - if (imgurReponseModel.getData() != null) { - ImgurReponseModel.ImgurImage imageResponse = imgurReponseModel.getData(); - sendToView(view -> view.onUploaded(title == null ? imageResponse.getTitle() : title, imageResponse.getLink())); - return; - } - sendToView(view -> view.onUploaded(null, null)); - }, false); - } else { - if (getView() != null) getView().onUploaded(null, null); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/feeds/FeedsFragment.java b/app/src/main/java/com/fastaccess/ui/modules/feeds/FeedsFragment.java deleted file mode 100644 index 0734df677..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/feeds/FeedsFragment.java +++ /dev/null @@ -1,186 +0,0 @@ -package com.fastaccess.ui.modules.feeds; - -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.os.Parcelable; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.GitCommitModel; -import com.fastaccess.data.dao.NameParser; -import com.fastaccess.data.dao.SimpleUrlsModel; -import com.fastaccess.data.dao.model.Event; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.adapter.FeedsAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.repos.code.commit.details.CommitPagerActivity; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.dialog.ListDialogView; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.ArrayList; -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 12:36 PM - */ - -public class FeedsFragment extends BaseFragment implements FeedsMvp.View { - - public static final String TAG = FeedsFragment.class.getSimpleName(); - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private FeedsAdapter adapter; - private OnLoadMore onLoadMore; - - public static FeedsFragment newInstance(@Nullable String user) { - return newInstance(user, false); - } - - public static FeedsFragment newInstance(@Nullable String user, boolean isOrg) { - FeedsFragment feedsFragment = new FeedsFragment(); - feedsFragment.setArguments(Bundler.start() - .put(BundleConstant.EXTRA, user) - .put(BundleConstant.EXTRA_TWO, isOrg) - .end()); - return feedsFragment; - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - stateLayout.setEmptyText(R.string.no_feeds); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - adapter = new FeedsAdapter(getPresenter().getEvents(), isProfile()); - adapter.setListener(getPresenter()); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter() - .getPreviousTotal()); - recycler.setAdapter(adapter); - if (isProfile()) { - recycler.addDivider(); - } - recycler.addOnScrollListener(getLoadMore()); - fastScroller.attachRecyclerView(recycler); - if (getPresenter().getEvents().isEmpty() && !getPresenter().isApiCalled()) { - getPresenter().onFragmentCreated(getArguments()); - } - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override public void showProgress(@StringRes int resId) { - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @Override public void onOpenRepoChooser(@NonNull ArrayList models) { - ListDialogView dialogView = new ListDialogView<>(); - dialogView.initArguments(getString(R.string.repo_chooser), models); - dialogView.show(getChildFragmentManager(), "ListDialogView"); - } - - @NonNull @Override public FeedsPresenter providePresenter() { - return new FeedsPresenter(); - } - - @SuppressWarnings("unchecked") @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore(getPresenter()); - } - return onLoadMore; - } - - @Override public void onOpenCommitChooser(@NonNull List commits) { - ListDialogView dialogView = new ListDialogView<>(); - dialogView.initArguments(getString(R.string.commits), commits); - dialogView.show(getChildFragmentManager(), "ListDialogView"); - } - - @Override public void onDestroyView() { - recycler.removeOnScrollListener(getLoadMore()); - super.onDestroyView(); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onItemSelected(Parcelable item) { - if (item instanceof SimpleUrlsModel) { - SchemeParser.launchUri(getContext(), Uri.parse(((SimpleUrlsModel) item).getItem())); - } else if (item instanceof GitCommitModel) { - GitCommitModel model = (GitCommitModel) item; - NameParser nameParser = new NameParser(model.getUrl()); - Intent intent = CommitPagerActivity.createIntent(getContext(), nameParser.getName(), - nameParser.getUsername(), model.getSha(), true, LinkParserHelper.isEnterprise(model.getUrl())); - getContext().startActivity(intent); - } - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) { - recycler.scrollToPosition(0); - } - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } - - public boolean isProfile() { - return !InputHelper.isEmpty(getArguments().getString(BundleConstant.EXTRA)) && - !getArguments().getBoolean(BundleConstant.EXTRA_TWO); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/feeds/FeedsMvp.java b/app/src/main/java/com/fastaccess/ui/modules/feeds/FeedsMvp.java deleted file mode 100644 index c2e6719a5..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/feeds/FeedsMvp.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.fastaccess.ui.modules.feeds; - -import android.os.Bundle; -import android.os.Parcelable; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.GitCommitModel; -import com.fastaccess.data.dao.SimpleUrlsModel; -import com.fastaccess.data.dao.model.Event; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.dialog.ListDialogView; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 11 Nov 2016, 12:35 PM - */ - -public interface FeedsMvp { - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, - android.view.View.OnClickListener, ListDialogView.onSimpleItemSelection { - - void onNotifyAdapter(@Nullable List events, int page); - - void onOpenRepoChooser(@NonNull ArrayList models); - - @NonNull OnLoadMore getLoadMore(); - - void onOpenCommitChooser(@NonNull List commits); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - void onFragmentCreated(@NonNull Bundle argument); - - boolean onCallApi(int page); - - @NonNull ArrayList getEvents(); - - void onWorkOffline(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/feeds/FeedsPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/feeds/FeedsPresenter.java deleted file mode 100644 index 4c963073a..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/feeds/FeedsPresenter.java +++ /dev/null @@ -1,200 +0,0 @@ -package com.fastaccess.ui.modules.feeds; - -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.annimon.stream.Collectors; -import com.annimon.stream.Stream; -import com.fastaccess.data.dao.NameParser; -import com.fastaccess.data.dao.Pageable; -import com.fastaccess.data.dao.PayloadModel; -import com.fastaccess.data.dao.SimpleUrlsModel; -import com.fastaccess.data.dao.model.Event; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.data.dao.types.EventsType; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.Logger; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.repos.RepoPagerActivity; -import com.fastaccess.ui.modules.repos.code.commit.details.CommitPagerActivity; -import com.fastaccess.ui.modules.repos.code.releases.ReleasesListActivity; -import com.fastaccess.ui.modules.repos.wiki.WikiActivity; - -import java.util.ArrayList; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 11 Nov 2016, 12:36 PM - */ - -public class FeedsPresenter extends BasePresenter implements FeedsMvp.Presenter { - private ArrayList eventsModels = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - @com.evernote.android.state.State String user; - @com.evernote.android.state.State boolean isOrg; - - @Override public void onFragmentCreated(@NonNull Bundle argument) { - user = argument.getString(BundleConstant.EXTRA); - isOrg = argument.getBoolean(BundleConstant.EXTRA_TWO); - if (eventsModels.isEmpty()) { - onCallApi(1); - } - } - - @Override public boolean onCallApi(int page) { - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - if (page > lastPage || lastPage == 0) { - sendToView(FeedsMvp.View::hideProgress); - return false; - } - setCurrentPage(page); - Login login = Login.getUser(); - if (login == null) return false;// I can't understand how this could possibly be reached lol. - Observable> observable; - Logger.e(isOrg); - if (user != null) { - if (isOrg) { - observable = RestProvider.getOrgService(isEnterprise()).getReceivedEvents(login.getLogin(), user, page); - } else { - observable = RestProvider.getUserService(login.getLogin().equalsIgnoreCase(user) - ? PrefGetter.isEnterprise() : isEnterprise()).getUserEvents(user, page); - } - } else { - observable = RestProvider.getUserService(PrefGetter.isEnterprise()).getReceivedEvents(login.getLogin(), page); - } - makeRestCall(observable, response -> { - lastPage = response.getLast(); - if (getCurrentPage() == 1) { - manageDisposable(Event.save(response.getItems(), user)); - } - sendToView(view -> view.onNotifyAdapter(response.getItems(), page)); - }); - return true; - } - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public boolean onCallApi(int page, @Nullable Object parameter) { - return onCallApi(page); - } - - @Override public void onSubscribed(boolean cancelable) { - sendToView(view -> view.showProgress(0)); - } - - @Override public void onError(@NonNull Throwable throwable) { - onWorkOffline(); - super.onError(throwable); - } - - @NonNull @Override public ArrayList getEvents() { - return eventsModels; - } - - @Override public void onWorkOffline() { - if (eventsModels.isEmpty() && InputHelper.isEmpty(user)) { - manageDisposable(RxHelper.getObservable(Event.getEvents(Login.getUser().getLogin()).toObservable()) - .subscribe(modelList -> { - if (modelList != null) { - sendToView(view -> view.onNotifyAdapter(modelList, 1)); - } - }, Throwable::printStackTrace)); - } else { - sendToView(FeedsMvp.View::hideProgress); - } - } - - @Override public void onItemClick(int position, View v, Event item) { - if (item.getType() == EventsType.ForkEvent) { - NameParser parser = new NameParser(item.getPayload().getForkee().getHtmlUrl()); - RepoPagerActivity.startRepoPager(v.getContext(), parser); - } else { - PayloadModel payloadModel = item.getPayload(); - if (payloadModel != null) { - if (payloadModel.getHead() != null) { - if (payloadModel.getCommits() != null && payloadModel.getCommits().size() > 1) { - sendToView(view -> view.onOpenCommitChooser(payloadModel.getCommits())); - } else { - Repo repoModel = item.getRepo(); - NameParser nameParser = new NameParser(repoModel.getUrl()); - Intent intent = CommitPagerActivity.createIntent(v.getContext(), nameParser.getName(), - nameParser.getUsername(), payloadModel.getHead(), true, - LinkParserHelper.isEnterprise(repoModel.getUrl())); - v.getContext().startActivity(intent); - } - } else if (payloadModel.getIssue() != null) { - SchemeParser.launchUri(v.getContext(), Uri.parse(payloadModel.getIssue().getHtmlUrl()), true); - } else if (payloadModel.getPullRequest() != null) { - SchemeParser.launchUri(v.getContext(), Uri.parse(payloadModel.getPullRequest().getHtmlUrl()), true); - } else if (payloadModel.getComment() != null) { - SchemeParser.launchUri(v.getContext(), Uri.parse(payloadModel.getComment().getHtmlUrl()), true); - } else if (item.getType() == EventsType.ReleaseEvent && payloadModel.getRelease() != null) { - NameParser nameParser = new NameParser(payloadModel.getRelease().getHtmlUrl()); - v.getContext().startActivity(ReleasesListActivity.getIntent(v.getContext(), nameParser.getUsername(), nameParser.getName(), - payloadModel.getRelease().getId(), LinkParserHelper.isEnterprise(payloadModel.getRelease().getHtmlUrl()))); - - } else if (item.getType() == EventsType.CreateEvent && "tag".equalsIgnoreCase(payloadModel.getRefType())) { - Repo repoModel = item.getRepo(); - NameParser nameParser = new NameParser(repoModel.getUrl()); - v.getContext().startActivity(ReleasesListActivity.getIntent(v.getContext(), nameParser.getUsername(), nameParser.getName(), - payloadModel.getRef(), LinkParserHelper.isEnterprise(repoModel.getUrl()))); - } else if (item.getType() == EventsType.GollumEvent) { - Repo repoModel = item.getRepo(); - NameParser parser = new NameParser(repoModel.getUrl()); - v.getContext().startActivity(WikiActivity.Companion.getWiki(v.getContext(), parser.getName(), parser.getUsername())); - } else { - Repo repoModel = item.getRepo(); - NameParser parser = new NameParser(repoModel.getUrl()); - RepoPagerActivity.startRepoPager(v.getContext(), parser); - } - } - } - } - - @Override public void onItemLongClick(int position, View v, Event item) { - if (item.getType() == EventsType.ForkEvent) { - if (getView() != null) { - getView().onOpenRepoChooser(Stream.of(new SimpleUrlsModel(item.getRepo().getName(), item.getRepo().getUrl()), - new SimpleUrlsModel(item.getPayload().getForkee().getFullName(), item.getPayload().getForkee().getHtmlUrl())) - .collect(Collectors.toCollection(ArrayList::new))); - } - } else { - Repo repo = item.getRepo(); - if (repo != null) { - NameParser parser = new NameParser(repo.getUrl()); - RepoPagerActivity.startRepoPager(v.getContext(), parser); - } - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/filter/chooser/FilterAddChooserListener.java b/app/src/main/java/com/fastaccess/ui/modules/filter/chooser/FilterAddChooserListener.java deleted file mode 100644 index cf94c3b0c..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/filter/chooser/FilterAddChooserListener.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.fastaccess.ui.modules.filter.chooser; - -/** - * Created by Kosh on 10 Apr 2017, 12:19 PM - */ - -public interface FilterAddChooserListener { - - void onAddSelected(); - - void onSearchSelected(); -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/filter/chooser/FilterChooserBottomSheetDialog.java b/app/src/main/java/com/fastaccess/ui/modules/filter/chooser/FilterChooserBottomSheetDialog.java deleted file mode 100644 index 786436760..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/filter/chooser/FilterChooserBottomSheetDialog.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.fastaccess.ui.modules.filter.chooser; - -import android.content.Context; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.ui.base.BaseBottomSheetDialog; - -import butterknife.OnClick; - -/** - * Created by Kosh on 10 Apr 2017, 12:18 PM - */ - -public class FilterChooserBottomSheetDialog extends BaseBottomSheetDialog { - - private FilterAddChooserListener listener; - - public static FilterChooserBottomSheetDialog newInstance() { - return new FilterChooserBottomSheetDialog(); - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() instanceof FilterAddChooserListener) { - listener = (FilterAddChooserListener) getParentFragment(); - } else if (context instanceof FilterAddChooserListener) { - listener = (FilterAddChooserListener) context; - } - } - - @Override public void onDestroy() { - listener = null; - super.onDestroy(); - } - - @Override protected int layoutRes() { - return R.layout.add_filter_row_layout; - } - - @OnClick({R.id.add, R.id.search}) public void onViewClicked(View view) { - switch (view.getId()) { - case R.id.add: - listener.onAddSelected(); - break; - case R.id.search: - listener.onSearchSelected(); - break; - } - dismiss(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/filter/issues/FilterIssuesActivity.java b/app/src/main/java/com/fastaccess/ui/modules/filter/issues/FilterIssuesActivity.java deleted file mode 100644 index 458778939..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/filter/issues/FilterIssuesActivity.java +++ /dev/null @@ -1,585 +0,0 @@ -package com.fastaccess.ui.modules.filter.issues; - -import android.annotation.SuppressLint; -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.content.res.Resources; -import android.graphics.drawable.ColorDrawable; -import android.os.Bundle; -import android.os.Handler; -import androidx.annotation.NonNull; -import android.text.Editable; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.PopupWindow; -import android.widget.Toast; - -import com.evernote.android.state.State; -import com.fastaccess.App; -import com.fastaccess.R; -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.AnimHelper; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.provider.timeline.CommentsHelper; -import com.fastaccess.ui.adapter.LabelsAdapter; -import com.fastaccess.ui.adapter.MilestonesAdapter; -import com.fastaccess.ui.adapter.SimpleListAdapter; -import com.fastaccess.ui.adapter.UsersAdapter; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.modules.filter.issues.fragment.FilterIssueFragment; -import com.fastaccess.ui.widgets.FontEditText; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.ForegroundImageView; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; - -import java.util.ArrayList; -import java.util.Collections; - -import butterknife.BindView; -import butterknife.ButterKnife; -import butterknife.OnClick; -import butterknife.OnEditorAction; -import butterknife.OnTextChanged; -import es.dmoral.toasty.Toasty; - -/** - * Created by Kosh on 09 Apr 2017, 6:23 PM - */ - -public class FilterIssuesActivity extends BaseActivity implements - FilterIssuesActivityMvp.View { - @BindView(R.id.back) ForegroundImageView back; - @BindView(R.id.open) FontTextView open; - @BindView(R.id.close) FontTextView close; - @BindView(R.id.author) FontTextView author; - @BindView(R.id.labels) FontTextView labels; - @BindView(R.id.milestone) FontTextView milestone; - @BindView(R.id.assignee) FontTextView assignee; - @BindView(R.id.sort) FontTextView sort; - @BindView(R.id.searchEditText) FontEditText searchEditText; - @BindView(R.id.clear) View clear; - @State boolean isIssue; - @State boolean isOpen; - @State String login; - @State String repoId; - @State String criteria; - - private FilterIssueFragment filterFragment; - private MilestonesAdapter milestonesAdapter; - private LabelsAdapter labelsAdapter; - private UsersAdapter assigneesAdapter; - private PopupWindow popupWindow; - - - public static Intent getIntent(@NonNull Context context, @NonNull String login, @NonNull String repoId, @NonNull String criteria) { - Intent intent = new Intent(context, FilterIssuesActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA_FOUR, criteria) - .put(BundleConstant.EXTRA_TWO, true) - .put(BundleConstant.EXTRA_THREE, true) - .end()); - return intent; - } - - public static void startActivity(@NonNull Activity context, @NonNull String login, @NonNull String repoId, - boolean isIssue, boolean isOpen, boolean isEnterprise) { - Intent intent = new Intent(context, FilterIssuesActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA_TWO, isIssue) - .put(BundleConstant.EXTRA_THREE, isOpen) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .end()); - View view = context.findViewById(R.id.fab); - if (view != null) { - ActivityHelper.startReveal(context, intent, view); - } else { - context.startActivity(intent); - } - } - - public static void startActivity(@NonNull View view, @NonNull String login, @NonNull String repoId, - boolean isIssue, boolean isOpen, boolean isEnterprise, @NonNull String criteria) { - Intent intent = new Intent(view.getContext(), FilterIssuesActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA_TWO, isIssue) - .put(BundleConstant.EXTRA_THREE, isOpen) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .put(BundleConstant.EXTRA_FOUR, criteria) - .end()); - //noinspection ConstantConditions - ActivityHelper.startReveal(ActivityHelper.getActivity(view.getContext()), intent, view); - } - - @Override protected int layout() { - return R.layout.filter_issues_prs_layout; - } - - @Override protected boolean isTransparent() { - return true; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @NonNull @Override public FilterIssuesActivityPresenter providePresenter() { - return new FilterIssuesActivityPresenter(); - } - - @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - if (savedInstanceState == null) { - Bundle bundle = getIntent().getExtras(); - isIssue = bundle.getBoolean(BundleConstant.EXTRA_TWO); - isOpen = bundle.getBoolean(BundleConstant.EXTRA_THREE); - repoId = bundle.getString(BundleConstant.ID); - login = bundle.getString(BundleConstant.EXTRA); - criteria = bundle.getString(BundleConstant.EXTRA_FOUR); - getPresenter().onStart(login, repoId); - if (isOpen) { - onOpenClicked(); - } else { - onCloseClicked(); - } - } - } - - @OnClick(R.id.back) public void onBackClicked() { - onBackPressed(); - } - - @OnClick(R.id.open) public void onOpenClicked() { - if (!open.isSelected()) { - open.setSelected(true); - close.setSelected(false); - String text = InputHelper.toString(searchEditText); - if (!InputHelper.isEmpty(text)) { - text = text.replace("is:closed", "is:open"); - searchEditText.setText(text); - onSearch(); - } else { - searchEditText.setText(String.format("%s %s ", isOpen ? "is:open" : "is:closed", isIssue ? "is:issue" : "is:pr")); - if (!InputHelper.isEmpty(criteria)) { - searchEditText.setText(String.format("%s%s", InputHelper.toString(searchEditText), criteria)); - criteria = null; - } - onSearch(); - } - } - } - - @OnClick(R.id.close) public void onCloseClicked() { - if (!close.isSelected()) { - open.setSelected(false); - close.setSelected(true); - String text = InputHelper.toString(searchEditText); - if (!InputHelper.isEmpty(text)) { - text = text.replace("is:open", "is:closed"); - searchEditText.setText(text); - onSearch(); - } else { - searchEditText.setText(String.format("%s %s ", isOpen ? "is:open" : "is:closed", isIssue ? "is:issue" : "is:pr")); - onSearch(); - } - } - } - - @OnClick(R.id.author) public void onAuthorClicked() { - Toasty.info(App.getInstance(), "GitHub doesn't have this API yet!\nYou can try typing it yourself for example author:k0shk0sh", - Toast.LENGTH_LONG).show(); - } - - @SuppressLint("InflateParams") @OnClick(R.id.labels) public void onLabelsClicked() { - if (labels.getTag() != null) return; - labels.setTag(true); - ViewHolder viewHolder = new ViewHolder(LayoutInflater.from(this).inflate(R.layout.simple_list_dialog, null)); - setupPopupWindow(viewHolder); - viewHolder.recycler.setAdapter(getLabelsAdapter()); - AnimHelper.revealPopupWindow(popupWindow, labels); - } - - @SuppressLint("InflateParams") @OnClick(R.id.milestone) public void onMilestoneClicked() { - if (milestone.getTag() != null) return; - milestone.setTag(true); - ViewHolder viewHolder = new ViewHolder(LayoutInflater.from(this).inflate(R.layout.simple_list_dialog, null)); - setupPopupWindow(viewHolder); - viewHolder.recycler.setAdapter(getMilestonesAdapter()); - AnimHelper.revealPopupWindow(popupWindow, milestone); - } - - @SuppressLint("InflateParams") @OnClick(R.id.assignee) public void onAssigneeClicked() { - if (assignee.getTag() != null) return; - assignee.setTag(true); - ViewHolder viewHolder = new ViewHolder(LayoutInflater.from(this).inflate(R.layout.simple_list_dialog, null)); - setupPopupWindow(viewHolder); - viewHolder.recycler.setAdapter(getAssigneesAdapter()); - AnimHelper.revealPopupWindow(popupWindow, assignee); - } - - @SuppressLint("InflateParams") @OnClick(R.id.sort) public void onSortClicked() { - if (sort.getTag() != null) return; - sort.setTag(true); - ViewHolder viewHolder = new ViewHolder(LayoutInflater.from(this).inflate(R.layout.simple_list_dialog, null)); - setupPopupWindow(viewHolder); - ArrayList lists = new ArrayList<>(); - Collections.addAll(lists, getResources().getStringArray(R.array.sort_prs_issues)); - lists.add(CommentsHelper.getThumbsUp()); - lists.add(CommentsHelper.getThumbsDown()); - lists.add(CommentsHelper.getLaugh()); - lists.add(CommentsHelper.getHooray()); - lists.add(CommentsHelper.getSad()); - lists.add(CommentsHelper.getHeart()); - viewHolder.recycler.setAdapter(new SimpleListAdapter<>(lists, new BaseViewHolder.OnItemClickListener() { - @Override public void onItemClick(int position, View v, String item) { - appendSort(item); - } - - @Override public void onItemLongClick(int position, View v, String item) {} - })); - AnimHelper.revealPopupWindow(popupWindow, sort); - } - - @OnClick(value = {R.id.clear}) void onClear(View view) { - if (view.getId() == R.id.clear) { - AppHelper.hideKeyboard(searchEditText); - searchEditText.setText(""); - } - } - - @OnClick(R.id.search) void onSearchClicked() { - onSearch(); - } - - @OnTextChanged(value = R.id.searchEditText, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) void onTextChange(Editable s) { - String text = s.toString(); - if (text.length() == 0) { - AnimHelper.animateVisibility(clear, false); - } else { - AnimHelper.animateVisibility(clear, true); - } - } - - @OnEditorAction(R.id.searchEditText) protected boolean onEditor() { - onSearchClicked(); - return true; - } - - @Override public void onSetCount(int count, boolean isOpen) { - if (isOpen) { - open.setText(SpannableBuilder.builder() - .append(getString(R.string.open)) - .append("(") - .append(String.valueOf(count)) - .append(")")); - close.setText(R.string.closed); - } else { - close.setText(SpannableBuilder.builder() - .append(getString(R.string.closed)) - .append("(") - .append(String.valueOf(count)) - .append(")")); - open.setText(R.string.open); - } - } - - @Override public void showProgress(int resId) { - super.showProgress(resId); - } - - @Override public void hideProgress() { - super.hideProgress(); - } - - @NonNull private String getRepoName() { - return "repo:" + login + "/" + repoId + " "; - }// let users stay within selected repo context. - - @Override public void onBackPressed() { - if (popupWindow != null && popupWindow.isShowing()) { - popupWindow.dismiss(); - } else { - super.onBackPressed(); - } - } - - private void setupPopupWindow(@NonNull ViewHolder viewHolder) { - if (popupWindow == null) { - popupWindow = new PopupWindow(this); - popupWindow.setElevation(getResources().getDimension(R.dimen.spacing_micro)); - popupWindow.setOutsideTouchable(true); - popupWindow.setBackgroundDrawable(new ColorDrawable(ViewHelper.getWindowBackground(this))); - popupWindow.setElevation(getResources().getDimension(R.dimen.spacing_normal)); - popupWindow.setOnDismissListener(() -> new Handler().postDelayed(() -> { - //hacky way to dismiss on re-selecting tab. - if (assignee == null || milestone == null || sort == null || labels == null) return; - assignee.setTag(null); - milestone.setTag(null); - sort.setTag(null); - labels.setTag(null); - }, 100)); - } - popupWindow.setContentView(viewHolder.view); - } - - private void onSearch() { - if (!InputHelper.isEmpty(searchEditText)) { - getFilterFragment().onSearch(getRepoName() + InputHelper.toString(searchEditText), - open.isSelected(), isIssue, isEnterprise()); - searchEditText.setSelection(searchEditText.getEditableText().length()); - } else { - getFilterFragment().onClear(); - showErrorMessage(getString(R.string.empty_search_error)); - } - } - - private FilterIssueFragment getFilterFragment() { - if (filterFragment == null) { - filterFragment = (FilterIssueFragment) getSupportFragmentManager().findFragmentById(R.id.filterFragment); - } - return filterFragment; - } - - private MilestonesAdapter getMilestonesAdapter() { - if (milestonesAdapter == null) { - if (!getPresenter().getMilestones().isEmpty()) { - MilestoneModel milestone = new MilestoneModel(); - milestone.setTitle(getString(R.string.clear)); - getPresenter().getMilestones().add(0, milestone); - } - milestonesAdapter = new MilestonesAdapter(getPresenter().getMilestones()); - milestonesAdapter.setListener(new BaseViewHolder.OnItemClickListener() { - @Override public void onItemClick(int position, View v, MilestoneModel item) { - appendMilestone(item); - } - - @Override public void onItemLongClick(int position, View v, MilestoneModel item) { - - } - }); - } - return milestonesAdapter; - } - - private LabelsAdapter getLabelsAdapter() { - if (labelsAdapter == null) { - if (!getPresenter().getLabels().isEmpty()) { - LabelModel label = new LabelModel(); - label.setName(getString(R.string.clear)); - getPresenter().getLabels().add(0, label); - } - labelsAdapter = new LabelsAdapter(getPresenter().getLabels(), null); - labelsAdapter.setListener(new BaseViewHolder.OnItemClickListener() { - @Override public void onItemClick(int position, View v, LabelModel item) { - appendLabel(item); - } - - @Override public void onItemLongClick(int position, View v, LabelModel item) { - - } - }); - } - return labelsAdapter; - } - - private UsersAdapter getAssigneesAdapter() { - if (assigneesAdapter == null) { - if (!getPresenter().getAssignees().isEmpty()) { - User user = new User(); - user.setLogin(getString(R.string.clear)); - getPresenter().getAssignees().add(0, user); - } - assigneesAdapter = new UsersAdapter(getPresenter().getAssignees(), false, true); - assigneesAdapter.setListener(new BaseViewHolder.OnItemClickListener() { - @Override public void onItemClick(int position, View v, User item) { - appendAssignee(item); - } - - @Override public void onItemLongClick(int position, View v, User item) {} - }); - } - return assigneesAdapter; - } - - private void appendIfEmpty() { - if (InputHelper.isEmpty(searchEditText)) - if (open.isSelected()) { - searchEditText.setText(isIssue ? "is:issue is:open " : "is:pr is:open "); - } else if (close.isSelected()) { - searchEditText.setText(isIssue ? "is:issue is:close " : "is:pr is:close "); - } else { - searchEditText.setText(isIssue ? "is:issue is:open " : "is:pr is:open "); - } - } - - private void appendMilestone(MilestoneModel item) { - if (popupWindow != null) { - popupWindow.dismiss(); - } - appendIfEmpty(); - String text = InputHelper.toString(searchEditText); - String regex = "milestone:(\".+\"|\\S+)"; - if (item.getTitle().equalsIgnoreCase(getString(R.string.clear))) { - text = text.replaceAll(regex, ""); - searchEditText.setText(text); - onSearch(); - return; - } - if (!text.replaceAll(regex, "milestone:\"" + item.getTitle() + "\"").equalsIgnoreCase(text)) { - String space = text.endsWith(" ") ? "" : " "; - text = text.replaceAll(regex, space + "milestone:\"" + item.getTitle() + "\""); - } else { - text += text.endsWith(" ") ? "" : " "; - text += "milestone:\"" + item.getTitle() + "\""; - } - searchEditText.setText(text); - onSearch(); - } - - private void appendLabel(LabelModel item) { - if (popupWindow != null) { - popupWindow.dismiss(); - } - appendIfEmpty(); - String text = InputHelper.toString(searchEditText); - String regex = "label:(\".+\"|\\S+)"; - if (item.getName().equalsIgnoreCase(getString(R.string.clear))) { - text = text.replaceAll(regex, ""); - searchEditText.setText(text); - onSearch(); - return; - } - if (!text.replaceAll(regex, "label:\"" + item.getName() + "\"").equalsIgnoreCase(text)) { - String space = text.endsWith(" ") ? "" : " "; - text = text.replaceAll(regex, space + "label:\"" + item.getName() + "\""); - } else { - text += text.endsWith(" ") ? "" : " "; - text += "label:\"" + item.getName() + "\""; - } - searchEditText.setText(text); - onSearch(); - } - - private void appendAssignee(User item) { - if (popupWindow != null) { - popupWindow.dismiss(); - } - appendIfEmpty(); - String text = InputHelper.toString(searchEditText); - String regex = "assignee:(\".+\"|\\S+)"; - if (item.getLogin().equalsIgnoreCase(getString(R.string.clear))) { - text = text.replaceAll(regex, ""); - searchEditText.setText(text); - onSearch(); - return; - } - if (!text.replaceAll(regex, "assignee:\"" + item.getLogin() + "\"").equalsIgnoreCase(text)) { - String space = text.endsWith(" ") ? "" : " "; - text = text.replaceAll(regex, space + "assignee:\"" + item.getLogin() + "\""); - } else { - text += text.endsWith(" ") ? "" : " "; - text += "assignee:\"" + item.getLogin() + "\""; - } - searchEditText.setText(text); - onSearch(); - } - - private void appendSort(String item) { - dismissPopup(); - appendIfEmpty(); - Resources resources = getResources(); - String regex = "sort:(\".+\"|\\S+)"; - String oldestQuery = "created-asc"; - String mostCommentedQuery = "comments-desc"; - String leastCommentedQuery = "comments-asc"; - String recentlyUpdatedQuery = "updated-desc"; - String leastRecentUpdatedQuery = "updated-asc"; - String sortThumbUp = "reactions-%2B1-desc"; - String sortThumbDown = "reactions--1-desc"; - String sortThumbLaugh = "reactions-smile-desc"; - String sortThumbHooray = "reactions-tada-desc"; - String sortThumbConfused = "reactions-thinking_face-desc"; - String sortThumbHeart = "reactions-heart-desc"; - String toQuery = ""; - String text = InputHelper.toString(searchEditText); - if (item.equalsIgnoreCase(resources.getString(R.string.newest))) { - text = text.replaceAll(regex, ""); - if (!InputHelper.toString(searchEditText).equalsIgnoreCase(text)) { - searchEditText.setText(text); - onSearch(); - } - return; - } - if (item.equalsIgnoreCase(resources.getString(R.string.oldest))) { - toQuery = oldestQuery; - } else if (item.equalsIgnoreCase(resources.getString(R.string.most_commented))) { - toQuery = mostCommentedQuery; - } else if (item.equalsIgnoreCase(resources.getString(R.string.least_commented))) { - toQuery = leastCommentedQuery; - } else if (item.equalsIgnoreCase(resources.getString(R.string.recently_updated))) { - toQuery = recentlyUpdatedQuery; - } else if (item.equalsIgnoreCase(resources.getString(R.string.least_recent_updated))) { - toQuery = leastRecentUpdatedQuery; - } else if (item.equalsIgnoreCase(CommentsHelper.getThumbsUp())) { - toQuery = sortThumbUp; - } else if (item.equalsIgnoreCase(CommentsHelper.getThumbsDown())) { - toQuery = sortThumbDown; - } else if (item.equalsIgnoreCase(CommentsHelper.getLaugh())) { - toQuery = sortThumbLaugh; - } else if (item.equalsIgnoreCase(CommentsHelper.getHooray())) { - toQuery = sortThumbHooray; - } else if (item.equalsIgnoreCase(CommentsHelper.getSad())) { - toQuery = sortThumbConfused; - } else if (item.equalsIgnoreCase(CommentsHelper.getHeart())) { - toQuery = sortThumbHeart; - } - if (!text.replaceAll(regex, "sort:\"" + toQuery + "\"").equalsIgnoreCase(text)) { - String space = text.endsWith(" ") ? "" : " "; - text = text.replaceAll(regex, space + "sort:\"" + toQuery + "\""); - } else { - text += text.endsWith(" ") ? "" : " "; - text += "sort:\"" + toQuery + "\""; - } - if (!InputHelper.toString(searchEditText).equalsIgnoreCase(text)) { - searchEditText.setText(text); - onSearch(); - } - } - - private void dismissPopup() { - if (popupWindow != null) { - popupWindow.dismiss(); - } - } - - static class ViewHolder { - @BindView(R.id.title) FontTextView title; - @BindView(R.id.recycler) DynamicRecyclerView recycler; - View view; - - ViewHolder(View view) { - this.view = view; - ButterKnife.bind(this, view); - title.setVisibility(View.GONE); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/filter/issues/FilterIssuesActivityMvp.java b/app/src/main/java/com/fastaccess/ui/modules/filter/issues/FilterIssuesActivityMvp.java deleted file mode 100644 index 2bce960f2..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/filter/issues/FilterIssuesActivityMvp.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.fastaccess.ui.modules.filter.issues; - -import androidx.annotation.NonNull; - -import com.fastaccess.ui.base.mvp.BaseMvp; - -/** - * Created by Kosh on 09 Apr 2017, 6:19 PM - */ - -public interface FilterIssuesActivityMvp { - - interface View extends BaseMvp.FAView { - void onSetCount(int count, boolean isOpen); - } - - interface Presenter { - void onStart(@NonNull String login, @NonNull String repoId); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/filter/issues/FilterIssuesActivityPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/filter/issues/FilterIssuesActivityPresenter.java deleted file mode 100644 index 26cf8bc30..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/filter/issues/FilterIssuesActivityPresenter.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.fastaccess.ui.modules.filter.issues; - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.data.dao.Pageable; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -import io.reactivex.Observable; -import lombok.Getter; - -/** - * Created by Kosh on 09 Apr 2017, 6:22 PM - */ - -@Getter public class FilterIssuesActivityPresenter extends BasePresenter implements FilterIssuesActivityMvp.Presenter { - - @com.evernote.android.state.State @NonNull ArrayList labels = new ArrayList<>(); - @com.evernote.android.state.State @NonNull ArrayList milestones = new ArrayList<>(); - @com.evernote.android.state.State @NonNull ArrayList assignees = new ArrayList<>(); - - @Override public void onStart(@NonNull String login, @NonNull String repoId) { - Observable> observable = RestProvider.getRepoService(isEnterprise()).getLabels(login, repoId) - .flatMap(labelModelPageable -> { - if (labelModelPageable != null && labelModelPageable.getItems() != null) { - labels.clear(); - labels.addAll(labelModelPageable.getItems()); - } - return RestProvider.getRepoService(isEnterprise()).getAssignees(login, repoId); - }) - .flatMap(userPageable -> { - if (userPageable != null && userPageable.getItems() != null) { - assignees.clear(); - assignees.addAll(userPageable.getItems()); - } - return RestProvider.getRepoService(isEnterprise()).getMilestones(login, repoId); - }); - makeRestCall(observable, response -> { - if (response != null && response.getItems() != null) { - milestones.clear(); - milestones.addAll(response.getItems()); - } - sendToView(BaseMvp.FAView::hideProgress); - }); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/filter/issues/fragment/FilterIssueFragment.java b/app/src/main/java/com/fastaccess/ui/modules/filter/issues/fragment/FilterIssueFragment.java deleted file mode 100644 index 910529aaa..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/filter/issues/fragment/FilterIssueFragment.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.fastaccess.ui.modules.filter.issues.fragment; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.adapter.IssuesAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.filter.issues.FilterIssuesActivityMvp; -import com.fastaccess.ui.modules.repos.extras.popup.IssuePopupFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 09 Apr 2017, 7:13 PM - */ - -public class FilterIssueFragment extends BaseFragment implements FilterIssuesMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private IssuesAdapter adapter; - - @State IssueState issueState = IssueState.open; - @State boolean isIssue; - @State String query; - - private FilterIssuesActivityMvp.View callback; - - @Override public void onAttach(Context context) { - super.onAttach(context); - callback = (FilterIssuesActivityMvp.View) context; - } - - @Override public void onDetach() { - callback = null; - super.onDetach(); - } - - @Override public void onRefresh() { - if (!InputHelper.isEmpty(query)) { - getPresenter().onCallApi(1, query); - } - } - - @Override public void onClick(View v) { - onRefresh(); - } - - @Override public void onClear() { - hideProgress(); - getPresenter().getIssues().clear(); - adapter.notifyDataSetChanged(); - } - - @Override public void onSearch(@NonNull String query, boolean isOpen, boolean isIssue, boolean isEnterprise) { - getPresenter().setEnterprise(isEnterprise); - this.query = query; - this.issueState = isOpen ? IssueState.open : IssueState.closed; - this.isIssue = isIssue; - onClear(); - onRefresh(); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter()); - } - onLoadMore.setParameter(query); - return onLoadMore; - } - - @Override public void onSetCount(int totalCount) { - if (callback != null) { - callback.onSetCount(totalCount, issueState == IssueState.open); - } - } - - @Override public void onItemClicked(@NonNull Issue item) { - SchemeParser.launchUri(getContext(), item.getHtmlUrl()); - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - stateLayout.setEmptyText(R.string.no_search_results); - recycler.setEmptyView(stateLayout, refresh); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - adapter = new IssuesAdapter(getPresenter().getIssues(), true, false, true); - adapter.setListener(getPresenter()); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - recycler.addKeyLineDivider(); - if (savedInstanceState != null) { - if (!InputHelper.isEmpty(query) && getPresenter().getIssues().isEmpty()) { - onRefresh(); - } - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public FilterIssuePresenter providePresenter() { - return new FilterIssuePresenter(); - } - - @Override public void onShowPopupDetails(@NonNull Issue item) { - IssuePopupFragment.showPopup(getChildFragmentManager(), item); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/filter/issues/fragment/FilterIssuePresenter.java b/app/src/main/java/com/fastaccess/ui/modules/filter/issues/fragment/FilterIssuePresenter.java deleted file mode 100644 index 5dbfb632c..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/filter/issues/fragment/FilterIssuePresenter.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.fastaccess.ui.modules.filter.issues.fragment; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 09 Apr 2017, 7:10 PM - */ - -public class FilterIssuePresenter extends BasePresenter implements FilterIssuesMvp.Presenter { - - - private ArrayList issues = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public void onItemClick(int position, View v, Issue item) { - if (getView() != null) { - getView().onItemClicked(item); - } - } - - @Override public void onItemLongClick(int position, View v, Issue item) { - if (getView() != null) getView().onShowPopupDetails(item); - } - - @NonNull @Override public ArrayList getIssues() { - return issues; - } - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public boolean onCallApi(int page, @Nullable String parameter) { - if (page == 1 || parameter == null) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - if (page > lastPage || lastPage == 0 || parameter == null) { - sendToView(FilterIssuesMvp.View::hideProgress); - return false; - } - setCurrentPage(page); - makeRestCall(RestProvider.getSearchService(isEnterprise()).searchIssues(parameter, page), - issues -> { - lastPage = issues.getLast(); - if (getCurrentPage() == 1) { - sendToView(view -> view.onSetCount(issues.getTotalCount())); - } - sendToView(view -> view.onNotifyAdapter(issues.getItems(), page)); - }); - return true; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/filter/issues/fragment/FilterIssuesMvp.java b/app/src/main/java/com/fastaccess/ui/modules/filter/issues/fragment/FilterIssuesMvp.java deleted file mode 100644 index a7bcbd131..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/filter/issues/fragment/FilterIssuesMvp.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.fastaccess.ui.modules.filter.issues.fragment; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 09 Apr 2017, 7:06 PM - */ - -public interface FilterIssuesMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - - void onClear(); - - void onSearch(@NonNull String query, boolean isOpen, boolean isIssue, boolean isEnterprise); - - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - - void onSetCount(int totalCount); - - void onItemClicked(@NonNull Issue item); - - void onShowPopupDetails(@NonNull Issue item); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getIssues(); - - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/GistsFragment.java b/app/src/main/java/com/fastaccess/ui/modules/gists/GistsFragment.java deleted file mode 100644 index c525cd4b2..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/GistsFragment.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.fastaccess.ui.modules.gists; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.GistsAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 12:36 PM - */ - -public class GistsFragment extends BaseFragment implements GistsMvp.View { - - public static final String TAG = GistsFragment.class.getSimpleName(); - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private GistsAdapter adapter; - private OnLoadMore onLoadMore; - - public static GistsFragment newInstance() { - return new GistsFragment(); - } - - @Override protected int fragmentLayout() { - return R.layout.small_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - refresh.setOnRefreshListener(this); - stateLayout.setOnReloadListener(this); - stateLayout.setEmptyText(R.string.no_gists); - recycler.setEmptyView(stateLayout, refresh); - adapter = new GistsAdapter(getPresenter().getGists()); - adapter.setListener(getPresenter()); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.setAdapter(adapter); - recycler.addKeyLineDivider(); - recycler.addOnScrollListener(getLoadMore()); - if (getPresenter().getGists().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, null); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public GistsPresenter providePresenter() { - return new GistsPresenter(); - } - - @SuppressWarnings("unchecked") @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore(getPresenter()); - } - return onLoadMore; - } - - @Override public void onDestroyView() { - recycler.removeOnScrollListener(getLoadMore()); - super.onDestroyView(); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/GistsListActivity.java b/app/src/main/java/com/fastaccess/ui/modules/gists/GistsListActivity.java deleted file mode 100644 index f47664f42..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/GistsListActivity.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.fastaccess.ui.modules.gists; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import com.google.android.material.floatingactionbutton.FloatingActionButton; -import com.google.android.material.tabs.TabLayout; -import androidx.fragment.app.Fragment; -import android.view.MenuItem; - -import com.fastaccess.R; -import com.fastaccess.data.dao.FragmentPagerAdapterModel; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.ui.adapter.FragmentsPagerAdapter; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.gists.create.CreateGistActivity; -import com.fastaccess.ui.modules.main.MainActivity; -import com.fastaccess.ui.widgets.ViewPagerView; - -import net.grandcentrix.thirtyinch.TiPresenter; - -import butterknife.BindView; -import butterknife.OnClick; - -/** - * Created by Kosh on 25 Mar 2017, 11:28 PM - */ - -public class GistsListActivity extends BaseActivity { - - @BindView(R.id.tabs) TabLayout tabs; - @BindView(R.id.gistsContainer) ViewPagerView pager; - @BindView(R.id.fab) FloatingActionButton fab; - - public static void startActivity(@NonNull Context context) { - context.startActivity(new Intent(context, GistsListActivity.class)); - } - - @Override protected int layout() { - return R.layout.gists_activity_layout; - } - - @Override protected boolean isTransparent() { - return true; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @NonNull @Override public TiPresenter providePresenter() { - return new BasePresenter(); - } - - @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setTitle(R.string.gists); - setTaskName(getString(R.string.gists)); - setupTabs(); - fab.show(); - tabs.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(pager) { - @Override public void onTabReselected(TabLayout.Tab tab) { - super.onTabReselected(tab); - onScrollTop(tab.getPosition()); - } - }); - } - - @Override public void onScrollTop(int index) { - if (pager == null || pager.getAdapter() == null) return; - Fragment fragment = (BaseFragment) pager.getAdapter().instantiateItem(pager, index); - if (fragment instanceof BaseFragment) { - ((BaseFragment) fragment).onScrollTop(index); - } - } - - @OnClick(R.id.fab) public void onViewClicked() { - ActivityHelper.startReveal(this, new Intent(this, CreateGistActivity.class), fab, BundleConstant.REQUEST_CODE); - } - - @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (resultCode == RESULT_OK && requestCode == BundleConstant.REQUEST_CODE) { - if (pager != null && pager.getAdapter() != null) { - ((Fragment) pager.getAdapter().instantiateItem(pager, 0)).onActivityResult(resultCode, resultCode, data); - } - } - } - - @Override public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == android.R.id.home) { - startActivity(new Intent(this, MainActivity.class)); - finish(); - return true; - } - return super.onOptionsItemSelected(item); - } - - private void setupTabs() { - pager.setAdapter(new FragmentsPagerAdapter(getSupportFragmentManager(), FragmentPagerAdapterModel.buildForGists(this))); - tabs.setupWithViewPager(pager); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/GistsMvp.java b/app/src/main/java/com/fastaccess/ui/modules/gists/GistsMvp.java deleted file mode 100644 index cef617d00..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/GistsMvp.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.fastaccess.ui.modules.gists; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 11 Nov 2016, 12:35 PM - */ - -interface GistsMvp { - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getGists(); - - void onWorkOffline(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/GistsPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/gists/GistsPresenter.java deleted file mode 100644 index 6c2de2b80..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/GistsPresenter.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.fastaccess.ui.modules.gists; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.gists.gist.GistActivity; - -import java.util.ArrayList; - -/** - * Created by Kosh on 11 Nov 2016, 12:36 PM - */ - -class GistsPresenter extends BasePresenter implements GistsMvp.Presenter { - private ArrayList gistsModels = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - onWorkOffline(); - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable Object parameter) { - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - if (page > lastPage || lastPage == 0) { - sendToView(GistsMvp.View::hideProgress); - return false; - } - setCurrentPage(page); - makeRestCall(RestProvider.getGistService(isEnterprise()).getPublicGists(RestProvider.PAGE_SIZE, page), - listResponse -> { - lastPage = listResponse.getLast(); - sendToView(view -> view.onNotifyAdapter(listResponse.getItems(), page)); - }); - return true; - } - - @NonNull @Override public ArrayList getGists() { - return gistsModels; - } - - @Override public void onWorkOffline() { - if (gistsModels.isEmpty()) { - manageDisposable(RxHelper.getObservable(Gist.getGists().toObservable()) - .subscribe(gists -> sendToView(view -> view.onNotifyAdapter(gists, 1)))); - } else { - sendToView(GistsMvp.View::hideProgress); - } - } - - @Override public void onItemClick(int position, View v, Gist item) { - v.getContext().startActivity(GistActivity.createIntent(v.getContext(), item.getGistId(), isEnterprise())); - } - - @Override public void onItemLongClick(int position, View v, Gist item) {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/create/CreateGistActivity.java b/app/src/main/java/com/fastaccess/ui/modules/gists/create/CreateGistActivity.java deleted file mode 100644 index 08158e691..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/create/CreateGistActivity.java +++ /dev/null @@ -1,179 +0,0 @@ -package com.fastaccess.ui.modules.gists.create; - -import android.app.Activity; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.textfield.TextInputLayout; -import androidx.fragment.app.Fragment; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.FilesListModel; -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.Logger; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.modules.gists.gist.files.GistFilesListFragment; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; - -import java.util.ArrayList; - -import butterknife.BindView; -import butterknife.OnClick; - -/** - * Created by Kosh on 30 Nov 2016, 11:02 AM - */ - -public class CreateGistActivity extends BaseActivity implements CreateGistMvp.View { - - @BindView(R.id.description) TextInputLayout description; - @BindView(R.id.buttonsHolder) View buttonsHolder; - @State String id; - - private GistFilesListFragment filesListFragment; - - - public static void start(@NonNull Activity context, @NonNull Gist gistsModel) { - Intent starter = new Intent(context, CreateGistActivity.class); - putBundle(gistsModel, starter); - context.startActivityForResult(starter, BundleConstant.REQUEST_CODE); - } - - public static void start(@NonNull Fragment context, @NonNull Gist gistsModel) { - Intent starter = new Intent(context.getContext(), CreateGistActivity.class); - putBundle(gistsModel, starter); - context.startActivityForResult(starter, BundleConstant.REQUEST_CODE); - } - - private static void putBundle(@NonNull Gist gistsModel, @NonNull Intent starter) { - String login = gistsModel.getOwner() != null ? gistsModel.getOwner().getLogin() : - gistsModel.getUser() != null ? gistsModel.getUser().getLogin() : ""; - starter.putExtras(Bundler.start() - .putParcelableArrayList(BundleConstant.ITEM, gistsModel.getFilesAsList()) - .put(BundleConstant.EXTRA, Login.getUser().getLogin().equalsIgnoreCase(login)) - .put(BundleConstant.ID, gistsModel.getGistId()) - .put(BundleConstant.EXTRA_TWO, gistsModel.getDescription()) - .end()); - } - - @OnClick(value = {R.id.createPublicGist, R.id.createSecretGist}) void onClick(View view) { - getPresenter().onSubmit(InputHelper.toString(description), - getFilesFragment().getFiles(), view.getId() == R.id.createPublicGist); - } - - @OnClick(R.id.addFile) public void onViewClicked() { - Logger.e(getFilesFragment()); - getFilesFragment().onAddNewFile(); - } - - @Override public void onDescriptionError(boolean isEmptyDesc) { - description.setError(isEmptyDesc ? getString(R.string.required_field) : null); - } - - @Override public void onFileNameError(boolean isEmptyDesc) { -// fileName.setError(isEmptyDesc ? getString(R.string.required_field) : null); - } - - @Override public void onFileContentError(boolean isEmptyDesc) { -// fileContent.setError(isEmptyDesc ? getString(R.string.required_field) : null); - } - - @Override public void onSuccessSubmission(Gist gistsModel) { - hideProgress(); - setResult(RESULT_OK); - finish(); - showMessage(R.string.success, R.string.successfully_submitted); - } - - @Override protected int layout() { - return R.layout.create_gist_layout; - } - - @Override protected boolean isTransparent() { - return false; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @NonNull @Override public CreateGistPresenter providePresenter() { - return new CreateGistPresenter(); - } - - @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - getPresenter().setEnterprise(PrefGetter.isEnterprise()); - setTaskName(getString(R.string.create_gist)); - if (savedInstanceState == null) { - if (getIntent() != null && getIntent().getExtras() != null) { - Bundle bundle = getIntent().getExtras(); - ArrayList models = bundle.getParcelableArrayList(BundleConstant.ITEM); - boolean isOwner = bundle.getBoolean(BundleConstant.EXTRA); - id = bundle.getString(BundleConstant.ID); - String descriptionText = bundle.getString(BundleConstant.EXTRA_TWO); - if (description.getEditText() != null) description.getEditText().setText(descriptionText); - getFilesFragment().onInitFiles(models, isOwner); - } else { - getFilesFragment().onInitFiles(new ArrayList<>(), true); - } - } - buttonsHolder.setVisibility(!InputHelper.isEmpty(id) ? View.GONE : View.VISIBLE); - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (isOk && bundle != null) { - finish(); - } - } - - @Override public void onBackPressed() { - if (InputHelper.isEmpty(description)) { - super.onBackPressed(); - } else { - ViewHelper.hideKeyboard(description); - MessageDialogView.newInstance(getString(R.string.close), getString(R.string.unsaved_data_warning), - Bundler.start().put("primary_extra", getString(R.string.discard)).put("secondary_extra", getString(R.string.cancel)) - .put(BundleConstant.EXTRA, true).end()).show(getSupportFragmentManager(), MessageDialogView.TAG); - } - } - - @Override public boolean onCreateOptionsMenu(Menu menu) { - if (!InputHelper.isEmpty(id)) { - getMenuInflater().inflate(R.menu.done_menu, menu); - } - return super.onCreateOptionsMenu(menu); - } - - @Override public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == R.id.submit) { - getPresenter().onSubmitUpdate(id, InputHelper.toString(description), getFilesFragment().getFiles()); - return true; - } - return super.onOptionsItemSelected(item); - } - - private GistFilesListFragment getFilesFragment() { - if (filesListFragment == null) { - filesListFragment = (GistFilesListFragment) getSupportFragmentManager().findFragmentById(R.id.files); - } - return filesListFragment; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/create/CreateGistMvp.java b/app/src/main/java/com/fastaccess/ui/modules/gists/create/CreateGistMvp.java deleted file mode 100644 index 8c6ab98a7..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/create/CreateGistMvp.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.fastaccess.ui.modules.gists.create; - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.CreateGistModel; -import com.fastaccess.data.dao.FilesListModel; -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.ui.base.mvp.BaseMvp; - -import java.util.HashMap; - -/** - * Created by Kosh on 30 Nov 2016, 10:43 AM - */ - -interface CreateGistMvp { - - interface View extends BaseMvp.FAView { - void onDescriptionError(boolean isEmptyDesc); - - void onFileNameError(boolean isEmptyDesc); - - void onFileContentError(boolean isEmptyDesc); - - void onSuccessSubmission(Gist gistsModel); - } - - interface Presenter extends BaseMvp.FAPresenter { - - void onSubmit(@NonNull String description, @NonNull HashMap files, boolean isPublic); - - void onSubmit(@NonNull CreateGistModel model); - - void onSubmitUpdate(@NonNull String id, @NonNull String description, @NonNull HashMap files); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/create/CreateGistPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/gists/create/CreateGistPresenter.java deleted file mode 100644 index 39f45cdab..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/create/CreateGistPresenter.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.fastaccess.ui.modules.gists.create; - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.CreateGistModel; -import com.fastaccess.data.dao.FilesListModel; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.HashMap; - -/** - * Created by Kosh on 30 Nov 2016, 10:51 AM - */ - -class CreateGistPresenter extends BasePresenter implements CreateGistMvp.Presenter { - @Override public void onSubmit(@NonNull String description, @NonNull HashMap files, boolean isPublic) { - if (files.isEmpty()) return; - CreateGistModel createGistModel = new CreateGistModel(); - createGistModel.setDescription(InputHelper.toString(description)); - createGistModel.setPublicGist(isPublic); - createGistModel.setFiles(files); - onSubmit(createGistModel); - } - - @Override public void onSubmit(@NonNull CreateGistModel model) { - makeRestCall(RestProvider.getGistService(isEnterprise()).createGist(model), - gistsModel -> sendToView(view -> view.onSuccessSubmission(gistsModel)), false); - } - - @Override public void onSubmitUpdate(@NonNull String id, @NonNull String description, @NonNull HashMap files) { - boolean isEmptyDesc = InputHelper.isEmpty(description); - if (getView() != null) { - getView().onDescriptionError(isEmptyDesc); - } - if (isEmptyDesc) return; - CreateGistModel createGistModel = new CreateGistModel(); - createGistModel.setDescription(InputHelper.toString(description)); - createGistModel.setFiles(files); - makeRestCall(RestProvider.getGistService(isEnterprise()).editGist(createGistModel, id), - gistsModel -> sendToView(view -> view.onSuccessSubmission(gistsModel)), false); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/create/dialog/AddGistBottomSheetDialog.kt b/app/src/main/java/com/fastaccess/ui/modules/gists/create/dialog/AddGistBottomSheetDialog.kt deleted file mode 100644 index 3dc848830..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/create/dialog/AddGistBottomSheetDialog.kt +++ /dev/null @@ -1,130 +0,0 @@ -package com.fastaccess.ui.modules.gists.create.dialog - -import android.annotation.SuppressLint -import android.content.Context -import android.os.Bundle -import android.os.Parcelable -import com.google.android.material.textfield.TextInputLayout -import androidx.fragment.app.FragmentManager -import androidx.appcompat.widget.Toolbar -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.view.WindowManager -import android.webkit.MimeTypeMap -import android.widget.EditText -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.data.dao.FilesListModel -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.helper.InputHelper -import com.fastaccess.helper.ViewHelper -import com.fastaccess.provider.emoji.Emoji -import com.fastaccess.ui.base.BaseDialogFragment -import com.fastaccess.ui.modules.gists.create.dialog.AddGistMvp.AddGistFileListener -import com.fastaccess.ui.widgets.markdown.MarkDownLayout -import com.fastaccess.ui.widgets.markdown.MarkdownEditText - -/** - * Created by kosh on 14/08/2017. - */ -class AddGistBottomSheetDialog : BaseDialogFragment(), AddGistMvp.View { - - @BindView(R.id.editText) lateinit var editText: MarkdownEditText - @BindView(R.id.description) lateinit var description: TextInputLayout - @BindView(R.id.toolbar) lateinit var toolbar: Toolbar - @BindView(R.id.markDownLayout) lateinit var markDownLayout: MarkDownLayout - - private var addFileListener: AddGistFileListener? = null - - override fun onAttach(context: Context) { - super.onAttach(context) - addFileListener = when { - parentFragment is AddGistFileListener -> parentFragment as AddGistFileListener - context is AddGistFileListener -> context - else -> throw NullPointerException("${context::class.java.simpleName} most implement AddGistFileListener") - } - } - - override fun onDetach() { - addFileListener = null - super.onDetach() - } - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN) - return super.onCreateView(inflater, container, savedInstanceState) - } - - override fun providePresenter(): AddGistPresenter = AddGistPresenter() - - override fun onAppendLink(title: String?, link: String?, isLink: Boolean) { - markDownLayout.onAppendLink(title, link, isLink) - } - - override fun fragmentLayout(): Int = R.layout.add_gist_file_layout - - override fun getEditText(): EditText = editText - - override fun fragmentManager(): FragmentManager = childFragmentManager - - override fun getSavedText(): CharSequence? = editText.savedText - - override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { - markDownLayout.markdownListener = this - var file = arguments?.getParcelable(BundleConstant.ITEM) - val position = arguments?.getInt(BundleConstant.ID) - if (position != null) { - toolbar.title = if (position > 0) getString(R.string.edit_gist) else getString(R.string.create_gist) - } else { - toolbar.title = getString(R.string.create_gist) - } - editText.setOnFocusChangeListener { _, focused -> markDownLayout.visibility = if (focused) View.VISIBLE else View.GONE } - toolbar.inflateMenu(R.menu.done_menu) - toolbar.menu.findItem(R.id.submit)?.setIcon(R.drawable.ic_done) - toolbar.setNavigationIcon(R.drawable.ic_clear) - toolbar.setNavigationOnClickListener { dismiss() } - toolbar.setOnMenuItemClickListener { - if (it.itemId == R.id.submit) { - if (file == null) { - file = FilesListModel() - } - file?.let { - it.content = getSavedText().toString() - it.filename = InputHelper.toString(description) - it.type = MimeTypeMap.getFileExtensionFromUrl(file!!.filename) - it.size = it.content?.length?.toLong() - ViewHelper.hideKeyboard(editText) - addFileListener?.onFileAdded(it, position) - } - } - dismiss() - return@setOnMenuItemClickListener true - } - file?.let { - description.editText?.setText(it.filename) - editText.setText(it.content) - } - } - - @SuppressLint("SetTextI18n") - override fun onEmojiAdded(emoji: Emoji?) { - markDownLayout.onEmojiAdded(emoji) - } - - companion object { - val TAG = AddGistBottomSheetDialog::class.java.simpleName!! - - fun newInstance(file: FilesListModel?, position: Int = -1): AddGistBottomSheetDialog { - val fragment = AddGistBottomSheetDialog() - file?.let { - fragment.arguments = Bundler.start() - .put(BundleConstant.ITEM, file as Parcelable) - .put(BundleConstant.ID, position) - .end() - } - return fragment - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/create/dialog/AddGistMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/gists/create/dialog/AddGistMvp.kt deleted file mode 100644 index 228f91982..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/create/dialog/AddGistMvp.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.fastaccess.ui.modules.gists.create.dialog - -import com.fastaccess.data.dao.FilesListModel -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.modules.editor.emoji.EmojiMvp -import com.fastaccess.ui.modules.editor.popup.EditorLinkImageMvp -import com.fastaccess.ui.widgets.markdown.MarkDownLayout - -/** - * Created by kosh on 14/08/2017. - */ -interface AddGistMvp { - - interface View : BaseMvp.FAView, EditorLinkImageMvp.EditorLinkCallback, MarkDownLayout.MarkdownListener, EmojiMvp.EmojiCallback - interface Presenter - interface AddGistFileListener { - fun onFileAdded(file: FilesListModel, position: Int? = -1) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/create/dialog/AddGistPresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/gists/create/dialog/AddGistPresenter.kt deleted file mode 100644 index 7329e6e1f..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/create/dialog/AddGistPresenter.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.fastaccess.ui.modules.gists.create.dialog - -import com.fastaccess.ui.base.mvp.presenter.BasePresenter - -/** - * Created by kosh on 14/08/2017. - */ -class AddGistPresenter : BasePresenter(), AddGistMvp.Presenter \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/gist/GistActivity.java b/app/src/main/java/com/fastaccess/ui/modules/gists/gist/GistActivity.java deleted file mode 100644 index e7e41452f..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/gist/GistActivity.java +++ /dev/null @@ -1,331 +0,0 @@ -package com.fastaccess.ui.modules.gists.gist; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.floatingactionbutton.FloatingActionButton; -import com.google.android.material.tabs.TabLayout; -import androidx.fragment.app.Fragment; -import androidx.core.content.ContextCompat; -import androidx.viewpager.widget.ViewPager; -import android.text.format.Formatter; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.FragmentPagerAdapterModel; -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.PinnedGists; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.provider.tasks.git.GithubActionService; -import com.fastaccess.ui.adapter.FragmentsPagerAdapter; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment; -import com.fastaccess.ui.modules.gists.GistsListActivity; -import com.fastaccess.ui.modules.gists.create.CreateGistActivity; -import com.fastaccess.ui.modules.gists.gist.comments.GistCommentsFragment; -import com.fastaccess.ui.modules.main.premium.PremiumActivity; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.ForegroundImageView; -import com.fastaccess.ui.widgets.ViewPagerView; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; - -import java.util.ArrayList; - -import butterknife.BindView; -import butterknife.OnClick; - -/** - * Created by Kosh on 12 Nov 2016, 12:18 PM - */ - -public class GistActivity extends BaseActivity - implements GistMvp.View { - - @BindView(R.id.avatarLayout) AvatarLayout avatarLayout; - @BindView(R.id.headerTitle) FontTextView title; - @BindView(R.id.size) FontTextView size; - @BindView(R.id.date) FontTextView date; - @BindView(R.id.pager) ViewPagerView pager; - @BindView(R.id.tabs) TabLayout tabs; - @BindView(R.id.fab) FloatingActionButton fab; - @BindView(R.id.startGist) ForegroundImageView startGist; - @BindView(R.id.forkGist) ForegroundImageView forkGist; - @BindView(R.id.detailsIcon) View detailsIcon; - @BindView(R.id.edit) View edit; - @BindView(R.id.pinUnpin) ForegroundImageView pinUnpin; - private int accentColor; - private int iconColor; - private CommentEditorFragment commentEditorFragment; - - public static Intent createIntent(@NonNull Context context, @NonNull String gistId, boolean isEnterprise) { - Intent intent = new Intent(context, GistActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA, gistId) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .end()); - return intent; - } - - @OnClick(R.id.detailsIcon) void onTitleClick() { - if (getPresenter().getGist() != null && !InputHelper.isEmpty(getPresenter().getGist().getDescription())) - MessageDialogView.newInstance(getString(R.string.details), getPresenter().getGist().getDescription(), false, true) - .show(getSupportFragmentManager(), MessageDialogView.TAG); - } - - @OnClick({R.id.startGist, R.id.forkGist, R.id.browser}) public void onGistActions(View view) { - if (getPresenter().getGist() == null) return; - if (view.getId() != R.id.browser) { - view.setEnabled(false); - } - switch (view.getId()) { - case R.id.startGist: - GithubActionService.startForGist(this, getPresenter().getGist().getGistId(), - getPresenter().isStarred() ? GithubActionService.UNSTAR_GIST : GithubActionService.STAR_GIST, isEnterprise()); - getPresenter().onStarGist(); - break; - case R.id.forkGist: - GithubActionService.startForGist(this, getPresenter().getGist().getGistId(), - GithubActionService.FORK_GIST, isEnterprise()); - getPresenter().onForkGist(); - break; - case R.id.browser: - ActivityHelper.startCustomTab(this, getPresenter().getGist().getHtmlUrl()); - break; - } - } - - @OnClick(R.id.edit) void onEdit() { - if (PrefGetter.isProEnabled() || PrefGetter.isAllFeaturesUnlocked()) { - if (getPresenter().getGist() != null) CreateGistActivity.start(this, getPresenter().getGist()); - } else { - PremiumActivity.Companion.startActivity(this); - } - } - - @OnClick(R.id.pinUnpin) void pinUpin() { - if (PrefGetter.isProEnabled()) { - getPresenter().onPinUnpinGist(); - } else { - PremiumActivity.Companion.startActivity(this); - } - } - - @Override protected int layout() { - return R.layout.gists_pager_layout; - } - - @Override protected boolean isTransparent() { - return true; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @NonNull @Override public GistPresenter providePresenter() { - return new GistPresenter(); - } - - @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - fab.hide(); - commentEditorFragment = (CommentEditorFragment) getSupportFragmentManager().findFragmentById(R.id.commentFragment); - accentColor = ViewHelper.getAccentColor(this); - iconColor = ViewHelper.getIconColor(this); - if (savedInstanceState == null) { - getPresenter().onActivityCreated(getIntent()); - } else { - if (getPresenter().getGist() != null) { - onSetupDetails(); - } - } - } - - @Override public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.gist_menu, menu); - return super.onCreateOptionsMenu(menu); - } - - @Override public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == R.id.share) { - if (getPresenter().getGist() != null) ActivityHelper.shareUrl(this, getPresenter().getGist().getHtmlUrl()); - return true; - } else if (item.getItemId() == R.id.deleteGist) { - MessageDialogView.newInstance( - getString(R.string.delete_gist), getString(R.string.confirm_message), - Bundler.start() - .put(BundleConstant.YES_NO_EXTRA, true) - .put(BundleConstant.EXTRA, true).end()) - .show(getSupportFragmentManager(), MessageDialogView.TAG); - return true; - } else if (item.getItemId() == android.R.id.home) { - GistsListActivity.startActivity(this); - finish(); - return true; - } - return super.onOptionsItemSelected(item); - } - - @Override public boolean onPrepareOptionsMenu(Menu menu) { - menu.findItem(R.id.deleteGist).setVisible(getPresenter().isOwner()); - return super.onPrepareOptionsMenu(menu); - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (bundle != null) { - boolean isDelete = bundle.getBoolean(BundleConstant.EXTRA) && isOk; - if (isDelete) { - getPresenter().onDeleteGist(); - } - } - } - - @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (resultCode == RESULT_OK) { - if (requestCode == BundleConstant.REQUEST_CODE) { - getPresenter().callApi(); - } - } - } - - @Override public void onSuccessDeleted() { - hideProgress(); - if (getPresenter().getGist() != null) { - Intent intent = new Intent(); - Gist gistsModel = new Gist(); - gistsModel.setUrl(getPresenter().getGist().getHtmlUrl()); - intent.putExtras(Bundler.start().put(BundleConstant.ITEM, gistsModel).end()); - setResult(RESULT_OK, intent); - } - finish(); - } - - @Override public void onErrorDeleting() { - showErrorMessage(getString(R.string.error_deleting_gist)); - } - - @Override public void onGistStarred(boolean isStarred) { - startGist.setImageResource(isStarred ? R.drawable.ic_star_filled : R.drawable.ic_star); - startGist.tintDrawableColor(isStarred ? accentColor : iconColor); - startGist.setEnabled(true); - } - - @Override public void onGistForked(boolean isForked) { - forkGist.tintDrawableColor(isForked ? accentColor : iconColor); - forkGist.setEnabled(true); - } - - @Override public void onSetupDetails() { - hideProgress(); - Gist gistsModel = getPresenter().getGist(); - if (gistsModel == null) { - return; - } - onUpdatePinIcon(gistsModel); - String url = gistsModel.getOwner() != null ? gistsModel.getOwner().getAvatarUrl() : - gistsModel.getUser() != null ? gistsModel.getUser().getAvatarUrl() : ""; - String login = gistsModel.getOwner() != null ? gistsModel.getOwner().getLogin() : - gistsModel.getUser() != null ? gistsModel.getUser().getLogin() : ""; - avatarLayout.setUrl(url, login, false, LinkParserHelper.isEnterprise(gistsModel.getHtmlUrl())); - title.setText(gistsModel.getDisplayTitle(false, true)); - setTaskName(gistsModel.getDisplayTitle(false, true).toString()); - edit.setVisibility(Login.getUser().getLogin().equals(login) ? View.VISIBLE : View.GONE); - detailsIcon.setVisibility(InputHelper.isEmpty(gistsModel.getDescription()) || !ViewHelper.isEllipsed(title) ? View.GONE : View.VISIBLE); - if (gistsModel.getCreatedAt().before(gistsModel.getUpdatedAt())) { - date.setText(String.format("%s %s", ParseDateFormat.getTimeAgo(gistsModel.getCreatedAt()), getString(R.string.edited))); - } else { - date.setText(ParseDateFormat.getTimeAgo(gistsModel.getCreatedAt())); - } - size.setText(Formatter.formatFileSize(this, gistsModel.getSize())); - pager.setAdapter(new FragmentsPagerAdapter(getSupportFragmentManager(), FragmentPagerAdapterModel.buildForGist(this, gistsModel))); - tabs.setupWithViewPager(pager); - pager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { - @Override public void onPageSelected(int position) { - super.onPageSelected(position); - hideShowFab(); - } - }); - supportInvalidateOptionsMenu(); - onGistForked(getPresenter().isForked()); - onGistStarred(getPresenter().isStarred()); - hideShowFab(); - tabs.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(pager) { - @Override public void onTabReselected(TabLayout.Tab tab) { - super.onTabReselected(tab); - onScrollTop(tab.getPosition()); - } - }); - } - - @Override public void onUpdatePinIcon(@NonNull Gist gist) { - pinUnpin.setImageDrawable(PinnedGists.isPinned(gist.getGistId().hashCode()) - ? ContextCompat.getDrawable(this, R.drawable.ic_pin_filled) - : ContextCompat.getDrawable(this, R.drawable.ic_pin)); - } - - @Override public void onScrollTop(int index) { - if (pager == null || pager.getAdapter() == null) return; - Fragment fragment = (BaseFragment) pager.getAdapter().instantiateItem(pager, index); - if (fragment instanceof BaseFragment) { - ((BaseFragment) fragment).onScrollTop(index); - } - } - - @Override public void onSendActionClicked(@NonNull String text, Bundle bundle) { - GistCommentsFragment view = getGistCommentsFragment(); - if (view != null) { - view.onHandleComment(text, bundle); - } - } - - @Override public void onTagUser(@NonNull String username) { - commentEditorFragment.onAddUserName(username); - } - - @Override public void onCreateComment(String text, Bundle bundle) { - - } - - @SuppressWarnings("ConstantConditions") @Override public void onClearEditText() { - if (commentEditorFragment != null && commentEditorFragment.commentText != null) commentEditorFragment.commentText.setText(""); - } - - @NonNull @Override public ArrayList getNamesToTag() { - GistCommentsFragment view = getGistCommentsFragment(); - if (view != null) return view.getNamesToTag(); - return new ArrayList<>(); - } - - @Nullable private GistCommentsFragment getGistCommentsFragment() { - if (pager == null || pager.getAdapter() == null) return null; - return (GistCommentsFragment) pager.getAdapter().instantiateItem(pager, 1); - } - - private void hideShowFab() { - if (pager.getCurrentItem() == 1) { - getSupportFragmentManager().beginTransaction().show(commentEditorFragment).commit(); - } else { - getSupportFragmentManager().beginTransaction().hide(commentEditorFragment).commit(); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/gist/GistMvp.java b/app/src/main/java/com/fastaccess/ui/modules/gists/gist/GistMvp.java deleted file mode 100644 index 10367ab7f..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/gist/GistMvp.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.fastaccess.ui.modules.gists.gist; - -import android.content.Intent; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment; - -/** - * Created by Kosh on 12 Nov 2016, 12:17 PM - */ - -interface GistMvp { - - interface View extends BaseMvp.FAView, CommentEditorFragment.CommentListener { - void onSuccessDeleted(); - - void onErrorDeleting(); - - void onGistStarred(boolean isStarred); - - void onGistForked(boolean isForked); - - void onSetupDetails(); - - void onUpdatePinIcon(Gist gist); - } - - interface Presenter extends BaseMvp.FAPresenter { - - @Nullable Gist getGist(); - - @NonNull String gistId(); - - void onActivityCreated(@Nullable Intent intent); - - void onDeleteGist(); - - boolean isOwner(); - - void onStarGist(); - - void onForkGist(); - - boolean isForked(); - - boolean isStarred(); - - void checkStarring(@NonNull String gistId); - - void callApi(); - - void onWorkOffline(@NonNull String gistId); - - void onPinUnpinGist(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/gist/GistPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/gists/gist/GistPresenter.java deleted file mode 100644 index 41e465ba1..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/gist/GistPresenter.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.fastaccess.ui.modules.gists.gist; - -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.PinnedGists; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -/** - * Created by Kosh on 12 Nov 2016, 12:17 PM - */ - -class GistPresenter extends BasePresenter implements GistMvp.Presenter { - @com.evernote.android.state.State boolean isGistStarred; - @com.evernote.android.state.State boolean isGistForked; - @com.evernote.android.state.State Gist gist; - @com.evernote.android.state.State String gistId; - - @Nullable @Override public Gist getGist() { - return gist; - } - - @NonNull @Override public String gistId() { - return gistId; - } - - @SuppressWarnings("unchecked") @Override public void onActivityCreated(@Nullable Intent intent) { - if (intent == null || intent.getExtras() == null) { - return; - } - Bundle bundle = intent.getExtras(); - gistId = bundle.getString(BundleConstant.EXTRA); - if (gist != null) { - checkStarring(gist.getGistId()); - sendToView(GistMvp.View::onSetupDetails); - } else if (gistId != null) { - callApi(); - } else { - sendToView(GistMvp.View::onSetupDetails); - } - } - - @Override public void onDeleteGist() { - if (getGist() == null) return; - manageDisposable(RxHelper.getObservable(RestProvider.getGistService(isEnterprise()).deleteGist(getGist().getGistId())) - .doOnSubscribe(disposable -> onSubscribed(false)) - .doOnNext(booleanResponse -> { - if (booleanResponse.code() == 204) { - sendToView(GistMvp.View::onSuccessDeleted); - } else { - sendToView(GistMvp.View::onErrorDeleting); - } - }) - .subscribe(booleanResponse -> {/**/}, throwable -> sendToView(view -> view.showErrorMessage(throwable.getMessage())))); - } - - @Override public boolean isOwner() { - return getGist() != null && getGist().getOwner() != null && - getGist().getOwner().getLogin().equals(Login.getUser().getLogin()); - } - - @Override public void onStarGist() { - isGistStarred = !isGistStarred; - sendToView(view -> view.onGistStarred(isGistStarred)); - } - - @Override public void onForkGist() { - isGistForked = !isGistForked; - sendToView(view -> view.onGistForked(isGistForked)); - } - - @Override public boolean isForked() { - return isGistForked; - } - - @Override public boolean isStarred() { - return isGistStarred; - } - - @Override public void checkStarring(@NonNull String gistId) { - makeRestCall(RestProvider.getGistService(isEnterprise()).checkGistStar(gistId), - booleanResponse -> { - isGistStarred = booleanResponse.code() == 204; - sendToView(view -> view.onGistStarred(isGistStarred)); - }); - } - - @Override public void onWorkOffline(@NonNull String gistId) { - if (gist == null) { - manageDisposable(RxHelper.getObservable(Gist.getGist(gistId)) - .subscribe(gistsModel -> { - this.gist = gistsModel; - sendToView(GistMvp.View::onSetupDetails); - })); - } - } - - @Override public void onPinUnpinGist() { - if (getGist() == null) return; - PinnedGists.pinUpin(getGist()); - sendToView(view -> view.onUpdatePinIcon(getGist())); - } - - @Override public void callApi() { - if (!InputHelper.isEmpty(gistId)) { - checkStarring(gistId); - makeRestCall(RestProvider.getGistService(isEnterprise()).getGist(gistId), gistsModel -> { - this.gist = gistsModel; - sendToView(GistMvp.View::onSetupDetails); - }); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/gist/comments/GistCommentsFragment.java b/app/src/main/java/com/fastaccess/ui/modules/gists/gist/comments/GistCommentsFragment.java deleted file mode 100644 index 9e5644fb5..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/gist/comments/GistCommentsFragment.java +++ /dev/null @@ -1,271 +0,0 @@ -package com.fastaccess.ui.modules.gists.gist.comments; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.SparseBooleanArrayParcelable; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.provider.timeline.CommentsHelper; -import com.fastaccess.ui.adapter.CommentsAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.editor.EditorActivity; -import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.ArrayList; -import java.util.List; - -import butterknife.BindView; - -import static com.fastaccess.helper.BundleConstant.ExtraType.EDIT_GIST_COMMENT_EXTRA; - -/** - * Created by Kosh on 11 Nov 2016, 12:36 PM - */ - -public class GistCommentsFragment extends BaseFragment implements GistCommentsMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - @State SparseBooleanArrayParcelable sparseBooleanArray; - private CommentEditorFragment.CommentListener commentsCallback; - private String gistId; - private CommentsAdapter adapter; - private OnLoadMore onLoadMore; - - public static GistCommentsFragment newInstance(@NonNull String gistId) { - GistCommentsFragment view = new GistCommentsFragment(); - view.setArguments(Bundler.start().put("gistId", gistId).end()); - return view; - } - - @SuppressWarnings("unchecked") @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() instanceof CommentEditorFragment.CommentListener) { - commentsCallback = (CommentEditorFragment.CommentListener) getParentFragment(); - } else if (context instanceof CommentEditorFragment.CommentListener) { - commentsCallback = (CommentEditorFragment.CommentListener) context; - } else { - throw new IllegalArgumentException(String.format("%s or parent fragment must implement CommentEditorFragment.CommentListener", - context.getClass().getSimpleName())); - } - } - - @Override public void onDetach() { - commentsCallback = null; - super.onDetach(); - } - - @Override protected int fragmentLayout() { - return R.layout.fab_micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - gistId = getArguments().getString("gistId"); - recycler.setEmptyView(stateLayout, refresh); - if (gistId == null) return; - stateLayout.setEmptyText(R.string.no_comments); - recycler.setItemViewCacheSize(30); - refresh.setOnRefreshListener(this); - stateLayout.setOnReloadListener(this); - adapter = new CommentsAdapter(getPresenter().getComments()); - adapter.setListener(getPresenter()); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.setAdapter(adapter); - recycler.addKeyLineDivider(); - recycler.addOnScrollListener(getLoadMore()); - recycler.addNormalSpacingDivider(); - if (getPresenter().getComments().isEmpty() && !getPresenter().isApiCalled()) { - sparseBooleanArray = new SparseBooleanArrayParcelable(); - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, gistId); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override public void onRemove(@NonNull Comment comment) { - hideProgress(); - adapter.removeItem(comment); - } - - @Override public void hideProgress() { - super.hideProgress(); - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - - stateLayout.showProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public GistCommentsPresenter providePresenter() { - return new GistCommentsPresenter(); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter(), gistId); - } - return onLoadMore; - } - - @Override public void onEditComment(@NonNull Comment item) { - Intent intent = new Intent(getContext(), EditorActivity.class); - intent.putExtras(Bundler - .start() - .put(BundleConstant.ID, gistId) - .put(BundleConstant.EXTRA, item.getBody()) - .put(BundleConstant.EXTRA_FOUR, item.getId()) - .put(BundleConstant.EXTRA_TYPE, EDIT_GIST_COMMENT_EXTRA) - .putStringArrayList("participants", CommentsHelper.getUsers(adapter.getData())) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise()) - .end()); - View view = getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler; - ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE); - } - - @Override public void onShowDeleteMsg(long id) { - MessageDialogView.newInstance(getString(R.string.delete), getString(R.string.confirm_message), - Bundler.start() - .put(BundleConstant.EXTRA, id) - .put(BundleConstant.ID, gistId) - .put(BundleConstant.YES_NO_EXTRA, true) - .putStringArrayList("participants", CommentsHelper.getUsers(adapter.getData())) - .end()) - .show(getChildFragmentManager(), MessageDialogView.TAG); - } - - @Override public void onTagUser(@Nullable User user) { - if (commentsCallback != null && user != null) { - commentsCallback.onTagUser(user.getLogin()); - } - } - - @Override public void onReply(User user, String message) { - onTagUser(user); - } - - @Override public void onHandleComment(@NonNull String text, @Nullable Bundle bundle) { - getPresenter().onHandleComment(text, bundle, gistId); - } - - @Override public void onAddNewComment(@NonNull Comment comment) { - hideBlockingProgress(); - adapter.addItem(comment); - if (commentsCallback != null) commentsCallback.onClearEditText(); - } - - @NonNull @Override public ArrayList getNamesToTag() { - return CommentsHelper.getUsers(adapter.getData()); - } - - @Override public void hideBlockingProgress() { - hideProgress(); - super.hideProgress(); - } - - @Override public void onDestroyView() { - recycler.removeOnScrollListener(getLoadMore()); - super.onDestroyView(); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (resultCode == Activity.RESULT_OK) { - if (requestCode == BundleConstant.REQUEST_CODE) { - if (data == null) { - onRefresh(); - return; - } - Bundle bundle = data.getExtras(); - if (bundle != null) { - boolean isNew = bundle.getBoolean(BundleConstant.EXTRA); - Comment commentsModel = bundle.getParcelable(BundleConstant.ITEM); - if (commentsModel == null) return; - if (isNew) { - adapter.addItem(commentsModel); - recycler.smoothScrollToPosition(adapter.getItemCount()); - } else { - int position = adapter.getItem(commentsModel); - if (position != -1) { - adapter.swapItem(commentsModel, position); - recycler.smoothScrollToPosition(position); - } else { - adapter.addItem(commentsModel); - recycler.smoothScrollToPosition(adapter.getItemCount()); - } - } - } - } - } - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (isOk) { - getPresenter().onHandleDeletion(bundle); - } - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/gist/comments/GistCommentsMvp.java b/app/src/main/java/com/fastaccess/ui/modules/gists/gist/comments/GistCommentsMvp.java deleted file mode 100644 index 556bab7a6..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/gist/comments/GistCommentsMvp.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.fastaccess.ui.modules.gists.gist.comments; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 20 Nov 2016, 11:10 AM - */ - -interface GistCommentsMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, - android.view.View.OnClickListener { - - void onNotifyAdapter(@Nullable List items, int page); - - void onRemove(@NonNull Comment comment); - - @NonNull OnLoadMore getLoadMore(); - - void onEditComment(@NonNull Comment item); - - void onShowDeleteMsg(long id); - - void onTagUser(@NonNull User user); - - void onReply(User user, String message); - - void onHandleComment(@NonNull String text, @Nullable Bundle bundle); - - void onAddNewComment(@NonNull Comment comment); - - @NonNull ArrayList getNamesToTag(); - - void hideBlockingProgress(); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseMvp.PaginationListener, BaseViewHolder.OnItemClickListener { - - @NonNull ArrayList getComments(); - - - void onHandleDeletion(@Nullable Bundle bundle); - - void onWorkOffline(@NonNull String gistId); - - void onHandleComment(@NonNull String text, @Nullable Bundle bundle, String gistId); - } - - -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/gist/comments/GistCommentsPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/gists/gist/comments/GistCommentsPresenter.java deleted file mode 100644 index 40a45459f..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/gist/comments/GistCommentsPresenter.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.fastaccess.ui.modules.gists.gist.comments; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.text.TextUtils; -import android.view.View; -import android.widget.PopupMenu; - -import com.fastaccess.R; -import com.fastaccess.data.dao.CommentRequestModel; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 11 Nov 2016, 12:36 PM - */ - -class GistCommentsPresenter extends BasePresenter implements GistCommentsMvp.Presenter { - private ArrayList comments = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - //noinspection ConstantConditions - sendToView(view -> onWorkOffline(view.getLoadMore().getParameter())); - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable String parameter) { - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - if (page > lastPage || parameter == null || lastPage == 0) { - sendToView(GistCommentsMvp.View::hideProgress); - return false; - } - setCurrentPage(page); - makeRestCall(RestProvider.getGistService(isEnterprise()).getGistComments(parameter, page), - listResponse -> { - lastPage = listResponse.getLast(); - if (getCurrentPage() == 1) { - manageDisposable(Comment.saveForGist(listResponse.getItems(), parameter)); - } - sendToView(view -> view.onNotifyAdapter(listResponse.getItems(), page)); - }); - return true; - } - - @NonNull @Override public ArrayList getComments() { - return comments; - } - - @Override public void onHandleDeletion(@Nullable Bundle bundle) { - if (bundle != null) { - long commId = bundle.getLong(BundleConstant.EXTRA, 0); - String gistId = bundle.getString(BundleConstant.ID); - if (commId != 0 && gistId != null) { - makeRestCall(RestProvider.getGistService(isEnterprise()).deleteGistComment(gistId, commId), - booleanResponse -> sendToView(view -> { - if (booleanResponse.code() == 204) { - Comment comment = new Comment(); - comment.setId(commId); - view.onRemove(comment); - } else { - view.showMessage(R.string.error, R.string.error_deleting_comment); - } - })); - } - } - } - - @Override public void onWorkOffline(@NonNull String gistId) { - if (comments.isEmpty()) { - manageDisposable(RxHelper.getObservable(Comment.getGistComments(gistId).toObservable()) - .subscribe(localComments -> sendToView(view -> view.onNotifyAdapter(localComments, 1)))); - } else { - sendToView(BaseMvp.FAView::hideProgress); - } - } - - @Override public void onHandleComment(@NonNull String text, @Nullable Bundle bundle, String gistId) { - CommentRequestModel model = new CommentRequestModel(); - model.setBody(text); - manageDisposable(RxHelper.getObservable(RestProvider.getGistService(isEnterprise()).createGistComment(gistId, model)) - .doOnSubscribe(disposable -> sendToView(view -> view.showBlockingProgress(0))) - .subscribe(comment -> sendToView(view -> view.onAddNewComment(comment)), throwable -> { - onError(throwable); - sendToView(GistCommentsMvp.View::hideBlockingProgress); - })); - } - - @Override public void onItemClick(int position, View v, Comment item) { - if (getView() == null) return; - if (v.getId() == R.id.toggle || v.getId() == R.id.toggleHolder) { - PopupMenu popupMenu = new PopupMenu(v.getContext(), v); - popupMenu.inflate(R.menu.comments_menu); - String username = Login.getUser().getLogin(); - popupMenu.getMenu().findItem(R.id.delete).setVisible(username.equalsIgnoreCase(item.getUser().getLogin())); - popupMenu.getMenu().findItem(R.id.edit).setVisible(username.equalsIgnoreCase(item.getUser().getLogin())); - popupMenu.setOnMenuItemClickListener(item1 -> { - if (getView() == null) return false; - if (item1.getItemId() == R.id.delete) { - getView().onShowDeleteMsg(item.getId()); - } else if (item1.getItemId() == R.id.reply) { - getView().onReply(item.getUser(), item.getBody()); - } else if (item1.getItemId() == R.id.edit) { - getView().onEditComment(item); - } - return true; - }); - popupMenu.show(); - } - } - - @Override public void onItemLongClick(int position, View v, Comment item) { - if (v.getId() == R.id.toggle) { - if (getView() != null) getView().onReply(item.getUser(), item.getBody()); - } else { - if (item.getUser() != null && TextUtils.equals(item.getUser().getLogin(), Login.getUser().getLogin())) { - if (getView() != null) getView().onShowDeleteMsg(item.getId()); - } else { - onItemClick(position, v, item); - } - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/gist/files/GistFilesListFragment.java b/app/src/main/java/com/fastaccess/ui/modules/gists/gist/files/GistFilesListFragment.java deleted file mode 100644 index 311ee3015..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/gist/files/GistFilesListFragment.java +++ /dev/null @@ -1,191 +0,0 @@ -package com.fastaccess.ui.modules.gists.gist.files; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.FilesListModel; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.FileHelper; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.Logger; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.provider.markdown.MarkDownProvider; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.adapter.GistFilesAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.code.CodeViewerActivity; -import com.fastaccess.ui.modules.gists.create.dialog.AddGistBottomSheetDialog; -import com.fastaccess.ui.modules.main.premium.PremiumActivity; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.ArrayList; -import java.util.HashMap; - -import butterknife.BindView; - -/** - * Created by Kosh on 13 Nov 2016, 1:36 PM - */ - -public class GistFilesListFragment extends BaseFragment implements - GistFilesListMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - @State boolean isOwner; - private GistFilesAdapter adapter; - - public static GistFilesListFragment newInstance(@NonNull ArrayList files, boolean isOwner) { - GistFilesListFragment view = new GistFilesListFragment(); - view.setArguments(Bundler.start() - .putParcelableArrayList(BundleConstant.ITEM, files) - .put(BundleConstant.EXTRA_TYPE, isOwner) - .end()); - return view; - } - - @Override protected int fragmentLayout() { - return R.layout.small_grid_refresh_list; - } - - @NonNull @Override public GistFilesListPresenter providePresenter() { - return new GistFilesListPresenter(); - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - stateLayout.setEmptyText(R.string.no_files); - stateLayout.showEmptyState(); - recycler.setEmptyView(stateLayout, refresh); - refresh.setEnabled(false); - adapter = new GistFilesAdapter(getPresenter().getFiles(), getPresenter(), isOwner); - recycler.setAdapter(adapter); - if (getArguments() != null && savedInstanceState == null) { - ArrayList filesListModel = getArguments().getParcelableArrayList(BundleConstant.ITEM); - isOwner = getArguments().getBoolean(BundleConstant.EXTRA_TYPE); - onInitFiles(filesListModel, isOwner); - setArguments(null);//CLEAR - } else { - onInitFiles(getPresenter().getFiles(), isOwner); - } - fastScroller.attachRecyclerView(recycler); - } - - @Override public void onOpenFile(@NonNull FilesListModel item, int position) { - if (canOpen(item) && !isOwner) { - CodeViewerActivity.startActivity(getContext(), item.getRawUrl(), item.getRawUrl()); - } else if (isOwner && canOpen(item)) { - onEditFile(item, position); - } - } - - @Override public void onDeleteFile(@NonNull FilesListModel item, int position) { - MessageDialogView.newInstance(getString(R.string.delete), getString(R.string.confirm_message), false, - Bundler.start() - .put(BundleConstant.ID, position) - .put(BundleConstant.YES_NO_EXTRA, true) - .end()) - .show(getChildFragmentManager(), MessageDialogView.TAG); - } - - @Override public void onEditFile(@NonNull FilesListModel item, int position) { - AddGistBottomSheetDialog.Companion.newInstance(item, position).show(getChildFragmentManager(), AddGistBottomSheetDialog.Companion.getTAG()); - } - - @Override public void onInitFiles(@Nullable ArrayList filesListModel, boolean isOwner) { - if (filesListModel == null) { - filesListModel = new ArrayList<>();//DO NOT PASS NULL TO ADAPTER - } - if (getPresenter().getFilesMap().isEmpty()) { - for (FilesListModel listModel : filesListModel) { - getPresenter().getFilesMap().put(listModel.getFilename(), listModel); - } - } - adapter.setOwner(isOwner); - getPresenter().onSetList(filesListModel); - adapter.insertItems(filesListModel); - } - - @Override public void onAddNewFile() { - Logger.e("Hello world"); - if (adapter.getItemCount() == 0 || (PrefGetter.isProEnabled() || PrefGetter.isAllFeaturesUnlocked())) { - AddGistBottomSheetDialog.Companion.newInstance(null, -1) - .show(getChildFragmentManager(), AddGistBottomSheetDialog.Companion.getTAG()); - } else { - PremiumActivity.Companion.startActivity(getContext()); - } - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (isOk && bundle != null) { - String url = bundle.getString(BundleConstant.EXTRA); - if (!InputHelper.isEmpty(url)) { - if (ActivityHelper.checkAndRequestReadWritePermission(getActivity())) { - RestProvider.downloadFile(getContext(), url); - } - } else if (bundle.getBoolean(BundleConstant.YES_NO_EXTRA)) { - if (adapter != null) { - int position = bundle.getInt(BundleConstant.ID); - FilesListModel file = adapter.getItem(position); - if (file != null) { - if (getPresenter().getFilesMap().get(file.getFilename()) != null) { - file = getPresenter().getFilesMap().get(file.getFilename()); - file.setContent(null); - getPresenter().getFilesMap().put(file.getFilename(), file); - } - } - adapter.removeItem(position); - } - } - } - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - @Override public void onFileAdded(@NonNull FilesListModel file, Integer position) { - if (position == null || position == -1) { - adapter.addItem(file); - getPresenter().getFilesMap().put(file.getFilename(), file); - } else { - FilesListModel current = adapter.getItem(position); - if (getPresenter().getFilesMap().get(current.getFilename()) != null) { - FilesListModel toUpdate = getPresenter().getFilesMap().get(current.getFilename()); - toUpdate.setFilename(file.getFilename()); - toUpdate.setContent(file.getContent()); - getPresenter().getFilesMap().put(current.getFilename(), toUpdate); - } - adapter.swapItem(file, position); - - } - } - - private boolean canOpen(@NonNull FilesListModel item) { - if (item.getRawUrl() == null) return false; - if (item.getSize() > FileHelper.ONE_MB && !MarkDownProvider.isImage(item.getRawUrl())) { - MessageDialogView.newInstance(getString(R.string.big_file), getString(R.string.big_file_description), false, true, - Bundler.start().put(BundleConstant.YES_NO_EXTRA, true).put(BundleConstant.EXTRA, item.getRawUrl()).end()) - .show(getChildFragmentManager(), "MessageDialogView"); - return false; - } - return true; - } - - @NonNull @Override public HashMap getFiles() { - return getPresenter().getFilesMap(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/gist/files/GistFilesListMvp.java b/app/src/main/java/com/fastaccess/ui/modules/gists/gist/files/GistFilesListMvp.java deleted file mode 100644 index 00d4d9e2a..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/gist/files/GistFilesListMvp.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.fastaccess.ui.modules.gists.gist.files; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.FilesListModel; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.gists.create.dialog.AddGistMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.HashMap; - -/** - * Created by Kosh on 13 Nov 2016, 1:35 PM - */ - -public interface GistFilesListMvp { - - interface View extends BaseMvp.FAView, AddGistMvp.AddGistFileListener { - void onOpenFile(@NonNull FilesListModel item, int position); - - void onDeleteFile(@NonNull FilesListModel item, int position); - - void onEditFile(@NonNull FilesListModel item, int position); - - void onInitFiles(@Nullable ArrayList file, boolean isOwner); - - void onAddNewFile(); - - @NonNull HashMap getFiles(); - } - - interface Presenter extends BaseMvp.FAPresenter, BaseViewHolder.OnItemClickListener { - void onSetList(@Nullable ArrayList files); - - @NonNull ArrayList getFiles(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/gist/files/GistFilesListPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/gists/gist/files/GistFilesListPresenter.java deleted file mode 100644 index 3d6b38d2f..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/gist/files/GistFilesListPresenter.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.fastaccess.ui.modules.gists.gist.files; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.FilesListModel; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; -import java.util.HashMap; - -import lombok.Getter; - -/** - * Created by Kosh on 13 Nov 2016, 1:35 PM - */ - -public class GistFilesListPresenter extends BasePresenter implements GistFilesListMvp.Presenter { - private ArrayList listModels; - @Getter private HashMap filesMap = new HashMap<>(); - - @Override public void onItemClick(int position, View v, FilesListModel item) { - if (getView() != null) { - if (v.getId() == R.id.delete) { - getView().onDeleteFile(item, position); - } else if (v.getId() == R.id.edit) { - getView().onEditFile(item, position); - } else { - getView().onOpenFile(item, position); - } - } - } - - @Override public void onItemLongClick(int position, View v, FilesListModel item) {} - - @Override public void onSetList(@Nullable ArrayList files) { - this.listModels = files; - } - - @NonNull @Override public ArrayList getFiles() { - if (listModels == null) { - return new ArrayList<>(); - } - return listModels; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/starred/StarredGistsFragment.java b/app/src/main/java/com/fastaccess/ui/modules/gists/starred/StarredGistsFragment.java deleted file mode 100644 index 61eaba8c9..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/starred/StarredGistsFragment.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.fastaccess.ui.modules.gists.starred; - -import android.app.Activity; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.GistsAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.gists.gist.GistActivity; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 12:36 PM - */ - -public class StarredGistsFragment extends BaseFragment implements StarredGistsMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - - private GistsAdapter adapter; - private OnLoadMore onLoadMore; - - public static StarredGistsFragment newInstance() { - return new StarredGistsFragment(); - } - - @Override protected int fragmentLayout() { - return R.layout.small_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - stateLayout.setEmptyText(R.string.no_gists); - refresh.setOnRefreshListener(this); - stateLayout.setOnReloadListener(this); - recycler.setEmptyView(stateLayout, refresh); - adapter = new GistsAdapter(getPresenter().getGists(), true); - adapter.setListener(getPresenter()); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - recycler.addDivider(); - if (getPresenter().getGists().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, null); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override public void showProgress(@StringRes int resId) { - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public StarredGistsPresenter providePresenter() { - return new StarredGistsPresenter(); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter(), null); - } - return onLoadMore; - } - - @Override public void onStartGistView(@NonNull String gistId) { - startActivityForResult(GistActivity.createIntent(getContext(), gistId, isEnterprise()), BundleConstant.REQUEST_CODE); - } - - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (resultCode == Activity.RESULT_OK && requestCode == BundleConstant.REQUEST_CODE) { - if (data != null && data.getExtras() != null) { - Gist gistsModel = data.getExtras().getParcelable(BundleConstant.ITEM); - if (gistsModel != null && adapter != null) { - adapter.removeItem(gistsModel); - } - } else { - onRefresh(); - } - } - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/starred/StarredGistsMvp.java b/app/src/main/java/com/fastaccess/ui/modules/gists/starred/StarredGistsMvp.java deleted file mode 100644 index 94353c32d..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/starred/StarredGistsMvp.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fastaccess.ui.modules.gists.starred; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 11 Nov 2016, 12:35 PM - */ - -interface StarredGistsMvp { - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - - void onStartGistView(@NonNull String gistId); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getGists(); - - void onWorkOffline(@NonNull String login); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/gists/starred/StarredGistsPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/gists/starred/StarredGistsPresenter.java deleted file mode 100644 index cd81af922..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/gists/starred/StarredGistsPresenter.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.fastaccess.ui.modules.gists.starred; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 11 Nov 2016, 12:36 PM - */ - -class StarredGistsPresenter extends BasePresenter implements StarredGistsMvp.Presenter { - private ArrayList gistsModels = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - sendToView(view -> { - if (view.getLoadMore().getParameter() != null) { - onWorkOffline(view.getLoadMore().getParameter()); - } - }); - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable String parameter) { - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0) { - sendToView(StarredGistsMvp.View::hideProgress); - return false; - } - makeRestCall(RestProvider.getGistService(isEnterprise()).getStarredGists(page), - listResponse -> { - lastPage = listResponse.getLast(); - sendToView(view -> view.onNotifyAdapter(listResponse.getItems(), page)); - }); - return true; - } - - @NonNull @Override public ArrayList getGists() { - return gistsModels; - } - - @Override public void onWorkOffline(@NonNull String login) {}// do nothing for now. - - @Override public void onItemClick(int position, View v, Gist item) { - SchemeParser.launchUri(v.getContext(), item.getHtmlUrl()); - } - - @Override public void onItemLongClick(int position, View v, Gist item) {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/login/LoginActivity.java b/app/src/main/java/com/fastaccess/ui/modules/login/LoginActivity.java deleted file mode 100644 index cd0f7d57a..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/login/LoginActivity.java +++ /dev/null @@ -1,262 +0,0 @@ -package com.fastaccess.ui.modules.login; - -import android.app.Activity; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import com.google.android.material.floatingactionbutton.FloatingActionButton; -import com.google.android.material.textfield.TextInputEditText; -import com.google.android.material.textfield.TextInputLayout; -import android.view.View; -import android.widget.ProgressBar; - -import com.evernote.android.state.State; -import com.fastaccess.App; -import com.fastaccess.BuildConfig; -import com.fastaccess.R; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.AnimHelper; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.Logger; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.modules.login.chooser.LoginChooserActivity; -import com.fastaccess.ui.modules.main.donation.DonateActivity; -import com.fastaccess.ui.widgets.FontCheckbox; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; -import com.miguelbcr.io.rx_billing_service.RxBillingService; -import com.miguelbcr.io.rx_billing_service.entities.ProductType; -import com.miguelbcr.io.rx_billing_service.entities.Purchase; - -import butterknife.BindView; -import butterknife.OnCheckedChanged; -import butterknife.OnClick; -import butterknife.OnEditorAction; -import es.dmoral.toasty.Toasty; -import io.reactivex.functions.Action; - -/** - * Created by Kosh on 08 Feb 2017, 9:10 PM - */ - -public class LoginActivity extends BaseActivity implements LoginMvp.View { - - @BindView(R.id.usernameEditText) TextInputEditText usernameEditText; - @BindView(R.id.username) TextInputLayout username; - @BindView(R.id.passwordEditText) TextInputEditText passwordEditText; - @BindView(R.id.password) TextInputLayout password; - @BindView(R.id.twoFactor) TextInputLayout twoFactor; - @BindView(R.id.twoFactorEditText) TextInputEditText twoFactorEditText; - @BindView(R.id.login) FloatingActionButton login; - @BindView(R.id.progress) ProgressBar progress; - @BindView(R.id.accessTokenCheckbox) FontCheckbox accessTokenCheckbox; - @BindView(R.id.endpoint) TextInputLayout endpoint; - @State boolean isBasicAuth; - - public static void startOAuth(@NonNull Activity activity) { - Intent intent = new Intent(activity, LoginActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.YES_NO_EXTRA, true) - .put(BundleConstant.EXTRA_TWO, true) - .end()); - intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); - activity.startActivity(intent); - activity.finish(); - } - - public static void start(@NonNull Activity activity, boolean isBasicAuth) { - start(activity, isBasicAuth, false); - } - - public static void start(@NonNull Activity activity, boolean isBasicAuth, boolean isEnterprise) { - Intent intent = new Intent(activity, LoginActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.YES_NO_EXTRA, isBasicAuth) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .end()); - intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); - activity.startActivity(intent); - activity.finish(); - } - - @OnClick(R.id.browserLogin) void onOpenBrowser() { - if (isEnterprise()) { - MessageDialogView.newInstance(getString(R.string.warning), getString(R.string.github_enterprise_reply), - true, Bundler.start().put("hide_buttons", true).end()) - .show(getSupportFragmentManager(), MessageDialogView.TAG); - return; - } - ActivityHelper.startCustomTab(this, getPresenter().getAuthorizationUrl()); - } - - @OnClick(R.id.login) public void onClick() { - doLogin(); - } - - @OnCheckedChanged(R.id.accessTokenCheckbox) void onCheckChanged(boolean checked) { - isBasicAuth = !checked; - password.setHint(checked ? getString(R.string.access_token) : getString(R.string - .password)); - } - - @OnEditorAction(R.id.passwordEditText) public boolean onSendPassword() { - if (twoFactor.getVisibility() == View.VISIBLE) { - twoFactorEditText.requestFocus(); - } else if (endpoint.getVisibility() == View.VISIBLE) { - endpoint.requestFocus(); - } else { - doLogin(); - } - return true; - } - - @OnEditorAction(R.id.twoFactorEditText) public boolean onSend2FA() { - doLogin(); - return true; - } - - @OnEditorAction(R.id.endpointEditText) boolean onSendEndpoint() { - doLogin(); - return true; - } - - @Override protected int layout() { - return R.layout.login_form_layout; - } - - @Override protected boolean isTransparent() { - return true; - } - - @Override protected boolean canBack() { - return false; - } - - @Override protected boolean isSecured() { - return true; - } - - @NonNull @Override public LoginPresenter providePresenter() { - return new LoginPresenter(); - } - - @Override public void onEmptyUserName(boolean isEmpty) { - username.setError(isEmpty ? getString(R.string.required_field) : null); - } - - @Override public void onRequire2Fa() { - Toasty.warning(App.getInstance(), getString(R.string.two_factors_otp_error)).show(); - twoFactor.setVisibility(View.VISIBLE); - hideProgress(); - } - - @Override public void onEmptyPassword(boolean isEmpty) { - password.setError(isEmpty ? getString(R.string.required_field) : null); - } - - @Override public void onEmptyEndpoint(boolean isEmpty) { - endpoint.setError(isEmpty ? getString(R.string.required_field) : null); - } - - @Override public void onSuccessfullyLoggedIn(boolean extraLogin) { - checkPurchases(() -> { - hideProgress(); - onRestartApp(); - }); - } - - @Override protected void onCreate(Bundle savedInstanceState) { - setTheme(R.style.LoginTheme); - super.onCreate(savedInstanceState); - if (savedInstanceState == null) { - if (getIntent() != null && getIntent().getExtras() != null) { - isBasicAuth = getIntent().getExtras().getBoolean(BundleConstant.YES_NO_EXTRA); - password.setHint(isBasicAuth ? getString(R.string.password) : getString(R.string.access_token)); - if (getIntent().getExtras().getBoolean(BundleConstant.EXTRA_TWO)) { - onOpenBrowser(); - } - } - } - accessTokenCheckbox.setVisibility(isEnterprise() ? View.VISIBLE : View.GONE); - endpoint.setVisibility(isEnterprise() ? View.VISIBLE : View.GONE); - } - - @Override protected void onNewIntent(Intent intent) { - super.onNewIntent(intent); - getPresenter().onHandleAuthIntent(intent); - setIntent(null); - } - - @Override protected void onResume() { - super.onResume(); - getPresenter().onHandleAuthIntent(getIntent()); - setIntent(null); - } - - @Override public void showErrorMessage(@NonNull String msgRes) { - hideProgress(); - super.showErrorMessage(msgRes); - } - - @Override public void showMessage(@StringRes int titleRes, @StringRes int msgRes) { - hideProgress(); - super.showMessage(titleRes, msgRes); - } - - @Override public void showMessage(@NonNull String titleRes, @NonNull String msgRes) { - hideProgress(); - super.showMessage(titleRes, msgRes); - } - - @Override public void showProgress(@StringRes int resId) { - login.hide(); - AppHelper.hideKeyboard(login); - AnimHelper.animateVisibility(progress, true); - } - - @Override public void onBackPressed() { - startActivity(new Intent(this, LoginChooserActivity.class)); - finish(); - } - - @Override public void hideProgress() { - progress.setVisibility(View.GONE); - login.show(); - } - - protected void checkPurchases(@Nullable Action action) { - getPresenter().manageViewDisposable(RxBillingService.getInstance(this, BuildConfig.DEBUG) - .getPurchases(ProductType.IN_APP) - .doOnSubscribe(disposable -> showProgress(0)) - .subscribe((purchases, throwable) -> { - hideProgress(); - if (throwable == null) { - Logger.e(purchases); - if (purchases != null && !purchases.isEmpty()) { - for (Purchase purchase : purchases) { - String sku = purchase.sku(); - if (!InputHelper.isEmpty(sku)) { - DonateActivity.Companion.enableProduct(sku, App.getInstance()); - } - } - } - } else { - throwable.printStackTrace(); - } - if (action != null) action.run(); - })); - } - - private void doLogin() { - if (progress.getVisibility() == View.GONE) { - getPresenter().login(InputHelper.toString(username), - InputHelper.toString(password), - InputHelper.toString(twoFactor), - isBasicAuth, InputHelper.toString(endpoint)); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/login/LoginMvp.java b/app/src/main/java/com/fastaccess/ui/modules/login/LoginMvp.java deleted file mode 100644 index 23fd05c25..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/login/LoginMvp.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.fastaccess.ui.modules.login; - -import android.content.Intent; -import android.net.Uri; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.AccessTokenModel; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.ui.base.mvp.BaseMvp; - -/** - * Created by Kosh on 09 Nov 2016, 9:41 PM - */ - -public interface LoginMvp { - - interface View extends BaseMvp.FAView { - - void onRequire2Fa(); - - void onEmptyUserName(boolean isEmpty); - - void onEmptyPassword(boolean isEmpty); - - void onEmptyEndpoint(boolean isEmpty); - - void onSuccessfullyLoggedIn(boolean extraLogin); - } - - interface Presenter extends BaseMvp.FAPresenter { - - @NonNull Uri getAuthorizationUrl(); - - void onHandleAuthIntent(@Nullable Intent intent); - - void onTokenResponse(@Nullable AccessTokenModel response); - - void onUserResponse(@Nullable Login response); - - void login(@NonNull String username, @NonNull String password, - @Nullable String twoFactorCode, boolean isBasicAuth, - @Nullable String endpoint); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/login/LoginPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/login/LoginPresenter.java deleted file mode 100644 index c673e4376..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/login/LoginPresenter.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.fastaccess.ui.modules.login; - -import android.content.Intent; -import android.net.Uri; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.BuildConfig; -import com.fastaccess.R; -import com.fastaccess.data.dao.AccessTokenModel; -import com.fastaccess.data.dao.AuthModel; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.helper.GithubConfigHelper; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.provider.rest.LoginProvider; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.Arrays; - -import okhttp3.Credentials; -import retrofit2.HttpException; - -/** - * Created by Kosh on 09 Nov 2016, 9:43 PM - */ - -public class LoginPresenter extends BasePresenter implements LoginMvp.Presenter { - - LoginPresenter() { - RestProvider.clearHttpClient(); - } - - @Override protected void onDestroy() { - super.onDestroy(); - } - - @Override public void onError(@NonNull Throwable throwable) { - if (RestProvider.getErrorCode(throwable) == 401 && throwable instanceof HttpException) { - retrofit2.Response response = ((HttpException) throwable).response(); - if (response != null && response.headers() != null) { - String twoFaToken = response.headers().get("X-GitHub-OTP"); - if (twoFaToken != null) { - sendToView(LoginMvp.View::onRequire2Fa); - return; - } else { - sendToView(view -> view.showMessage(R.string.error, R.string.failed_login)); - return; - } - } - } - sendToView(view -> view.showErrorMessage(throwable.getMessage())); - } - - @Override public void onTokenResponse(@Nullable AccessTokenModel modelResponse) { - if (modelResponse != null) { - String token = modelResponse.getToken() != null ? modelResponse.getToken() : modelResponse.getAccessToken(); - if (!InputHelper.isEmpty(token)) { - PrefGetter.setToken(token); - makeRestCall(RestProvider.getUserService(false).getUser(), this::onUserResponse); - return; - } - } - sendToView(view -> view.showMessage(R.string.error, R.string.failed_login)); - } - - @NonNull @Override public Uri getAuthorizationUrl() { - return new Uri.Builder().scheme("https") - .authority("github.com") - .appendPath("login") - .appendPath("oauth") - .appendPath("authorize") - .appendQueryParameter("client_id", GithubConfigHelper.getClientId()) - .appendQueryParameter("redirect_uri", GithubConfigHelper.getRedirectUrl()) - .appendQueryParameter("scope", "user,repo,gist,notifications,read:org") - .appendQueryParameter("state", BuildConfig.APPLICATION_ID) - .build(); - } - - @Override public void onHandleAuthIntent(@Nullable Intent intent) { - if (intent != null && intent.getData() != null) { - Uri uri = intent.getData(); - if (uri.toString().startsWith(GithubConfigHelper.getRedirectUrl())) { - String tokenCode = uri.getQueryParameter("code"); - if (!InputHelper.isEmpty(tokenCode)) { - makeRestCall(LoginProvider.getLoginRestService().getAccessToken(tokenCode, - GithubConfigHelper.getClientId(), GithubConfigHelper.getSecret(), - BuildConfig.APPLICATION_ID, GithubConfigHelper.getRedirectUrl()), - this::onTokenResponse); - } else { - sendToView(view -> view.showMessage(R.string.error, R.string.error)); - } - } - } - } - - @Override public void onUserResponse(@Nullable Login userModel) { - if (userModel != null) { - manageObservable(Login.onMultipleLogin(userModel, isEnterprise(), true) - .doOnComplete(() -> sendToView(view -> view.onSuccessfullyLoggedIn(isEnterprise())))); - return; - } - sendToView(view -> view.showMessage(R.string.error, R.string.failed_login)); - } - - @Override public void login(@NonNull String username, @NonNull String password, @Nullable String twoFactorCode, - boolean isBasicAuth, @Nullable String endpoint) { - boolean usernameIsEmpty = InputHelper.isEmpty(username); - boolean passwordIsEmpty = InputHelper.isEmpty(password); - boolean endpointIsEmpty = InputHelper.isEmpty(endpoint) && isEnterprise(); - if (getView() == null) return; - getView().onEmptyUserName(usernameIsEmpty); - getView().onEmptyPassword(passwordIsEmpty); - getView().onEmptyEndpoint(endpointIsEmpty); - if ((!usernameIsEmpty && !passwordIsEmpty)) { - try { - String authToken = Credentials.basic(username, password); - if (isBasicAuth && !isEnterprise()) { - AuthModel authModel = new AuthModel(); - authModel.setScopes(Arrays.asList("user", "repo", "gist", "notifications", "read:org")); - authModel.setNote(BuildConfig.APPLICATION_ID); - authModel.setClientSecret(GithubConfigHelper.getSecret()); - authModel.setClientId(GithubConfigHelper.getClientId()); - authModel.setNoteUrl(GithubConfigHelper.getRedirectUrl()); - if (!InputHelper.isEmpty(twoFactorCode)) { - authModel.setOtpCode(twoFactorCode); - } - makeRestCall(LoginProvider.getLoginRestService(authToken, twoFactorCode, null).login(authModel), accessTokenModel -> { - if (!InputHelper.isEmpty(twoFactorCode)) { - PrefGetter.setOtpCode(twoFactorCode); - } - onTokenResponse(accessTokenModel); - }); - } else { - accessTokenLogin(password, endpoint, twoFactorCode, authToken); - } - } catch (Exception e) { - sendToView(view -> view.showMessage("Error", "The app was about to crash!!(" + e.getMessage() + ")")); - } - } - } - - private void accessTokenLogin(@NonNull String password, @Nullable String endpoint, @Nullable String otp, - @NonNull String authToken) { - makeRestCall(LoginProvider.getLoginRestService(authToken, otp, endpoint).loginAccessToken(), - login -> { - if (!isEnterprise()) { - PrefGetter.setToken(password); - } else { - PrefGetter.setEnterpriseOtpCode(otp); - PrefGetter.setTokenEnterprise(authToken); - PrefGetter.setEnterpriseUrl(endpoint); - } - onUserResponse(login); - }); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/login/chooser/LoginChooserActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/login/chooser/LoginChooserActivity.kt deleted file mode 100644 index 3466fdea8..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/login/chooser/LoginChooserActivity.kt +++ /dev/null @@ -1,138 +0,0 @@ -package com.fastaccess.ui.modules.login.chooser - -import android.content.Context -import android.content.Intent -import android.os.Bundle -import androidx.coordinatorlayout.widget.CoordinatorLayout -import androidx.transition.TransitionManager -import android.view.View -import android.widget.RelativeLayout -import butterknife.BindView -import butterknife.OnClick -import com.fastaccess.BuildConfig -import com.fastaccess.R -import com.fastaccess.data.dao.model.Login -import com.fastaccess.helper.Bundler -import com.fastaccess.helper.PrefGetter -import com.fastaccess.ui.adapter.LoginAdapter -import com.fastaccess.ui.base.BaseActivity -import com.fastaccess.ui.modules.login.LoginActivity -import com.fastaccess.ui.modules.main.premium.PremiumActivity -import com.fastaccess.ui.modules.settings.LanguageBottomSheetDialog -import com.fastaccess.ui.widgets.dialog.MessageDialogView -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView -import io.reactivex.functions.Action -import java.util.* - -/** - * Created by Kosh on 28 Apr 2017, 9:03 PM - */ - -class LoginChooserActivity : BaseActivity(), LoginChooserMvp.View { - - @BindView(R.id.language_selector) lateinit var language_selector: RelativeLayout - @BindView(R.id.recycler) lateinit var recycler: DynamicRecyclerView - @BindView(R.id.multiAccLayout) lateinit var multiAccLayout: View - @BindView(R.id.viewGroup) lateinit var viewGroup: CoordinatorLayout - @BindView(R.id.toggleImage) lateinit var toggleImage: View - - private val adapter = LoginAdapter() - - override fun layout(): Int = R.layout.login_chooser_layout - - override fun isTransparent(): Boolean = true - - override fun canBack(): Boolean = false - - override fun isSecured(): Boolean = true - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - adapter.listener = this - recycler.adapter = adapter - val languages = resources.getStringArray(R.array.languages_array_values) - if (Locale.getDefault().language in languages) { - val language = PrefGetter.getAppLanguage() - PrefGetter.setAppLangauge(Locale.getDefault().language) - if (!BuildConfig.DEBUG) language_selector.visibility = View.GONE - if (Locale.getDefault().language != language) recreate() - } - } - - @OnClick(R.id.basicAuth) fun onBasicAuthClicked() { - LoginActivity.start(this, true) - } - - @OnClick(R.id.accessToken) fun onAccessTokenClicked() { - LoginActivity.start(this, false) - } - - @OnClick(R.id.enterprise) internal fun onEnterpriseClicked() { - if (Login.hasNormalLogin()) { - if (PrefGetter.isAllFeaturesUnlocked() || PrefGetter.isEnterpriseEnabled()) { - LoginActivity.start(this, true, true) - } else { - startActivity(Intent(this, PremiumActivity::class.java)) - } - } else { - MessageDialogView.newInstance(getString(R.string.warning), getString(R.string.enterprise_login_warning), - false, Bundler.start().put("hide_buttons", true).end()) - .show(supportFragmentManager, MessageDialogView.TAG) - } - } - - @OnClick(R.id.browserLogin) internal fun onOpenBrowser() { - LoginActivity.startOAuth(this) - } - - @OnClick(R.id.language_selector_clicker) fun onChangeLanguage() { - showLanguage() - } - - @OnClick(R.id.toggle) internal fun onToggle() { - TransitionManager.beginDelayedTransition(viewGroup) - val isVisible = recycler.visibility == View.VISIBLE - recycler.visibility = if (isVisible) View.GONE else View.VISIBLE - toggleImage.rotation = if (!isVisible) 180f else 0f - } - - override fun onLanguageChanged(action: Action) { - try { - action.run() - recreate() - } catch (e: Exception) { - e.printStackTrace() - } - - } - - override fun providePresenter(): LoginChooserPresenter { - return LoginChooserPresenter() - } - - override fun onAccountsLoaded(accounts: List?) { - if (accounts == null || accounts.isEmpty()) { - multiAccLayout.visibility = View.GONE - } else { - TransitionManager.beginDelayedTransition(viewGroup) - adapter.insertItems(accounts) - multiAccLayout.visibility = View.VISIBLE - } - } - - override fun onItemClick(position: Int, v: View, item: Login) { - presenter.manageViewDisposable(Login.onMultipleLogin(item, item.isIsEnterprise, false) - .doOnSubscribe { showProgress(0) } - .doOnComplete { this.hideProgress() } - .subscribe({ onRestartApp() }, ::println)) - } - - override fun onItemLongClick(position: Int, v: View, item: Login) {} - - private fun showLanguage() { - val languageBottomSheetDialog = LanguageBottomSheetDialog() - languageBottomSheetDialog.onAttach(this as Context) - languageBottomSheetDialog.show(supportFragmentManager, "LanguageBottomSheetDialog") - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/login/chooser/LoginChooserMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/login/chooser/LoginChooserMvp.kt deleted file mode 100644 index 9620a98cd..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/login/chooser/LoginChooserMvp.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.fastaccess.ui.modules.login.chooser - -import com.fastaccess.data.dao.model.Login -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.modules.settings.LanguageBottomSheetDialog -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -interface LoginChooserMvp { - - interface View : BaseMvp.FAView, LanguageBottomSheetDialog.LanguageDialogListener, - BaseViewHolder.OnItemClickListener { - fun onAccountsLoaded(accounts: List?) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/login/chooser/LoginChooserPresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/login/chooser/LoginChooserPresenter.kt deleted file mode 100644 index 85b23b4bd..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/login/chooser/LoginChooserPresenter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.fastaccess.ui.modules.login.chooser - -import com.fastaccess.data.dao.model.Login -import com.fastaccess.ui.base.mvp.presenter.BasePresenter - -class LoginChooserPresenter : BasePresenter() { - init { - manageObservable(Login.getAccounts().toList() - .toObservable() - .doOnNext { sendToView { view -> view.onAccountsLoaded(it) } }) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/MainActivity.java b/app/src/main/java/com/fastaccess/ui/modules/main/MainActivity.java deleted file mode 100644 index 4a84a37ab..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/MainActivity.java +++ /dev/null @@ -1,219 +0,0 @@ -package com.fastaccess.ui.modules.main; - -import android.content.Intent; -import android.graphics.Typeface; -import android.os.Bundle; -import android.view.Menu; -import android.view.MenuItem; -import android.widget.Toast; - -import com.evernote.android.state.State; -import com.fastaccess.App; -import com.fastaccess.BuildConfig; -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.Notification; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Logger; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.helper.TypeFaceHelper; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.modules.feeds.FeedsFragment; -import com.fastaccess.ui.modules.main.issues.pager.MyIssuesPagerFragment; -import com.fastaccess.ui.modules.main.pullrequests.pager.MyPullsPagerFragment; -import com.fastaccess.ui.modules.notification.NotificationActivity; -import com.fastaccess.ui.modules.search.SearchActivity; -import com.fastaccess.ui.modules.user.UserPagerActivity; -import com.google.android.material.floatingactionbutton.FloatingActionButton; -import com.google.firebase.iid.FirebaseInstanceId; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.core.view.GravityCompat; -import androidx.fragment.app.FragmentManager; -import butterknife.BindView; -import butterknife.OnClick; -import it.sephiroth.android.library.bottomnavigation.BottomNavigation; -import shortbread.Shortcut; - -import static com.fastaccess.helper.AppHelper.getFragmentByTag; - -public class MainActivity extends BaseActivity implements MainMvp.View { - - @State @MainMvp.NavigationType int navType = MainMvp.FEEDS; - @BindView(R.id.bottomNavigation) BottomNavigation bottomNavigation; - @BindView(R.id.fab) FloatingActionButton fab; - - @OnClick(R.id.fab) void onFilter() {} - - @NonNull @Override public MainPresenter providePresenter() { - return new MainPresenter(); - } - - @Override protected int layout() { - return R.layout.activity_main_view; - } - - @Override protected boolean isTransparent() { - return true; - } - - @Override protected boolean canBack() { - return false; - } - - @Override protected boolean isSecured() { - return false; - } - - @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - if (BuildConfig.DEBUG) { - FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(o -> Logger.e(o.getId(), o.getToken())); - } - - getPresenter().setEnterprise(PrefGetter.isEnterprise()); - selectHome(false); - hideShowShadow(navType == MainMvp.FEEDS); - setToolbarIcon(R.drawable.ic_menu); - onInit(savedInstanceState); - fab.setImageResource(R.drawable.ic_filter); - onNewIntent(getIntent()); - } - - @Override protected void onNewIntent(Intent intent) { - super.onNewIntent(intent); - if (intent != null && intent.getExtras() != null) { - boolean recreate = intent.getExtras().getBoolean(BundleConstant.YES_NO_EXTRA); - if (recreate) recreate(); - } - } - - @Override public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.search_menu, menu); - return super.onCreateOptionsMenu(menu); - } - - @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { - if (item.getItemId() == android.R.id.home) { - if (drawer != null) drawer.openDrawer(GravityCompat.START); - return true; - } else if (item.getItemId() == R.id.search) { - startActivity(new Intent(this, SearchActivity.class)); - return true; - } else if (item.getItemId() == R.id.notifications) { - ViewHelper.tintDrawable(item.setIcon(R.drawable.ic_notifications_none).getIcon(), ViewHelper.getIconColor(this)); - startActivity(new Intent(this, NotificationActivity.class)); - return true; - } - return super.onOptionsItemSelected(item); - } - - @Override public boolean onPrepareOptionsMenu(Menu menu) { - if (isLoggedIn() && Notification.hasUnreadNotifications()) { - ViewHelper.tintDrawable(menu.findItem(R.id.notifications).setIcon(R.drawable.ic_ring).getIcon(), ViewHelper.getAccentColor(this)); - } else { - ViewHelper.tintDrawable(menu.findItem(R.id.notifications) - .setIcon(R.drawable.ic_notifications_none).getIcon(), ViewHelper.getIconColor(this)); - } - return super.onPrepareOptionsMenu(menu); - } - - @Override public void onNavigationChanged(@MainMvp.NavigationType int navType) { - if (navType == MainMvp.PROFILE) { - getPresenter().onModuleChanged(getSupportFragmentManager(), navType); - bottomNavigation.setSelectedIndex(this.navType, true); - return; - } - this.navType = navType; - //noinspection WrongConstant - if (bottomNavigation.getSelectedIndex() != navType) bottomNavigation.setSelectedIndex(navType, true); - hideShowShadow(navType == MainMvp.FEEDS); - getPresenter().onModuleChanged(getSupportFragmentManager(), navType); - } - - @Override public void onUpdateDrawerMenuHeader() { - setupNavigationView(); - } - - @Override public void onOpenProfile() { - UserPagerActivity.startActivity(this, Login.getUser().getLogin(), false, PrefGetter.isEnterprise(), -1); - } - - @Override public void onInvalidateNotification() { - invalidateOptionsMenu(); - } - - @Override public void onUserIsBlackListed() { - Toast.makeText(App.getInstance(), "You are blacklisted, please contact the dev", Toast.LENGTH_LONG).show(); - finish(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - FragmentManager fragmentManager = getSupportFragmentManager(); - if (index == 0) { - FeedsFragment homeView = (FeedsFragment) getFragmentByTag(fragmentManager, FeedsFragment.TAG); - if (homeView != null) { - homeView.onScrollTop(index); - } - } else if (index == 1) { - MyIssuesPagerFragment issuesView = (MyIssuesPagerFragment) getFragmentByTag - (fragmentManager, MyIssuesPagerFragment.TAG); - if (issuesView != null) { - issuesView.onScrollTop(index); - } - } else if (index == 2) { - MyPullsPagerFragment pullRequestView = (MyPullsPagerFragment) getFragmentByTag - (fragmentManager, MyPullsPagerFragment.TAG); - if (pullRequestView != null) { - pullRequestView.onScrollTop(0); - } - } - } - - @Shortcut(id = "myIssues", icon = R.drawable.ic_app_shortcut_issues, shortLabelRes = R.string.issues, rank = 2, action = "myIssues") - public void myIssues() {}//do nothing - - @Shortcut(id = "myPulls", icon = R.drawable.ic_app_shortcut_pull_requests, shortLabelRes = R.string.pull_requests, rank = 3, action = "myPulls") - public void myPulls() {}//do nothing - - private void onInit(@Nullable Bundle savedInstanceState) { - if (isLoggedIn()) { - if (savedInstanceState == null) { - boolean attachFeeds = true; - if (getIntent().getAction() != null) { - if (getIntent().getAction().equalsIgnoreCase("myPulls")) { - navType = MainMvp.PULL_REQUESTS; - getSupportFragmentManager() - .beginTransaction() - .replace(R.id.container, MyPullsPagerFragment.newInstance(), MyPullsPagerFragment.TAG) - .commit(); - bottomNavigation.setSelectedIndex(2, true); - attachFeeds = false; - } else if (getIntent().getAction().equalsIgnoreCase("myIssues")) { - navType = MainMvp.ISSUES; - getSupportFragmentManager() - .beginTransaction() - .replace(R.id.container, MyIssuesPagerFragment.newInstance(), MyIssuesPagerFragment.TAG) - .commit(); - bottomNavigation.setSelectedIndex(1, true); - attachFeeds = false; - } - } - hideShowShadow(navType == MainMvp.FEEDS); - if (attachFeeds) { - getSupportFragmentManager() - .beginTransaction() - .replace(R.id.container, FeedsFragment.newInstance(null), FeedsFragment.TAG) - .commit(); - } - } - Typeface myTypeface = TypeFaceHelper.getTypeface(); - bottomNavigation.setDefaultTypeface(myTypeface); - bottomNavigation.setOnMenuItemClickListener(getPresenter()); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/MainMvp.java b/app/src/main/java/com/fastaccess/ui/modules/main/MainMvp.java deleted file mode 100644 index 58b8adda9..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/MainMvp.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.fastaccess.ui.modules.main; - -import androidx.annotation.IntDef; -import androidx.annotation.NonNull; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentManager; -import androidx.drawerlayout.widget.DrawerLayout; - -import com.fastaccess.ui.base.mvp.BaseMvp; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -import it.sephiroth.android.library.bottomnavigation.BottomNavigation; - -/** - * Created by Kosh on 09 Nov 2016, 7:51 PM - */ - -public interface MainMvp { - - int FEEDS = 0; - int ISSUES = 1; - int PULL_REQUESTS = 2; - int PROFILE = 3; - - @IntDef({ - FEEDS, - ISSUES, - PULL_REQUESTS, - PROFILE - }) - @Retention(RetentionPolicy.SOURCE) @interface NavigationType {} - - interface View extends BaseMvp.FAView { - - void onNavigationChanged(@NavigationType int navType); - - void onUpdateDrawerMenuHeader(); - - void onOpenProfile(); - - void onInvalidateNotification(); - - void onUserIsBlackListed(); - } - - interface Presenter extends BaseMvp.FAPresenter, - BottomNavigation.OnMenuItemSelectionListener { - - boolean canBackPress(@NonNull DrawerLayout drawerLayout); - - void onModuleChanged(@NonNull FragmentManager fragmentManager, @NavigationType int type); - - void onShowHideFragment(@NonNull FragmentManager fragmentManager, @NonNull Fragment toShow, @NonNull Fragment toHide); - - void onAddAndHide(@NonNull FragmentManager fragmentManager, @NonNull Fragment toAdd, @NonNull Fragment toHide); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/MainPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/main/MainPresenter.java deleted file mode 100644 index b21aabcf3..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/MainPresenter.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.fastaccess.ui.modules.main; - -import androidx.annotation.IdRes; -import androidx.annotation.NonNull; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentManager; -import androidx.core.view.GravityCompat; -import androidx.drawerlayout.widget.DrawerLayout; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.Notification; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.feeds.FeedsFragment; -import com.fastaccess.ui.modules.main.issues.pager.MyIssuesPagerFragment; -import com.fastaccess.ui.modules.main.pullrequests.pager.MyPullsPagerFragment; - -import io.reactivex.Single; - -import static com.fastaccess.helper.ActivityHelper.getVisibleFragment; -import static com.fastaccess.helper.AppHelper.getFragmentByTag; - -/** - * Created by Kosh on 09 Nov 2016, 7:53 PM - */ - -public class MainPresenter extends BasePresenter implements MainMvp.Presenter { - - MainPresenter() { - setEnterprise(PrefGetter.isEnterprise()); - manageDisposable(RxHelper.getObservable(RestProvider.getUserService(isEnterprise()).getUser()) - .flatMap(login -> { - Login current = Login.getUser(); - current.setLogin(login.getLogin()); - current.setName(login.getName()); - current.setAvatarUrl(login.getAvatarUrl()); - current.setEmail(login.getEmail()); - current.setBio(login.getBio()); - current.setBlog(login.getBlog()); - current.setCompany(current.getCompany()); - return login.update(current); - }) - .flatMap(login -> RxHelper.getObservable(RestProvider.getNotificationService(isEnterprise()) - .getNotifications(ParseDateFormat.getLastWeekDate()))) - .flatMapSingle(notificationPageable -> { - if (notificationPageable != null && (notificationPageable.getItems() != null && !notificationPageable.getItems().isEmpty())) { - return Notification.saveAsSingle(notificationPageable.getItems()); - } else { - Notification.deleteAll(); - } - return Single.just(true); - }) - .subscribe(unread -> {/**/}, Throwable::printStackTrace/*fail silently*/, () -> sendToView(view -> { - view.onInvalidateNotification(); - view.onUpdateDrawerMenuHeader(); - }))); - } - - @Override public boolean canBackPress(@NonNull DrawerLayout drawerLayout) { - return !drawerLayout.isDrawerOpen(GravityCompat.START); - } - - @SuppressWarnings("ConstantConditions") - @Override public void onModuleChanged(@NonNull FragmentManager fragmentManager, @MainMvp.NavigationType - int type) { - Fragment currentVisible = getVisibleFragment(fragmentManager); - FeedsFragment homeView = (FeedsFragment) getFragmentByTag(fragmentManager, FeedsFragment - .TAG); - MyPullsPagerFragment pullRequestView = (MyPullsPagerFragment) getFragmentByTag - (fragmentManager, MyPullsPagerFragment.TAG); - MyIssuesPagerFragment issuesView = (MyIssuesPagerFragment) getFragmentByTag - (fragmentManager, MyIssuesPagerFragment.TAG); - switch (type) { - case MainMvp.PROFILE: - sendToView(MainMvp.View::onOpenProfile); - break; - case MainMvp.FEEDS: - if (homeView == null) { - onAddAndHide(fragmentManager, FeedsFragment.newInstance(null), - currentVisible); - } else { - onShowHideFragment(fragmentManager, homeView, currentVisible); - } - break; - case MainMvp.PULL_REQUESTS: - if (pullRequestView == null) { - onAddAndHide(fragmentManager, MyPullsPagerFragment.newInstance( - ), currentVisible); - } else { - onShowHideFragment(fragmentManager, pullRequestView, currentVisible); - } - break; - case MainMvp.ISSUES: - if (issuesView == null) { - onAddAndHide(fragmentManager, MyIssuesPagerFragment.newInstance(), currentVisible); - } else { - onShowHideFragment(fragmentManager, issuesView, currentVisible); - } - break; - } - } - - @Override public void onShowHideFragment(@NonNull FragmentManager fragmentManager, @NonNull Fragment toShow, - @NonNull Fragment toHide) { - toHide.onHiddenChanged(true); - fragmentManager - .beginTransaction() - .hide(toHide) - .show(toShow) - .commit(); - toShow.onHiddenChanged(false); - } - - @Override public void onAddAndHide(@NonNull FragmentManager fragmentManager, @NonNull Fragment toAdd, - @NonNull Fragment toHide) { - toHide.onHiddenChanged(true); - fragmentManager - .beginTransaction() - .hide(toHide) - .add(R.id.container, toAdd, toAdd.getClass().getSimpleName()) - .commit(); - toAdd.onHiddenChanged(false); - } - - @Override public void onMenuItemSelect(@IdRes int id, int position, boolean fromUser) { - if (getView() != null) { - getView().onNavigationChanged(position); - } - } - - @Override public void onMenuItemReselect(@IdRes int id, int position, boolean fromUser) { - sendToView(view -> view.onScrollTop(position)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/donation/CheckPurchaseActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/main/donation/CheckPurchaseActivity.kt deleted file mode 100644 index acd1b1e5e..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/donation/CheckPurchaseActivity.kt +++ /dev/null @@ -1,79 +0,0 @@ -package com.fastaccess.ui.modules.main.donation - -import android.app.Activity -import android.app.ProgressDialog -import android.os.Bundle -import android.widget.Toast -import com.fastaccess.App -import com.fastaccess.BuildConfig -import com.fastaccess.R -import com.fastaccess.helper.AppHelper -import com.fastaccess.helper.RxHelper -import com.miguelbcr.io.rx_billing_service.RxBillingService -import com.miguelbcr.io.rx_billing_service.entities.ProductType -import es.dmoral.toasty.Toasty -import io.reactivex.Observable -import io.reactivex.disposables.Disposable - -/** - * Created by kosh on 14/07/2017. - */ -class CheckPurchaseActivity : Activity() { - - private var progress: ProgressDialog? = null - private var disposable: Disposable? = null - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - progress = ProgressDialog(this) - .apply { - setMessage(getString(R.string.in_progress)) - setOnCancelListener { finishActivity(false) } - show() - } - if (AppHelper.isGoogleAvailable(this) && !AppHelper.isEmulator()) { - disposable = RxHelper.getObservable(Observable.fromCallable { - try { - val purchases = RxBillingService.getInstance(this, BuildConfig.DEBUG) - .getPurchases(ProductType.IN_APP) - .toMaybe() - .blockingGet(mutableListOf()) - if (!purchases.isEmpty()) { - purchases.filterNotNull() - .map { it.sku() } - .filterNot { !it.isNullOrBlank() } - .onEach { DonateActivity.enableProduct(it, App.getInstance()) } - return@fromCallable true - } - } catch (e: Exception) { - e.printStackTrace() - } - return@fromCallable false - }).subscribe({ finishActivity(it) }, { finishActivity(false) }) - } else { - finishActivity(false) - } - } - - override fun onStart() { - super.onStart() - setVisible(true) - } - - override fun onBackPressed() = Unit - - private fun finishActivity(showMessage: Boolean) { - if (showMessage) Toasty.success(App.getInstance(), getString(R.string.success_purchase_message), Toast.LENGTH_LONG).show() - finish() - } - - override fun onDestroy() { - progress?.let { - it.dismiss() - } - disposable?.let { - if (!it.isDisposed) it.dispose() - } - super.onDestroy() - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/donation/DonateActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/main/donation/DonateActivity.kt deleted file mode 100644 index 240debda5..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/donation/DonateActivity.kt +++ /dev/null @@ -1,125 +0,0 @@ -package com.fastaccess.ui.modules.main.donation - -import android.app.Activity -import android.content.Context -import android.content.Intent -import android.os.Bundle -import androidx.fragment.app.Fragment -import com.fastaccess.BuildConfig -import com.fastaccess.R -import com.fastaccess.helper.* -import com.fastaccess.provider.fabric.FabricProvider -import com.fastaccess.ui.base.BaseActivity -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import com.miguelbcr.io.rx_billing_service.RxBillingService -import com.miguelbcr.io.rx_billing_service.RxBillingServiceError -import com.miguelbcr.io.rx_billing_service.RxBillingServiceException -import com.miguelbcr.io.rx_billing_service.entities.ProductType -import com.miguelbcr.io.rx_billing_service.entities.Purchase -import io.reactivex.disposables.Disposable - -/** - * Created by Kosh on 10 Jun 2017, 1:04 PM - */ - -class DonateActivity : BaseActivity>() { - - private var subscription: Disposable? = null - - override fun layout(): Int = 0 - - override fun isTransparent(): Boolean = true - - override fun canBack(): Boolean = false - - override fun isSecured(): Boolean = true - - override fun providePresenter(): BasePresenter = BasePresenter() - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - val bundle: Bundle? = intent?.extras - - val productKey = bundle?.getString(BundleConstant.EXTRA) - val price = bundle?.getLong(BundleConstant.EXTRA_FOUR, 0) - val priceText = bundle?.getString(BundleConstant.EXTRA_FIVE) - subscription = RxHelper.getSingle( - RxBillingService.getInstance(this, BuildConfig.DEBUG) - .purchase(ProductType.IN_APP, productKey, "inapp:com.fastaccess.github:$productKey") - ) - .subscribe { _: Purchase?, throwable: Throwable? -> - if (throwable == null) { - FabricProvider.logPurchase(productKey, price, priceText) - showMessage(R.string.success, R.string.success_purchase_message) - enableProduct(productKey, applicationContext) - val intent = Intent() - intent.putExtra(BundleConstant.ITEM, productKey) - setResult(Activity.RESULT_OK, intent) - } else { - if (throwable is RxBillingServiceException) { - val code = throwable.code - if (code == RxBillingServiceError.ITEM_ALREADY_OWNED) { - enableProduct(productKey, applicationContext) - val intent = Intent() - intent.putExtra(BundleConstant.ITEM, productKey) - setResult(Activity.RESULT_OK, intent) - } else { - showErrorMessage(throwable.message!!) - Logger.e(code) - setResult(Activity.RESULT_CANCELED) - } - } - throwable.printStackTrace() - } - finish() - } - } - - override fun onDestroy() { - subscription?.let { if (!it.isDisposed) it.dispose() } - super.onDestroy() - } - - companion object { - fun start(context: Activity, product: String?, price: Long? = 0, priceText: String? = null) { - val intent = Intent(context, DonateActivity::class.java) - intent.putExtras( - Bundler.start() - .put(BundleConstant.EXTRA, product) - .put(BundleConstant.EXTRA_FOUR, price) - .put(BundleConstant.EXTRA_FIVE, priceText) - .end() - ) - context.startActivityForResult(intent, BundleConstant.REQUEST_CODE) - } - - fun start(context: Fragment, product: String?, price: Long? = 0, priceText: String? = null) { - val intent = Intent(context.context, DonateActivity::class.java) - intent.putExtras( - Bundler.start() - .put(BundleConstant.EXTRA, product) - .put(BundleConstant.EXTRA_FOUR, price) - .put(BundleConstant.EXTRA_FIVE, priceText) - .end() - ) - context.startActivityForResult(intent, BundleConstant.REQUEST_CODE) - } - - fun enableProduct(productKey: String?, context: Context) { - when (productKey) { - context.getString(R.string.donation_product_3), context.getString(R.string.donation_product_4), - context.getString(R.string.fasthub_all_features_purchase) -> { - PrefGetter.setProItems() - PrefGetter.setEnterpriseItem() - } - context.getString(R.string.donation_product_2), context.getString(R.string.fasthub_pro_purchase) -> PrefGetter.setProItems() - context.getString(R.string.fasthub_enterprise_purchase) -> PrefGetter.setEnterpriseItem() - context.getString(R.string.donation_product_1), context.getString(R.string.amlod_theme_purchase) -> PrefGetter.enableAmlodTheme() - context.getString(R.string.midnight_blue_theme_purchase) -> PrefGetter.enableMidNightBlueTheme() - context.getString(R.string.theme_bluish_purchase) -> PrefGetter.enableBluishTheme() - else -> Logger.e(productKey) - } - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/donation/DonationActivity.java b/app/src/main/java/com/fastaccess/ui/modules/main/donation/DonationActivity.java deleted file mode 100644 index 2bd4256f1..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/donation/DonationActivity.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.fastaccess.ui.modules.main.donation; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import com.google.android.material.appbar.AppBarLayout; -import android.view.View; - -import com.fastaccess.App; -import com.fastaccess.BuildConfig; -import com.fastaccess.R; -import com.fastaccess.helper.AnimHelper; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.main.premium.PremiumActivity; -import com.miguelbcr.io.rx_billing_service.RxBillingService; -import com.miguelbcr.io.rx_billing_service.entities.ProductType; -import com.miguelbcr.io.rx_billing_service.entities.Purchase; - -import net.grandcentrix.thirtyinch.TiPresenter; - -import butterknife.BindView; -import butterknife.OnClick; - -/** - * Created by Kosh on 24 Mar 2017, 9:16 PM - */ - -public class DonationActivity extends BaseActivity { - @BindView(R.id.cardsHolder) View cardsHolder; - @BindView(R.id.appbar) AppBarLayout appBarLayout; - - @Override protected int layout() { - return R.layout.support_development_layout; - } - - @Override protected boolean isTransparent() { - return false; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return true; - } - - @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - AnimHelper.animateVisibility(cardsHolder, true); - checkPurchase(); - } - - @OnClick(R.id.two) void onTwoClicked(View v) { - onProceed(getString(R.string.donation_product_1)); - } - - @OnClick(R.id.five) void onFiveClicked(View v) { - onProceed(getString(R.string.donation_product_2)); - } - - @OnClick(R.id.ten) void onTenClicked(View v) { - onProceed(getString(R.string.donation_product_3)); - } - - @OnClick(R.id.twenty) void onTwentyClicked(View v) { - onProceed(getString(R.string.donation_product_4)); - } - - @OnClick(R.id.premium) void onNavToPremium() { - PremiumActivity.Companion.startActivity(this); - } - - @NonNull @Override public TiPresenter providePresenter() { - return new BasePresenter(); - } - - private void onProceed(@NonNull String productKey) { - if (AppHelper.isGoogleAvailable(this)) { - DonateActivity.Companion.start(this, productKey, null, null); - } else { - showErrorMessage(getString(R.string.google_play_service_error)); - } - } - - private void checkPurchase() { - ((BasePresenter) getPresenter()).manageViewDisposable(RxBillingService.getInstance(this, BuildConfig.DEBUG) - .getPurchases(ProductType.IN_APP) - .subscribe((purchases, throwable) -> { - if (purchases != null && !purchases.isEmpty()) { - for (Purchase purchase : purchases) { - String sku = purchase.sku(); - if (!InputHelper.isEmpty(sku)) { - DonateActivity.Companion.enableProduct(sku, App.getInstance()); - } - } - } - })); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/drawer/AccountDrawerFragment.kt b/app/src/main/java/com/fastaccess/ui/modules/main/drawer/AccountDrawerFragment.kt deleted file mode 100644 index 9cd674765..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/drawer/AccountDrawerFragment.kt +++ /dev/null @@ -1,132 +0,0 @@ -package com.fastaccess.ui.modules.main.drawer - -import android.content.Intent -import android.os.Bundle -import android.view.View -import com.fastaccess.R -import com.fastaccess.data.dao.model.Login -import com.fastaccess.data.dao.model.PinnedRepos -import com.fastaccess.helper.PrefGetter -import com.fastaccess.helper.RxHelper -import com.fastaccess.provider.scheme.SchemeParser -import com.fastaccess.ui.adapter.LoginAdapter -import com.fastaccess.ui.adapter.PinnedReposAdapter -import com.fastaccess.ui.base.BaseActivity -import com.fastaccess.ui.base.BaseFragment -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import com.fastaccess.ui.modules.login.chooser.LoginChooserActivity -import com.fastaccess.ui.modules.main.MainMvp -import com.fastaccess.ui.modules.main.premium.PremiumActivity -import com.fastaccess.ui.modules.pinned.PinnedReposActivity -import com.fastaccess.ui.modules.user.UserPagerActivity -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder -import kotlinx.android.synthetic.main.accounts_menu_layout.* - -/** - * Created by Kosh on 25.03.18. - */ -class AccountDrawerFragment : BaseFragment>(), - BaseViewHolder.OnItemClickListener { - - private val pinnedListAdapter = PinnedReposAdapter(true) - private val adapter = LoginAdapter(true) - private val userModel by lazy { Login.getUser() } - - override fun fragmentLayout() = R.layout.accounts_menu_layout - - override fun providePresenter() = BasePresenter() - - override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { - pinnedListAdapter.listener = this - pinnedList.adapter = pinnedListAdapter - - adapter.listener = object : BaseViewHolder.OnItemClickListener { - override fun onItemLongClick(position: Int, v: View?, item: Login?) {} - - override fun onItemClick(position: Int, v: View?, item: Login) { - presenter.manageViewDisposable(RxHelper.getObservable(Login.onMultipleLogin(item, item.isIsEnterprise, false)) - .doOnSubscribe { showProgress(0) } - .doOnComplete { hideProgress() } - .subscribe({ (activity as? BaseActivity<*, *>?)?.onRestartApp() }, ::println)) - } - } - accLists.adapter = adapter - - logout.setOnClickListener { - postDelayedAndClose { - activity?.let { - (it as? BaseActivity<*, *>)?.onLogoutPressed() - } - } - } - togglePinned?.setOnClickListener { - postDelayedAndClose { PinnedReposActivity.startActivity(it.context) } - } - addAccLayout.setOnClickListener { - postDelayedAndClose { - if (PrefGetter.isProEnabled() || PrefGetter.isEnterpriseEnabled()) { - val intent = Intent(it.context, LoginChooserActivity::class.java) - intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP - startActivity(intent) - } else { - startActivity(Intent(it.context, PremiumActivity::class.java)) - } - } - } - repos.setOnClickListener { - postDelayedAndClose { - UserPagerActivity.startActivity(it.context, userModel.login, false, PrefGetter.isEnterprise(), 2) - } - } - starred.setOnClickListener { - postDelayedAndClose { - UserPagerActivity.startActivity(it.context, userModel.login, false, PrefGetter.isEnterprise(), 3) - } - } - - loadAccount() - loadPinned() - } - - override fun onItemClick(position: Int, v: View?, item: PinnedRepos?) { - if (v != null && item != null) { - postDelayedAndClose { SchemeParser.launchUri(v.context, item.pinnedRepo.htmlUrl) } - } - } - - override fun onItemLongClick(position: Int, v: View?, item: PinnedRepos?) = Unit - - override fun setUserVisibleHint(isVisibleToUser: Boolean) { - super.setUserVisibleHint(isVisibleToUser) - if (isVisibleToUser) { - loadPinned() - } - } - - private fun loadAccount() { - presenter.manageViewDisposable(Login.getAccounts() - .doOnComplete { - if (!adapter.isEmpty) { - toggleAccountsLayout.visibility = View.VISIBLE - } else { - toggleAccountsLayout.visibility = View.GONE - } - } - .subscribe({ adapter.addItem(it) }, ::print)) - } - - private fun loadPinned() { - presenter?.manageViewDisposable(PinnedRepos.getMenuRepos() - .subscribe({ pinnedListAdapter.insertItems(it) }, ::println)) - } - - private fun closeDrawer() { - val activity = activity as? BaseActivity<*, *>? ?: return - activity.closeDrawer() - } - - private fun postDelayedAndClose(method: () -> Unit) { - closeDrawer() - view?.postDelayed({ method.invoke() }, 250) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/drawer/MainDrawerFragment.kt b/app/src/main/java/com/fastaccess/ui/modules/main/drawer/MainDrawerFragment.kt deleted file mode 100644 index 42ae79344..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/drawer/MainDrawerFragment.kt +++ /dev/null @@ -1,82 +0,0 @@ -package com.fastaccess.ui.modules.main.drawer - -import android.content.Intent -import android.os.Bundle -import com.google.android.material.navigation.NavigationView -import android.view.MenuItem -import android.view.View -import com.fastaccess.R -import com.fastaccess.data.dao.model.Login -import com.fastaccess.helper.PrefGetter -import com.fastaccess.ui.base.BaseActivity -import com.fastaccess.ui.base.BaseFragment -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import com.fastaccess.ui.modules.about.FastHubAboutActivity -import com.fastaccess.ui.modules.gists.GistsListActivity -import com.fastaccess.ui.modules.main.MainActivity -import com.fastaccess.ui.modules.main.MainMvp -import com.fastaccess.ui.modules.main.donation.CheckPurchaseActivity -import com.fastaccess.ui.modules.main.playstore.PlayStoreWarningActivity -import com.fastaccess.ui.modules.notification.NotificationActivity -import com.fastaccess.ui.modules.pinned.PinnedReposActivity -import com.fastaccess.ui.modules.repos.RepoPagerActivity -import com.fastaccess.ui.modules.repos.RepoPagerMvp -import com.fastaccess.ui.modules.repos.issues.create.CreateIssueActivity -import com.fastaccess.ui.modules.trending.TrendingActivity -import com.fastaccess.ui.modules.user.UserPagerActivity -import kotlinx.android.synthetic.main.main_nav_fragment_layout.* - -/** - * Created by Kosh on 25.03.18. - */ -class MainDrawerFragment : BaseFragment>(), NavigationView.OnNavigationItemSelectedListener { - - private val userModel by lazy { Login.getUser() } - - override fun fragmentLayout() = R.layout.main_nav_fragment_layout - - override fun providePresenter() = BasePresenter() - - override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { - mainNav.setNavigationItemSelectedListener(this) - } - - override fun onNavigationItemSelected(item: MenuItem): Boolean { - val activity = activity as? BaseActivity<*, *>? ?: return false - activity.closeDrawer() - if (item.isChecked) return false - mainNav.postDelayed({ - if (!activity.isFinishing()) { - when { - item.itemId == R.id.navToRepo -> activity.onNavToRepoClicked() - item.itemId == R.id.gists -> GistsListActivity.startActivity(activity) - item.itemId == R.id.pinnedMenu -> PinnedReposActivity.startActivity(activity) - item.itemId == R.id.mainView -> { - if (activity !is MainActivity) { - val intent = Intent(activity, MainActivity::class.java) - intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP - activity.startActivity(intent) - activity.finish() - } - } - item.itemId == R.id.profile -> userModel?.let { - UserPagerActivity.startActivity(activity, it.login, false, PrefGetter.isEnterprise(), 0) - } - item.itemId == R.id.settings -> activity.onOpenSettings() - item.itemId == R.id.about -> activity.startActivity(Intent(activity, FastHubAboutActivity::class.java)) - item.itemId == R.id.orgs -> activity.onOpenOrgsDialog() - item.itemId == R.id.notifications -> activity.startActivity(Intent(activity, NotificationActivity::class.java)) - item.itemId == R.id.trending -> activity.startActivity(Intent(activity, TrendingActivity::class.java)) - item.itemId == R.id.openFatHub -> activity.startActivity( - RepoPagerActivity.createIntent(activity, "FastHub", "k0shk0sh", RepoPagerMvp.ISSUES) - ) - item.itemId == R.id.faq -> activity.startActivity(Intent(activity, PlayStoreWarningActivity::class.java)) - item.itemId == R.id.restorePurchase -> activity.startActivity(Intent(activity, CheckPurchaseActivity::class.java)) - } - } - }, 250) - return true - } - - fun getMenu() = mainNav?.menu -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/issues/MyIssuesFragment.java b/app/src/main/java/com/fastaccess/ui/modules/main/issues/MyIssuesFragment.java deleted file mode 100644 index 2a349bda0..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/issues/MyIssuesFragment.java +++ /dev/null @@ -1,198 +0,0 @@ -package com.fastaccess.ui.modules.main.issues; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.data.dao.types.MyIssuesType; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.IssuesAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; -import com.fastaccess.ui.modules.repos.extras.popup.IssuePopupFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 25 Mar 2017, 11:48 PM - */ - -public class MyIssuesFragment extends BaseFragment implements MyIssuesMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - @State IssueState issueState; - private OnLoadMore onLoadMore; - private IssuesAdapter adapter; - private MyIssuesType issuesType; - private RepoPagerMvp.TabsBadgeListener tabsBadgeListener; - - public static MyIssuesFragment newInstance(@NonNull IssueState issueState, @NonNull MyIssuesType issuesType) { - MyIssuesFragment view = new MyIssuesFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.EXTRA, issueState) - .put(BundleConstant.EXTRA_TWO, issuesType) - .end()); - return view; - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() instanceof RepoPagerMvp.TabsBadgeListener) { - tabsBadgeListener = (RepoPagerMvp.TabsBadgeListener) getParentFragment(); - } else if (context instanceof RepoPagerMvp.TabsBadgeListener) { - tabsBadgeListener = (RepoPagerMvp.TabsBadgeListener) context; - } - } - - @Override public void onDetach() { - tabsBadgeListener = null; - super.onDetach(); - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, issueState); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter()); - } - onLoadMore.setParameter(issueState); - return onLoadMore; - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (savedInstanceState == null) { - issueState = (IssueState) getArguments().getSerializable(BundleConstant.EXTRA); - } - getPresenter().onSetIssueType(getIssuesType()); - stateLayout.setEmptyText(R.string.no_issues); - recycler.setEmptyView(stateLayout, refresh); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - adapter = new IssuesAdapter(getPresenter().getIssues(), false, true); - adapter.setListener(getPresenter()); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.setAdapter(adapter); - recycler.addDivider(); - recycler.addOnScrollListener(getLoadMore()); - if (savedInstanceState == null || (getPresenter().getIssues().isEmpty() && !getPresenter().isApiCalled())) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public MyIssuesPresenter providePresenter() { - return new MyIssuesPresenter(); - } - - @Override public void onSetCount(int totalCount) { - if (tabsBadgeListener != null) { - switch (getIssuesType()) { - case CREATED: - tabsBadgeListener.onSetBadge(0, totalCount); - break; - case ASSIGNED: - tabsBadgeListener.onSetBadge(1, totalCount); - break; - case MENTIONED: - tabsBadgeListener.onSetBadge(2, totalCount); - break; - case PARTICIPATED: - tabsBadgeListener.onSetBadge(3, totalCount); - break; - } - } - } - - @Override public void onFilterIssue(@NonNull IssueState issueState) { - if (this.issueState != null && this.issueState != issueState) { - this.issueState = issueState; - getArguments().putSerializable(BundleConstant.ITEM, issueState); - getLoadMore().reset(); - adapter.clear(); - onRefresh(); - } - } - - @Override public void onShowPopupDetails(@NonNull Issue item) { - IssuePopupFragment.showPopup(getChildFragmentManager(), item); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private MyIssuesType getIssuesType() { - if (issuesType == null) { - issuesType = (MyIssuesType) getArguments().getSerializable(BundleConstant.EXTRA_TWO); - } - return issuesType; - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/issues/MyIssuesMvp.java b/app/src/main/java/com/fastaccess/ui/modules/main/issues/MyIssuesMvp.java deleted file mode 100644 index 57a999f66..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/issues/MyIssuesMvp.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.fastaccess.ui.modules.main.issues; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.data.dao.types.MyIssuesType; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 25 Mar 2017, 11:39 PM - */ - -public interface MyIssuesMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - - void onSetCount(int totalCount); - - void onFilterIssue(@NonNull IssueState issueState); - - void onShowPopupDetails(@NonNull Issue item); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getIssues(); - - void onSetIssueType(@NonNull MyIssuesType issuesType); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/issues/MyIssuesPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/main/issues/MyIssuesPresenter.java deleted file mode 100644 index 14f59bbeb..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/issues/MyIssuesPresenter.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.fastaccess.ui.modules.main.issues; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.data.dao.types.MyIssuesType; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.provider.rest.RepoQueryProvider; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 25 Mar 2017, 11:39 PM - */ - -public class MyIssuesPresenter extends BasePresenter implements MyIssuesMvp.Presenter { - - private ArrayList issues = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - @com.evernote.android.state.State MyIssuesType issuesType; - @NonNull private String login = Login.getUser().getLogin(); - - MyIssuesPresenter() { - setEnterprise(PrefGetter.isEnterprise()); - } - - @Override public void onItemClick(int position, View v, Issue item) { - SchemeParser.launchUri(v.getContext(), item.getHtmlUrl()); - } - - @Override public void onItemLongClick(int position, View v, Issue item) { - if (getView() != null) getView().onShowPopupDetails(item); - } - - @NonNull @Override public ArrayList getIssues() { - return issues; - } - - @Override public void onSetIssueType(@NonNull MyIssuesType issuesType) { - this.issuesType = issuesType; - } - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public boolean onCallApi(int page, @Nullable IssueState parameter) { - if (parameter == null) { - throw new NullPointerException("parameter is null"); - } - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - if (page > lastPage || lastPage == 0) { - sendToView(MyIssuesMvp.View::hideProgress); - return false; - } - setCurrentPage(page); - makeRestCall(RestProvider.getIssueService(isEnterprise()).getIssuesWithCount(getUrl(parameter), page), issues -> { - lastPage = issues.getLast(); - if (getCurrentPage() == 1) { - sendToView(view -> view.onSetCount(issues.getTotalCount())); - } - sendToView(view -> view.onNotifyAdapter(issues.getItems(), page)); - }); - return true; - } - - @NonNull private String getUrl(@NonNull IssueState parameter) { - switch (issuesType) { - case CREATED: - return RepoQueryProvider.getMyIssuesPullRequestQuery(login, parameter, false); - case ASSIGNED: - return RepoQueryProvider.getAssigned(login, parameter, false); - case MENTIONED: - return RepoQueryProvider.getMentioned(login, parameter, false); - case PARTICIPATED: - return RepoQueryProvider.getParticipated(login, parameter, false); - } - return RepoQueryProvider.getMyIssuesPullRequestQuery(login, parameter, false); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/issues/pager/MyIssuesPagerFragment.java b/app/src/main/java/com/fastaccess/ui/modules/main/issues/pager/MyIssuesPagerFragment.java deleted file mode 100644 index 5d3fe7507..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/issues/pager/MyIssuesPagerFragment.java +++ /dev/null @@ -1,195 +0,0 @@ -package com.fastaccess.ui.modules.main.issues.pager; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.tabs.TabLayout; -import androidx.viewpager.widget.ViewPager; -import android.view.MenuInflater; -import android.view.View; -import android.widget.PopupMenu; -import android.widget.TextView; - -import com.annimon.stream.Stream; -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.FragmentPagerAdapterModel; -import com.fastaccess.data.dao.TabsCountStateModel; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.ui.adapter.FragmentsPagerAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.main.issues.MyIssuesFragment; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.ViewPagerView; - -import java.util.HashSet; - -import butterknife.BindView; - -/** - * Created by Kosh on 26 Mar 2017, 12:14 AM - */ - -public class MyIssuesPagerFragment extends BaseFragment implements MyIssuesPagerMvp.View { - - public static final String TAG = MyIssuesPagerFragment.class.getSimpleName(); - - @BindView(R.id.tabs) TabLayout tabs; - @BindView(R.id.pager) ViewPagerView pager; - @State HashSet counts = new HashSet<>(); - - public static MyIssuesPagerFragment newInstance() { - return new MyIssuesPagerFragment(); - } - - @Override protected int fragmentLayout() { - return R.layout.tabbed_viewpager; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - FragmentsPagerAdapter adapter = new FragmentsPagerAdapter(getChildFragmentManager(), - FragmentPagerAdapterModel.buildForMyIssues(getContext())); - pager.setAdapter(adapter); - //noinspection deprecation - tabs.setTabsFromPagerAdapter(adapter); - tabs.setTabGravity(TabLayout.GRAVITY_FILL); - tabs.setTabMode(TabLayout.MODE_SCROLLABLE); - if (savedInstanceState == null) { - tabs.getTabAt(0).select(); - } - pager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { - @Override public void onPageSelected(int position) { - super.onPageSelected(position); - selectTab(position, true); - } - }); - tabs.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { - @Override public void onTabSelected(TabLayout.Tab tab) { - if (tab.getTag() == null) { - int position = tab.getPosition(); - selectTab(position, false); - } - tab.setTag(null); - } - - @Override public void onTabUnselected(TabLayout.Tab tab) {} - - @Override public void onTabReselected(TabLayout.Tab tab) { - selectTab(tab.getPosition(), false); - } - }); - if (savedInstanceState != null && !counts.isEmpty()) { - Stream.of(counts).forEach(this::updateCount); - } - } - - @NonNull @Override public MyIssuesPagerPresenter providePresenter() { - return new MyIssuesPagerPresenter(); - } - - @Override public void onSetBadge(int tabIndex, int count) { - TabsCountStateModel model = getModelAtIndex(tabIndex); - if (model == null) { - model = new TabsCountStateModel(); - } - model.setTabIndex(tabIndex); - model.setCount(count); - boolean removed = counts.remove(model); - counts.add(model); - if (tabs != null) { - updateCount(model); - } - } - - @Nullable private TabsCountStateModel getModelAtIndex(int index) { - return Stream.of(counts) - .filter(model -> model.getTabIndex() == index) - .findFirst() - .orElse(null); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (pager != null && pager.getAdapter() != null) { - MyIssuesFragment myIssuesFragment = (MyIssuesFragment) pager.getAdapter().instantiateItem(pager, pager.getCurrentItem()); - if (myIssuesFragment != null) { - myIssuesFragment.onScrollTop(0); - } - } - } - - private void selectTab(int position, boolean fromViewPager) { - if (!fromViewPager) { - onShowFilterMenu(getModelAtIndex(position), ViewHelper.getTabTextView(tabs, position)); - pager.setCurrentItem(position); - } else { - TabLayout.Tab tab = tabs.getTabAt(position); - if (tab != null) { - tab.setTag("hello"); - if (!tab.isSelected()) tab.select(); - } - } - } - - private void updateCount(@NonNull TabsCountStateModel model) { - TextView tv = ViewHelper.getTabTextView(tabs, model.getTabIndex()); - String title = getString(R.string.created); - switch (model.getTabIndex()) { - case 0: - title = getString(R.string.created); - break; - case 1: - title = getString(R.string.assigned); - break; - case 2: - title = getString(R.string.mentioned); - break; - case 3: - title = getString(R.string.participated); - } - updateDrawable(model, tv); - tv.setText(SpannableBuilder.builder() - .append(title) - .append(" ") - .append("(") - .bold(String.valueOf(model.getCount())) - .append(")")); - } - - private void onShowFilterMenu(@Nullable TabsCountStateModel model, TextView tv) { - if (model == null) return; - PopupMenu popup = new PopupMenu(getContext(), tv); - MenuInflater inflater = popup.getMenuInflater(); - inflater.inflate(R.menu.filter_issue_state_menu, popup.getMenu()); - popup.setOnMenuItemClickListener(item -> { - if (pager == null || pager.getAdapter() == null) return false; - MyIssuesFragment myIssuesFragment = (MyIssuesFragment) pager.getAdapter().instantiateItem(pager, model.getTabIndex()); - if (myIssuesFragment == null) return false; - switch (item.getItemId()) { - case R.id.opened: - counts.remove(model); - model.setDrawableId(R.drawable.ic_issue_opened_small); - counts.add(model); - updateDrawable(model, tv); - myIssuesFragment.onFilterIssue(IssueState.open); - return true; - case R.id.closed: - counts.remove(model); - model.setDrawableId(R.drawable.ic_issue_closed_small); - counts.add(model); - updateDrawable(model, tv); - myIssuesFragment.onFilterIssue(IssueState.closed); - return true; - } - return false; - }); - popup.show(); - } - - private void updateDrawable(@NonNull TabsCountStateModel model, TextView tv) { - model.setDrawableId(model.getDrawableId() == 0 ? R.drawable.ic_issue_opened_small : model.getDrawableId()); - tv.setCompoundDrawablePadding(16); - tv.setCompoundDrawablesWithIntrinsicBounds(model.getDrawableId(), 0, R.drawable.ic_arrow_drop_down, 0); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/issues/pager/MyIssuesPagerMvp.java b/app/src/main/java/com/fastaccess/ui/modules/main/issues/pager/MyIssuesPagerMvp.java deleted file mode 100644 index b6527f3f0..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/issues/pager/MyIssuesPagerMvp.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.fastaccess.ui.modules.main.issues.pager; - -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; - -/** - * Created by Kosh on 26 Mar 2017, 12:15 AM - */ - -public interface MyIssuesPagerMvp { - - interface View extends BaseMvp.FAView, RepoPagerMvp.TabsBadgeListener {} - - interface Presenter {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/issues/pager/MyIssuesPagerPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/main/issues/pager/MyIssuesPagerPresenter.java deleted file mode 100644 index 650e3fab3..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/issues/pager/MyIssuesPagerPresenter.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fastaccess.ui.modules.main.issues.pager; - -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -/** - * Created by Kosh on 26 Mar 2017, 12:17 AM - */ - -public class MyIssuesPagerPresenter extends BasePresenter implements MyIssuesPagerMvp.Presenter {} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/notifications/FastHubNotificationDialog.kt b/app/src/main/java/com/fastaccess/ui/modules/main/notifications/FastHubNotificationDialog.kt deleted file mode 100644 index 267b21207..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/notifications/FastHubNotificationDialog.kt +++ /dev/null @@ -1,77 +0,0 @@ -package com.fastaccess.ui.modules.main.notifications - -import android.os.Bundle -import androidx.fragment.app.FragmentManager -import android.text.Html -import android.view.View -import butterknife.OnClick -import com.fastaccess.R -import com.fastaccess.data.dao.model.AbstractFastHubNotification.NotificationType -import com.fastaccess.data.dao.model.FastHubNotification -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.helper.PrefGetter -import com.fastaccess.ui.base.BaseDialogFragment -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import kotlinx.android.synthetic.main.dialog_guide_layout.* - -/** - * Created by Kosh on 17.11.17. - */ -class FastHubNotificationDialog : BaseDialogFragment>() { - - init { - suppressAnimation = true - isCancelable = false - } - - private val model by lazy { arguments?.getParcelable(BundleConstant.ITEM) } - - @OnClick(R.id.cancel) fun onCancel() { - dismiss() - } - - override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { - model?.let { - title?.text = it.title - description?.text = Html.fromHtml(it.body) - it.isRead = true - FastHubNotification.update(it) - } ?: dismiss() - } - - override fun providePresenter(): BasePresenter = BasePresenter() - - override fun fragmentLayout(): Int = R.layout.dialog_guide_layout - - companion object { - @JvmStatic private val TAG = FastHubNotificationDialog::class.java.simpleName - - fun newInstance(model: FastHubNotification): FastHubNotificationDialog { - val fragment = FastHubNotificationDialog() - fragment.arguments = Bundler.start() - .put(BundleConstant.ITEM, model) - .end() - return fragment - } - - fun show(fragmentManager: FragmentManager, model: FastHubNotification? = null) { - val notification = model ?: FastHubNotification.getLatest() - notification?.let { - if (it.type == NotificationType.PROMOTION || it.type == NotificationType.PURCHASE && model == null) { - if (PrefGetter.isProEnabled()) { - it.isRead = true - FastHubNotification.update(it) - return - } - } - newInstance(it).show(fragmentManager, TAG) - } - } - - fun show(fragmentManager: FragmentManager) { - show(fragmentManager, null) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/orgs/OrgListDialogFragment.java b/app/src/main/java/com/fastaccess/ui/modules/main/orgs/OrgListDialogFragment.java deleted file mode 100644 index 3210e4ac6..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/orgs/OrgListDialogFragment.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.fastaccess.ui.modules.main.orgs; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import androidx.appcompat.widget.Toolbar; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.ui.adapter.UsersAdapter; -import com.fastaccess.ui.base.BaseDialogFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 15 Apr 2017, 1:57 PM - */ - -public class OrgListDialogFragment extends BaseDialogFragment - implements OrgListDialogMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.toolbar) Toolbar toolbar; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private UsersAdapter adapter; - - public static OrgListDialogFragment newInstance() { - return new OrgListDialogFragment(); - } - - @Override public void onNotifyAdapter(@Nullable List items) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - adapter.insertItems(items); - } - - @Override protected int fragmentLayout() { - return R.layout.milestone_dialog_layout; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - toolbar.setTitle(R.string.organizations); - toolbar.inflateMenu(R.menu.add_menu); - toolbar.getMenu().findItem(R.id.add).setIcon(R.drawable.ic_info_outline).setTitle(R.string.no_orgs_dialog_title); - toolbar.setOnMenuItemClickListener(item -> { - MessageDialogView.newInstance(getString(R.string.no_orgs_dialog_title), getString(R.string.no_orgs_description), false, true) - .show(getChildFragmentManager(), MessageDialogView.TAG); - return true; - }); - toolbar.setNavigationIcon(R.drawable.ic_clear); - toolbar.setNavigationOnClickListener(v -> dismiss()); - stateLayout.setEmptyText(R.string.no_orgs); - stateLayout.setOnReloadListener(v -> getPresenter().onLoadOrgs()); - refresh.setOnRefreshListener(() -> getPresenter().onLoadOrgs()); - recycler.setEmptyView(stateLayout, refresh); - adapter = new UsersAdapter(getPresenter().getOrgs()); - recycler.setAdapter(adapter); - recycler.addKeyLineDivider(); - if (savedInstanceState == null) { - getPresenter().onLoadOrgs(); - } - fastScroller.attachRecyclerView(recycler); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public OrgListDialogPresenter providePresenter() { - return new OrgListDialogPresenter(); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/orgs/OrgListDialogMvp.java b/app/src/main/java/com/fastaccess/ui/modules/main/orgs/OrgListDialogMvp.java deleted file mode 100644 index 1d1ef665f..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/orgs/OrgListDialogMvp.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.fastaccess.ui.modules.main.orgs; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.ui.base.mvp.BaseMvp; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 15 Apr 2017, 1:53 PM - */ - -public interface OrgListDialogMvp { - - interface View extends BaseMvp.FAView { - void onNotifyAdapter(@Nullable List items); - - } - - interface Presenter { - void onLoadOrgs(); - - @NonNull ArrayList getOrgs(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/orgs/OrgListDialogPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/main/orgs/OrgListDialogPresenter.java deleted file mode 100644 index 4898dac54..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/orgs/OrgListDialogPresenter.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.fastaccess.ui.modules.main.orgs; - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; -import java.util.List; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 15 Apr 2017, 1:54 PM - */ - -public class OrgListDialogPresenter extends BasePresenter implements OrgListDialogMvp.Presenter { - private ArrayList orgs = new ArrayList<>(); - - @Override public void onLoadOrgs() { - makeRestCall(RestProvider.getOrgService(PrefGetter.isEnterprise()).getMyOrganizations() - .flatMap(userPageable -> { - if (userPageable != null && userPageable.getItems() != null) { - return Observable.fromIterable(userPageable.getItems()); - } - return Observable.empty(); - }) - .map(user -> { - if (user != null) user.setType("Organization"); - return user; - }) - .toList() - .toObservable(), list -> { - List myOrgs = new ArrayList<>(); - if (list != null && !list.isEmpty()) { - myOrgs.addAll(list); - } - sendToView(view -> view.onNotifyAdapter(myOrgs)); - }); - } - - @NonNull @Override public ArrayList getOrgs() { - return orgs; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/playstore/PlayStoreWarningActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/main/playstore/PlayStoreWarningActivity.kt deleted file mode 100644 index a06c4db2e..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/playstore/PlayStoreWarningActivity.kt +++ /dev/null @@ -1,38 +0,0 @@ -package com.fastaccess.ui.modules.main.playstore - -import android.os.Bundle -import android.widget.TextView -import butterknife.OnClick -import com.fastaccess.R -import com.fastaccess.helper.PrefGetter -import com.fastaccess.provider.timeline.HtmlHelper -import com.fastaccess.ui.base.BaseActivity -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.base.mvp.presenter.BasePresenter - -/** - * Created by Hashemsergani on 21.09.17. - */ -class PlayStoreWarningActivity : BaseActivity>() { - - @OnClick(R.id.done) fun onDone() { - PrefGetter.setPlayStoreWarningShowed() - finish() - } - - override fun layout(): Int = R.layout.playstore_review_layout_warning - - override fun isTransparent(): Boolean = true - - override fun canBack(): Boolean = false - - override fun isSecured(): Boolean = true - - override fun providePresenter(): BasePresenter = BasePresenter() - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - val textView = findViewById(R.id.description) - textView.post { HtmlHelper.htmlIntoTextView(textView, getString(R.string.fasthub_faq_description), textView.width) } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/premium/GmsTaskListeners.java b/app/src/main/java/com/fastaccess/ui/modules/main/premium/GmsTaskListeners.java deleted file mode 100644 index 3e8664d4f..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/premium/GmsTaskListeners.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.github.b3er.rxfirebase.common; - -import androidx.annotation.NonNull; -import com.google.android.gms.tasks.OnCompleteListener; -import com.google.android.gms.tasks.Task; -import io.reactivex.CompletableEmitter; -import io.reactivex.SingleEmitter; - -public final class GmsTaskListeners { - - private GmsTaskListeners() { - throw new AssertionError("No instances"); - } - - public static OnCompleteListener listener(@NonNull final SingleEmitter emitter) { - return new OnCompleteListener() { - @Override public void onComplete(@NonNull Task task) { - if (!task.isSuccessful()) { - if (!emitter.isDisposed()) { - emitter.onError(task.getException()); - } - return; - } - - if (!emitter.isDisposed()) { - emitter.onSuccess(task.getResult()); - } - } - }; - } - - public static OnCompleteListener listener(@NonNull final CompletableEmitter emitter) { - return new OnCompleteListener() { - @Override public void onComplete(@NonNull Task task) { - if (!task.isSuccessful()) { - if (!emitter.isDisposed()) { - emitter.onError(task.getException()); - } - return; - } - - if (!emitter.isDisposed()) { - emitter.onComplete(); - } - } - }; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/premium/PremiumActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/main/premium/PremiumActivity.kt deleted file mode 100644 index e94658a06..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/premium/PremiumActivity.kt +++ /dev/null @@ -1,149 +0,0 @@ -package com.fastaccess.ui.modules.main.premium - -import android.annotation.SuppressLint -import android.app.Activity -import android.content.Context -import android.content.Intent -import android.os.Bundle -import android.view.View -import android.widget.Button -import android.widget.FrameLayout -import android.widget.TextView -import androidx.transition.TransitionManager -import butterknife.BindView -import butterknife.OnClick -import com.fastaccess.BuildConfig -import com.fastaccess.R -import com.fastaccess.helper.AppHelper -import com.fastaccess.helper.Logger -import com.fastaccess.helper.RxHelper -import com.fastaccess.ui.base.BaseActivity -import com.fastaccess.ui.modules.main.donation.DonateActivity -import com.miguelbcr.io.rx_billing_service.RxBillingService -import com.miguelbcr.io.rx_billing_service.entities.ProductType -import io.reactivex.Observable -import io.reactivex.disposables.Disposable - -/** - * Created by kosh on 13/07/2017. - */ -class PremiumActivity : BaseActivity(), PremiumMvp.View { - @BindView(R.id.viewGroup) lateinit var viewGroup: FrameLayout - @BindView(R.id.progressLayout) lateinit var progressLayout: View - @BindView(R.id.proPrice) lateinit var proPriceText: TextView - @BindView(R.id.enterprisePrice) lateinit var enterpriseText: TextView - @BindView(R.id.buyAll) lateinit var buyAll: Button - private var disposable: Disposable? = null - private val allFeaturesKey by lazy { getString(R.string.fasthub_all_features_purchase) } - private val enterpriseKey by lazy { getString(R.string.fasthub_enterprise_purchase) } - private val proKey by lazy { getString(R.string.fasthub_pro_purchase) } - - override fun layout(): Int = R.layout.pro_features_layout - - override fun isTransparent(): Boolean = true - - override fun providePresenter(): PremiumPresenter = PremiumPresenter() - - override fun canBack(): Boolean = false - - override fun isSecured(): Boolean = true - - @OnClick(R.id.buyAll) fun onBuyAll() { - if (!isGoogleSupported()) return - val price = buyAll.tag as? Long? - DonateActivity.Companion.start(this, allFeaturesKey, price, buyAll.text.toString()) - } - - @OnClick(R.id.buyPro) fun onBuyPro() { - if (!isGoogleSupported()) return - val price = proPriceText.tag as? Long? - DonateActivity.Companion.start(this, proKey, price, proPriceText.text.toString()) - } - - @OnClick(R.id.buyEnterprise) fun onBuyEnterprise() { - if (!isGoogleSupported()) return - val price = enterpriseText.tag as? Long? - DonateActivity.start(this, enterpriseKey, price, enterpriseText.text.toString()) - } - - @OnClick(R.id.close) fun onClose() = finish() - - @SuppressLint("CheckResult") - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - buyAll.text = getString(R.string.purchase_all).replace("%price%", "$7.99") - RxHelper.getObservable( - RxBillingService.getInstance(this, BuildConfig.DEBUG) - .getSkuDetails(ProductType.IN_APP, arrayListOf(enterpriseKey, proKey, allFeaturesKey)) - .toObservable() - ) - .flatMap { Observable.fromIterable(it) } - .subscribe({ - Logger.e(it.sku(), it.price(), it.priceCurrencyCode(), it.priceAmountMicros()) - when (it.sku()) { - enterpriseKey -> { - enterpriseText.text = it.price() - enterpriseText.tag = it.priceAmountMicros() - } - proKey -> { - proPriceText.text = it.price() - proPriceText.tag = it.priceAmountMicros() - } - allFeaturesKey -> { - buyAll.text = getString(R.string.purchase_all).replace("%price%", it.price()) - buyAll.tag = it.priceAmountMicros() - } - } - }, { t -> t.printStackTrace() }) - } - - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - super.onActivityResult(requestCode, resultCode, data) - if (resultCode == Activity.RESULT_OK) { - successResult() - } - } - - private fun successResult() { - hideProgress() - setResult(Activity.RESULT_OK) - finish() - } - - override fun onSuccessfullyActivated() {} - - override fun onNoMatch() { - hideProgress() - showErrorMessage(getString(R.string.not_match)) - } - - override fun showProgress(resId: Int) { - TransitionManager.beginDelayedTransition(viewGroup) - progressLayout.visibility = View.VISIBLE - } - - override fun hideProgress() { - TransitionManager.beginDelayedTransition(viewGroup) - progressLayout.visibility = View.GONE - } - - override fun onDestroy() { - val disposable = disposable - if (disposable != null && !disposable.isDisposed) disposable.dispose() - super.onDestroy() - } - - private fun isGoogleSupported(): Boolean { - if (AppHelper.isGoogleAvailable(this)) { - return true - } - showErrorMessage(getString(R.string.google_play_service_error)) - return false - } - - companion object { - fun startActivity(context: Context) { - context.startActivity(Intent(context, PremiumActivity::class.java)) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/premium/PremiumMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/main/premium/PremiumMvp.kt deleted file mode 100644 index e5018d73b..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/premium/PremiumMvp.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.fastaccess.ui.modules.main.premium - -import com.fastaccess.ui.base.mvp.BaseMvp - -/** - * Created by kosh on 15/07/2017. - */ -interface PremiumMvp { - - interface View : BaseMvp.FAView { - fun onSuccessfullyActivated() - fun onNoMatch() - } - - interface Presenter { - fun onCheckPromoCode(promo: String) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/premium/PremiumPresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/main/premium/PremiumPresenter.kt deleted file mode 100644 index 9750e59ef..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/premium/PremiumPresenter.kt +++ /dev/null @@ -1,71 +0,0 @@ -package com.fastaccess.ui.modules.main.premium - -import com.fastaccess.data.dao.ProUsersModel -import com.fastaccess.helper.PrefGetter -import com.fastaccess.helper.RxHelper -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import com.github.b3er.rxfirebase.database.data -import com.github.b3er.rxfirebase.database.rxUpdateChildren -import com.google.firebase.database.FirebaseDatabase -import com.google.firebase.database.GenericTypeIndicator -import io.reactivex.Completable -import io.reactivex.Observable - - -/** - * Created by kosh on 15/07/2017. - */ -class PremiumPresenter : BasePresenter(), PremiumMvp.Presenter { - override fun onCheckPromoCode(promo: String) { - val ref = FirebaseDatabase.getInstance().reference - manageDisposable(RxHelper.getObservable(ref.child("fasthub_pro").child(promo) - .data() - .toObservable()) - .doOnSubscribe { sendToView { it.showProgress(0) } } - .flatMap { - var user = ProUsersModel() - if (it.exists() && it.hasChildren()) { - val gti = object : GenericTypeIndicator() {} - user = it.getValue(gti) ?: ProUsersModel() - } - return@flatMap Observable.just(user) - } - .subscribe({ user -> - var completable: Completable? = null - val isAllowed = user.isAllowed - if (isAllowed && !user.isBlocked) { - if (user.type == 1) { - PrefGetter.setProItems() - user.isAllowed = false - user.count = user.count + 1 - completable = ref.child("fasthub_pro") - .rxUpdateChildren(hashMapOf(Pair(promo, user))) - } else { - PrefGetter.setProItems() - PrefGetter.setEnterpriseItem() - user.count = user.count + 1 - completable = ref.child("fasthub_pro") - .rxUpdateChildren(hashMapOf(Pair(promo, user))) - } - } - if (completable != null) { - manageDisposable(completable.doOnComplete({ - if (isAllowed) { - sendToView { it.onSuccessfullyActivated() } - } else { - sendToView { it.onNoMatch() } - } - }).subscribe({}, { it.printStackTrace() })) - } else { - if (isAllowed) { - sendToView { it.onSuccessfullyActivated() } - } else { - if (user.isBlocked) { - PrefGetter.clearPurchases() - } - sendToView { it.onNoMatch() } - } - } - }, { it.printStackTrace() })) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/pullrequests/MyPullRequestFragment.java b/app/src/main/java/com/fastaccess/ui/modules/main/pullrequests/MyPullRequestFragment.java deleted file mode 100644 index 99a93ce26..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/pullrequests/MyPullRequestFragment.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.fastaccess.ui.modules.main.pullrequests; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.data.dao.types.MyIssuesType; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.PullRequestAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; -import com.fastaccess.ui.modules.repos.extras.popup.IssuePopupFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 25 Mar 2017, 11:48 PM - */ - -public class MyPullRequestFragment extends BaseFragment implements MyPullRequestsMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - @State IssueState issueState; - private OnLoadMore onLoadMore; - private PullRequestAdapter adapter; - private RepoPagerMvp.TabsBadgeListener tabsBadgeListener; - - public static MyPullRequestFragment newInstance(@NonNull IssueState issueState, @NonNull MyIssuesType issuesType) { - MyPullRequestFragment view = new MyPullRequestFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.EXTRA, issueState) - .put(BundleConstant.EXTRA_TWO, issuesType) - .end()); - return view; - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() instanceof RepoPagerMvp.TabsBadgeListener) { - tabsBadgeListener = (RepoPagerMvp.TabsBadgeListener) getParentFragment(); - } else if (context instanceof RepoPagerMvp.TabsBadgeListener) { - tabsBadgeListener = (RepoPagerMvp.TabsBadgeListener) context; - } - } - - @Override public void onDetach() { - tabsBadgeListener = null; - super.onDetach(); - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, issueState); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter()); - } - onLoadMore.setParameter(issueState); - return onLoadMore; - } - - @Override public void onSetCount(int totalCount) { - if (tabsBadgeListener != null) { - switch (getIssuesType()) { - case CREATED: - tabsBadgeListener.onSetBadge(0, totalCount); - break; - case ASSIGNED: - tabsBadgeListener.onSetBadge(1, totalCount); - break; - case MENTIONED: - tabsBadgeListener.onSetBadge(2, totalCount); - break; - case REVIEW: - tabsBadgeListener.onSetBadge(3, totalCount); - break; - } - } - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (savedInstanceState == null) { - issueState = (IssueState) getArguments().getSerializable(BundleConstant.EXTRA); - } - getPresenter().onSetPullType(getIssuesType()); - recycler.setEmptyView(stateLayout, refresh); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - adapter = new PullRequestAdapter(getPresenter().getPullRequests(), false, true); - adapter.setListener(getPresenter()); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.setAdapter(adapter); - recycler.addDivider(); - recycler.addOnScrollListener(getLoadMore()); - if (savedInstanceState == null || (getPresenter().getPullRequests().isEmpty() && !getPresenter().isApiCalled())) { - onRefresh(); - } - stateLayout.setEmptyText(getString((R.string.no_pull_requests))); - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public MyPullRequestsPresenter providePresenter() { - return new MyPullRequestsPresenter(); - } - - @Override public void onFilterIssue(@NonNull IssueState issueState) { - if (this.issueState != null && this.issueState != issueState) { - this.issueState = issueState; - getArguments().putSerializable(BundleConstant.ITEM, issueState); - getLoadMore().reset(); - adapter.clear(); - onRefresh(); - } - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - @Override public void onShowPopupDetails(@NonNull PullRequest item) { - IssuePopupFragment.showPopup(getChildFragmentManager(), item); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } - - private MyIssuesType getIssuesType() { - return (MyIssuesType) getArguments().getSerializable(BundleConstant.EXTRA_TWO); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/pullrequests/MyPullRequestsMvp.java b/app/src/main/java/com/fastaccess/ui/modules/main/pullrequests/MyPullRequestsMvp.java deleted file mode 100644 index a5039c96a..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/pullrequests/MyPullRequestsMvp.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.fastaccess.ui.modules.main.pullrequests; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.data.dao.types.MyIssuesType; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 25 Mar 2017, 11:39 PM - */ - -public interface MyPullRequestsMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - - void onSetCount(int totalCount); - - void onFilterIssue(@NonNull IssueState issueState); - - void onShowPopupDetails(@NonNull PullRequest item); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getPullRequests(); - - void onSetPullType(@NonNull MyIssuesType issuesType); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/pullrequests/MyPullRequestsPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/main/pullrequests/MyPullRequestsPresenter.java deleted file mode 100644 index 2eebd7429..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/pullrequests/MyPullRequestsPresenter.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.fastaccess.ui.modules.main.pullrequests; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.data.dao.types.MyIssuesType; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.provider.rest.RepoQueryProvider; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 25 Mar 2017, 11:53 PM - */ - -public class MyPullRequestsPresenter extends BasePresenter implements MyPullRequestsMvp.Presenter { - - private ArrayList pullRequests = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - @com.evernote.android.state.State MyIssuesType issuesType; - @NonNull private String login = Login.getUser().getLogin(); - - MyPullRequestsPresenter() { - setEnterprise(PrefGetter.isEnterprise()); - } - - @Override public void onItemClick(int position, View v, PullRequest item) { - SchemeParser.launchUri(v.getContext(), item.getHtmlUrl()); - } - - @Override public void onItemLongClick(int position, View v, PullRequest item) { - if (getView() != null) getView().onShowPopupDetails(item); - } - - @NonNull @Override public ArrayList getPullRequests() { - return pullRequests; - } - - @Override public void onSetPullType(@NonNull MyIssuesType issuesType) { - this.issuesType = issuesType; - } - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public boolean onCallApi(int page, @Nullable IssueState parameter) { - if (parameter == null) { - throw new NullPointerException("Parameter is null"); - } - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - if (page > lastPage || lastPage == 0) { - sendToView(MyPullRequestsMvp.View::hideProgress); - return false; - } - setCurrentPage(page); - makeRestCall(RestProvider.getPullRequestService(isEnterprise()).getPullsWithCount(getUrl(parameter), page), response -> { - lastPage = response.getLast(); - if (getCurrentPage() == 1) { - sendToView(view -> view.onSetCount(response.getTotalCount())); - } - sendToView(view -> view.onNotifyAdapter(response.getItems(), page)); - }); - return true; - } - - @NonNull private String getUrl(@NonNull IssueState parameter) { - switch (issuesType) { - case CREATED: - return RepoQueryProvider.getMyIssuesPullRequestQuery(login, parameter, true); - case ASSIGNED: - return RepoQueryProvider.getAssigned(login, parameter, true); - case MENTIONED: - return RepoQueryProvider.getMentioned(login, parameter, true); - case REVIEW: - return RepoQueryProvider.getReviewRequests(login, parameter); - } - return RepoQueryProvider.getMyIssuesPullRequestQuery(login, parameter, false); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/pullrequests/pager/MyPullsPagerFragment.java b/app/src/main/java/com/fastaccess/ui/modules/main/pullrequests/pager/MyPullsPagerFragment.java deleted file mode 100644 index 0cca8ff87..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/pullrequests/pager/MyPullsPagerFragment.java +++ /dev/null @@ -1,196 +0,0 @@ -package com.fastaccess.ui.modules.main.pullrequests.pager; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.tabs.TabLayout; -import androidx.viewpager.widget.ViewPager; -import android.view.MenuInflater; -import android.view.View; -import android.widget.PopupMenu; -import android.widget.TextView; - -import com.annimon.stream.Stream; -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.FragmentPagerAdapterModel; -import com.fastaccess.data.dao.TabsCountStateModel; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.ui.adapter.FragmentsPagerAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.main.pullrequests.MyPullRequestFragment; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.ViewPagerView; - -import java.util.HashSet; - -import butterknife.BindView; - -/** - * Created by Kosh on 26 Mar 2017, 12:14 AM - */ - -public class MyPullsPagerFragment extends BaseFragment implements MyPullsPagerMvp.View { - - public static final String TAG = MyPullsPagerFragment.class.getSimpleName(); - - @BindView(R.id.tabs) TabLayout tabs; - @BindView(R.id.pager) ViewPagerView pager; - @State HashSet counts = new HashSet<>(); - - public static MyPullsPagerFragment newInstance() { - return new MyPullsPagerFragment(); - } - - @Override protected int fragmentLayout() { - return R.layout.tabbed_viewpager; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - FragmentsPagerAdapter adapter = new FragmentsPagerAdapter(getChildFragmentManager(), - FragmentPagerAdapterModel.buildForMyPulls(getContext())); - pager.setAdapter(adapter); - //noinspection deprecation - tabs.setTabsFromPagerAdapter(adapter); - tabs.setTabGravity(TabLayout.GRAVITY_FILL); - tabs.setTabMode(TabLayout.MODE_SCROLLABLE); - if (savedInstanceState == null) { - tabs.getTabAt(0).select(); - } - pager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { - @Override public void onPageSelected(int position) { - super.onPageSelected(position); - selectTab(position, true); - } - }); - tabs.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { - @Override public void onTabSelected(TabLayout.Tab tab) { - if (tab.getTag() == null) { - int position = tab.getPosition(); - selectTab(position, false); - } - tab.setTag(null); - } - - @Override public void onTabUnselected(TabLayout.Tab tab) {} - - @Override public void onTabReselected(TabLayout.Tab tab) { - selectTab(tab.getPosition(), false); - } - }); - if (savedInstanceState != null && !counts.isEmpty()) { - Stream.of(counts).forEach(this::updateCount); - } - } - - @NonNull @Override public MyPullsPagerPresenter providePresenter() { - return new MyPullsPagerPresenter(); - } - - @Override public void onSetBadge(int tabIndex, int count) { - TabsCountStateModel model = getModelAtIndex(tabIndex); - if (model == null) { - model = new TabsCountStateModel(); - } - model.setTabIndex(tabIndex); - model.setCount(count); - boolean removed = counts.remove(model); - counts.add(model); - if (tabs != null) { - updateCount(model); - } - } - - @Nullable private TabsCountStateModel getModelAtIndex(int index) { - return Stream.of(counts) - .filter(model -> model.getTabIndex() == index) - .findFirst() - .orElse(null); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (pager != null && pager.getAdapter() != null) { - MyPullRequestFragment myIssuesFragment = (MyPullRequestFragment) pager.getAdapter().instantiateItem(pager, pager.getCurrentItem()); - if (myIssuesFragment != null) { - myIssuesFragment.onScrollTop(0); - } - } - } - - private void selectTab(int position, boolean fromViewPager) { - if (!fromViewPager) { - onShowFilterMenu(getModelAtIndex(position), ViewHelper.getTabTextView(tabs, position)); - pager.setCurrentItem(position); - } else { - TabLayout.Tab tab = tabs.getTabAt(position); - if (tab != null) { - tab.setTag("hello"); - if (!tab.isSelected()) tab.select(); - } - } - } - - private void updateCount(@NonNull TabsCountStateModel model) { - TextView tv = ViewHelper.getTabTextView(tabs, model.getTabIndex()); - String title = getString(R.string.created); - switch (model.getTabIndex()) { - case 0: - title = getString(R.string.created); - break; - case 1: - title = getString(R.string.assigned); - break; - case 2: - title = getString(R.string.mentioned); - break; - case 3: - title = getString(R.string.review_requests); - break; - } - updateDrawable(model, tv); - tv.setText(SpannableBuilder.builder() - .append(title) - .append(" ") - .append("(") - .bold(String.valueOf(model.getCount())) - .append(")")); - } - - private void onShowFilterMenu(@Nullable TabsCountStateModel model, TextView tv) { - if (model == null) return; - PopupMenu popup = new PopupMenu(getContext(), tv); - MenuInflater inflater = popup.getMenuInflater(); - inflater.inflate(R.menu.filter_issue_state_menu, popup.getMenu()); - popup.setOnMenuItemClickListener(item -> { - if (pager == null || pager.getAdapter() == null) return false; - MyPullRequestFragment myIssuesFragment = (MyPullRequestFragment) pager.getAdapter().instantiateItem(pager, model.getTabIndex()); - if (myIssuesFragment == null) return false; - switch (item.getItemId()) { - case R.id.opened: - counts.remove(model); - model.setDrawableId(R.drawable.ic_issue_opened_small); - counts.add(model); - updateDrawable(model, tv); - myIssuesFragment.onFilterIssue(IssueState.open); - return true; - case R.id.closed: - counts.remove(model); - model.setDrawableId(R.drawable.ic_issue_closed_small); - counts.add(model); - updateDrawable(model, tv); - myIssuesFragment.onFilterIssue(IssueState.closed); - return true; - } - return false; - }); - popup.show(); - } - - private void updateDrawable(@NonNull TabsCountStateModel model, TextView tv) { - model.setDrawableId(model.getDrawableId() == 0 ? R.drawable.ic_issue_opened_small : model.getDrawableId()); - tv.setCompoundDrawablePadding(16); - tv.setCompoundDrawablesWithIntrinsicBounds(model.getDrawableId(), 0, R.drawable.ic_arrow_drop_down, 0); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/pullrequests/pager/MyPullsPagerMvp.java b/app/src/main/java/com/fastaccess/ui/modules/main/pullrequests/pager/MyPullsPagerMvp.java deleted file mode 100644 index caeb8d8e2..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/pullrequests/pager/MyPullsPagerMvp.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.fastaccess.ui.modules.main.pullrequests.pager; - -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; - -/** - * Created by Kosh on 26 Mar 2017, 12:15 AM - */ - -public interface MyPullsPagerMvp { - - interface View extends BaseMvp.FAView, RepoPagerMvp.TabsBadgeListener {} - - interface Presenter {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/pullrequests/pager/MyPullsPagerPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/main/pullrequests/pager/MyPullsPagerPresenter.java deleted file mode 100644 index dca9c89d6..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/pullrequests/pager/MyPullsPagerPresenter.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fastaccess.ui.modules.main.pullrequests.pager; - -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -/** - * Created by Kosh on 26 Mar 2017, 12:17 AM - */ - -public class MyPullsPagerPresenter extends BasePresenter implements MyPullsPagerMvp.Presenter {} diff --git a/app/src/main/java/com/fastaccess/ui/modules/notification/NotificationActivity.java b/app/src/main/java/com/fastaccess/ui/modules/notification/NotificationActivity.java deleted file mode 100644 index 89b005b17..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/notification/NotificationActivity.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.fastaccess.ui.modules.notification; - -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.tabs.TabLayout; -import androidx.fragment.app.Fragment; - -import com.fastaccess.R; -import com.fastaccess.data.dao.FragmentPagerAdapterModel; -import com.fastaccess.data.dao.GroupedNotificationModel; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.ui.adapter.FragmentsPagerAdapter; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.main.MainActivity; -import com.fastaccess.ui.modules.notification.all.AllNotificationsFragment; -import com.fastaccess.ui.modules.notification.callback.OnNotificationChangedListener; -import com.fastaccess.ui.modules.notification.unread.UnreadNotificationsFragment; -import com.fastaccess.ui.widgets.ViewPagerView; - -import net.grandcentrix.thirtyinch.TiPresenter; - -import butterknife.BindView; - -/** - * Created by Kosh on 27 Feb 2017, 12:36 PM - */ - -public class NotificationActivity extends BaseActivity implements OnNotificationChangedListener { - - @BindView(R.id.tabs) TabLayout tabs; - @BindView(R.id.notificationContainer) - ViewPagerView pager; - - @Override protected int layout() { - return R.layout.notification_activity_layout; - } - - @Override protected boolean isTransparent() { - return true; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @NonNull @Override public TiPresenter providePresenter() { - return new BasePresenter(); - } - - @Override protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - AppHelper.cancelNotification(this); - onSelectNotifications(); - setupTabs(); - tabs.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(pager) { - @Override public void onTabReselected(TabLayout.Tab tab) { - super.onTabReselected(tab); - onScrollTop(tab.getPosition()); - } - }); - } - - @Override public void onScrollTop(int index) { - if (pager == null || pager.getAdapter() == null) return; - Fragment fragment = (BaseFragment) pager.getAdapter().instantiateItem(pager, index); - if (fragment instanceof BaseFragment) { - ((BaseFragment) fragment).onScrollTop(index); - } - } - - @Override public void onBackPressed() { - if (isTaskRoot()) { - startActivity(new Intent(this, MainActivity.class)); - } - super.onBackPressed(); - } - - @Override public void onNotificationChanged(@NonNull GroupedNotificationModel notification, int index) { - if (pager != null && pager.getAdapter() != null) { - if (index == 0) { - UnreadNotificationsFragment fragment = (UnreadNotificationsFragment) pager.getAdapter().instantiateItem(pager, 0); - fragment.onNotifyNotificationChanged(notification); - } else { - AllNotificationsFragment fragment = (AllNotificationsFragment) pager.getAdapter().instantiateItem(pager, 1); - fragment.onNotifyNotificationChanged(notification); - } - } - } - - private void setupTabs() { - pager.setAdapter(new FragmentsPagerAdapter(getSupportFragmentManager(), - FragmentPagerAdapterModel.buildForNotifications(this))); - tabs.setupWithViewPager(pager); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/notification/all/AllNotificationsFragment.java b/app/src/main/java/com/fastaccess/ui/modules/notification/all/AllNotificationsFragment.java deleted file mode 100644 index ee212016f..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/notification/all/AllNotificationsFragment.java +++ /dev/null @@ -1,201 +0,0 @@ -package com.fastaccess.ui.modules.notification.all; - -import android.content.Context; -import android.net.Uri; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.View; - -import com.annimon.stream.Stream; -import com.fastaccess.R; -import com.fastaccess.data.dao.GroupedNotificationModel; -import com.fastaccess.data.dao.model.Notification; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.ObjectsCompat; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.provider.tasks.notification.ReadNotificationService; -import com.fastaccess.ui.adapter.NotificationsAdapter; -import com.fastaccess.ui.adapter.viewholder.NotificationsViewHolder; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.notification.callback.OnNotificationChangedListener; -import com.fastaccess.ui.widgets.AppbarRefreshLayout; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 20 Feb 2017, 8:50 PM - */ - -public class AllNotificationsFragment extends BaseFragment - implements AllNotificationsMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) AppbarRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private NotificationsAdapter adapter; - private OnNotificationChangedListener onNotificationChangedListener; - - public static AllNotificationsFragment newInstance() { - return new AllNotificationsFragment(); - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (context instanceof OnNotificationChangedListener) { - onNotificationChangedListener = (OnNotificationChangedListener) context; - } - } - - @Override public void onDetach() { - onNotificationChangedListener = null; - super.onDetach(); - } - - @Override public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setHasOptionsMenu(true); - } - - @Override public void onRefresh() { - getPresenter().onCallApi(); - } - - @Override public void onUpdateReadState(GroupedNotificationModel item, int position) { - if (onNotificationChangedListener != null) onNotificationChangedListener.onNotificationChanged(item, 0); - adapter.swapItem(item, position); - } - - @Override public void onNotifyAdapter(@Nullable List items) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - adapter.insertItems(items); - if (isSafe()) getActivity().invalidateOptionsMenu(); - } - - @Override public void onClick(@NonNull String url) { - SchemeParser.launchUri(getContext(), Uri.parse(url), true); - } - - @Override public void onReadNotification(@NonNull Notification notification) { - GroupedNotificationModel model = new GroupedNotificationModel(notification); - if (onNotificationChangedListener != null) onNotificationChangedListener.onNotificationChanged(model, 0); - adapter.swapItem(model); - ReadNotificationService.start(getContext(), notification.getId()); - } - - @Override public void onMarkAllByRepo(@NonNull Repo repo) { - getPresenter().onMarkReadByRepo(adapter.getData(), repo); - } - - @Override public void onNotifyNotificationChanged(@NonNull GroupedNotificationModel notification) { - if (adapter != null) { - adapter.swapItem(notification); - } - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - adapter = new NotificationsAdapter(getPresenter().getNotifications(), true, true); - adapter.setListener(getPresenter()); - refresh.setOnRefreshListener(this); - stateLayout.setEmptyText(R.string.no_notifications); - stateLayout.setOnReloadListener(v -> onRefresh()); - recycler.setEmptyView(stateLayout, refresh); - recycler.setAdapter(adapter); - recycler.addDivider(NotificationsViewHolder.class); - if (savedInstanceState == null || !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public AllNotificationsPresenter providePresenter() { - return new AllNotificationsPresenter(); - } - - @Override public void showProgress(@StringRes int resId) { - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - super.onCreateOptionsMenu(menu, inflater); - inflater.inflate(R.menu.notification_menu, menu); - } - - @Override public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == R.id.readAll) { - if (!adapter.getData().isEmpty()) { - MessageDialogView.newInstance(getString(R.string.mark_all_as_read), getString(R.string.confirm_message), - false, false, Bundler.start() - .put("primary_button", getString(R.string.yes)) - .put("secondary_button", getString(R.string.no)) - .end()) - .show(getChildFragmentManager(), MessageDialogView.TAG); - } - return true; - } - return super.onOptionsItemSelected(item); - } - - @Override public void onPrepareOptionsMenu(Menu menu) { - boolean hasUnread = Stream.of(adapter.getData()) - .filter(ObjectsCompat::nonNull) - .filter(group -> group.getType() == GroupedNotificationModel.ROW) - .anyMatch(group -> group.getNotification().isUnread()); - menu.findItem(R.id.readAll).setVisible(hasUnread); - super.onPrepareOptionsMenu(menu); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (isOk) { - getPresenter().onMarkAllAsRead(adapter.getData()); - } - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/notification/all/AllNotificationsMvp.java b/app/src/main/java/com/fastaccess/ui/modules/notification/all/AllNotificationsMvp.java deleted file mode 100644 index 281a28879..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/notification/all/AllNotificationsMvp.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.fastaccess.ui.modules.notification.all; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.GroupedNotificationModel; -import com.fastaccess.data.dao.model.Notification; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import net.grandcentrix.thirtyinch.callonmainthread.CallOnMainThread; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 19 Feb 2017, 7:53 PM - */ - -public interface AllNotificationsMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener { - - @CallOnMainThread void onNotifyAdapter(@Nullable List items); - - void onUpdateReadState(GroupedNotificationModel item, int position); - - void onClick(@NonNull String url); - - void onReadNotification(@NonNull Notification notification); - - void onMarkAllByRepo(@NonNull Repo repo); - - void onNotifyNotificationChanged(@NonNull GroupedNotificationModel notification); - } - - interface Presenter extends BaseViewHolder.OnItemClickListener { - - void onWorkOffline(); - - @NonNull ArrayList getNotifications(); - - void onCallApi(); - - void onMarkAllAsRead(@NonNull List data); - - void onMarkReadByRepo(@NonNull List data, @NonNull Repo repo); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/notification/all/AllNotificationsPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/notification/all/AllNotificationsPresenter.java deleted file mode 100644 index 28d52901d..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/notification/all/AllNotificationsPresenter.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.fastaccess.ui.modules.notification.all; - -import androidx.annotation.NonNull; - -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.GroupedNotificationModel; -import com.fastaccess.data.dao.NameParser; -import com.fastaccess.data.dao.model.Notification; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.tasks.notification.ReadNotificationService; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.repos.RepoPagerActivity; - -import java.util.ArrayList; -import java.util.List; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 20 Feb 2017, 8:46 PM - */ - -public class AllNotificationsPresenter extends BasePresenter implements AllNotificationsMvp.Presenter { - private final ArrayList notifications = new ArrayList<>(); - - @Override public void onItemClick(int position, View v, GroupedNotificationModel model) { - if (getView() == null) return; - if (model.getType() == GroupedNotificationModel.ROW) { - Notification item = model.getNotification(); - if (v.getId() == R.id.markAsRead) { - if (item.isUnread() && !PrefGetter.isMarkAsReadEnabled()) { - markAsRead(position, v, item); - } - } else { - if (item.getSubject() != null && item.getSubject().getUrl() != null) { - if (item.isUnread() && !PrefGetter.isMarkAsReadEnabled()) { - markAsRead(position, v, item); - } - if (getView() != null) getView().onClick(item.getSubject().getUrl()); - } - } - } else { - Repo repo = model.getRepo(); - if (repo == null) return; - if (v.getId() == R.id.markAsRead) { - getView().onMarkAllByRepo(repo); - } else { - RepoPagerActivity.startRepoPager(v.getContext(), new NameParser(repo.getUrl())); - } - } - } - - private void markAsRead(int position, View v, Notification item) { - item.setUnread(false); - manageDisposable(item.save(item)); - sendToView(view -> view.onUpdateReadState(new GroupedNotificationModel(item), position)); - ReadNotificationService.start(v.getContext(), item.getId()); - } - - @Override public void onItemLongClick(int position, View v, GroupedNotificationModel item) {} - - @Override public void onError(@NonNull Throwable throwable) { - onWorkOffline(); - super.onError(throwable); - } - - @Override public void onWorkOffline() { - if (notifications.isEmpty()) { - manageDisposable(RxHelper.getObservable(Notification.getAllNotifications().toObservable()) - .flatMap(notifications -> Observable.just(GroupedNotificationModel.construct(notifications))) - .subscribe(models -> sendToView(view -> view.onNotifyAdapter(models)))); - } else { - sendToView(BaseMvp.FAView::hideProgress); - } - } - - @NonNull @Override public ArrayList getNotifications() { - return notifications; - } - - @Override public void onCallApi() { -// Observable> notifications = RestProvider.getNotificationService().getAllNotifications() -// .flatMap(response -> response.getItems() != null ? Observable.fromIterable(response.getItems()) : Observable.empty()) -// .filter(ObjectsCompat::nonNull) -// .flatMap(notification -> RestProvider.getNotificationService().isSubscribed(notification.getId()) -// .onErrorReturn(throwable -> null), -// (notification, subscriptionModel) -> { -// if (subscriptionModel != null) { -// notification.setIsSubscribed(subscriptionModel.isSubscribed()); -// } else { -// notification.setIsSubscribed(true); -// } -// return notification; -// }) -// .toList(); - Observable> observable = RestProvider.getNotificationService(PrefGetter.isEnterprise()) - .getAllNotifications().flatMap(response -> { - manageDisposable(Notification.save(response.getItems())); - if (response.getItems() != null && !response.getItems().isEmpty()) { - return Observable.just(GroupedNotificationModel.construct(response.getItems())); - } - return Observable.empty(); - }); - makeRestCall(observable.doOnComplete(() -> sendToView(BaseMvp.FAView::hideProgress)), response -> sendToView(view -> view.onNotifyAdapter - (response))); - } - - @Override public void onMarkAllAsRead(@NonNull List data) { - manageDisposable(RxHelper.getObservable(Observable.fromIterable(data)) - .filter(group -> group.getType() == GroupedNotificationModel.ROW) - .filter(group -> group.getNotification() != null && group.getNotification().isUnread()) - .map(GroupedNotificationModel::getNotification) - .subscribe(notification -> { - notification.setUnread(false); - manageDisposable(notification.save(notification)); - sendToView(view -> view.onReadNotification(notification)); - }, this::onError)); - } - - @Override public void onMarkReadByRepo(@NonNull List data, @NonNull Repo repo) { - manageDisposable(RxHelper.getObservable(Observable.fromIterable(data)) - .filter(group -> group.getType() == GroupedNotificationModel.ROW) - .filter(group -> group.getNotification() != null && group.getNotification().isUnread()) - .filter(group -> group.getNotification().getRepository().getFullName().equalsIgnoreCase(repo.getFullName())) - .map(GroupedNotificationModel::getNotification) - .subscribe(notification -> { - notification.setUnread(false); - manageDisposable(notification.save(notification)); - sendToView(view -> view.onReadNotification(notification)); - }, this::onError)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/notification/callback/OnNotificationChangedListener.java b/app/src/main/java/com/fastaccess/ui/modules/notification/callback/OnNotificationChangedListener.java deleted file mode 100644 index 80bd317dc..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/notification/callback/OnNotificationChangedListener.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.fastaccess.ui.modules.notification.callback; - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.GroupedNotificationModel; - -public interface OnNotificationChangedListener { - - void onNotificationChanged(@NonNull GroupedNotificationModel notification, int index); -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/notification/fasthub/FastHubNotificationsFragment.kt b/app/src/main/java/com/fastaccess/ui/modules/notification/fasthub/FastHubNotificationsFragment.kt deleted file mode 100644 index 5c15cab54..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/notification/fasthub/FastHubNotificationsFragment.kt +++ /dev/null @@ -1,59 +0,0 @@ -package com.fastaccess.ui.modules.notification.fasthub - -import android.os.Bundle -import android.view.View -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.data.dao.model.FastHubNotification -import com.fastaccess.ui.adapter.FastHubNotificationsAdapter -import com.fastaccess.ui.base.BaseFragment -import com.fastaccess.ui.modules.main.notifications.FastHubNotificationDialog -import com.fastaccess.ui.widgets.AppbarRefreshLayout -import com.fastaccess.ui.widgets.StateLayout -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller - -/** - * Created by Kosh on 19.11.17. - */ -class FastHubNotificationsFragment : BaseFragment(), FastHubNotificationsMvp.View { - - @BindView(R.id.recycler) lateinit var recycler: DynamicRecyclerView - @BindView(R.id.refresh) lateinit var refresh: AppbarRefreshLayout - @BindView(R.id.stateLayout) lateinit var stateLayout: StateLayout - @BindView(R.id.fastScroller) lateinit var fastScroller: RecyclerViewFastScroller - private val adapter by lazy { FastHubNotificationsAdapter(presenter.getData()) } - - override fun fragmentLayout(): Int = R.layout.small_grid_refresh_list - - override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { - adapter.listener = this - stateLayout.setEmptyText(R.string.no_notifications) - recycler.setEmptyView(stateLayout, refresh) - recycler.addDivider() - refresh.setOnRefreshListener { presenter.load() } - stateLayout.setOnReloadListener { presenter.load() } - if (savedInstanceState == null) { - stateLayout.showProgress() - presenter.load() - } - recycler.adapter = adapter - fastScroller.attachRecyclerView(recycler) - } - - override fun providePresenter(): FastHubNotificationsPresenter = FastHubNotificationsPresenter() - - override fun notifyAdapter(items: List?) { - refresh.isRefreshing = false - stateLayout.hideProgress() - if (items != null) { - adapter.insertItems(items) - } else { - adapter.clear() - } - } - - override fun onItemClick(position: Int, v: View?, item: FastHubNotification) = FastHubNotificationDialog.show(childFragmentManager, item) - - override fun onItemLongClick(position: Int, v: View?, item: FastHubNotification) {} -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/notification/fasthub/FastHubNotificationsMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/notification/fasthub/FastHubNotificationsMvp.kt deleted file mode 100644 index 22ad54ab6..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/notification/fasthub/FastHubNotificationsMvp.kt +++ /dev/null @@ -1,20 +0,0 @@ -package com.fastaccess.ui.modules.notification.fasthub - -import com.fastaccess.data.dao.model.FastHubNotification -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created by Kosh on 19.11.17. - */ -interface FastHubNotificationsMvp { - - interface View : BaseMvp.FAView, BaseViewHolder.OnItemClickListener { - fun notifyAdapter(items: List?) - } - - interface Presenter { - fun getData(): List - fun load() - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/notification/fasthub/FastHubNotificationsPresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/notification/fasthub/FastHubNotificationsPresenter.kt deleted file mode 100644 index d5dedd89d..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/notification/fasthub/FastHubNotificationsPresenter.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.fastaccess.ui.modules.notification.fasthub - -import com.fastaccess.data.dao.model.FastHubNotification -import com.fastaccess.ui.base.mvp.presenter.BasePresenter - -/** - * Created by Kosh on 19.11.17. - */ -class FastHubNotificationsPresenter : BasePresenter(), FastHubNotificationsMvp.Presenter { - private val data = mutableListOf() - - override fun getData(): List = data - - override fun load() { - manageObservable(FastHubNotification.getNotifications() - .toList() - .toObservable() - .doOnNext { - sendToView({ v -> v.notifyAdapter(it) }) - }) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/notification/unread/UnreadNotificationMvp.java b/app/src/main/java/com/fastaccess/ui/modules/notification/unread/UnreadNotificationMvp.java deleted file mode 100644 index 61b38a453..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/notification/unread/UnreadNotificationMvp.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.fastaccess.ui.modules.notification.unread; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.GroupedNotificationModel; -import com.fastaccess.data.dao.model.Notification; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import net.grandcentrix.thirtyinch.callonmainthread.CallOnMainThread; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 25 Apr 2017, 3:51 PM - */ - -public interface UnreadNotificationMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener { - @CallOnMainThread void onNotifyAdapter(@Nullable List items); - - void onRemove(int position); - - void onReadNotification(@NonNull Notification notification); - - void onClick(@NonNull String url); - - void onNotifyNotificationChanged(@NonNull GroupedNotificationModel notification); - } - - interface Presenter extends BaseViewHolder.OnItemClickListener { - - void onWorkOffline(); - - @NonNull ArrayList getNotifications(); - - void onMarkAllAsRead(@NonNull List data); - - void onCallApi(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/notification/unread/UnreadNotificationsFragment.java b/app/src/main/java/com/fastaccess/ui/modules/notification/unread/UnreadNotificationsFragment.java deleted file mode 100644 index 840958735..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/notification/unread/UnreadNotificationsFragment.java +++ /dev/null @@ -1,197 +0,0 @@ -package com.fastaccess.ui.modules.notification.unread; - -import android.content.Context; -import android.net.Uri; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.GroupedNotificationModel; -import com.fastaccess.data.dao.model.Notification; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.provider.tasks.notification.ReadNotificationService; -import com.fastaccess.ui.adapter.NotificationsAdapter; -import com.fastaccess.ui.adapter.viewholder.NotificationsViewHolder; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.notification.callback.OnNotificationChangedListener; -import com.fastaccess.ui.widgets.AppbarRefreshLayout; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 25 Apr 2017, 4:06 PM - */ - -public class UnreadNotificationsFragment extends BaseFragment - implements UnreadNotificationMvp.View { - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) AppbarRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private NotificationsAdapter adapter; - private OnNotificationChangedListener onNotificationChangedListener; - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (context instanceof OnNotificationChangedListener) { - onNotificationChangedListener = (OnNotificationChangedListener) context; - } - } - - @Override public void onDetach() { - onNotificationChangedListener = null; - super.onDetach(); - } - - @Override public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setHasOptionsMenu(true); - } - - @Override public void onNotifyAdapter(@Nullable List items) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - adapter.insertItems(items); - invalidateMenu(); - } - - @Override public void onRemove(int position) { - hideProgress(); - GroupedNotificationModel model = adapter.getItem(position); - if (model != null) { - if (onNotificationChangedListener != null) onNotificationChangedListener.onNotificationChanged(model, 1); - } - adapter.removeItem(position); - invalidateMenu(); - } - - @Override public void onReadNotification(@NonNull Notification notification) { - GroupedNotificationModel model = new GroupedNotificationModel(notification); - if (onNotificationChangedListener != null) onNotificationChangedListener.onNotificationChanged(model, 1); - adapter.removeItem(model); - ReadNotificationService.start(getContext(), notification.getId()); - invalidateMenu(); - } - - @Override public void onClick(@NonNull String url) { - SchemeParser.launchUri(getContext(), Uri.parse(url), true); - } - - @Override public void onNotifyNotificationChanged(@NonNull GroupedNotificationModel notification) { - if (adapter != null) { - adapter.removeItem(notification); - } - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - adapter = new NotificationsAdapter(getPresenter().getNotifications(), false); - adapter.setListener(getPresenter()); - refresh.setOnRefreshListener(this); - stateLayout.setEmptyText(R.string.no_notifications); - stateLayout.setOnReloadListener(v -> onRefresh()); - recycler.setEmptyView(stateLayout, refresh); - recycler.setAdapter(adapter); - recycler.addDivider(NotificationsViewHolder.class); - if (savedInstanceState == null || !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public UnreadNotificationsPresenter providePresenter() { - return new UnreadNotificationsPresenter(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - super.onCreateOptionsMenu(menu, inflater); - inflater.inflate(R.menu.notification_menu, menu); - } - - @Override public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == R.id.readAll) { - if (!adapter.getData().isEmpty()) { - MessageDialogView.newInstance(getString(R.string.mark_all_as_read), getString(R.string.confirm_message), - false, false, Bundler.start() - .put("primary_button", getString(R.string.yes)) - .put("secondary_button", getString(R.string.no)) - .end()) - .show(getChildFragmentManager(), MessageDialogView.TAG); - } - return true; - } - return super.onOptionsItemSelected(item); - } - - @Override public void onPrepareOptionsMenu(Menu menu) { - boolean hasUnread = !adapter.getData().isEmpty(); - menu.findItem(R.id.readAll).setVisible(hasUnread); - super.onPrepareOptionsMenu(menu); - } - - @Override public void onRefresh() { - getPresenter().onCallApi(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (isOk) { - getPresenter().onMarkAllAsRead(adapter.getData()); - } - } - - private void invalidateMenu() { - if (isSafe()) getActivity().invalidateOptionsMenu(); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/notification/unread/UnreadNotificationsPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/notification/unread/UnreadNotificationsPresenter.java deleted file mode 100644 index c3d76aee8..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/notification/unread/UnreadNotificationsPresenter.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.fastaccess.ui.modules.notification.unread; - -import androidx.annotation.NonNull; - -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.GroupedNotificationModel; -import com.fastaccess.data.dao.model.Notification; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.tasks.notification.ReadNotificationService; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; -import java.util.List; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 25 Apr 2017, 3:55 PM - */ - -public class UnreadNotificationsPresenter extends BasePresenter implements UnreadNotificationMvp.Presenter { - private ArrayList notifications = new ArrayList<>(); - - @Override public void onItemClick(int position, View v, GroupedNotificationModel model) { - if (getView() == null) return; - Notification item = model.getNotification(); - if (v.getId() == R.id.markAsRead) { - if (item.isUnread()) markAsRead(position, v, item); - } else { - if (item.getSubject() != null && item.getSubject().getUrl() != null) { - if (item.isUnread() && !PrefGetter.isMarkAsReadEnabled()) { - markAsRead(position, v, item); - } - if (getView() != null) getView().onClick(item.getSubject().getUrl()); - } - } - } - - @Override public void onItemLongClick(int position, View v, GroupedNotificationModel item) {} - - @Override public void onWorkOffline() { - if (notifications.isEmpty()) { - manageDisposable(RxHelper.getObservable(Notification.getUnreadNotifications().toObservable()) - .flatMap(notifications -> Observable.just(GroupedNotificationModel.onlyNotifications(notifications))) - .subscribe(models -> sendToView(view -> view.onNotifyAdapter(models)))); - } else { - sendToView(BaseMvp.FAView::hideProgress); - } - } - - @NonNull @Override public ArrayList getNotifications() { - return notifications; - } - - @Override public void onMarkAllAsRead(@NonNull List data) { - manageDisposable(RxHelper.getObservable(Observable.fromIterable(data)) - .filter(group -> group.getType() == GroupedNotificationModel.ROW) - .filter(group -> group.getNotification() != null && group.getNotification().isUnread()) - .map(GroupedNotificationModel::getNotification) - .subscribe(notification -> { - notification.setUnread(false); - manageDisposable(notification.save(notification)); - sendToView(view -> view.onReadNotification(notification)); - }, this::onError)); - } - - @Override public void onCallApi() { - Observable> observable = RestProvider.getNotificationService(PrefGetter.isEnterprise()) - .getNotifications(ParseDateFormat.getLastWeekDate()).flatMap(response -> { - if (response.getItems() != null) manageDisposable(Notification.save(response.getItems())); - return Observable.just(GroupedNotificationModel.onlyNotifications(response.getItems())); - }); - makeRestCall(observable, response -> sendToView(view -> view.onNotifyAdapter(response))); - } - - private void markAsRead(int position, View v, Notification item) { - item.setUnread(false); - manageDisposable(item.save(item)); - sendToView(view -> view.onRemove(position)); - ReadNotificationService.start(v.getContext(), item.getId()); - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/parser/LinksParserActivity.java b/app/src/main/java/com/fastaccess/ui/modules/parser/LinksParserActivity.java deleted file mode 100644 index bac506f0d..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/parser/LinksParserActivity.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.fastaccess.ui.modules.parser; - -import android.app.Activity; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.widget.Toast; - -import com.fastaccess.App; -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.modules.login.chooser.LoginChooserActivity; - -/** - * Created by Kosh on 09 Dec 2016, 12:31 PM - */ - -public class LinksParserActivity extends Activity { - - @Override protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - if (Login.getUser() == null) { - Toast.makeText(App.getInstance(), R.string.please_login, Toast.LENGTH_SHORT).show(); - startActivity(new Intent(this, LoginChooserActivity.class)); - finish(); - return; - } - onCreate(getIntent()); - } - - @Override protected void onStart() { - super.onStart(); - setVisible(true); - } - - private void onCreate(@Nullable Intent intent) { - if (intent == null || intent.getAction() == null) { - finish(); - return; - } - if (Intent.ACTION_SEND.equals(intent.getAction())) { - try { - String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT); - if (!InputHelper.isEmpty(sharedText)) { - Uri uri = Uri.parse(sharedText); - onUriReceived(uri); - } - } catch (Exception ignored) {} - } else if (intent.getAction().equals(Intent.ACTION_VIEW)) { - if (intent.getData() != null) { - onUriReceived(intent.getData()); - } - } - finish(); - } - - private void onUriReceived(@NonNull Uri uri) { - SchemeParser.launchUri(this, uri, false, true); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/pinned/PinnedReposActivity.java b/app/src/main/java/com/fastaccess/ui/modules/pinned/PinnedReposActivity.java deleted file mode 100644 index f6267c6f0..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/pinned/PinnedReposActivity.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.fastaccess.ui.modules.pinned; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.tabs.TabLayout; - -import com.fastaccess.R; -import com.fastaccess.data.dao.FragmentPagerAdapterModel; -import com.fastaccess.ui.adapter.FragmentsPagerAdapter; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.main.MainActivity; -import com.fastaccess.ui.widgets.ViewPagerView; - -import net.grandcentrix.thirtyinch.TiPresenter; - -import butterknife.BindView; -import shortbread.Shortcut; - -/** - * Created by Kosh on 25 Mar 2017, 11:14 PM - */ - -@Shortcut(id = "pinned", icon = R.drawable.ic_app_shortcut_pinned, shortLabelRes = R.string.pinned, backStack = {MainActivity.class}, rank = 5) -public class PinnedReposActivity extends BaseActivity { - - @BindView(R.id.tabs) TabLayout tabs; - @BindView(R.id.tabbedPager) ViewPagerView tabbedPager; - - public static void startActivity(@NonNull Context context) { - context.startActivity(new Intent(context, PinnedReposActivity.class)); - } - - @Override protected int layout() { - return R.layout.tabbed_pager_layout; - } - - @Override protected boolean isTransparent() { - return true; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @NonNull @Override public TiPresenter providePresenter() { - return new BasePresenter(); - } - - @Override protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - selectPinned(); - tabbedPager.setAdapter(new FragmentsPagerAdapter(getSupportFragmentManager(), FragmentPagerAdapterModel.buildForPinned(this))); - tabs.setupWithViewPager(tabbedPager); - tabs.setPadding(0, 0, 0, 0); - tabs.setTabMode(TabLayout.MODE_SCROLLABLE); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/pinned/gist/PinnedGistFragment.java b/app/src/main/java/com/fastaccess/ui/modules/pinned/gist/PinnedGistFragment.java deleted file mode 100644 index 6c07ea41e..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/pinned/gist/PinnedGistFragment.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.fastaccess.ui.modules.pinned.gist; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.data.dao.model.PinnedGists; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.ui.adapter.GistsAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.widgets.AppbarRefreshLayout; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 25 Mar 2017, 8:04 PM - */ - -public class PinnedGistFragment extends BaseFragment implements PinnedGistMvp.View { - - public static final String TAG = PinnedGistFragment.class.getSimpleName(); - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) AppbarRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private GistsAdapter adapter; - - public static PinnedGistFragment newInstance() { - return new PinnedGistFragment(); - } - - @Override public void onNotifyAdapter(@Nullable List items) { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - if (items != null) adapter.insertItems(items); - else adapter.clear(); - } - - @Override public void onDeletePinnedGist(long id, int position) { - MessageDialogView.newInstance(getString(R.string.delete), getString(R.string.confirm_message), - Bundler.start().put(BundleConstant.YES_NO_EXTRA, true) - .put(BundleConstant.EXTRA, position) - .put(BundleConstant.ID, id) - .end()) - .show(getChildFragmentManager(), MessageDialogView.TAG); - } - - @Override protected int fragmentLayout() { - return R.layout.small_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - adapter = new GistsAdapter(getPresenter().getPinnedGists()); - adapter.setListener(getPresenter()); - stateLayout.setEmptyText(R.string.no_gists); - recycler.setEmptyView(stateLayout, refresh); - recycler.setAdapter(adapter); - recycler.addKeyLineDivider(); - refresh.setOnRefreshListener(() -> getPresenter().onReload()); - stateLayout.setOnReloadListener(v -> getPresenter().onReload()); - if (savedInstanceState == null) { - stateLayout.showProgress(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public PinnedGistPresenter providePresenter() { - return new PinnedGistPresenter(); - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (bundle != null && isOk) { - long id = bundle.getLong(BundleConstant.ID); - int position = bundle.getInt(BundleConstant.EXTRA); - PinnedGists.delete(id); - adapter.removeItem(position); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/pinned/gist/PinnedGistMvp.java b/app/src/main/java/com/fastaccess/ui/modules/pinned/gist/PinnedGistMvp.java deleted file mode 100644 index 089a79e0a..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/pinned/gist/PinnedGistMvp.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.fastaccess.ui.modules.pinned.gist; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 25 Mar 2017, 7:57 PM - */ - -public interface PinnedGistMvp { - - interface View extends BaseMvp.FAView { - void onNotifyAdapter(@Nullable List items); - - void onDeletePinnedGist(long id, int position); - } - - interface Presenter extends BaseViewHolder.OnItemClickListener { - @NonNull ArrayList getPinnedGists(); - - void onReload(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/pinned/gist/PinnedGistPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/pinned/gist/PinnedGistPresenter.java deleted file mode 100644 index 1b878524b..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/pinned/gist/PinnedGistPresenter.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.fastaccess.ui.modules.pinned.gist; - -import androidx.annotation.NonNull; -import android.view.View; - -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.data.dao.model.PinnedGists; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 25 Mar 2017, 8:00 PM - */ - -public class PinnedGistPresenter extends BasePresenter implements PinnedGistMvp.Presenter { - private ArrayList issues = new ArrayList<>(); - - @Override protected void onAttachView(@NonNull PinnedGistMvp.View view) { - super.onAttachView(view); - if (issues.isEmpty()) { - onReload(); - } - } - - @NonNull @Override public ArrayList getPinnedGists() { - return issues; - } - - @Override public void onReload() { - manageDisposable(PinnedGists.getMyPinnedGists() - .subscribe(repos -> sendToView(view -> view.onNotifyAdapter(repos)), throwable -> - sendToView(view -> view.onNotifyAdapter(null)))); - } - - @Override public void onItemClick(int position, View v, Gist item) { - SchemeParser.launchUri(v.getContext(), !InputHelper.isEmpty(item.getHtmlUrl()) ? item.getHtmlUrl() : item.getUrl()); - } - - @Override public void onItemLongClick(int position, View v, Gist item) { - if (getView() != null) { - getView().onDeletePinnedGist(item.getId(), position); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/pinned/issue/PinnedIssueFragment.java b/app/src/main/java/com/fastaccess/ui/modules/pinned/issue/PinnedIssueFragment.java deleted file mode 100644 index 550fadf38..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/pinned/issue/PinnedIssueFragment.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.fastaccess.ui.modules.pinned.issue; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.PinnedIssues; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.ui.adapter.IssuesAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.widgets.AppbarRefreshLayout; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 25 Mar 2017, 8:04 PM - */ - -public class PinnedIssueFragment extends BaseFragment implements PinnedIssueMvp.View { - - public static final String TAG = PinnedIssueFragment.class.getSimpleName(); - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) AppbarRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private IssuesAdapter adapter; - - public static PinnedIssueFragment newInstance() { - return new PinnedIssueFragment(); - } - - @Override public void onNotifyAdapter(@Nullable List items) { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - if (items != null) adapter.insertItems(items); - else adapter.clear(); - } - - @Override public void onDeletePinnedIssue(long id, int position) { - MessageDialogView.newInstance(getString(R.string.delete), getString(R.string.confirm_message), - Bundler.start().put(BundleConstant.YES_NO_EXTRA, true) - .put(BundleConstant.EXTRA, position) - .put(BundleConstant.ID, id) - .end()) - .show(getChildFragmentManager(), MessageDialogView.TAG); - } - - @Override protected int fragmentLayout() { - return R.layout.small_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - adapter = new IssuesAdapter(getPresenter().getPinnedIssue(), true, true, true); - adapter.setListener(getPresenter()); - stateLayout.setEmptyText(R.string.no_issues); - recycler.setEmptyView(stateLayout, refresh); - recycler.setAdapter(adapter); - recycler.addKeyLineDivider(); - refresh.setOnRefreshListener(() -> getPresenter().onReload()); - stateLayout.setOnReloadListener(v -> getPresenter().onReload()); - if (savedInstanceState == null) { - stateLayout.showProgress(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public PinnedIssuePresenter providePresenter() { - return new PinnedIssuePresenter(); - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (bundle != null && isOk) { - long id = bundle.getLong(BundleConstant.ID); - int position = bundle.getInt(BundleConstant.EXTRA); - PinnedIssues.delete(id); - adapter.removeItem(position); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/pinned/issue/PinnedIssueMvp.java b/app/src/main/java/com/fastaccess/ui/modules/pinned/issue/PinnedIssueMvp.java deleted file mode 100644 index 2d478538b..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/pinned/issue/PinnedIssueMvp.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.fastaccess.ui.modules.pinned.issue; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 25 Mar 2017, 7:57 PM - */ - -public interface PinnedIssueMvp { - - interface View extends BaseMvp.FAView { - void onNotifyAdapter(@Nullable List items); - - void onDeletePinnedIssue(long id, int position); - } - - interface Presenter extends BaseViewHolder.OnItemClickListener { - @NonNull ArrayList getPinnedIssue(); - - void onReload(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/pinned/issue/PinnedIssuePresenter.java b/app/src/main/java/com/fastaccess/ui/modules/pinned/issue/PinnedIssuePresenter.java deleted file mode 100644 index 7f423bd59..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/pinned/issue/PinnedIssuePresenter.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.fastaccess.ui.modules.pinned.issue; - -import androidx.annotation.NonNull; -import android.view.View; - -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.PinnedIssues; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 25 Mar 2017, 8:00 PM - */ - -public class PinnedIssuePresenter extends BasePresenter implements PinnedIssueMvp.Presenter { - private ArrayList issues = new ArrayList<>(); - - @Override protected void onAttachView(@NonNull PinnedIssueMvp.View view) { - super.onAttachView(view); - if (issues.isEmpty()) { - onReload(); - } - } - - @NonNull @Override public ArrayList getPinnedIssue() { - return issues; - } - - @Override public void onReload() { - manageDisposable(PinnedIssues.getMyPinnedIssues() - .subscribe(repos -> sendToView(view -> view.onNotifyAdapter(repos)), throwable -> - sendToView(view -> view.onNotifyAdapter(null)))); - } - - @Override public void onItemClick(int position, View v, Issue item) { - SchemeParser.launchUri(v.getContext(), !InputHelper.isEmpty(item.getHtmlUrl()) ? item.getHtmlUrl() : item.getUrl()); - } - - @Override public void onItemLongClick(int position, View v, Issue item) { - if (getView() != null) { - getView().onDeletePinnedIssue(item.getId(), position); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/pinned/pullrequest/PinnedPullRequestFragment.java b/app/src/main/java/com/fastaccess/ui/modules/pinned/pullrequest/PinnedPullRequestFragment.java deleted file mode 100644 index 2ddf26eb9..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/pinned/pullrequest/PinnedPullRequestFragment.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.fastaccess.ui.modules.pinned.pullrequest; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.PinnedPullRequests; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.ui.adapter.PullRequestAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.widgets.AppbarRefreshLayout; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 25 Mar 2017, 8:04 PM - */ - -public class PinnedPullRequestFragment extends BaseFragment implements PinnedPullRequestMvp - .View { - - public static final String TAG = PinnedPullRequestFragment.class.getSimpleName(); - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) AppbarRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private PullRequestAdapter adapter; - - public static PinnedPullRequestFragment newInstance() { - return new PinnedPullRequestFragment(); - } - - @Override public void onNotifyAdapter(@Nullable List items) { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - if (items != null) adapter.insertItems(items); - else adapter.clear(); - } - - @Override public void onDeletePinnedPullRequest(long id, int position) { - MessageDialogView.newInstance(getString(R.string.delete), getString(R.string.confirm_message), - Bundler.start().put(BundleConstant.YES_NO_EXTRA, true) - .put(BundleConstant.EXTRA, position) - .put(BundleConstant.ID, id) - .end()) - .show(getChildFragmentManager(), MessageDialogView.TAG); - } - - @Override protected int fragmentLayout() { - return R.layout.small_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - adapter = new PullRequestAdapter(getPresenter().getPinnedPullRequest(), true, true); - adapter.setListener(getPresenter()); - stateLayout.setEmptyText(getString((R.string.no_pull_requests))); - recycler.setEmptyView(stateLayout, refresh); - recycler.setAdapter(adapter); - recycler.addKeyLineDivider(); - refresh.setOnRefreshListener(() -> getPresenter().onReload()); - stateLayout.setOnReloadListener(v -> getPresenter().onReload()); - if (savedInstanceState == null) { - stateLayout.showProgress(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public PinnedPullRequestPresenter providePresenter() { - return new PinnedPullRequestPresenter(); - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (bundle != null && isOk) { - long id = bundle.getLong(BundleConstant.ID); - int position = bundle.getInt(BundleConstant.EXTRA); - PinnedPullRequests.delete(id); - adapter.removeItem(position); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/pinned/pullrequest/PinnedPullRequestMvp.java b/app/src/main/java/com/fastaccess/ui/modules/pinned/pullrequest/PinnedPullRequestMvp.java deleted file mode 100644 index ccbac215f..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/pinned/pullrequest/PinnedPullRequestMvp.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.fastaccess.ui.modules.pinned.pullrequest; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 25 Mar 2017, 7:57 PM - */ - -public interface PinnedPullRequestMvp { - - interface View extends BaseMvp.FAView { - void onNotifyAdapter(@Nullable List items); - - void onDeletePinnedPullRequest(long id, int position); - } - - interface Presenter extends BaseViewHolder.OnItemClickListener { - @NonNull ArrayList getPinnedPullRequest(); - - void onReload(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/pinned/pullrequest/PinnedPullRequestPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/pinned/pullrequest/PinnedPullRequestPresenter.java deleted file mode 100644 index c7c849429..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/pinned/pullrequest/PinnedPullRequestPresenter.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.fastaccess.ui.modules.pinned.pullrequest; - -import androidx.annotation.NonNull; -import android.view.View; - -import com.fastaccess.data.dao.model.PinnedPullRequests; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 25 Mar 2017, 8:00 PM - */ - -public class PinnedPullRequestPresenter extends BasePresenter implements PinnedPullRequestMvp.Presenter { - private ArrayList pullRequests = new ArrayList<>(); - - @Override protected void onAttachView(@NonNull PinnedPullRequestMvp.View view) { - super.onAttachView(view); - if (pullRequests.isEmpty()) { - onReload(); - } - } - - @NonNull @Override public ArrayList getPinnedPullRequest() { - return pullRequests; - } - - @Override public void onReload() { - manageDisposable(PinnedPullRequests.getMyPinnedPullRequests() - .subscribe(repos -> sendToView(view -> view.onNotifyAdapter(repos)), throwable -> - sendToView(view -> view.onNotifyAdapter(null)))); - } - - @Override public void onItemClick(int position, View v, PullRequest item) { - SchemeParser.launchUri(v.getContext(), !InputHelper.isEmpty(item.getHtmlUrl()) ? item.getHtmlUrl() : item.getUrl()); - } - - @Override public void onItemLongClick(int position, View v, PullRequest item) { - if (getView() != null) { - getView().onDeletePinnedPullRequest(item.getId(), position); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/pinned/repo/PinnedReposFragment.java b/app/src/main/java/com/fastaccess/ui/modules/pinned/repo/PinnedReposFragment.java deleted file mode 100644 index f64a2cc7f..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/pinned/repo/PinnedReposFragment.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.fastaccess.ui.modules.pinned.repo; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.AbstractPinnedRepos; -import com.fastaccess.data.dao.model.PinnedRepos; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.ui.adapter.PinnedReposAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.widgets.AppbarRefreshLayout; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 25 Mar 2017, 8:04 PM - */ - -public class PinnedReposFragment extends BaseFragment implements PinnedReposMvp.View { - - public static final String TAG = PinnedReposFragment.class.getSimpleName(); - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) AppbarRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private PinnedReposAdapter adapter; - - public static PinnedReposFragment newInstance() { - return new PinnedReposFragment(); - } - - @Override public void onNotifyAdapter(@Nullable List items) { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - if (items != null) adapter.insertItems(items); - else adapter.clear(); - } - - @Override public void onDeletePinnedRepo(long id, int position) { - MessageDialogView.newInstance(getString(R.string.delete), getString(R.string.confirm_message), - Bundler.start().put(BundleConstant.YES_NO_EXTRA, true) - .put(BundleConstant.EXTRA, position) - .put(BundleConstant.ID, id) - .end()) - .show(getChildFragmentManager(), MessageDialogView.TAG); - } - - @Override protected int fragmentLayout() { - return R.layout.small_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - adapter = new PinnedReposAdapter(getPresenter().getPinnedRepos(), getPresenter()); - stateLayout.setEmptyText(R.string.empty_pinned_repos); - recycler.setEmptyView(stateLayout, refresh); - recycler.setAdapter(adapter); - recycler.addKeyLineDivider(); - refresh.setOnRefreshListener(() -> getPresenter().onReload()); - stateLayout.setOnReloadListener(v -> getPresenter().onReload()); - if (savedInstanceState == null) { - stateLayout.showProgress(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public PinnedReposPresenter providePresenter() { - return new PinnedReposPresenter(); - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (bundle != null && isOk) { - long id = bundle.getLong(BundleConstant.ID); - int position = bundle.getInt(BundleConstant.EXTRA); - AbstractPinnedRepos.delete(id); - adapter.removeItem(position); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/pinned/repo/PinnedReposMvp.java b/app/src/main/java/com/fastaccess/ui/modules/pinned/repo/PinnedReposMvp.java deleted file mode 100644 index 08e6bb431..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/pinned/repo/PinnedReposMvp.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.fastaccess.ui.modules.pinned.repo; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.model.PinnedRepos; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 25 Mar 2017, 7:57 PM - */ - -public interface PinnedReposMvp { - - interface View extends BaseMvp.FAView { - void onNotifyAdapter(@Nullable List items); - - void onDeletePinnedRepo(long id, int position); - } - - interface Presenter extends BaseViewHolder.OnItemClickListener { - @NonNull ArrayList getPinnedRepos(); - - void onReload(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/pinned/repo/PinnedReposPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/pinned/repo/PinnedReposPresenter.java deleted file mode 100644 index 5b4e2cf4f..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/pinned/repo/PinnedReposPresenter.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.fastaccess.ui.modules.pinned.repo; - -import androidx.annotation.NonNull; -import android.view.View; - -import com.fastaccess.data.dao.model.AbstractPinnedRepos; -import com.fastaccess.data.dao.model.PinnedRepos; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 25 Mar 2017, 8:00 PM - */ - -public class PinnedReposPresenter extends BasePresenter implements PinnedReposMvp.Presenter { - private ArrayList pinnedRepos = new ArrayList<>(); - - @Override protected void onAttachView(@NonNull PinnedReposMvp.View view) { - super.onAttachView(view); - if (pinnedRepos.isEmpty()) { - onReload(); - } - } - - @NonNull @Override public ArrayList getPinnedRepos() { - return pinnedRepos; - } - - @Override public void onReload() { - manageDisposable(AbstractPinnedRepos.getMyPinnedRepos() - .subscribe(repos -> sendToView(view -> view.onNotifyAdapter(repos)), throwable -> - sendToView(view -> view.onNotifyAdapter(null)))); - } - - @Override public void onItemClick(int position, View v, PinnedRepos item) { - SchemeParser.launchUri(v.getContext(), item.getPinnedRepo().getHtmlUrl()); - } - - @Override public void onItemLongClick(int position, View v, PinnedRepos item) { - if (getView() != null) { - if (item.getRepoFullName().equalsIgnoreCase("k0shk0sh/FastHub")) { - return; - } - getView().onDeletePinnedRepo(item.getId(), position); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/ProfilePagerFragment.java b/app/src/main/java/com/fastaccess/ui/modules/profile/ProfilePagerFragment.java deleted file mode 100644 index d172e7fe0..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/ProfilePagerFragment.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.fastaccess.ui.modules.profile; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.tabs.TabLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.FragmentPagerAdapterModel; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.ui.adapter.FragmentsPagerAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.widgets.ViewPagerView; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 8:00 AM - */ - -public class ProfilePagerFragment extends BaseFragment implements ProfilePagerMvp.View { - - public static final String TAG = ProfilePagerFragment.class.getSimpleName(); - - @BindView(R.id.tabs) TabLayout tabs; - @BindView(R.id.pager) ViewPagerView pager; - - public static ProfilePagerFragment newInstance(@NonNull String login) { - ProfilePagerFragment profileView = new ProfilePagerFragment(); - profileView.setArguments(Bundler.start().put(BundleConstant.EXTRA, login).end()); - return profileView; - } - - @Override protected int fragmentLayout() { - return R.layout.tabbed_viewpager; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new RuntimeException("Bundle is null?"); - } - String login = getArguments().getString(BundleConstant.EXTRA); - if (login == null) { - throw new RuntimeException("user is null?"); - } - FragmentsPagerAdapter adapter = new FragmentsPagerAdapter(getChildFragmentManager(), - FragmentPagerAdapterModel.buildForProfile(getContext(), login)); - tabs.setTabGravity(TabLayout.GRAVITY_FILL); - tabs.setTabMode(TabLayout.MODE_SCROLLABLE); - pager.setAdapter(adapter); - tabs.setupWithViewPager(pager); - } - - @NonNull @Override public ProfilePagerPresenter providePresenter() { - return new ProfilePagerPresenter(); - } - - @Override public void onNavigateToFollowers() { - pager.setCurrentItem(4); - } - - @Override public void onNavigateToFollowing() { - pager.setCurrentItem(5); - } - - @Override public void onCheckType(boolean isOrg) {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/ProfilePagerMvp.java b/app/src/main/java/com/fastaccess/ui/modules/profile/ProfilePagerMvp.java deleted file mode 100644 index cb9032cef..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/ProfilePagerMvp.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.fastaccess.ui.modules.profile; - -import com.fastaccess.ui.base.mvp.BaseMvp; - -/** - * Created by Kosh on 03 Dec 2016, 7:59 AM - */ - -public interface ProfilePagerMvp { - - interface View extends BaseMvp.FAView { - void onNavigateToFollowers(); - - void onNavigateToFollowing(); - - void onCheckType(boolean isOrg); - - } - - interface Presenter extends BaseMvp.FAPresenter {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/ProfilePagerPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/profile/ProfilePagerPresenter.java deleted file mode 100644 index 0710cbcee..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/ProfilePagerPresenter.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fastaccess.ui.modules.profile; - -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -/** - * Created by Kosh on 03 Dec 2016, 8:00 AM - */ - -class ProfilePagerPresenter extends BasePresenter implements ProfilePagerMvp.Presenter {} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/followers/ProfileFollowersFragment.java b/app/src/main/java/com/fastaccess/ui/modules/profile/followers/ProfileFollowersFragment.java deleted file mode 100644 index 82a0c1830..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/followers/ProfileFollowersFragment.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.fastaccess.ui.modules.profile.followers; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.UsersAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class ProfileFollowersFragment extends BaseFragment implements ProfileFollowersMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private UsersAdapter adapter; - - public static ProfileFollowersFragment newInstance(@NonNull String username) { - ProfileFollowersFragment view = new ProfileFollowersFragment(); - view.setArguments(Bundler.start().put(BundleConstant.EXTRA, username).end()); - return view; - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override protected int fragmentLayout() { - return R.layout.small_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new NullPointerException("Bundle is null, username is required"); - } - stateLayout.setEmptyText(R.string.no_followers); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - adapter = new UsersAdapter(getPresenter().getFollowers()); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - recycler.addKeyLineDivider(); - if (getPresenter().getFollowers().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public ProfileFollowersPresenter providePresenter() { - return new ProfileFollowersPresenter(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter(), getArguments().getString(BundleConstant.EXTRA)); - } - return onLoadMore; - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, getArguments().getString(BundleConstant.EXTRA)); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/followers/ProfileFollowersMvp.java b/app/src/main/java/com/fastaccess/ui/modules/profile/followers/ProfileFollowersMvp.java deleted file mode 100644 index 3b8c59b4b..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/followers/ProfileFollowersMvp.java +++ /dev/null @@ -1,36 +0,0 @@ - -package com.fastaccess.ui.modules.profile.followers; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -interface ProfileFollowersMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getFollowers(); - - void onWorkOffline(@NonNull String login); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/followers/ProfileFollowersPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/profile/followers/ProfileFollowersPresenter.java deleted file mode 100644 index ea45c4006..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/followers/ProfileFollowersPresenter.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.fastaccess.ui.modules.profile.followers; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class ProfileFollowersPresenter extends BasePresenter implements ProfileFollowersMvp.Presenter { - - private ArrayList users = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - sendToView(view -> { - if (view.getLoadMore().getParameter() != null) { - onWorkOffline(view.getLoadMore().getParameter()); - } - }); - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable String parameter) { - if (parameter == null) { - throw new NullPointerException("Username is null"); - } - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0) { - sendToView(ProfileFollowersMvp.View::hideProgress); - return false; - } - makeRestCall(RestProvider.getUserService(isEnterprise()).getFollowers(parameter, page), - response -> { - lastPage = response.getLast(); - if (getCurrentPage() == 1) { - manageDisposable(User.saveUserFollowerList(response.getItems(), parameter)); - } - sendToView(view -> view.onNotifyAdapter(response.getItems(), page)); - }); - return true; - } - - @NonNull @Override public ArrayList getFollowers() { - return users; - } - - @Override public void onWorkOffline(@NonNull String login) { - if (users.isEmpty()) { - manageDisposable(RxHelper.getSingle(User.getUserFollowerList(login)).subscribe(userModels -> - sendToView(view -> view.onNotifyAdapter(userModels, 1)))); - } else { - sendToView(ProfileFollowersMvp.View::hideProgress); - } - } - - @Override public void onItemClick(int position, View v, User item) {} - - @Override public void onItemLongClick(int position, View v, User item) {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/following/ProfileFollowingFragment.java b/app/src/main/java/com/fastaccess/ui/modules/profile/following/ProfileFollowingFragment.java deleted file mode 100644 index 5fe9654e0..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/following/ProfileFollowingFragment.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.fastaccess.ui.modules.profile.following; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.UsersAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class ProfileFollowingFragment extends BaseFragment implements ProfileFollowingMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private UsersAdapter adapter; - - public static ProfileFollowingFragment newInstance(@NonNull String username) { - ProfileFollowingFragment view = new ProfileFollowingFragment(); - view.setArguments(Bundler.start().put(BundleConstant.EXTRA, username).end()); - return view; - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override protected int fragmentLayout() { - return R.layout.small_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new NullPointerException("Bundle is null, username is required"); - } - stateLayout.setEmptyText(R.string.no_followings); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - adapter = new UsersAdapter(getPresenter().getFollowing()); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - recycler.addKeyLineDivider(); - if (getPresenter().getFollowing().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public ProfileFollowingPresenter providePresenter() { - return new ProfileFollowingPresenter(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter(), getArguments().getString(BundleConstant.EXTRA)); - } - return onLoadMore; - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, getArguments().getString(BundleConstant.EXTRA)); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/following/ProfileFollowingMvp.java b/app/src/main/java/com/fastaccess/ui/modules/profile/following/ProfileFollowingMvp.java deleted file mode 100644 index 1249e8c12..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/following/ProfileFollowingMvp.java +++ /dev/null @@ -1,36 +0,0 @@ - -package com.fastaccess.ui.modules.profile.following; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -interface ProfileFollowingMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getFollowing(); - - void onWorkOffline(@NonNull String login); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/following/ProfileFollowingPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/profile/following/ProfileFollowingPresenter.java deleted file mode 100644 index 443f7aa7a..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/following/ProfileFollowingPresenter.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.fastaccess.ui.modules.profile.following; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class ProfileFollowingPresenter extends BasePresenter implements ProfileFollowingMvp.Presenter { - - private ArrayList users = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - sendToView(view -> {//wait view - if (view.getLoadMore().getParameter() != null) { - onWorkOffline(view.getLoadMore().getParameter()); - } - }); - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable String parameter) { - if (parameter == null) { - throw new NullPointerException("Username is null"); - } - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0) { - sendToView(ProfileFollowingMvp.View::hideProgress); - return false; - } - makeRestCall(RestProvider.getUserService(isEnterprise()).getFollowing(parameter, page), - response -> { - lastPage = response.getLast(); - if (getCurrentPage() == 1) { - manageDisposable(User.saveUserFollowingList(response.getItems(), parameter)); - } - sendToView(view -> view.onNotifyAdapter(response.getItems(), page)); - }); - return true; - } - - @NonNull @Override public ArrayList getFollowing() { - return users; - } - - @Override public void onWorkOffline(@NonNull String login) { - if (users.isEmpty()) { - manageDisposable(RxHelper.getSingle(User.getUserFollowingList(login)).subscribe(userModels -> - sendToView(view -> view.onNotifyAdapter(userModels, 1)))); - } else { - sendToView(ProfileFollowingMvp.View::hideProgress); - } - } - - @Override public void onItemClick(int position, View v, User item) {} - - @Override public void onItemLongClick(int position, View v, User item) {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/gists/ProfileGistsFragment.java b/app/src/main/java/com/fastaccess/ui/modules/profile/gists/ProfileGistsFragment.java deleted file mode 100644 index 7f5ae1aa7..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/gists/ProfileGistsFragment.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.fastaccess.ui.modules.profile.gists; - -import android.app.Activity; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.GistsAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.gists.gist.GistActivity; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 12:36 PM - */ - -public class ProfileGistsFragment extends BaseFragment implements ProfileGistsMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - - private GistsAdapter adapter; - private OnLoadMore onLoadMore; - - public static ProfileGistsFragment newInstance(@NonNull String login) { - ProfileGistsFragment view = new ProfileGistsFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.IS_ENTERPRISE, Login.getUser().getLogin().equalsIgnoreCase(login)) - .end()); - return view; - } - - @Override protected int fragmentLayout() { - return R.layout.small_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments().getString(BundleConstant.EXTRA) == null) { - throw new NullPointerException("Username is null"); - } - stateLayout.setEmptyText(R.string.no_gists); - refresh.setOnRefreshListener(this); - stateLayout.setOnReloadListener(this); - recycler.setEmptyView(stateLayout, refresh); - adapter = new GistsAdapter(getPresenter().getGists(), true); - adapter.setListener(getPresenter()); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - recycler.addDivider(); - if (getPresenter().getGists().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, getArguments().getString(BundleConstant.EXTRA)); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override public void showProgress(@StringRes int resId) { - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public ProfileGistsPresenter providePresenter() { - return new ProfileGistsPresenter(); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter(), getArguments().getString(BundleConstant.EXTRA)); - } - return onLoadMore; - } - - @Override public void onStartGistView(@NonNull String gistId) { - startActivityForResult(GistActivity.createIntent(getContext(), gistId, isEnterprise()), BundleConstant.REQUEST_CODE); - } - - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (resultCode == Activity.RESULT_OK && requestCode == BundleConstant.REQUEST_CODE) { - if (data != null && data.getExtras() != null) { - Gist gistsModel = data.getExtras().getParcelable(BundleConstant.ITEM); - if (gistsModel != null && adapter != null) { - adapter.removeItem(gistsModel); - } - } else { - onRefresh(); - } - } - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/gists/ProfileGistsMvp.java b/app/src/main/java/com/fastaccess/ui/modules/profile/gists/ProfileGistsMvp.java deleted file mode 100644 index c0c484eb4..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/gists/ProfileGistsMvp.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fastaccess.ui.modules.profile.gists; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 11 Nov 2016, 12:35 PM - */ - -interface ProfileGistsMvp { - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - - void onStartGistView(@NonNull String gistId); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getGists(); - - void onWorkOffline(@NonNull String login); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/gists/ProfileGistsPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/profile/gists/ProfileGistsPresenter.java deleted file mode 100644 index e098ccc78..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/gists/ProfileGistsPresenter.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.fastaccess.ui.modules.profile.gists; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.annimon.stream.Stream; -import com.fastaccess.data.dao.model.Gist; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 11 Nov 2016, 12:36 PM - */ - -class ProfileGistsPresenter extends BasePresenter implements ProfileGistsMvp.Presenter { - private ArrayList gistsModels = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - sendToView(view -> { - if (view.getLoadMore().getParameter() != null) { - onWorkOffline(view.getLoadMore().getParameter()); - } - }); - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable String parameter) { - if (parameter == null) { - throw new NullPointerException("Username is null"); - } - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0) { - sendToView(ProfileGistsMvp.View::hideProgress); - return false; - } - makeRestCall(RestProvider.getGistService(isEnterprise()).getUserGists(parameter, page), - listResponse -> { - lastPage = listResponse.getLast(); - sendToView(view -> view.onNotifyAdapter(listResponse.getItems(), page)); - manageDisposable(Gist.save(Stream.of(listResponse.getItems()).toList(), parameter)); - }); - return true; - } - - @NonNull @Override public ArrayList getGists() { - return gistsModels; - } - - @Override public void onWorkOffline(@NonNull String login) { - if (gistsModels.isEmpty()) { - manageDisposable(RxHelper.getObservable(Gist.getMyGists(login).toObservable()).subscribe(gistsModels1 -> - sendToView(view -> view.onNotifyAdapter(gistsModels1, 1)))); - } else { - sendToView(ProfileGistsMvp.View::hideProgress); - } - } - - @Override public void onItemClick(int position, View v, Gist item) { - SchemeParser.launchUri(v.getContext(), item.getHtmlUrl()); - } - - @Override public void onItemLongClick(int position, View v, Gist item) {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/OrgProfileOverviewFragment.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/OrgProfileOverviewFragment.java deleted file mode 100644 index e9859f487..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/OrgProfileOverviewFragment.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.fastaccess.ui.modules.profile.org; - -import android.annotation.SuppressLint; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.transition.TransitionManager; -import android.view.MotionEvent; -import android.view.View; -import android.view.ViewGroup; -import android.widget.LinearLayout; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.provider.emoji.EmojiParser; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.profile.org.project.OrgProjectActivity; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; - -import butterknife.BindView; -import butterknife.OnClick; - -import static android.view.View.GONE; - -/** - * Created by Kosh on 04 Apr 2017, 10:47 AM - */ - -public class OrgProfileOverviewFragment extends BaseFragment - implements OrgProfileOverviewMvp.View { - - @BindView(R.id.avatarLayout) AvatarLayout avatarLayout; - @BindView(R.id.username) FontTextView username; - @BindView(R.id.description) FontTextView description; - @BindView(R.id.location) FontTextView location; - @BindView(R.id.email) FontTextView email; - @BindView(R.id.link) FontTextView link; - @BindView(R.id.joined) FontTextView joined; - @BindView(R.id.progress) LinearLayout progress; - @BindView(R.id.projects) View projects; - - @State User userModel; - - public static OrgProfileOverviewFragment newInstance(@NonNull String login) { - OrgProfileOverviewFragment view = new OrgProfileOverviewFragment(); - view.setArguments(Bundler.start().put(BundleConstant.EXTRA, login).end()); - return view; - } - - @OnClick(R.id.userInformation) void onOpenAvatar() { - if (userModel != null) ActivityHelper.startCustomTab(getActivity(), userModel.getAvatarUrl()); - } - - @OnClick(R.id.projects) void onOpenProjects() { - OrgProjectActivity.Companion.startActivity(getContext(), getPresenter().getLogin(), isEnterprise()); - } - - @SuppressLint("ClickableViewAccessibility") @Override public void onInitViews(@Nullable User userModel) { - if (getView() != null) { - TransitionManager.beginDelayedTransition((ViewGroup) getView()); - } - if (this.userModel != null) return; - progress.setVisibility(View.GONE); - if (userModel == null) return; - this.userModel = userModel; - username.setText(InputHelper.isEmpty(userModel.getName()) ? userModel.getLogin() : userModel.getName()); - if (userModel.getDescription() != null) { - description.setText(EmojiParser.parseToUnicode(userModel.getDescription())); - description.setVisibility(View.VISIBLE); - } else { - description.setVisibility(GONE); - } - avatarLayout.setUrl(userModel.getAvatarUrl(), null, false, false); - avatarLayout.findViewById(R.id.avatar).setOnTouchListener((v, event) -> { - if (event.getAction() == MotionEvent.ACTION_UP) { - ActivityHelper.startCustomTab(getActivity(), userModel.getAvatarUrl()); - return true; - } - return false; - }); - location.setText(userModel.getLocation()); - email.setText(userModel.getEmail()); - link.setText(userModel.getBlog()); - joined.setText(ParseDateFormat.getTimeAgo(userModel.getCreatedAt())); - - if (!InputHelper.isEmpty(userModel.getLocation())) { - location.setVisibility(View.VISIBLE); - } - if (!InputHelper.isEmpty(userModel.getEmail())) { - email.setVisibility(View.VISIBLE); - } - if (!InputHelper.isEmpty(userModel.getBlog())) { - link.setVisibility(View.VISIBLE); - } - if (!InputHelper.isEmpty(userModel.getCreatedAt())) { - joined.setVisibility(View.VISIBLE); - } - if (!InputHelper.isEmpty(userModel.getEmail())) { - email.setVisibility(View.VISIBLE); - } - projects.setVisibility(userModel.isHasOrganizationProjects() ? View.VISIBLE : View.GONE); - } - - @Override protected int fragmentLayout() { - return R.layout.org_profile_overview_layout; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (savedInstanceState == null) { - getPresenter().onFragmentCreated(getArguments()); - } else { - if (userModel != null) { - onInitViews(userModel); - } else { - getPresenter().onFragmentCreated(getArguments()); - } - } - } - - @NonNull @Override public OrgProfileOverviewPresenter providePresenter() { - return new OrgProfileOverviewPresenter(); - } - - @Override public void showProgress(@StringRes int resId) { - progress.setVisibility(View.VISIBLE); - } - - @Override public void hideProgress() { - progress.setVisibility(View.GONE); - } - - @Override public void showErrorMessage(@NonNull String message) { - onHideProgress(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - onHideProgress(); - super.showMessage(titleRes, msgRes); - } - - private void onHideProgress() { - hideProgress(); - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/OrgProfileOverviewMvp.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/OrgProfileOverviewMvp.java deleted file mode 100644 index 1bc7ce549..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/OrgProfileOverviewMvp.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.fastaccess.ui.modules.profile.org; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.ui.base.mvp.BaseMvp; - -/** - * Created by Kosh on 03 Dec 2016, 7:59 AM - */ - -public interface OrgProfileOverviewMvp { - - interface View extends BaseMvp.FAView { - void onInitViews(@Nullable User userModel); - } - - interface Presenter extends BaseMvp.FAPresenter { - void onFragmentCreated(@Nullable Bundle bundle); - - void onWorkOffline(@NonNull String login); - - @NonNull String getLogin(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/OrgProfileOverviewPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/OrgProfileOverviewPresenter.java deleted file mode 100644 index 5146430b3..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/OrgProfileOverviewPresenter.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.fastaccess.ui.modules.profile.org; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -/** - * Created by Kosh on 04 Apr 2017, 10:36 AM - */ - -public class OrgProfileOverviewPresenter extends BasePresenter implements OrgProfileOverviewMvp.Presenter { - @com.evernote.android.state.State String login; - - @Override public void onError(@NonNull Throwable throwable) { - if (!InputHelper.isEmpty(login)) { - onWorkOffline(login); - } - super.onError(throwable); - } - - @Override public void onFragmentCreated(@Nullable Bundle bundle) { - if (bundle == null || bundle.getString(BundleConstant.EXTRA) == null) { - throw new NullPointerException("Either bundle or User is null"); - } - login = bundle.getString(BundleConstant.EXTRA); - if (login != null) { - makeRestCall(RestProvider.getOrgService(isEnterprise()).getOrganization(login), - this::onSendUserToView); - } - } - - @Override public void onWorkOffline(@NonNull String login) { - onSendUserToView(User.getUser(login)); - } - - @NonNull @Override public String getLogin() { - return login; - } - - private void onSendUserToView(User userModel) { - sendToView(view -> view.onInitViews(userModel)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/members/OrgMembersFragment.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/members/OrgMembersFragment.java deleted file mode 100644 index 3655cec08..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/members/OrgMembersFragment.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.fastaccess.ui.modules.profile.org.members; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.UsersAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class OrgMembersFragment extends BaseFragment implements OrgMembersMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private UsersAdapter adapter; - - public static OrgMembersFragment newInstance(@NonNull String username) { - OrgMembersFragment view = new OrgMembersFragment(); - view.setArguments(Bundler.start().put(BundleConstant.EXTRA, username).end()); - return view; - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override protected int fragmentLayout() { - return R.layout.small_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new NullPointerException("Bundle is null, username is required"); - } - stateLayout.setEmptyText(R.string.no_members); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - adapter = new UsersAdapter(getPresenter().getFollowers()); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - recycler.addKeyLineDivider(); - if (getPresenter().getFollowers().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public OrgMembersPresenter providePresenter() { - return new OrgMembersPresenter(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter(), getArguments().getString(BundleConstant.EXTRA)); - } - return onLoadMore; - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, getArguments().getString(BundleConstant.EXTRA)); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/members/OrgMembersMvp.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/members/OrgMembersMvp.java deleted file mode 100644 index ab60bfb06..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/members/OrgMembersMvp.java +++ /dev/null @@ -1,36 +0,0 @@ - -package com.fastaccess.ui.modules.profile.org.members; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -interface OrgMembersMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getFollowers(); - - void onWorkOffline(@NonNull String login); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/members/OrgMembersPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/members/OrgMembersPresenter.java deleted file mode 100644 index 517386a18..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/members/OrgMembersPresenter.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.fastaccess.ui.modules.profile.org.members; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class OrgMembersPresenter extends BasePresenter implements OrgMembersMvp.Presenter { - - private ArrayList users = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable String parameter) { - if (parameter == null) { - throw new NullPointerException("Username is null"); - } - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0) { - sendToView(OrgMembersMvp.View::hideProgress); - return false; - } - makeRestCall(RestProvider.getOrgService(isEnterprise()).getOrgMembers(parameter, page), - response -> { - lastPage = response.getLast(); - sendToView(view -> view.onNotifyAdapter(response.getItems(), page)); - }); - return true; - } - - @NonNull @Override public ArrayList getFollowers() { - return users; - } - - @Override public void onWorkOffline(@NonNull String login) { - //TODO - } - - @Override public void onItemClick(int position, View v, User item) {} - - @Override public void onItemLongClick(int position, View v, User item) {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/project/OrgProjectActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/profile/org/project/OrgProjectActivity.kt deleted file mode 100644 index e81823d90..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/project/OrgProjectActivity.kt +++ /dev/null @@ -1,67 +0,0 @@ -package com.fastaccess.ui.modules.profile.org.project - -import android.content.Context -import android.content.Intent -import android.os.Bundle -import com.google.android.material.appbar.AppBarLayout -import butterknife.BindView -import com.evernote.android.state.State -import com.fastaccess.R -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.ui.base.BaseActivity -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import com.fastaccess.ui.modules.repos.projects.RepoProjectsFragmentPager - -/** - * Created by Hashemsergani on 24.09.17. - */ - -class OrgProjectActivity : BaseActivity>() { - - @State var org: String? = null - - @BindView(R.id.appbar) lateinit var appBar: AppBarLayout - - override fun layout(): Int = R.layout.activity_fragment_layout - - override fun isTransparent(): Boolean = true - - override fun canBack(): Boolean = true - - override fun isSecured(): Boolean = false - - override fun providePresenter(): BasePresenter = BasePresenter() - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - appBar.elevation = 0f - appBar.stateListAnimator = null - if (savedInstanceState == null) { - org = intent.extras?.getString(BundleConstant.ITEM) - val org = org - if (org != null) { - supportFragmentManager.beginTransaction() - .replace( - R.id.container, RepoProjectsFragmentPager.newInstance(org), - RepoProjectsFragmentPager.TAG - ) - .commit() - } - } - toolbar?.apply { subtitle = org } - } - - companion object { - fun startActivity(context: Context, org: String, isEnterprise: Boolean) { - val intent = Intent(context, OrgProjectActivity::class.java) - intent.putExtras( - Bundler.start().put(BundleConstant.ITEM, org) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .end() - ) - context.startActivity(intent) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/repos/OrgReposFragment.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/repos/OrgReposFragment.java deleted file mode 100644 index b9f1035a6..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/repos/OrgReposFragment.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.fastaccess.ui.modules.profile.org.repos; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.ReposAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.profile.repos.ProfileReposFilterBottomSheetDialog; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class OrgReposFragment extends BaseFragment implements OrgReposMvp.View, - ProfileReposFilterBottomSheetDialog.ProfileReposFilterChangeListener { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private ReposAdapter adapter; - - public static OrgReposFragment newInstance(@NonNull String username) { - OrgReposFragment view = new OrgReposFragment(); - view.setArguments(Bundler.start().put(BundleConstant.EXTRA, username).end()); - return view; - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new NullPointerException("Bundle is null, username is required"); - } - stateLayout.setEmptyText(R.string.no_repos); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - adapter = new ReposAdapter(getPresenter().getRepos(), false); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - recycler.addDivider(); - if (getPresenter().getRepos().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public OrgReposPresenter providePresenter() { - return new OrgReposPresenter(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter()); - } - onLoadMore.setParameter(getArguments().getString(BundleConstant.EXTRA)); - return onLoadMore; - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, getArguments().getString(BundleConstant.EXTRA)); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - @Override public void onRepoFilterClicked() { - ProfileReposFilterBottomSheetDialog.newInstance(getPresenter().getFilterOptions()) - .show(getChildFragmentManager(), "ProfileReposFilterBottomSheetDialog"); - } - - @Override public void onFilterApply() { - getPresenter().onFilterApply(getArguments().getString(BundleConstant.EXTRA)); - } - - @Override public void onTypeSelected(String selectedType) { - getPresenter().onTypeSelected(selectedType); - } - - @Override public void onSortOptionSelected(String selectedSortOption) { - //Not supported for org profile - } - - @Override public void onSortDirectionSelected(String selectedSortDirection) { - //Not supported for org profile - } - - @Override - public String getLogin() { - return getArguments().getString(BundleConstant.EXTRA); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/repos/OrgReposMvp.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/repos/OrgReposMvp.java deleted file mode 100644 index 3ca94184e..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/repos/OrgReposMvp.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.fastaccess.ui.modules.profile.org.repos; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -public interface OrgReposMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - void onRepoFilterClicked(); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getRepos(); - - void onWorkOffline(@NonNull String login); - void onFilterApply(String org); - void onTypeSelected(String selectedType); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/repos/OrgReposPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/repos/OrgReposPresenter.java deleted file mode 100644 index 7742e8222..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/repos/OrgReposPresenter.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.fastaccess.ui.modules.profile.org.repos; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.data.dao.FilterOptionsModel; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class OrgReposPresenter extends BasePresenter implements OrgReposMvp.Presenter { - - private ArrayList repos = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - @com.evernote.android.state.State FilterOptionsModel filterOptions = new FilterOptionsModel(); - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - sendToView(view -> { - if (view.getLoadMore().getParameter() != null) { - onWorkOffline(view.getLoadMore().getParameter()); - } - }); - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable String parameter) { - if (parameter == null) { - throw new NullPointerException("Username is null"); - } - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0) { - sendToView(OrgReposMvp.View::hideProgress); - return false; - } - filterOptions.setOrg(true); - makeRestCall(RestProvider.getOrgService(isEnterprise()).getOrgRepos(parameter, filterOptions.getQueryMap(), page), - repoModelPageable -> { - lastPage = repoModelPageable.getLast(); - if (getCurrentPage() == 1) { - manageDisposable(Repo.saveMyRepos(repoModelPageable.getItems(), parameter)); - } - sendToView(view -> view.onNotifyAdapter(repoModelPageable.getItems(), page)); - }); - return true; - } - - @NonNull @Override public ArrayList getRepos() { - return repos; - } - - @Override public void onWorkOffline(@NonNull String login) { - if (repos.isEmpty()) { - manageDisposable(RxHelper.getObservable(Repo.getMyRepos(login).toObservable()).subscribe(repoModels -> - sendToView(view -> view.onNotifyAdapter(repoModels, 1)))); - } else { - sendToView(OrgReposMvp.View::hideProgress); - } - } - - @Override public void onFilterApply(String org) { - onCallApi(1, org); - } - - @Override public void onTypeSelected(String selectedType) { - filterOptions.setType(selectedType); - } - - @Override public void onItemClick(int position, View v, Repo item) { - SchemeParser.launchUri(v.getContext(), item.getHtmlUrl()); - } - - @Override public void onItemLongClick(int position, View v, Repo item) {} - - @NonNull FilterOptionsModel getFilterOptions() { - return filterOptions; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/OrgTeamFragment.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/OrgTeamFragment.java deleted file mode 100644 index ece0e1c67..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/OrgTeamFragment.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.fastaccess.ui.modules.profile.org.teams; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.TeamsModel; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.TeamsAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class OrgTeamFragment extends BaseFragment implements OrgTeamMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private TeamsAdapter adapter; - - public static OrgTeamFragment newInstance(@NonNull String username) { - OrgTeamFragment view = new OrgTeamFragment(); - view.setArguments(Bundler.start().put(BundleConstant.EXTRA, username).end()); - return view; - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new NullPointerException("Bundle is null, username is required"); - } - stateLayout.setEmptyText(R.string.no_teams); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - adapter = new TeamsAdapter(getPresenter().getTeams()); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - recycler.addKeyLineDivider(); - if (getPresenter().getTeams().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public OrgTeamPresenter providePresenter() { - return new OrgTeamPresenter(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter(), getArguments().getString(BundleConstant.EXTRA)); - } - return onLoadMore; - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, getArguments().getString(BundleConstant.EXTRA)); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/OrgTeamMvp.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/OrgTeamMvp.java deleted file mode 100644 index 35f1feb13..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/OrgTeamMvp.java +++ /dev/null @@ -1,36 +0,0 @@ - -package com.fastaccess.ui.modules.profile.org.teams; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.TeamsModel; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -interface OrgTeamMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getTeams(); - - void onWorkOffline(@NonNull String login); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/OrgTeamPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/OrgTeamPresenter.java deleted file mode 100644 index e439e33ea..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/OrgTeamPresenter.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.fastaccess.ui.modules.profile.org.teams; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.data.dao.TeamsModel; -import com.fastaccess.helper.Logger; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.profile.org.teams.details.TeamPagerActivity; - -import java.util.ArrayList; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class OrgTeamPresenter extends BasePresenter implements OrgTeamMvp.Presenter { - - private ArrayList users = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable String parameter) { - if (parameter == null) { - throw new NullPointerException("Username is null"); - } - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0) { - sendToView(OrgTeamMvp.View::hideProgress); - return false; - } - makeRestCall(RestProvider.getOrgService(isEnterprise()).getOrgTeams(parameter, page), - response -> { - lastPage = response.getLast(); - sendToView(view -> view.onNotifyAdapter(response.getItems(), page)); - }); - return true; - } - - @NonNull @Override public ArrayList getTeams() { - return users; - } - - @Override public void onWorkOffline(@NonNull String login) { - //TODO - } - - @Override public void onItemClick(int position, View v, TeamsModel item) { - Logger.e(item.getUrl()); - TeamPagerActivity.startActivity(v.getContext(), item.getId(), item.getName()); - } - - @Override public void onItemLongClick(int position, View v, TeamsModel item) {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/TeamPagerActivity.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/TeamPagerActivity.java deleted file mode 100644 index 1c8d8a983..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/TeamPagerActivity.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.fastaccess.ui.modules.profile.org.teams.details; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.tabs.TabLayout; -import androidx.fragment.app.Fragment; - -import com.fastaccess.R; -import com.fastaccess.data.dao.FragmentPagerAdapterModel; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.ui.adapter.FragmentsPagerAdapter; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.widgets.ViewPagerView; - -import net.grandcentrix.thirtyinch.TiPresenter; - -import butterknife.BindView; -import com.evernote.android.state.State; - -/** - * Created by Kosh on 03 Apr 2017, 10:08 PM - */ - -public class TeamPagerActivity extends BaseActivity { - - @State long id; - @State String name; - - @BindView(R.id.tabs) TabLayout tabs; - @BindView(R.id.tabbedPager) ViewPagerView pager; - - public static void startActivity(@NonNull Context context, long id, @NonNull String name) { - Intent intent = new Intent(context, TeamPagerActivity.class); - intent.putExtras(Bundler - .start() - .put(BundleConstant.ID, id) - .put(BundleConstant.EXTRA, name) - .end()); - context.startActivity(intent); - } - - @Override protected int layout() { - return R.layout.tabbed_pager_layout; - } - - @Override protected boolean isTransparent() { - return false; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @NonNull @Override public TiPresenter providePresenter() { - return new BasePresenter(); - } - - @Override protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - if (savedInstanceState == null) { - id = getIntent().getExtras().getLong(BundleConstant.ID); - name = getIntent().getExtras().getString(BundleConstant.EXTRA); - } - setTitle(name); - if (id <= 0) { - finish(); - return; - } - FragmentsPagerAdapter adapter = new FragmentsPagerAdapter(getSupportFragmentManager(), - FragmentPagerAdapterModel.buildForTeam(this, id)); - pager.setAdapter(adapter); - tabs.setTabGravity(TabLayout.GRAVITY_FILL); - tabs.setTabMode(TabLayout.MODE_FIXED); - tabs.setupWithViewPager(pager); - tabs.setPaddingRelative(0, 0, 0, 0); - tabs.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(pager) { - @Override public void onTabReselected(TabLayout.Tab tab) { - super.onTabReselected(tab); - onScrollTop(tab.getPosition()); - } - }); - } - - @Override public void onScrollTop(int index) { - if (pager == null || pager.getAdapter() == null) return; - Fragment fragment = (BaseFragment) pager.getAdapter().instantiateItem(pager, index); - if (fragment instanceof BaseFragment) { - ((BaseFragment) fragment).onScrollTop(index); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/members/TeamMembersFragment.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/members/TeamMembersFragment.java deleted file mode 100644 index df7e8ed36..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/members/TeamMembersFragment.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.fastaccess.ui.modules.profile.org.teams.details.members; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.UsersAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class TeamMembersFragment extends BaseFragment implements TeamMembersMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private UsersAdapter adapter; - - public static TeamMembersFragment newInstance(@NonNull Long id) { - TeamMembersFragment view = new TeamMembersFragment(); - view.setArguments(Bundler.start().put(BundleConstant.EXTRA, id).end()); - return view; - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override protected int fragmentLayout() { - return R.layout.small_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new NullPointerException("Bundle is null, username is required"); - } - stateLayout.setEmptyText(R.string.no_members); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - adapter = new UsersAdapter(getPresenter().getFollowers()); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - recycler.addKeyLineDivider(); - if (getPresenter().getFollowers().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public TeamMembersPresenter providePresenter() { - return new TeamMembersPresenter(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter(), getArguments().getLong(BundleConstant.EXTRA)); - } - return onLoadMore; - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, getArguments().getLong(BundleConstant.EXTRA)); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/members/TeamMembersMvp.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/members/TeamMembersMvp.java deleted file mode 100644 index 62d30096f..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/members/TeamMembersMvp.java +++ /dev/null @@ -1,36 +0,0 @@ - -package com.fastaccess.ui.modules.profile.org.teams.details.members; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -interface TeamMembersMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getFollowers(); - - void onWorkOffline(@NonNull String login); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/members/TeamMembersPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/members/TeamMembersPresenter.java deleted file mode 100644 index 90a1080cf..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/members/TeamMembersPresenter.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.fastaccess.ui.modules.profile.org.teams.details.members; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class TeamMembersPresenter extends BasePresenter implements TeamMembersMvp.Presenter { - - private ArrayList users = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable Long parameter) { - if (parameter == null) { - throw new NullPointerException("Username is null"); - } - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0) { - sendToView(TeamMembersMvp.View::hideProgress); - return false; - } - makeRestCall(RestProvider.getOrgService(isEnterprise()).getTeamMembers(parameter, page), - response -> { - lastPage = response.getLast(); - sendToView(view -> view.onNotifyAdapter(response.getItems(), page)); - }); - return true; - } - - @NonNull @Override public ArrayList getFollowers() { - return users; - } - - @Override public void onWorkOffline(@NonNull String login) { - //TODO - } - - @Override public void onItemClick(int position, View v, User item) {} - - @Override public void onItemLongClick(int position, View v, User item) {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/repos/TeamReposFragment.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/repos/TeamReposFragment.java deleted file mode 100644 index c827f80c6..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/repos/TeamReposFragment.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.fastaccess.ui.modules.profile.org.teams.details.repos; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.ReposAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class TeamReposFragment extends BaseFragment implements TeamReposMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private ReposAdapter adapter; - - public static TeamReposFragment newInstance(long id) { - TeamReposFragment view = new TeamReposFragment(); - view.setArguments(Bundler.start().put(BundleConstant.EXTRA, id).end()); - return view; - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new NullPointerException("Bundle is null, username is required"); - } - stateLayout.setEmptyText(R.string.no_repos); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - adapter = new ReposAdapter(getPresenter().getRepos(), false); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - recycler.addDivider(); - if (getPresenter().getRepos().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public TeamReposPresenter providePresenter() { - return new TeamReposPresenter(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter(), getArguments().getLong(BundleConstant.EXTRA)); - } - return onLoadMore; - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, getArguments().getLong(BundleConstant.EXTRA)); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/repos/TeamReposMvp.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/repos/TeamReposMvp.java deleted file mode 100644 index 4e272f349..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/repos/TeamReposMvp.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.fastaccess.ui.modules.profile.org.teams.details.repos; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -interface TeamReposMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getRepos(); - - void onWorkOffline(@NonNull String login); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/repos/TeamReposPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/repos/TeamReposPresenter.java deleted file mode 100644 index 8295089d5..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/org/teams/details/repos/TeamReposPresenter.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.fastaccess.ui.modules.profile.org.teams.details.repos; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class TeamReposPresenter extends BasePresenter implements TeamReposMvp.Presenter { - private ArrayList repos = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable Long parameter) { - if (parameter == null) { - throw new NullPointerException("Username is null"); - } - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0) { - sendToView(TeamReposMvp.View::hideProgress); - return false; - } - makeRestCall(RestProvider.getOrgService(isEnterprise()).getTeamRepos(parameter, page), - repoModelPageable -> { - lastPage = repoModelPageable.getLast(); - sendToView(view -> view.onNotifyAdapter(repoModelPageable.getItems(), page)); - }); - return true; - } - - @NonNull @Override public ArrayList getRepos() { - return repos; - } - - @Override public void onWorkOffline(@NonNull String login) { - //TODO - } - - @Override public void onItemClick(int position, View v, Repo item) { - SchemeParser.launchUri(v.getContext(), item.getHtmlUrl()); - } - - @Override public void onItemLongClick(int position, View v, Repo item) {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/overview/ProfileOverviewFragment.java b/app/src/main/java/com/fastaccess/ui/modules/profile/overview/ProfileOverviewFragment.java deleted file mode 100644 index 8ac6688ef..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/overview/ProfileOverviewFragment.java +++ /dev/null @@ -1,319 +0,0 @@ -package com.fastaccess.ui.modules.profile.overview; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.transition.AutoTransition; -import androidx.transition.Transition; -import androidx.transition.TransitionManager; -import androidx.core.widget.NestedScrollView; -import androidx.cardview.widget.CardView; -import android.view.MotionEvent; -import android.view.View; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.LinearLayout; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.provider.emoji.EmojiParser; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.adapter.ProfileOrgsAdapter; -import com.fastaccess.ui.adapter.ProfilePinnedReposAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.profile.ProfilePagerMvp; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontButton; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.contributions.GitHubContributionsView; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.layout_manager.GridManager; - -import java.util.List; - -import butterknife.BindView; -import butterknife.OnClick; -import github.GetPinnedReposQuery; - -import static android.view.View.GONE; -import static android.view.View.VISIBLE; - -/** - * Created by Kosh on 03 Dec 2016, 9:16 AM - */ - -public class ProfileOverviewFragment extends BaseFragment implements ProfileOverviewMvp.View { - - @BindView(R.id.contributionsCaption) FontTextView contributionsCaption; - @BindView(R.id.organizationsCaption) FontTextView organizationsCaption; - @BindView(R.id.userInformation) LinearLayout userInformation; - @BindView(R.id.username) FontTextView username; - @BindView(R.id.fullname) FontTextView fullname; - @BindView(R.id.description) FontTextView description; - @BindView(R.id.avatarLayout) AvatarLayout avatarLayout; - @BindView(R.id.organization) FontTextView organization; - @BindView(R.id.location) FontTextView location; - @BindView(R.id.email) FontTextView email; - @BindView(R.id.link) FontTextView link; - @BindView(R.id.joined) FontTextView joined; - @BindView(R.id.following) FontButton following; - @BindView(R.id.followers) FontButton followers; - @BindView(R.id.progress) View progress; - @BindView(R.id.followBtn) Button followBtn; - @BindView(R.id.orgsList) DynamicRecyclerView orgsList; - @BindView(R.id.orgsCard) CardView orgsCard; - @BindView(R.id.parentView) NestedScrollView parentView; - @BindView(R.id.contributionView) GitHubContributionsView contributionView; - @BindView(R.id.contributionCard) CardView contributionCard; - @BindView(R.id.pinnedReposTextView) FontTextView pinnedReposTextView; - @BindView(R.id.pinnedList) DynamicRecyclerView pinnedList; - @BindView(R.id.pinnedReposCard) CardView pinnedReposCard; - @State User userModel; - private ProfilePagerMvp.View profileCallback; - - public static ProfileOverviewFragment newInstance(@NonNull String login) { - ProfileOverviewFragment view = new ProfileOverviewFragment(); - view.setArguments(Bundler.start().put(BundleConstant.EXTRA, login).end()); - return view; - } - - @OnClick({R.id.following, R.id.followers, R.id.followBtn}) void onClick(View view) { - if (view.getId() == R.id.followers) { - profileCallback.onNavigateToFollowers(); - } else if (view.getId() == R.id.following) { - profileCallback.onNavigateToFollowing(); - } else if (view.getId() == R.id.followBtn) { - getPresenter().onFollowButtonClicked(getPresenter().getLogin()); - followBtn.setEnabled(false); - } - } - - @OnClick(R.id.userInformation) void onOpenAvatar() { - if (userModel != null) ActivityHelper.startCustomTab(getActivity(), userModel.getAvatarUrl()); - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() instanceof ProfilePagerMvp.View) { - profileCallback = (ProfilePagerMvp.View) getParentFragment(); - } else { - profileCallback = (ProfilePagerMvp.View) context; - } - } - - @Override public void onDetach() { - profileCallback = null; - super.onDetach(); - } - - @Override protected int fragmentLayout() { - return R.layout.profile_overview_layout; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - onInitOrgs(getPresenter().getOrgs()); - onInitPinnedRepos(getPresenter().getNodes()); - if (savedInstanceState == null) { - getPresenter().onFragmentCreated(getArguments()); - } else { - if (userModel != null) { - invalidateFollowBtn(); - onInitViews(userModel); - } else { - getPresenter().onFragmentCreated(getArguments()); - } - } - if (isMeOrOrganization()) { - followBtn.setVisibility(GONE); - } - } - - @NonNull @Override public ProfileOverviewPresenter providePresenter() { - return new ProfileOverviewPresenter(); - } - - @SuppressLint("ClickableViewAccessibility") @Override public void onInitViews(@Nullable User userModel) { - progress.setVisibility(GONE); - if (userModel == null) return; - if (profileCallback != null) profileCallback.onCheckType(userModel.isOrganizationType()); - if (getView() != null) { - if (this.userModel == null) { - TransitionManager.beginDelayedTransition((ViewGroup) getView(), - new AutoTransition().addListener(new Transition.TransitionListener() { - - @Override public void onTransitionStart(@NonNull Transition transition) { - - } - - @Override public void onTransitionEnd(@NonNull Transition transition) { - if (contributionView != null) getPresenter().onLoadContributionWidget(contributionView); - } - - @Override public void onTransitionCancel(@NonNull Transition transition) { - - } - - @Override public void onTransitionPause(@NonNull Transition transition) { - - } - - @Override public void onTransitionResume(@NonNull Transition transition) { - - } - })); - } else { - getPresenter().onLoadContributionWidget(contributionView); - } - } - this.userModel = userModel; - followBtn.setVisibility(!isMeOrOrganization() ? VISIBLE : GONE); - username.setText(userModel.getLogin()); - fullname.setText(userModel.getName()); - if (userModel.getBio() != null) { - description.setText(EmojiParser.parseToUnicode(userModel.getBio())); - } else { - description.setVisibility(GONE); - } - avatarLayout.setUrl(userModel.getAvatarUrl(), null, false, false, true); - avatarLayout.findViewById(R.id.avatar).setOnTouchListener((v, event) -> { - if (event.getAction() == MotionEvent.ACTION_UP) { - ActivityHelper.startCustomTab(getActivity(), userModel.getAvatarUrl()); - return true; - } - return false; - }); - organization.setText(userModel.getCompany()); - location.setText(userModel.getLocation()); - email.setText(userModel.getEmail()); - link.setText(userModel.getBlog()); - joined.setText(ParseDateFormat.getTimeAgo(userModel.getCreatedAt())); - if (InputHelper.isEmpty(userModel.getCompany())) { - organization.setVisibility(GONE); - } - if (InputHelper.isEmpty(userModel.getLocation())) { - location.setVisibility(GONE); - } - if (InputHelper.isEmpty(userModel.getEmail())) { - email.setVisibility(GONE); - } - if (InputHelper.isEmpty(userModel.getBlog())) { - link.setVisibility(GONE); - } - if (InputHelper.isEmpty(userModel.getCreatedAt())) { - joined.setVisibility(GONE); - } - followers.setText(SpannableBuilder.builder() - .append(getString(R.string.followers)) - .append(" (") - .bold(String.valueOf(userModel.getFollowers())) - .append(")")); - following.setText(SpannableBuilder.builder() - .append(getString(R.string.following)) - .append(" (") - .bold(String.valueOf(userModel.getFollowing())) - .append(")")); - } - - @Override public void invalidateFollowBtn() { - hideProgress(); - if (isMeOrOrganization()) return; - if (getPresenter().isSuccessResponse()) { - followBtn.setEnabled(true); - followBtn.setActivated(getPresenter().isFollowing()); - followBtn.setText(getPresenter().isFollowing() ? getString(R.string.unfollow) : getString(R.string.follow)); - } - } - - @Override public void onInitContributions(boolean show) { - if (contributionView == null) return; - if (show) { - contributionView.onResponse(); - } - contributionCard.setVisibility(show ? VISIBLE : GONE); - contributionsCaption.setVisibility(show ? VISIBLE : GONE); - } - - @Override public void onInitOrgs(@Nullable List orgs) { - if (orgs != null && !orgs.isEmpty()) { - orgsList.setNestedScrollingEnabled(false); - ProfileOrgsAdapter adapter = new ProfileOrgsAdapter(); - adapter.addItems(orgs); - orgsList.setAdapter(adapter); - orgsCard.setVisibility(VISIBLE); - organizationsCaption.setVisibility(VISIBLE); - ((GridManager) orgsList.getLayoutManager()).setIconSize(getResources().getDimensionPixelSize(R.dimen.header_icon_zie) + getResources() - .getDimensionPixelSize(R.dimen.spacing_xs_large)); - } else { - organizationsCaption.setVisibility(GONE); - orgsCard.setVisibility(GONE); - } - } - - @Override public void onUserNotFound() { - showMessage(R.string.error, R.string.no_user_found); - } - - @Override public void onInitPinnedRepos(@NonNull List nodes) { - if (pinnedReposTextView == null) return; - if (!nodes.isEmpty()) { - pinnedReposTextView.setVisibility(VISIBLE); - pinnedReposCard.setVisibility(VISIBLE); - ProfilePinnedReposAdapter adapter = new ProfilePinnedReposAdapter(nodes); - adapter.setListener(new BaseViewHolder.OnItemClickListener() { - @Override public void onItemClick(int position, View v, GetPinnedReposQuery.Node item) { - SchemeParser.launchUri(getContext(), item.url().toString()); - } - - @Override public void onItemLongClick(int position, View v, GetPinnedReposQuery.Node item) {} - }); - pinnedList.addDivider(); - pinnedList.setAdapter(adapter); - } else { - pinnedReposTextView.setVisibility(GONE); - pinnedReposCard.setVisibility(GONE); - } - } - - @Override public void showProgress(@StringRes int resId) { - progress.setVisibility(VISIBLE); - } - - @Override public void hideProgress() { - progress.setVisibility(GONE); - } - - @Override public void showErrorMessage(@NonNull String message) { - onHideProgress(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - onHideProgress(); - super.showMessage(titleRes, msgRes); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - } - - private void onHideProgress() { - hideProgress(); - } - - private boolean isMeOrOrganization() { - return Login.getUser() != null && Login.getUser().getLogin().equalsIgnoreCase(getPresenter().getLogin()) || - (userModel != null && userModel.getType() != null && !userModel.getType().equalsIgnoreCase("user")); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/overview/ProfileOverviewMvp.java b/app/src/main/java/com/fastaccess/ui/modules/profile/overview/ProfileOverviewMvp.java deleted file mode 100644 index ea23173eb..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/overview/ProfileOverviewMvp.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.fastaccess.ui.modules.profile.overview; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.contributions.ContributionsDay; -import com.fastaccess.ui.widgets.contributions.GitHubContributionsView; - -import java.util.ArrayList; -import java.util.List; - -import github.GetPinnedReposQuery; - -/** - * Created by Kosh on 03 Dec 2016, 9:15 AM - */ - -public interface ProfileOverviewMvp { - - interface View extends BaseMvp.FAView { - void onInitViews(@Nullable User userModel); - - void invalidateFollowBtn(); - - void onInitContributions(boolean show); - - void onInitOrgs(@Nullable List orgs); - - void onUserNotFound(); - - void onInitPinnedRepos(@NonNull List nodes); - } - - interface Presenter extends BaseMvp.FAPresenter { - - void onFragmentCreated(@Nullable Bundle bundle); - - void onWorkOffline(@NonNull String login); - - void onCheckFollowStatus(@NonNull String login); - - boolean isSuccessResponse(); - - boolean isFollowing(); - - void onFollowButtonClicked(@NonNull String login); - - void onSendUserToView(@Nullable User userModel); - - void onLoadContributionWidget(@NonNull GitHubContributionsView view); - - @NonNull ArrayList getOrgs(); - - @NonNull ArrayList getContributions(); - - @NonNull ArrayList getNodes(); - - @NonNull String getLogin(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/overview/ProfileOverviewPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/profile/overview/ProfileOverviewPresenter.java deleted file mode 100644 index 07f319d88..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/overview/ProfileOverviewPresenter.java +++ /dev/null @@ -1,197 +0,0 @@ -package com.fastaccess.ui.modules.profile.overview; - -import android.graphics.Bitmap; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.text.TextUtils; - -import com.apollographql.apollo.ApolloCall; -import com.apollographql.apollo.rx2.Rx2Apollo; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.ApolloProdivder; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.widgets.contributions.ContributionsDay; -import com.fastaccess.ui.widgets.contributions.ContributionsProvider; -import com.fastaccess.ui.widgets.contributions.GitHubContributionsView; - -import java.util.ArrayList; -import java.util.List; - -import github.GetPinnedReposQuery; -import io.reactivex.Observable; - -/** - * Created by Kosh on 03 Dec 2016, 9:16 AM - */ - -class ProfileOverviewPresenter extends BasePresenter implements ProfileOverviewMvp.Presenter { - @com.evernote.android.state.State boolean isSuccessResponse; - @com.evernote.android.state.State boolean isFollowing; - @com.evernote.android.state.State String login; - private ArrayList userOrgs = new ArrayList<>(); - private ArrayList nodes = new ArrayList<>(); - private ArrayList contributions = new ArrayList<>(); - private static final String URL = "https://github.com/users/%s/contributions"; - - @Override public void onCheckFollowStatus(@NonNull String login) { - if (!TextUtils.equals(login, Login.getUser().getLogin())) { - manageDisposable(RxHelper.getObservable(RestProvider.getUserService(isEnterprise()).getFollowStatus(login)) - .subscribe(booleanResponse -> { - isSuccessResponse = true; - isFollowing = booleanResponse.code() == 204; - sendToView(ProfileOverviewMvp.View::invalidateFollowBtn); - }, Throwable::printStackTrace)); - } - } - - @Override public boolean isSuccessResponse() { - return isSuccessResponse; - } - - @Override public boolean isFollowing() { - return isFollowing; - } - - @Override public void onFollowButtonClicked(@NonNull String login) { - manageDisposable(RxHelper.getObservable(!isFollowing ? RestProvider.getUserService(isEnterprise()).followUser(login) - : RestProvider.getUserService(isEnterprise()).unfollowUser(login)) - .subscribe(booleanResponse -> { - if (booleanResponse.code() == 204) { - isFollowing = !isFollowing; - sendToView(ProfileOverviewMvp.View::invalidateFollowBtn); - } - }, this::onError)); - } - - @Override public void onError(@NonNull Throwable throwable) { - int statusCode = RestProvider.getErrorCode(throwable); - if (statusCode == 404) { - sendToView(ProfileOverviewMvp.View::onUserNotFound); - return; - } - if (!InputHelper.isEmpty(login)) { - onWorkOffline(login); - } - sendToView(ProfileOverviewMvp.View::invalidateFollowBtn); - super.onError(throwable); - } - - @Override public void onFragmentCreated(@Nullable Bundle bundle) { - if (bundle == null || bundle.getString(BundleConstant.EXTRA) == null) { - throw new NullPointerException("Either bundle or User is null"); - } - login = bundle.getString(BundleConstant.EXTRA); - if (login != null) { - makeRestCall(RestProvider.getUserService(isEnterprise()) - .getUser(login) - .doOnComplete(() -> { - loadPinnedRepos(login); - loadOrgs(); - }), userModel -> { - onSendUserToView(userModel); - if (userModel != null) { - userModel.save(userModel); - if (userModel.getType() != null && userModel.getType().equalsIgnoreCase("user")) { - onCheckFollowStatus(login); - } - } - }); - } - } - - @SuppressWarnings("ConstantConditions") private void loadPinnedRepos(@NonNull String login) { - ApolloCall apolloCall = ApolloProdivder.INSTANCE.getApollo(isEnterprise()) - .query(GetPinnedReposQuery.builder() - .login(login) - .build()); - manageDisposable(RxHelper.getObservable(Rx2Apollo.from(apolloCall)) - .filter(dataResponse -> !dataResponse.hasErrors()) - .flatMap(dataResponse -> { - if (dataResponse.data() != null && dataResponse.data().user() != null) { - return Observable.fromIterable(dataResponse.data().user().pinnedRepositories().edges()); - } - return Observable.empty(); - }) - .map(GetPinnedReposQuery.Edge::node) - .toList() - .toObservable() - .subscribe(nodes1 -> { - nodes.clear(); - nodes.addAll(nodes1); - sendToView(view -> view.onInitPinnedRepos(nodes)); - }, Throwable::printStackTrace)); - } - - @Override public void onWorkOffline(@NonNull String login) { - User userModel = User.getUser(login); - if (userModel == null) { - return; - } - onSendUserToView(userModel); - } - - @Override public void onSendUserToView(@Nullable User userModel) { - sendToView(view -> view.onInitViews(userModel)); - } - - @Override public void onLoadContributionWidget(@NonNull GitHubContributionsView gitHubContributionsView) { - if (!isEnterprise()) { - if (contributions == null || contributions.isEmpty()) { - String url = String.format(URL, login); - manageDisposable(RxHelper.getObservable(RestProvider.getContribution().getContributions(url)) - .flatMap(s -> Observable.just(new ContributionsProvider().getContributions(s))) - .subscribe(lists -> { - contributions.clear(); - contributions.addAll(lists); - loadContributions(contributions, gitHubContributionsView); - }, Throwable::printStackTrace)); - } else { - loadContributions(contributions, gitHubContributionsView); - } - } - } - - @NonNull @Override public ArrayList getOrgs() { - return userOrgs; - } - - @NonNull @Override public ArrayList getContributions() { - return contributions; - } - - @NonNull @Override public ArrayList getNodes() { - return nodes; - } - - @NonNull @Override public String getLogin() { - return login; - } - - private void loadContributions(ArrayList contributions, GitHubContributionsView gitHubContributionsView) { - List filter = gitHubContributionsView.getLastContributions(contributions); - if (filter != null && contributions != null) { - Observable bitmapObservable = Observable.just(gitHubContributionsView.drawOnCanvas(filter, contributions)); - manageObservable(bitmapObservable - .doOnNext(bitmap -> sendToView(view -> view.onInitContributions(bitmap != null)))); - } - } - - private void loadOrgs() { - boolean isMe = login.equalsIgnoreCase(Login.getUser() != null ? Login.getUser().getLogin() : ""); - manageDisposable(RxHelper.getObservable(isMe ? RestProvider.getOrgService(isEnterprise()).getMyOrganizations() - : RestProvider.getOrgService(isEnterprise()).getMyOrganizations(login)) - .subscribe(response -> { - if (response != null && response.getItems() != null) { - userOrgs.addAll(response.getItems()); - } - sendToView(view -> view.onInitOrgs(userOrgs)); - }, Throwable::printStackTrace)); - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/repos/ProfileReposFilterBottomSheetDialog.java b/app/src/main/java/com/fastaccess/ui/modules/profile/repos/ProfileReposFilterBottomSheetDialog.java deleted file mode 100644 index 76462b917..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/repos/ProfileReposFilterBottomSheetDialog.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.fastaccess.ui.modules.profile.repos; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; -import android.widget.ArrayAdapter; -import android.widget.LinearLayout; -import android.widget.Spinner; - -import com.fastaccess.R; -import com.fastaccess.data.dao.FilterOptionsModel; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.ui.base.BaseBottomSheetDialog; -import com.fastaccess.ui.modules.profile.org.repos.OrgReposFragment; -import com.fastaccess.ui.modules.profile.org.repos.OrgReposMvp; -import com.fastaccess.ui.modules.search.SearchUserActivity; - -import butterknife.BindView; -import butterknife.OnClick; - -public class ProfileReposFilterBottomSheetDialog extends BaseBottomSheetDialog { - - @BindView(R.id.type_selection) Spinner typeSelectionSpinner; - @BindView(R.id.sort_selection) Spinner sortSelectionSpinner; - @BindView(R.id.filter_sheet_apply_btn) View applyBtn; - @BindView(R.id.sort_direction_selection) Spinner sortDirectionSpinner; - @BindView(R.id.sort_layout) LinearLayout sortLayout; - @BindView(R.id.sort_direction_layout) LinearLayout sortDirectionlayout; - private FilterOptionsModel currentFilterOptions; - - private ProfileReposFilterChangeListener listener; - - public static ProfileReposFilterBottomSheetDialog newInstance(@NonNull FilterOptionsModel currentFilterOptions) { - ProfileReposFilterBottomSheetDialog fragment = new ProfileReposFilterBottomSheetDialog(); - fragment.setArguments(Bundler.start().put(BundleConstant.ITEM, currentFilterOptions).end()); - return fragment; - } - - @Override protected int layoutRes() { - return R.layout.filter_bottom_sheet; - } - - @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - currentFilterOptions = getArguments().getParcelable(BundleConstant.ITEM); - if (currentFilterOptions == null) return; - ArrayAdapter typesAdapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_list_item_1, - currentFilterOptions.getTypesList()); - ArrayAdapter sortOptionsAdapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_list_item_1, - currentFilterOptions.getSortOptionList()); - ArrayAdapter sortDirectionAdapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_list_item_1, - currentFilterOptions.getSortDirectionList()); - typeSelectionSpinner.setAdapter(typesAdapter); - sortSelectionSpinner.setAdapter(sortOptionsAdapter); - sortDirectionSpinner.setAdapter(sortDirectionAdapter); - typeSelectionSpinner.setSelection(currentFilterOptions.getSelectedTypeIndex()); - sortSelectionSpinner.setSelection(currentFilterOptions.getSelectedSortOptionIndex()); - sortDirectionSpinner.setSelection(currentFilterOptions.getSelectedSortDirectionIndex()); - if (currentFilterOptions.isOrg()) { - sortLayout.setVisibility(View.GONE); - sortDirectionlayout.setVisibility(View.GONE); - } - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (context instanceof OrgReposMvp.View || getParentFragment() instanceof OrgReposMvp.View) { - listener = ((OrgReposFragment) getParentFragment()); - } else { - listener = ((ProfileReposFragment) getParentFragment()); - } - } - - @Override public void onDetach() { - super.onDetach(); - listener = null; - } - - @OnClick(R.id.filter_sheet_apply_btn) public void onApply() { - if (listener != null) { - listener.onTypeSelected((String) typeSelectionSpinner.getSelectedItem()); - listener.onSortOptionSelected((String) sortSelectionSpinner.getSelectedItem()); - listener.onSortDirectionSelected((String) sortDirectionSpinner.getSelectedItem()); - listener.onFilterApply(); - dismiss(); - } - } - - @OnClick(R.id.filter_sheet_reset_btn) public void onReset() { - typeSelectionSpinner.setSelection(0); - sortDirectionSpinner.setSelection(0); - sortSelectionSpinner.setSelection(0); - } - - @OnClick(R.id.filter_sheet_search_btn) public void startSearch() { - if (listener != null) { - Intent intent = SearchUserActivity.Companion.getIntent(getContext(), listener.getLogin(), ""); - startActivity(intent); - } - dismiss(); - } - - public interface ProfileReposFilterChangeListener { - void onFilterApply(); - - void onTypeSelected(String selectedType); - - void onSortOptionSelected(String selectedSortOption); - - void onSortDirectionSelected(String selectedSortDirection); - - String getLogin(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/repos/ProfileReposFragment.java b/app/src/main/java/com/fastaccess/ui/modules/profile/repos/ProfileReposFragment.java deleted file mode 100644 index 6cd606479..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/repos/ProfileReposFragment.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.fastaccess.ui.modules.profile.repos; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.ReposAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class ProfileReposFragment extends BaseFragment implements ProfileReposMvp.View, - ProfileReposFilterBottomSheetDialog.ProfileReposFilterChangeListener { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private ReposAdapter adapter; - - public static ProfileReposFragment newInstance(@NonNull String username) { - ProfileReposFragment view = new ProfileReposFragment(); - view.setArguments(Bundler.start().put(BundleConstant.EXTRA, username).end()); - return view; - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new NullPointerException("Bundle is null, username is required"); - } - stateLayout.setEmptyText(R.string.no_repos); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - adapter = new ReposAdapter(getPresenter().getRepos(), false); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - recycler.addDivider(); - if (getPresenter().getRepos().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public ProfileReposPresenter providePresenter() { - return new ProfileReposPresenter(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter(), getArguments().getString(BundleConstant.EXTRA)); - } - return onLoadMore; - } - - @Override public void onRepoFilterClicked() { - ProfileReposFilterBottomSheetDialog.newInstance(getPresenter().getFilterOptions()) - .show(getChildFragmentManager(), "ProfileReposFilterBottomSheetDialog"); - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, getArguments().getString(BundleConstant.EXTRA)); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } - - @Override - public void onFilterApply() { - getPresenter().onFilterApply(); - } - - @Override - public void onTypeSelected(String selectedType) { - getPresenter().onTypeSelected(selectedType); - } - - @Override - public void onSortOptionSelected(String selectedSortOption) { - getPresenter().onSortOptionSelected(selectedSortOption); - } - - @Override - public void onSortDirectionSelected(String selectedSortDirection) { - getPresenter().onSortDirectionSelected(selectedSortDirection); - } - - @Override - public String getLogin() { - return getArguments().getString(BundleConstant.EXTRA); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/repos/ProfileReposMvp.java b/app/src/main/java/com/fastaccess/ui/modules/profile/repos/ProfileReposMvp.java deleted file mode 100644 index 94268f569..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/repos/ProfileReposMvp.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.fastaccess.ui.modules.profile.repos; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -interface ProfileReposMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - - void onRepoFilterClicked(); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getRepos(); - - void onWorkOffline(@NonNull String login); - void onFilterApply(); - void onTypeSelected(String selectedType); - void onSortOptionSelected(String selectedSortOption); - void onSortDirectionSelected(String selectedSortDirection); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/repos/ProfileReposPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/profile/repos/ProfileReposPresenter.java deleted file mode 100644 index 8a722c32a..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/repos/ProfileReposPresenter.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.fastaccess.ui.modules.profile.repos; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.text.TextUtils; -import android.view.View; - -import com.fastaccess.data.dao.FilterOptionsModel; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class ProfileReposPresenter extends BasePresenter implements ProfileReposMvp.Presenter { - - private ArrayList repos = new ArrayList<>(); - private int page; - private int previousTotal; - private String username; - private int lastPage = Integer.MAX_VALUE; - private String currentLoggedIn; - private FilterOptionsModel filterOptions = new FilterOptionsModel(); - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - sendToView(view -> { - if (view.getLoadMore().getParameter() != null) { - onWorkOffline(view.getLoadMore().getParameter()); - } - }); - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable String parameter) { - if (currentLoggedIn == null) { - currentLoggedIn = Login.getUser().getLogin(); - } - if (parameter == null) { - throw new NullPointerException("Username is null"); - } - username = parameter; - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0) { - sendToView(ProfileReposMvp.View::hideProgress); - return false; - } - boolean isProfile = TextUtils.equals(currentLoggedIn, username); - filterOptions.setIsPersonalProfile(isProfile); - makeRestCall(isProfile - ? RestProvider.getUserService(isEnterprise()).getRepos(filterOptions.getQueryMap(), page) - : RestProvider.getUserService(isEnterprise()).getRepos(parameter, filterOptions.getQueryMap(), page), - repoModelPageable -> { - lastPage = repoModelPageable.getLast(); - if (getCurrentPage() == 1) { - manageDisposable(Repo.saveMyRepos(repoModelPageable.getItems(), parameter)); - } - sendToView(view -> view.onNotifyAdapter(repoModelPageable.getItems(), page)); - }); - return true; - } - - @NonNull @Override public ArrayList getRepos() { - return repos; - } - - @Override public void onWorkOffline(@NonNull String login) { - if (repos.isEmpty()) { - manageDisposable(RxHelper.getObservable(Repo.getMyRepos(login).toObservable()).subscribe(repoModels -> - sendToView(view -> view.onNotifyAdapter(repoModels, 1)))); - } else { - sendToView(ProfileReposMvp.View::hideProgress); - } - } - - @Override public void onItemClick(int position, View v, Repo item) { - SchemeParser.launchUri(v.getContext(), item.getHtmlUrl()); - } - - @Override public void onItemLongClick(int position, View v, Repo item) {} - - @Override public void onFilterApply() { - onCallApi(1, username); - } - - @Override public void onTypeSelected(String selectedType) { - filterOptions.setType(selectedType); - } - - @Override public void onSortOptionSelected(String selectedSortOption) { - filterOptions.setSort(selectedSortOption); - } - - @Override public void onSortDirectionSelected(String selectedSortDirection) { - filterOptions.setSortDirection(selectedSortDirection); - } - - FilterOptionsModel getFilterOptions() { - return filterOptions; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/starred/ProfileStarredFragment.java b/app/src/main/java/com/fastaccess/ui/modules/profile/starred/ProfileStarredFragment.java deleted file mode 100644 index 3347608ab..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/starred/ProfileStarredFragment.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.fastaccess.ui.modules.profile.starred; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.ReposAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class ProfileStarredFragment extends BaseFragment implements ProfileStarredMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private ReposAdapter adapter; - private RepoPagerMvp.TabsBadgeListener tabsBadgeListener; - - public static ProfileStarredFragment newInstance(@NonNull String username) { - ProfileStarredFragment view = new ProfileStarredFragment(); - view.setArguments(Bundler.start().put(BundleConstant.EXTRA, username).end()); - return view; - } - - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() instanceof RepoPagerMvp.TabsBadgeListener) { - tabsBadgeListener = (RepoPagerMvp.TabsBadgeListener) getParentFragment(); - } else if (context instanceof RepoPagerMvp.TabsBadgeListener) { - tabsBadgeListener = (RepoPagerMvp.TabsBadgeListener) context; - } - } - - @Override public void onDetach() { - tabsBadgeListener = null; - super.onDetach(); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new NullPointerException("Bundle is null, username is required"); - } - stateLayout.setEmptyText(R.string.no_starred_repos); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - adapter = new ReposAdapter(getPresenter().getRepos(), true); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - recycler.addDivider(); - if (getPresenter().getRepos().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public ProfileStarredPresenter providePresenter() { - return new ProfileStarredPresenter(); - } - - @Override public void showProgress(@StringRes int resId) { - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter(), getArguments().getString(BundleConstant.EXTRA)); - } - return onLoadMore; - } - - @Override public void onUpdateCount(int starredCount) { - if (tabsBadgeListener != null) { - tabsBadgeListener.onSetBadge(3, starredCount); - } - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, getArguments().getString(BundleConstant.EXTRA)); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/starred/ProfileStarredMvp.java b/app/src/main/java/com/fastaccess/ui/modules/profile/starred/ProfileStarredMvp.java deleted file mode 100644 index e8c2c9a43..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/starred/ProfileStarredMvp.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fastaccess.ui.modules.profile.starred; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -interface ProfileStarredMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - - void onUpdateCount(int starredCount); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getRepos(); - - void onWorkOffline(@NonNull String login); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/profile/starred/ProfileStarredPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/profile/starred/ProfileStarredPresenter.java deleted file mode 100644 index 230e09749..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/profile/starred/ProfileStarredPresenter.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.fastaccess.ui.modules.profile.starred; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.data.dao.Pageable; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class ProfileStarredPresenter extends BasePresenter implements ProfileStarredMvp.Presenter { - - @com.evernote.android.state.State int starredCount = -1; - private ArrayList repos = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - sendToView(view -> { - if (view.getLoadMore().getParameter() != null) { - onWorkOffline(view.getLoadMore().getParameter()); - } - }); - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable String parameter) { - if (parameter == null) { - throw new NullPointerException("Username is null"); - } - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0) { - sendToView(ProfileStarredMvp.View::hideProgress); - return false; - } - Observable> observable; - if (starredCount == -1) { - observable = Observable.zip(RestProvider.getUserService(isEnterprise()).getStarred(parameter, page), - RestProvider.getUserService(isEnterprise()).getStarredCount(parameter), (repoPageable, count) -> { - if (count != null) { - starredCount = count.getLast(); - } - return repoPageable; - }); - } else { - observable = RestProvider.getUserService(isEnterprise()).getStarred(parameter, page); - } - makeRestCall(observable, repoModelPageable -> { - lastPage = repoModelPageable.getLast(); - if (getCurrentPage() == 1) { - manageDisposable(Repo.saveStarred(repoModelPageable.getItems(), parameter)); - } - sendToView(view -> { - view.onUpdateCount(starredCount); - view.onNotifyAdapter(repoModelPageable.getItems(), page); - }); - }); - return true; - } - - @NonNull @Override public ArrayList getRepos() { - return repos; - } - - @Override public void onWorkOffline(@NonNull String login) { - if (repos.isEmpty()) { - manageDisposable(RxHelper.getObservable(Repo.getStarred(login).toObservable()).subscribe(repoModels -> - sendToView(view -> { - starredCount = -1; - view.onUpdateCount(repoModels != null ? repoModels.size() : 0); - view.onNotifyAdapter(repoModels, 1); - }))); - } else { - sendToView(ProfileStarredMvp.View::hideProgress); - } - } - - @Override public void onItemClick(int position, View v, Repo item) { - SchemeParser.launchUri(v.getContext(), item.getHtmlUrl()); - } - - @Override public void onItemLongClick(int position, View v, Repo item) {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/DummyFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/DummyFragment.java deleted file mode 100644 index 3c55fdadf..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/DummyFragment.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.fastaccess.ui.modules.repos; - -import android.os.Bundle; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; - -/** - * Created by Kosh on 11 Mar 2017, 12:10 AM - */ - -public class DummyFragment extends Fragment { - - @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - return inflater.inflate(R.layout.single_container_layout, container, false); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/RepoPagerActivity.java b/app/src/main/java/com/fastaccess/ui/modules/repos/RepoPagerActivity.java deleted file mode 100644 index c9f133d02..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/RepoPagerActivity.java +++ /dev/null @@ -1,642 +0,0 @@ -package com.fastaccess.ui.modules.repos; - -import android.content.Context; -import android.content.Intent; -import android.content.res.ColorStateList; -import android.graphics.Color; -import android.graphics.Rect; -import android.graphics.Typeface; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.floatingactionbutton.FloatingActionButton; -import androidx.transition.TransitionManager; -import androidx.core.widget.TextViewCompat; -import androidx.recyclerview.widget.RecyclerView; -import android.text.format.Formatter; -import android.view.Menu; -import android.view.MenuItem; -import android.view.MotionEvent; -import android.view.View; -import android.widget.CheckBox; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.LicenseModel; -import com.fastaccess.data.dao.NameParser; -import com.fastaccess.data.dao.model.AbstractPinnedRepos; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.AnimHelper; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.helper.TypeFaceHelper; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.provider.colors.ColorsProvider; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.provider.tasks.git.GithubActionService; -import com.fastaccess.ui.adapter.TopicsAdapter; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.modules.filter.issues.FilterIssuesActivity; -import com.fastaccess.ui.modules.main.MainActivity; -import com.fastaccess.ui.modules.repos.code.RepoCodePagerFragment; -import com.fastaccess.ui.modules.repos.extras.labels.LabelsDialogFragment; -import com.fastaccess.ui.modules.repos.extras.license.RepoLicenseBottomSheet; -import com.fastaccess.ui.modules.repos.extras.milestone.create.MilestoneDialogFragment; -import com.fastaccess.ui.modules.repos.extras.misc.RepoMiscDialogFragment; -import com.fastaccess.ui.modules.repos.extras.misc.RepoMiscMVp; -import com.fastaccess.ui.modules.repos.issues.RepoIssuesPagerFragment; -import com.fastaccess.ui.modules.repos.pull_requests.RepoPullRequestPagerFragment; -import com.fastaccess.ui.modules.repos.wiki.WikiActivity; -import com.fastaccess.ui.modules.user.UserPagerActivity; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.ForegroundImageView; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; - -import java.text.NumberFormat; - -import butterknife.BindView; -import butterknife.OnCheckedChanged; -import butterknife.OnClick; -import butterknife.OnLongClick; -import it.sephiroth.android.library.bottomnavigation.BottomNavigation; - -/** - * Created by Kosh on 09 Dec 2016, 4:17 PM - */ - -public class RepoPagerActivity extends BaseActivity implements RepoPagerMvp.View { - - @BindView(R.id.avatarLayout) AvatarLayout avatarLayout; - @BindView(R.id.headerTitle) FontTextView title; - @BindView(R.id.size) FontTextView size; - @BindView(R.id.date) FontTextView date; - @BindView(R.id.forkRepo) FontTextView forkRepo; - @BindView(R.id.starRepo) FontTextView starRepo; - @BindView(R.id.watchRepo) FontTextView watchRepo; - @BindView(R.id.license) FontTextView license; - @BindView(R.id.bottomNavigation) BottomNavigation bottomNavigation; - @BindView(R.id.fab) FloatingActionButton fab; - @BindView(R.id.language) FontTextView language; - @BindView(R.id.detailsIcon) View detailsIcon; - @BindView(R.id.tagsIcon) View tagsIcon; - @BindView(R.id.watchRepoImage) ForegroundImageView watchRepoImage; - @BindView(R.id.starRepoImage) ForegroundImageView starRepoImage; - @BindView(R.id.forkRepoImage) ForegroundImageView forkRepoImage; - @BindView(R.id.licenseLayout) View licenseLayout; - @BindView(R.id.watchRepoLayout) View watchRepoLayout; - @BindView(R.id.starRepoLayout) View starRepoLayout; - @BindView(R.id.forkRepoLayout) View forkRepoLayout; - @BindView(R.id.pinImage) ForegroundImageView pinImage; - @BindView(R.id.pinLayout) View pinLayout; - @BindView(R.id.pinText) FontTextView pinText; - @BindView(R.id.filterLayout) View filterLayout; - @BindView(R.id.topicsList) RecyclerView topicsList; - @BindView(R.id.sortByUpdated) CheckBox sortByUpdated; - @BindView(R.id.wikiLayout) View wikiLayout; - @State @RepoPagerMvp.RepoNavigationType int navType; - @State String login; - @State String repoId; - @State int showWhich = -1; - - private NumberFormat numberFormat = NumberFormat.getNumberInstance(); - private boolean userInteracted; - private int accentColor; - private int iconColor; - - public static void startRepoPager(@NonNull Context context, @NonNull NameParser nameParser) { - if (!InputHelper.isEmpty(nameParser.getName()) && !InputHelper.isEmpty(nameParser.getUsername())) { - Intent intent = new Intent(context, RepoPagerActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.ID, nameParser.getName()) - .put(BundleConstant.EXTRA_TWO, nameParser.getUsername()) - .put(BundleConstant.EXTRA_TYPE, RepoPagerMvp.CODE) - .put(BundleConstant.IS_ENTERPRISE, nameParser.isEnterprise()) - .end()); - context.startActivity(intent); - } - } - - public static Intent createIntent(@NonNull Context context, @NonNull String repoId, @NonNull String login) { - return createIntent(context, repoId, login, RepoPagerMvp.CODE); - } - - public static Intent createIntent(@NonNull Context context, @NonNull String repoId, @NonNull String login, - @RepoPagerMvp.RepoNavigationType int navType) { - return createIntent(context, repoId, login, navType, -1); - } - - public static Intent createIntent(@NonNull Context context, @NonNull String repoId, @NonNull String login, - @RepoPagerMvp.RepoNavigationType int navType, int showWhat) { - Intent intent = new Intent(context, RepoPagerActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA_TWO, login) - .put(BundleConstant.EXTRA_TYPE, navType) - .put(BundleConstant.EXTRA_THREE, showWhat) - .end()); - return intent; - } - - @OnLongClick(R.id.date) boolean onShowDateHint() { - showMessage(R.string.creation_date, R.string.creation_date_hint); - return true; - } - - @OnLongClick(R.id.size) boolean onShowLastUpdateDateHint() { - showMessage(R.string.last_updated, R.string.last_updated_hint); - return true; - } - - @OnLongClick(R.id.fab) boolean onFabLongClick() { - if (navType == RepoPagerMvp.ISSUES) { - onAddSelected(); - return true; - } - return false; - } - - @OnClick(R.id.fab) void onFabClicked() { - if (navType == RepoPagerMvp.ISSUES) { - fab.hide(new FloatingActionButton.OnVisibilityChangedListener() { - @Override public void onHidden(FloatingActionButton fab) { - super.onHidden(fab); - if (appbar != null) appbar.setExpanded(false, true); - bottomNavigation.setExpanded(false, true); - AnimHelper.mimicFabVisibility(true, filterLayout, null); - } - }); - } else if (navType == RepoPagerMvp.PULL_REQUEST) { - RepoPullRequestPagerFragment pullRequestPagerView = (RepoPullRequestPagerFragment) AppHelper.getFragmentByTag(getSupportFragmentManager(), - RepoPullRequestPagerFragment.TAG); - if (pullRequestPagerView != null) { - FilterIssuesActivity.startActivity(this, getPresenter().login(), getPresenter().repoId(), false, - pullRequestPagerView.getCurrentItem() == 0, isEnterprise()); - } - } else { - fab.hide(); - } - } - - @OnClick(R.id.add) void onAddIssues() { - hideFilterLayout(); - onAddSelected(); - } - - @OnClick(R.id.search) void onSearch() { - hideFilterLayout(); - onSearchSelected(); - } - - @Override public boolean dispatchTouchEvent(MotionEvent ev) { - if (navType == RepoPagerMvp.ISSUES && filterLayout.isShown()) { - Rect viewRect = ViewHelper.getLayoutPosition(filterLayout); - if (!viewRect.contains((int) ev.getRawX(), (int) ev.getRawY())) { - hideFilterLayout(); - } - } - return super.dispatchTouchEvent(ev); - } - - @OnClick(R.id.detailsIcon) void onTitleClick() { - Repo repoModel = getPresenter().getRepo(); - if (repoModel != null && !InputHelper.isEmpty(repoModel.getDescription())) { - MessageDialogView.newInstance(repoModel.getFullName(), repoModel.getDescription(), false, true) - .show(getSupportFragmentManager(), MessageDialogView.TAG); - } - } - - @OnClick(R.id.tagsIcon) void onTagsClick() { - if (topicsList.getAdapter().getItemCount() > 0) { - TransitionManager.beginDelayedTransition(topicsList); - topicsList.setVisibility(topicsList.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); - } - } - - @OnClick({R.id.forkRepoLayout, R.id.starRepoLayout, R.id.watchRepoLayout, - R.id.pinLayout, R.id.wikiLayout, R.id.licenseLayout}) void onClick(View view) { - switch (view.getId()) { - case R.id.forkRepoLayout: - MessageDialogView.newInstance(getString(R.string.fork), String.format("%s %s/%s?", getString(R.string.fork), login, repoId), - Bundler.start().put(BundleConstant.EXTRA, true).put(BundleConstant.YES_NO_EXTRA, true).end()) - .show(getSupportFragmentManager(), MessageDialogView.TAG); - break; - case R.id.starRepoLayout: - if (!InputHelper.isEmpty(getPresenter().login()) && !InputHelper.isEmpty(getPresenter().repoId())) { - GithubActionService.startForRepo(this, getPresenter().login(), getPresenter().repoId(), - getPresenter().isStarred() ? GithubActionService.UNSTAR_REPO : GithubActionService.STAR_REPO, isEnterprise()); - getPresenter().onStar(); - } - break; - case R.id.watchRepoLayout: - if (!InputHelper.isEmpty(getPresenter().login()) && !InputHelper.isEmpty(getPresenter().repoId())) { - GithubActionService.startForRepo(this, getPresenter().login(), getPresenter().repoId(), - getPresenter().isWatched() ? GithubActionService.UNWATCH_REPO : GithubActionService.WATCH_REPO, isEnterprise()); - getPresenter().onWatch(); - } - break; - case R.id.pinLayout: - pinLayout.setEnabled(false); - getPresenter().onPinUnpinRepo(); - break; - case R.id.wikiLayout: - ActivityHelper.startReveal(this, WikiActivity.Companion.getWiki(this, repoId, login), wikiLayout); - break; - case R.id.licenseLayout: - if (getPresenter().getRepo() != null) { - LicenseModel licenseModel = getPresenter().getRepo().getLicense(); - String license = !InputHelper.isEmpty(licenseModel.getSpdxId()) ? licenseModel.getSpdxId() : licenseModel.getName(); - RepoLicenseBottomSheet.Companion.newInstance(getPresenter().login(), getPresenter().repoId(), license) - .show(getSupportFragmentManager(), "RepoLicenseBottomSheet"); - } - break; - } - } - - @OnLongClick({R.id.forkRepoLayout, R.id.starRepoLayout, R.id.watchRepoLayout}) boolean onLongClick(View view) { - switch (view.getId()) { - case R.id.forkRepoLayout: - RepoMiscDialogFragment.show(getSupportFragmentManager(), login, repoId, RepoMiscMVp.FORKS); - return true; - case R.id.starRepoLayout: - RepoMiscDialogFragment.show(getSupportFragmentManager(), login, repoId, RepoMiscMVp.STARS); - return true; - case R.id.watchRepoLayout: - RepoMiscDialogFragment.show(getSupportFragmentManager(), login, repoId, RepoMiscMVp.WATCHERS); - return true; - } - return false; - } - - @OnCheckedChanged(R.id.sortByUpdated) void onSortIssues(boolean isChecked) { - RepoIssuesPagerFragment pagerView = (RepoIssuesPagerFragment) AppHelper.getFragmentByTag(getSupportFragmentManager(), - RepoIssuesPagerFragment.TAG); - if (pagerView != null) { - pagerView.onChangeIssueSort(isChecked); - } - hideFilterLayout(); - } - - @Override protected int layout() { - return R.layout.repo_pager_activity; - } - - @Override protected boolean isTransparent() { - return true; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @NonNull @Override public RepoPagerPresenter providePresenter() { - return new RepoPagerPresenter(); - } - - @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - if (savedInstanceState == null) { - if (getIntent() == null || getIntent().getExtras() == null) { - finish(); - return; - } - final Bundle extras = getIntent().getExtras(); - repoId = extras.getString(BundleConstant.ID); - login = extras.getString(BundleConstant.EXTRA_TWO); - navType = extras.getInt(BundleConstant.EXTRA_TYPE); - showWhich = extras.getInt(BundleConstant.EXTRA_THREE); - getPresenter().onUpdatePinnedEntry(repoId, login); - } - getPresenter().onActivityCreate(repoId, login, navType); - setTitle(""); - accentColor = ViewHelper.getAccentColor(this); - iconColor = ViewHelper.getIconColor(this); - if (savedInstanceState == null) { - getSupportFragmentManager() - .beginTransaction() - .add(R.id.container, new DummyFragment(), "DummyFragment") - .commit(); - } - Typeface myTypeface = TypeFaceHelper.getTypeface(); - bottomNavigation.setDefaultTypeface(myTypeface); - fab.setImageTintList(ColorStateList.valueOf(Color.WHITE)); - showHideFab(); - } - - @Override public void onNavigationChanged(@RepoPagerMvp.RepoNavigationType int navType) { - if (navType == RepoPagerMvp.PROFILE) { - getPresenter().onModuleChanged(getSupportFragmentManager(), navType); - bottomNavigation.setSelectedIndex(this.navType, true); - return; - } - this.navType = navType; - //noinspection WrongConstant - try { - if (bottomNavigation.getSelectedIndex() != navType) bottomNavigation.setSelectedIndex(navType, true); - } catch (Exception ignored) {} - showHideFab(); - getPresenter().onModuleChanged(getSupportFragmentManager(), navType); - } - - @Override public void onFinishActivity() { - //do nothing here, github might return 404 if even the repo don't have anything but issues. - } - - @Override public void onInitRepo() { - hideProgress(); - if (getPresenter().getRepo() == null) { - return; - } - switch (showWhich) { - case 1: - onLongClick(watchRepoLayout); - break; - case 2: - onLongClick(starRepoLayout); - break; - case 3: - onLongClick(forkRepoLayout); - break; - case 4: - MilestoneDialogFragment.newInstance(login, repoId) - .show(getSupportFragmentManager(), "MilestoneDialogFragment"); - break; - case 5: - LabelsDialogFragment.newInstance(null, repoId, login) - .show(getSupportFragmentManager(), "LabelsDialogFragment"); - break; - } - showWhich = -1; - setTaskName(getPresenter().getRepo().getFullName()); - Repo repoModel = getPresenter().getRepo(); - if (repoModel.isHasProjects()) { - bottomNavigation.inflateMenu(R.menu.repo_with_project_bottom_nav_menu); - } - bottomNavigation.setOnMenuItemClickListener(getPresenter()); - if (repoModel.getTopics() != null && !repoModel.getTopics().isEmpty()) { - tagsIcon.setVisibility(View.VISIBLE); - topicsList.setAdapter(new TopicsAdapter(repoModel.getTopics())); - } else { - topicsList.setVisibility(View.GONE); - } - onRepoPinned(AbstractPinnedRepos.isPinned(repoModel.getFullName())); - wikiLayout.setVisibility(repoModel.isHasWiki() ? View.VISIBLE : View.GONE); - pinText.setText(R.string.pin); - detailsIcon.setVisibility(InputHelper.isEmpty(repoModel.getDescription()) ? View.GONE : View.VISIBLE); - language.setVisibility(InputHelper.isEmpty(repoModel.getLanguage()) ? View.GONE : View.VISIBLE); - if (!InputHelper.isEmpty(repoModel.getLanguage())) { - language.setText(repoModel.getLanguage()); - language.setTextColor(ColorsProvider.getColorAsColor(repoModel.getLanguage(), language.getContext())); - } - forkRepo.setText(numberFormat.format(repoModel.getForksCount())); - starRepo.setText(numberFormat.format(repoModel.getStargazersCount())); - watchRepo.setText(numberFormat.format(repoModel.getSubsCount())); - if (repoModel.getOwner() != null) { - avatarLayout.setUrl(repoModel.getOwner().getAvatarUrl(), repoModel.getOwner().getLogin(), - repoModel.getOwner().isOrganizationType(), LinkParserHelper.isEnterprise(repoModel.getHtmlUrl())); - } else if (repoModel.getOrganization() != null) { - avatarLayout.setUrl(repoModel.getOrganization().getAvatarUrl(), repoModel.getOrganization().getLogin(), true, - LinkParserHelper.isEnterprise(repoModel.getHtmlUrl())); - } - long repoSize = repoModel.getSize() > 0 ? (repoModel.getSize() * 1000) : repoModel.getSize(); - date.setText(SpannableBuilder.builder() - .append(ParseDateFormat.getTimeAgo(repoModel.getPushedAt())) - .append(" ,") - .append(" ") - .append(Formatter.formatFileSize(this, repoSize))); - size.setVisibility(View.GONE); - title.setText(repoModel.getFullName()); - TextViewCompat.setTextAppearance(title, R.style.TextAppearance_AppCompat_Medium); - title.setTextColor(ViewHelper.getPrimaryTextColor(this)); - if (repoModel.getLicense() != null) { - licenseLayout.setVisibility(View.VISIBLE); - LicenseModel licenseModel = repoModel.getLicense(); - license.setText(!InputHelper.isEmpty(licenseModel.getSpdxId()) ? licenseModel.getSpdxId() : licenseModel.getName()); - } - supportInvalidateOptionsMenu(); - if (!PrefGetter.isRepoGuideShowed()) {} - onRepoWatched(getPresenter().isWatched()); - onRepoStarred(getPresenter().isStarred()); - onRepoForked(getPresenter().isForked()); - } - - @Override public void onRepoWatched(boolean isWatched) { - watchRepoImage.tintDrawableColor(isWatched ? accentColor : iconColor); - onEnableDisableWatch(true); - } - - @Override public void onRepoStarred(boolean isStarred) { - starRepoImage.setImageResource(isStarred ? R.drawable.ic_star_filled : R.drawable.ic_star); - starRepoImage.tintDrawableColor(isStarred ? accentColor : iconColor); - onEnableDisableStar(true); - } - - @Override public void onRepoForked(boolean isForked) { - forkRepoImage.tintDrawableColor(isForked ? accentColor : iconColor); - onEnableDisableFork(true); - } - - @Override public void onRepoPinned(boolean isPinned) { - pinImage.setImageResource(isPinned ? R.drawable.ic_pin_filled : R.drawable.ic_pin); - pinLayout.setEnabled(true); - } - - @Override public void onEnableDisableWatch(boolean isEnabled) { - watchRepoLayout.setEnabled(isEnabled); - } - - @Override public void onEnableDisableStar(boolean isEnabled) { - starRepoLayout.setEnabled(isEnabled); - } - - @Override public void onEnableDisableFork(boolean isEnabled) { - forkRepoLayout.setEnabled(isEnabled); - } - - @Override public void onChangeWatchedCount(boolean isWatched) { - long count = InputHelper.toLong(watchRepo); - watchRepo.setText(numberFormat.format(isWatched ? (count + 1) : (count > 0 ? (count - 1) : 0))); - updatePinnedRepo(); - } - - @Override public void onChangeStarCount(boolean isStarred) { - long count = InputHelper.toLong(starRepo); - starRepo.setText(numberFormat.format(isStarred ? (count + 1) : (count > 0 ? (count - 1) : 0))); - updatePinnedRepo(); - } - - @Override public void onChangeForkCount(boolean isForked) { - long count = InputHelper.toLong(forkRepo); - forkRepo.setText(numberFormat.format(isForked ? (count + 1) : (count > 0 ? (count - 1) : 0))); - updatePinnedRepo(); - } - - @Override public void onUserInteraction() { - super.onUserInteraction(); - userInteracted = true; - } - - @Override public boolean hasUserInteractedWithView() { - return userInteracted; - } - - @Override public void disableIssueTab() { - showMessage(R.string.error, R.string.repo_issues_is_disabled); - bottomNavigation.setMenuItemEnabled(1, false); - bottomNavigation.setSelectedIndex(this.navType, true); - } - - @Override public void openUserProfile() { - UserPagerActivity.startActivity(this, Login.getUser().getLogin(), false, PrefGetter.isEnterprise(), -1); - } - - @Override public void onScrolled(boolean isUp) { - if (fab != null) { - if (isUp) { - fab.hide(); - } else { - fab.show(); - } - } - } - - @Override public boolean isCollaborator() { - return getPresenter().isRepoOwner(); - } - - @Override public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.repo_menu, menu); - return super.onCreateOptionsMenu(menu); - } - - @Override public boolean onPrepareOptionsMenu(Menu menu) { - Repo repoModel = getPresenter().getRepo(); - if (repoModel != null && repoModel.isFork() && repoModel.getParent() != null) { - MenuItem menuItem = menu.findItem(R.id.originalRepo); - menuItem.setVisible(true); - menuItem.setTitle(repoModel.getParent().getFullName()); - } -// menu.findItem(R.id.deleteRepo).setVisible(getPresenter().isRepoOwner()); - if (menu.findItem(R.id.deleteRepo) != null) menu.findItem(R.id.deleteRepo).setVisible(false);//removing delete permission. - return super.onPrepareOptionsMenu(menu); - } - - @Override public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == android.R.id.home) { - startActivity(new Intent(this, MainActivity.class)); - finish(); - } else if (item.getItemId() == R.id.share) { - if (getPresenter().getRepo() != null) ActivityHelper.shareUrl(this, getPresenter().getRepo().getHtmlUrl()); - return true; - } else if (item.getItemId() == R.id.browser) { - if (getPresenter().getRepo() != null) ActivityHelper.startCustomTab(this, getPresenter().getRepo().getHtmlUrl()); - return true; - } else if (item.getItemId() == R.id.copy) { - if (getPresenter().getRepo() != null) AppHelper.copyToClipboard(this, getPresenter().getRepo().getHtmlUrl()); - return true; - } else if (item.getItemId() == R.id.originalRepo) { - if (getPresenter().getRepo() != null && getPresenter().getRepo().getParent() != null) { - Repo parent = getPresenter().getRepo().getParent(); - SchemeParser.launchUri(this, parent.getHtmlUrl()); - } - return true; - } else if (item.getItemId() == R.id.deleteRepo) { - MessageDialogView.newInstance(getString(R.string.delete_repo), getString(R.string.delete_repo_warning), - Bundler.start().put(BundleConstant.EXTRA_TWO, true) - .put(BundleConstant.YES_NO_EXTRA, true) - .end()).show(getSupportFragmentManager(), MessageDialogView.TAG); - return true; - } - return super.onOptionsItemSelected(item); - } - - @SuppressWarnings("ConstantConditions") @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (isOk && bundle != null) { - boolean isDelete = bundle.getBoolean(BundleConstant.EXTRA_TWO); - boolean fork = bundle.getBoolean(BundleConstant.EXTRA); - if (fork) { - if (getPresenter().login() != null && getPresenter().repoId() != null && !getPresenter().isForked()) { - GithubActionService.startForRepo(this, getPresenter().login(), getPresenter().repoId(), - GithubActionService.FORK_REPO, isEnterprise()); - getPresenter().onFork(); - } - } - if (isDelete) getPresenter().onDeleteRepo(); - } - } - - @Override public void onBackPressed() { - if (navType == RepoPagerMvp.CODE) { - RepoCodePagerFragment codePagerView = (RepoCodePagerFragment) AppHelper.getFragmentByTag(getSupportFragmentManager(), - RepoCodePagerFragment.TAG); - if (codePagerView != null) { - if (codePagerView.canPressBack()) { - super.onBackPressed(); - } else { - codePagerView.onBackPressed(); - return; - } - } - } else if (navType == RepoPagerMvp.ISSUES && filterLayout.isShown()) { - hideFilterLayout(); - return; - } - super.onBackPressed(); - } - - @Override public void onAddSelected() { - RepoIssuesPagerFragment pagerView = (RepoIssuesPagerFragment) AppHelper.getFragmentByTag(getSupportFragmentManager(), - RepoIssuesPagerFragment.TAG); - if (pagerView != null) { - pagerView.onAddIssue(); - } - } - - @Override public void onSearchSelected() { - boolean isOpen = true; - RepoIssuesPagerFragment pagerView = (RepoIssuesPagerFragment) AppHelper.getFragmentByTag(getSupportFragmentManager(), - RepoIssuesPagerFragment.TAG); - if (pagerView != null) { - isOpen = pagerView.getCurrentItem() == 0; - } - FilterIssuesActivity.startActivity(this, getPresenter().login(), getPresenter().repoId(), true, isOpen, isEnterprise()); - } - - private void showHideFab() { - if (navType == RepoPagerMvp.ISSUES) { - fab.setImageResource(R.drawable.ic_menu); - fab.show(); - if (!PrefGetter.isRepoFabHintShowed()) {} - } else if (navType == RepoPagerMvp.PULL_REQUEST) { - fab.setImageResource(R.drawable.ic_search); - fab.show(); - } else { - fab.hide(); - } - } - - private void hideFilterLayout() { - AnimHelper.mimicFabVisibility(false, filterLayout, new FloatingActionButton.OnVisibilityChangedListener() { - @Override public void onHidden(FloatingActionButton actionButton) { - fab.show(); - } - }); - } - - private void updatePinnedRepo() { - getPresenter().updatePinned((int) InputHelper.toLong(forkRepo), (int) InputHelper.toLong(starRepo), (int) InputHelper.toLong(watchRepo)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/RepoPagerMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/RepoPagerMvp.java deleted file mode 100644 index f94424902..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/RepoPagerMvp.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.fastaccess.ui.modules.repos; - -import androidx.annotation.IntDef; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentManager; - -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.filter.chooser.FilterAddChooserListener; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -import it.sephiroth.android.library.bottomnavigation.BottomNavigation; - -/** - * Created by Kosh on 09 Dec 2016, 4:16 PM - */ - -public interface RepoPagerMvp { - - int CODE = 0; - int ISSUES = 1; - int PULL_REQUEST = 2; - int PROJECTS = 3; - int PROFILE = 4; - - @IntDef({ - CODE, - ISSUES, - PULL_REQUEST, - PROJECTS, - PROFILE - }) - @Retention(RetentionPolicy.SOURCE) @interface RepoNavigationType {} - - - interface View extends BaseMvp.FAView, FilterAddChooserListener { - - void onNavigationChanged(@RepoNavigationType int navType); - - void onFinishActivity(); - - void onInitRepo(); - - void onRepoWatched(boolean isWatched); - - void onRepoStarred(boolean isStarred); - - void onRepoForked(boolean isForked); - - void onRepoPinned(boolean isPinned); - - void onEnableDisableWatch(boolean isEnabled); - - void onEnableDisableStar(boolean isEnabled); - - void onEnableDisableFork(boolean isEnabled); - - void onChangeWatchedCount(boolean isWatched); - - void onChangeStarCount(boolean isStarred); - - void onChangeForkCount(boolean isForked); - - boolean hasUserInteractedWithView(); - - void disableIssueTab(); - - void openUserProfile(); - - void onScrolled(boolean isUp); - - boolean isCollaborator(); - } - - interface Presenter extends BaseMvp.FAPresenter, BottomNavigation.OnMenuItemSelectionListener { - - void onUpdatePinnedEntry(@NonNull String repoId, @NonNull String login); - - void onActivityCreate(@NonNull String repoId, @NonNull String login, @RepoPagerMvp.RepoNavigationType int navTyp); - - @NonNull String repoId(); - - @NonNull String login(); - - @Nullable Repo getRepo(); - - boolean isWatched(); - - boolean isStarred(); - - boolean isForked(); - - boolean isRepoOwner(); - - void onWatch(); - - void onStar(); - - void onFork(); - - void onCheckWatching(); - - void onCheckStarring(); - - void onWorkOffline(); - - void onModuleChanged(@NonNull FragmentManager fragmentManager, @RepoNavigationType int type); - - void onShowHideFragment(@NonNull FragmentManager fragmentManager, @NonNull Fragment toShow, @NonNull Fragment toHide); - - void onAddAndHide(@NonNull FragmentManager fragmentManager, @NonNull Fragment toAdd, @NonNull Fragment toHide); - - void onDeleteRepo(); - - void onPinUnpinRepo(); - - void updatePinned(int forks, int stars, int watching); - } - - interface TabsBadgeListener { - void onSetBadge(int tabIndex, int count); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/RepoPagerPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/RepoPagerPresenter.java deleted file mode 100644 index abb827d68..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/RepoPagerPresenter.java +++ /dev/null @@ -1,316 +0,0 @@ -package com.fastaccess.ui.modules.repos; - -import androidx.annotation.IdRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentManager; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.AbstractPinnedRepos; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.PinnedRepos; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.repos.code.RepoCodePagerFragment; -import com.fastaccess.ui.modules.repos.issues.RepoIssuesPagerFragment; -import com.fastaccess.ui.modules.repos.projects.RepoProjectsFragmentPager; -import com.fastaccess.ui.modules.repos.pull_requests.RepoPullRequestPagerFragment; - -import io.reactivex.Observable; - -import static com.fastaccess.helper.ActivityHelper.getVisibleFragment; - -/** - * Created by Kosh on 09 Dec 2016, 4:17 PM - */ - -class RepoPagerPresenter extends BasePresenter implements RepoPagerMvp.Presenter { - @com.evernote.android.state.State boolean isWatched; - @com.evernote.android.state.State boolean isStarred; - @com.evernote.android.state.State boolean isForked; - @com.evernote.android.state.State String login; - @com.evernote.android.state.State String repoId; - @com.evernote.android.state.State Repo repo; - @com.evernote.android.state.State int navTyp; - @com.evernote.android.state.State boolean isCollaborator; - - private void callApi(int navTyp) { - if (InputHelper.isEmpty(login) || InputHelper.isEmpty(repoId)) return; - makeRestCall(Observable.zip(RestProvider.getRepoService(isEnterprise()).getRepo(login(), repoId()), - RestProvider.getRepoService(isEnterprise()).isCollaborator(login, repoId, Login.getUser().getLogin()), - (repo1, booleanResponse) -> { - isCollaborator = booleanResponse.code() == 204; - return repo1; - }), - repoModel -> { - this.repo = repoModel; - manageDisposable(this.repo.save(repo)); - updatePinned(repoModel); - sendToView(view -> { - view.onInitRepo(); - view.onNavigationChanged(navTyp); - }); - onCheckStarring(); - onCheckWatching(); - }); - } - - @Override public void onError(@NonNull Throwable throwable) { - int code = RestProvider.getErrorCode(throwable); - if (code == 404) { - sendToView(BaseMvp.FAView::onOpenUrlInBrowser); - } else { - onWorkOffline(); - } - super.onError(throwable); - } - - @Override public void onUpdatePinnedEntry(@NonNull String repoId, @NonNull String login) { - manageDisposable(PinnedRepos.updateEntry(login + "/" + repoId)); - } - - @Override public void onActivityCreate(@NonNull String repoId, @NonNull String login, int navTyp) { - this.login = login; - this.repoId = repoId; - this.navTyp = navTyp; - if (getRepo() == null || !isApiCalled()) { - callApi(navTyp); - } else { - sendToView(RepoPagerMvp.View::onInitRepo); - } - } - - @NonNull @Override public String repoId() { - return repoId; - } - - @NonNull @Override public String login() { - return login; - } - - @Nullable @Override public Repo getRepo() { - return repo; - } - - @Override public boolean isWatched() { - return isWatched; - } - - @Override public boolean isStarred() { - return isStarred; - } - - @Override public boolean isForked() { - return isForked; - } - - @Override public boolean isRepoOwner() { - if (getRepo() != null && getRepo().getOwner() != null) { - return getRepo().getOwner().getLogin().equals(Login.getUser().getLogin()) || isCollaborator; - } - return false; - } - - @Override public void onWatch() { - if (getRepo() == null) return; - isWatched = !isWatched; - sendToView(view -> { - view.onRepoWatched(isWatched); - view.onChangeWatchedCount(isWatched); - }); - } - - @Override public void onStar() { - if (getRepo() == null) return; - isStarred = !isStarred; - sendToView(view -> { - view.onRepoStarred(isStarred); - view.onChangeStarCount(isStarred); - }); - } - - @Override public void onFork() { - if (!isForked && getRepo() != null) { - isForked = true; - sendToView(view -> { - view.onRepoForked(isForked); - view.onChangeForkCount(isForked); - }); - } - } - - @Override public void onCheckWatching() { - if (getRepo() != null) { - String login = login(); - String name = repoId(); - manageDisposable(RxHelper.getObservable(RestProvider.getRepoService(isEnterprise()).isWatchingRepo(login, name)) - .doOnSubscribe(disposable -> sendToView(view -> view.onEnableDisableWatch(false))) - .doOnNext(subscriptionModel -> sendToView(view -> view.onRepoWatched(isWatched = subscriptionModel.isSubscribed()))) - .subscribe(o -> {/**/}, throwable -> { - isWatched = false; - sendToView(view -> view.onRepoWatched(isWatched)); - })); - } - } - - @Override public void onCheckStarring() { - if (getRepo() != null) { - String login = login(); - String name = repoId(); - manageDisposable(RxHelper.getObservable(RestProvider.getRepoService(isEnterprise()).checkStarring(login, name)) - .doOnSubscribe(disposable -> sendToView(view -> view.onEnableDisableStar(false))) - .doOnNext(response -> sendToView(view -> view.onRepoStarred(isStarred = response.code() == 204))) - .subscribe(booleanResponse -> {/**/}, throwable -> { - isStarred = false; - sendToView(view -> view.onRepoStarred(isStarred)); - })); - } - } - - @Override public void onWorkOffline() { - if (!InputHelper.isEmpty(login()) && !InputHelper.isEmpty(repoId())) { - manageDisposable(RxHelper.getObservable(Repo.getRepo(repoId, login).toObservable()) - .subscribe(repoModel -> { - repo = repoModel; - if (repo != null) { - sendToView(view -> { - view.onInitRepo(); - view.onNavigationChanged(RepoPagerMvp.CODE); - }); - } else { - callApi(navTyp); - } - }, Throwable::printStackTrace)); - } else { - sendToView(RepoPagerMvp.View::onFinishActivity); - } - } - - @Override public void onModuleChanged(@NonNull FragmentManager fragmentManager, @RepoPagerMvp.RepoNavigationType int type) { - Fragment currentVisible = getVisibleFragment(fragmentManager); - RepoCodePagerFragment codePagerView = (RepoCodePagerFragment) AppHelper.getFragmentByTag(fragmentManager, RepoCodePagerFragment.TAG); - RepoIssuesPagerFragment repoIssuesPagerView = (RepoIssuesPagerFragment) - AppHelper.getFragmentByTag(fragmentManager, RepoIssuesPagerFragment.TAG); - RepoPullRequestPagerFragment pullRequestPagerView = (RepoPullRequestPagerFragment) - AppHelper.getFragmentByTag(fragmentManager, RepoPullRequestPagerFragment.TAG); - RepoProjectsFragmentPager projectsFragmentPager = (RepoProjectsFragmentPager) AppHelper.getFragmentByTag(fragmentManager, - RepoProjectsFragmentPager.Companion.getTAG()); - if (getRepo() == null) { - sendToView(RepoPagerMvp.View::onFinishActivity); - return; - } - if (currentVisible == null) return; - switch (type) { - case RepoPagerMvp.PROFILE: - sendToView(RepoPagerMvp.View::openUserProfile); - case RepoPagerMvp.CODE: - if (codePagerView == null) { - onAddAndHide(fragmentManager, RepoCodePagerFragment.newInstance(repoId(), login(), - getRepo().getHtmlUrl(), getRepo().getUrl(), getRepo().getDefaultBranch()), currentVisible); - } else { - onShowHideFragment(fragmentManager, codePagerView, currentVisible); - } - break; - case RepoPagerMvp.ISSUES: - if ((!getRepo().isHasIssues())) { - sendToView(view -> view.showMessage(R.string.error, R.string.repo_issues_is_disabled)); - break; - } - if (repoIssuesPagerView == null) { - onAddAndHide(fragmentManager, RepoIssuesPagerFragment.newInstance(repoId(), login()), currentVisible); - } else { - onShowHideFragment(fragmentManager, repoIssuesPagerView, currentVisible); - } - break; - case RepoPagerMvp.PULL_REQUEST: - if (pullRequestPagerView == null) { - onAddAndHide(fragmentManager, RepoPullRequestPagerFragment.newInstance(repoId(), login()), currentVisible); - } else { - onShowHideFragment(fragmentManager, pullRequestPagerView, currentVisible); - } - break; - case RepoPagerMvp.PROJECTS: - if (projectsFragmentPager == null) { - onAddAndHide(fragmentManager, RepoProjectsFragmentPager.Companion.newInstance(login(), repoId()), currentVisible); - } else { - onShowHideFragment(fragmentManager, projectsFragmentPager, currentVisible); - } - break; - } - } - - @Override public void onShowHideFragment(@NonNull FragmentManager fragmentManager, @NonNull Fragment toShow, @NonNull Fragment toHide) { - fragmentManager - .beginTransaction() - .hide(toHide) - .show(toShow) - .commit(); - toHide.onHiddenChanged(true); - toShow.onHiddenChanged(false); - } - - @Override public void onAddAndHide(@NonNull FragmentManager fragmentManager, @NonNull Fragment toAdd, @NonNull Fragment toHide) { - fragmentManager - .beginTransaction() - .hide(toHide) - .add(R.id.container, toAdd, toAdd.getClass().getSimpleName()) - .commit(); - - //noinspection ConstantConditions really android? - if (toHide != null) toHide.onHiddenChanged(true); - //noinspection ConstantConditions really android? - if (toAdd != null) toAdd.onHiddenChanged(false); - } - - @Override public void onDeleteRepo() { - if (isRepoOwner()) { - makeRestCall(RestProvider.getRepoService(isEnterprise()).deleteRepo(login, repoId), - booleanResponse -> { - if (booleanResponse.code() == 204) { -// if (repo != null) repo.delete().execute(); - repo = null; - sendToView(RepoPagerMvp.View::onInitRepo); - } - }); - } - } - - @Override public void onPinUnpinRepo() { - if (getRepo() == null) return; - boolean isPinned = AbstractPinnedRepos.pinUpin(getRepo()); - sendToView(view -> view.onRepoPinned(isPinned)); - } - - @Override public void updatePinned(int forks, int stars, int watching) { - this.repo.setStargazersCount(stars); - this.repo.setForksCount(forks); - this.repo.setSubsCount(watching); - updatePinned(repo); - } - - @Override public void onMenuItemSelect(@IdRes int id, int position, boolean fromUser) { - if (id == R.id.issues && (getRepo() != null && !getRepo().isHasIssues())) { - sendToView(RepoPagerMvp.View::disableIssueTab); - return; - } - if (getView() != null && isViewAttached() && fromUser) { - getView().onNavigationChanged(position); - } - } - - @Override public void onMenuItemReselect(@IdRes int id, int position, boolean fromUser) {} - - private void updatePinned(Repo repoModel) { - PinnedRepos pinnedRepos = PinnedRepos.get(repoModel.getFullName()); - if (pinnedRepos != null) { - pinnedRepos.setPinnedRepo(repoModel); - manageObservable(PinnedRepos.update(pinnedRepos).toObservable()); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/RepoCodePagerFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/RepoCodePagerFragment.java deleted file mode 100644 index c54d5fc6e..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/RepoCodePagerFragment.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.fastaccess.ui.modules.repos.code; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.tabs.TabLayout; -import androidx.fragment.app.Fragment; -import android.view.View; -import android.widget.TextView; - -import com.annimon.stream.Objects; -import com.annimon.stream.Stream; -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.FragmentPagerAdapterModel; -import com.fastaccess.data.dao.TabsCountStateModel; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.ui.adapter.FragmentsPagerAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.repos.code.files.paths.RepoFilePathFragment; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.ViewPagerView; - -import java.util.HashSet; - -import butterknife.BindView; - -/** - * Created by Kosh on 31 Dec 2016, 1:36 AM - */ - -public class RepoCodePagerFragment extends BaseFragment implements RepoCodePagerMvp.View { - public static final String TAG = RepoCodePagerFragment.class.getSimpleName(); - - @BindView(R.id.tabs) TabLayout tabs; - @BindView(R.id.pager) ViewPagerView pager; - @State HashSet counts = new HashSet<>(); - - public static RepoCodePagerFragment newInstance(@NonNull String repoId, @NonNull String login, - @NonNull String htmlLink, @NonNull String url, @NonNull String defaultBranch) { - RepoCodePagerFragment view = new RepoCodePagerFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.EXTRA_TWO, url) - .put(BundleConstant.EXTRA_THREE, defaultBranch) - .put(BundleConstant.EXTRA_FOUR, htmlLink) - .end()); - return view; - } - - @Override protected int fragmentLayout() { - return R.layout.tabbed_viewpager; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() != null) { - String repoId = getArguments().getString(BundleConstant.ID); - String login = getArguments().getString(BundleConstant.EXTRA); - String url = getArguments().getString(BundleConstant.EXTRA_TWO); - String htmlUrl = getArguments().getString(BundleConstant.EXTRA_FOUR); - String defaultBranch = getArguments().getString(BundleConstant.EXTRA_THREE); - if (InputHelper.isEmpty(repoId) || InputHelper.isEmpty(login) || InputHelper.isEmpty(url) || InputHelper.isEmpty(htmlUrl)) { - return; - } - pager.setAdapter(new FragmentsPagerAdapter(getChildFragmentManager(), - FragmentPagerAdapterModel.buildForRepoCode(getContext(), repoId, login, url, - Objects.toString(defaultBranch, "master"), htmlUrl))); - tabs.setTabMode(TabLayout.MODE_SCROLLABLE); - tabs.setupWithViewPager(pager); - } - if (savedInstanceState != null && !counts.isEmpty()) { - Stream.of(counts).forEach(this::updateCount); - } - tabs.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(pager) { - @Override public void onTabReselected(TabLayout.Tab tab) { - super.onTabReselected(tab); - onScrollTop(tab.getPosition()); - } - }); - } - - @Override public void onScrollTop(int index) { - if (pager == null || pager.getAdapter() == null) return; - Fragment fragment = (BaseFragment) pager.getAdapter().instantiateItem(pager, index); - if (fragment instanceof BaseFragment) { - ((BaseFragment) fragment).onScrollTop(index); - } - } - - @NonNull @Override public RepoCodePagerPresenter providePresenter() { - return new RepoCodePagerPresenter(); - } - - @Override public boolean canPressBack() { - if (pager.getCurrentItem() != 1) return true; - RepoFilePathFragment pathView = (RepoFilePathFragment) pager.getAdapter().instantiateItem(pager, 1); - return pathView == null || pathView.canPressBack(); - } - - @Override public void onBackPressed() { - if (pager != null && pager.getAdapter() != null) { - RepoFilePathFragment pathView = (RepoFilePathFragment) pager.getAdapter().instantiateItem(pager, 1); - if (pathView != null) { - pathView.onBackPressed(); - } - } - } - - @Override public void onSetBadge(int tabIndex, int count) { - TabsCountStateModel model = new TabsCountStateModel(); - model.setTabIndex(tabIndex); - model.setCount(count); - counts.add(model); - if (tabs != null) { - updateCount(model); - } - } - - private void updateCount(@NonNull TabsCountStateModel model) { - TextView tv = ViewHelper.getTabTextView(tabs, model.getTabIndex()); - tv.setText(SpannableBuilder.builder() - .append(getString(R.string.commits)) - .append(" ") - .append("(") - .bold(String.valueOf(model.getCount())) - .append(")")); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/RepoCodePagerMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/RepoCodePagerMvp.java deleted file mode 100644 index 4d92ec913..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/RepoCodePagerMvp.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.fastaccess.ui.modules.repos.code; - -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; - -/** - * Created by Kosh on 31 Dec 2016, 1:35 AM - */ - -public interface RepoCodePagerMvp { - - interface View extends BaseMvp.FAView, RepoPagerMvp.TabsBadgeListener { - boolean canPressBack(); - - void onBackPressed(); - } - - interface Presenter extends BaseMvp.FAPresenter {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/RepoCodePagerPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/RepoCodePagerPresenter.java deleted file mode 100644 index 265101b82..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/RepoCodePagerPresenter.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fastaccess.ui.modules.repos.code; - -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -/** - * Created by Kosh on 31 Dec 2016, 1:36 AM - */ - -class RepoCodePagerPresenter extends BasePresenter implements RepoCodePagerMvp.Presenter {} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/RepoCommitsFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/RepoCommitsFragment.java deleted file mode 100644 index 9999ac327..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/RepoCommitsFragment.java +++ /dev/null @@ -1,189 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.commit; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.BranchesModel; -import com.fastaccess.data.dao.model.Commit; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.CommitsAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; -import com.fastaccess.ui.modules.repos.extras.branches.pager.BranchesPagerFragment; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; -import butterknife.OnClick; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class RepoCommitsFragment extends BaseFragment implements RepoCommitsMvp.View { - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - @BindView(R.id.branches) FontTextView branches; - private OnLoadMore onLoadMore; - private CommitsAdapter adapter; - private RepoPagerMvp.TabsBadgeListener tabsBadgeListener; - - public static RepoCommitsFragment newInstance(@NonNull String repoId, @NonNull String login, @NonNull String branch) { - return newInstance(repoId, login, branch, null); - } - - public static RepoCommitsFragment newInstance(@NonNull String repoId, @NonNull String login, @NonNull String branch, - @Nullable String path) { - return newInstance(Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.EXTRA_TWO, branch) - .put(BundleConstant.EXTRA_THREE, path) - .end()); - } - - public static RepoCommitsFragment newInstance(@NonNull Bundle bundle) { - RepoCommitsFragment view = new RepoCommitsFragment(); - view.setArguments(bundle); - return view; - } - - @OnClick(R.id.branches) void onBranchesClicked() { - BranchesPagerFragment.Companion.newInstance(getPresenter().login, getPresenter().repoId) - .show(getChildFragmentManager(), "BranchesFragment"); - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (context instanceof RepoPagerMvp.TabsBadgeListener) { - tabsBadgeListener = (RepoPagerMvp.TabsBadgeListener) context; - } else if (getParentFragment() instanceof RepoPagerMvp.TabsBadgeListener) { - tabsBadgeListener = (RepoPagerMvp.TabsBadgeListener) getParentFragment(); - } - } - - @Override public void onDetach() { - tabsBadgeListener = null; - super.onDetach(); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override protected int fragmentLayout() { - return R.layout.commit_with_branch_layout; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new NullPointerException("Bundle is null, therefore, issues can't be proceeded."); - } - stateLayout.setEmptyText(R.string.no_commits); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - recycler.addKeyLineDivider(); - adapter = new CommitsAdapter(getPresenter().getCommits()); - adapter.setListener(getPresenter()); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - if (savedInstanceState == null) { - getPresenter().onFragmentCreated(getArguments()); - } else if (getPresenter().getCommits().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - branches.setText(getPresenter().branch); - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public RepoCommitsPresenter providePresenter() { - return new RepoCommitsPresenter(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @SuppressWarnings("unchecked") @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore(getPresenter()); - } - return onLoadMore; - } - - @Override public void setBranchesData(@Nullable List branchesData, boolean firstTime) { - } - - @Override public void onShowCommitCount(long sum) { - if (tabsBadgeListener != null) { - tabsBadgeListener.onSetBadge(2, (int) sum); - } - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, null); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - @Override public void onBranchSelected(@NonNull BranchesModel branch) { - String ref = branch.getName(); - branches.setText(ref); - getPresenter().onBranchChanged(ref); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/RepoCommitsMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/RepoCommitsMvp.java deleted file mode 100644 index 57ab6c256..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/RepoCommitsMvp.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.commit; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.BranchesModel; -import com.fastaccess.data.dao.model.Commit; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.repos.extras.branches.BranchesMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -interface RepoCommitsMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, - android.view.View.OnClickListener, BranchesMvp.BranchSelectionListener { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - - void setBranchesData(@NonNull List branches, boolean firstTime); - - void onShowCommitCount(long sum); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - void onFragmentCreated(@NonNull Bundle bundle); - - @NonNull ArrayList getCommits(); - - void onWorkOffline(); - - void onBranchChanged(@NonNull String branch); - - String getDefaultBranch(); - - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/RepoCommitsPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/RepoCommitsPresenter.java deleted file mode 100644 index 1fe2d6f1b..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/RepoCommitsPresenter.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.commit; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.text.TextUtils; -import android.view.View; - -import com.fastaccess.data.dao.Pageable; -import com.fastaccess.data.dao.model.Commit; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.repos.code.commit.details.CommitPagerActivity; - -import java.util.ArrayList; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class RepoCommitsPresenter extends BasePresenter implements RepoCommitsMvp.Presenter { - - private ArrayList commits = new ArrayList<>(); - @com.evernote.android.state.State String login; - @com.evernote.android.state.State String repoId; - @com.evernote.android.state.State String branch; - @com.evernote.android.state.State String path; - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - onWorkOffline(); - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable Object parameter) { - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0) { - sendToView(RepoCommitsMvp.View::hideProgress); - return false; - } - if (repoId == null || login == null) return false; - Observable> observable = InputHelper.isEmpty(path) - ? RestProvider.getRepoService(isEnterprise()).getCommits(login, repoId, branch, page) - : RestProvider.getRepoService(isEnterprise()).getCommits(login, repoId, branch, path, page); - makeRestCall(observable, response -> { - if (response != null && response.getItems() != null) { - lastPage = response.getLast(); - if (getCurrentPage() == 1) { - manageDisposable(Commit.save(response.getItems(), repoId, login)); - } - } - sendToView(view -> view.onNotifyAdapter(response != null ? response.getItems() : null, page)); - }); - return true; - } - - @Override public void onFragmentCreated(@NonNull Bundle bundle) { - repoId = bundle.getString(BundleConstant.ID); - login = bundle.getString(BundleConstant.EXTRA); - branch = bundle.getString(BundleConstant.EXTRA_TWO); - path = bundle.getString(BundleConstant.EXTRA_THREE); - if (!InputHelper.isEmpty(branch)) { - getCommitCount(branch); - } - if (!InputHelper.isEmpty(login) && !InputHelper.isEmpty(repoId)) { - onCallApi(1, null); - } - } - - @NonNull @Override public ArrayList getCommits() { - return commits; - } - - @Override public void onWorkOffline() { - if (commits.isEmpty()) { - manageDisposable(RxHelper.getObservable(Commit.getCommits(repoId, login).toObservable()) - .subscribe(models -> sendToView(view -> view.onNotifyAdapter(models, 1)))); - } else { - sendToView(BaseMvp.FAView::hideProgress); - } - } - - @Override public void onBranchChanged(@NonNull String branch) { - if (!TextUtils.equals(branch, this.branch)) { - this.branch = branch; - onCallApi(1, null); - getCommitCount(branch); - } - } - - @Override public String getDefaultBranch() { - return branch; - } - - @Override public void onItemClick(int position, View v, Commit item) { - CommitPagerActivity.createIntentForOffline(v.getContext(), item); - } - - @Override public void onItemLongClick(int position, View v, Commit item) {} - - private void getCommitCount(@NonNull String branch) { - manageDisposable(RxHelper.safeObservable(RxHelper.getObservable(RestProvider.getRepoService(isEnterprise()) - .getCommitCounts(login, repoId, branch))) - .subscribe(response -> { - if (response != null) { - sendToView(view -> view.onShowCommitCount(response.getLast())); - } - }, Throwable::printStackTrace)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/CommitPagerActivity.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/CommitPagerActivity.java deleted file mode 100644 index 200c042f4..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/CommitPagerActivity.java +++ /dev/null @@ -1,295 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.commit.details; - -import android.content.Context; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.coordinatorlayout.widget.CoordinatorLayout; -import com.google.android.material.floatingactionbutton.FloatingActionButton; -import com.google.android.material.tabs.TabLayout; -import androidx.fragment.app.Fragment; -import androidx.viewpager.widget.ViewPager; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.FragmentPagerAdapterModel; -import com.fastaccess.data.dao.NameParser; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.Commit; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.provider.timeline.HtmlHelper; -import com.fastaccess.ui.adapter.FragmentsPagerAdapter; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment; -import com.fastaccess.ui.modules.repos.RepoPagerActivity; -import com.fastaccess.ui.modules.repos.code.commit.details.comments.CommitCommentsFragment; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.ViewPagerView; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; - -import java.util.ArrayList; -import java.util.Date; - -import butterknife.BindView; -import butterknife.OnClick; -import kotlin.text.StringsKt; - -/** - * Created by Kosh on 10 Dec 2016, 9:23 AM - */ - -public class CommitPagerActivity extends BaseActivity implements CommitPagerMvp.View { - - @BindView(R.id.avatarLayout) AvatarLayout avatarLayout; - @BindView(R.id.headerTitle) FontTextView title; - @BindView(R.id.size) FontTextView size; - @BindView(R.id.date) FontTextView date; - @BindView(R.id.tabs) TabLayout tabs; - @BindView(R.id.pager) ViewPagerView pager; - @BindView(R.id.fab) FloatingActionButton fab; - @BindView(R.id.changes) FontTextView changes; - @BindView(R.id.addition) FontTextView addition; - @BindView(R.id.deletion) FontTextView deletion; - @BindView(R.id.coordinatorLayout) CoordinatorLayout coordinatorLayout; - @BindView(R.id.detailsIcon) View detailsIcon; - private CommentEditorFragment commentEditorFragment; - - public static Intent createIntent(@NonNull Context context, @NonNull String repoId, @NonNull String login, @NonNull String sha) { - return createIntent(context, repoId, login, sha, false); - } - - public static Intent createIntent(@NonNull Context context, @NonNull String repoId, @NonNull String login, - @NonNull String sha, boolean showRepoBtn) { - return createIntent(context, repoId, login, sha, showRepoBtn, false); - } - - public static Intent createIntent(@NonNull Context context, @NonNull String repoId, @NonNull String login, - @NonNull String sha, boolean showRepoBtn, - boolean isEnterprise) { - Intent intent = new Intent(context, CommitPagerActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.ID, sha) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.EXTRA_TWO, repoId) - .put(BundleConstant.EXTRA_THREE, showRepoBtn) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .end()); - return intent; - } - - public static void createIntentForOffline(@NonNull Context context, @NonNull Commit commitModel) { - SchemeParser.launchUri(context, Uri.parse(commitModel.getHtmlUrl())); - } - - @OnClick(R.id.detailsIcon) void onTitleClick() { - if (getPresenter().getCommit() != null && !InputHelper.isEmpty(getPresenter().getCommit().getGitCommit().getMessage())) - MessageDialogView.newInstance(String.format("%s/%s", getPresenter().getLogin(), getPresenter().getRepoId()), - getPresenter().getCommit().getGitCommit().getMessage(), true, false) - .show(getSupportFragmentManager(), MessageDialogView.TAG); - } - - @Override protected int layout() { - return R.layout.commit_pager_activity; - } - - @Override protected boolean isTransparent() { - return true; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @NonNull @Override public CommitPagerPresenter providePresenter() { - return new CommitPagerPresenter(); - } - - @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - fab.hide(); - commentEditorFragment = (CommentEditorFragment) getSupportFragmentManager().findFragmentById(R.id.commentFragment); - setTitle(""); - if (savedInstanceState == null) { - getPresenter().onActivityCreated(getIntent()); - } else { - if (getPresenter().isApiCalled()) onSetup(); - } - if (getPresenter().showToRepoBtn()) showNavToRepoItem(); - } - - @Override public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.share_menu, menu); - menu.findItem(R.id.browser).setVisible(true).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); - menu.findItem(R.id.copyUrl).setVisible(true).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); - menu.findItem(R.id.copySha).setVisible(true).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); - menu.findItem(R.id.share).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); - return super.onCreateOptionsMenu(menu); - } - - @Override public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == android.R.id.home) { - onNavToRepoClicked(); - return true; - } else if (item.getItemId() == R.id.share) { - if (getPresenter().getCommit() != null) ActivityHelper.shareUrl(this, getPresenter().getCommit().getHtmlUrl()); - return true; - } else if (item.getItemId() == R.id.browser) { - if (getPresenter().getCommit() != null) ActivityHelper.startCustomTab(this, getPresenter().getCommit().getHtmlUrl()); - return true; - } else if (item.getItemId() == R.id.copyUrl) { - if (getPresenter().getCommit() != null) AppHelper.copyToClipboard(this, getPresenter().getCommit().getHtmlUrl()); - return true; - } else if (item.getItemId() == R.id.copySha) { - if (getPresenter().getCommit() != null) AppHelper.copyToClipboard(this, getPresenter().getCommit().getSha()); - return true; - } - return super.onOptionsItemSelected(item); - } - - @Override public void onSetup() { - hideProgress(); - if (getPresenter().getCommit() == null) { - return; - } - supportInvalidateOptionsMenu(); - Commit commit = getPresenter().getCommit(); - String login = commit.getAuthor() != null ? commit.getAuthor().getLogin() : commit.getGitCommit().getAuthor().getName(); - String avatar = commit.getAuthor() != null ? commit.getAuthor().getAvatarUrl() : null; - Date dateValue = commit.getGitCommit().getAuthor().getDate(); - HtmlHelper.htmlIntoTextView(title, commit.getGitCommit().getMessage(), title.getWidth()); - setTaskName(commit.getLogin() + "/" + commit.getRepoId() + " - Commit " + StringsKt.take(commit.getSha(), 5)); - detailsIcon.setVisibility(View.VISIBLE); - size.setVisibility(View.GONE); - date.setText(SpannableBuilder.builder() - .bold(getPresenter().repoId) - .append(" ") - .append(" ") - .append(ParseDateFormat.getTimeAgo(dateValue))); - avatarLayout.setUrl(avatar, login, false, LinkParserHelper.isEnterprise(commit.getHtmlUrl())); - addition.setText(String.valueOf(commit.getStats() != null ? commit.getStats().getAdditions() : 0)); - deletion.setText(String.valueOf(commit.getStats() != null ? commit.getStats().getDeletions() : 0)); - changes.setText(String.valueOf(commit.getFiles() != null ? commit.getFiles().size() : 0)); - pager.setAdapter(new FragmentsPagerAdapter(getSupportFragmentManager(), FragmentPagerAdapterModel.buildForCommit(this, commit))); - tabs.setupWithViewPager(pager); - pager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { - @Override public void onPageSelected(int position) { - super.onPageSelected(position); - hideShowFab(); - } - }); - hideShowFab(); - TabLayout.Tab tabOne = tabs.getTabAt(0); - TabLayout.Tab tabTwo = tabs.getTabAt(1); - if (tabOne != null && commit.getFiles() != null) { - tabOne.setText(getString(R.string.files) + " (" + commit.getFiles().size() + ")"); - } - if (tabTwo != null && commit.getGitCommit() != null && commit.getGitCommit().getCommentCount() > 0) { - tabTwo.setText(getString(R.string.comments) + " (" + commit.getGitCommit().getCommentCount() + ")"); - } - tabs.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(pager) { - @Override public void onTabReselected(TabLayout.Tab tab) { - super.onTabReselected(tab); - onScrollTop(tab.getPosition()); - } - }); - } - - @Override public void onScrollTop(int index) { - if (pager == null || pager.getAdapter() == null) return; - Fragment fragment = (BaseFragment) pager.getAdapter().instantiateItem(pager, index); - if (fragment instanceof BaseFragment) { - ((BaseFragment) fragment).onScrollTop(index); - } - } - - @Override public void onFinishActivity() { - hideProgress(); - finish(); - } - - @Override public void onAddComment(@NonNull Comment newComment) { - CommitCommentsFragment fragment = getCommitCommentsFragment(); - if (fragment != null) { - fragment.addComment(newComment); - } - } - - @Override public String getLogin() { - return getPresenter().getLogin(); - } - - @Override public String getRepoId() { - return getPresenter().getRepoId(); - } - - @Override public void onBackPressed() { - super.onBackPressed(); - } - - @Override public void onNavToRepoClicked() { - NameParser nameParser = new NameParser(""); - nameParser.setName(getPresenter().getRepoId()); - nameParser.setUsername(getPresenter().getLogin()); - nameParser.setEnterprise(isEnterprise()); - RepoPagerActivity.startRepoPager(this, nameParser); - finish(); - } - - @Override public void onSendActionClicked(@NonNull String text, Bundle bundle) { - CommitCommentsFragment fragment = getCommitCommentsFragment(); - if (fragment != null) { - fragment.onHandleComment(text, bundle); - } - } - - @Override public void onTagUser(@NonNull String username) { - commentEditorFragment.onAddUserName(username); - } - - @Override public void onCreateComment(String text, Bundle bundle) { - - } - - @SuppressWarnings("ConstantConditions") @Override public void onClearEditText() { - if (commentEditorFragment != null && commentEditorFragment.commentText != null) commentEditorFragment.commentText.setText(""); - } - - @NonNull @Override public ArrayList getNamesToTag() { - CommitCommentsFragment fragment = getCommitCommentsFragment(); - if (fragment != null) { - return fragment.getNamesToTags(); - } - return new ArrayList<>(); - } - - private void hideShowFab() { - if (pager.getCurrentItem() == 1) { - getSupportFragmentManager().beginTransaction().show(commentEditorFragment).commit(); - } else { - getSupportFragmentManager().beginTransaction().hide(commentEditorFragment).commit(); - } - } - - private CommitCommentsFragment getCommitCommentsFragment() { - if (pager != null & pager.getAdapter() != null) - return (CommitCommentsFragment) pager.getAdapter().instantiateItem(pager, 1); - return null; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/CommitPagerMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/CommitPagerMvp.java deleted file mode 100644 index 4e57ef093..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/CommitPagerMvp.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.commit.details; - -import android.content.Intent; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.Commit; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment; - -/** - * Created by Kosh on 10 Dec 2016, 9:21 AM - */ - -public interface CommitPagerMvp { - - interface View extends BaseMvp.FAView, CommentEditorFragment.CommentListener { - - void onSetup(); - - void onFinishActivity(); - - void onAddComment(@NonNull Comment newComment); - - String getLogin(); - - String getRepoId(); - } - - interface Presenter extends BaseMvp.FAPresenter { - - @Nullable Commit getCommit(); - - void onActivityCreated(@Nullable Intent intent); - - void onWorkOffline(@NonNull String sha, @NonNull String repoId, @NonNull String login); - - String getLogin(); - - String getRepoId(); - - boolean showToRepoBtn(); - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/CommitPagerPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/CommitPagerPresenter.java deleted file mode 100644 index 89a870a5f..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/CommitPagerPresenter.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.commit.details; - -import android.content.Intent; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.CommentRequestModel; -import com.fastaccess.data.dao.MarkdownModel; -import com.fastaccess.data.dao.model.Commit; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 10 Dec 2016, 9:23 AM - */ - -class CommitPagerPresenter extends BasePresenter implements CommitPagerMvp.Presenter { - @com.evernote.android.state.State Commit commitModel; - @com.evernote.android.state.State String sha; - @com.evernote.android.state.State String login; - @com.evernote.android.state.State String repoId; - @com.evernote.android.state.State boolean showToRepoBtn; - @com.evernote.android.state.State ArrayList reviewComments = new ArrayList<>(); - - @Nullable @Override public Commit getCommit() { - return commitModel; - } - - @Override public void onError(@NonNull Throwable throwable) { - if (RestProvider.getErrorCode(throwable) == 404) { - sendToView(CommitPagerMvp.View::onFinishActivity); - } else { - onWorkOffline(sha, repoId, login); - } - super.onError(throwable); - } - - @Override public void onActivityCreated(@Nullable Intent intent) { - if (intent != null && intent.getExtras() != null) { - sha = intent.getExtras().getString(BundleConstant.ID); - login = intent.getExtras().getString(BundleConstant.EXTRA); - repoId = intent.getExtras().getString(BundleConstant.EXTRA_TWO); - showToRepoBtn = intent.getExtras().getBoolean(BundleConstant.EXTRA_THREE); - if (commitModel != null) { - sendToView(CommitPagerMvp.View::onSetup); - return; - } else if (!InputHelper.isEmpty(sha) && !InputHelper.isEmpty(login) && !InputHelper.isEmpty(repoId)) { - makeRestCall(RestProvider.getRepoService(isEnterprise()) - .getCommit(login, repoId, sha) - .flatMap(commit -> { - if (commit.getGitCommit() != null && commit.getGitCommit().getMessage() != null) { - MarkdownModel markdownModel = new MarkdownModel(); - markdownModel.setContext(login + "/" + repoId); - markdownModel.setText(commit.getGitCommit().getMessage()); - return RestProvider.getRepoService(isEnterprise()).convertReadmeToHtml(markdownModel); - } - return Observable.just(commit); - }, (commit, u) -> { - if (!InputHelper.isEmpty(u) && u instanceof String) { - commit.getGitCommit().setMessage(u.toString()); - } - return commit; - }), commit -> { - commitModel = commit; - commitModel.setRepoId(repoId); - commitModel.setLogin(login); - sendToView(CommitPagerMvp.View::onSetup); - manageObservable(commitModel.save(commitModel).toObservable()); - }); - return; - } - } - sendToView(CommitPagerMvp.View::onSetup); - } - - @Override public void onWorkOffline(@NonNull String sha, @NonNull String repoId, @NonNull String login) { - manageDisposable(RxHelper.getObservable(Commit.getCommit(sha, repoId, login)) - .subscribe(commit -> { - commitModel = commit; - sendToView(CommitPagerMvp.View::onSetup); - })); - } - - @Override public String getLogin() { - return login; - } - - @Override public String getRepoId() { - return repoId; - } - - @Override public boolean showToRepoBtn() { - return showToRepoBtn; - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/comments/CommitCommentsFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/comments/CommitCommentsFragment.java deleted file mode 100644 index 437e6485a..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/comments/CommitCommentsFragment.java +++ /dev/null @@ -1,316 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.commit.details.comments; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.TimelineModel; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.data.dao.types.ReactionTypes; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.provider.timeline.CommentsHelper; -import com.fastaccess.provider.timeline.ReactionsProvider; -import com.fastaccess.ui.adapter.IssuesTimelineAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.editor.EditorActivity; -import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment; -import com.fastaccess.ui.modules.repos.reactions.ReactionsDialogFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 11 Nov 2016, 12:36 PM - */ - -public class CommitCommentsFragment extends BaseFragment implements CommitCommentsMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - @State HashMap toggleMap = new LinkedHashMap<>(); - private CommentEditorFragment.CommentListener commentsCallback; - private IssuesTimelineAdapter adapter; - private OnLoadMore onLoadMore; - - public static CommitCommentsFragment newInstance(@NonNull String login, @NonNull String repoId, @NonNull String sha) { - CommitCommentsFragment view = new CommitCommentsFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.EXTRA_TWO, sha) - .end()); - return view; - } - - @SuppressWarnings("unchecked") @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() instanceof CommentEditorFragment.CommentListener) { - commentsCallback = (CommentEditorFragment.CommentListener) getParentFragment(); - } else if (context instanceof CommentEditorFragment.CommentListener) { - commentsCallback = (CommentEditorFragment.CommentListener) context; - } else { - throw new IllegalArgumentException(String.format("%s or parent fragment must implement CommentEditorFragment.CommentListener", - context.getClass().getSimpleName())); - } - } - - @Override public void onDetach() { - commentsCallback = null; - super.onDetach(); - } - - @Override protected int fragmentLayout() { - return R.layout.fab_micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (savedInstanceState == null) getPresenter().onFragmentCreated(getArguments()); - stateLayout.setEmptyText(R.string.no_comments); - recycler.setEmptyView(stateLayout, refresh); - recycler.setItemViewCacheSize(30); - refresh.setOnRefreshListener(this); - stateLayout.setOnReloadListener(this); - adapter = new IssuesTimelineAdapter(getPresenter().getComments(), this, true, - this, getArguments().getString(BundleConstant.EXTRA), null); - adapter.setListener(getPresenter()); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - recycler.addNormalSpacingDivider(); - if (getPresenter().getComments().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, null); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override public void onRemove(@NonNull TimelineModel comment) { - hideProgress(); - adapter.removeItem(comment); - } - - @Override public void hideProgress() { - super.hideProgress(); - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - - stateLayout.showProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public CommitCommentsPresenter providePresenter() { - return new CommitCommentsPresenter(); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter()); - } - return onLoadMore; - } - - @Override public void onEditComment(@NonNull Comment item) { - Intent intent = new Intent(getContext(), EditorActivity.class); - intent.putExtras(Bundler - .start() - .put(BundleConstant.ID, getPresenter().repoId()) - .put(BundleConstant.EXTRA_TWO, getPresenter().login()) - .put(BundleConstant.EXTRA_THREE, getPresenter().sha()) - .put(BundleConstant.EXTRA_FOUR, item.getId()) - .put(BundleConstant.EXTRA, item.getBody()) - .put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraType.EDIT_COMMIT_COMMENT_EXTRA) - .putStringArrayList("participants", CommentsHelper.getUsersByTimeline(adapter.getData())) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise()) - .end()); - View view = getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler; - ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE); - } - - @Override public void onShowDeleteMsg(long id) { - MessageDialogView.newInstance(getString(R.string.delete), getString(R.string.confirm_message), - Bundler.start() - .put(BundleConstant.EXTRA, id) - .put(BundleConstant.YES_NO_EXTRA, true) - .end()) - .show(getChildFragmentManager(), MessageDialogView.TAG); - } - - @Override public void onTagUser(@Nullable User user) { - Intent intent = new Intent(getContext(), EditorActivity.class); - intent.putExtras(Bundler - .start() - .put(BundleConstant.ID, getPresenter().repoId()) - .put(BundleConstant.EXTRA_TWO, getPresenter().login()) - .put(BundleConstant.EXTRA_THREE, getPresenter().sha()) - .put(BundleConstant.EXTRA, user != null ? "@" + user.getLogin() : "") - .put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraType.NEW_COMMIT_COMMENT_EXTRA) - .putStringArrayList("participants", CommentsHelper.getUsersByTimeline(adapter.getData())) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise()) - .end()); - View view = getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler; - ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE); - - } - - @Override public void onReply(User user, String message) { - onTagUser(user); - } - - @Override public void showReactionsPopup(@NonNull ReactionTypes reactionTypes, @NonNull String login, @NonNull String repoId, long commentId) { - ReactionsDialogFragment.newInstance(login, repoId, reactionTypes, commentId, ReactionsProvider.COMMIT) - .show(getChildFragmentManager(), "ReactionsDialogFragment"); - } - - @Override public void addComment(@NonNull Comment newComment) { - hideBlockingProgress(); - if (adapter != null) { - adapter.addItem(TimelineModel.constructComment(newComment)); - } - if (commentsCallback != null) commentsCallback.onClearEditText(); - } - - @Override public void onDestroyView() { - recycler.removeOnScrollListener(getLoadMore()); - super.onDestroyView(); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (resultCode == Activity.RESULT_OK) { - if (requestCode == BundleConstant.REQUEST_CODE) { - if (data == null) { - onRefresh(); - return; - } - Bundle bundle = data.getExtras(); - if (bundle != null) { - boolean isNew = bundle.getBoolean(BundleConstant.EXTRA); - Comment commentsModel = bundle.getParcelable(BundleConstant.ITEM); - if (commentsModel == null) { - onRefresh(); // shit happens, refresh()? - return; - } - adapter.notifyDataSetChanged(); - if (isNew) { - adapter.addItem(TimelineModel.constructComment(commentsModel)); - recycler.smoothScrollToPosition(adapter.getItemCount()); - } else { - int position = adapter.getItem(TimelineModel.constructComment(commentsModel)); - if (position != -1) { - adapter.swapItem(TimelineModel.constructComment(commentsModel), position); - recycler.smoothScrollToPosition(position); - } else { - adapter.addItem(TimelineModel.constructComment(commentsModel)); - recycler.smoothScrollToPosition(adapter.getItemCount()); - } - } - } else { - onRefresh(); // bundle size is too large? refresh the api - } - } - } - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (isOk) { - getPresenter().onHandleDeletion(bundle); - } - } - - @Override public void onToggle(long position, boolean isCollapsed) { - toggleMap.put(position, isCollapsed); - } - - @Override public boolean isCollapsed(long position) { - Boolean toggle = toggleMap.get(position); - return toggle != null && toggle; - } - - @Override public boolean isPreviouslyReacted(long id, int vId) { - return getPresenter().isPreviouslyReacted(id, vId); - } - - @Override public boolean isCallingApi(long id, int vId) { - return getPresenter().isCallingApi(id, vId); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - @Override public void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } - - @Override public void onHandleComment(@NonNull String text, @Nullable Bundle bundle) { - getPresenter().onHandleComment(text, bundle); - } - - @NonNull @Override public ArrayList getNamesToTags() { - return CommentsHelper.getUsersByTimeline(adapter.getData()); - } - - @Override public void hideBlockingProgress() { - hideProgress(); - super.hideProgress(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/comments/CommitCommentsMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/comments/CommitCommentsMvp.java deleted file mode 100644 index d5d234f8c..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/comments/CommitCommentsMvp.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.commit.details.comments; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.TimelineModel; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.data.dao.types.ReactionTypes; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.callback.OnToggleView; -import com.fastaccess.ui.adapter.callback.ReactionsCallback; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 20 Nov 2016, 11:10 AM - */ - -interface CommitCommentsMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, - android.view.View.OnClickListener, OnToggleView, ReactionsCallback { - - void onNotifyAdapter(@Nullable List items, int page); - - void onRemove(@NonNull TimelineModel comment); - - @NonNull OnLoadMore getLoadMore(); - - void onEditComment(@NonNull Comment item); - - void onShowDeleteMsg(long id); - - void onTagUser(@Nullable User user); - - void onReply(User user, String message); - - void showReactionsPopup(@NonNull ReactionTypes reactionTypes, @NonNull String login, @NonNull String repoId, long commentId); - - void addComment(@NonNull Comment newComment); - - void showReload(); - - void onHandleComment(@NonNull String text, @Nullable Bundle bundle); - - @NonNull List getNamesToTags(); - - void hideBlockingProgress(); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseMvp.PaginationListener, BaseViewHolder.OnItemClickListener { - - void onFragmentCreated(@Nullable Bundle bundle); - - @NonNull ArrayList getComments(); - - void onHandleDeletion(@Nullable Bundle bundle); - - void onWorkOffline(); - - @NonNull String repoId(); - - @NonNull String login(); - - String sha(); - - boolean isPreviouslyReacted(long commentId, int vId); - - boolean isCallingApi(long id, int vId); - - void onHandleComment(@NonNull String text, @Nullable Bundle bundle); - } - - -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/comments/CommitCommentsPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/comments/CommitCommentsPresenter.java deleted file mode 100644 index 438c527d1..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/comments/CommitCommentsPresenter.java +++ /dev/null @@ -1,214 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.commit.details.comments; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; -import android.widget.PopupMenu; - -import com.fastaccess.R; -import com.fastaccess.data.dao.CommentRequestModel; -import com.fastaccess.data.dao.TimelineModel; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.types.ReactionTypes; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.timeline.CommentsHelper; -import com.fastaccess.provider.timeline.ReactionsProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 11 Nov 2016, 12:36 PM - */ - -class CommitCommentsPresenter extends BasePresenter implements CommitCommentsMvp.Presenter { - private ArrayList comments = new ArrayList<>(); - private ReactionsProvider reactionsProvider; - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - @com.evernote.android.state.State String repoId; - @com.evernote.android.state.State String login; - @com.evernote.android.state.State String sha; - @com.evernote.android.state.State boolean isCollaborator; - - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public boolean onCallApi(int page, @Nullable String parameter) { - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - if (page > lastPage || lastPage == 0) { - sendToView(CommitCommentsMvp.View::hideProgress); - return false; - } - if (page == 1) { - manageObservable(RestProvider.getRepoService(isEnterprise()).isCollaborator(login, repoId, - Login.getUser().getLogin()) - .doOnNext(booleanResponse -> isCollaborator = booleanResponse.code() == 204)); - } - setCurrentPage(page); - makeRestCall(RestProvider.getRepoService(isEnterprise()).getCommitComments(login, repoId, sha, page) - .flatMap(listResponse -> { - lastPage = listResponse.getLast(); - return TimelineModel.construct(listResponse.getItems()); - }) - .doOnComplete(() -> { - if (lastPage <= 1) { - sendToView(CommitCommentsMvp.View::showReload); - } - }), - listResponse -> sendToView(view -> view.onNotifyAdapter(listResponse, page))); - return true; - } - - @Override public void onFragmentCreated(@Nullable Bundle bundle) { - if (bundle == null) throw new NullPointerException("Bundle is null?"); - repoId = bundle.getString(BundleConstant.ID); - login = bundle.getString(BundleConstant.EXTRA); - sha = bundle.getString(BundleConstant.EXTRA_TWO); - } - - @NonNull @Override public ArrayList getComments() { - return comments; - } - - @Override public void onHandleDeletion(@Nullable Bundle bundle) { - if (bundle != null) { - long commId = bundle.getLong(BundleConstant.EXTRA, 0); - if (commId != 0) { - makeRestCall(RestProvider.getRepoService(isEnterprise()).deleteComment(login, repoId, commId) - , booleanResponse -> sendToView(view -> { - if (booleanResponse.code() == 204) { - Comment comment = new Comment(); - comment.setId(commId); - view.onRemove(TimelineModel.constructComment(comment)); - } else { - view.showMessage(R.string.error, R.string.error_deleting_comment); - } - })); - } - } - } - - @Override public void onWorkOffline() { - if (comments.isEmpty()) { - manageDisposable(RxHelper.getObservable(Comment.getCommitComments(repoId(), login(), sha).toObservable()) - .flatMap(TimelineModel::construct) - .subscribe(models -> sendToView(view -> view.onNotifyAdapter(models, 1)))); - } else { - sendToView(CommitCommentsMvp.View::hideProgress); - } - } - - @NonNull @Override public String repoId() { - return repoId; - } - - @NonNull @Override public String login() { - return login; - } - - @Override public String sha() { - return sha; - } - - @Override public boolean isPreviouslyReacted(long commentId, int vId) { - return getReactionsProvider().isPreviouslyReacted(commentId, vId); - } - - @Override public boolean isCallingApi(long id, int vId) { - return getReactionsProvider().isCallingApi(id, vId); - } - - @Override public void onHandleComment(@NonNull String text, @Nullable Bundle bundle) { - CommentRequestModel model = new CommentRequestModel(); - model.setBody(text); - manageDisposable(RxHelper.getObservable(RestProvider.getRepoService(isEnterprise()).postCommitComment(login, repoId, sha, model)) - .doOnSubscribe(disposable -> sendToView(view -> view.showBlockingProgress(0))) - .subscribe(comment -> sendToView(view -> view.addComment(comment)), - throwable -> { - onError(throwable); - sendToView(CommitCommentsMvp.View::hideBlockingProgress); - })); - } - - @Override public void onItemClick(int position, View v, TimelineModel timelineModel) { - if (getView() != null) { - Comment item = timelineModel.getComment(); - if (v.getId() == R.id.commentMenu) { - PopupMenu popupMenu = new PopupMenu(v.getContext(), v); - popupMenu.inflate(R.menu.comments_menu); - String username = Login.getUser().getLogin(); - boolean isOwner = CommentsHelper.isOwner(username, login, item.getUser().getLogin()) || isCollaborator; - popupMenu.getMenu().findItem(R.id.delete).setVisible(isOwner); - popupMenu.getMenu().findItem(R.id.edit).setVisible(isOwner); - popupMenu.setOnMenuItemClickListener(item1 -> { - if (getView() == null) return false; - if (item1.getItemId() == R.id.delete) { - getView().onShowDeleteMsg(item.getId()); - } else if (item1.getItemId() == R.id.reply) { - getView().onReply(item.getUser(), item.getBody()); - } else if (item1.getItemId() == R.id.edit) { - getView().onEditComment(item); - } else if (item1.getItemId() == R.id.share) { - ActivityHelper.shareUrl(v.getContext(), item.getHtmlUrl()); - } - return true; - }); - popupMenu.show(); - } else { - onHandleReaction(v.getId(), item.getId()); - } - } - } - - @Override public void onItemLongClick(int position, View v, TimelineModel timelineModel) { - if (v.getId() == R.id.commentMenu) { - Comment item = timelineModel.getComment(); - if (getView() != null) getView().onReply(item.getUser(), item.getBody()); - } else { - ReactionTypes reactionTypes = ReactionTypes.get(v.getId()); - if (reactionTypes != null) { - if (getView() != null) getView().showReactionsPopup(reactionTypes, login, repoId, timelineModel.getComment().getId()); - } else { - onItemClick(position, v, timelineModel); - } - } - } - - @NonNull private ReactionsProvider getReactionsProvider() { - if (reactionsProvider == null) { - reactionsProvider = new ReactionsProvider(); - } - return reactionsProvider; - } - - private void onHandleReaction(int viewId, long id) { - Observable observable = getReactionsProvider().onHandleReaction(viewId, id, login, repoId, ReactionsProvider.COMMIT, isEnterprise()); - if (observable != null) manageObservable(observable); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesFragment.java deleted file mode 100644 index 72094848a..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesFragment.java +++ /dev/null @@ -1,180 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.commit.details.files; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.CommentRequestModel; -import com.fastaccess.data.dao.CommitFileChanges; -import com.fastaccess.data.dao.CommitFileListModel; -import com.fastaccess.data.dao.CommitFileModel; -import com.fastaccess.data.dao.CommitLinesModel; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.adapter.CommitFilesAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.main.premium.PremiumActivity; -import com.fastaccess.ui.modules.repos.code.commit.details.CommitPagerMvp; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.files.fullscreen.FullScreenFileChangeActivity; -import com.fastaccess.ui.modules.reviews.AddReviewDialogFragment; -import com.fastaccess.ui.widgets.AppbarRefreshLayout; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 15 Feb 2017, 10:16 PM - */ - -public class CommitFilesFragment extends BaseFragment implements CommitFilesMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) AppbarRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - @State HashMap toggleMap = new LinkedHashMap<>(); - - private CommitPagerMvp.View viewCallback; - private CommitFilesAdapter adapter; - - public static CommitFilesFragment newInstance(@NonNull String sha, @Nullable CommitFileListModel commitFileModels) { - CommitFilesFragment view = new CommitFilesFragment(); - if (commitFileModels != null) { - CommitFilesSingleton.getInstance().putFiles(sha, commitFileModels); - } - Bundle bundle = Bundler.start().put(BundleConstant.ID, sha).end(); - view.setArguments(bundle); - return view; - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() instanceof CommitPagerMvp.View) { - viewCallback = (CommitPagerMvp.View) getParentFragment(); - } else if (context instanceof CommitPagerMvp.View) { - viewCallback = (CommitPagerMvp.View) context; - } - } - - @Override public void onDetach() { - viewCallback = null; - super.onDetach(); - } - - @Override public void onNotifyAdapter(@Nullable List items) { - hideProgress(); - if (items != null) { - adapter.insertItems(items); - } - } - - @Override public void onCommentAdded(@NonNull Comment newComment) { - hideProgress(); - if (viewCallback != null) { - viewCallback.onAddComment(newComment); - } - } - - @Override public void clearAdapter() { - refresh.setRefreshing(true); - adapter.clear(); - } - - @Override public void onOpenForResult(int position, CommitFileChanges model) { - FullScreenFileChangeActivity.Companion.startActivityForResult(this, model, position, true); - } - - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - if (resultCode == Activity.RESULT_OK) { - if (requestCode == FullScreenFileChangeActivity.Companion.getFOR_RESULT_CODE() && data != null) { - List comments = data.getParcelableArrayListExtra(BundleConstant.ITEM); - if (comments != null && !comments.isEmpty()) { - if (viewCallback != null && !InputHelper.isEmpty(viewCallback.getLogin())) { - getPresenter().onSubmit(viewCallback.getLogin(), viewCallback.getRepoId(), comments.get(0)); - } - } - } - } - super.onActivityResult(requestCode, resultCode, data); - } - - @Override public void hideProgress() { - if (refresh != null) refresh.setRefreshing(false); - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - refresh.setEnabled(false); - stateLayout.setEmptyText(R.string.no_files); - recycler.setEmptyView(stateLayout, refresh); - adapter = new CommitFilesAdapter(getPresenter().changes, this, this); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - if (getPresenter().changes.isEmpty()) getPresenter().onFragmentCreated(getArguments()); - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public CommitFilesPresenter providePresenter() { - return new CommitFilesPresenter(); - } - - @Override public void onToggle(long position, boolean isCollapsed) { - CommitFileChanges model = adapter.getItem((int) position); - if (model == null) return; - if (model.getCommitFileModel().getPatch() == null) { - if ("renamed".equalsIgnoreCase(model.getCommitFileModel().getStatus())) { - SchemeParser.launchUri(getContext(), model.getCommitFileModel().getBlobUrl()); - return; - } - ActivityHelper.startCustomTab(getActivity(), adapter.getItem((int) position).getCommitFileModel().getBlobUrl()); - } - toggleMap.put(position, isCollapsed); - } - - @Override public boolean isCollapsed(long position) { - Boolean toggle = toggleMap.get(position); - return toggle != null && toggle; - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - @Override public void onPatchClicked(int groupPosition, int childPosition, View v, CommitFileModel commit, CommitLinesModel item) { - if (item.getText().startsWith("@@")) return; - if (PrefGetter.isProEnabled()) { - AddReviewDialogFragment.Companion.newInstance(item, Bundler.start() - .put(BundleConstant.ITEM, commit.getBlobUrl()) - .put(BundleConstant.EXTRA, commit.getFilename()) - .end()) - .show(getChildFragmentManager(), "AddReviewDialogFragment"); - } else { - PremiumActivity.Companion.startActivity(getContext()); - } - } - - @Override public void onCommentAdded(@NonNull String comment, @NonNull CommitLinesModel item, Bundle bundle) { - getPresenter().onSubmitComment(comment, item, bundle); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesMvp.java deleted file mode 100644 index e7f9bbe81..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesMvp.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.commit.details.files; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.CommentRequestModel; -import com.fastaccess.data.dao.CommitFileChanges; -import com.fastaccess.data.dao.CommitLinesModel; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.ui.adapter.callback.OnToggleView; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.files.PullRequestFilesMvp; -import com.fastaccess.ui.modules.reviews.callback.ReviewCommentListener; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.List; - -/** - * Created by Kosh on 20 Nov 2016, 11:10 AM - */ - -interface CommitFilesMvp { - - interface View extends BaseMvp.FAView, OnToggleView, PullRequestFilesMvp.OnPatchClickListener, ReviewCommentListener { - - void onNotifyAdapter(@Nullable List items); - - void onCommentAdded(@NonNull Comment newComment); - - void clearAdapter(); - - void onOpenForResult(int position, CommitFileChanges model); - } - - interface Presenter extends BaseMvp.FAPresenter, BaseViewHolder.OnItemClickListener { - - void onFragmentCreated(@Nullable Bundle bundle); - - void onSubmitComment(@NonNull String comment, @NonNull CommitLinesModel item, @Nullable Bundle bundle); - - void onSubmit(String username, String name, CommentRequestModel commentRequestModel); - } - - -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesPresenter.java deleted file mode 100644 index a94e22da7..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesPresenter.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.commit.details.files; - -import android.app.Activity; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.MenuInflater; -import android.view.View; -import android.widget.PopupMenu; - -import com.fastaccess.R; -import com.fastaccess.data.dao.CommentRequestModel; -import com.fastaccess.data.dao.CommitFileChanges; -import com.fastaccess.data.dao.CommitFileListModel; -import com.fastaccess.data.dao.CommitFileModel; -import com.fastaccess.data.dao.CommitLinesModel; -import com.fastaccess.data.dao.NameParser; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.code.CodeViewerActivity; - -import java.util.ArrayList; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 15 Feb 2017, 10:10 PM - */ - -class CommitFilesPresenter extends BasePresenter implements CommitFilesMvp.Presenter { - @com.evernote.android.state.State String sha; - ArrayList changes = new ArrayList<>(); - - @Override public void onItemClick(int position, View v, CommitFileChanges model) { - if (v.getId() == R.id.patchList) { - sendToView(view -> view.onOpenForResult(position, model)); - } else if (v.getId() == R.id.open) { - CommitFileModel item = model.getCommitFileModel(); - PopupMenu popup = new PopupMenu(v.getContext(), v); - MenuInflater inflater = popup.getMenuInflater(); - inflater.inflate(R.menu.commit_row_menu, popup.getMenu()); - popup.setOnMenuItemClickListener(item1 -> { - switch (item1.getItemId()) { - case R.id.open: - v.getContext().startActivity(CodeViewerActivity.createIntent(v.getContext(), item.getContentsUrl(), item.getBlobUrl())); - break; - case R.id.share: - ActivityHelper.shareUrl(v.getContext(), item.getBlobUrl()); - break; - case R.id.download: - Activity activity = ActivityHelper.getActivity(v.getContext()); - if (activity == null) break; - if (ActivityHelper.checkAndRequestReadWritePermission(activity)) { - RestProvider.downloadFile(v.getContext(), item.getRawUrl()); - } - break; - case R.id.copy: - AppHelper.copyToClipboard(v.getContext(), item.getBlobUrl()); - break; - } - return true; - }); - popup.show(); - } - } - - @Override public void onItemLongClick(int position, View v, CommitFileChanges item) {} - - @Override public void onFragmentCreated(@Nullable Bundle bundle) { - if (sha == null) { - if (bundle != null) { - sha = bundle.getString(BundleConstant.ID); - } - } - if (!InputHelper.isEmpty(sha)) { - CommitFileListModel commitFiles = CommitFilesSingleton.getInstance().getByCommitId(sha); - if (commitFiles != null) { - manageObservable(Observable.just(commitFiles) - .map(CommitFileChanges::construct) - .doOnSubscribe(disposable -> sendToView(CommitFilesMvp.View::clearAdapter)) - .doOnNext(commitFileChanges -> { - sendToView(view -> view.onNotifyAdapter(commitFileChanges)); - }) - .doOnComplete(() -> sendToView(BaseMvp.FAView::hideProgress))); - } - } else { - throw new NullPointerException("Bundle is null"); - } - } - - @Override public void onSubmitComment(@NonNull String comment, @NonNull CommitLinesModel item, @Nullable Bundle bundle) { - if (bundle != null) { - String blob = bundle.getString(BundleConstant.ITEM); - String path = bundle.getString(BundleConstant.EXTRA); - if (path == null || sha == null) return; - CommentRequestModel commentRequestModel = new CommentRequestModel(); - commentRequestModel.setBody(comment); - commentRequestModel.setPath(path); - commentRequestModel.setPosition(item.getPosition()); - commentRequestModel.setLine(item.getRightLineNo() > 0 ? item.getRightLineNo() : item.getLeftLineNo()); - NameParser nameParser = new NameParser(blob); - onSubmit(nameParser.getUsername(), nameParser.getName(), commentRequestModel); - } - } - - @Override public void onSubmit(String username, String name, CommentRequestModel commentRequestModel) { - makeRestCall(RestProvider.getRepoService(isEnterprise()).postCommitComment(username, name, sha, - commentRequestModel), newComment -> sendToView(view -> view.onCommentAdded(newComment))); - } - - @Override protected void onDestroy() { - CommitFilesSingleton.getInstance().clear(); - super.onDestroy(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesSingleton.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesSingleton.java deleted file mode 100644 index 21ddfa90d..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/details/files/CommitFilesSingleton.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.commit.details.files; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.CommitFileListModel; - -import java.util.Hashtable; -import java.util.Map; - -/** - * Created by Kosh on 27 Mar 2017, 7:28 PM - * Commits files could be so freaking large, so having this will avoid transactionToLargeException. - */ - -class CommitFilesSingleton { - private static final CommitFilesSingleton SINGLETON = new CommitFilesSingleton(); - - static CommitFilesSingleton getInstance() { - return SINGLETON; - } - - private Map files = new Hashtable<>(); - - private CommitFilesSingleton() {} - - void putFiles(@NonNull String id, @NonNull CommitFileListModel commitFiles) { - clear(); - files.put(id, commitFiles); - } - - @Nullable CommitFileListModel getByCommitId(@NonNull String id) { - return files.get(id); - } - - void clear() { - files.clear(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/history/FileCommitHistoryActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/history/FileCommitHistoryActivity.kt deleted file mode 100644 index 195168ff6..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/history/FileCommitHistoryActivity.kt +++ /dev/null @@ -1,86 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.commit.history - -import android.content.Context -import android.content.Intent -import android.os.Bundle -import android.view.MenuItem -import com.evernote.android.state.State -import com.fastaccess.R -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.ui.base.BaseActivity -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import com.fastaccess.ui.modules.repos.RepoPagerActivity -import com.fastaccess.ui.modules.repos.code.commit.RepoCommitsFragment - -/** - * Created by Hashemsergani on 02/09/2017. - */ -class FileCommitHistoryActivity : BaseActivity>() { - - @State var login: String? = null - @State var repoId: String? = null - - override fun layout(): Int = R.layout.activity_fragment_layout - - override fun providePresenter(): BasePresenter = BasePresenter() - - override fun isTransparent(): Boolean = true - - override fun canBack(): Boolean = true - - override fun isSecured(): Boolean = false - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - if (savedInstanceState == null && intent != null) { - val bundle = intent.extras ?: kotlin.run { - finish() - return - } - repoId = bundle.getString(BundleConstant.ID) - login = bundle.getString(BundleConstant.EXTRA) - supportFragmentManager - .beginTransaction() - .replace(R.id.container, RepoCommitsFragment.newInstance(bundle), RepoCommitsFragment::class.java.simpleName) - .commit() - } - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - if (item.itemId == android.R.id.home) { - val repoId = repoId - val login = login - if (!repoId.isNullOrEmpty() && !login.isNullOrEmpty()) { - val bundle = intent.extras - val intent = RepoPagerActivity.createIntent(this, repoId, login) - bundle?.putBoolean(BundleConstant.IS_ENTERPRISE, isEnterprise) - bundle?.let { intent.putExtras(it) } - startActivity(intent) - finish() - } - return true - } - return super.onOptionsItemSelected(item) - } - - companion object { - fun startActivity( - context: Context, login: String, repoId: String, branch: String, path: String, - enterprise: Boolean - ) { - val intent = Intent(context, FileCommitHistoryActivity::class.java) - intent.putExtras( - Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.EXTRA_TWO, branch) - .put(BundleConstant.EXTRA_THREE, path) - .put(BundleConstant.IS_ENTERPRISE, enterprise) - .end() - ) - context.startActivity(intent) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/viewer/FullCommitFileActivity.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/viewer/FullCommitFileActivity.java deleted file mode 100644 index cca82f0cf..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/commit/viewer/FullCommitFileActivity.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.commit.viewer; - -import android.content.Context; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import androidx.annotation.NonNull; -import android.view.Menu; -import android.view.MenuItem; - -import com.fastaccess.R; -import com.fastaccess.data.dao.CommitFileModel; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.code.CodeViewerActivity; -import com.fastaccess.ui.widgets.DiffLineSpan; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.SpannableBuilder; - -import net.grandcentrix.thirtyinch.TiPresenter; - -import butterknife.BindString; -import butterknife.BindView; -import com.evernote.android.state.State; - -/** - * Created by Kosh on 24 Apr 2017, 2:53 PM - */ - -public class FullCommitFileActivity extends BaseActivity { - @BindView(R.id.textView) FontTextView textView; - - - @State CommitFileModel commitFileModel; - @BindView(R.id.changes) FontTextView changes; - @BindView(R.id.addition) FontTextView addition; - @BindView(R.id.deletion) FontTextView deletion; - @BindView(R.id.status) FontTextView status; - @BindString(R.string.changes) String changesText; - @BindString(R.string.addition) String additionText; - @BindString(R.string.deletion) String deletionText; - @BindString(R.string.status) String statusText; - - public static void start(@NonNull Context context, @NonNull CommitFileModel fileModel) { - Intent starter = new Intent(context, FullCommitFileActivity.class); - starter.putExtras(Bundler.start() - .put(BundleConstant.ITEM, fileModel) - .end()); - context.startActivity(starter); - } - - @Override protected int layout() { - return R.layout.commit_file_full_layout; - } - - @Override protected boolean isTransparent() { - return false; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @NonNull @Override public TiPresenter providePresenter() { - return new BasePresenter(); - } - - @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - if (savedInstanceState == null) { - commitFileModel = getIntent().getExtras().getParcelable(BundleConstant.ITEM); - } - if (commitFileModel == null || commitFileModel.getPatch() == null) { - finish(); - return; - } - changes.setText(SpannableBuilder.builder() - .append(changesText) - .append("\n") - .bold(String.valueOf(commitFileModel.getChanges()))); - addition.setText(SpannableBuilder.builder() - .append(additionText) - .append("\n") - .bold(String.valueOf(commitFileModel.getAdditions()))); - deletion.setText(SpannableBuilder.builder() - .append(deletionText) - .append("\n") - .bold(String.valueOf(commitFileModel.getDeletions()))); - status.setText(SpannableBuilder.builder() - .append(statusText) - .append("\n") - .bold(String.valueOf(commitFileModel.getStatus()))); - setTitle(Uri.parse(commitFileModel.getFilename()).getLastPathSegment()); - textView.setText(DiffLineSpan.getSpannable(commitFileModel.getPatch(), - ViewHelper.getPatchAdditionColor(this), - ViewHelper.getPatchDeletionColor(this), - ViewHelper.getPatchRefColor(this))); - } - - @Override public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.commit_row_menu, menu); - return super.onCreateOptionsMenu(menu); - } - - @Override public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case R.id.open: - startActivity(CodeViewerActivity.createIntent(this, commitFileModel.getContentsUrl(), commitFileModel.getBlobUrl())); - return true; - case R.id.share: - ActivityHelper.shareUrl(this, commitFileModel.getBlobUrl()); - return true; - case R.id.download: - if (ActivityHelper.checkAndRequestReadWritePermission(this)) { - RestProvider.downloadFile(this, commitFileModel.getRawUrl()); - } - return true; - case R.id.copy: - AppHelper.copyToClipboard(this, commitFileModel.getBlobUrl()); - return true; - default: - return super.onOptionsItemSelected(item); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/contributors/RepoContributorsFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/contributors/RepoContributorsFragment.java deleted file mode 100644 index 012502b50..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/contributors/RepoContributorsFragment.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.contributors; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.UsersAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class RepoContributorsFragment extends BaseFragment implements RepoContributorsMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private UsersAdapter adapter; - - public static RepoContributorsFragment newInstance(@NonNull String repoId, @NonNull String login) { - RepoContributorsFragment view = new RepoContributorsFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .end()); - return view; - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override protected int fragmentLayout() { - return R.layout.small_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new NullPointerException("Bundle is null, therefore, issues can't be proceeded."); - } - stateLayout.setEmptyText(R.string.no_contributors); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - recycler.addKeyLineDivider(); - adapter = new UsersAdapter(getPresenter().getUsers(), true); - adapter.setListener(getPresenter()); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - if (savedInstanceState == null) { - getPresenter().onFragmentCreated(getArguments()); - } else if (getPresenter().getUsers().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public RepoContributorsPresenter providePresenter() { - return new RepoContributorsPresenter(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @SuppressWarnings("unchecked") @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore(getPresenter()); - } - return onLoadMore; - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, getArguments().getString(BundleConstant.EXTRA)); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/contributors/RepoContributorsMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/contributors/RepoContributorsMvp.java deleted file mode 100644 index b1ad91c4f..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/contributors/RepoContributorsMvp.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.contributors; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -interface RepoContributorsMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - void onFragmentCreated(@NonNull Bundle bundle); - - void onWorkOffline(); - - @NonNull ArrayList getUsers(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/contributors/RepoContributorsPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/contributors/RepoContributorsPresenter.java deleted file mode 100644 index ab124cadf..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/contributors/RepoContributorsPresenter.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.contributors; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class RepoContributorsPresenter extends BasePresenter implements RepoContributorsMvp.Presenter { - - private ArrayList users = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - @com.evernote.android.state.State String repoId; - @com.evernote.android.state.State String login; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public boolean onCallApi(int page, @Nullable Object parameter) { - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0) { - sendToView(RepoContributorsMvp.View::hideProgress); - return false; - } - makeRestCall(RestProvider.getRepoService(isEnterprise()).getContributors(login, repoId, page), - response -> { - if (response != null) { - lastPage = response.getLast(); - } - sendToView(view -> view.onNotifyAdapter(response != null ? response.getItems() : null, page)); - }); - return true; - } - - @Override public void onFragmentCreated(@NonNull Bundle bundle) { - repoId = bundle.getString(BundleConstant.ID); - login = bundle.getString(BundleConstant.EXTRA); - if (!InputHelper.isEmpty(login) && !InputHelper.isEmpty(repoId)) { - onCallApi(1, null); - } - } - - @Override public void onError(@NonNull Throwable throwable) { - onWorkOffline(); - super.onError(throwable); - } - - @Override public void onWorkOffline() { - sendToView(BaseMvp.FAView::hideProgress); - } - - @NonNull @Override public ArrayList getUsers() { - return users; - } - - @Override public void onItemClick(int position, View v, User item) {} - - @Override public void onItemLongClick(int position, View v, User item) {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/RepoFilesFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/RepoFilesFragment.java deleted file mode 100644 index 3d373f27f..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/RepoFilesFragment.java +++ /dev/null @@ -1,257 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.files; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import android.view.MenuInflater; -import android.view.View; -import android.widget.PopupMenu; - -import com.fastaccess.R; -import com.fastaccess.data.dao.EditRepoFileModel; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.RepoFile; -import com.fastaccess.data.dao.types.FilesType; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.FileHelper; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.provider.markdown.MarkDownProvider; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.adapter.RepoFilesAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.code.CodeViewerActivity; -import com.fastaccess.ui.modules.main.premium.PremiumActivity; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; -import com.fastaccess.ui.modules.repos.code.files.activity.RepoFilesActivity; -import com.fastaccess.ui.modules.repos.code.files.paths.RepoFilePathFragment; -import com.fastaccess.ui.modules.repos.git.EditRepoFileActivity; -import com.fastaccess.ui.modules.repos.git.delete.DeleteFileBottomSheetFragment; -import com.fastaccess.ui.widgets.AppbarRefreshLayout; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import butterknife.BindView; - -/** - * Created by Kosh on 18 Feb 2017, 2:10 AM - */ - -public class RepoFilesFragment extends BaseFragment implements RepoFilesMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) AppbarRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private RepoFilesAdapter adapter; - private Login login; - private RepoFilePathFragment parentFragment; - private RepoPagerMvp.View repoCallback; - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() instanceof RepoPagerMvp.View) { - repoCallback = (RepoPagerMvp.View) getParentFragment(); - } else if (context instanceof RepoPagerMvp.View) { - repoCallback = (RepoPagerMvp.View) context; - } - } - - @Override public void onDetach() { - repoCallback = null; - super.onDetach(); - } - - @Override public void onNotifyAdapter() { - hideProgress(); - adapter.notifyDataSetChanged(); - } - - @Override public void onItemClicked(@NonNull RepoFile model) { - if (refresh.isRefreshing()) return; - if (model.getType() == FilesType.dir) { - if (getParent() != null) { - getParent().onAppendPath(model); - } - } else { - if (model.getSize() == 0 && InputHelper.isEmpty(model.getDownloadUrl()) && !InputHelper.isEmpty(model.getGitUrl())) { - RepoFilesActivity.startActivity(getContext(), model.getGitUrl().replace("trees/", ""), isEnterprise()); - } else { - String url = InputHelper.isEmpty(model.getDownloadUrl()) ? model.getUrl() : model.getDownloadUrl(); - if (InputHelper.isEmpty(url)) return; - if (model.getSize() > FileHelper.ONE_MB && !MarkDownProvider.isImage(url)) { - MessageDialogView.newInstance(getString(R.string.big_file), getString(R.string.big_file_description), - false, true, Bundler.start() - .put(BundleConstant.EXTRA, model.getDownloadUrl()) - .put(BundleConstant.YES_NO_EXTRA, true) - .end()) - .show(getChildFragmentManager(), "MessageDialogView"); - } else { - CodeViewerActivity.startActivity(getContext(), url, model.getHtmlUrl()); - } - } - } - } - - @Override public void onMenuClicked(int position, @NonNull RepoFile item, View v) { - if (login == null) { - login = Login.getUser(); - } - if (refresh.isRefreshing()) return; - boolean isOwner = login.getLogin().equals(getPresenter().login) || (repoCallback != null && repoCallback.isCollaborator()); - PopupMenu popup = new PopupMenu(getContext(), v); - MenuInflater inflater = popup.getMenuInflater(); - inflater.inflate(R.menu.download_share_menu, popup.getMenu()); - popup.getMenu().findItem(R.id.download).setVisible(item.getType() == FilesType.file); - boolean canOpen = canOpen(item); - popup.getMenu().findItem(R.id.editFile).setVisible(isOwner && item.getType() == FilesType.file && canOpen); - popup.getMenu().findItem(R.id.deleteFile).setVisible(isOwner && item.getType() == FilesType.file); - popup.getMenu().findItem(R.id.history).setVisible(true); - popup.setOnMenuItemClickListener(item1 -> { - switch (item1.getItemId()) { - case R.id.share: - ActivityHelper.shareUrl(v.getContext(), item.getHtmlUrl()); - break; - case R.id.download: - if (ActivityHelper.checkAndRequestReadWritePermission(getActivity())) { - RestProvider.downloadFile(getContext(), item.getDownloadUrl()); - } - break; - case R.id.copy: - AppHelper.copyToClipboard(v.getContext(), !InputHelper.isEmpty(item.getHtmlUrl()) ? item.getHtmlUrl() : item.getUrl()); - break; - case R.id.editFile: - if (PrefGetter.isProEnabled() || PrefGetter.isAllFeaturesUnlocked()) { - if (canOpen) { - EditRepoFileModel fileModel = new EditRepoFileModel(getPresenter().login, getPresenter().repoId, - item.getPath(), getPresenter().ref, item.getSha(), item.getDownloadUrl(), item.getName(), true); - EditRepoFileActivity.Companion.startForResult(this, fileModel, isEnterprise()); - } - } else { - PremiumActivity.Companion.startActivity(getContext()); - } - break; - case R.id.deleteFile: - if (PrefGetter.isProEnabled() || PrefGetter.isAllFeaturesUnlocked()) { - DeleteFileBottomSheetFragment.Companion.newInstance(position, item.getName()) - .show(getChildFragmentManager(), DeleteFileBottomSheetFragment.class.getSimpleName()); - } else { - PremiumActivity.Companion.startActivity(getContext()); - } - break; - case R.id.history: - getPresenter().onItemLongClick(position, v, item); - break; - } - return true; - }); - popup.show(); - } - - @Override public void onSetData(@NonNull String login, @NonNull String repoId, @NonNull String path, - @NonNull String ref, boolean clear, @Nullable RepoFile toAppend) { - getPresenter().onInitDataAndRequest(login, repoId, path, ref, clear, toAppend); - } - - @Override public boolean isRefreshing() { - return refresh.isRefreshing(); - } - - @Override public void onUpdateTab(@Nullable RepoFile toAppend) { - getParent().onAppenedtab(toAppend); - } - - @Override protected int fragmentLayout() { - return R.layout.vertical_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - stateLayout.setEmptyText(R.string.no_files); - refresh.setOnRefreshListener(this); - stateLayout.setOnReloadListener(v -> onRefresh()); - recycler.setEmptyView(stateLayout, refresh); - adapter = new RepoFilesAdapter(getPresenter().getFiles()); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - fastScroller.setVisibility(View.GONE); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public RepoFilesPresenter providePresenter() { - return new RepoFilesPresenter(); - } - - @Override public void onRefresh() { - getPresenter().onCallApi(null); - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (isOk && bundle != null) { - String url = bundle.getString(BundleConstant.EXTRA); - if (!InputHelper.isEmpty(url)) { - if (ActivityHelper.checkAndRequestReadWritePermission(getActivity())) { - RestProvider.downloadFile(getContext(), url); - } - } - } - } - - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (resultCode == Activity.RESULT_OK && requestCode == EditRepoFileActivity.EDIT_RQ) { - onRefresh(); - } - } - - @Override public void onDelete(@NonNull String message, int position) { - getPresenter().onDeleteFile(message, adapter.getItem(position), getParent() != null ? getParent().getRef() : "master"); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } - - private RepoFilePathFragment getParent() { - if (parentFragment == null) { - parentFragment = (RepoFilePathFragment) getParentFragment(); - } - return parentFragment; - } - - private boolean canOpen(@NonNull RepoFile item) { - return item.getDownloadUrl() != null && !MarkDownProvider.isImage(item.getDownloadUrl()) - && !MarkDownProvider.isArchive(item.getDownloadUrl()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/RepoFilesMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/RepoFilesMvp.java deleted file mode 100644 index 8f92073a7..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/RepoFilesMvp.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.files; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.RepoFile; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.repos.git.delete.DeleteContentFileCallback; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 20 Nov 2016, 11:10 AM - */ - -interface RepoFilesMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, DeleteContentFileCallback { - void onNotifyAdapter(); - - void onItemClicked(@NonNull RepoFile model); - - void onMenuClicked(int position, @NonNull RepoFile model, android.view.View view); - - void onSetData(@NonNull String login, @NonNull String repoId, @NonNull String path, @NonNull String ref, - boolean clear, @Nullable RepoFile toAppend); - - boolean isRefreshing(); - - void onUpdateTab(@Nullable RepoFile toAppend); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener { - - @NonNull ArrayList getFiles(); - - void onWorkOffline(); - - void onCallApi(@Nullable RepoFile toAppend); - - void onInitDataAndRequest(@NonNull String login, @NonNull String repoId, @NonNull String path, - @NonNull String ref, boolean clear, @Nullable RepoFile toAppend); - - @Nullable List getCachedFiles(@NonNull String url, @NonNull String ref); - - void onDeleteFile(@NonNull String message, @NonNull RepoFile item, @NonNull String branch); - } - - -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/RepoFilesPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/RepoFilesPresenter.java deleted file mode 100644 index d8afefda8..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/RepoFilesPresenter.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.files; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.CommitRequestModel; -import com.fastaccess.data.dao.RepoPathsManager; -import com.fastaccess.data.dao.model.RepoFile; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.repos.code.commit.history.FileCommitHistoryActivity; - -import java.util.ArrayList; -import java.util.List; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 15 Feb 2017, 10:10 PM - */ - -class RepoFilesPresenter extends BasePresenter implements RepoFilesMvp.Presenter { - private ArrayList files = new ArrayList<>(); - private RepoPathsManager pathsModel = new RepoPathsManager(); - @com.evernote.android.state.State String repoId; - @com.evernote.android.state.State String login; - @com.evernote.android.state.State String path; - @com.evernote.android.state.State String ref; - - @Override public void onItemClick(int position, View v, RepoFile item) { - if (getView() == null) return; - if (v.getId() != R.id.menu) { - getView().onItemClicked(item); - } else { - getView().onMenuClicked(position, item, v); - } - } - - @Override public void onItemLongClick(int position, View v, RepoFile item) { - FileCommitHistoryActivity.Companion.startActivity(v.getContext(), login, repoId, ref, item.getPath(), isEnterprise()); - } - - @Override public void onError(@NonNull Throwable throwable) { - onWorkOffline(); - super.onError(throwable); - } - - @NonNull @Override public ArrayList getFiles() { - return files; - } - - @Override public void onWorkOffline() { - if ((repoId == null || login == null) || !files.isEmpty()) return; - manageDisposable(RxHelper.getObservable(RepoFile.getFiles(login, repoId).toObservable()) - .flatMap(response -> { - if (response != null) { - return Observable.fromIterable(response) - .filter(repoFile -> repoFile != null && repoFile.getType() != null) - .sorted((repoFile, repoFile2) -> repoFile2.getType().compareTo(repoFile.getType())); - } - return Observable.empty(); - }) - .toList() - .subscribe(models -> { - files.addAll(models); - sendToView(RepoFilesMvp.View::onNotifyAdapter); - })); - } - - @Override public void onCallApi(@Nullable RepoFile toAppend) { - if (repoId == null || login == null) return; - makeRestCall(RestProvider.getRepoService(isEnterprise()).getRepoFiles(login, repoId, path, ref) - .flatMap(response -> { - if (response != null && response.getItems() != null) { - return Observable.fromIterable(response.getItems()) - .filter(repoFile -> repoFile.getType() != null) - .sorted((repoFile, repoFile2) -> repoFile2.getType().compareTo(repoFile.getType())); - } - return Observable.empty(); - }) - .toList().toObservable(), response -> { - files.clear(); - if (response != null) { - manageObservable(RepoFile.save(response, login, repoId)); - pathsModel.setFiles(ref, path, response); - files.addAll(response); - } - sendToView(view -> { - view.onNotifyAdapter(); - view.onUpdateTab(toAppend); - }); - }); - - } - - @Override public void onInitDataAndRequest(@NonNull String login, @NonNull String repoId, @NonNull String path, - @NonNull String ref, boolean clear, @Nullable RepoFile toAppend) { - if (clear) pathsModel.clear(); - this.login = login; - this.repoId = repoId; - this.ref = ref; - this.path = path; - List cachedFiles = getCachedFiles(path, ref); - if (cachedFiles != null && !cachedFiles.isEmpty()) { - files.clear(); - files.addAll(cachedFiles); - sendToView(view -> { - view.onNotifyAdapter(); - view.onUpdateTab(toAppend); - }); - } else { - onCallApi(toAppend); - } - } - - @Nullable @Override public List getCachedFiles(@NonNull String url, @NonNull String ref) { - return pathsModel.getPaths(url, ref); - } - - @Override public void onDeleteFile(@NonNull String message, @NonNull RepoFile item, @NonNull String branch) { - CommitRequestModel body = new CommitRequestModel(message, null, item.getSha(), branch); - makeRestCall(RestProvider.getContentService(isEnterprise()) - .deleteFile(login, repoId, item.getPath(), ref, body), - gitCommitModel -> sendToView(SwipeRefreshLayout.OnRefreshListener::onRefresh)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/activity/RepoFilesActivity.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/activity/RepoFilesActivity.java deleted file mode 100644 index eb39b3659..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/activity/RepoFilesActivity.java +++ /dev/null @@ -1,167 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.files.activity; - -import android.content.Context; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.MenuItem; - -import com.annimon.stream.Objects; -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.NameParser; -import com.fastaccess.data.dao.model.AbstractRepo; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.main.MainActivity; -import com.fastaccess.ui.modules.repos.RepoPagerActivity; -import com.fastaccess.ui.modules.repos.code.files.paths.RepoFilePathFragment; - -import net.grandcentrix.thirtyinch.TiPresenter; - -/** - * Created by Kosh on 08 Apr 2017, 4:24 PM - */ - -public class RepoFilesActivity extends BaseActivity { - - @State String login; - @State String repoId; - - public static void startActivity(@NonNull Context context, @NonNull String url, boolean isEnterprise) { - if (!InputHelper.isEmpty(url)) { - Intent intent = ActivityHelper.editBundle(getIntent(context, url), isEnterprise); - context.startActivity(intent); - } - } - - public static Intent getIntent(@NonNull Context context, @NonNull String url) { - boolean isEnterprise = LinkParserHelper.isEnterprise(url); - if (isEnterprise) { - url = url.replace("api/v3/", ""); - if (url.contains("/raw")) { - url = url.replace("/raw", ""); - } - } - Uri uri = Uri.parse(url); - if (uri.getPathSegments() != null && uri.getPathSegments().size() > 3) { - String login = null; - String repoId = null; - String branch = null; - StringBuilder path = new StringBuilder(); - boolean startWithRepo = false; - if (uri.getPathSegments().get(0).equalsIgnoreCase("repos")) { - login = uri.getPathSegments().get(1); - repoId = uri.getPathSegments().get(2); - branch = uri.getQueryParameter("ref"); - startWithRepo = true; - } else if (uri.getPathSegments().get(0).equalsIgnoreCase("repositories")) { - String id = uri.getPathSegments().get(1); - try { - long longRepoId = Long.valueOf(id); - if (longRepoId != 0) { - Repo repo = AbstractRepo.getRepo(longRepoId); - if (repo != null) { - NameParser nameParser = new NameParser(repo.getHtmlUrl()); - if (nameParser.getUsername() != null && nameParser.getName() != null) { - login = nameParser.getUsername(); - repoId = nameParser.getName(); - branch = uri.getQueryParameter("ref"); - } - } - } - } catch (NumberFormatException ignored) { - return new Intent(context, MainActivity.class); - } - } else { - login = uri.getPathSegments().get(0); - repoId = uri.getPathSegments().get(1); - branch = uri.getPathSegments().get(2); - } - for (int i = startWithRepo ? 4 : 3; i < uri.getPathSegments().size() - 1; i++) { - String appendedPath = uri.getPathSegments().get(i); - path.append("/").append(appendedPath); - } - if (!InputHelper.isEmpty(repoId) && !InputHelper.isEmpty(login)) { - Intent intent = new Intent(context, RepoFilesActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.EXTRA_TWO, path.toString()) - .put(BundleConstant.EXTRA_THREE, branch) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .end()); - return intent; - } - return new Intent(context, MainActivity.class); - } - return new Intent(context, MainActivity.class); - } - - @Override protected int layout() { - return R.layout.toolbar_activity_layout; - } - - @Override protected boolean isTransparent() { - return true; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @NonNull @Override public TiPresenter providePresenter() { - return new BasePresenter(); - } - - @Override protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - if (savedInstanceState == null) { - Bundle bundle = getIntent().getExtras(); - login = bundle.getString(BundleConstant.EXTRA); - repoId = bundle.getString(BundleConstant.ID); - String path = bundle.getString(BundleConstant.EXTRA_TWO); - String defaultBranch = Objects.toString(bundle.getString(BundleConstant.EXTRA_THREE), "master"); - getSupportFragmentManager().beginTransaction() - .add(R.id.fragmentContainer, RepoFilePathFragment.newInstance(login, repoId, path, defaultBranch, true), "RepoFilePathFragment") - .commit(); - } - setTitle(String.format("%s/%s", login, repoId)); - } - - @Override public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == android.R.id.home) { - Intent intent = ActivityHelper.editBundle(RepoPagerActivity.createIntent(this, repoId, login), isEnterprise()); - startActivity(intent); - finish(); - return true; - } - return super.onOptionsItemSelected(item); - } - - @Override public void onBackPressed() { - RepoFilePathFragment filePathView = (RepoFilePathFragment) AppHelper.getFragmentByTag(getSupportFragmentManager(), "RepoFilePathFragment"); - if (filePathView != null) { - if (filePathView.canPressBack()) { - super.onBackPressed(); - } else { - filePathView.onBackPressed(); - return; - } - } - super.onBackPressed(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/paths/RepoFilePathFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/paths/RepoFilePathFragment.java deleted file mode 100644 index 3cbaf7d40..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/paths/RepoFilePathFragment.java +++ /dev/null @@ -1,289 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.files.paths; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.recyclerview.widget.RecyclerView; -import android.view.View; - -import com.annimon.stream.Objects; -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.BranchesModel; -import com.fastaccess.data.dao.EditRepoFileModel; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.RepoFile; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.adapter.RepoFilePathsAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.main.premium.PremiumActivity; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; -import com.fastaccess.ui.modules.repos.code.files.RepoFilesFragment; -import com.fastaccess.ui.modules.repos.extras.branches.pager.BranchesPagerFragment; -import com.fastaccess.ui.modules.repos.git.EditRepoFileActivity; -import com.fastaccess.ui.modules.search.repos.files.SearchFileActivity; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; - -import java.util.List; - -import butterknife.BindView; -import butterknife.OnClick; - -/** - * Created by Kosh on 18 Feb 2017, 2:10 AM - */ - -public class RepoFilePathFragment extends BaseFragment implements RepoFilePathMvp.View { - - @BindView(R.id.recycler) RecyclerView recycler; - @BindView(R.id.toParentFolder) View toParentFolder; - @BindView(R.id.branches) FontTextView branches; - @BindView(R.id.addFile) View addFile; - private RepoPagerMvp.View repoCallback; - - @State String ref; - - private RepoFilePathsAdapter adapter; - private RepoFilesFragment repoFilesView; - - public static RepoFilePathFragment newInstance(@NonNull String login, @NonNull String repoId, @Nullable String path, - @NonNull String defaultBranch) { - return newInstance(login, repoId, path, defaultBranch, false); - } - - public static RepoFilePathFragment newInstance(@NonNull String login, @NonNull String repoId, - @Nullable String path, @NonNull String defaultBranch, - boolean forceAppendPath) { - RepoFilePathFragment view = new RepoFilePathFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.EXTRA_TWO, path) - .put(BundleConstant.EXTRA_THREE, defaultBranch) - .put(BundleConstant.EXTRA_FOUR, forceAppendPath) - .end()); - return view; - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() instanceof RepoPagerMvp.View) { - repoCallback = (RepoPagerMvp.View) getParentFragment(); - } else if (context instanceof RepoPagerMvp.View) { - repoCallback = (RepoPagerMvp.View) context; - } - } - - @Override public void onDetach() { - repoCallback = null; - super.onDetach(); - } - - @OnClick(R.id.addFile) void onAddFile() { - if (PrefGetter.isProEnabled() || PrefGetter.isAllFeaturesUnlocked()) { - RepoFile repoFile = !adapter.isEmpty() ? adapter.getItem(adapter.getItemCount() - 1) : null; - EditRepoFileModel fileModel = new EditRepoFileModel(getPresenter().login, getPresenter().repoId, - repoFile != null ? repoFile.getPath() : "", ref, repoFile != null ? repoFile.getSha() : "", null, null, false); - EditRepoFileActivity.Companion.startForResult(this, fileModel, isEnterprise()); - } else { - PremiumActivity.Companion.startActivity(getContext()); - } - } - - @OnClick(R.id.downloadRepoFiles) void onDownloadRepoFiles() { - if (InputHelper.isEmpty(ref)) { - ref = getPresenter().getDefaultBranch(); - } - if (ActivityHelper.checkAndRequestReadWritePermission(getActivity())) { - MessageDialogView.newInstance(getString(R.string.download), getString(R.string.confirm_message), - Bundler.start() - .put(BundleConstant.YES_NO_EXTRA, true) - .end()) - .show(getChildFragmentManager(), MessageDialogView.TAG); - } - } - - @OnClick(R.id.searchRepoFiles) void onSearchClicked() { - startActivity(SearchFileActivity.createIntent(getContext(), getPresenter().getLogin(), getPresenter().getRepoId(), isEnterprise())); - } - - @OnClick(R.id.toParentFolder) void onBackClicked() { - if (adapter.getItemCount() > 0) { - adapter.clear(); - getRepoFilesView().onSetData(getPresenter().getLogin(), getPresenter().getRepoId(), "", ref, false, null); - } - } - - @OnClick(R.id.branches) void onBranchesClicked() { - BranchesPagerFragment.Companion.newInstance(getPresenter().login, getPresenter().repoId) - .show(getChildFragmentManager(), "BranchesFragment"); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - recycler.smoothScrollToPosition(adapter.getItemCount() - 1); - } - - @Override public void onItemClicked(@NonNull RepoFile model, int position) { - if (getRepoFilesView().isRefreshing()) return; - getRepoFilesView().onSetData(getPresenter().getLogin(), getPresenter().getRepoId(), - Objects.toString(model.getPath(), ""), ref, false, null); - if ((position + 1) < adapter.getItemCount()) { - adapter.subList(position + 1, adapter.getItemCount()); - } - recycler.scrollToPosition(adapter.getItemCount() - 1); - } - - @Override public void onAppendPath(@NonNull RepoFile model) { - getRepoFilesView().onSetData(getPresenter().getLogin(), getPresenter().getRepoId(), - Objects.toString(model.getPath(), ""), ref, false, model); - } - - @Override public void onAppenedtab(@Nullable RepoFile repoFile) { - if (repoFile != null) { - adapter.addItem(repoFile); - recycler.scrollToPosition(adapter.getItemCount() - 1); - } - } - - @Override public void onSendData() { - if (InputHelper.isEmpty(ref)) { - ref = getPresenter().getDefaultBranch(); - } - getRepoFilesView().onSetData(getPresenter().getLogin(), getPresenter().getRepoId(), - Objects.toString(getPresenter().getPath(), ""), ref, false, null); - } - - @Override public boolean canPressBack() { - return adapter == null || adapter.getItemCount() == 0; - } - - @Override public void onBackPressed() { - if (getRepoFilesView().isRefreshing()) return; - if (adapter.getItemCount() > 1) { - adapter.removeItem(adapter.getItemCount() - 1); - RepoFile model = adapter.getItem(adapter.getItemCount() - 1); - getRepoFilesView().onSetData(getPresenter().getLogin(), getPresenter().getRepoId(), - Objects.toString(model.getPath(), ""), ref, false, null); - recycler.scrollToPosition(adapter.getItemCount() - 1); - } else { - onBackClicked(); - } - } - - @Override public void showProgress(@StringRes int resId) {} - - @Override public void hideProgress() {} - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @Override protected int fragmentLayout() { - return R.layout.repo_file_layout; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - adapter = new RepoFilePathsAdapter(getPresenter().getPaths()); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - branches.setText(ref); - if (savedInstanceState == null) { - getPresenter().onFragmentCreated(getArguments()); - } else if (getPresenter().getPaths().isEmpty() && !getPresenter().isApiCalled()) { - getPresenter().onFragmentCreated(getArguments()); - } - branches.setText(getPresenter().getDefaultBranch()); - if (Login.getUser().getLogin().equalsIgnoreCase(getPresenter().login) || (repoCallback != null && repoCallback.isCollaborator())) { - addFile.setVisibility(View.VISIBLE); - } - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (isOk && bundle != null) { - boolean isDownload = bundle.getBoolean(BundleConstant.YES_NO_EXTRA); - if (isDownload) { - Uri uri = new Uri.Builder() - .scheme("https") - .authority("github.com") - .appendPath(getPresenter().getLogin()) - .appendPath(getPresenter().getRepoId()) - .appendPath("archive") - .appendPath(ref + ".zip") - .build(); - RestProvider.downloadFile(getContext(), uri.toString()); - } - } - } - - @NonNull @Override public RepoFilePathPresenter providePresenter() { - return new RepoFilePathPresenter(); - } - - @Override public void setUserVisibleHint(boolean isVisibleToUser) { - super.setUserVisibleHint(isVisibleToUser); - //noinspection ConstantConditions (for this state, it is still null!!!) - if (isSafe() && getRepoFilesView() != null) getRepoFilesView().onHiddenChanged(!isVisibleToUser); - } - - @NonNull public RepoFilesFragment getRepoFilesView() { - if (repoFilesView == null) { - repoFilesView = (RepoFilesFragment) getChildFragmentManager().findFragmentById(R.id.filesFragment); - } - return repoFilesView; - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (repoFilesView != null) repoFilesView.onScrollTop(index); - } - - @Override public void onBranchSelected(@NonNull BranchesModel branch) { - ref = branch.getName(); - branches.setText(ref); - getRepoFilesView().onSetData(getPresenter().getLogin(), getPresenter().getRepoId(), "", ref, true, null); - onBackClicked(); - } - - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (resultCode == Activity.RESULT_OK && requestCode == EditRepoFileActivity.EDIT_RQ) { - getRepoFilesView().onRefresh(); - } - } - - private void showReload() { - hideProgress(); - } - - @NonNull public String getRef() { - return !InputHelper.isEmpty(ref) ? ref : "master"; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/paths/RepoFilePathMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/paths/RepoFilePathMvp.java deleted file mode 100644 index 1ad1958be..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/paths/RepoFilePathMvp.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.files.paths; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.model.RepoFile; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.repos.extras.branches.BranchesMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 20 Nov 2016, 11:10 AM - */ - -interface RepoFilePathMvp { - - interface View extends BaseMvp.FAView, BranchesMvp.BranchSelectionListener { - void onNotifyAdapter(@Nullable List items, int page); - - void onItemClicked(@NonNull RepoFile model, int position); - - void onAppendPath(@NonNull RepoFile model); - - void onAppenedtab(@Nullable RepoFile repoFile); - - void onSendData(); - - boolean canPressBack(); - - void onBackPressed(); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener { - - void onFragmentCreated(@Nullable Bundle bundle); - - @NonNull String getRepoId(); - - @NonNull String getLogin(); - - @Nullable String getPath(); - - @NonNull ArrayList getPaths(); - - String getDefaultBranch(); - } - - -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/paths/RepoFilePathPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/paths/RepoFilePathPresenter.java deleted file mode 100644 index 2b9a24a67..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/files/paths/RepoFilePathPresenter.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.files.paths; - -import android.net.Uri; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.annimon.stream.Objects; -import com.fastaccess.data.dao.model.RepoFile; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 15 Feb 2017, 10:10 PM - */ - -class RepoFilePathPresenter extends BasePresenter implements RepoFilePathMvp.Presenter { - @com.evernote.android.state.State String repoId; - @com.evernote.android.state.State String login; - @com.evernote.android.state.State String path; - @com.evernote.android.state.State String defaultBranch; - private ArrayList paths = new ArrayList<>(); - - @Override public void onItemClick(int position, View v, RepoFile item) { - if (!item.getPath().equalsIgnoreCase(path)) if (getView() != null) getView().onItemClicked(item, position); - } - - @Override public void onItemLongClick(int position, View v, RepoFile item) {} - - @Override public void onFragmentCreated(@Nullable Bundle bundle) { - if (bundle != null) { - repoId = bundle.getString(BundleConstant.ID); - login = bundle.getString(BundleConstant.EXTRA); - path = Objects.toString(bundle.getString(BundleConstant.EXTRA_TWO), ""); - defaultBranch = Objects.toString(bundle.getString(BundleConstant.EXTRA_THREE), "master"); - boolean forceAppend = bundle.getBoolean(BundleConstant.EXTRA_FOUR); - if (InputHelper.isEmpty(repoId) || InputHelper.isEmpty(login)) { - throw new NullPointerException(String.format("error, repoId(%s) or login(%s) is null", repoId, login)); - } - if (forceAppend && paths.isEmpty()) { - List repoFiles = new ArrayList<>(); - if (!InputHelper.isEmpty(path)) { - Uri uri = Uri.parse(path); - StringBuilder builder = new StringBuilder(); - if (uri.getPathSegments() != null && !uri.getPathSegments().isEmpty()) { - List pathSegments = uri.getPathSegments(); - for (int i = 0; i < pathSegments.size(); i++) { - String name = pathSegments.get(i); - RepoFile file = new RepoFile(); - if (i == 0) { - builder.append(name); - } else { - builder.append("/").append(name); - } - file.setPath(builder.toString()); - file.setName(name); - repoFiles.add(file); - } - } - if (!repoFiles.isEmpty()) { - sendToView(view -> view.onNotifyAdapter(repoFiles, 1)); - } - } - } - sendToView(RepoFilePathMvp.View::onSendData); - } else { - throw new NullPointerException("Bundle is null"); - } - } - - @NonNull @Override public String getRepoId() { - return repoId; - } - - @NonNull @Override public String getLogin() { - return login; - } - - @Nullable @Override public String getPath() { - return path; - } - - @NonNull @Override public ArrayList getPaths() { - return paths; - } - - @Override public String getDefaultBranch() { - return defaultBranch; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/prettifier/ViewerFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/prettifier/ViewerFragment.java deleted file mode 100644 index 934eb0df4..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/prettifier/ViewerFragment.java +++ /dev/null @@ -1,276 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.prettifier; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import com.google.android.material.appbar.AppBarLayout; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.MotionEvent; -import android.view.View; -import android.widget.ProgressBar; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.prettifier.pretty.PrettifyWebView; - -import butterknife.BindView; -import it.sephiroth.android.library.bottomnavigation.BottomNavigation; - -/** - * Created by Kosh on 28 Nov 2016, 9:27 PM - */ - -public class ViewerFragment extends BaseFragment implements ViewerMvp.View, AppBarLayout.OnOffsetChangedListener { - - public static final String TAG = ViewerFragment.class.getSimpleName(); - - @BindView(R.id.readmeLoader) ProgressBar loader; - @BindView(R.id.webView) PrettifyWebView webView; - @BindView(R.id.stateLayout) StateLayout stateLayout; - private AppBarLayout appBarLayout; - private BottomNavigation bottomNavigation; - private boolean isAppBarMoving; - private boolean isAppBarExpanded = true; - private boolean isAppBarListener; - @State boolean isWrap = PrefGetter.isWrapCode(); - - public static ViewerFragment newInstance(@NonNull String url, @Nullable String htmlUrl) { - return newInstance(url, htmlUrl, false); - } - - public static ViewerFragment newInstance(@NonNull String url, boolean isRepo) { - return newInstance(url, null, isRepo); - } - - public static ViewerFragment newInstance(@NonNull String url, @Nullable String htmlUrl, boolean isRepo) { - return newInstance(Bundler.start() - .put(BundleConstant.ITEM, url) - .put(BundleConstant.EXTRA_TWO, htmlUrl) - .put(BundleConstant.EXTRA, isRepo) - .end()); - } - - private static ViewerFragment newInstance(@NonNull Bundle bundle) { - ViewerFragment fragmentView = new ViewerFragment(); - fragmentView.setArguments(bundle); - return fragmentView; - } - - @Override public void onSetImageUrl(@NonNull String url, boolean isSvg) { - webView.loadImage(url, isSvg); - webView.setOnContentChangedListener(this); - webView.setVisibility(View.VISIBLE); - getActivity().invalidateOptionsMenu(); - } - - @Override public void onSetMdText(@NonNull String text, String baseUrl, boolean replace) { - webView.setVisibility(View.VISIBLE); - loader.setIndeterminate(false); - webView.setGithubContentWithReplace(text, baseUrl, replace); - webView.setOnContentChangedListener(this); - getActivity().invalidateOptionsMenu(); - } - - @Override public void onSetCode(@NonNull String text) { - webView.setVisibility(View.VISIBLE); - loader.setIndeterminate(false); - webView.setSource(text, isWrap); - webView.setOnContentChangedListener(this); - getActivity().invalidateOptionsMenu(); - } - - @Override public void onShowError(@NonNull String msg) { - hideProgress(); - showErrorMessage(msg); - } - - @Override public void onShowError(@StringRes int msg) { - hideProgress(); - onShowError(getString(msg)); - } - - @Override public void onShowMdProgress() { - loader.setIndeterminate(true); - loader.setVisibility(View.VISIBLE); - stateLayout.showProgress(); - } - - @Override public void openUrl(@NonNull String url) { - ActivityHelper.startCustomTab(getActivity(), url); - } - - @Override public void onViewAsCode() { - getPresenter().onLoadContentAsStream(); - } - - @Override public void showProgress(@StringRes int resId) { - onShowMdProgress(); - } - - @Override public void hideProgress() { - loader.setVisibility(View.GONE); - stateLayout.hideProgress(); - if (!getPresenter().isImage()) stateLayout.showReload(getPresenter().downloadedStream() == null ? 0 : 1); - } - - @Override public void showErrorMessage(@NonNull String msgRes) { - hideProgress(); - super.showErrorMessage(msgRes); - } - - @Override public void showMessage(int titleRes, int msgRes) { - hideProgress(); - super.showMessage(titleRes, msgRes); - } - - @Override public void showMessage(@NonNull String titleRes, @NonNull String msgRes) { - hideProgress(); - super.showMessage(titleRes, msgRes); - } - - @Override protected int fragmentLayout() { - return R.layout.general_viewer_layout; - } - - @NonNull @Override public ViewerPresenter providePresenter() { - return new ViewerPresenter(); - } - - @Override public void onContentChanged(int progress) { - if (loader != null) { - loader.setProgress(progress); - if (progress == 100) { - hideProgress(); - if (!getPresenter().isMarkDown() && !getPresenter().isImage()) { - webView.scrollToLine(getPresenter().url()); - } - } - } - } - - @Override public void onScrollChanged(boolean reachedTop, int scroll) { - if (AppHelper.isDeviceAnimationEnabled(getContext())) { - if (getPresenter().isRepo() && appBarLayout != null && bottomNavigation != null && webView != null) { - boolean shouldExpand = webView.getScrollY() == 0; - if (!isAppBarMoving && shouldExpand != isAppBarExpanded) { - isAppBarMoving = true; - isAppBarExpanded = shouldExpand; - bottomNavigation.setExpanded(shouldExpand, true); - appBarLayout.setExpanded(shouldExpand, true); - webView.setNestedScrollingEnabled(shouldExpand); - if (shouldExpand) - webView.onTouchEvent(MotionEvent.obtain(0, 0, MotionEvent.ACTION_UP, 0, 0, 0)); - } - } - } - } - - @Override public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setHasOptionsMenu(true); - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (InputHelper.isEmpty(getPresenter().downloadedStream())) { - getPresenter().onHandleIntent(getArguments()); - } else { - if (getPresenter().isMarkDown()) { - onSetMdText(getPresenter().downloadedStream(), getPresenter().url(), false); - } else { - onSetCode(getPresenter().downloadedStream()); - } - } - getActivity().invalidateOptionsMenu(); - stateLayout.setEmptyText(R.string.no_data); - if (savedInstanceState == null) { - stateLayout.showReload(0); - } - stateLayout.setOnReloadListener(view1 -> getPresenter().onHandleIntent(getArguments())); - if (getPresenter().isRepo()) { - appBarLayout = getActivity().findViewById(R.id.appbar); - bottomNavigation = getActivity().findViewById(R.id.bottomNavigation); - - if (appBarLayout != null && !isAppBarListener) { - appBarLayout.addOnOffsetChangedListener(this); - isAppBarListener = true; - } - } - } - - @Override public void onStart() { - super.onStart(); - if (AppHelper.isDeviceAnimationEnabled(getContext())) { - if (appBarLayout != null && !isAppBarListener) { - appBarLayout.addOnOffsetChangedListener(this); - isAppBarListener = true; - } - } - } - - @Override public void onStop() { - if (AppHelper.isDeviceAnimationEnabled(getContext())) { - if (appBarLayout != null && isAppBarListener) { - appBarLayout.removeOnOffsetChangedListener(this); - isAppBarListener = false; - } - } - super.onStop(); - } - - @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - super.onCreateOptionsMenu(menu, inflater); - inflater.inflate(R.menu.wrap_menu_option, menu); - menu.findItem(R.id.wrap).setVisible(false); - } - - @Override public void onPrepareOptionsMenu(Menu menu) { - super.onPrepareOptionsMenu(menu); - MenuItem menuItem = menu.findItem(R.id.wrap); - if (menuItem != null) { - if (getPresenter().isMarkDown() || getPresenter().isRepo() || getPresenter().isImage()) { - menuItem.setVisible(false); - } else { - menuItem.setVisible(true).setCheckable(true).setChecked(isWrap); - } - } - } - - @Override public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == R.id.wrap) { - item.setChecked(!item.isChecked()); - isWrap = item.isChecked(); - showProgress(0); - onSetCode(getPresenter().downloadedStream()); - } - return super.onOptionsItemSelected(item); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (webView != null) webView.scrollTo(0, 0); - } - - @Override public void setUserVisibleHint(boolean isVisibleToUser) { - super.setUserVisibleHint(isVisibleToUser); - if (!isVisibleToUser && appBarLayout != null) { - appBarLayout.setVisibility(View.VISIBLE); - } - } - - @Override public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { - verticalOffset = Math.abs(verticalOffset); - if (verticalOffset == 0 || verticalOffset == appBarLayout.getTotalScrollRange()) - isAppBarMoving = false; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/prettifier/ViewerMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/prettifier/ViewerMvp.java deleted file mode 100644 index 433bddc93..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/prettifier/ViewerMvp.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.prettifier; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; - -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.prettifier.pretty.PrettifyWebView; - -/** - * Created by Kosh on 27 Nov 2016, 3:41 PM - */ - -interface ViewerMvp { - - interface View extends BaseMvp.FAView, PrettifyWebView.OnContentChangedListener { - - void onSetImageUrl(@NonNull String url, boolean isSvg); - - void onSetMdText(@NonNull String text, String baseUrl, boolean replace); - - void onSetCode(@NonNull String text); - - void onShowError(@NonNull String msg); - - void onShowError(@StringRes int msg); - - void onShowMdProgress(); - - void openUrl(@NonNull String url); - - void onViewAsCode(); - } - - interface Presenter extends BaseMvp.FAPresenter { - - void onHandleIntent(@Nullable Bundle intent); - - void onLoadContentAsStream(); - - String downloadedStream(); - - boolean isMarkDown(); - - void onWorkOffline(); - - void onWorkOnline(); - - boolean isRepo(); - - boolean isImage(); - - @NonNull String url(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/prettifier/ViewerPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/prettifier/ViewerPresenter.java deleted file mode 100644 index 6d5d2f772..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/prettifier/ViewerPresenter.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.prettifier; - -import android.net.Uri; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.webkit.MimeTypeMap; - -import com.fastaccess.R; -import com.fastaccess.data.dao.MarkdownModel; -import com.fastaccess.data.dao.model.ViewerFile; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.markdown.MarkDownProvider; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 27 Nov 2016, 3:43 PM - */ - -class ViewerPresenter extends BasePresenter implements ViewerMvp.Presenter { - private String downloadedStream; - @com.evernote.android.state.State boolean isMarkdown; - @com.evernote.android.state.State boolean isRepo; - @com.evernote.android.state.State boolean isImage; - @com.evernote.android.state.State String url; - @com.evernote.android.state.State String htmlUrl; - - @Override public void onError(@NonNull Throwable throwable) { - throwable.printStackTrace(); - int code = RestProvider.getErrorCode(throwable); - if (code == 404) { - if (!isRepo) { - sendToView(view -> view.onShowError(R.string.no_file_found)); - } - sendToView(BaseMvp.FAView::hideProgress); - } else { - if (code == 406) { - sendToView(view -> { - view.hideProgress(); - view.openUrl(url); - }); - return; - } - onWorkOffline(); - super.onError(throwable); - } - } - - @Override public void onHandleIntent(@Nullable Bundle intent) { - if (intent == null) return; - isRepo = intent.getBoolean(BundleConstant.EXTRA); - url = intent.getString(BundleConstant.ITEM); - htmlUrl = intent.getString(BundleConstant.EXTRA_TWO); - if (!InputHelper.isEmpty(url)) { - if (MarkDownProvider.isArchive(url)) { - sendToView(view -> view.onShowError(R.string.archive_file_detected_error)); - return; - } - if (isRepo) { - url = url.endsWith("/") ? (url + "readme") : (url + "/readme"); - } - onWorkOnline(); - } - } - - @Override public void onLoadContentAsStream() { - boolean isImage = MarkDownProvider.isImage(url) && !"svg".equalsIgnoreCase(MimeTypeMap.getFileExtensionFromUrl(url)); - if (isImage || MarkDownProvider.isArchive(url)) { - return; - } - makeRestCall(RestProvider.getRepoService(isEnterprise()).getFileAsStream(url), - body -> { - downloadedStream = body; - sendToView(view -> view.onSetCode(body)); - }); - } - - @Override public String downloadedStream() { - return downloadedStream; - } - - @Override public boolean isMarkDown() { - return isMarkdown; - } - - @Override public void onWorkOffline() { - if (downloadedStream == null) { - manageDisposable(RxHelper.getObservable(ViewerFile.get(url)) - .subscribe(fileModel -> { - if (fileModel != null) { - isImage = MarkDownProvider.isImage(fileModel.getFullUrl()); - if (isImage) { - sendToView(view -> view.onSetImageUrl(fileModel.getFullUrl(), false)); - } else { - downloadedStream = fileModel.getContent(); - isRepo = fileModel.isRepo(); - isMarkdown = fileModel.isMarkdown(); - sendToView(view -> { - if (isRepo || isMarkdown) { - view.onSetMdText(downloadedStream, fileModel.getFullUrl(), false); - } else { - view.onSetCode(downloadedStream); - } - }); - } - } - }, throwable -> sendToView(view -> view.showErrorMessage(throwable.getMessage())))); - } - } - - @Override public void onWorkOnline() { - isImage = MarkDownProvider.isImage(url); - if (isImage) { - if ("svg".equalsIgnoreCase(MimeTypeMap.getFileExtensionFromUrl(url))) { - makeRestCall(RestProvider.getRepoService(isEnterprise()).getFileAsStream(url), - s -> sendToView(view -> view.onSetImageUrl(s, true))); - return; - } - sendToView(view -> view.onSetImageUrl(url, false)); - return; - } - Observable streamObservable = MarkDownProvider.isMarkdown(url) - ? RestProvider.getRepoService(isEnterprise()).getFileAsHtmlStream(url) - : RestProvider.getRepoService(isEnterprise()).getFileAsStream(url); - Observable observable = isRepo ? RestProvider.getRepoService(isEnterprise()).getReadmeHtml(url) : streamObservable; - makeRestCall(observable, content -> { - downloadedStream = content; - ViewerFile fileModel = new ViewerFile(); - fileModel.setContent(downloadedStream); - fileModel.setFullUrl(url); - fileModel.setRepo(isRepo); - if (isRepo) { - fileModel.setMarkdown(true); - isMarkdown = true; - isRepo = true; - sendToView(view -> view.onSetMdText(downloadedStream, htmlUrl == null ? url : htmlUrl, false)); - } else { - isMarkdown = MarkDownProvider.isMarkdown(url); - if (isMarkdown) { - MarkdownModel model = new MarkdownModel(); - model.setText(downloadedStream); - Uri uri = Uri.parse(url); - StringBuilder baseUrl = new StringBuilder(); - for (String s : uri.getPathSegments()) { - if (!s.equalsIgnoreCase(uri.getLastPathSegment())) { - baseUrl.append("/").append(s); - } - } - model.setContext(baseUrl.toString()); - makeRestCall(RestProvider.getRepoService(isEnterprise()).convertReadmeToHtml(model), string -> { - isMarkdown = true; - downloadedStream = string; - fileModel.setMarkdown(true); - fileModel.setContent(downloadedStream); - manageObservable(fileModel.save(fileModel).toObservable()); - sendToView(view -> view.onSetMdText(downloadedStream, htmlUrl == null ? url : htmlUrl, true)); - }); - return; - } - fileModel.setMarkdown(false); - sendToView(view -> view.onSetCode(downloadedStream)); - } - manageObservable(fileModel.save(fileModel).toObservable()); - }); - } - - @Override public boolean isRepo() { - return isRepo; - } - - @Override public boolean isImage() { - return isImage; - } - - @NonNull @Override public String url() { - return url; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/releases/ReleasesListActivity.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/releases/ReleasesListActivity.java deleted file mode 100644 index ef0fbdcfe..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/releases/ReleasesListActivity.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.releases; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.MenuItem; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.NameParser; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.repos.RepoPagerActivity; - -/** - * Created by Kosh on 25 May 2017, 7:13 PM - */ - -public class ReleasesListActivity extends BaseActivity { - - @State String repoId; - @State String login; - - - public static Intent getIntent(@NonNull Context context, @NonNull String username, @NonNull String repoId) { - Intent intent = new Intent(context, ReleasesListActivity.class); - intent.putExtras(Bundler.start().put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, username) - .end()); - return intent; - } - - public static Intent getIntent(@NonNull Context context, @NonNull String username, @NonNull String repoId, - @NonNull String tag, boolean isEnterprise) { - Intent intent = new Intent(context, ReleasesListActivity.class); - intent.putExtras(Bundler.start().put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, username) - .put(BundleConstant.EXTRA_THREE, tag) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .end()); - return intent; - } - - public static Intent getIntent(@NonNull Context context, @NonNull String username, @NonNull String repoId, - long id, boolean isEnterprise) { - Intent intent = new Intent(context, ReleasesListActivity.class); - intent.putExtras(Bundler.start().put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, username) - .put(BundleConstant.EXTRA_TWO, id) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .end()); - return intent; - } - - @Override protected int layout() { - return R.layout.activity_fragment_layout; - } - - @Override protected boolean isTransparent() { - return true; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @NonNull @Override public BasePresenter providePresenter() { - return new BasePresenter(); - } - - @Override protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - if (savedInstanceState == null) { - if (getIntent() == null || getIntent().getExtras() == null) { - finish(); - } else { - Bundle bundle = getIntent().getExtras(); - repoId = bundle.getString(BundleConstant.ID); - login = bundle.getString(BundleConstant.EXTRA); - //noinspection ConstantConditions - getSupportFragmentManager() - .beginTransaction() - .replace(R.id.container, RepoReleasesFragment - .newInstance(repoId, login, bundle.getString(BundleConstant.EXTRA_THREE), - bundle.getLong(BundleConstant.EXTRA_TWO))) - .commit(); - - setTaskName(repoId + "/" + login + " " + getString(R.string.releases)); - } - } - } - - @Override public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == android.R.id.home) { - NameParser parser = new NameParser(""); - parser.setName(repoId); - parser.setUsername(login); - parser.setEnterprise(isEnterprise()); - RepoPagerActivity.startRepoPager(this, parser); - finish(); - return true; - } - return super.onOptionsItemSelected(item); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/releases/RepoReleasesFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/releases/RepoReleasesFragment.java deleted file mode 100644 index 04a003c3c..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/releases/RepoReleasesFragment.java +++ /dev/null @@ -1,200 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.releases; - -import android.app.Activity; -import android.os.Bundle; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import android.view.View; - -import com.annimon.stream.Collectors; -import com.annimon.stream.Stream; -import com.fastaccess.R; -import com.fastaccess.data.dao.SimpleUrlsModel; -import com.fastaccess.data.dao.model.Release; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.ReleasesAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.dialog.ListDialogView; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.ArrayList; -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class RepoReleasesFragment extends BaseFragment implements RepoReleasesMvp.View { - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private ReleasesAdapter adapter; - - public static RepoReleasesFragment newInstance(@NonNull String repoId, @NonNull String login) { - RepoReleasesFragment view = new RepoReleasesFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .end()); - return view; - } - - public static RepoReleasesFragment newInstance(@NonNull String repoId, @NonNull String login, @Nullable String tag, long id) { - RepoReleasesFragment view = new RepoReleasesFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.EXTRA_TWO, id) - .put(BundleConstant.EXTRA_THREE, tag) - .end()); - return view; - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override protected int fragmentLayout() { - return R.layout.small_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new NullPointerException("Bundle is null, therefore, issues can't be proceeded."); - } - stateLayout.setEmptyText(R.string.no_releases); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - recycler.addDivider(); - adapter = new ReleasesAdapter(getPresenter().getReleases()); - adapter.setListener(getPresenter()); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - if (savedInstanceState == null) { - getPresenter().onFragmentCreated(getArguments()); - } else if (getPresenter().getReleases().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public RepoReleasesPresenter providePresenter() { - return new RepoReleasesPresenter(); - } - - @SuppressWarnings("unchecked") @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore(getPresenter()); - } - return onLoadMore; - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @Override public void onDownload(@NonNull Release item) { - ArrayList models = new ArrayList<>(); - if (!InputHelper.isEmpty(item.getZipBallUrl())) { - String url = item.getZipBallUrl(); - models.add(new SimpleUrlsModel(getString(R.string.download_as_zip), url, ".zip")); - } - if (!InputHelper.isEmpty(item.getTarballUrl())) { - String url = item.getTarballUrl(); - models.add(new SimpleUrlsModel(getString(R.string.download_as_tar), url, ".tar.gz")); - } - if (item.getAssets() != null && !item.getAssets().isEmpty()) { - ArrayList mapped = Stream.of(item.getAssets()) - .filter(value -> value != null && value.getBrowserDownloadUrl() != null) - .map(assetsModel -> new SimpleUrlsModel(String.format("%s (%s)", assetsModel.getName(), assetsModel.getDownloadCount()), - assetsModel.getBrowserDownloadUrl())) - .collect(Collectors.toCollection(ArrayList::new)); - if (mapped != null && !mapped.isEmpty()) { - models.addAll(mapped); - } - } - ListDialogView dialogView = new ListDialogView<>(); - dialogView.initArguments(getString(R.string.releases), models); - dialogView.show(getChildFragmentManager(), "ListDialogView"); - } - - @Override public void onShowDetails(@NonNull Release item) { - if (!InputHelper.isEmpty(item.getBody())) { - MessageDialogView.newInstance(!InputHelper.isEmpty(item.getName()) ? item.getName() : item.getTagName(), - item.getBody(), true, false).show(getChildFragmentManager(), MessageDialogView.TAG); - } else { - showErrorMessage(getString(R.string.no_body)); - } - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, null); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onItemSelected(SimpleUrlsModel item) { - Activity activity = getActivity(); - if (activity == null) return; - if (ActivityHelper.checkAndRequestReadWritePermission(activity)) { - RestProvider.downloadFile(activity, item.getUrl(), item.extension); - } - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/releases/RepoReleasesMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/releases/RepoReleasesMvp.java deleted file mode 100644 index 2ddd9bf69..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/releases/RepoReleasesMvp.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.releases; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.SimpleUrlsModel; -import com.fastaccess.data.dao.model.Release; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.dialog.ListDialogView; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -interface RepoReleasesMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, - android.view.View.OnClickListener, ListDialogView.onSimpleItemSelection { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - - void onDownload(@NonNull Release item); - - void onShowDetails(@NonNull Release item); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - void onFragmentCreated(@NonNull Bundle bundle); - - void onWorkOffline(); - - @NonNull ArrayList getReleases(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/code/releases/RepoReleasesPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/code/releases/RepoReleasesPresenter.java deleted file mode 100644 index 9a0770082..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/code/releases/RepoReleasesPresenter.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.fastaccess.ui.modules.repos.code.releases; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.Pageable; -import com.fastaccess.data.dao.model.Release; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class RepoReleasesPresenter extends BasePresenter implements RepoReleasesMvp.Presenter { - private ArrayList releases = new ArrayList<>(); - @com.evernote.android.state.State String login; - @com.evernote.android.state.State String repoId; - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - onWorkOffline(); - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable Object parameter) { - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0) { - sendToView(RepoReleasesMvp.View::hideProgress); - return false; - } - if (repoId == null || login == null) return false; - makeRestCall(RestProvider.getRepoService(isEnterprise()).getReleases(login, repoId, page), - response -> { - if (response.getItems() == null || response.getItems().isEmpty()) { - makeRestCall(RestProvider.getRepoService(isEnterprise()).getTagReleases(login, repoId, page), this::onResponse); - return; - } - onResponse(response); - }); - return true; - - } - - @Override public void onFragmentCreated(@NonNull Bundle bundle) { - repoId = bundle.getString(BundleConstant.ID); - login = bundle.getString(BundleConstant.EXTRA); - String tag = bundle.getString(BundleConstant.EXTRA_THREE); - long id = bundle.getLong(BundleConstant.EXTRA_TWO, -1); - if (!InputHelper.isEmpty(tag)) { - manageObservable(RestProvider.getRepoService(isEnterprise()).getTagRelease(login, repoId, tag) - .doOnNext(release -> { - if (release != null) { - sendToView(view -> view.onShowDetails(release)); - } - })); - } else if (id > 0) { - manageObservable(RestProvider.getRepoService(isEnterprise()).getRelease(login, repoId, id) - .doOnNext(release -> { - if (release != null) { - sendToView(view -> view.onShowDetails(release)); - } - })); - } - if (!InputHelper.isEmpty(login) && !InputHelper.isEmpty(repoId)) { - onCallApi(1, null); - } - } - - @Override public void onWorkOffline() { - if (releases.isEmpty()) { - manageDisposable(RxHelper.getSingle(Release.get(repoId, login)) - .subscribe(releasesModels -> sendToView(view -> view.onNotifyAdapter(releasesModels, 1)))); - } else { - sendToView(RepoReleasesMvp.View::hideProgress); - } - } - - @NonNull @Override public ArrayList getReleases() { - return releases; - } - - @Override public void onItemClick(int position, View v, Release item) { - if (getView() == null) return; - if (v.getId() == R.id.download) { - getView().onDownload(item); - } else { - getView().onShowDetails(item); - } - } - - @Override public void onItemLongClick(int position, View v, Release item) {} - - private void onResponse(Pageable response) { - lastPage = response.getLast(); - if (getCurrentPage() == 1) { - manageDisposable(Release.save(response.getItems(), repoId, login)); - } - sendToView(view -> view.onNotifyAdapter(response.getItems(), getCurrentPage())); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/assignees/AssigneesDialogFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/assignees/AssigneesDialogFragment.java deleted file mode 100644 index 33512af64..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/assignees/AssigneesDialogFragment.java +++ /dev/null @@ -1,178 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.assignees; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.annimon.stream.Collectors; -import com.annimon.stream.Stream; -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.ui.adapter.AssigneesAdapter; -import com.fastaccess.ui.base.BaseDialogFragment; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import butterknife.BindView; -import butterknife.OnClick; - -/** - * Created by Kosh on 22 Feb 2017, 7:23 PM - */ - -public class AssigneesDialogFragment extends BaseDialogFragment implements AssigneesMvp.View { - - @BindView(R.id.title) FontTextView title; - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - @State HashMap selectionMap; - - private AssigneesAdapter adapter; - private AssigneesMvp.SelectedAssigneesListener callback; - - public static AssigneesDialogFragment newInstance(@NonNull String login, @NonNull String repoId, boolean isAssignees) { - AssigneesDialogFragment fragment = new AssigneesDialogFragment(); - fragment.setArguments(Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.EXTRA_TWO, isAssignees) - .end()); - return fragment; - } - - @Override public void onAttach(@NotNull Context context) { - super.onAttach(context); - if (getParentFragment() instanceof AssigneesMvp.SelectedAssigneesListener) { - callback = (AssigneesMvp.SelectedAssigneesListener) getParentFragment(); - } else if (context instanceof AssigneesMvp.SelectedAssigneesListener) { - callback = (AssigneesMvp.SelectedAssigneesListener) context; - } else { - throw new IllegalArgumentException("Parent Fragment or Activity must implement AssigneesMvp.SelectedAssigneesListener"); - } - } - - @Override public void onDetach() { - super.onDetach(); - callback = null; - } - - @Override protected int fragmentLayout() { - return R.layout.simple_footer_list_dialog; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (savedInstanceState == null) { - callApi(); - } - refresh.setOnRefreshListener(this::callApi); - stateLayout.setOnReloadListener(v -> callApi()); - boolean isAssinees = getArguments().getBoolean(BundleConstant.EXTRA_TWO); - stateLayout.setEmptyText(isAssinees ? R.string.no_assignees : R.string.no_reviewers); - recycler.setEmptyView(stateLayout, refresh); - recycler.addKeyLineDivider(); - title.setText(isAssinees ? R.string.assignees : R.string.reviewers); - adapter = new AssigneesAdapter(getPresenter().getList(), this); - recycler.setAdapter(adapter); - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public AssigneesPresenter providePresenter() { - return new AssigneesPresenter(); - } - - @Override public boolean isAssigneeSelected(int position) { - return getSelectionMap().get(position) != null; - } - - @Override public void onToggleSelection(int position, boolean select) { - if (select) { - getSelectionMap().put(position, adapter.getItem(position)); - } else { - getSelectionMap().remove(position); - } - adapter.notifyDataSetChanged(); - } - - @OnClick({R.id.cancel, R.id.ok}) public void onClick(View view) { - switch (view.getId()) { - case R.id.cancel: - dismiss(); - break; - case R.id.ok: - ArrayList labels = Stream.of(selectionMap) - .filter(value -> value.getValue() != null) - .map(Map.Entry::getValue) - .collect(Collectors.toCollection(ArrayList::new)); - callback.onSelectedAssignees(labels != null ? labels : new ArrayList<>(), getArguments().getBoolean(BundleConstant.EXTRA_TWO)); - dismiss(); - break; - } - } - - @Override public void onNotifyAdapter(@Nullable List items) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - adapter.insertItems(items); - } - - @Override public void showProgress(@StringRes int resId) { - stateLayout.showProgress(); - refresh.setRefreshing(true); - } - - @Override public void hideProgress() { - stateLayout.hideProgress(); - refresh.setRefreshing(false); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } - - public HashMap getSelectionMap() { - if (selectionMap == null) { - selectionMap = new LinkedHashMap<>(); - } - return selectionMap; - } - - private void callApi() { - //noinspection ConstantConditions - getPresenter().onCallApi(getArguments().getString(BundleConstant.EXTRA), - getArguments().getString(BundleConstant.ID), - getArguments().getBoolean(BundleConstant.EXTRA_TWO)); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/assignees/AssigneesMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/assignees/AssigneesMvp.java deleted file mode 100644 index 4614e3c81..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/assignees/AssigneesMvp.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.assignees; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.ui.adapter.AssigneesAdapter; -import com.fastaccess.ui.base.mvp.BaseMvp; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 22 Feb 2017, 7:22 PM - */ - -public interface AssigneesMvp { - - interface SelectedAssigneesListener { - void onSelectedAssignees(@NonNull ArrayList users, boolean isAssignees); - } - - interface View extends BaseMvp.FAView, AssigneesAdapter.OnSelectAssignee { - void onNotifyAdapter(@Nullable List items); - } - - interface Presenter { - void onCallApi(@NonNull String login, @NonNull String repo, boolean isAssignees); - - @NonNull ArrayList getList(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/assignees/AssigneesPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/assignees/AssigneesPresenter.java deleted file mode 100644 index 47f5b9744..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/assignees/AssigneesPresenter.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.assignees; - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 05 Mar 2017, 11:52 AM - */ - -class AssigneesPresenter extends BasePresenter implements AssigneesMvp.Presenter { - private ArrayList users = new ArrayList<>(); - - @Override public void onCallApi(@NonNull String login, @NonNull String repo, boolean isAssignees) { - makeRestCall(isAssignees ? RestProvider.getRepoService(isEnterprise()).getAssignees(login, repo) - : RestProvider.getRepoService(isEnterprise()).getCollaborator(login, repo), - response -> sendToView(view -> view.onNotifyAdapter(response != null ? response.getItems() : null))); - } - - @NonNull @Override public ArrayList getList() { - return users; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/branches/BranchesFragment.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/branches/BranchesFragment.kt deleted file mode 100644 index e7211e695..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/branches/BranchesFragment.kt +++ /dev/null @@ -1,120 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.branches - -import android.content.Context -import android.os.Bundle -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout -import android.view.View -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.data.dao.BranchesModel -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.provider.rest.loadmore.OnLoadMore -import com.fastaccess.ui.adapter.BranchesAdapter -import com.fastaccess.ui.base.BaseFragment -import com.fastaccess.ui.modules.repos.extras.branches.pager.BranchesPagerListener -import com.fastaccess.ui.widgets.StateLayout -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller - -/** - * Created by Kosh on 06 Jul 2017, 9:48 PM - */ -class BranchesFragment : BaseFragment(), BranchesMvp.View { - - @BindView(R.id.recycler) lateinit var recycler: DynamicRecyclerView - @BindView(R.id.refresh) lateinit var refresh: SwipeRefreshLayout - @BindView(R.id.stateLayout) lateinit var stateLayout: StateLayout - @BindView(R.id.fastScroller) lateinit var fastScroller: RecyclerViewFastScroller - - private var onLoadMore: OnLoadMore? = null - private var branchCallback: BranchesPagerListener? = null - - private val adapter by lazy { BranchesAdapter(presenter.branches, presenter) } - - override fun onAttach(context: Context) { - super.onAttach(context) - branchCallback = if (parentFragment is BranchesPagerListener) { - parentFragment as BranchesPagerListener - } else context as BranchesPagerListener - } - - override fun onDetach() { - branchCallback = null - super.onDetach() - } - - override fun fragmentLayout(): Int = R.layout.small_grid_refresh_list - - override fun providePresenter(): BranchesPresenter = BranchesPresenter() - - override fun onNotifyAdapter(branches: ArrayList, page: Int) { - hideProgress() - if (page == 1) adapter.insertItems(branches) - else adapter.addItems(branches) - } - - override fun onBranchSelected(item: BranchesModel?) { - branchCallback?.onItemSelect(item!!) - } - - override fun getLoadMore(): OnLoadMore { - if (onLoadMore == null) { - onLoadMore = OnLoadMore(presenter) - } - return onLoadMore!! - } - - override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { - getLoadMore().initialize(presenter.currentPage, presenter.previousTotal) - stateLayout.setEmptyText(R.string.no_branches) - refresh.setOnRefreshListener { presenter.onCallApi(1, null) } - recycler.setEmptyView(stateLayout, refresh) - stateLayout.setOnReloadListener { presenter.onCallApi(1, null) } - recycler.adapter = adapter - recycler.addOnScrollListener(getLoadMore()) - recycler.addDivider() - if (savedInstanceState == null) { - arguments?.let { presenter.onFragmentCreated(it) } - } - fastScroller.attachRecyclerView(recycler) - } - - override fun showProgress(resId: Int) { - refresh.isRefreshing = true - stateLayout.showProgress() - } - - override fun hideProgress() { - refresh.isRefreshing = false - stateLayout.hideProgress() - stateLayout.showReload(adapter.itemCount) - } - - override fun showMessage(titleRes: Int, msgRes: Int) { - hideProgress() - super.showMessage(titleRes, msgRes) - } - - override fun showMessage(titleRes: String, msgRes: String) { - hideProgress() - super.showMessage(titleRes, msgRes) - } - - override fun showErrorMessage(msgRes: String) { - hideProgress() - super.showErrorMessage(msgRes) - } - - companion object { - fun newInstance(login: String, repoId: String, branch: Boolean): BranchesFragment { - val fragment = BranchesFragment() - fragment.arguments = Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.EXTRA_TYPE, branch) - .end() - return fragment - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/branches/BranchesMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/branches/BranchesMvp.kt deleted file mode 100644 index d4c515a43..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/branches/BranchesMvp.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.branches - -import android.os.Bundle -import com.fastaccess.data.dao.BranchesModel -import com.fastaccess.provider.rest.loadmore.OnLoadMore -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created by Kosh on 06 Jul 2017, 9:06 PM - */ -interface BranchesMvp { - - interface View : BaseMvp.FAView { - fun onNotifyAdapter(branches: ArrayList, page: Int) - fun onBranchSelected(item: BranchesModel?) - fun getLoadMore(): OnLoadMore - } - - interface Presenter : BaseViewHolder.OnItemClickListener, BaseMvp.PaginationListener { - fun onFragmentCreated(bundle: Bundle) - } - - interface BranchSelectionListener { - fun onBranchSelected(branch: BranchesModel) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/branches/BranchesPresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/branches/BranchesPresenter.kt deleted file mode 100644 index 91e381929..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/branches/BranchesPresenter.kt +++ /dev/null @@ -1,89 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.branches - -import android.os.Bundle -import android.view.View -import com.fastaccess.data.dao.BranchesModel -import com.fastaccess.data.dao.Pageable -import com.fastaccess.helper.BundleConstant -import com.fastaccess.provider.rest.RestProvider -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import io.reactivex.Observable - -/** - * Created by Kosh on 06 Jul 2017, 9:14 PM - */ -class BranchesPresenter : BasePresenter(), BranchesMvp.Presenter { - private var page: Int = 0 - private var previousTotal: Int = 0 - private var lastPage = Integer.MAX_VALUE - @com.evernote.android.state.State var login: String? = null - @com.evernote.android.state.State var repoId: String? = null - @com.evernote.android.state.State var isBranch: Boolean = true - - var branches = ArrayList() - - - override fun onFragmentCreated(bundle: Bundle) { - login = bundle.getString(BundleConstant.EXTRA) - repoId = bundle.getString(BundleConstant.ID) - isBranch = bundle.getBoolean(BundleConstant.EXTRA_TYPE) - if (branches.isEmpty()) { - onCallApi(1, null) - } - } - - private fun callApi(login: String, repoId: String, page: Int) { - val observable = if (!isBranch) RestProvider.getRepoService(isEnterprise) - .getTags(login, repoId, page) else RestProvider.getRepoService(isEnterprise) - .getBranches(login, repoId, page) - return makeRestCall(observable - .flatMap({ t: Pageable? -> - val list = ArrayList() - if (t != null) { - lastPage = t.last - t.items.onEach { - it.isTag = !isBranch - list.add(it) - } - } - return@flatMap Observable.just(list) - }), { items -> sendToView { v -> v.onNotifyAdapter(items, page) } }) - } - - override fun onItemClick(position: Int, v: View?, item: BranchesModel?) { - sendToView({ it.onBranchSelected(item) }) - } - - override fun onItemLongClick(position: Int, v: View?, item: BranchesModel?) {} - - override fun getCurrentPage(): Int = page - - override fun getPreviousTotal(): Int = previousTotal - - override fun setCurrentPage(page: Int) { - this.page = page - } - - override fun setPreviousTotal(previousTotal: Int) { - this.previousTotal = previousTotal - } - - override fun onCallApi(page: Int, parameter: Boolean?): Boolean { - if (login.isNullOrEmpty() || repoId.isNullOrEmpty()) { - sendToView({ it.hideProgress() }) - return false - } - if (page == 1) { - lastPage = Integer.MAX_VALUE - sendToView({ it.getLoadMore().reset() }) - } - if (page > lastPage || lastPage == 0) { - sendToView({ it.hideProgress() }) - return false - } - currentPage = page - callApi(login!!, repoId!!, page) - return true - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/branches/pager/BranchesPagerFragment.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/branches/pager/BranchesPagerFragment.kt deleted file mode 100644 index 220698b96..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/branches/pager/BranchesPagerFragment.kt +++ /dev/null @@ -1,82 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.branches.pager - -import android.content.Context -import android.os.Bundle -import com.google.android.material.tabs.TabLayout -import androidx.viewpager.widget.ViewPager -import androidx.appcompat.widget.Toolbar -import android.view.View -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.data.dao.BranchesModel -import com.fastaccess.data.dao.FragmentPagerAdapterModel -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.ui.adapter.FragmentsPagerAdapter -import com.fastaccess.ui.base.BaseDialogFragment -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import com.fastaccess.ui.modules.repos.extras.branches.BranchesMvp - -/** - * Created by kosh on 15/07/2017. - */ -class BranchesPagerFragment : BaseDialogFragment>(), BranchesPagerListener { - - @BindView(R.id.pager) lateinit var pager: ViewPager - @BindView(R.id.tabs) lateinit var tabs: TabLayout - @BindView(R.id.toolbar) lateinit var toolbar: Toolbar - - private var branchCallback: BranchesMvp.BranchSelectionListener? = null - - override fun onAttach(context: Context) { - super.onAttach(context) - branchCallback = if (parentFragment is BranchesMvp.BranchSelectionListener) { - parentFragment as BranchesMvp.BranchSelectionListener - } else context as BranchesMvp.BranchSelectionListener - } - - override fun onDetach() { - branchCallback = null - super.onDetach() - } - - override fun onItemSelect(branch: BranchesModel) { - branchCallback?.onBranchSelected(branch) - dismiss() - } - - override fun fragmentLayout(): Int = R.layout.branches_tabbed_viewpager - - override fun providePresenter(): BasePresenter = BasePresenter() - - override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { - toolbar.setNavigationIcon(R.drawable.ic_clear) - toolbar.setNavigationOnClickListener { dismiss() } - toolbar.setTitle(R.string.switch_branch) - tabs.setPadding(0, 0, 0, 0) - tabs.tabMode = TabLayout.MODE_FIXED - arguments?.let { - val login = it.getString(BundleConstant.EXTRA) - val repoId = it.getString(BundleConstant.ID) - if (!login.isNullOrEmpty() && !repoId.isNullOrEmpty()) { - pager.adapter = FragmentsPagerAdapter( - childFragmentManager, FragmentPagerAdapterModel - .buildForBranches(requireContext(), repoId, login) - ) - tabs.setupWithViewPager(pager) - } - } - } - - companion object { - fun newInstance(login: String, repoId: String): BranchesPagerFragment { - val fragment = BranchesPagerFragment() - fragment.arguments = Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .end() - return fragment - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/branches/pager/BranchesPagerListener.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/branches/pager/BranchesPagerListener.kt deleted file mode 100644 index b75f775f2..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/branches/pager/BranchesPagerListener.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.branches.pager - -import com.fastaccess.data.dao.BranchesModel - -/** - * Created by kosh on 15/07/2017. - */ -interface BranchesPagerListener { - fun onItemSelect(branch: BranchesModel) -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/labels/LabelsDialogFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/labels/LabelsDialogFragment.java deleted file mode 100644 index 6e244e8e1..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/labels/LabelsDialogFragment.java +++ /dev/null @@ -1,191 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.labels; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.LabelListModel; -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.LabelsAdapter; -import com.fastaccess.ui.base.BaseDialogFragment; -import com.fastaccess.ui.modules.repos.extras.labels.create.CreateLabelDialogFragment; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; - -import butterknife.BindView; -import butterknife.OnClick; - -/** - * Created by Kosh on 22 Feb 2017, 7:23 PM - */ - -public class LabelsDialogFragment extends BaseDialogFragment implements LabelsMvp.View { - - @BindView(R.id.title) FontTextView title; - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.add) View add; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - @State ArrayList labelModels = new ArrayList<>(); - - private OnLoadMore onLoadMore; - private LabelsAdapter adapter; - private LabelsMvp.SelectedLabelsListener callback; - - public static LabelsDialogFragment newInstance(@Nullable LabelListModel selectedLabels, @NonNull String repo, @NonNull String login) { - LabelsDialogFragment fragment = new LabelsDialogFragment(); - fragment.setArguments(Bundler.start() - .putParcelableArrayList(BundleConstant.EXTRA, selectedLabels) - .put(BundleConstant.EXTRA_TWO, repo) - .put(BundleConstant.EXTRA_THREE, login) - .end()); - return fragment; - } - - @OnClick(R.id.add) void onAddLabel() { - String repo = getArguments().getString(BundleConstant.EXTRA_TWO); - String login = getArguments().getString(BundleConstant.EXTRA_THREE); - if (!InputHelper.isEmpty(repo) && !InputHelper.isEmpty(login)) { - CreateLabelDialogFragment.newInstance(login, repo).show(getChildFragmentManager(), "CreateLabelDialogFragment"); - } - } - - @Override public void onAttach(@NotNull Context context) { - super.onAttach(context); - if (getParentFragment() instanceof LabelsMvp.SelectedLabelsListener) { - callback = (LabelsMvp.SelectedLabelsListener) getParentFragment(); - } else if (context instanceof LabelsMvp.SelectedLabelsListener) { - callback = (LabelsMvp.SelectedLabelsListener) context; - } - } - - @Override public void onDetach() { - super.onDetach(); - callback = null; - } - - @Override protected int fragmentLayout() { - return R.layout.simple_footer_list_dialog; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - stateLayout.setEmptyText(R.string.no_labels); - recycler.setEmptyView(stateLayout, refresh); - refresh.setOnRefreshListener(() -> getPresenter().onCallApi(1, null)); - stateLayout.setOnReloadListener(v -> getPresenter().onCallApi(1, null)); - recycler.addDivider(); - title.setText(R.string.labels); - add.setVisibility(View.VISIBLE); - labelModels = getArguments().getParcelableArrayList(BundleConstant.EXTRA); - if (labelModels == null) { - labelModels = new ArrayList<>(); - } - add.setVisibility(callback == null ? View.GONE : View.VISIBLE); - adapter = new LabelsAdapter(getPresenter().getLabels(), this); - recycler.setAdapter(adapter); - fastScroller.attachRecyclerView(recycler); - recycler.addOnScrollListener(getLoadMore()); - if (getPresenter().getLabels().isEmpty() && !getPresenter().isApiCalled()) { - getPresenter().onCallApi(1, null); - } - } - - @NonNull @Override public LabelsPresenter providePresenter() { - Bundle bundle = getArguments(); - //noinspection ConstantConditions - return new LabelsPresenter(bundle.getString(BundleConstant.EXTRA_THREE), bundle.getString(BundleConstant.EXTRA_TWO)); - } - - @Override public boolean isLabelSelected(LabelModel labelModel) { - return labelModels.indexOf(labelModel) != -1; - } - - @Override public void onToggleSelection(LabelModel labelModel, boolean select) { - if (select) { - labelModels.add(labelModel); - } else { - labelModels.remove(labelModel); - } - adapter.notifyDataSetChanged(); - } - - @SuppressWarnings("unchecked") @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore(getPresenter()); - } - return onLoadMore; - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override public void onLabelAdded(@NonNull LabelModel labelModel) { - adapter.addItem(labelModel, 0); - recycler.scrollToPosition(0); - } - - @OnClick({R.id.cancel, R.id.ok}) public void onClick(View view) { - switch (view.getId()) { - case R.id.cancel: - dismiss(); - break; - case R.id.ok: - if (callback != null) callback.onSelectedLabels(labelModels); - dismiss(); - break; - } - } - - @Override public void showProgress(@StringRes int resId) { - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/labels/LabelsMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/labels/LabelsMvp.java deleted file mode 100644 index 0fa18b378..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/labels/LabelsMvp.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.labels; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.LabelsAdapter; -import com.fastaccess.ui.base.mvp.BaseMvp; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 22 Feb 2017, 7:22 PM - */ - -public interface LabelsMvp { - - interface SelectedLabelsListener { - void onSelectedLabels(@NonNull ArrayList labels); - } - - interface View extends BaseMvp.FAView, LabelsAdapter.OnSelectLabel { - - @NonNull OnLoadMore getLoadMore(); - - void onNotifyAdapter(@Nullable List items, int page); - - void onLabelAdded(@NonNull LabelModel labelModel); - } - - interface Presenter extends BaseMvp.PaginationListener { - - @NonNull ArrayList getLabels(); - - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/labels/LabelsPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/labels/LabelsPresenter.java deleted file mode 100644 index e33d0f282..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/labels/LabelsPresenter.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.labels; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 22 Feb 2017, 7:23 PM - */ - -class LabelsPresenter extends BasePresenter implements LabelsMvp.Presenter { - - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - private ArrayList labels = new ArrayList<>(); - @com.evernote.android.state.State String login; - @com.evernote.android.state.State String repoId; - - LabelsPresenter(@NonNull String login, @NonNull String repoId) { - this.login = login; - this.repoId = repoId; - } - - @NonNull @Override public ArrayList getLabels() { - return labels; - } - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public boolean onCallApi(int page, @Nullable Object parameter) { - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - if (page > lastPage || lastPage == 0) { - sendToView(LabelsMvp.View::hideProgress); - return false; - } - setCurrentPage(page); - makeRestCall(RestProvider.getRepoService(isEnterprise()).getLabels(login, repoId, page), response -> { - lastPage = response.getLast(); - sendToView(view -> view.onNotifyAdapter(response.getItems(), page)); - }); - return true; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/labels/create/CreateLabelDialogFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/labels/create/CreateLabelDialogFragment.java deleted file mode 100644 index 1e6ea4f0e..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/labels/create/CreateLabelDialogFragment.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.labels.create; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.textfield.TextInputLayout; -import androidx.appcompat.widget.Toolbar; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.ui.adapter.LabelColorsAdapter; -import com.fastaccess.ui.base.BaseDialogFragment; -import com.fastaccess.ui.modules.repos.extras.labels.LabelsMvp; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -import butterknife.BindView; - -/** - * Created by Kosh on 02 Apr 2017, 5:38 PM - */ - -public class CreateLabelDialogFragment extends BaseDialogFragment implements CreateLabelMvp.View { - - @BindView(R.id.toolbar) Toolbar toolbar; - @BindView(R.id.name) TextInputLayout name; - @BindView(R.id.description) TextInputLayout description; - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private LabelsMvp.View callback; - - public static CreateLabelDialogFragment newInstance(@NonNull String login, @NonNull String repo) { - CreateLabelDialogFragment fragment = new CreateLabelDialogFragment(); - fragment.setArguments(Bundler.start() - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.ID, repo) - .end()); - return fragment; - } - - @Override public void onAttach(@NotNull Context context) { - super.onAttach(context); - if (getParentFragment() instanceof LabelsMvp.View) { - callback = (LabelsMvp.View) getParentFragment(); - } else if (context instanceof LabelsMvp.View) { - callback = (LabelsMvp.View) context; - } - } - - @Override public void onDetach() { - callback = null; - super.onDetach(); - } - - @Override public void onSuccessfullyCreated(@NonNull LabelModel labelModel1) { - hideProgress(); - if (callback != null) callback.onLabelAdded(labelModel1); - dismiss(); - } - - @Override public void onColorSelected(@NonNull String color) { - description.getEditText().setText(color.replaceFirst("#", "")); - } - - @Override protected int fragmentLayout() { - return R.layout.create_label_layout; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - String login = getArguments().getString(BundleConstant.EXTRA); - String repo = getArguments().getString(BundleConstant.ID); - if (login == null || repo == null) { - return; - } - recycler.setAdapter(new LabelColorsAdapter(Arrays.asList(getResources().getStringArray(R.array.label_colors)), getPresenter())); - recycler.addKeyLineDivider(); - toolbar.setTitle(R.string.create_label); - toolbar.setNavigationIcon(R.drawable.ic_clear); - toolbar.setNavigationOnClickListener(item -> dismiss()); - toolbar.inflateMenu(R.menu.add_menu); - toolbar.getMenu().findItem(R.id.add).setIcon(R.drawable.ic_send); - toolbar.setOnMenuItemClickListener(item -> { - boolean emptyColor = InputHelper.isEmpty(description); - boolean emptyName = InputHelper.isEmpty(name); - description.setError(emptyColor ? getString(R.string.required_field) : null); - name.setError(emptyName ? getString(R.string.required_field) : null); - if (!emptyColor && !emptyName) { - getPresenter().onSubmitLabel(InputHelper.toString(name), InputHelper.toString(description), repo, login); - } - return true; - }); - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public CreateLabelPresenter providePresenter() { - return new CreateLabelPresenter(); - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/labels/create/CreateLabelMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/labels/create/CreateLabelMvp.java deleted file mode 100644 index 37d7ef45c..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/labels/create/CreateLabelMvp.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.labels.create; - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -/** - * Created by Kosh on 02 Apr 2017, 5:30 PM - */ - -public interface CreateLabelMvp { - - interface View extends BaseMvp.FAView { - void onSuccessfullyCreated(@NonNull LabelModel labelModel1); - - void onColorSelected(@NonNull String color); - } - - interface Presenter extends BaseViewHolder.OnItemClickListener { - void onSubmitLabel(@NonNull String name, @NonNull String color, - @NonNull String repo, @NonNull String login); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/labels/create/CreateLabelPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/labels/create/CreateLabelPresenter.java deleted file mode 100644 index 5981e6934..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/labels/create/CreateLabelPresenter.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.labels.create; - -import androidx.annotation.NonNull; -import android.view.View; - -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -/** - * Created by Kosh on 02 Apr 2017, 5:35 PM - */ - -public class CreateLabelPresenter extends BasePresenter implements CreateLabelMvp.Presenter { - - @Override public void onItemClick(int position, View v, String item) { - if (getView() != null) { - getView().onColorSelected(item); - } - } - - @Override public void onItemLongClick(int position, View v, String item) {} - - @Override public void onSubmitLabel(@NonNull String name, @NonNull String color, @NonNull String repo, @NonNull String login) { - LabelModel labelModel = new LabelModel(); - labelModel.setColor(color.replaceAll("#", "")); - labelModel.setName(name); - makeRestCall(RestProvider.getRepoService(isEnterprise()) - .addLabel(login, repo, labelModel), - labelModel1 -> sendToView(view -> view.onSuccessfullyCreated(labelModel1))); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/license/RepoLicenseBottomSheet.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/license/RepoLicenseBottomSheet.kt deleted file mode 100644 index 20ca91365..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/license/RepoLicenseBottomSheet.kt +++ /dev/null @@ -1,114 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.license - -import android.os.Bundle -import android.view.View -import android.widget.ProgressBar -import android.widget.TextView -import androidx.annotation.StringRes -import butterknife.BindView -import com.evernote.android.state.State -import com.fastaccess.R -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.ui.base.BaseMvpBottomSheetDialogFragment -import com.fastaccess.ui.widgets.StateLayout -import com.prettifier.pretty.PrettifyWebView - -/** - * Created by Kosh on 30 Jun 2017, 12:38 PM - */ -class RepoLicenseBottomSheet : BaseMvpBottomSheetDialogFragment(), RepoLicenseMvp.View, - PrettifyWebView.OnContentChangedListener { - - @State var content: String? = null - - - @BindView(R.id.stateLayout) lateinit var stateLayout: StateLayout - @BindView(R.id.readmeLoader) lateinit var loader: ProgressBar - @BindView(R.id.webView) lateinit var webView: PrettifyWebView - @BindView(R.id.licenseName) lateinit var licenseName: TextView - - override fun providePresenter(): RepoLicensePresenter = RepoLicensePresenter() - - override fun onLicenseLoaded(license: String) { - this.content = license - if (license.isNotEmpty()) { - loader.isIndeterminate = false - val licenseText = license.replace( - "

", "
"
-            )
-            webView.setGithubContent("
$licenseText
", null, false) - } else { - hideProgress() - } - } - - override fun fragmentLayout(): Int = R.layout.license_viewer_layout - - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - val login = arguments?.getString(BundleConstant.EXTRA) - val repo = arguments?.getString(BundleConstant.ID) - if (!login.isNullOrEmpty() && !repo.isNullOrEmpty()) { - val licenseTitle = arguments?.getString(BundleConstant.EXTRA_TWO) - licenseName.text = licenseTitle - if (content.isNullOrBlank() && !presenter.isApiCalled) { - presenter.onLoadLicense(login, repo) - } else { - content?.let { onLicenseLoaded(it) } - } - webView.setOnContentChangedListener(this) - } - } - - override fun onContentChanged(progress: Int) { - val loader: ProgressBar? = loader - loader?.let { - it.progress = progress - if (progress == 100) { - it.visibility = View.GONE - hideProgress() - } - } - } - - override fun showProgress(@StringRes resId: Int) { - loader.visibility = View.VISIBLE - loader.isIndeterminate = true - stateLayout.showProgress() - } - - override fun hideProgress() { - loader.visibility = View.GONE - stateLayout.hideProgress() - } - - override fun showErrorMessage(msgRes: String) { - hideProgress() - super.showErrorMessage(msgRes) - } - - override fun showMessage(titleRes: Int, msgRes: Int) { - hideProgress() - super.showMessage(titleRes, msgRes) - } - - override fun showMessage(titleRes: String, msgRes: String) { - hideProgress() - super.showMessage(titleRes, msgRes) - } - - override fun onScrollChanged(reachedTop: Boolean, scroll: Int) {} - - companion object { - fun newInstance(login: String, repo: String, license: String): RepoLicenseBottomSheet { - val view = RepoLicenseBottomSheet() - view.arguments = Bundler.start() - .put(BundleConstant.ID, repo) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.EXTRA_TWO, license) - .end() - return view - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/license/RepoLicenseMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/license/RepoLicenseMvp.kt deleted file mode 100644 index ca3358361..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/license/RepoLicenseMvp.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.license - -import com.fastaccess.ui.base.mvp.BaseMvp - -/** - * Created by Kosh on 30 Jun 2017, 12:32 PM - */ - -interface RepoLicenseMvp { - interface View : BaseMvp.FAView { - fun onLicenseLoaded(license: String) - } - - interface Presenter { - fun onLoadLicense(login: String, repo: String) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/license/RepoLicensePresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/license/RepoLicensePresenter.kt deleted file mode 100644 index 4db1f0ff1..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/license/RepoLicensePresenter.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.license - -import com.fastaccess.provider.rest.RestProvider -import com.fastaccess.ui.base.mvp.presenter.BasePresenter - -/** - * Created by Kosh on 30 Jun 2017, 12:34 PM - */ -class RepoLicensePresenter : BasePresenter(), RepoLicenseMvp.Presenter { - - override fun onLoadLicense(login: String, repo: String) { - makeRestCall(RestProvider.getRepoService(isEnterprise).getLicense(login, repo), - { license -> sendToView { it.onLicenseLoaded(license) } }) - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/locking/LockIssuePrBottomSheetDialog.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/locking/LockIssuePrBottomSheetDialog.kt deleted file mode 100644 index 4ca7ca718..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/locking/LockIssuePrBottomSheetDialog.kt +++ /dev/null @@ -1,46 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.locking - -import android.content.Context -import android.os.Bundle -import android.view.View -import com.fastaccess.R -import com.fastaccess.ui.base.BaseBottomSheetDialog -import kotlinx.android.synthetic.main.lock_issue_pr_dialog.* - -/** - * Created by Kosh on 10.02.18. - */ - -class LockIssuePrBottomSheetDialog : BaseBottomSheetDialog() { - - private var lockIssuePrCallback: LockIssuePrCallback? = null - - override fun onAttach(context: Context) { - super.onAttach(context) - lockIssuePrCallback = when { - parentFragment is LockIssuePrCallback -> parentFragment as LockIssuePrCallback - context is LockIssuePrCallback -> context - else -> null - } - } - - override fun onDetach() { - lockIssuePrCallback = null - super.onDetach() - } - - override fun layoutRes(): Int = R.layout.lock_issue_pr_dialog - - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - cancel.setOnClickListener { dismiss() } - ok.setOnClickListener { - lockIssuePrCallback?.onLock(lockReason.selectedItem as String) - dismiss() - } - } - - companion object { - fun newInstance() = LockIssuePrBottomSheetDialog() - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/locking/LockIssuePrCallback.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/locking/LockIssuePrCallback.kt deleted file mode 100644 index bb088cb35..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/locking/LockIssuePrCallback.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.locking - -/** - * Created by Kosh on 10.02.18. - */ - -interface LockIssuePrCallback { - fun onLock(reason: String) -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/MilestoneDialogFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/MilestoneDialogFragment.java deleted file mode 100644 index 164b9a0ef..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/MilestoneDialogFragment.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.milestone; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import com.google.android.material.appbar.AppBarLayout; -import androidx.appcompat.widget.Toolbar; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.ui.adapter.MilestonesAdapter; -import com.fastaccess.ui.base.BaseDialogFragment; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.repos.extras.milestone.create.CreateMilestoneDialogFragment; -import com.fastaccess.ui.widgets.AppbarRefreshLayout; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 04 Mar 2017, 9:45 PM - */ - -public class MilestoneDialogFragment extends BaseFragment implements MilestoneMvp.View { - public static final String TAG = MilestoneDialogFragment.class.getSimpleName(); - - @BindView(R.id.toolbar) Toolbar toolbar; - @BindView(R.id.appbar) AppBarLayout appbar; - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) AppbarRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private MilestonesAdapter adapter; - private MilestoneMvp.OnMilestoneSelected onMilestoneSelected; - - public static MilestoneDialogFragment newInstance(@NonNull String login, @NonNull String repo) { - MilestoneDialogFragment fragment = new MilestoneDialogFragment(); - fragment.setArguments(Bundler.start() - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.ID, repo) - .end()); - return fragment; - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() != null && getParentFragment() instanceof MilestoneMvp.OnMilestoneSelected) { - onMilestoneSelected = (MilestoneMvp.OnMilestoneSelected) getParentFragment(); - } else if (context instanceof MilestoneMvp.OnMilestoneSelected) { - onMilestoneSelected = (MilestoneMvp.OnMilestoneSelected) context; - } - } - - @Override public void onDetach() { - onMilestoneSelected = null; - super.onDetach(); - } - - @Override public void onNotifyAdapter(@Nullable List items) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - adapter.insertItems(items); - } - - @Override public void onMilestoneSelected(@NonNull MilestoneModel milestoneModel) { - if (onMilestoneSelected != null) onMilestoneSelected.onMilestoneSelected(milestoneModel); - if (getParentFragment() instanceof BaseDialogFragment) { - ((BaseDialogFragment) getParentFragment()).dismiss(); - } - } - - @Override protected int fragmentLayout() { - return R.layout.milestone_dialog_layout; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - return; - } - String login = getArguments().getString(BundleConstant.EXTRA); - String repo = getArguments().getString(BundleConstant.ID); - if (login == null || repo == null) { - return; - } - stateLayout.setEmptyText(R.string.no_milestones); - toolbar.setTitle(R.string.milestone); - toolbar.setOnMenuItemClickListener(item -> onAddMilestone()); - if (onMilestoneSelected != null) toolbar.inflateMenu(R.menu.add_menu); - toolbar.setNavigationIcon(R.drawable.ic_clear); - toolbar.setNavigationOnClickListener(v -> { - if (getParentFragment() instanceof BaseDialogFragment) { - ((BaseDialogFragment) getParentFragment()).dismiss(); - } - }); - recycler.addDivider(); - adapter = new MilestonesAdapter(getPresenter().getMilestones()); - if (onMilestoneSelected != null) adapter.setListener(getPresenter()); - recycler.setEmptyView(stateLayout, refresh); - recycler.setAdapter(adapter); - recycler.addKeyLineDivider(); - if (savedInstanceState == null || (getPresenter().getMilestones().isEmpty() && !getPresenter().isApiCalled())) { - getPresenter().onLoadMilestones(login, repo); - } - stateLayout.setOnReloadListener(v -> getPresenter().onLoadMilestones(login, repo)); - refresh.setOnRefreshListener(() -> getPresenter().onLoadMilestones(login, repo)); - fastScroller.attachRecyclerView(recycler); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public MilestonePresenter providePresenter() { - return new MilestonePresenter(); - } - - @Override public void onMilestoneAdded(@NonNull MilestoneModel milestoneModel) { - adapter.addItem(milestoneModel, 0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } - - private boolean onAddMilestone() { - //noinspection ConstantConditions - CreateMilestoneDialogFragment.newInstance(getArguments().getString(BundleConstant.EXTRA), getArguments().getString(BundleConstant.ID)) - .show(getChildFragmentManager(), CreateMilestoneDialogFragment.TAG); - return true; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/MilestoneMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/MilestoneMvp.java deleted file mode 100644 index e5cd49f96..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/MilestoneMvp.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.milestone; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.repos.extras.milestone.create.CreateMilestoneMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 04 Mar 2017, 9:38 PM - */ - -public interface MilestoneMvp { - - - interface OnMilestoneSelected { - void onMilestoneSelected(@NonNull MilestoneModel milestoneModel); - } - - interface View extends BaseMvp.FAView, CreateMilestoneMvp.OnMilestoneAdded { - void onNotifyAdapter(@Nullable List items); - - void onMilestoneSelected(@NonNull MilestoneModel milestoneModel); - } - - interface Presenter extends BaseViewHolder.OnItemClickListener { - void onLoadMilestones(@NonNull String login, @NonNull String repo); - - @NonNull ArrayList getMilestones(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/MilestonePresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/MilestonePresenter.java deleted file mode 100644 index 992d93272..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/MilestonePresenter.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.milestone; - -import androidx.annotation.NonNull; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 04 Mar 2017, 9:41 PM - */ - -public class MilestonePresenter extends BasePresenter implements MilestoneMvp.Presenter { - private ArrayList milestoneModels = new ArrayList<>(); - - @Override public void onItemClick(int position, View v, MilestoneModel item) { - if (getView() != null) getView().onMilestoneSelected(item); - } - - @Override public void onItemLongClick(int position, View v, MilestoneModel item) {} - - @Override public void onLoadMilestones(@NonNull String login, @NonNull String repo) { - makeRestCall(RestProvider.getRepoService(isEnterprise()).getMilestones(login, repo), - response -> { - if (response == null || response.getItems() == null || response.getItems().isEmpty()) { - sendToView(view -> view.showMessage(R.string.error, R.string.no_milestones)); - return; - } - sendToView(view -> view.onNotifyAdapter(response.getItems())); - }); - } - - @NonNull @Override public ArrayList getMilestones() { - return milestoneModels; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/create/CreateMilestoneDialogFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/create/CreateMilestoneDialogFragment.java deleted file mode 100644 index 3cd9a6bc5..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/create/CreateMilestoneDialogFragment.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.milestone.create; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.textfield.TextInputEditText; -import com.google.android.material.textfield.TextInputLayout; -import androidx.appcompat.widget.Toolbar; -import android.view.MotionEvent; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.datetimepicker.DatePickerFragmentDialog; -import com.fastaccess.datetimepicker.callback.DatePickerCallback; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.ui.base.BaseDialogFragment; - -import org.jetbrains.annotations.NotNull; - -import butterknife.BindView; -import butterknife.OnTouch; - -/** - * Created by Kosh on 04 Mar 2017, 10:40 PM - */ - -public class CreateMilestoneDialogFragment extends BaseDialogFragment - implements CreateMilestoneMvp.View, DatePickerCallback { - - public static final String TAG = CreateMilestoneDialogFragment.class.getSimpleName(); - - @BindView(R.id.toolbar) Toolbar toolbar; - @BindView(R.id.title) TextInputLayout title; - @BindView(R.id.dueOnEditText) TextInputEditText dueOnEditText; - @BindView(R.id.description) TextInputLayout description; - - private CreateMilestoneMvp.OnMilestoneAdded onMilestoneAdded; - - public static CreateMilestoneDialogFragment newInstance(@NonNull String login, @NonNull String repo) { - CreateMilestoneDialogFragment fragment = new CreateMilestoneDialogFragment(); - fragment.setArguments(Bundler.start() - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.ID, repo) - .end()); - return fragment; - } - - @Override public void onAttach(@NotNull Context context) { - super.onAttach(context); - if (getParentFragment() instanceof CreateMilestoneMvp.OnMilestoneAdded) { - onMilestoneAdded = (CreateMilestoneMvp.OnMilestoneAdded) getParentFragment(); - } else { - onMilestoneAdded = (CreateMilestoneMvp.OnMilestoneAdded) context; - } - } - - @Override public void onDetach() { - onMilestoneAdded = null; - super.onDetach(); - } - - @Override protected int fragmentLayout() { - return R.layout.create_milestone_layout; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - String login = getArguments().getString(BundleConstant.EXTRA); - String repo = getArguments().getString(BundleConstant.ID); - if (login == null || repo == null) { - return; - } - toolbar.setTitle(R.string.create_milestone); - toolbar.setNavigationIcon(R.drawable.ic_clear); - toolbar.setNavigationOnClickListener(item -> dismiss()); - toolbar.inflateMenu(R.menu.add_menu); - toolbar.getMenu().findItem(R.id.add).setIcon(R.drawable.ic_send); - toolbar.setOnMenuItemClickListener(item -> { - getPresenter().onSubmit(InputHelper.toString(title), InputHelper.toString(dueOnEditText), InputHelper.toString(description), login, repo); - return true; - }); - } - - @NonNull @Override public CreateMilestonePresenter providePresenter() { - return new CreateMilestonePresenter(); - } - - @OnTouch(R.id.dueOnEditText) boolean onTouch(MotionEvent event) { - if (event.getAction() == MotionEvent.ACTION_UP) { - DatePickerFragmentDialog.newInstance().show(getChildFragmentManager(), "DatePickerFragmentDialog"); - } - return false; - } - - @Override public void onDateSet(long date) { - if (date > 0) { - dueOnEditText.setText(ParseDateFormat.prettifyDate(date)); - } - } - - @Override public void onShowTitleError(boolean isError) { - title.setError(isError ? getString(R.string.required_field) : null); - } - - @Override public void onMilestoneAdded(@NonNull MilestoneModel milestoneModel) { - hideProgress(); - onMilestoneAdded.onMilestoneAdded(milestoneModel); - dismiss(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/create/CreateMilestoneMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/create/CreateMilestoneMvp.java deleted file mode 100644 index 33fdc4b68..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/create/CreateMilestoneMvp.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.milestone.create; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.ui.base.mvp.BaseMvp; - -/** - * Created by Kosh on 04 Mar 2017, 10:47 PM - */ - -public interface CreateMilestoneMvp { - - interface OnMilestoneAdded { - void onMilestoneAdded(@NonNull MilestoneModel milestoneModel); - } - - interface View extends BaseMvp.FAView { - void onShowTitleError(boolean isError); - - void onMilestoneAdded(@NonNull MilestoneModel milestoneModel); - } - - interface Presenter { - void onSubmit(@Nullable String title, @Nullable String dueOn, @Nullable String description, - @NonNull String login, @NonNull String repo); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/create/CreateMilestonePresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/create/CreateMilestonePresenter.java deleted file mode 100644 index b83c9129a..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/create/CreateMilestonePresenter.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.milestone.create; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.R; -import com.fastaccess.data.dao.CreateMilestoneModel; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.Date; - -/** - * Created by Kosh on 04 Mar 2017, 10:49 PM - */ - -public class CreateMilestonePresenter extends BasePresenter implements CreateMilestoneMvp.Presenter { - @Override public void onSubmit(@Nullable String title, @Nullable String dueOn, @Nullable String description, - @NonNull String login, @NonNull String repo) { - if (getView() != null) { - boolean isEmptyTitle = InputHelper.isEmpty(title); - getView().onShowTitleError(isEmptyTitle); - if (!isEmptyTitle) { - CreateMilestoneModel createMilestoneModel = new CreateMilestoneModel(); - createMilestoneModel.setTitle(title); - if (!InputHelper.isEmpty(dueOn)) { - Date date = ParseDateFormat.getDateFromString(dueOn); - if (date != null) createMilestoneModel.setDueOn(ParseDateFormat.toGithubDate(date)); - } - if (!InputHelper.isEmpty(description)) { - createMilestoneModel.setDescription(description); - } - makeRestCall(RestProvider.getRepoService(isEnterprise()).createMilestone(login, repo, createMilestoneModel), - milestoneModel -> { - if (milestoneModel != null) { - sendToView(view -> view.onMilestoneAdded(milestoneModel)); - } else { - sendToView(view -> view.showMessage(R.string.error, R.string.error_creating_milestone)); - } - }); - } - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/create/MilestoneDialogFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/create/MilestoneDialogFragment.java deleted file mode 100644 index 3e1ad55db..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/milestone/create/MilestoneDialogFragment.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.milestone.create; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.ui.base.BaseDialogFragment; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.repos.extras.milestone.MilestoneMvp; -import com.fastaccess.ui.modules.repos.issues.issue.details.IssuePagerMvp; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.PullRequestPagerMvp; - -import net.grandcentrix.thirtyinch.TiPresenter; - -import org.jetbrains.annotations.NotNull; - -/** - * Created by Kosh on 04 Mar 2017, 10:58 PM - */ - -public class MilestoneDialogFragment extends BaseDialogFragment implements MilestoneMvp.OnMilestoneSelected { - - private IssuePagerMvp.View issueCallback; - private PullRequestPagerMvp.View pullRequestCallback; - private MilestoneMvp.OnMilestoneSelected milestoneCallback; - - public static MilestoneDialogFragment newInstance(@NonNull String login, @NonNull String repo) { - MilestoneDialogFragment view = new MilestoneDialogFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.ID, repo) - .end()); - return view; - } - - @Override public void onAttach(@NotNull Context context) { - super.onAttach(context); - if (context instanceof IssuePagerMvp.View) { - issueCallback = (IssuePagerMvp.View) context; - } else if (getParentFragment() instanceof IssuePagerMvp.View) { - issueCallback = (IssuePagerMvp.View) getParentFragment(); - } - if (context instanceof PullRequestPagerMvp.View) { - pullRequestCallback = (PullRequestPagerMvp.View) context; - } else if (getParentFragment() instanceof PullRequestPagerMvp.View) { - pullRequestCallback = (PullRequestPagerMvp.View) getParentFragment(); - } - - if (context instanceof MilestoneMvp.OnMilestoneSelected) { - milestoneCallback = (MilestoneMvp.OnMilestoneSelected) context; - } else if (getParentFragment() instanceof MilestoneMvp.OnMilestoneSelected) { - milestoneCallback = (MilestoneMvp.OnMilestoneSelected) getParentFragment(); - } - } - - @Override public void onDetach() { - super.onDetach(); - } - - @NonNull @Override public TiPresenter providePresenter() { - return new BasePresenter(); - } - - @Override protected int fragmentLayout() { - return R.layout.single_container_layout; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (savedInstanceState == null) { - Bundle bundle = getArguments(); - com.fastaccess.ui.modules.repos.extras.milestone.MilestoneDialogFragment milestoneView = new com.fastaccess.ui.modules.repos.extras - .milestone.MilestoneDialogFragment(); - milestoneView.setArguments(bundle); - getChildFragmentManager() - .beginTransaction() - .replace(R.id.singleContainer, milestoneView, com.fastaccess.ui.modules.repos.extras.milestone.MilestoneDialogFragment.TAG) - .commit(); - } - } - - @Override public void onMilestoneSelected(@NonNull MilestoneModel milestoneModel) { - if (issueCallback != null) issueCallback.onMileStoneSelected(milestoneModel); - if (pullRequestCallback != null) pullRequestCallback.onMileStoneSelected(milestoneModel); - if (milestoneCallback != null) milestoneCallback.onMilestoneSelected(milestoneModel); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/misc/RepoMiscDialogFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/misc/RepoMiscDialogFragment.java deleted file mode 100644 index 2d7096a5b..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/misc/RepoMiscDialogFragment.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.misc; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.fragment.app.FragmentManager; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import androidx.appcompat.widget.Toolbar; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.UsersAdapter; -import com.fastaccess.ui.base.BaseDialogFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 04 May 2017, 8:41 PM - */ - -public class RepoMiscDialogFragment extends BaseDialogFragment implements RepoMiscMVp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - @BindView(R.id.toolbar) Toolbar toolbar; - private OnLoadMore onLoadMore; - private UsersAdapter adapter; - - private static RepoMiscDialogFragment newInstance(@NonNull String owner, @NonNull String repo, @RepoMiscMVp.MiscType int type) { - RepoMiscDialogFragment view = new RepoMiscDialogFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.EXTRA, owner) - .put(BundleConstant.ID, repo) - .put(BundleConstant.EXTRA_TYPE, type) - .end()); - return view; - } - - public static void show(@NonNull FragmentManager fragmentManager, @NonNull String owner, - @NonNull String repo, @RepoMiscMVp.MiscType int type) { - newInstance(owner, repo, type).show(fragmentManager, RepoMiscDialogFragment.class.getName()); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override protected int fragmentLayout() { - return R.layout.milestone_dialog_layout; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new NullPointerException("Bundle is null, username is required"); - } - switch (getPresenter().getType()) { - case RepoMiscMVp.FORKS: - toolbar.setTitle(R.string.forks); - stateLayout.setEmptyText(String.format("%s %s", getString(R.string.no), getString(R.string.forks))); - break; - case RepoMiscMVp.STARS: - toolbar.setTitle(R.string.stars); - stateLayout.setEmptyText(String.format("%s %s", getString(R.string.no), getString(R.string.stars))); - break; - case RepoMiscMVp.WATCHERS: - toolbar.setTitle(R.string.watchers); - stateLayout.setEmptyText(String.format("%s %s", getString(R.string.no), getString(R.string.watchers))); - break; - } - toolbar.setNavigationIcon(R.drawable.ic_clear); - toolbar.setNavigationOnClickListener(v -> dismiss()); - stateLayout.setOnReloadListener(v -> getPresenter().onCallApi(1, null)); - refresh.setOnRefreshListener(() -> getPresenter().onCallApi(1, null)); - recycler.setEmptyView(stateLayout, refresh); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - adapter = new UsersAdapter(getPresenter().getList()); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - recycler.addKeyLineDivider(); - if (getPresenter().getList().isEmpty() && !getPresenter().isApiCalled()) { - getPresenter().onCallApi(1, null); - } - fastScroller.attachRecyclerView(recycler); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter()); - } - return onLoadMore; - } - - @NonNull @Override public RepoMiscPresenter providePresenter() { - return new RepoMiscPresenter(getArguments()); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/misc/RepoMiscMVp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/misc/RepoMiscMVp.java deleted file mode 100644 index b6d9850db..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/misc/RepoMiscMVp.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.misc; - -import androidx.annotation.IntDef; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 04 May 2017, 8:30 PM - */ - -public interface RepoMiscMVp { - - int WATCHERS = 0; - int FORKS = 1; - int STARS = 2; - - @IntDef({ - WATCHERS, - FORKS, - STARS - }) - @Retention(RetentionPolicy.SOURCE) @interface MiscType {} - - - interface View extends BaseMvp.FAView { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - } - - interface Presenter extends BaseMvp.PaginationListener, BaseViewHolder.OnItemClickListener { - - @NonNull ArrayList getList(); - - @MiscType int getType(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/misc/RepoMiscPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/misc/RepoMiscPresenter.java deleted file mode 100644 index e1aa6c585..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/misc/RepoMiscPresenter.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.misc; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.data.dao.Pageable; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 04 May 2017, 8:33 PM - */ - -public class RepoMiscPresenter extends BasePresenter implements RepoMiscMVp.Presenter { - - private ArrayList users = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - @com.evernote.android.state.State String owner; - @com.evernote.android.state.State String repo; - @com.evernote.android.state.State @RepoMiscMVp.MiscType int type; - - RepoMiscPresenter(@Nullable Bundle arguments) { - if (arguments == null) return; - if (InputHelper.isEmpty(owner) || InputHelper.isEmpty(repo)) { - owner = arguments.getString(BundleConstant.EXTRA); - repo = arguments.getString(BundleConstant.ID); - type = arguments.getInt(BundleConstant.EXTRA_TYPE); - onCallApi(1, type); - } - } - - @NonNull @Override public ArrayList getList() { - return users; - } - - @Override public int getType() { - return type; - } - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public boolean onCallApi(int page, @RepoMiscMVp.MiscType @Nullable Integer parameter) { - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0) { - sendToView(RepoMiscMVp.View::hideProgress); - return false; - } - switch (type) { - case RepoMiscMVp.WATCHERS: - makeRestCall(RestProvider.getRepoService(isEnterprise()).getWatchers(owner, repo, page), response -> onResponse(page, response)); - return true; - case RepoMiscMVp.STARS: - makeRestCall(RestProvider.getRepoService(isEnterprise()).getStargazers(owner, repo, page), response -> onResponse(page, response)); - return true; - case RepoMiscMVp.FORKS: - makeRestCall(RestProvider.getRepoService(isEnterprise()).getForks(owner, repo, page) - .flatMap(repoPageable -> { - lastPage = repoPageable.getLast(); - return Observable.fromIterable(repoPageable.getItems()) - .map(Repo::getOwner) - .toList() - .toObservable(); - }), owners -> sendToView(view -> view.onNotifyAdapter(owners, page))); - return true; - } - return false; - } - - private void onResponse(int page, @Nullable Pageable response) { - if (response != null) { - lastPage = response.getLast(); - sendToView(view -> view.onNotifyAdapter(response.getItems(), page)); - } else { - sendToView(BaseMvp.FAView::hideProgress); - } - } - - @Override public void onItemClick(int position, View v, User item) {} - - @Override public void onItemLongClick(int position, View v, User item) {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/popup/IssuePopupFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/popup/IssuePopupFragment.java deleted file mode 100644 index 819401f3b..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/popup/IssuePopupFragment.java +++ /dev/null @@ -1,202 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.popup; - -import android.graphics.Color; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.appbar.AppBarLayout; -import com.google.android.material.floatingactionbutton.FloatingActionButton; -import androidx.fragment.app.FragmentManager; -import androidx.appcompat.widget.Toolbar; -import android.view.View; -import android.widget.LinearLayout; -import android.widget.ProgressBar; - -import com.fastaccess.R; -import com.fastaccess.data.dao.LabelListModel; -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.data.dao.PullsIssuesParser; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.AnimHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.markdown.MarkDownProvider; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.ui.base.BaseMvpBottomSheetDialogFragment; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontEditText; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.LabelSpan; -import com.fastaccess.ui.widgets.SpannableBuilder; - -import java.util.ArrayList; - -import butterknife.BindView; -import butterknife.OnClick; - -/** - * Created by Kosh on 27 May 2017, 12:54 PM - */ - -public class IssuePopupFragment extends BaseMvpBottomSheetDialogFragment - implements IssuePopupMvp.View { - - @BindView(R.id.toolbar) Toolbar toolbar; - @BindView(R.id.appbar) AppBarLayout appbar; - @BindView(R.id.avatarLayout) AvatarLayout avatarLayout; - @BindView(R.id.name) FontTextView name; - @BindView(R.id.body) FontTextView body; - @BindView(R.id.assignee) FontTextView assignee; - @BindView(R.id.assigneeLayout) LinearLayout assigneeLayout; - @BindView(R.id.title) FontTextView title; - @BindView(R.id.labels) FontTextView labels; - @BindView(R.id.labelsLayout) LinearLayout labelsLayout; - @BindView(R.id.milestoneTitle) FontTextView milestoneTitle; - @BindView(R.id.milestoneDescription) FontTextView milestoneDescription; - @BindView(R.id.milestoneLayout) LinearLayout milestoneLayout; - @BindView(R.id.comment) FontEditText comment; - @BindView(R.id.submit) FloatingActionButton submit; - @BindView(R.id.commentSection) LinearLayout commentSection; - @BindView(R.id.progressBar) ProgressBar progressBar; - - public static void showPopup(@NonNull FragmentManager manager, @NonNull Issue issue) { - IssuePopupFragment fragment = new IssuePopupFragment(); - PullsIssuesParser parser = PullsIssuesParser.getForIssue(issue.getHtmlUrl()); - if (parser == null) { - parser = PullsIssuesParser.getForPullRequest(issue.getHtmlUrl()); - } - if (parser == null) return; - fragment.setArguments(getBundle(parser.getLogin(), parser.getRepoId(), issue.getNumber(), issue.getTitle(), issue.getBody(), issue.getUser(), - issue.getAssignee(), issue.getLabels(), issue.getMilestone(), !issue.isLocked())); - fragment.show(manager, ""); - } - - public static void showPopup(@NonNull FragmentManager manager, @NonNull PullRequest pullRequest) { - IssuePopupFragment fragment = new IssuePopupFragment(); - PullsIssuesParser parser = PullsIssuesParser.getForPullRequest(pullRequest.getHtmlUrl()); - if (parser == null) return; - fragment.setArguments(getBundle(parser.getLogin(), parser.getRepoId(), pullRequest.getNumber(), - pullRequest.getTitle(), pullRequest.getBody(), pullRequest.getUser(), - pullRequest.getAssignee(), pullRequest.getLabels(), pullRequest.getMilestone(), !pullRequest.isLocked())); - fragment.show(manager, ""); - } - - @NonNull private static Bundle getBundle(@NonNull String login, @NonNull String repoId, - int number, @NonNull String title, @NonNull String body, - @NonNull User user, @Nullable User assignee, - @Nullable LabelListModel labels, @Nullable MilestoneModel milestone, - boolean canComment) { - return Bundler.start() - .put(BundleConstant.EXTRA_SEVEN, login) - .put(BundleConstant.EXTRA_EIGHT, repoId) - .put(BundleConstant.ID, number) - .put(BundleConstant.EXTRA, title) - .put(BundleConstant.EXTRA_TWO, body) - .put(BundleConstant.EXTRA_THREE, user) - .put(BundleConstant.EXTRA_FOUR, assignee) - .putParcelableArrayList(BundleConstant.EXTRA_FIVE, labels) - .put(BundleConstant.EXTRA_SIX, milestone) - .put(BundleConstant.YES_NO_EXTRA, canComment) - .end(); - } - - @OnClick(R.id.submit) void onSubmit() { - boolean isEmpty = InputHelper.isEmpty(comment); - if (!isEmpty) { - //noinspection ConstantConditions - getPresenter().onSubmit(getArguments().getString(BundleConstant.EXTRA_SEVEN), getArguments().getString(BundleConstant.EXTRA_EIGHT), - getArguments().getInt(BundleConstant.ID), InputHelper.toString(comment)); - } else { - showMessage(R.string.error, R.string.required_field); - } - } - - @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - toolbar.setNavigationIcon(R.drawable.ic_clear); - toolbar.setNavigationOnClickListener(view1 -> dismiss()); - Bundle bundle = getArguments(); - String titleString = bundle.getString(BundleConstant.EXTRA); - String bodyString = bundle.getString(BundleConstant.EXTRA_TWO); - User user = bundle.getParcelable(BundleConstant.EXTRA_THREE); - User assigneeModel = bundle.getParcelable(BundleConstant.EXTRA_FOUR); - ArrayList labelsList = bundle.getParcelableArrayList(BundleConstant.EXTRA_FIVE); - MilestoneModel milestoneModel = bundle.getParcelable(BundleConstant.EXTRA_SIX); - boolean canComment = bundle.getBoolean(BundleConstant.YES_NO_EXTRA); - commentSection.setVisibility(canComment ? View.VISIBLE : View.GONE); - toolbar.setTitle(String.format("#%s", bundle.getInt(BundleConstant.ID))); - title.setText(titleString); - MarkDownProvider.setMdText(body, bodyString); - if (user != null) { - name.setText(user.getLogin()); - avatarLayout.setUrl(user.getAvatarUrl(), user.getLogin(), false, LinkParserHelper.isEnterprise(user.getUrl())); - } - if (assigneeModel == null) { - assigneeLayout.setVisibility(View.GONE); - } else { - assignee.setText(assigneeModel.getLogin()); - } - if (labelsList == null || labelsList.isEmpty()) { - labelsLayout.setVisibility(View.GONE); - } else { - SpannableBuilder builder = SpannableBuilder.builder(); - for (LabelModel label : labelsList) { - int color = Color.parseColor("#" + label.getColor()); - builder.append(" ").append(" " + label.getName() + " ", new LabelSpan(color)); - } - labels.setText(builder); - } - if (milestoneModel == null) { - milestoneLayout.setVisibility(View.GONE); - } else { - milestoneTitle.setText(milestoneModel.getTitle()); - milestoneDescription.setText(milestoneModel.getDescription()); - if (milestoneModel.getDescription() == null) { - milestoneDescription.setVisibility(View.GONE); - } - } - } - - @Override protected int fragmentLayout() { - return R.layout.issue_popup_layout; - } - - @NonNull @Override public IssuePopupPresenter providePresenter() { - return new IssuePopupPresenter(); - } - - @Override public void showMessage(int titleRes, int msgRes) { - hideProgress(); - super.showMessage(titleRes, msgRes); - } - - @Override public void showMessage(@NonNull String titleRes, @NonNull String msgRes) { - hideProgress(); - super.showMessage(titleRes, msgRes); - } - - @Override public void showErrorMessage(@NonNull String msgRes) { - hideProgress(); - super.showErrorMessage(msgRes); - } - - @Override public void showProgress(int resId) { - submit.hide(); - AnimHelper.mimicFabVisibility(true, progressBar, null); - } - - @Override public void hideProgress() { - AnimHelper.mimicFabVisibility(false, progressBar, null); - submit.show(); - } - - @Override public void onSuccessfullySubmitted() { - showMessage(R.string.success, R.string.successfully_submitted); - hideProgress(); - comment.setText(""); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/popup/IssuePopupMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/popup/IssuePopupMvp.java deleted file mode 100644 index 7fd54ea1f..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/popup/IssuePopupMvp.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.popup; - -import androidx.annotation.NonNull; - -import com.fastaccess.ui.base.mvp.BaseMvp; - -/** - * Created by Kosh on 27 May 2017, 1:55 PM - */ - -public interface IssuePopupMvp { - - interface View extends BaseMvp.FAView { - void onSuccessfullySubmitted(); - } - - interface Presenter { - void onSubmit(@NonNull String login, @NonNull String repoId, int issueNumber, @NonNull String text); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/popup/IssuePopupPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/popup/IssuePopupPresenter.java deleted file mode 100644 index c726b254b..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/popup/IssuePopupPresenter.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.fastaccess.ui.modules.repos.extras.popup; - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.CommentRequestModel; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -/** - * Created by Kosh on 27 May 2017, 1:56 PM - */ - -public class IssuePopupPresenter extends BasePresenter implements IssuePopupMvp.Presenter { - - @Override public void onSubmit(@NonNull String login, @NonNull String repoId, int issueNumber, @NonNull String text) { - CommentRequestModel requestModel = new CommentRequestModel(); - requestModel.setBody(text); - makeRestCall(RestProvider.getIssueService(isEnterprise()).createIssueComment(login, repoId, issueNumber, requestModel), - comment -> sendToView(IssuePopupMvp.View::onSuccessfullySubmitted)); - } - - -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/git/EditRepoFileActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/git/EditRepoFileActivity.kt deleted file mode 100644 index 397a5a0a8..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/git/EditRepoFileActivity.kt +++ /dev/null @@ -1,159 +0,0 @@ -package com.fastaccess.ui.modules.repos.git - -import android.annotation.SuppressLint -import android.app.Activity -import android.content.Intent -import android.net.Uri -import android.os.Bundle -import com.google.android.material.textfield.TextInputLayout -import androidx.fragment.app.Fragment -import androidx.fragment.app.FragmentManager -import android.view.Menu -import android.view.MenuItem -import android.view.View -import android.widget.EditText -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.data.dao.EditRepoFileModel -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.provider.emoji.Emoji -import com.fastaccess.ui.base.BaseActivity -import com.fastaccess.ui.widgets.markdown.MarkDownLayout -import com.fastaccess.ui.widgets.markdown.MarkdownEditText - -/** - * Created by kosh on 29/08/2017. - */ -class EditRepoFileActivity : BaseActivity(), EditRepoFileMvp.View { - - @BindView(R.id.markDownLayout) lateinit var markDownLayout: MarkDownLayout - @BindView(R.id.editText) lateinit var editText: MarkdownEditText - @BindView(R.id.description) lateinit var description: TextInputLayout - @BindView(R.id.fileName) lateinit var fileName: TextInputLayout - @BindView(R.id.fileNameHolder) lateinit var fileNameHolder: View - @BindView(R.id.commitHolder) lateinit var commitHolder: View - @BindView(R.id.layoutHolder) lateinit var layoutHolder: View - - - override fun layout(): Int = R.layout.edit_repo_file_layout - - override fun isTransparent(): Boolean = false - - override fun canBack(): Boolean = true - - override fun isSecured(): Boolean = true - - override fun providePresenter(): EditRepoFilePresenter = EditRepoFilePresenter() - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - markDownLayout.markdownListener = this - setToolbarIcon(R.drawable.ic_clear) - if (savedInstanceState == null) { - presenter.onInit(intent) - } - val path = presenter.model?.path - if (!path.isNullOrBlank() && presenter.model?.fileName.isNullOrBlank()) { - val name = Uri.parse(path)?.lastPathSegment - title = name - fileName.editText?.setText(name) - } else if (!presenter.model?.fileName.isNullOrBlank()) { - fileName.editText?.setText(presenter.model?.fileName) - fileName.isEnabled = false - title = presenter.model?.fileName - } - toolbar?.let { - it.subtitle = "${presenter.model?.login}/${presenter.model?.repoId}" - } - } - - override fun onSetText(content: String?) { - hideProgress() - editText.setText(content) - } - - override fun onCreateOptionsMenu(menu: Menu): Boolean { - menuInflater.inflate(R.menu.done_menu, menu) - return super.onCreateOptionsMenu(menu) - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - if (item.itemId == R.id.submit) { - val text = editText.text - if (presenter.fileContent == text.toString() && presenter.model?.fileName == fileName.editText?.text.toString()) { - showErrorMessage(getString(R.string.commit_file_required)) - return true - } - presenter.onSubmit(editText.text?.toString(), fileName.editText?.text?.toString(), description.editText?.text?.toString()) - return true - } - return super.onOptionsItemSelected(item) - } - - override fun onPrepareOptionsMenu(menu: Menu): Boolean { - if (menu.findItem(R.id.submit) != null) { - menu.findItem(R.id.submit).isEnabled = true - } - presenter.model?.isEdit?.let { - menu.findItem(R.id.submit).setIcon(R.drawable.ic_done) - } - return super.onPrepareOptionsMenu(menu) - } - - override fun onAppendLink(title: String?, link: String?, isLink: Boolean) { - markDownLayout.onAppendLink(title, link, isLink) - } - - override fun getEditText(): EditText = editText - - override fun getSavedText(): CharSequence? = editText.savedText - - override fun fragmentManager(): FragmentManager = supportFragmentManager - - @SuppressLint("SetTextI18n") - override fun onEmojiAdded(emoji: Emoji?) { - markDownLayout.onEmojiAdded(emoji) - } - - override fun onSetTextError(isEmpty: Boolean) { - editText.error = if (isEmpty) getString(R.string.required_field) else null - } - - override fun onSetDescriptionError(isEmpty: Boolean) { - description.error = if (isEmpty) getString(R.string.required_field) else null - } - - override fun onSetFilenameError(isEmpty: Boolean) { - fileName.error = if (isEmpty) getString(R.string.required_field) else null - } - - override fun onSuccessfullyCommitted() { - setResult(Activity.RESULT_OK) - finish() - } - - companion object { - const val EDIT_RQ = 2017 - - fun startForResult(activity: Activity, model: EditRepoFileModel, isEnterprise: Boolean) { - val bundle = Bundler.start() - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .put(BundleConstant.ITEM, model) - .end() - val intent = Intent(activity, EditRepoFileActivity::class.java) - intent.putExtras(bundle) - activity.startActivityForResult(intent, EDIT_RQ) - } - - fun startForResult(fragment: Fragment, model: EditRepoFileModel, isEnterprise: Boolean) { - val bundle = Bundler.start() - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .put(BundleConstant.ITEM, model) - .end() - val intent = Intent(fragment.context, EditRepoFileActivity::class.java) - intent.putExtras(bundle) - fragment.startActivityForResult(intent, EDIT_RQ) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/git/EditRepoFileMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/git/EditRepoFileMvp.kt deleted file mode 100644 index 618eedc92..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/git/EditRepoFileMvp.kt +++ /dev/null @@ -1,28 +0,0 @@ -package com.fastaccess.ui.modules.repos.git - -import android.content.Intent -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.modules.editor.emoji.EmojiMvp -import com.fastaccess.ui.modules.editor.popup.EditorLinkImageMvp -import com.fastaccess.ui.widgets.markdown.MarkDownLayout - -/** - * Created by kosh on 29/08/2017. - */ -interface EditRepoFileMvp { - - interface View : BaseMvp.FAView, EditorLinkImageMvp.EditorLinkCallback, - MarkDownLayout.MarkdownListener, EmojiMvp.EmojiCallback { - - fun onSetText(content: String?) - fun onSetTextError(isEmpty: Boolean) - fun onSetDescriptionError(isEmpty: Boolean) - fun onSetFilenameError(isEmpty: Boolean) - fun onSuccessfullyCommitted() - } - - interface Presenter { - fun onInit(intent: Intent?) - fun onSubmit(text: String?, filename: String?, description: String?) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/git/EditRepoFilePresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/git/EditRepoFilePresenter.kt deleted file mode 100644 index 77e4f1af1..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/git/EditRepoFilePresenter.kt +++ /dev/null @@ -1,69 +0,0 @@ -package com.fastaccess.ui.modules.repos.git - -import android.content.Intent -import android.util.Base64 -import com.fastaccess.data.dao.CommitRequestModel -import com.fastaccess.data.dao.EditRepoFileModel -import com.fastaccess.helper.BundleConstant -import com.fastaccess.provider.rest.RestProvider -import com.fastaccess.ui.base.mvp.presenter.BasePresenter - -/** - * Created by kosh on 29/08/2017. - */ -class EditRepoFilePresenter : BasePresenter(), EditRepoFileMvp.Presenter { - - @com.evernote.android.state.State var model: EditRepoFileModel? = null - var fileContent: String? = null - - var downloadedContent: String? = null - - override fun onInit(intent: Intent?) { - if (downloadedContent.isNullOrBlank()) { - intent?.let { - it.extras?.let { - model = it.getParcelable(BundleConstant.ITEM) - loadContent() - } - } - } else { - sendToView { it.onSetText(downloadedContent) } - } - } - - override fun onSubmit(text: String?, filename: String?, description: String?) { - if (model?.login.isNullOrBlank() || model?.repoId.isNullOrBlank()) return - - sendToView { - it.onSetTextError(text.isNullOrBlank()) - it.onSetFilenameError(filename.isNullOrBlank()) - it.onSetDescriptionError(description.isNullOrBlank()) - } - if (!text.isNullOrBlank() && !description.isNullOrBlank() && !filename.isNullOrBlank()) { - model?.let { - val commitModel = CommitRequestModel(description!!, Base64.encodeToString(text!!.toByteArray(), Base64.DEFAULT), it.sha, it.ref) - val observable = RestProvider.getContentService(isEnterprise).updateCreateFile(it.login, it.repoId, - if (it.path.isNullOrBlank()) { - filename!! - } else { - if (it.path!!.endsWith("/")) { - "${it.path}$filename" - } else { - "${it.path}" - } - }, it.ref, commitModel) - makeRestCall(observable, { sendToView { it.onSuccessfullyCommitted() } }) - } - } - } - - private fun loadContent() { - model?.contentUrl?.let { - makeRestCall(RestProvider.getRepoService(isEnterprise) - .getFileAsStream(it), { - fileContent = it - sendToView({ v -> v.onSetText(it) }) - }) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/git/delete/DeleteContentFileCallback.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/git/delete/DeleteContentFileCallback.kt deleted file mode 100644 index 9713a6472..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/git/delete/DeleteContentFileCallback.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.fastaccess.ui.modules.repos.git.delete - -/** - * Created by Hashemsergani on 02/09/2017. - */ -interface DeleteContentFileCallback { - - fun onDelete(message: String, position: Int) -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/git/delete/DeleteFileBottomSheetFragment.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/git/delete/DeleteFileBottomSheetFragment.kt deleted file mode 100644 index 1a95b3d3d..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/git/delete/DeleteFileBottomSheetFragment.kt +++ /dev/null @@ -1,72 +0,0 @@ -package com.fastaccess.ui.modules.repos.git.delete - -import android.content.Context -import android.os.Bundle -import com.google.android.material.textfield.TextInputLayout -import android.view.View -import butterknife.BindView -import butterknife.OnClick -import com.fastaccess.R -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.helper.InputHelper -import com.fastaccess.ui.base.BaseBottomSheetDialog - -/** - * Created by Hashemsergani on 02/09/2017. - */ -class DeleteFileBottomSheetFragment : BaseBottomSheetDialog() { - - @BindView(R.id.description) lateinit var description: TextInputLayout - @BindView(R.id.fileName) lateinit var fileName: TextInputLayout - - private var deleteCallback: DeleteContentFileCallback? = null - - - @OnClick(R.id.delete) fun onDeleteClicked() { - description.error = if (InputHelper.isEmpty(description)) getString(R.string.required_field) else null - if (!InputHelper.isEmpty(description)) { - val position = arguments?.getInt(BundleConstant.EXTRA) - position?.let { - deleteCallback?.onDelete(InputHelper.toString(description), position) - } - dismiss() - } - } - - @OnClick(R.id.cancel) - fun onCancel() = dismiss() - - override fun onAttach(context: Context) { - super.onAttach(context) - if (parentFragment is DeleteContentFileCallback) { - deleteCallback = parentFragment as DeleteContentFileCallback - } else if (context is DeleteContentFileCallback) { - deleteCallback = context - } - } - - override fun onDetach() { - deleteCallback = null - super.onDetach() - } - - override fun layoutRes(): Int = R.layout.delete_repo_file_layout - - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - fileName.isEnabled = false - fileName.editText?.setText(arguments?.getString(BundleConstant.ITEM)) - } - - companion object { - fun newInstance(position: Int, path: String): DeleteFileBottomSheetFragment { - val fragment = DeleteFileBottomSheetFragment() - fragment.arguments = Bundler.start() - .put(BundleConstant.EXTRA, position) - .put(BundleConstant.ITEM, path) - .end() - return fragment - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/RepoIssuesPagerFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/issues/RepoIssuesPagerFragment.java deleted file mode 100644 index 42d842be0..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/RepoIssuesPagerFragment.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.fastaccess.ui.modules.repos.issues; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.tabs.TabLayout; -import androidx.fragment.app.Fragment; -import android.view.View; -import android.widget.TextView; - -import com.annimon.stream.Stream; -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.FragmentPagerAdapterModel; -import com.fastaccess.data.dao.TabsCountStateModel; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.ui.adapter.FragmentsPagerAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; -import com.fastaccess.ui.modules.repos.issues.issue.RepoClosedIssuesFragment; -import com.fastaccess.ui.modules.repos.issues.issue.RepoOpenedIssuesFragment; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.ViewPagerView; - -import java.util.HashSet; - -import butterknife.BindView; - -/** - * Created by Kosh on 31 Dec 2016, 1:36 AM - */ - -public class RepoIssuesPagerFragment extends BaseFragment implements RepoIssuesPagerMvp.View { - - public static final String TAG = RepoIssuesPagerFragment.class.getSimpleName(); - @BindView(R.id.tabs) TabLayout tabs; - @BindView(R.id.pager) ViewPagerView pager; - @State HashSet counts = new HashSet<>(); - private RepoPagerMvp.View repoCallback; - - public static RepoIssuesPagerFragment newInstance(@NonNull String repoId, @NonNull String login) { - RepoIssuesPagerFragment view = new RepoIssuesPagerFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .end()); - return view; - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() instanceof RepoPagerMvp.View) { - repoCallback = (RepoPagerMvp.View) getParentFragment(); - } else if (context instanceof RepoPagerMvp.View) { - repoCallback = (RepoPagerMvp.View) context; - } - } - - @Override public void onDetach() { - repoCallback = null; - super.onDetach(); - } - - @Override protected int fragmentLayout() { - return R.layout.centered_tabbed_viewpager; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - String repoId = getArguments().getString(BundleConstant.ID); - String login = getArguments().getString(BundleConstant.EXTRA); - if (login == null || repoId == null) throw new NullPointerException("repoId || login is null???"); - pager.setAdapter(new FragmentsPagerAdapter(getChildFragmentManager(), - FragmentPagerAdapterModel.buildForRepoIssue(getContext(), login, repoId))); - tabs.setupWithViewPager(pager); - if (savedInstanceState != null && !counts.isEmpty()) { - Stream.of(counts).forEach(this::updateCount); - } - tabs.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(pager) { - @Override public void onTabReselected(TabLayout.Tab tab) { - super.onTabReselected(tab); - onScrollTop(tab.getPosition()); - } - }); - } - - @NonNull @Override public RepoIssuesPagerPresenter providePresenter() { - return new RepoIssuesPagerPresenter(); - } - - @Override public void onAddIssue() { - if (pager.getCurrentItem() != 0) pager.setCurrentItem(0); - RepoOpenedIssuesFragment repoOpenedIssuesView = (RepoOpenedIssuesFragment) pager.getAdapter().instantiateItem(pager, 0); - repoOpenedIssuesView.onAddIssue(); - } - - @Override public void setCurrentItem(int index, boolean refresh) { - if (pager == null || pager.getAdapter() == null) return; - if (!refresh) pager.setCurrentItem(index, true); - if (index == 1 && refresh) { - RepoClosedIssuesFragment closedIssues = (RepoClosedIssuesFragment) pager.getAdapter().instantiateItem(pager, 1); - if (closedIssues != null) closedIssues.onRefresh(); - } else if (index == 0 && refresh) { - RepoOpenedIssuesFragment openedIssues = (RepoOpenedIssuesFragment) pager.getAdapter().instantiateItem(pager, 0); - if (openedIssues != null) openedIssues.onRefresh(); - } - } - - @Override public int getCurrentItem() { - return pager != null ? pager.getCurrentItem() : 0; - } - - @Override public void onScrolled(boolean isUp) { - if (repoCallback != null) repoCallback.onScrolled(isUp); - } - - @Override public void onSetBadge(int tabIndex, int count) { - TabsCountStateModel model = new TabsCountStateModel(); - model.setTabIndex(tabIndex); - model.setCount(count); - counts.add(model); - if (tabs != null) { - updateCount(model); - } - } - - @Override public void onChangeIssueSort(boolean isLastUpdated) { - if (pager == null || pager.getAdapter() == null) return; - RepoClosedIssuesFragment closedIssues = (RepoClosedIssuesFragment) pager.getAdapter().instantiateItem(pager, 1); - if (closedIssues != null) closedIssues.onRefresh(isLastUpdated); - RepoOpenedIssuesFragment openedIssues = (RepoOpenedIssuesFragment) pager.getAdapter().instantiateItem(pager, 0); - if (openedIssues != null) openedIssues.onRefresh(isLastUpdated); - } - - @Override public void onScrollTop(int index) { - if (pager == null || pager.getAdapter() == null) return; - Fragment fragment = (BaseFragment) pager.getAdapter().instantiateItem(pager, index); - if (fragment instanceof BaseFragment) { - ((BaseFragment) fragment).onScrollTop(index); - } - } - - private void updateCount(@NonNull TabsCountStateModel model) { - TextView tv = ViewHelper.getTabTextView(tabs, model.getTabIndex()); - tv.setText(SpannableBuilder.builder() - .append(model.getTabIndex() == 0 ? getString(R.string.opened) : getString(R.string.closed)) - .append(" ") - .append("(") - .bold(String.valueOf(model.getCount())) - .append(")")); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/RepoIssuesPagerMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/issues/RepoIssuesPagerMvp.java deleted file mode 100644 index f03110157..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/RepoIssuesPagerMvp.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.fastaccess.ui.modules.repos.issues; - -import androidx.annotation.IntRange; - -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; - -/** - * Created by Kosh on 31 Dec 2016, 1:35 AM - */ - -public interface RepoIssuesPagerMvp { - - interface View extends BaseMvp.FAView, RepoPagerMvp.TabsBadgeListener { - void onAddIssue(); - - void setCurrentItem(int index, boolean refresh); - - void onChangeIssueSort(boolean isLastUpdated); - - @IntRange(from = 0, to = 1) int getCurrentItem(); - - void onScrolled(boolean isUp); - } - - interface Presenter extends BaseMvp.FAPresenter {} - -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/RepoIssuesPagerPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/issues/RepoIssuesPagerPresenter.java deleted file mode 100644 index e5683fb23..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/RepoIssuesPagerPresenter.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fastaccess.ui.modules.repos.issues; - -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -/** - * Created by Kosh on 31 Dec 2016, 1:36 AM - */ - -class RepoIssuesPagerPresenter extends BasePresenter implements RepoIssuesPagerMvp.Presenter {} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/create/CreateIssueActivity.java b/app/src/main/java/com/fastaccess/ui/modules/repos/issues/create/CreateIssueActivity.java deleted file mode 100644 index 4fc2a5eab..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/create/CreateIssueActivity.java +++ /dev/null @@ -1,417 +0,0 @@ -package com.fastaccess.ui.modules.repos.issues.create; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.graphics.Color; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.textfield.TextInputLayout; -import androidx.transition.TransitionManager; -import androidx.fragment.app.Fragment; -import androidx.appcompat.app.AlertDialog; -import android.view.MotionEvent; -import android.view.View; -import android.widget.LinearLayout; -import android.widget.Toast; - -import com.danielstone.materialaboutlibrary.ConvenienceBuilder; -import com.evernote.android.state.State; -import com.fastaccess.App; -import com.fastaccess.BuildConfig; -import com.fastaccess.R; -import com.fastaccess.data.dao.LabelListModel; -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.Logger; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.provider.markdown.MarkDownProvider; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.modules.editor.EditorActivity; -import com.fastaccess.ui.modules.repos.extras.assignees.AssigneesDialogFragment; -import com.fastaccess.ui.modules.repos.extras.labels.LabelsDialogFragment; -import com.fastaccess.ui.modules.repos.extras.milestone.create.MilestoneDialogFragment; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.LabelSpan; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; - -import java.util.ArrayList; - -import butterknife.BindView; -import butterknife.OnClick; -import butterknife.OnTouch; -import es.dmoral.toasty.Toasty; - -/** - * Created by Kosh on 19 Feb 2017, 12:33 PM - */ - -public class CreateIssueActivity extends BaseActivity implements CreateIssueMvp.View { - - @BindView(R.id.title) TextInputLayout title; - @BindView(R.id.description) FontTextView description; - @BindView(R.id.submit) View submit; - @BindView(R.id.issueMiscLayout) LinearLayout issueMiscLayout; - @BindView(R.id.assignee) FontTextView assignee; - @BindView(R.id.labels) FontTextView labels; - @BindView(R.id.milestoneTitle) FontTextView milestoneTitle; - @BindView(R.id.milestoneDescription) FontTextView milestoneDescription; - - @State String repoId; - @State String login; - @State Issue issue; - @State PullRequest pullRequest; - @State boolean isFeedback; - @State ArrayList labelModels = new ArrayList<>(); - @State MilestoneModel milestoneModel; - @State ArrayList users = new ArrayList<>(); - - private AlertDialog alertDialog; - private CharSequence savedText; - - public static void startForResult(@NonNull Fragment fragment, @NonNull String login, @NonNull String repoId, boolean isEnterprise) { - Intent intent = new Intent(fragment.getContext(), CreateIssueActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA_TWO, login.equalsIgnoreCase("k0shk0sh") && repoId.equalsIgnoreCase("FastHub")) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .end()); - View view = fragment.getActivity() != null ? fragment.getActivity().findViewById(R.id.fab) : null; - if (view != null) { - ActivityHelper.startReveal(fragment, intent, view, BundleConstant.REQUEST_CODE); - } else { - fragment.startActivityForResult(intent, BundleConstant.REQUEST_CODE); - } - } - - - public static void startForResult(@NonNull Activity activity, @NonNull String login, @NonNull String repoId, - @Nullable Issue issueModel, boolean isEnterprise) { - if (issueModel != null) { - Intent intent = new Intent(activity, CreateIssueActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.ID, repoId) - .put(BundleConstant.ITEM, issueModel) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .end()); - View view = activity.findViewById(R.id.fab); - if (view != null) { - startForResult(activity, intent, view); - } else { - activity.startActivityForResult(intent, BundleConstant.REQUEST_CODE); - } - } - } - - public static void startForResult(@NonNull Activity activity, @NonNull String login, @NonNull String repoId, - @Nullable PullRequest pullRequestModel, boolean isEnterprise) { - if (pullRequestModel != null) { - Intent intent = new Intent(activity, CreateIssueActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.ID, repoId) - .put(BundleConstant.ITEM, pullRequestModel) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .end()); - View view = activity.findViewById(R.id.fab); - if (view != null) { - startForResult(activity, intent, view); - } else { - activity.startActivityForResult(intent, BundleConstant.REQUEST_CODE); - } - } - } - - @NonNull public static Intent getIntent(@NonNull Context context, @NonNull String login, @NonNull String repoId, boolean isFeedback) { - Intent intent = new Intent(context, CreateIssueActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA_TWO, isFeedback) - .end()); - return intent; - } - - @NonNull public static Intent startForResult(@NonNull Activity activity) { - String login = "k0shk0sh"; // FIXME: 23/02/2017 hardcoded - String repoId = "FastHub";// FIXME: 23/02/2017 hardcoded - Intent intent = new Intent(activity, CreateIssueActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA_TWO, true) - .end()); - return intent; - } - - public static void startForResult(@NonNull Activity activity, @NonNull Intent intent, @NonNull View view) { - ActivityHelper.startReveal(activity, intent, view, BundleConstant.REQUEST_CODE); - } - - @Override public void onSetCode(@NonNull CharSequence charSequence) { - this.savedText = charSequence; - MarkDownProvider.setMdText(description, InputHelper.toString(savedText)); - } - - @Override public void onTitleError(boolean isEmptyTitle) { - title.setError(isEmptyTitle ? getString(R.string.required_field) : null); - } - - @Override public void onDescriptionError(boolean isEmptyDesc) { - description.setError(isEmptyDesc ? getString(R.string.required_field) : null); - } - - @Override public void onSuccessSubmission(Issue issueModel) { - hideProgress(); - Intent intent = new Intent(); - intent.putExtras(Bundler.start() - .put(BundleConstant.ITEM, issueModel) - .end()); - setResult(RESULT_OK, intent); - finish(); - showMessage(R.string.success, R.string.successfully_submitted); - } - - @Override public void onSuccessSubmission(PullRequest issueModel) { - hideProgress(); - Intent intent = new Intent(); - intent.putExtras(Bundler.start() - .put(BundleConstant.ITEM, issueModel) - .end()); - setResult(RESULT_OK, intent); - finish(); - showMessage(R.string.success, R.string.successfully_submitted); - } - - @Override public void onShowUpdate() { - hideProgress(); - Toasty.error(App.getInstance(), getString(R.string.new_version)).show(); - ConvenienceBuilder.createRateOnClickAction(this).onClick(); - finish(); - } - - @Override public void onShowIssueMisc() { - TransitionManager.beginDelayedTransition(findViewById(R.id.parent)); - issueMiscLayout.setVisibility(getPresenter().isCollaborator() ? View.VISIBLE : View.GONE); - //TODO - } - - @NonNull @Override public CreateIssuePresenter providePresenter() { - return new CreateIssuePresenter(); - } - - @Override protected int layout() { - return R.layout.create_issue_layout; - } - - @Override protected boolean isTransparent() { - return false; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - if (savedInstanceState == null) { - Bundle bundle = getIntent().getExtras(); - login = bundle.getString(BundleConstant.EXTRA); - repoId = bundle.getString(BundleConstant.ID); - isFeedback = bundle.getBoolean(BundleConstant.EXTRA_TWO); - if (bundle.getParcelable(BundleConstant.ITEM) != null) { - if (bundle.getParcelable(BundleConstant.ITEM) instanceof Issue) { - issue = bundle.getParcelable(BundleConstant.ITEM); - setTitle(getString(R.string.update_issue)); - } else if (bundle.getParcelable(BundleConstant.ITEM) instanceof PullRequest) { - pullRequest = bundle.getParcelable(BundleConstant.ITEM); - setTitle(getString(R.string.update_pull_request)); - } - } - if (issue != null) { - Logger.e(issue.getLabels(), issue.getMilestone(), issue.getAssignees()); - if (issue.getLabels() != null) { - onSelectedLabels(new ArrayList<>(issue.getLabels())); - } - if (issue.getAssignees() != null) { - onSelectedAssignees(new ArrayList<>(issue.getAssignees()), false); - } - if (issue.getMilestone() != null) { - milestoneModel = issue.getMilestone(); - onMilestoneSelected(milestoneModel); - } - if (!InputHelper.isEmpty(issue.getTitle())) { - if (title.getEditText() != null) title.getEditText().setText(issue.getTitle()); - } - if (!InputHelper.isEmpty(issue.getBody())) { - onSetCode(issue.getBody()); - } - } - if (pullRequest != null) { - if (pullRequest.getLabels() != null) { - onSelectedLabels(new ArrayList<>(pullRequest.getLabels())); - } - if (pullRequest.getAssignees() != null) { - users.addAll(pullRequest.getAssignees()); - onSelectedAssignees(new ArrayList<>(pullRequest.getAssignees()), false); - } - if (pullRequest.getMilestone() != null) { - milestoneModel = pullRequest.getMilestone(); - onMilestoneSelected(milestoneModel); - } - if (!InputHelper.isEmpty(pullRequest.getTitle())) { - if (title.getEditText() != null) title.getEditText().setText(pullRequest.getTitle()); - } - if (!InputHelper.isEmpty(pullRequest.getBody())) { - onSetCode(pullRequest.getBody()); - } - } - } - getPresenter().checkAuthority(login, repoId); - if (isFeedback || ("k0shk0sh".equalsIgnoreCase(login) && repoId.equalsIgnoreCase("FastHub"))) { - Toasty.info(App.getInstance(), getString(R.string.report_issue_warning), Toast.LENGTH_LONG).show(); - setTitle(R.string.submit_feedback); - getPresenter().onCheckAppVersion(); - } - if (BuildConfig.DEBUG && isFeedback) { - alertDialog = new AlertDialog.Builder(this) - .setTitle("You are currently using a debug build") - .setMessage("If you have found a bug, please report it on slack." + "\n" + - "Feature requests can be submitted here." + "\n" + "Happy Testing") - .setPositiveButton(android.R.string.ok, null) - .show(); - } - if (toolbar != null) toolbar.setSubtitle(login + "/" + repoId); - setTaskName(login + "/" + repoId + " - " + (isFeedback ? getString(R.string.submit_feedback) : getString(R.string.create_issue))); - } - - @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - AppHelper.hideKeyboard(title); - getPresenter().onActivityForResult(resultCode, requestCode, data); - } - - @Override public void onBackPressed() { - if (InputHelper.isEmpty(title)) { - super.onBackPressed(); - } else { - ViewHelper.hideKeyboard(title); - MessageDialogView.newInstance(getString(R.string.close), getString(R.string.unsaved_data_warning), - Bundler.start().put("primary_extra", getString(R.string.discard)).put("secondary_extra", getString(R.string.cancel)) - .put(BundleConstant.EXTRA, true).end()).show(getSupportFragmentManager(), MessageDialogView.TAG); - } - } - - @Override protected void onDestroy() { - if (alertDialog != null && alertDialog.isShowing()) { - alertDialog.dismiss(); - } - super.onDestroy(); - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (isOk && bundle != null) { - finish(); - } - } - - @OnTouch(R.id.description) boolean onTouch(MotionEvent event) { - if (isFeedback && InputHelper.isEmpty(savedText)) { - savedText = AppHelper.getFastHubIssueTemplate(isEnterprise()); - } - if (event.getAction() == MotionEvent.ACTION_UP) { - Intent intent = new Intent(this, EditorActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA, InputHelper.toString(savedText)) - .put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraType.FOR_RESULT_EXTRA) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise()) - .end()); - ActivityHelper.startReveal(this, intent, submit, BundleConstant.REQUEST_CODE); - return true; - } - return false; - } - - @OnClick(R.id.submit) public void onClick() { - getPresenter().onSubmit(InputHelper.toString(title), savedText, login, repoId, issue, pullRequest, labelModels, milestoneModel, users); - } - - @OnClick({R.id.addAssignee, R.id.addLabels, R.id.addMilestone}) public void onViewClicked(View view) { - switch (view.getId()) { - case R.id.addAssignee: - AssigneesDialogFragment.newInstance(login, repoId, false) - .show(getSupportFragmentManager(), "AssigneesDialogFragment"); - break; - case R.id.addLabels: - LabelListModel labelModels = new LabelListModel(); - labelModels.addAll(this.labelModels); - LabelsDialogFragment.newInstance(labelModels, repoId, login) - .show(getSupportFragmentManager(), "LabelsDialogFragment"); - break; - case R.id.addMilestone: - MilestoneDialogFragment.newInstance(login, repoId) - .show(getSupportFragmentManager(), "MilestoneDialogFragment"); - break; - } - } - - @Override public void onSelectedLabels(@NonNull ArrayList labelModels) { - this.labelModels.clear(); - this.labelModels.addAll(labelModels); - SpannableBuilder builder = SpannableBuilder.builder(); - for (int i = 0; i < labelModels.size(); i++) { - LabelModel labelModel = labelModels.get(i); - int color = Color.parseColor("#" + labelModel.getColor()); - if (i > 0) { - builder.append(" ").append(" " + labelModel.getName() + " ", new LabelSpan(color)); - } else { - builder.append(labelModel.getName() + " ", new LabelSpan(color)); - } - } - this.labels.setText(builder); - } - - @Override public void onMilestoneSelected(@NonNull MilestoneModel milestoneModel) { - Logger.e(milestoneModel.getTitle(), milestoneModel.getDescription(), milestoneModel.getNumber()); - this.milestoneModel = milestoneModel; - milestoneTitle.setText(milestoneModel.getTitle()); - if (!InputHelper.isEmpty(milestoneModel.getDescription())) { - milestoneDescription.setText(milestoneModel.getDescription()); - milestoneDescription.setVisibility(View.VISIBLE); - } else { - milestoneDescription.setText(""); - milestoneDescription.setVisibility(View.GONE); - } - } - - @Override public void onSelectedAssignees(@NonNull ArrayList users, boolean isAssignees) { - this.users.clear(); - this.users.addAll(users); - SpannableBuilder builder = SpannableBuilder.builder(); - for (int i = 0; i < users.size(); i++) { - User user = users.get(i); - builder.append(user.getLogin()); - if (i != users.size() - 1) { - builder.append(", "); - } - } - assignee.setText(builder); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/create/CreateIssueMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/issues/create/CreateIssueMvp.java deleted file mode 100644 index beef1a0a4..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/create/CreateIssueMvp.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.fastaccess.ui.modules.repos.issues.create; - -import android.content.Intent; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.repos.extras.assignees.AssigneesMvp; -import com.fastaccess.ui.modules.repos.extras.labels.LabelsMvp; -import com.fastaccess.ui.modules.repos.extras.milestone.MilestoneMvp; - -import java.util.ArrayList; - -/** - * Created by Kosh on 19 Feb 2017, 12:12 PM - */ - -public interface CreateIssueMvp { - - interface View extends BaseMvp.FAView, LabelsMvp.SelectedLabelsListener, AssigneesMvp.SelectedAssigneesListener, - MilestoneMvp.OnMilestoneSelected { - void onSetCode(@NonNull CharSequence charSequence); - - void onTitleError(boolean isEmptyTitle); - - void onDescriptionError(boolean isEmptyDesc); - - void onSuccessSubmission(Issue issueModel); - - void onSuccessSubmission(PullRequest issueModel); - - void onShowUpdate(); - - void onShowIssueMisc(); - } - - interface Presenter extends BaseMvp.FAPresenter { - - void checkAuthority(@NonNull String login, @NonNull String repoId); - - void onActivityForResult(int resultCode, int requestCode, Intent intent); - - void onSubmit(@NonNull String title, @NonNull CharSequence description, @NonNull String login, - @NonNull String repo, @Nullable Issue issueModel, @Nullable PullRequest pullRequestModel, - @Nullable ArrayList labels, @Nullable MilestoneModel milestoneModel, - @Nullable ArrayList users); - - void onCheckAppVersion(); - - boolean isCollaborator(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/create/CreateIssuePresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/issues/create/CreateIssuePresenter.java deleted file mode 100644 index df511abe9..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/create/CreateIssuePresenter.java +++ /dev/null @@ -1,179 +0,0 @@ -package com.fastaccess.ui.modules.repos.issues.create; - -import android.app.Activity; -import android.content.Intent; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.annimon.stream.Collectors; -import com.annimon.stream.Stream; -import com.fastaccess.BuildConfig; -import com.fastaccess.R; -import com.fastaccess.data.dao.CreateIssueModel; -import com.fastaccess.data.dao.IssueRequestModel; -import com.fastaccess.data.dao.LabelListModel; -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.data.dao.UsersListModel; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 19 Feb 2017, 12:18 PM - */ - -public class CreateIssuePresenter extends BasePresenter implements CreateIssueMvp.Presenter { - - @com.evernote.android.state.State boolean isCollaborator; - - - @Override public void checkAuthority(@NonNull String login, @NonNull String repoId) { - manageViewDisposable(RxHelper.getObservable(RestProvider.getRepoService(isEnterprise()). - isCollaborator(login, repoId, Login.getUser().getLogin())) - .subscribe(booleanResponse -> { - isCollaborator = booleanResponse.code() == 204; - sendToView(CreateIssueMvp.View::onShowIssueMisc); - }, Throwable::printStackTrace)); - } - - @Override public void onActivityForResult(int resultCode, int requestCode, Intent intent) { - if (resultCode == Activity.RESULT_OK && requestCode == BundleConstant.REQUEST_CODE) { - if (intent != null && intent.getExtras() != null) { - CharSequence charSequence = intent.getExtras().getCharSequence(BundleConstant.EXTRA); - if (!InputHelper.isEmpty(charSequence)) { - sendToView(view -> view.onSetCode(charSequence)); - } - } - } - } - - @Override public void onSubmit(@NonNull String title, @NonNull CharSequence description, @NonNull String login, - @NonNull String repo, @Nullable Issue issue, @Nullable PullRequest pullRequestModel, - @Nullable ArrayList labels, @Nullable MilestoneModel milestoneModel, - @Nullable ArrayList users) { - - boolean isEmptyTitle = InputHelper.isEmpty(title); - if (getView() != null) { - getView().onTitleError(isEmptyTitle); - } - if (!isEmptyTitle) { - if (issue == null && pullRequestModel == null) { - CreateIssueModel createIssue = new CreateIssueModel(); - createIssue.setBody(InputHelper.toString(description)); - createIssue.setTitle(title); - if (isCollaborator) { - if (labels != null && !labels.isEmpty()) { - createIssue.setLabels(Stream.of(labels).map(LabelModel::getName).collect(Collectors.toCollection(ArrayList::new))); - } - if (users != null && !users.isEmpty()) { - createIssue.setAssignees(Stream.of(users).map(User::getLogin).collect(Collectors.toCollection(ArrayList::new))); - } - if (milestoneModel != null) { - createIssue.setMilestone((long) milestoneModel.getNumber()); - } - } - makeRestCall(RestProvider.getIssueService(isEnterprise()).createIssue(login, repo, createIssue), - issueModel -> { - if (issueModel != null) { - sendToView(view -> view.onSuccessSubmission(issueModel)); - } else { - sendToView(view -> view.showMessage(R.string.error, R.string.error_creating_issue)); - } - }, false); - } else { - if (issue != null) { - issue.setBody(InputHelper.toString(description)); - issue.setTitle(title); - int number = issue.getNumber(); - if (isCollaborator) { - if (labels != null) { - LabelListModel labelModels = new LabelListModel(); - labelModels.addAll(labels); - issue.setLabels(labelModels); - } - if (milestoneModel != null) { - issue.setMilestone(milestoneModel); - } - if (users != null) { - UsersListModel usersListModel = new UsersListModel(); - usersListModel.addAll(users); - issue.setAssignees(usersListModel); - } - } - IssueRequestModel requestModel = IssueRequestModel.clone(issue, false); - makeRestCall(RestProvider.getIssueService(isEnterprise()).editIssue(login, repo, number, requestModel), - issueModel -> { - if (issueModel != null) { - sendToView(view -> view.onSuccessSubmission(issueModel)); - } else { - sendToView(view -> view.showMessage(R.string.error, R.string.error_creating_issue)); - } - }, false); - } - if (pullRequestModel != null) { - int number = pullRequestModel.getNumber(); - pullRequestModel.setBody(InputHelper.toString(description)); - pullRequestModel.setTitle(title); - if (isCollaborator) { - if (labels != null) { - LabelListModel labelModels = new LabelListModel(); - labelModels.addAll(labels); - pullRequestModel.setLabels(labelModels); - } - if (milestoneModel != null) { - pullRequestModel.setMilestone(milestoneModel); - } - if (users != null) { - UsersListModel usersListModel = new UsersListModel(); - usersListModel.addAll(users); - pullRequestModel.setAssignees(usersListModel); - } - } - IssueRequestModel requestModel = IssueRequestModel.clone(pullRequestModel, false); - makeRestCall(RestProvider.getPullRequestService(isEnterprise()).editPullRequest(login, repo, number, requestModel) - .flatMap(pullRequest1 -> RestProvider.getIssueService(isEnterprise()).getIssue(login, repo, number), - (pullRequest1, issueReaction) -> {//hack to get reactions from issue api - if (issueReaction != null) { - pullRequest1.setReactions(issueReaction.getReactions()); - } - return pullRequest1; - }), pr -> { - if (pr != null) { - sendToView(view -> view.onSuccessSubmission(pr)); - } else { - sendToView(view -> view.showMessage(R.string.error, R.string.error_creating_issue)); - } - }, false); - } - } - } - - } - - @Override public void onCheckAppVersion() { - makeRestCall(RestProvider.getRepoService(false).getLatestRelease("k0shk0sh", "FastHub"), - release -> { - if (release != null) { - if (!BuildConfig.VERSION_NAME.contains(release.getTagName())) { - sendToView(CreateIssueMvp.View::onShowUpdate); - } else { - sendToView(BaseMvp.FAView::hideProgress); - } - } - }, false); - } - - @Override public boolean isCollaborator() { - return isCollaborator; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/RepoClosedIssuesFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/RepoClosedIssuesFragment.java deleted file mode 100644 index ea540b19a..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/RepoClosedIssuesFragment.java +++ /dev/null @@ -1,209 +0,0 @@ -package com.fastaccess.ui.modules.repos.issues.issue; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.PullsIssuesParser; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.IssuesAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; -import com.fastaccess.ui.modules.repos.extras.popup.IssuePopupFragment; -import com.fastaccess.ui.modules.repos.issues.RepoIssuesPagerMvp; -import com.fastaccess.ui.modules.repos.issues.issue.details.IssuePagerActivity; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class RepoClosedIssuesFragment extends BaseFragment implements RepoIssuesMvp.View { - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private IssuesAdapter adapter; - private RepoPagerMvp.TabsBadgeListener tabsBadgeListener; - private RepoIssuesPagerMvp.View pagerCallback; - - public static RepoClosedIssuesFragment newInstance(@NonNull String repoId, @NonNull String login) { - RepoClosedIssuesFragment view = new RepoClosedIssuesFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .end()); - return view; - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() instanceof RepoIssuesPagerMvp.View) { - pagerCallback = (RepoIssuesPagerMvp.View) getParentFragment(); - } else if (context instanceof RepoIssuesPagerMvp.View) { - pagerCallback = (RepoIssuesPagerMvp.View) context; - } - if (getParentFragment() instanceof RepoPagerMvp.TabsBadgeListener) { - tabsBadgeListener = (RepoPagerMvp.TabsBadgeListener) getParentFragment(); - } else if (context instanceof RepoPagerMvp.TabsBadgeListener) { - tabsBadgeListener = (RepoPagerMvp.TabsBadgeListener) context; - } - } - - @Override public void onDetach() { - pagerCallback = null; - tabsBadgeListener = null; - super.onDetach(); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new NullPointerException("Bundle is null, therefore, issues can't be proceeded."); - } - stateLayout.setEmptyText(R.string.no_issues); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - adapter = new IssuesAdapter(getPresenter().getIssues(), true); - adapter.setListener(getPresenter()); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.setAdapter(adapter); - recycler.addKeyLineDivider(); - recycler.addOnScrollListener(getLoadMore()); - if (savedInstanceState == null) { - getPresenter().onFragmentCreated(getArguments(), IssueState.closed); - } else if (getPresenter().getIssues().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public RepoIssuesPresenter providePresenter() { - return new RepoIssuesPresenter(); - } - - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (resultCode == Activity.RESULT_OK) { - if (requestCode == RepoIssuesMvp.ISSUE_REQUEST_CODE && data != null) { - boolean isClose = data.getExtras().getBoolean(BundleConstant.EXTRA); - boolean isOpened = data.getExtras().getBoolean(BundleConstant.EXTRA_TWO); - if (isClose) { - onRefresh(); - } else if (isOpened) { - if (pagerCallback != null) pagerCallback.setCurrentItem(0, true); - onRefresh(); - } //else ignore! - } - } - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore(getPresenter()) { - @Override public void onScrolled(boolean isUp) { - super.onScrolled(isUp); - if (pagerCallback != null) pagerCallback.onScrolled(isUp); - } - }; - } - onLoadMore.setParameter(IssueState.closed); - return onLoadMore; - } - - @Override public void onAddIssue() { - //DO NOTHING - } - - @Override public void onUpdateCount(int totalCount) { - if (tabsBadgeListener != null) tabsBadgeListener.onSetBadge(1, totalCount); - } - - @Override public void onOpenIssue(@NonNull PullsIssuesParser parser) { - startActivityForResult(IssuePagerActivity.createIntent(getContext(), parser.getRepoId(), parser.getLogin(), - parser.getNumber(), false, isEnterprise()), RepoIssuesMvp.ISSUE_REQUEST_CODE); - } - - @Override public void onRefresh(boolean isLastUpdated) { - getPresenter().onSetSortBy(isLastUpdated); - getPresenter().onCallApi(1, IssueState.closed); - } - - @Override public void onShowIssuePopup(@NonNull Issue item) { - IssuePopupFragment.showPopup(getChildFragmentManager(), item); - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, IssueState.closed); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/RepoIssuesMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/RepoIssuesMvp.java deleted file mode 100644 index 194992497..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/RepoIssuesMvp.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.fastaccess.ui.modules.repos.issues.issue; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.PullsIssuesParser; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -interface RepoIssuesMvp { - - int ISSUE_REQUEST_CODE = 1002; - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - - void onAddIssue(); - - void onUpdateCount(int totalCount); - - void onOpenIssue(@NonNull PullsIssuesParser parser); - - void onRefresh(boolean isLastUpdated); - - void onShowIssuePopup(@NonNull Issue item); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - void onFragmentCreated(@NonNull Bundle bundle, @NonNull IssueState issueState); - - void onWorkOffline(); - - @NonNull ArrayList getIssues(); - - @NonNull String repoId(); - - @NonNull String login(); - - void onSetSortBy(boolean isLastUpdated); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/RepoIssuesPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/RepoIssuesPresenter.java deleted file mode 100644 index eaa31f40b..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/RepoIssuesPresenter.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.fastaccess.ui.modules.repos.issues.issue; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.annimon.stream.Stream; -import com.fastaccess.data.dao.PullsIssuesParser; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RepoQueryProvider; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; -import java.util.List; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class RepoIssuesPresenter extends BasePresenter implements RepoIssuesMvp.Presenter { - - private ArrayList issues = new ArrayList<>(); - @com.evernote.android.state.State String login; - @com.evernote.android.state.State String repoId; - @com.evernote.android.state.State IssueState issueState; - @com.evernote.android.state.State boolean isLastUpdated; - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - onWorkOffline(); - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable IssueState parameter) { - if (parameter == null) { - sendToView(RepoIssuesMvp.View::hideProgress); - return false; - } - this.issueState = parameter; - if (page == 1) { - onCallCountApi(issueState); - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - if (page > lastPage || lastPage == 0) { - sendToView(RepoIssuesMvp.View::hideProgress); - return false; - } - String sortBy = "created"; - if (isLastUpdated) { - sortBy = "updated"; - } - setCurrentPage(page); - String finalSortBy = sortBy; - makeRestCall(RestProvider.getIssueService(isEnterprise()) - .getRepositoryIssues(login, repoId, parameter.name(), sortBy, page) - .flatMap(issues -> { - lastPage = issues.getLast(); - List filtered = Stream.of(issues.getItems()) - .filter(issue -> issue.getPullRequest() == null) - .toList(); - if (filtered != null) { - if (filtered.size() < 10 && issues.getNext() > 1) { - setCurrentPage(getCurrentPage() + 1); - return grabMoreIssues(filtered, parameter.name(), finalSortBy, getCurrentPage()); - } - return Observable.just(filtered); - } - return Observable.just(new ArrayList()); - }) - .doOnNext(filtered -> { - if (getCurrentPage() == 1) { - Issue.save(filtered, repoId, login); - } - }), - issues -> sendToView(view -> view.onNotifyAdapter(issues, page))); - return true; - } - - @Override public void onFragmentCreated(@NonNull Bundle bundle, @NonNull IssueState issueState) { - repoId = bundle.getString(BundleConstant.ID); - login = bundle.getString(BundleConstant.EXTRA); - this.issueState = issueState; - if (!InputHelper.isEmpty(login) && !InputHelper.isEmpty(repoId)) { - onCallApi(1, issueState); - } - } - - @Override public void onWorkOffline() { - if (issues.isEmpty()) { - manageDisposable(RxHelper.getSingle(Issue.getIssues(repoId, login, issueState)) - .subscribe(issueModel -> sendToView(view -> { - view.onNotifyAdapter(issueModel, 1); - view.onUpdateCount(issueModel.size()); - }))); - } else { - sendToView(BaseMvp.FAView::hideProgress); - } - } - - @NonNull @Override public ArrayList getIssues() { - return issues; - } - - @NonNull @Override public String repoId() { - return repoId; - } - - @NonNull @Override public String login() { - return login; - } - - @Override public void onSetSortBy(boolean isLastUpdated) { - this.isLastUpdated = isLastUpdated; - } - - @Override public void onItemClick(int position, View v, Issue item) { - PullsIssuesParser parser = PullsIssuesParser.getForIssue(item.getHtmlUrl()); - if (parser != null && getView() != null) { - getView().onOpenIssue(parser); - } - } - - @Override public void onItemLongClick(int position, View v, Issue item) { - if (getView() != null) getView().onShowIssuePopup(item); - } - - private void onCallCountApi(@NonNull IssueState issueState) { - manageDisposable(RxHelper.getObservable(RestProvider.getIssueService(isEnterprise()) - .getIssuesWithCount(RepoQueryProvider.getIssuesPullRequestQuery(login, repoId, issueState, false), 1)) - .subscribe(pullRequestPageable -> sendToView(view -> view.onUpdateCount(pullRequestPageable.getTotalCount())), - Throwable::printStackTrace)); - } - - private Observable> grabMoreIssues(@NonNull List issues, @NonNull String state, @NonNull String sortBy, int page) { - return RestProvider.getIssueService(isEnterprise()).getRepositoryIssues(login, repoId, state, sortBy, page) - .flatMap(issuePageable -> { - if (issuePageable != null) { - lastPage = issuePageable.getLast(); - List filtered = Stream.of(issuePageable.getItems()) - .filter(issue -> issue.getPullRequest() == null) - .toList(); - if (filtered != null) { - issues.addAll(filtered); - if (issues.size() < 10 && issuePageable.getNext() > 1 && this.issues.size() < 10) { - setCurrentPage(getCurrentPage() + 1); - return grabMoreIssues(issues, state, sortBy, getCurrentPage()); - } - issues.addAll(filtered); - return Observable.just(issues); - } - } - return Observable.just(issues); - }); - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/RepoOpenedIssuesFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/RepoOpenedIssuesFragment.java deleted file mode 100644 index 24b7a5fff..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/RepoOpenedIssuesFragment.java +++ /dev/null @@ -1,219 +0,0 @@ -package com.fastaccess.ui.modules.repos.issues.issue; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.PullsIssuesParser; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.IssuesAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; -import com.fastaccess.ui.modules.repos.extras.popup.IssuePopupFragment; -import com.fastaccess.ui.modules.repos.issues.RepoIssuesPagerMvp; -import com.fastaccess.ui.modules.repos.issues.create.CreateIssueActivity; -import com.fastaccess.ui.modules.repos.issues.issue.details.IssuePagerActivity; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class RepoOpenedIssuesFragment extends BaseFragment implements RepoIssuesMvp.View { - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private IssuesAdapter adapter; - private RepoIssuesPagerMvp.View pagerCallback; - private RepoPagerMvp.TabsBadgeListener tabsBadgeListener; - - public static RepoOpenedIssuesFragment newInstance(@NonNull String repoId, @NonNull String login) { - RepoOpenedIssuesFragment view = new RepoOpenedIssuesFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .end()); - return view; - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() instanceof RepoIssuesPagerMvp.View) { - pagerCallback = (RepoIssuesPagerMvp.View) getParentFragment(); - } else if (context instanceof RepoIssuesPagerMvp.View) { - pagerCallback = (RepoIssuesPagerMvp.View) context; - } - if (getParentFragment() instanceof RepoPagerMvp.TabsBadgeListener) { - tabsBadgeListener = (RepoPagerMvp.TabsBadgeListener) getParentFragment(); - } else if (context instanceof RepoPagerMvp.TabsBadgeListener) { - tabsBadgeListener = (RepoPagerMvp.TabsBadgeListener) context; - } - } - - @Override public void onDetach() { - pagerCallback = null; - tabsBadgeListener = null; - super.onDetach(); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new NullPointerException("Bundle is null, therefore, issues can't be proceeded."); - } - stateLayout.setEmptyText(R.string.no_issues); - recycler.setEmptyView(stateLayout, refresh); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - adapter = new IssuesAdapter(getPresenter().getIssues(), true); - adapter.setListener(getPresenter()); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.setAdapter(adapter); - recycler.addKeyLineDivider(); - recycler.addOnScrollListener(getLoadMore()); - if (savedInstanceState == null) { - getPresenter().onFragmentCreated(getArguments(), IssueState.open); - } else if (getPresenter().getIssues().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (resultCode == Activity.RESULT_OK) { - if (requestCode == BundleConstant.REQUEST_CODE) { - onRefresh(); - if (pagerCallback != null) pagerCallback.setCurrentItem(0, false); - } else if (requestCode == RepoIssuesMvp.ISSUE_REQUEST_CODE && data != null) { - boolean isClose = data.getExtras().getBoolean(BundleConstant.EXTRA); - boolean isOpened = data.getExtras().getBoolean(BundleConstant.EXTRA_TWO); - if (isClose) { - if (pagerCallback != null) pagerCallback.setCurrentItem(1, true); - onRefresh(); - } else if (isOpened) { - onRefresh(); - } //else ignore! - } - } - } - - @NonNull @Override public RepoIssuesPresenter providePresenter() { - return new RepoIssuesPresenter(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - - stateLayout.showProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore(getPresenter()) { - @Override public void onScrolled(boolean isUp) { - super.onScrolled(isUp); - if (pagerCallback != null) pagerCallback.onScrolled(isUp); - } - }; - } - onLoadMore.setParameter(IssueState.open); - return onLoadMore; - } - - @Override public void onAddIssue() { - String login = getPresenter().login(); - String repoId = getPresenter().repoId(); - if (!InputHelper.isEmpty(login) && !InputHelper.isEmpty(repoId)) { - CreateIssueActivity.startForResult(this, login, repoId, isEnterprise()); - } - } - - @Override public void onUpdateCount(int totalCount) { - if (tabsBadgeListener != null) tabsBadgeListener.onSetBadge(0, totalCount); - } - - @Override public void onOpenIssue(@NonNull PullsIssuesParser parser) { - startActivityForResult(IssuePagerActivity.createIntent(getContext(), parser.getRepoId(), parser.getLogin(), - parser.getNumber(), false, isEnterprise()), RepoIssuesMvp.ISSUE_REQUEST_CODE); - } - - @Override public void onRefresh(boolean isLastUpdated) { - getPresenter().onSetSortBy(isLastUpdated); - getPresenter().onCallApi(1, IssueState.open); - } - - @Override public void onShowIssuePopup(@NonNull Issue item) { - IssuePopupFragment.showPopup(getChildFragmentManager(), item); - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, IssueState.open); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/details/IssuePagerActivity.java b/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/details/IssuePagerActivity.java deleted file mode 100644 index 9a9b5be59..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/details/IssuePagerActivity.java +++ /dev/null @@ -1,462 +0,0 @@ -package com.fastaccess.ui.modules.repos.issues.issue.details; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.floatingactionbutton.FloatingActionButton; -import com.google.android.material.tabs.TabLayout; -import androidx.core.content.ContextCompat; -import androidx.viewpager.widget.ViewPager; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.FragmentPagerAdapterModel; -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.PinnedIssues; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.Logger; -import com.fastaccess.helper.ParseDateFormat; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.ui.adapter.FragmentsPagerAdapter; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment; -import com.fastaccess.ui.modules.main.premium.PremiumActivity; -import com.fastaccess.ui.modules.repos.RepoPagerActivity; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; -import com.fastaccess.ui.modules.repos.extras.assignees.AssigneesDialogFragment; -import com.fastaccess.ui.modules.repos.extras.labels.LabelsDialogFragment; -import com.fastaccess.ui.modules.repos.extras.locking.LockIssuePrBottomSheetDialog; -import com.fastaccess.ui.modules.repos.extras.milestone.create.MilestoneDialogFragment; -import com.fastaccess.ui.modules.repos.issues.create.CreateIssueActivity; -import com.fastaccess.ui.modules.repos.issues.issue.details.timeline.IssueTimelineFragment; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.ForegroundImageView; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.ViewPagerView; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; - -import java.util.ArrayList; - -import butterknife.BindView; -import butterknife.OnClick; - -/** - * Created by Kosh on 10 Dec 2016, 9:23 AM - */ - -public class IssuePagerActivity extends BaseActivity implements IssuePagerMvp.View { - - @BindView(R.id.startGist) ForegroundImageView startGist; - @BindView(R.id.forkGist) ForegroundImageView forkGist; - @BindView(R.id.avatarLayout) AvatarLayout avatarLayout; - @BindView(R.id.headerTitle) FontTextView title; - @BindView(R.id.size) FontTextView size; - @BindView(R.id.date) FontTextView date; - @BindView(R.id.tabs) TabLayout tabs; - @BindView(R.id.pager) ViewPagerView pager; - @BindView(R.id.fab) FloatingActionButton fab; - @BindView(R.id.detailsIcon) View detailsIcon; - @State boolean isClosed; - @State boolean isOpened; - private CommentEditorFragment commentEditorFragment; - - public static Intent createIntent(@NonNull Context context, @NonNull String repoId, @NonNull String login, int number) { - return createIntent(context, repoId, login, number, false); - - } - - public static Intent createIntent(@NonNull Context context, @NonNull String repoId, - @NonNull String login, int number, boolean showToRepoBtn) { - return createIntent(context, repoId, login, number, showToRepoBtn, false); - - } - - public static Intent createIntent(@NonNull Context context, @NonNull String repoId, - @NonNull String login, int number, boolean showToRepoBtn, - boolean isEnterprise) { - return createIntent(context, repoId, login, number, showToRepoBtn, isEnterprise, 0); - - } - - public static Intent createIntent(@NonNull Context context, @NonNull String repoId, - @NonNull String login, int number, boolean showToRepoBtn, - boolean isEnterprise, long commentId) { - Intent intent = new Intent(context, IssuePagerActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.ID, number) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.EXTRA_TWO, repoId) - .put(BundleConstant.EXTRA_THREE, showToRepoBtn) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .put(BundleConstant.EXTRA_SIX, commentId) - .end()); - return intent; - - } - - @OnClick(R.id.detailsIcon) void onTitleClick() { - if (getPresenter().getIssue() != null && !InputHelper.isEmpty(getPresenter().getIssue().getTitle())) - MessageDialogView.newInstance(String.format("%s/%s", getPresenter().getLogin(), getPresenter().getRepoId()), - getPresenter().getIssue().getTitle(), false, true) - .show(getSupportFragmentManager(), MessageDialogView.TAG); - } - - @Override protected int layout() { - return R.layout.issue_pager_activity; - } - - @Override protected boolean isTransparent() { - return true; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @NonNull @Override public IssuePagerPresenter providePresenter() { - return new IssuePagerPresenter(); - } - - @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - commentEditorFragment = (CommentEditorFragment) getSupportFragmentManager().findFragmentById(R.id.commentFragment); - tabs.setVisibility(View.GONE); - if (savedInstanceState == null) { - getPresenter().onActivityCreated(getIntent()); - } else { - if (getPresenter().getIssue() != null) onSetupIssue(false); - } - startGist.setVisibility(View.GONE); - forkGist.setVisibility(View.GONE); - fab.hide(); - if (getPresenter().showToRepoBtn()) showNavToRepoItem(); - } - - @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (resultCode == RESULT_OK && data != null) { - if (requestCode == BundleConstant.REQUEST_CODE) { - Bundle bundle = data.getExtras(); - if (bundle != null) { - Issue issueModel = bundle.getParcelable(BundleConstant.ITEM); - if (issueModel != null) { - getPresenter().onUpdateIssue(issueModel); - } - } - } - } - } - - @Override public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.issue_menu, menu); - menu.findItem(R.id.closeIssue).setVisible(getPresenter().isOwner()); - menu.findItem(R.id.lockIssue).setVisible(getPresenter().isRepoOwner() || getPresenter().isCollaborator); - menu.findItem(R.id.labels).setVisible(getPresenter().isRepoOwner() || getPresenter().isCollaborator); - return super.onCreateOptionsMenu(menu); - } - - @Override public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == android.R.id.home) { - onNavToRepoClicked(); - return true; - } - Issue issueModel = getPresenter().getIssue(); - if (issueModel == null) return false; - if (item.getItemId() == R.id.share) { - ActivityHelper.shareUrl(this, getPresenter().getIssue().getHtmlUrl()); - return true; - } else if (item.getItemId() == R.id.closeIssue) { - MessageDialogView.newInstance( - issueModel.getState() == IssueState.open ? getString(R.string.close_issue) : getString(R.string.re_open_issue), - getString(R.string.confirm_message), Bundler.start().put(BundleConstant.EXTRA, true) - .put(BundleConstant.YES_NO_EXTRA, true).end()) - .show(getSupportFragmentManager(), MessageDialogView.TAG); - return true; - } else if (item.getItemId() == R.id.lockIssue) { - if (!getPresenter().isLocked()) { - LockIssuePrBottomSheetDialog.Companion - .newInstance() - .show(getSupportFragmentManager(), MessageDialogView.TAG); - } else { - MessageDialogView.newInstance(getString(R.string.unlock_issue), getString(R.string.unlock_issue_details), - Bundler.start().put(BundleConstant.EXTRA_TWO, true) - .put(BundleConstant.YES_NO_EXTRA, true) - .end()) - .show(getSupportFragmentManager(), MessageDialogView.TAG); - } - return true; - } else if (item.getItemId() == R.id.labels) { - LabelsDialogFragment.newInstance(getPresenter().getIssue() != null ? getPresenter().getIssue().getLabels() : null, - getPresenter().getRepoId(), getPresenter().getLogin()) - .show(getSupportFragmentManager(), "LabelsDialogFragment"); - return true; - } else if (item.getItemId() == R.id.edit) { - CreateIssueActivity.startForResult(this, getPresenter().getLogin(), getPresenter().getRepoId(), - getPresenter().getIssue(), isEnterprise()); - return true; - } else if (item.getItemId() == R.id.milestone) { - MilestoneDialogFragment.newInstance(getPresenter().getLogin(), getPresenter().getRepoId()) - .show(getSupportFragmentManager(), "MilestoneDialogFragment"); - return true; - } else if (item.getItemId() == R.id.assignees) { - AssigneesDialogFragment.newInstance(getPresenter().getLogin(), getPresenter().getRepoId(), true) - .show(getSupportFragmentManager(), "AssigneesDialogFragment"); - return true; - } else if (item.getItemId() == R.id.subscribe) { - getPresenter().onSubscribeOrMute(false); - return true; - } else if (item.getItemId() == R.id.mute) { - getPresenter().onSubscribeOrMute(true); - return true; - } else if (item.getItemId() == R.id.browser) { - ActivityHelper.startCustomTab(this, issueModel.getHtmlUrl()); - return true; - } else if (item.getItemId() == R.id.pinUnpin) { - if (PrefGetter.isProEnabled()) { - getPresenter().onPinUnpinIssue(); - } else { - PremiumActivity.Companion.startActivity(this); - } - return true; - } - return super.onOptionsItemSelected(item); - } - - @Override public boolean onPrepareOptionsMenu(Menu menu) { - MenuItem closeIssue = menu.findItem(R.id.closeIssue); - MenuItem lockIssue = menu.findItem(R.id.lockIssue); - MenuItem milestone = menu.findItem(R.id.milestone); - MenuItem labels = menu.findItem(R.id.labels); - MenuItem assignees = menu.findItem(R.id.assignees); - MenuItem edit = menu.findItem(R.id.edit); - MenuItem editMenu = menu.findItem(R.id.editMenu); - MenuItem pinUnpin = menu.findItem(R.id.pinUnpin); - boolean isOwner = getPresenter().isOwner(); - boolean isLocked = getPresenter().isLocked(); - boolean isCollaborator = getPresenter().isCollaborator(); - boolean isRepoOwner = getPresenter().isRepoOwner(); - editMenu.setVisible(isOwner || isCollaborator || isRepoOwner); - milestone.setVisible(isCollaborator || isRepoOwner); - labels.setVisible(isCollaborator || isRepoOwner); - assignees.setVisible(isCollaborator || isRepoOwner); - edit.setVisible(isCollaborator || isRepoOwner || isOwner); - lockIssue.setVisible(isRepoOwner || isCollaborator); - labels.setVisible(getPresenter().isRepoOwner() || isCollaborator); - closeIssue.setVisible(isOwner || isCollaborator); - if (getPresenter().getIssue() != null) { - boolean isPinned = PinnedIssues.isPinned(getPresenter().getIssue().getId()); - pinUnpin.setIcon(isPinned ? ContextCompat.getDrawable(this, R.drawable.ic_pin_filled) - : ContextCompat.getDrawable(this, R.drawable.ic_pin)); - closeIssue.setTitle(getPresenter().getIssue().getState() == IssueState.closed ? getString(R.string.re_open) : getString(R.string.close)); - lockIssue.setTitle(isLocked ? getString(R.string.unlock_issue) : getString(R.string.lock_issue)); - } - return super.onPrepareOptionsMenu(menu); - } - - @Override public void onSetupIssue(boolean isUpdate) { - hideProgress(); - if (getPresenter().getIssue() == null) { - return; - } - onUpdateMenu(); - Issue issueModel = getPresenter().getIssue(); - setTaskName(issueModel.getRepoId() + " - " + issueModel.getTitle()); - setTitle(String.format("#%s", issueModel.getNumber())); - if (getSupportActionBar() != null) { - getSupportActionBar().setSubtitle(issueModel.getRepoId()); - } - updateViews(issueModel); - if (isUpdate) { - IssueTimelineFragment issueDetailsView = getIssueTimelineFragment(); - if (issueDetailsView != null && getPresenter().getIssue() != null) { - issueDetailsView.onUpdateHeader(); - } - } else { - if (pager.getAdapter() == null) { - Logger.e(getPresenter().commentId); - pager.setAdapter(new FragmentsPagerAdapter(getSupportFragmentManager(), FragmentPagerAdapterModel - .buildForIssues(this, getPresenter().commentId))); - } else { - onUpdateTimeline(); - } - } - if (!getPresenter().isLocked() || getPresenter().isOwner()) { - pager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { - @Override public void onPageSelected(int position) { - super.onPageSelected(position); - hideShowFab(); - } - }); - } - hideShowFab(); - } - - @Override public void showSuccessIssueActionMsg(boolean isClose) { - hideProgress(); - if (isClose) { - isOpened = false; - isClosed = true; - showMessage(getString(R.string.success), getString(R.string.success_closed)); - } else { - isOpened = true; - isClosed = false; - showMessage(getString(R.string.success), getString(R.string.success_re_opened)); - } - } - - @Override public void showErrorIssueActionMsg(boolean isClose) { - hideProgress(); - if (isClose) { - showMessage(getString(R.string.error), getString(R.string.error_closing_issue)); - } else { - showMessage(getString(R.string.error), getString(R.string.error_re_opening_issue)); - } - } - - @Override public void onUpdateTimeline() { - IssueTimelineFragment issueDetailsView = getIssueTimelineFragment(); - if (issueDetailsView != null && getPresenter().getIssue() != null) { - issueDetailsView.onRefresh(); - } - } - - @Override public void onUpdateMenu() { - invalidateOptionsMenu(); - } - - @Override public void onMileStoneSelected(@NonNull MilestoneModel milestoneModel) { - getPresenter().onPutMilestones(milestoneModel); - } - - @Override public void onFinishActivity() { - hideProgress(); - finish(); - } - - @Nullable @Override public Issue getData() { - return getPresenter().getIssue(); - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (isOk) { - getPresenter().onHandleConfirmDialog(bundle); - } - } - - @Override public void onSelectedLabels(@NonNull ArrayList labels) { - getPresenter().onPutLabels(labels); - } - - @Override public void onSelectedAssignees(@NonNull ArrayList users, boolean isAssignee) { - getPresenter().onPutAssignees(users); - } - - @Override public void onNavToRepoClicked() { - Intent intent = ActivityHelper.editBundle(RepoPagerActivity.createIntent(this, getPresenter().getRepoId(), - getPresenter().getLogin(), RepoPagerMvp.ISSUES), isEnterprise()); - startActivity(intent); - finish(); - } - - @Override public void onBackPressed() { - super.onBackPressed(); - } - - @Override public void finish() { - Intent intent = new Intent(); - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA, isClosed) - .put(BundleConstant.EXTRA_TWO, isOpened) - .end()); - setResult(RESULT_OK, intent); - super.finish(); - } - - @Override public void onSendActionClicked(@NonNull String text, @Nullable Bundle bundle) { - IssueTimelineFragment fragment = getIssueTimelineFragment(); - if (fragment != null) { - fragment.onHandleComment(text, bundle); - } - } - - @Override public void onTagUser(@NonNull String username) { - commentEditorFragment.onAddUserName(username); - } - - @Override public void onCreateComment(String text, Bundle bundle) {} - - @SuppressWarnings("ConstantConditions") @Override public void onClearEditText() { - if (commentEditorFragment != null && commentEditorFragment.commentText != null) commentEditorFragment.commentText.setText(""); - } - - @NonNull @Override public ArrayList getNamesToTag() { - IssueTimelineFragment fragment = getIssueTimelineFragment(); - if (fragment != null) { - return fragment.getNamesToTag(); - } - return new ArrayList<>(); - } - - @Override public void onLock(@NonNull String reason) { - getPresenter().onLockUnlockIssue(reason); - } - - private IssueTimelineFragment getIssueTimelineFragment() { - if (pager == null || pager.getAdapter() == null) return null; - return (IssueTimelineFragment) pager.getAdapter().instantiateItem(pager, 0); - } - - private void hideShowFab() { - if (getPresenter().isLocked() && !getPresenter().isOwner() && !getPresenter().isCollaborator()) { - getSupportFragmentManager().beginTransaction().hide(commentEditorFragment).commit(); - return; - } - getSupportFragmentManager().beginTransaction().show(commentEditorFragment).commit(); - } - - private void updateViews(@NonNull Issue issueModel) { - User userModel = issueModel.getUser(); - title.setText(issueModel.getTitle()); - detailsIcon.setVisibility(View.VISIBLE); - if (userModel != null) { - size.setVisibility(View.GONE); - String username; - CharSequence parsedDate; - if (issueModel.getState() == IssueState.closed) { - username = issueModel.getClosedBy() != null ? issueModel.getClosedBy().getLogin() : "N/A"; - parsedDate = issueModel.getClosedAt() != null ? ParseDateFormat.getTimeAgo(issueModel.getClosedAt()) : "N/A"; - } else { - parsedDate = ParseDateFormat.getTimeAgo(issueModel.getCreatedAt()); - username = issueModel.getUser() != null ? issueModel.getUser().getLogin() : "N/A"; - } - date.setText(SpannableBuilder.builder() - .append(ContextCompat.getDrawable(this, - issueModel.getState() == IssueState.open ? R.drawable.ic_issue_opened_small : R.drawable.ic_issue_closed_small)) - .append(" ") - .append(getString(issueModel.getState().getStatus())) - .append(" ").append(getString(R.string.by)).append(" ").append(username).append(" ") - .append(parsedDate)); - avatarLayout.setUrl(userModel.getAvatarUrl(), userModel.getLogin(), false, - LinkParserHelper.isEnterprise(issueModel.getHtmlUrl())); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/details/IssuePagerMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/details/IssuePagerMvp.java deleted file mode 100644 index b781cadeb..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/details/IssuePagerMvp.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.fastaccess.ui.modules.repos.issues.issue.details; - -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment; -import com.fastaccess.ui.modules.repos.extras.assignees.AssigneesMvp; -import com.fastaccess.ui.modules.repos.extras.labels.LabelsMvp; -import com.fastaccess.ui.modules.repos.extras.locking.LockIssuePrCallback; - -import java.util.ArrayList; - -/** - * Created by Kosh on 10 Dec 2016, 9:21 AM - */ - -public interface IssuePagerMvp { - - interface View extends BaseMvp.FAView, LabelsMvp.SelectedLabelsListener, - AssigneesMvp.SelectedAssigneesListener, IssuePrCallback, - CommentEditorFragment.CommentListener, LockIssuePrCallback { - void onSetupIssue(boolean isUpdate); - - void showSuccessIssueActionMsg(boolean isClose); - - void showErrorIssueActionMsg(boolean isClose); - - void onUpdateTimeline(); - - void onUpdateMenu(); - - void onMileStoneSelected(@NonNull MilestoneModel milestoneModel); - - void onFinishActivity(); - } - - interface Presenter extends BaseMvp.FAPresenter { - - @Nullable Issue getIssue(); - - void onActivityCreated(@Nullable Intent intent); - - void onWorkOffline(long issueNumber, @NonNull String repoId, @NonNull String login); - - boolean isOwner(); - - boolean isRepoOwner(); - - boolean isLocked(); - - boolean isCollaborator(); - - boolean showToRepoBtn(); - - void onHandleConfirmDialog(@Nullable Bundle bundle); - - void onOpenCloseIssue(); - - void onLockUnlockIssue(String reason); - - void onPutMilestones(@NonNull MilestoneModel milestone); - - void onPutLabels(@NonNull ArrayList labels); - - void onPutAssignees(@NonNull ArrayList users); - - String getLogin(); - - String getRepoId(); - - void onUpdateIssue(@NonNull Issue issueModel); - - void onSubscribeOrMute(boolean mute); - - void onPinUnpinIssue(); - } - - interface IssuePrCallback { - @Nullable T getData(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/details/IssuePagerPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/details/IssuePagerPresenter.java deleted file mode 100644 index f894621fa..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/details/IssuePagerPresenter.java +++ /dev/null @@ -1,290 +0,0 @@ -package com.fastaccess.ui.modules.repos.issues.issue.details; - -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.text.TextUtils; - -import com.annimon.stream.Collectors; -import com.annimon.stream.Stream; -import com.fastaccess.R; -import com.fastaccess.data.dao.AssigneesRequestModel; -import com.fastaccess.data.dao.IssueRequestModel; -import com.fastaccess.data.dao.LabelListModel; -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.LockIssuePrModel; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.data.dao.NotificationSubscriptionBodyModel; -import com.fastaccess.data.dao.PullsIssuesParser; -import com.fastaccess.data.dao.UsersListModel; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.PinnedIssues; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.data.service.IssueService; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.Logger; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -import io.reactivex.Observable; -import retrofit2.Response; - -/** - * Created by Kosh on 10 Dec 2016, 9:23 AM - */ - -class IssuePagerPresenter extends BasePresenter implements IssuePagerMvp.Presenter { - @com.evernote.android.state.State Issue issueModel; - @com.evernote.android.state.State int issueNumber; - @com.evernote.android.state.State String login; - @com.evernote.android.state.State String repoId; - @com.evernote.android.state.State boolean isCollaborator; - @com.evernote.android.state.State boolean showToRepoBtn; - @com.evernote.android.state.State long commentId; - - @Nullable @Override public Issue getIssue() { - return issueModel; - } - - @Override public void onError(@NonNull Throwable throwable) { - if (RestProvider.getErrorCode(throwable) == 404) { - sendToView(BaseMvp.FAView::onOpenUrlInBrowser); - } else { - onWorkOffline(issueNumber, login, repoId); - } - super.onError(throwable); - } - - @Override public void onActivityCreated(@Nullable Intent intent) { - Logger.e(isEnterprise()); - if (intent != null && intent.getExtras() != null) { - issueModel = intent.getExtras().getParcelable(BundleConstant.ITEM); - issueNumber = intent.getExtras().getInt(BundleConstant.ID); - login = intent.getExtras().getString(BundleConstant.EXTRA); - repoId = intent.getExtras().getString(BundleConstant.EXTRA_TWO); - showToRepoBtn = intent.getExtras().getBoolean(BundleConstant.EXTRA_THREE); - commentId = intent.getExtras().getLong(BundleConstant.EXTRA_SIX); - if (issueModel != null) { - issueNumber = issueModel.getNumber(); - sendToView(view -> view.onSetupIssue(false)); - return; - } else if (issueNumber > 0 && !InputHelper.isEmpty(login) && !InputHelper.isEmpty(repoId)) { - getIssueFromApi(); - return; - } - } - sendToView(view -> view.onSetupIssue(false)); - } - - @Override public void onWorkOffline(long issueNumber, @NonNull String repoId, @NonNull String login) { - if (issueModel == null) { - manageDisposable(RxHelper.getObservable(Issue.getIssueByNumber((int) issueNumber, repoId, login)) - .subscribe(issueModel1 -> { - if (issueModel1 != null) { - issueModel = issueModel1; - sendToView(view -> view.onSetupIssue(false)); - } - })); - } else { - sendToView(BaseMvp.FAView::hideProgress); - } - } - - @Override public boolean isOwner() { - if (getIssue() == null) return false; - User userModel = getIssue() != null ? getIssue().getUser() : null; - Login me = Login.getUser(); - PullsIssuesParser parser = PullsIssuesParser.getForIssue(getIssue().getHtmlUrl()); - return (userModel != null && userModel.getLogin().equalsIgnoreCase(me.getLogin())) - || (parser != null && parser.getLogin().equalsIgnoreCase(me.getLogin())); - } - - @Override public boolean isRepoOwner() { - if (getIssue() == null) return false; - Login me = Login.getUser(); - return TextUtils.equals(login, me.getLogin()); - } - - @Override public boolean isLocked() { - return getIssue() != null && getIssue().isLocked(); - } - - @Override public boolean isCollaborator() { - return isCollaborator; - } - - @Override public boolean showToRepoBtn() { - return showToRepoBtn; - } - - @Override public void onHandleConfirmDialog(@Nullable Bundle bundle) { - if (bundle != null) { - boolean proceedCloseIssue = bundle.getBoolean(BundleConstant.EXTRA); - boolean proceedLockUnlock = bundle.getBoolean(BundleConstant.EXTRA_TWO); - if (proceedCloseIssue) { - onOpenCloseIssue(); - } else if (proceedLockUnlock) { - onLockUnlockIssue(null); - } - } - } - - @Override public void onOpenCloseIssue() { - Issue currentIssue = getIssue(); - if (currentIssue != null) { - IssueRequestModel requestModel = IssueRequestModel.clone(currentIssue, true); - manageDisposable(RxHelper.getObservable(RestProvider.getIssueService(isEnterprise()).editIssue(login, repoId, - issueNumber, requestModel)) - .doOnSubscribe(disposable -> sendToView(view -> view.showProgress(0))) - .subscribe(issue -> { - if (issue != null) { - sendToView(view -> view.showSuccessIssueActionMsg(currentIssue.getState() == IssueState.open)); - issue.setRepoId(issueModel.getRepoId()); - issue.setLogin(issueModel.getLogin()); - issueModel = issue; - sendToView(view -> view.onSetupIssue(false)); - } - }, this::onError)); - } - } - - @Override public void onLockUnlockIssue(String reason) { - Issue currentIssue = getIssue(); - if (currentIssue == null) return; - String login = getLogin(); - String repoId = getRepoId(); - int number = currentIssue.getNumber(); - LockIssuePrModel model = null; - if (!isLocked() && !InputHelper.isEmpty(reason)) { - model = new LockIssuePrModel(true, reason); - } - IssueService issueService = RestProvider.getIssueService(isEnterprise()); - Observable> observable = RxHelper - .getObservable(model == null - ? issueService.unlockIssue(login, repoId, number) : - issueService.lockIssue(model, login, repoId, number)); - makeRestCall(observable, booleanResponse -> { - int code = booleanResponse.code(); - if (code == 204) { - issueModel.setLocked(!isLocked()); - sendToView(view -> view.onSetupIssue(true)); - } - sendToView(IssuePagerMvp.View::hideProgress); - }); - - } - - @Override public void onPutMilestones(@NonNull MilestoneModel milestone) { - issueModel.setMilestone(milestone); - IssueRequestModel issueRequestModel = IssueRequestModel.clone(issueModel, false); - makeRestCall(RestProvider.getIssueService(isEnterprise()).editIssue(login, repoId, issueNumber, issueRequestModel), - issue -> { - this.issueModel.setMilestone(issue.getMilestone()); - manageObservable(issue.save(issueModel).toObservable()); - sendToView(view -> updateTimeline(view, R.string.labels_added_successfully)); - }); - - } - - @Override public void onPutLabels(@NonNull ArrayList labels) { - makeRestCall(RestProvider.getIssueService(isEnterprise()).putLabels(login, repoId, issueNumber, - Stream.of(labels).filter(value -> value != null && value.getName() != null) - .map(LabelModel::getName).collect(Collectors.toList())), - labelModels -> { - sendToView(view -> updateTimeline(view, R.string.labels_added_successfully)); - LabelListModel listModel = new LabelListModel(); - listModel.addAll(labels); - issueModel.setLabels(listModel); - manageObservable(issueModel.save(issueModel).toObservable()); - }); - } - - @Override public void onPutAssignees(@NonNull ArrayList users) { - AssigneesRequestModel assigneesRequestModel = new AssigneesRequestModel(); - ArrayList assignees = new ArrayList<>(); - Stream.of(users).forEach(userModel -> assignees.add(userModel.getLogin())); - assigneesRequestModel.setAssignees(assignees.isEmpty() ? Stream.of(issueModel.getAssignees()).map(User::getLogin).toList() : assignees); - makeRestCall(!assignees.isEmpty() ? - RestProvider.getIssueService(isEnterprise()).putAssignees(login, repoId, issueNumber, assigneesRequestModel) : - RestProvider.getIssueService(isEnterprise()).deleteAssignees(login, repoId, issueNumber, assigneesRequestModel), - issue -> { - UsersListModel assignee = new UsersListModel(); - assignee.addAll(users); - issueModel.setAssignees(assignee); - manageObservable(issueModel.save(issueModel).toObservable()); - sendToView(view -> updateTimeline(view, R.string.assignee_added)); - } - ); - } - - @Override public String getLogin() { - return login; - } - - @Override public String getRepoId() { - return repoId; - } - - @Override public void onUpdateIssue(@NonNull Issue issue) { - this.issueModel.setBody(issue.getBody()); - this.issueModel.setBodyHtml(issue.getBodyHtml()); - this.issueModel.setTitle(issue.getTitle()); - this.issueModel.setLogin(login); - this.issueModel.setRepoId(repoId); - manageObservable(issueModel.save(issueModel).toObservable()); - sendToView(view -> view.onSetupIssue(true)); - } - - @Override public void onSubscribeOrMute(boolean mute) { - if (getIssue() == null) return; - makeRestCall(mute ? RestProvider.getNotificationService(isEnterprise()).subscribe(getIssue().getId(), - new NotificationSubscriptionBodyModel(false, true)) - : RestProvider.getNotificationService(isEnterprise()).subscribe(getIssue().getId(), - new NotificationSubscriptionBodyModel(true, false)), - booleanResponse -> { - if (booleanResponse.code() == 204 || booleanResponse.code() == 200) { - sendToView(view -> view.showMessage(R.string.success, R.string.successfully_submitted)); - } else { - sendToView(view -> view.showMessage(R.string.error, R.string.network_error)); - } - }); - } - - @Override public void onPinUnpinIssue() { - if (getIssue() == null) return; - PinnedIssues.pinUpin(getIssue()); - sendToView(IssuePagerMvp.View::onUpdateMenu); - } - - private void getIssueFromApi() { - Login loginUser = Login.getUser(); - if (loginUser == null) return; - makeRestCall(RxHelper.getObservable(Observable.zip(RestProvider.getIssueService(isEnterprise()).getIssue(login, repoId, issueNumber), - RestProvider.getRepoService(isEnterprise()).isCollaborator(login, repoId, loginUser.getLogin()), - (issue, booleanResponse) -> { - isCollaborator = booleanResponse.code() == 204; - return issue; - })), this::setupIssue); - } - - private void setupIssue(Issue issue) { - issueModel = issue; - issueModel.setRepoId(repoId); - issueModel.setLogin(login); - sendToView(view -> view.onSetupIssue(false)); - manageDisposable(PinnedIssues.updateEntry(issue.getId())); - } - - private void updateTimeline(IssuePagerMvp.View view, int assignee_added) { - view.showMessage(R.string.success, assignee_added); - view.onUpdateTimeline(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/details/timeline/IssueTimelineFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/details/timeline/IssueTimelineFragment.java deleted file mode 100644 index 3f0103d09..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/details/timeline/IssueTimelineFragment.java +++ /dev/null @@ -1,372 +0,0 @@ -package com.fastaccess.ui.modules.repos.issues.issue.details.timeline; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import android.view.View; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.TimelineModel; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.data.dao.types.ReactionTypes; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.Logger; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.provider.timeline.CommentsHelper; -import com.fastaccess.provider.timeline.ReactionsProvider; -import com.fastaccess.ui.adapter.IssuesTimelineAdapter; -import com.fastaccess.ui.adapter.viewholder.TimelineCommentsViewHolder; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.editor.EditorActivity; -import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment; -import com.fastaccess.ui.modules.repos.issues.issue.details.IssuePagerMvp; -import com.fastaccess.ui.modules.repos.reactions.ReactionsDialogFragment; -import com.fastaccess.ui.widgets.AppbarRefreshLayout; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 31 Mar 2017, 7:35 PM - */ - -public class IssueTimelineFragment extends BaseFragment implements IssueTimelineMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) AppbarRefreshLayout refresh; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @State HashMap toggleMap = new LinkedHashMap<>(); - private IssuesTimelineAdapter adapter; - private OnLoadMore onLoadMore; - private IssuePagerMvp.IssuePrCallback issueCallback; - private CommentEditorFragment.CommentListener commentsCallback; - - @NonNull public static IssueTimelineFragment newInstance(long commentId) { - IssueTimelineFragment fragment = new IssueTimelineFragment(); - fragment.setArguments(Bundler.start().put(BundleConstant.ID, commentId).end()); - return fragment; - } - - @SuppressWarnings("unchecked") @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() instanceof IssuePagerMvp.IssuePrCallback) { - issueCallback = (IssuePagerMvp.IssuePrCallback) getParentFragment(); - } else if (context instanceof IssuePagerMvp.IssuePrCallback) { - issueCallback = (IssuePagerMvp.IssuePrCallback) context; - } else { - throw new IllegalArgumentException(String.format("%s or parent fragment must implement IssuePagerMvp.IssuePrCallback", - context.getClass().getSimpleName())); - } - if (getParentFragment() instanceof CommentEditorFragment.CommentListener) { - commentsCallback = (CommentEditorFragment.CommentListener) getParentFragment(); - } else if (context instanceof CommentEditorFragment.CommentListener) { - commentsCallback = (CommentEditorFragment.CommentListener) context; - } else { - throw new IllegalArgumentException(String.format("%s or parent fragment must implement CommentEditorFragment.CommentListener", - context.getClass().getSimpleName())); - } - } - - @Override public void onDetach() { - issueCallback = null; - commentsCallback = null; - super.onDetach(); - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, getIssue()); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null) { - adapter.subList(1, adapter.getItemCount()); - return; - } - if (page == 1) { - adapter.subList(1, adapter.getItemCount()); - } - adapter.addItems(items); - Logger.e(adapter.getItemCount()); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter()); - } - onLoadMore.setParameter(getIssue()); - return onLoadMore; - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getIssue() == null) { - throw new NullPointerException("Issue went missing!!!"); - } - - getPresenter().setCommentId(getCommentId()); - if (issueCallback != null && issueCallback.getData() != null) { - adapter = new IssuesTimelineAdapter(getPresenter().getEvents(), this, true, - this, issueCallback.getData().getLogin(), issueCallback.getData().getUser().getLogin()); - } else { - adapter = new IssuesTimelineAdapter(getPresenter().getEvents(), this, true, - this, "", ""); - } - recycler.setVerticalScrollBarEnabled(false); - stateLayout.setEmptyText(R.string.no_events); - recycler.setEmptyView(stateLayout, refresh); - refresh.setOnRefreshListener(this); - stateLayout.setOnReloadListener(this); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - fastScroller.setVisibility(View.VISIBLE); - fastScroller.attachRecyclerView(recycler); - recycler.addDivider(TimelineCommentsViewHolder.class); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.addOnScrollListener(getLoadMore()); - if (savedInstanceState == null) { - onSetHeader(TimelineModel.constructHeader(getIssue())); - onRefresh(); - } else if (getPresenter().getEvents().isEmpty() || getPresenter().getEvents().size() == 1) { - onRefresh(); - } - } - - @NonNull @Override public IssueTimelinePresenter providePresenter() { - return new IssueTimelinePresenter(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @Override public void onEditComment(@NonNull Comment item) { - if (getIssue() == null) return; - Intent intent = new Intent(getContext(), EditorActivity.class); - intent.putExtras(Bundler - .start() - .put(BundleConstant.ID, getIssue().getRepoId()) - .put(BundleConstant.EXTRA_TWO, getIssue().getLogin()) - .put(BundleConstant.EXTRA_THREE, getIssue().getNumber()) - .put(BundleConstant.EXTRA_FOUR, item.getId()) - .put(BundleConstant.EXTRA, item.getBody()) - .put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraType.EDIT_ISSUE_COMMENT_EXTRA) - .putStringArrayList("participants", CommentsHelper.getUsersByTimeline(adapter.getData())) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise()) - .end()); - View view = getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler; - ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE); - } - - @Override public void onRemove(@NonNull TimelineModel timelineModel) { - hideProgress(); - adapter.removeItem(timelineModel); - } - - @Override public void onStartNewComment(String text) { - onTagUser(null); - } - - @Override public void onShowDeleteMsg(long id) { - MessageDialogView.newInstance(getString(R.string.delete), getString(R.string.confirm_message), - Bundler.start() - .put(BundleConstant.EXTRA, id) - .put(BundleConstant.YES_NO_EXTRA, true) - .end()) - .show(getChildFragmentManager(), MessageDialogView.TAG); - } - - @Override public void onTagUser(@Nullable User user) { - if (commentsCallback != null) if (user != null) { - commentsCallback.onTagUser(user.getLogin()); - } - } - - @Override public void onReply(User user, String message) { - if (getIssue() == null) return; - Intent intent = new Intent(getContext(), EditorActivity.class); - intent.putExtras(Bundler - .start() - .put(BundleConstant.ID, getIssue().getRepoId()) - .put(BundleConstant.EXTRA_TWO, getIssue().getLogin()) - .put(BundleConstant.EXTRA_THREE, getIssue().getNumber()) - .put(BundleConstant.EXTRA, "@" + user.getLogin()) - .put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraType.NEW_ISSUE_COMMENT_EXTRA) - .putStringArrayList("participants", CommentsHelper.getUsersByTimeline(adapter.getData())) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise()) - .put("message", message) - .end()); - View view = getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler; - ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE); - - } - - @Override public void showReactionsPopup(@NonNull ReactionTypes type, @NonNull String login, - @NonNull String repoId, long idOrNumber, boolean isHeader) { - ReactionsDialogFragment.newInstance(login, repoId, type, idOrNumber, isHeader ? ReactionsProvider.HEADER : ReactionsProvider.COMMENT) - .show(getChildFragmentManager(), "ReactionsDialogFragment"); - } - - @Override public void onSetHeader(@NonNull TimelineModel timelineModel) { - if (adapter != null) { - if (adapter.isEmpty()) { - adapter.addItem(timelineModel, 0); - } else { - adapter.swapItem(timelineModel, 0); - } - } - } - - @Nullable @Override public Issue getIssue() { - return issueCallback.getData(); - } - - @Override public void onUpdateHeader() { - if (getIssue() == null) return; - onSetHeader(TimelineModel.constructHeader(getIssue())); - } - - @Override public void onHandleComment(@NonNull String text, @Nullable Bundle bundle) { - getPresenter().onHandleComment(text, bundle); - } - - @Override public void addNewComment(@NonNull TimelineModel timelineModel) { - onHideBlockingProgress(); - adapter.addItem(timelineModel); - if (commentsCallback != null) commentsCallback.onClearEditText(); - } - - @NonNull @Override public ArrayList getNamesToTag() { - return CommentsHelper.getUsersByTimeline(adapter.getData()); - } - - @Override public void onHideBlockingProgress() { - hideProgress(); - super.hideProgress(); - } - - @Override public long getCommentId() { - return getArguments() != null ? getArguments().getLong(BundleConstant.ID) : 0; - } - - @Override public void addComment(@Nullable TimelineModel timelineModel, int index) { - if (timelineModel != null) { - adapter.addItem(timelineModel, 1); - recycler.smoothScrollToPosition(1); - } else if (index != -1) { - recycler.smoothScrollToPosition(index + 1); - if ((index + 1) > adapter.getItemCount()) { - showMessage(R.string.error, R.string.comment_is_too_far_to_paginate); - } - } - } - - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (resultCode == Activity.RESULT_OK) { - if (requestCode == BundleConstant.REQUEST_CODE) { - if (data == null) { - onRefresh(); - return; - } - Bundle bundle = data.getExtras(); - if (bundle != null) { - boolean isNew = bundle.getBoolean(BundleConstant.EXTRA); - Comment commentsModel = bundle.getParcelable(BundleConstant.ITEM); - if (commentsModel == null) { - onRefresh(); // shit happens, refresh()? - return; - } - adapter.notifyDataSetChanged(); - if (isNew) { - adapter.addItem(TimelineModel.constructComment(commentsModel)); - recycler.smoothScrollToPosition(adapter.getItemCount()); - } else { - int position = adapter.getItem(TimelineModel.constructComment(commentsModel)); - if (position != -1) { - adapter.swapItem(TimelineModel.constructComment(commentsModel), position); - recycler.smoothScrollToPosition(position); - } else { - adapter.addItem(TimelineModel.constructComment(commentsModel)); - recycler.smoothScrollToPosition(adapter.getItemCount()); - } - } - } else { - onRefresh(); // bundle size is too large? refresh the api - } - } - } - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (isOk) { - getPresenter().onHandleDeletion(bundle); - } - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onToggle(long position, boolean isCollapsed) { - toggleMap.put(position, isCollapsed); - } - - @Override public boolean isCollapsed(long position) { - Boolean toggle = toggleMap.get(position); - return toggle != null && toggle; - } - - @Override public boolean isPreviouslyReacted(long id, int vId) { - return getPresenter().isPreviouslyReacted(id, vId); - } - - @Override public boolean isCallingApi(long id, int vId) { - return getPresenter().isCallingApi(id, vId); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/details/timeline/IssueTimelineMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/details/timeline/IssueTimelineMvp.java deleted file mode 100644 index ef6029c41..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/details/timeline/IssueTimelineMvp.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.fastaccess.ui.modules.repos.issues.issue.details.timeline; - -import android.os.Bundle; -import androidx.annotation.IdRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.TimelineModel; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.data.dao.types.ReactionTypes; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.provider.timeline.ReactionsProvider; -import com.fastaccess.ui.adapter.callback.OnToggleView; -import com.fastaccess.ui.adapter.callback.ReactionsCallback; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 31 Mar 2017, 7:15 PM - */ - -public interface IssueTimelineMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener, - OnToggleView, ReactionsCallback { - - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - - void onEditComment(@NonNull Comment item); - - void onRemove(@NonNull TimelineModel timelineModel); - - void onStartNewComment(String text); - - void onShowDeleteMsg(long id); - - void onTagUser(@Nullable User user); - - void onReply(User user, String message); - - void showReactionsPopup(@NonNull ReactionTypes type, @NonNull String login, @NonNull String repoId, long idOrNumber, boolean isHeadre); - - void onSetHeader(@NonNull TimelineModel timelineModel); - - @Nullable Issue getIssue(); - - void onUpdateHeader(); - - void onHandleComment(String text, @Nullable Bundle bundle); - - void addNewComment(@NonNull TimelineModel timelineModel); - - @NonNull ArrayList getNamesToTag(); - - void onHideBlockingProgress(); - - long getCommentId(); - - void addComment(@Nullable TimelineModel timelineModel, int index); - } - - interface Presenter extends BaseMvp.FAPresenter, BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - boolean isPreviouslyReacted(long commentId, int vId); - - @NonNull ArrayList getEvents(); - - void onWorkOffline(); - - void onHandleDeletion(@Nullable Bundle bundle); - - void onHandleReaction(@IdRes int viewId, long id, @ReactionsProvider.ReactionType int reactionType); - - boolean isCallingApi(long id, int vId); - - void onHandleComment(@NonNull String text, @Nullable Bundle bundle); - - void setCommentId(long commentId); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/details/timeline/IssueTimelinePresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/details/timeline/IssueTimelinePresenter.java deleted file mode 100644 index 836b71e53..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/issues/issue/details/timeline/IssueTimelinePresenter.java +++ /dev/null @@ -1,328 +0,0 @@ -package com.fastaccess.ui.modules.repos.issues.issue.details.timeline; - -import android.app.Activity; -import android.net.Uri; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; -import android.widget.PopupMenu; - -import com.fastaccess.R; -import com.fastaccess.data.dao.CommentRequestModel; -import com.fastaccess.data.dao.TimelineModel; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.timeline.GenericEvent; -import com.fastaccess.data.dao.timeline.SourceModel; -import com.fastaccess.data.dao.types.ReactionTypes; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.provider.timeline.CommentsHelper; -import com.fastaccess.provider.timeline.ReactionsProvider; -import com.fastaccess.provider.timeline.TimelineConverter; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.filter.issues.FilterIssuesActivity; -import com.fastaccess.ui.modules.repos.issues.create.CreateIssueActivity; - -import java.util.ArrayList; -import java.util.List; - -import io.reactivex.Observable; -import lombok.Getter; - -/** - * Created by Kosh on 31 Mar 2017, 7:17 PM - */ - -@Getter public class IssueTimelinePresenter extends BasePresenter implements IssueTimelineMvp.Presenter { - private ArrayList timeline = new ArrayList<>(); - private ReactionsProvider reactionsProvider; - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - @com.evernote.android.state.State boolean isCollaborator; - private long commentId; - - @Override public boolean isPreviouslyReacted(long commentId, int vId) { - return getReactionsProvider().isPreviouslyReacted(commentId, vId); - } - - @Override public void onItemClick(int position, View v, TimelineModel item) { - if (getView() != null) { - Issue issue = getView().getIssue(); - if (issue == null) return; - if (item.getType() == TimelineModel.COMMENT) { - if (v.getId() == R.id.commentMenu) { - PopupMenu popupMenu = new PopupMenu(v.getContext(), v); - popupMenu.inflate(R.menu.comments_menu); - String username = Login.getUser().getLogin(); - boolean isOwner = CommentsHelper.isOwner(username, issue.getLogin(), item.getComment().getUser().getLogin()) || isCollaborator; - popupMenu.getMenu().findItem(R.id.delete).setVisible(isOwner); - popupMenu.getMenu().findItem(R.id.edit).setVisible(isOwner); - popupMenu.setOnMenuItemClickListener(item1 -> { - if (getView() == null) return false; - if (item1.getItemId() == R.id.delete) { - getView().onShowDeleteMsg(item.getComment().getId()); - } else if (item1.getItemId() == R.id.reply) { - getView().onReply(item.getComment().getUser(), item.getComment().getBody()); - } else if (item1.getItemId() == R.id.edit) { - getView().onEditComment(item.getComment()); - } else if (item1.getItemId() == R.id.share) { - ActivityHelper.shareUrl(v.getContext(), item.getComment().getHtmlUrl()); - } - return true; - }); - popupMenu.show(); - } else { - onHandleReaction(v.getId(), item.getComment().getId(), ReactionsProvider.COMMENT); - } - } else if (item.getType() == TimelineModel.EVENT) { - GenericEvent issueEventModel = item.getGenericEvent(); - if (issueEventModel.getCommitUrl() != null) { - SchemeParser.launchUri(v.getContext(), Uri.parse(issueEventModel.getCommitUrl())); - } else if (issueEventModel.getLabel() != null) { - FilterIssuesActivity.startActivity(v, issue.getLogin(), issue.getRepoId(), true, - true, isEnterprise(), "label:\"" + issueEventModel.getLabel().getName() + "\""); - } else if (issueEventModel.getMilestone() != null) { - FilterIssuesActivity.startActivity(v, issue.getLogin(), issue.getRepoId(), true, - true, isEnterprise(), "milestone:\"" + issueEventModel.getMilestone().getTitle() + "\""); - } else if (issueEventModel.getAssignee() != null) { - FilterIssuesActivity.startActivity(v, issue.getLogin(), issue.getRepoId(), true, - true, isEnterprise(), "assignee:\"" + issueEventModel.getAssignee().getLogin() + "\""); - } else { - SourceModel sourceModel = issueEventModel.getSource(); - if (sourceModel != null) { - if (sourceModel.getCommit() != null) { - SchemeParser.launchUri(v.getContext(), sourceModel.getCommit().getUrl()); - } else if (sourceModel.getPullRequest() != null) { - SchemeParser.launchUri(v.getContext(), sourceModel.getPullRequest().getUrl()); - } else if (sourceModel.getIssue() != null) { - SchemeParser.launchUri(v.getContext(), sourceModel.getIssue().getHtmlUrl()); - } else if (sourceModel.getRepository() != null) { - SchemeParser.launchUri(v.getContext(), sourceModel.getRepository().getUrl()); - } - } - } - } else if (item.getType() == TimelineModel.HEADER) { - if (v.getId() == R.id.commentMenu) { - PopupMenu popupMenu = new PopupMenu(v.getContext(), v); - popupMenu.inflate(R.menu.comments_menu); - String username = Login.getUser().getLogin(); - boolean isOwner = CommentsHelper.isOwner(username, item.getIssue().getLogin(), - item.getIssue().getUser().getLogin()) || isCollaborator; - popupMenu.getMenu().findItem(R.id.edit).setVisible(isOwner); - popupMenu.setOnMenuItemClickListener(item1 -> { - if (getView() == null) return false; - if (item1.getItemId() == R.id.reply) { - getView().onReply(item.getIssue().getUser(), item.getIssue().getBody()); - } else if (item1.getItemId() == R.id.edit) { - Activity activity = ActivityHelper.getActivity(v.getContext()); - if (activity == null) return false; - CreateIssueActivity.startForResult(activity, - item.getIssue().getLogin(), item.getIssue().getRepoId(), item.getIssue(), isEnterprise()); - } else if (item1.getItemId() == R.id.share) { - ActivityHelper.shareUrl(v.getContext(), item.getIssue().getHtmlUrl()); - } - return true; - }); - popupMenu.show(); - } else { - onHandleReaction(v.getId(), item.getIssue().getNumber(), ReactionsProvider.HEADER); - } - } - } - } - - @Override public void onItemLongClick(int position, View v, TimelineModel item) { - if (getView() == null) return; - if (item.getType() == TimelineModel.COMMENT || item.getType() == TimelineModel.HEADER) { - if (v.getId() == R.id.commentMenu && item.getType() == TimelineModel.COMMENT) { - Comment comment = item.getComment(); - if (getView() != null) getView().onReply(comment.getUser(), comment.getBody()); - } else { - if (getView().getIssue() == null) return; - Issue issue = getView().getIssue(); - String login = issue.getLogin(); - String repoId = issue.getRepoId(); - if (!InputHelper.isEmpty(login) && !InputHelper.isEmpty(repoId)) { - ReactionTypes type = ReactionTypes.get(v.getId()); - if (type != null) { - if (item.getType() == TimelineModel.HEADER) { - getView().showReactionsPopup(type, login, repoId, item.getIssue().getNumber(), true); - } else { - getView().showReactionsPopup(type, login, repoId, item.getComment().getId(), false); - } - } else { - onItemClick(position, v, item); - } - } - } - } else { - onItemClick(position, v, item); - } - } - - @NonNull @Override public ArrayList getEvents() { - return timeline; - } - - @Override public void onWorkOffline() { - //TODO - } - - @Override public void onHandleDeletion(@Nullable Bundle bundle) { - if (bundle != null) { - long commId = bundle.getLong(BundleConstant.EXTRA, 0); - if (commId != 0) { - if (getView() == null || getView().getIssue() == null) return; - Issue issue = getView().getIssue(); - makeRestCall(RestProvider.getIssueService(isEnterprise()).deleteIssueComment(issue.getLogin(), issue.getRepoId(), commId), - booleanResponse -> sendToView(view -> { - if (booleanResponse.code() == 204) { - Comment comment = new Comment(); - comment.setId(commId); - view.onRemove(TimelineModel.constructComment(comment)); - } else { - view.showMessage(R.string.error, R.string.error_deleting_comment); - } - })); - } - } - } - - @Override public void onHandleReaction(int viewId, long id, @ReactionsProvider.ReactionType int reactionType) { - if (getView() == null || getView().getIssue() == null) return; - Issue issue = getView().getIssue(); - String login = issue.getLogin(); - String repoId = issue.getRepoId(); - Observable observable = getReactionsProvider().onHandleReaction(viewId, id, login, repoId, reactionType, isEnterprise()); - if (observable != null) manageObservable(observable); - } - - @Override public boolean isCallingApi(long id, int vId) { - return getReactionsProvider().isCallingApi(id, vId); - } - - @Override public void onHandleComment(@NonNull String text, @Nullable Bundle bundle) { - if (getView() == null) return; - Issue issue = getView().getIssue(); - if (issue != null) { - if (bundle == null) { - CommentRequestModel commentRequestModel = new CommentRequestModel(); - commentRequestModel.setBody(text); - manageDisposable(RxHelper.getObservable(RestProvider.getIssueService(isEnterprise()).createIssueComment(issue.getLogin(), issue - .getRepoId(), - issue.getNumber(), commentRequestModel)) - .doOnSubscribe(disposable -> sendToView(view -> view.showBlockingProgress(0))) - .subscribe(comment -> sendToView(view -> view.addNewComment(TimelineModel.constructComment(comment))), - throwable -> { - onError(throwable); - sendToView(IssueTimelineMvp.View::onHideBlockingProgress); - })); - } - } - } - - @Override public void setCommentId(long commentId) { - this.commentId = commentId; - } - - @NonNull private ReactionsProvider getReactionsProvider() { - if (reactionsProvider == null) { - reactionsProvider = new ReactionsProvider(); - } - return reactionsProvider; - } - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public boolean onCallApi(int page, @Nullable Issue parameter) { - if (parameter == null) { - sendToView(BaseMvp.FAView::hideProgress); - return false; - } - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - if (page > lastPage || lastPage == 0) { - sendToView(IssueTimelineMvp.View::hideProgress); - return false; - } - setCurrentPage(page); - String login = parameter.getLogin(); - String repoId = parameter.getRepoId(); - if (page == 1) { - manageObservable(RestProvider.getRepoService(isEnterprise()).isCollaborator(login, repoId, - Login.getUser().getLogin()) - .doOnNext(booleanResponse -> isCollaborator = booleanResponse.code() == 204)); - } - int number = parameter.getNumber(); - Observable> observable = RestProvider.getIssueService(isEnterprise()) - .getTimeline(login, repoId, number, page) - .flatMap(response -> { - if (response != null) { - lastPage = response.getLast(); - } - return TimelineConverter.INSTANCE.convert(response != null ? response.getItems() : null); - }) - .toList() - .toObservable(); - makeRestCall(observable, timeline -> { - sendToView(view -> view.onNotifyAdapter(timeline, page)); - loadComment(page, commentId, login, repoId, timeline); - }); - return true; - } - - private void loadComment(int page, long commentId, String login, String repoId, List timeline) { - if (page == 1 && commentId > 0) { - Observable observable = Observable.create(source -> { - int index = -1; - if (timeline != null) { - for (int i = 0; i < timeline.size(); i++) { - TimelineModel timelineModel = timeline.get(i); - if (timelineModel.getComment() != null) { - if (timelineModel.getComment().getId() == commentId) { - index = i; - break; - } - } - } - } - TimelineModel timelineModel = new TimelineModel(); - timelineModel.setPosition(index); - source.onNext(timelineModel); - source.onComplete(); - }); - manageObservable(observable.doOnNext(timelineModel -> sendToView(view -> { - if (timelineModel.getComment() != null) { - view.addComment(timelineModel, -1); - } else { - view.addComment(null, timelineModel.getPosition()); - } - }))); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/RepoProjectsFragmentPager.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/projects/RepoProjectsFragmentPager.kt deleted file mode 100644 index 7ab086d8b..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/RepoProjectsFragmentPager.kt +++ /dev/null @@ -1,91 +0,0 @@ -package com.fastaccess.ui.modules.repos.projects - -import android.os.Bundle -import com.google.android.material.tabs.TabLayout -import android.view.View -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.data.dao.FragmentPagerAdapterModel -import com.fastaccess.data.dao.TabsCountStateModel -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.helper.ViewHelper -import com.fastaccess.ui.adapter.FragmentsPagerAdapter -import com.fastaccess.ui.base.BaseFragment -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import com.fastaccess.ui.modules.repos.RepoPagerMvp -import com.fastaccess.ui.widgets.SpannableBuilder -import com.fastaccess.ui.widgets.ViewPagerView - -/** - * Created by kosh on 09/09/2017. - */ -class RepoProjectsFragmentPager : BaseFragment>(), RepoPagerMvp.TabsBadgeListener { - - @BindView(R.id.tabs) lateinit var tabs: TabLayout - @BindView(R.id.pager) lateinit var pager: ViewPagerView - private var counts: HashSet? = null - - override fun fragmentLayout(): Int = R.layout.centered_tabbed_viewpager - - override fun onSaveInstanceState(outState: Bundle) { - super.onSaveInstanceState(outState) - if (counts?.isNotEmpty() == true) { - outState.putSerializable("counts", counts) - } - } - - override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { - val repoId = arguments!!.getString(BundleConstant.ID) - val login = arguments!!.getString(BundleConstant.EXTRA) - if (!login.isNullOrEmpty() && !repoId.isNullOrEmpty()) { - pager.adapter = FragmentsPagerAdapter( - childFragmentManager, FragmentPagerAdapterModel.buildForRepoProjects( - requireContext(), - repoId, login - ) - ) - tabs.setupWithViewPager(pager) - } - if (savedInstanceState != null) { - @Suppress("UNCHECKED_CAST") - counts = savedInstanceState.getSerializable("counts") as? HashSet? - counts?.let { counts -> if (counts.isNotEmpty()) counts.onEach { updateCount(it) } } - } else { - counts = hashSetOf() - } - } - - override fun providePresenter(): BasePresenter = BasePresenter() - - override fun onSetBadge(tabIndex: Int, count: Int) { - val model = TabsCountStateModel() - model.tabIndex = tabIndex - model.count = count - counts?.add(model) - tabs.let { updateCount(model) } - } - - private fun updateCount(model: TabsCountStateModel) { - val tv = ViewHelper.getTabTextView(tabs, model.tabIndex) - tv.text = SpannableBuilder.builder() - .append(if (model.tabIndex == 0) getString(R.string.opened) else getString(R.string.closed)) - .append(" ") - .append("(") - .bold(model.count.toString()) - .append(")") - } - - companion object { - val TAG = RepoProjectsFragmentPager::class.java.simpleName - fun newInstance(login: String, repoId: String? = null): RepoProjectsFragmentPager { - val fragment = RepoProjectsFragmentPager() - fragment.arguments = Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .end() - return fragment - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/columns/ProjectColumnFragment.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/projects/columns/ProjectColumnFragment.kt deleted file mode 100644 index c2613e757..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/columns/ProjectColumnFragment.kt +++ /dev/null @@ -1,265 +0,0 @@ -package com.fastaccess.ui.modules.repos.projects.columns - -import android.content.Context -import android.os.Bundle -import androidx.annotation.StringRes -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout -import android.view.View -import butterknife.BindView -import butterknife.OnClick -import com.fastaccess.R -import com.fastaccess.data.dao.ProjectCardModel -import com.fastaccess.data.dao.ProjectColumnModel -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.helper.Logger -import com.fastaccess.helper.PrefGetter -import com.fastaccess.provider.rest.loadmore.OnLoadMore -import com.fastaccess.ui.adapter.ColumnCardAdapter -import com.fastaccess.ui.base.BaseFragment -import com.fastaccess.ui.modules.main.premium.PremiumActivity -import com.fastaccess.ui.modules.repos.projects.crud.ProjectCurdDialogFragment -import com.fastaccess.ui.modules.repos.projects.details.ProjectPagerMvp -import com.fastaccess.ui.widgets.FontTextView -import com.fastaccess.ui.widgets.StateLayout -import com.fastaccess.ui.widgets.dialog.MessageDialogView -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller - -/** - * Created by Hashemsergani on 11.09.17. - */ -class ProjectColumnFragment : BaseFragment(), ProjectColumnMvp.View { - - @BindView(R.id.recycler) lateinit var recycler: DynamicRecyclerView - @BindView(R.id.refresh) lateinit var refresh: SwipeRefreshLayout - @BindView(R.id.stateLayout) lateinit var stateLayout: StateLayout - @BindView(R.id.fastScroller) lateinit var fastScroller: RecyclerViewFastScroller - @BindView(R.id.columnName) lateinit var columnName: FontTextView - @BindView(R.id.editColumnHolder) lateinit var editColumnHolder: View - @BindView(R.id.editColumn) lateinit var editColumn: View - @BindView(R.id.addCard) lateinit var addCard: View - @BindView(R.id.deleteColumn) lateinit var deleteColumn: View - - private var onLoadMore: OnLoadMore? = null - private val adapter by lazy { ColumnCardAdapter(presenter.getCards(), isOwner()) } - private var pageCallback: ProjectPagerMvp.DeletePageListener? = null - - - override fun onAttach(context: Context) { - super.onAttach(context) - pageCallback = when { - parentFragment is ProjectPagerMvp.DeletePageListener -> parentFragment as ProjectPagerMvp.DeletePageListener - context is ProjectPagerMvp.DeletePageListener -> context - else -> null - } - } - - override fun onDetach() { - pageCallback = null - super.onDetach() - } - - @OnClick(R.id.editColumn) fun onEditColumn() { - if (canEdit()) { - ProjectCurdDialogFragment.newInstance(getColumn()?.name) - .show(childFragmentManager, ProjectCurdDialogFragment.TAG) - } - } - - @OnClick(R.id.deleteColumn) fun onDeleteColumn() { - if (canEdit()) { - MessageDialogView.newInstance( - getString(R.string.delete), getString(R.string.confirm_message), - false, MessageDialogView.getYesNoBundle(context!!) - ) - .show(childFragmentManager, MessageDialogView.TAG) - } - } - - @OnClick(R.id.addCard) fun onAddCard() { - if (canEdit()) { - ProjectCurdDialogFragment.newInstance(isCard = true) - .show(childFragmentManager, ProjectCurdDialogFragment.TAG) - } - } - - override fun onNotifyAdapter(items: List?, page: Int) { - hideProgress() - if (items == null || items.isEmpty()) { - adapter.clear() - return - } - if (page <= 1) { - adapter.insertItems(items) - } else { - adapter.addItems(items) - } - } - - override fun getLoadMore(): OnLoadMore { - if (onLoadMore == null) { - onLoadMore = OnLoadMore(presenter) - } - onLoadMore?.parameter = getColumn()?.id - return onLoadMore!! - } - - override fun providePresenter(): ProjectColumnPresenter = ProjectColumnPresenter() - - override fun fragmentLayout(): Int = R.layout.project_columns_layout - - override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { - getColumn()?.let { column -> - columnName.text = column.name - refresh.setOnRefreshListener { presenter.onCallApi(1, column.id) } - stateLayout.setOnReloadListener { presenter.onCallApi(1, column.id) } - stateLayout.setEmptyText(R.string.no_cards) - recycler.setEmptyView(stateLayout, refresh) - getLoadMore().initialize(presenter.currentPage, presenter.previousTotal) - adapter.listener = presenter - recycler.adapter = adapter - recycler.addOnScrollListener(getLoadMore()) - fastScroller.attachRecyclerView(recycler) - if (presenter.getCards().isEmpty() && !presenter.isApiCalled) { - presenter.onCallApi(1, column.id) - } - addCard.visibility = if (isOwner()) View.VISIBLE else View.GONE - deleteColumn.visibility = if (isOwner()) View.VISIBLE else View.GONE - editColumn.visibility = if (isOwner()) View.VISIBLE else View.GONE - } - } - - override fun showProgress(@StringRes resId: Int) { - refresh.isRefreshing = true - stateLayout.showProgress() - } - - override fun hideProgress() { - refresh.isRefreshing = false - stateLayout.hideProgress() - } - - override fun showErrorMessage(message: String) { - showReload() - super.showErrorMessage(message) - } - - override fun showMessage(titleRes: Int, msgRes: Int) { - showReload() - super.showMessage(titleRes, msgRes) - } - - override fun onScrollTop(index: Int) { - super.onScrollTop(index) - recycler.scrollToPosition(0) - } - - override fun onDestroyView() { - recycler.removeOnScrollListener(getLoadMore()) - super.onDestroyView() - } - - override fun onCreatedOrEdited(text: String, isCard: Boolean, position: Int) { - Logger.e(text, isCard, position) - if (!isCard) { - columnName.text = text - getColumn()?.let { presenter.onEditOrDeleteColumn(text, it) } - } else { - if (position == -1) { - getColumn()?.let { presenter.createCard(text, it.id) } - } else { - presenter.editCard(text, adapter.getItem(position), position) - } - } - } - - override fun onMessageDialogActionClicked(isOk: Boolean, bundle: Bundle?) { - super.onMessageDialogActionClicked(isOk, bundle) - if (isOk) { - if (bundle != null) { - if (bundle.containsKey(BundleConstant.ID)) { - val position = bundle.getInt(BundleConstant.ID) - presenter.onDeleteCard(position, adapter.getItem(position)) - } else { - getColumn()?.let { presenter.onEditOrDeleteColumn(null, it) } - } - } else { - getColumn()?.let { presenter.onEditOrDeleteColumn(null, it) } - } - } - } - - override fun deleteColumn() { - getColumn()?.let { pageCallback?.onDeletePage(it) } - hideBlockingProgress() - } - - override fun showBlockingProgress() { - super.showProgress(0) - } - - override fun hideBlockingProgress() { - super.hideProgress() - } - - override fun isOwner(): Boolean = arguments!!.getBoolean(BundleConstant.EXTRA) - - override fun onDeleteCard(position: Int) { - if (canEdit()) { - val yesNoBundle = MessageDialogView.getYesNoBundle(context!!) - yesNoBundle.putInt(BundleConstant.ID, position) - MessageDialogView.newInstance( - getString(R.string.delete), getString(R.string.confirm_message), - false, yesNoBundle - ).show(childFragmentManager, MessageDialogView.TAG) - } - } - - override fun onEditCard(note: String?, position: Int) { - if (canEdit()) { - ProjectCurdDialogFragment.newInstance(note, true, position) - .show(childFragmentManager, ProjectCurdDialogFragment.TAG) - } - } - - override fun addCard(it: ProjectCardModel) { - hideBlockingProgress() - adapter.addItem(it, 0) - } - - override fun updateCard(response: ProjectCardModel, position: Int) { - hideBlockingProgress() - adapter.swapItem(response, position) - } - - override fun onRemoveCard(position: Int) { - hideBlockingProgress() - adapter.removeItem(position) - } - - private fun showReload() { - hideProgress() - stateLayout.showReload(adapter.itemCount) - } - - private fun getColumn(): ProjectColumnModel? = arguments?.getParcelable(BundleConstant.ITEM) - - private fun canEdit(): Boolean = if (PrefGetter.isProEnabled() || PrefGetter.isAllFeaturesUnlocked()) { - true - } else { - PremiumActivity.startActivity(context!!) - false - } - - companion object { - fun newInstance(column: ProjectColumnModel, isCollaborator: Boolean): ProjectColumnFragment { - val fragment = ProjectColumnFragment() - fragment.arguments = Bundler.start() - .put(BundleConstant.ITEM, column) - .put(BundleConstant.EXTRA, isCollaborator) - .end() - return fragment - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/columns/ProjectColumnMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/projects/columns/ProjectColumnMvp.kt deleted file mode 100644 index ddab0e47a..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/columns/ProjectColumnMvp.kt +++ /dev/null @@ -1,36 +0,0 @@ -package com.fastaccess.ui.modules.repos.projects.columns - -import com.fastaccess.data.dao.ProjectCardModel -import com.fastaccess.data.dao.ProjectColumnModel -import com.fastaccess.provider.rest.loadmore.OnLoadMore -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.modules.repos.projects.crud.ProjectCurdDialogFragment -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created by Hashemsergani on 11.09.17. - */ - -interface ProjectColumnMvp { - interface View : BaseMvp.FAView, ProjectCurdDialogFragment.OnProjectEditedCallback { - fun onNotifyAdapter(items: List?, page: Int) - fun getLoadMore(): OnLoadMore - fun deleteColumn() - fun showBlockingProgress() - fun hideBlockingProgress() - fun isOwner(): Boolean - fun onDeleteCard(position: Int) - fun onEditCard(note: String?, position: Int) - fun addCard(it: ProjectCardModel) - fun updateCard(response: ProjectCardModel, position: Int) - fun onRemoveCard(position: Int) - } - - interface Presenter : BaseViewHolder.OnItemClickListener, BaseMvp.PaginationListener { - fun getCards(): ArrayList - fun onEditOrDeleteColumn(text: String? = null, column: ProjectColumnModel) - fun onDeleteCard(position: Int, card: ProjectCardModel) - fun createCard(text: String, columnId: Long) - fun editCard(text: String, card: ProjectCardModel, position: Int) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/columns/ProjectColumnPresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/projects/columns/ProjectColumnPresenter.kt deleted file mode 100644 index cdfde9c69..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/columns/ProjectColumnPresenter.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.fastaccess.ui.modules.repos.projects.columns - -import android.view.View -import android.widget.PopupMenu -import com.fastaccess.R -import com.fastaccess.data.dao.ProjectCardModel -import com.fastaccess.data.dao.ProjectColumnModel -import com.fastaccess.helper.ActivityHelper -import com.fastaccess.helper.AppHelper -import com.fastaccess.helper.Logger -import com.fastaccess.helper.RxHelper -import com.fastaccess.provider.rest.RestProvider -import com.fastaccess.provider.scheme.SchemeParser -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import java.util.* - -/** - * Created by Hashemsergani on 11.09.17. - */ - -class ProjectColumnPresenter : BasePresenter(), ProjectColumnMvp.Presenter { - - private val projects = ArrayList() - private var page: Int = 0 - private var previousTotal: Int = 0 - private var lastPage = Integer.MAX_VALUE - - override fun onItemClick(position: Int, v: View, item: ProjectCardModel) { - if (v.id == R.id.editCard) { - view?.let { - val popupMenu = PopupMenu(v.context, v) - popupMenu.inflate(R.menu.project_card_menu) - popupMenu.menu.findItem(R.id.share).isVisible = !item.contentUrl.isNullOrBlank() - popupMenu.menu.findItem(R.id.copy).isVisible = !item.contentUrl.isNullOrBlank() - popupMenu.menu.findItem(R.id.edit).isVisible = it.isOwner() && !item.note.isNullOrBlank() - popupMenu.menu.findItem(R.id.delete).isVisible = it.isOwner() && !item.note.isNullOrBlank() - popupMenu.setOnMenuItemClickListener { - when (it.itemId) { - R.id.edit -> sendToView { it.onEditCard(item.note, position) } - R.id.delete -> sendToView { it.onDeleteCard(position) } - R.id.share -> if (!item.contentUrl.isNullOrBlank()) { - ActivityHelper.shareUrl(v.context, item.contentUrl) - } - R.id.copy -> if (!item.contentUrl.isNullOrBlank()) { - AppHelper.copyToClipboard(v.context, item.contentUrl) - } - } - return@setOnMenuItemClickListener true - } - popupMenu.show() - } - } else { - if (!item.contentUrl.isNullOrBlank()) { - SchemeParser.launchUri(v.context, item.contentUrl) - } - } - } - - override fun onItemLongClick(position: Int, v: View?, item: ProjectCardModel?) {} - - override fun getCards(): ArrayList = projects - - override fun getCurrentPage(): Int = page - - override fun getPreviousTotal(): Int = previousTotal - - override fun setCurrentPage(page: Int) { - this.page = page - } - - override fun setPreviousTotal(previousTotal: Int) { - this.previousTotal = previousTotal - } - - override fun onCallApi(page: Int, parameter: Long?): Boolean { - if (page == 1) { - lastPage = Integer.MAX_VALUE - sendToView { view -> view.getLoadMore().reset() } - } - if (page > lastPage || lastPage == 0) { - sendToView({ it.hideProgress() }) - return false - } - currentPage = page - makeRestCall(RestProvider.getProjectsService(isEnterprise).getProjectCards(parameter!!, page), - { response -> - lastPage = response.last - Logger.e(response.items as List?) - sendToView({ it.onNotifyAdapter(response.items, page) }) - }) - return true - } - - override fun onEditOrDeleteColumn(text: String?, column: ProjectColumnModel) { - if (text.isNullOrBlank()) { - manageDisposable(RxHelper.getObservable(RestProvider.getProjectsService(isEnterprise).deleteColumn(column.id)) - .doOnSubscribe { - showBlockingProgress() - } - .subscribe({ - if (it.code() == 204) { - sendToView { it.deleteColumn() } - } else { - sendToView { it.showMessage(R.string.error, R.string.network_error) } - } - }, { - hideBlockingProgress() - onError(it) - })) - } else { - val body = ProjectColumnModel() - body.name = text - manageDisposable(RxHelper.getObservable(RestProvider.getProjectsService(isEnterprise).updateColumn(column.id, body)) - .doOnSubscribe { - showBlockingProgress() - } - .subscribe({ - hideBlockingProgress() - }, { - hideBlockingProgress() - onError(it) - })) - } - } - - override fun onDeleteCard(position: Int, card: ProjectCardModel) { - manageDisposable(RxHelper.getObservable(RestProvider.getProjectsService(isEnterprise).deleteCard(card.id.toLong())) - .doOnSubscribe { - showBlockingProgress() - } - .subscribe({ - if (it.code() == 204) { - sendToView { it.onRemoveCard(position) } - } else { - sendToView { it.showMessage(R.string.error, R.string.network_error) } - } - }, { - hideBlockingProgress() - onError(it) - })) - } - - override fun createCard(text: String, columnId: Long) { - val body = ProjectCardModel() - body.note = text - manageDisposable(RxHelper.getObservable(RestProvider.getProjectsService(isEnterprise).createCard(columnId, body)) - .doOnSubscribe { - showBlockingProgress() - } - .subscribe({ response -> - sendToView { it.addCard(response) } - }, { - hideBlockingProgress() - onError(it) - })) - } - - override fun editCard(text: String, card: ProjectCardModel, position: Int) { - val body = ProjectCardModel() - body.note = text - manageDisposable(RxHelper.getObservable(RestProvider.getProjectsService(isEnterprise).updateCard(card.id.toLong(), body)) - .doOnSubscribe { - showBlockingProgress() - } - .subscribe({ response -> - sendToView { it.updateCard(response, position) } - }, { - hideBlockingProgress() - onError(it) - })) - } - - private fun showBlockingProgress() { - sendToView({ v -> v.showBlockingProgress() }) - } - - private fun hideBlockingProgress() { - sendToView({ v -> v.hideBlockingProgress() }) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/crud/ProjectCurdDialogFragment.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/projects/crud/ProjectCurdDialogFragment.kt deleted file mode 100644 index 1304fb2d0..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/crud/ProjectCurdDialogFragment.kt +++ /dev/null @@ -1,120 +0,0 @@ -package com.fastaccess.ui.modules.repos.projects.crud - -import android.annotation.SuppressLint -import android.content.Context -import android.os.Bundle -import androidx.fragment.app.FragmentManager -import androidx.appcompat.widget.Toolbar -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.view.WindowManager -import android.widget.EditText -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.helper.InputHelper -import com.fastaccess.provider.emoji.Emoji -import com.fastaccess.ui.base.BaseDialogFragment -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import com.fastaccess.ui.modules.editor.emoji.EmojiMvp -import com.fastaccess.ui.modules.editor.popup.EditorLinkImageMvp -import com.fastaccess.ui.widgets.markdown.MarkDownLayout -import com.fastaccess.ui.widgets.markdown.MarkdownEditText - -/** - * Created by Hashemsergani on 15.09.17. - */ - -class ProjectCurdDialogFragment : BaseDialogFragment>(), - EditorLinkImageMvp.EditorLinkCallback, MarkDownLayout.MarkdownListener, EmojiMvp.EmojiCallback { - - @BindView(R.id.editText) lateinit var editText: MarkdownEditText - @BindView(R.id.toolbar) lateinit var toolbar: Toolbar - @BindView(R.id.markDownLayout) lateinit var markDownLayout: MarkDownLayout - - private var onProjectEditedCallback: OnProjectEditedCallback? = null - - override fun onAttach(context: Context) { - super.onAttach(context) - onProjectEditedCallback = when { - parentFragment is OnProjectEditedCallback -> parentFragment as OnProjectEditedCallback - context is OnProjectEditedCallback -> context - else -> throw NullPointerException("${context::class.java.simpleName} most implement OnProjectEditedCallback") - } - } - - override fun onDetach() { - onProjectEditedCallback = null - super.onDetach() - } - - override fun fragmentLayout(): Int = R.layout.edit_project_column_note_layout - - override fun providePresenter(): BasePresenter = BasePresenter() - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN) - return super.onCreateView(inflater, container, savedInstanceState) - } - - override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { - markDownLayout.markdownListener = this - toolbar.inflateMenu(R.menu.done_menu) - toolbar.menu.findItem(R.id.submit)?.setIcon(R.drawable.ic_done) - toolbar.setNavigationIcon(R.drawable.ic_clear) - toolbar.setNavigationOnClickListener { dismiss() } - val position: Int = arguments!!.getInt(BundleConstant.ID, -1) - val isCard: Boolean = arguments!!.getBoolean(BundleConstant.EXTRA) - if (savedInstanceState == null) { - editText.setText(arguments?.getString(BundleConstant.ITEM) ?: "") - } - toolbar.setOnMenuItemClickListener { - if (it.itemId == R.id.submit) { - val isEmpty = editText.text.isNullOrBlank() - editText.error = if (isEmpty) getString(R.string.required_field) else null - if (!isEmpty) { - onProjectEditedCallback?.onCreatedOrEdited(InputHelper.toString(editText), isCard, position) - dismiss() - } - } - return@setOnMenuItemClickListener true - } - } - - override fun getEditText(): EditText = editText - - override fun fragmentManager(): FragmentManager = childFragmentManager - - override fun getSavedText(): CharSequence? = editText.savedText - - override fun onAppendLink(title: String?, link: String?, isLink: Boolean) { - markDownLayout.onAppendLink(title, link, isLink) - } - - @SuppressLint("SetTextI18n") - override fun onEmojiAdded(emoji: Emoji?) { - markDownLayout.onEmojiAdded(emoji) - } - - companion object { - val TAG = ProjectCurdDialogFragment::class.java.simpleName - - fun newInstance(text: String? = null, isCard: Boolean = false, position: Int = -1): ProjectCurdDialogFragment { - val fragment = ProjectCurdDialogFragment() - fragment.arguments = Bundler.start() - .put(BundleConstant.ITEM, text) - .put(BundleConstant.EXTRA, isCard) - .put(BundleConstant.ID, position) - .end() - return fragment - } - } - - interface OnProjectEditedCallback { - fun onCreatedOrEdited(text: String, isCard: Boolean, position: Int) - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/details/ProjectPagerActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/projects/details/ProjectPagerActivity.kt deleted file mode 100644 index ba19c2d4c..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/details/ProjectPagerActivity.kt +++ /dev/null @@ -1,149 +0,0 @@ -package com.fastaccess.ui.modules.repos.projects.details - -import android.content.Context -import android.content.Intent -import android.os.Bundle -import androidx.viewpager.widget.ViewPager -import android.view.MenuItem -import android.view.View -import android.widget.ProgressBar -import butterknife.BindView -import com.evernote.android.state.State -import com.fastaccess.R -import com.fastaccess.data.dao.FragmentPagerAdapterModel -import com.fastaccess.data.dao.NameParser -import com.fastaccess.data.dao.ProjectColumnModel -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.ui.adapter.FragmentsPagerAdapter -import com.fastaccess.ui.base.BaseActivity -import com.fastaccess.ui.modules.repos.RepoPagerActivity -import com.fastaccess.ui.modules.user.UserPagerActivity -import com.fastaccess.ui.widgets.CardsPagerTransformerBasic - -/** - * Created by Hashemsergani on 11.09.17. - */ - -class ProjectPagerActivity : BaseActivity(), ProjectPagerMvp.View { - - @BindView(R.id.pager) lateinit var pager: ViewPager - @BindView(R.id.loading) lateinit var loading: ProgressBar - @State var isProgressShowing = false - - override fun canBack(): Boolean = true - - override fun isSecured(): Boolean = false - - override fun providePresenter(): ProjectPagerPresenter = ProjectPagerPresenter() - - override fun onInitPager(list: List) { - hideProgress() - pager.adapter = FragmentsPagerAdapter(supportFragmentManager, FragmentPagerAdapterModel - .buildForProjectColumns(list, presenter.viewerCanUpdate)) - } - - override fun showMessage(titleRes: Int, msgRes: Int) { - hideProgress() - super.showMessage(titleRes, msgRes) - } - - override fun showMessage(titleRes: String, msgRes: String) { - hideProgress() - super.showMessage(titleRes, msgRes) - } - - override fun showErrorMessage(msgRes: String) { - hideProgress() - super.showErrorMessage(msgRes) - } - - override fun showProgress(resId: Int) { - isProgressShowing = true - loading.visibility = View.VISIBLE - } - - override fun hideProgress() { - isProgressShowing = false - loading.visibility = View.GONE - } - - override fun layout(): Int = R.layout.projects_activity_layout - - override fun isTransparent(): Boolean = true - - override fun onOptionsItemSelected(item: MenuItem?): Boolean { - return when (item?.itemId) { - android.R.id.home -> { - val repoId = presenter.repoId - if (repoId != null && !repoId.isNullOrBlank()) { - if (!presenter.login.isBlank()) { - val nameParse = NameParser("") - nameParse.name = presenter.repoId - nameParse.username = presenter.login - nameParse.isEnterprise = isEnterprise - RepoPagerActivity.startRepoPager(this, nameParse) - } - } else if (!presenter.login.isBlank()) { - UserPagerActivity.startActivity(this, presenter.login, true, isEnterprise, 0) - } - finish() - true - } - else -> super.onOptionsItemSelected(item) - } - } - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - if (isProgressShowing) { - showProgress(0) - } else { - hideProgress() - } - pager.clipToPadding = false - val partialWidth = resources.getDimensionPixelSize(R.dimen.spacing_xs_large) - val pageMargin = resources.getDimensionPixelSize(R.dimen.spacing_normal) - val pagerPadding = partialWidth + pageMargin - pager.pageMargin = pageMargin - pager.setPageTransformer(true, CardsPagerTransformerBasic(4, 10)) - pager.setPadding(pagerPadding, pagerPadding, pagerPadding, pagerPadding) - - if (savedInstanceState == null) { - presenter.onActivityCreated(intent) - } else if (presenter.getColumns().isEmpty() && !presenter.isApiCalled) { - presenter.onRetrieveColumns() - } else { - onInitPager(presenter.getColumns()) - } - if (presenter.repoId.isNullOrBlank()) { - toolbar?.subtitle = presenter.login - } else { - toolbar?.subtitle = "${presenter.login}/${presenter.repoId}" - } - } - - override fun onDeletePage(model: ProjectColumnModel) { - presenter.getColumns().remove(model) - onInitPager(presenter.getColumns()) - } - - companion object { - fun startActivity(context: Context, login: String, repoId: String? = null, projectId: Long, isEnterprise: Boolean = false) { - context.startActivity(getIntent(context, login, repoId, projectId, isEnterprise)) - } - - fun getIntent(context: Context, login: String, repoId: String? = null, projectId: Long, isEnterprise: Boolean = false): Intent { - val intent = Intent(context, ProjectPagerActivity::class.java) - intent.putExtras(Bundler.start() - .put(BundleConstant.ID, projectId) - .put(BundleConstant.ITEM, repoId) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .end()) - return intent - } - - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/details/ProjectPagerMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/projects/details/ProjectPagerMvp.kt deleted file mode 100644 index 636bdb9a0..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/details/ProjectPagerMvp.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.fastaccess.ui.modules.repos.projects.details - -import android.content.Intent -import com.fastaccess.data.dao.ProjectColumnModel -import com.fastaccess.ui.base.mvp.BaseMvp - -/** - * Created by Hashemsergani on 11.09.17. - */ -interface ProjectPagerMvp { - - interface View : BaseMvp.FAView, DeletePageListener { - fun onInitPager(list: List) - } - - interface Presenter { - fun onActivityCreated(intent: Intent?) - - fun onRetrieveColumns() - - fun getColumns(): ArrayList - } - - interface DeletePageListener { - fun onDeletePage(model: ProjectColumnModel) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/details/ProjectPagerPresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/projects/details/ProjectPagerPresenter.kt deleted file mode 100644 index 8221fe2d5..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/details/ProjectPagerPresenter.kt +++ /dev/null @@ -1,87 +0,0 @@ -package com.fastaccess.ui.modules.repos.projects.details - -import android.content.Intent -import com.fastaccess.R -import com.fastaccess.data.dao.Pageable -import com.fastaccess.data.dao.ProjectColumnModel -import com.fastaccess.data.dao.model.Login -import com.fastaccess.helper.BundleConstant -import com.fastaccess.provider.rest.RestProvider -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import io.reactivex.Observable -import io.reactivex.functions.BiFunction -import retrofit2.Response - -/** - * Created by Hashemsergani on 11.09.17. - */ -class ProjectPagerPresenter : BasePresenter(), ProjectPagerMvp.Presenter { - - private val columns = arrayListOf() - @com.evernote.android.state.State var projectId: Long = -1 - @com.evernote.android.state.State var repoId: String? = null - @com.evernote.android.state.State var login: String = "" - @com.evernote.android.state.State var viewerCanUpdate: Boolean = false - - override fun onError(throwable: Throwable) { - val code = RestProvider.getErrorCode(throwable) - if (code == 404) { - sendToView { it.onOpenUrlInBrowser() } - } - super.onError(throwable) - } - - override fun getColumns(): ArrayList = columns - - override fun onRetrieveColumns() { - val repoId = repoId - if (repoId != null && !repoId.isNullOrBlank()) { - makeRestCall(Observable.zip(RestProvider.getProjectsService(isEnterprise).getProjectColumns(projectId), - RestProvider.getRepoService(isEnterprise).isCollaborator(login, repoId, Login.getUser().login), - BiFunction { items: Pageable, response: Response -> - viewerCanUpdate = response.code() == 204 - return@BiFunction items - }) - .flatMap { - if (it.items != null) { - return@flatMap Observable.just(it.items) - } - return@flatMap Observable.just(listOf()) - }) { t -> - columns.clear() - columns.addAll(t) - sendToView { it.onInitPager(columns) } - } - } else { - makeRestCall(RestProvider.getProjectsService(isEnterprise).getProjectColumns(projectId) - .flatMap { - if (it.items != null) { - return@flatMap Observable.just(it.items) - } - return@flatMap Observable.just(listOf()) - }) { t -> - columns.clear() - columns.addAll(t) - sendToView { it.onInitPager(columns) } - } - } - } - - override fun onActivityCreated(intent: Intent?) { - intent?.let { - it.extras?.let { - projectId = it.getLong(BundleConstant.ID) - repoId = it.getString(BundleConstant.ITEM) - login = it.getString(BundleConstant.EXTRA) ?: "" - } - } - if (columns.isEmpty()) { - if (projectId > 0) - onRetrieveColumns() - else - sendToView { it.showMessage(R.string.error, R.string.unexpected_error) } - } else { - sendToView { it.onInitPager(columns) } - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/list/RepoProjectFragment.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/projects/list/RepoProjectFragment.kt deleted file mode 100644 index ba936b2fd..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/list/RepoProjectFragment.kt +++ /dev/null @@ -1,145 +0,0 @@ -package com.fastaccess.ui.modules.repos.projects.list - -import android.content.Context -import android.os.Bundle -import androidx.annotation.StringRes -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout -import android.view.View -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.data.dao.types.IssueState -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.provider.rest.loadmore.OnLoadMore -import com.fastaccess.ui.adapter.ProjectsAdapter -import com.fastaccess.ui.base.BaseFragment -import com.fastaccess.ui.modules.repos.RepoPagerMvp -import com.fastaccess.ui.widgets.StateLayout -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller -import github.RepoProjectsOpenQuery - -/** - * Created by kosh on 09/09/2017. - */ - -class RepoProjectFragment : BaseFragment(), RepoProjectMvp.View { - - @BindView(R.id.recycler) lateinit var recycler: DynamicRecyclerView - @BindView(R.id.refresh) lateinit var refresh: SwipeRefreshLayout - @BindView(R.id.stateLayout) lateinit var stateLayout: StateLayout - @BindView(R.id.fastScroller) lateinit var fastScroller: RecyclerViewFastScroller - private var onLoadMore: OnLoadMore? = null - private val adapter by lazy { ProjectsAdapter(presenter.getProjects()) } - private var badgeListener: RepoPagerMvp.TabsBadgeListener? = null - - override fun onAttach(context: Context) { - super.onAttach(context) - if (parentFragment is RepoPagerMvp.TabsBadgeListener) { - badgeListener = parentFragment as RepoPagerMvp.TabsBadgeListener - } else if (context is RepoPagerMvp.TabsBadgeListener) { - badgeListener = context - } - } - - override fun onDetach() { - badgeListener = null - super.onDetach() - } - - override fun providePresenter(): RepoProjectPresenter = RepoProjectPresenter() - - override fun onNotifyAdapter(items: List?, page: Int) { - hideProgress() - if (items == null || items.isEmpty()) { - adapter.clear() - return - } - if (page <= 1) { - adapter.insertItems(items) - } else { - adapter.addItems(items) - } - } - - override fun onChangeTotalCount(count: Int) { - badgeListener?.onSetBadge(if (getState() == IssueState.open) 0 else 1, count) - } - - override fun getLoadMore(): OnLoadMore { - if (onLoadMore == null) { - onLoadMore = OnLoadMore(presenter) - } - onLoadMore!!.parameter = getState() - return onLoadMore!! - } - - override fun fragmentLayout(): Int = R.layout.micro_grid_refresh_list - - override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { - stateLayout.setEmptyText(R.string.no_projects) - stateLayout.setOnReloadListener({ presenter.onCallApi(1, getState()) }) - refresh.setOnRefreshListener({ presenter.onCallApi(1, getState()) }) - recycler.setEmptyView(stateLayout, refresh) - getLoadMore().initialize(presenter.currentPage, presenter - .previousTotal) - adapter.listener = presenter - recycler.adapter = adapter - recycler.addDivider() - recycler.addOnScrollListener(getLoadMore()) - fastScroller.attachRecyclerView(recycler) - if (presenter.getProjects().isEmpty() && !presenter.isApiCalled) { - presenter.onFragmentCreate(arguments) - presenter.onCallApi(1, getState()) - } - } - - override fun showProgress(@StringRes resId: Int) { - refresh.isRefreshing = true - stateLayout.showProgress() - } - - override fun hideProgress() { - refresh.isRefreshing = false - stateLayout.hideProgress() - } - - override fun showErrorMessage(message: String) { - showReload() - super.showErrorMessage(message) - } - - override fun showMessage(titleRes: Int, msgRes: Int) { - showReload() - super.showMessage(titleRes, msgRes) - } - - override fun onScrollTop(index: Int) { - super.onScrollTop(index) - recycler?.scrollToPosition(0) - } - - override fun onDestroyView() { - recycler.removeOnScrollListener(getLoadMore()) - super.onDestroyView() - } - - private fun showReload() { - hideProgress() - stateLayout.showReload(adapter.itemCount) - } - - private fun getState(): IssueState = arguments!!.getSerializable(BundleConstant.EXTRA_TYPE) as IssueState - - companion object { - fun newInstance(login: String, repoId: String? = null, state: IssueState): RepoProjectFragment { - val fragment = RepoProjectFragment() - fragment.arguments = Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.EXTRA_TYPE, state) - .end() - return fragment - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/list/RepoProjectMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/projects/list/RepoProjectMvp.kt deleted file mode 100644 index 59db03396..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/list/RepoProjectMvp.kt +++ /dev/null @@ -1,29 +0,0 @@ -package com.fastaccess.ui.modules.repos.projects.list - -import android.os.Bundle -import com.fastaccess.data.dao.types.IssueState -import com.fastaccess.provider.rest.loadmore.OnLoadMore -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder -import github.RepoProjectsOpenQuery -import java.util.* - -/** - * Created by kosh on 09/09/2017. - */ -interface RepoProjectMvp { - - interface View : BaseMvp.FAView { - fun onNotifyAdapter(items: List?, page: Int) - fun getLoadMore(): OnLoadMore - fun onChangeTotalCount(count: Int) - } - - interface Presenter : BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - fun onFragmentCreate(bundle: Bundle?) - - fun getProjects(): ArrayList - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/list/RepoProjectPresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/projects/list/RepoProjectPresenter.kt deleted file mode 100644 index 826d85a10..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/projects/list/RepoProjectPresenter.kt +++ /dev/null @@ -1,228 +0,0 @@ -package com.fastaccess.ui.modules.repos.projects.list - -import android.os.Bundle -import android.view.View -import com.apollographql.apollo.rx2.Rx2Apollo -import com.fastaccess.data.dao.types.IssueState -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Logger -import com.fastaccess.provider.rest.ApolloProdivder -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import com.fastaccess.ui.modules.repos.projects.details.ProjectPagerActivity -import github.OrgProjectsClosedQuery -import github.OrgProjectsOpenQuery -import github.RepoProjectsClosedQuery -import github.RepoProjectsOpenQuery -import io.reactivex.Observable - -/** - * Created by kosh on 09/09/2017. - */ -class RepoProjectPresenter : BasePresenter(), RepoProjectMvp.Presenter { - - private val projects = arrayListOf() - private var page: Int = 0 - private var previousTotal: Int = 0 - private var lastPage = Integer.MAX_VALUE - @com.evernote.android.state.State var login: String = "" - @com.evernote.android.state.State var repoId: String? = null - var count: Int = 0 - val pages = arrayListOf() - - override fun onItemClick(position: Int, v: View, item: RepoProjectsOpenQuery.Node) { - item.databaseId()?.let { - ProjectPagerActivity.startActivity(v.context, login, repoId, it.toLong(), isEnterprise) - } - } - - override fun onItemLongClick(position: Int, v: View?, item: RepoProjectsOpenQuery.Node?) {} - - override fun onFragmentCreate(bundle: Bundle?) { - bundle?.let { - repoId = it.getString(BundleConstant.ID) - login = it.getString(BundleConstant.EXTRA) ?: "" - } - } - - override fun getProjects(): ArrayList = projects - - override fun getCurrentPage(): Int = page - - override fun getPreviousTotal(): Int = previousTotal - - override fun setCurrentPage(page: Int) { - this.page = page - } - - override fun setPreviousTotal(previousTotal: Int) { - this.previousTotal = previousTotal - } - - override fun onCallApi(page: Int, parameter: IssueState?): Boolean { - if (page == 1) { - lastPage = Integer.MAX_VALUE - sendToView { view -> view.getLoadMore().reset() } - } - if (page > lastPage || lastPage == 0 || parameter == null) { - sendToView({ it.hideProgress() }) - return false - } - currentPage = page - Logger.e(login) - val repoId = repoId - val apollo = ApolloProdivder.getApollo(isEnterprise) - if (repoId != null && !repoId.isNullOrBlank()) { - if (parameter == IssueState.open) { - val query = RepoProjectsOpenQuery.builder() - .name(repoId) - .owner(login) - .page(getPage()) - .build() - makeRestCall(Rx2Apollo.from(apollo.query(query)) - .flatMap { response -> - val list = arrayListOf() - response.data()?.repository()?.let { repos -> - repos.projects().let { - lastPage = if (it.pageInfo().hasNextPage()) Int.MAX_VALUE else 0 - pages.clear() - count = it.totalCount() - it.edges()?.let { - pages.addAll(it.map { it.cursor() }) - } - it.nodes()?.let { - list.addAll(it) - } - } - } - return@flatMap Observable.just(list) - } - ) { - sendToView { v -> - v.onNotifyAdapter(it, page) - if (page == 1) v.onChangeTotalCount(count) - } - } - } else { - val query = RepoProjectsClosedQuery.builder() - .name(repoId) - .owner(login) - .page(getPage()) - .build() - makeRestCall(Rx2Apollo.from(apollo.query(query)) - .flatMap { response -> - val list = arrayListOf() - response.data()?.repository()?.let { repository -> - repository.projects().let { projects1 -> - lastPage = if (projects1.pageInfo().hasNextPage()) Int.MAX_VALUE else 0 - pages.clear() - count = projects1.totalCount() - projects1.edges()?.let { edges -> - pages.addAll(edges.map { it.cursor() }) - } - projects1.nodes()?.let { nodesList -> - val toConvert = arrayListOf() - nodesList.onEach { - val columns = RepoProjectsOpenQuery.Columns(it.columns().__typename(), it.columns().totalCount()) - val node = RepoProjectsOpenQuery.Node( - it.__typename(), it.name(), it.number(), it.body(), - it.createdAt(), it.id(), it.viewerCanUpdate(), columns, it.databaseId() - ) - toConvert.add(node) - } - list.addAll(toConvert) - } - } - } - return@flatMap Observable.just(list) - } - ) { - sendToView { v -> - v.onNotifyAdapter(it, page) - if (page == 1) v.onChangeTotalCount(count) - } - } - } - } else { - if (parameter == IssueState.open) { - val query = OrgProjectsOpenQuery.builder() - .owner(login) - .page(getPage()) - .build() - makeRestCall(Rx2Apollo.from(apollo.query(query)) - .flatMap { - val list = arrayListOf() - it.data()?.organization()?.let { - it.projects().let { - lastPage = if (it.pageInfo().hasNextPage()) Int.MAX_VALUE else 0 - pages.clear() - count = it.totalCount() - it.edges()?.let { - pages.addAll(it.map { it.cursor() }) - } - it.nodes()?.let { - val toConvert = arrayListOf() - it.onEach { - val columns = RepoProjectsOpenQuery.Columns(it.columns().__typename(), it.columns().totalCount()) - val node = RepoProjectsOpenQuery.Node( - it.__typename(), it.name(), it.number(), it.body(), - it.createdAt(), it.id(), it.viewerCanUpdate(), columns, it.databaseId() - ) - toConvert.add(node) - } - list.addAll(toConvert) - } - } - } - return@flatMap Observable.just(list) - } - ) { - sendToView { v -> - v.onNotifyAdapter(it, page) - if (page == 1) v.onChangeTotalCount(count) - } - } - } else { - val query = OrgProjectsClosedQuery.builder() - .owner(login) - .page(getPage()) - .build() - makeRestCall(Rx2Apollo.from(apollo.query(query)) - .flatMap { - val list = arrayListOf() - it.data()?.organization()?.let { - it.projects().let { - lastPage = if (it.pageInfo().hasNextPage()) Int.MAX_VALUE else 0 - pages.clear() - count = it.totalCount() - it.edges()?.let { - pages.addAll(it.map { it.cursor() }) - } - it.nodes()?.let { - val toConvert = arrayListOf() - it.onEach { - val columns = RepoProjectsOpenQuery.Columns(it.columns().__typename(), it.columns().totalCount()) - val node = RepoProjectsOpenQuery.Node( - it.__typename(), it.name(), it.number(), it.body(), - it.createdAt(), it.id(), it.viewerCanUpdate(), columns, it.databaseId() - ) - toConvert.add(node) - } - list.addAll(toConvert) - } - } - } - return@flatMap Observable.just(list) - } - ) { - sendToView { v -> - v.onNotifyAdapter(it, page) - if (page == 1) v.onChangeTotalCount(count) - } - } - } - } - return true - } - - private fun getPage(): String? = if (pages.isNotEmpty()) pages.last() else null -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/RepoPullRequestPagerFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/RepoPullRequestPagerFragment.java deleted file mode 100644 index e96a34f63..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/RepoPullRequestPagerFragment.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.tabs.TabLayout; -import androidx.fragment.app.Fragment; -import android.view.View; -import android.widget.TextView; - -import com.annimon.stream.Stream; -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.FragmentPagerAdapterModel; -import com.fastaccess.data.dao.TabsCountStateModel; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.ui.adapter.FragmentsPagerAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.ViewPagerView; - -import java.util.HashSet; - -import butterknife.BindView; - -/** - * Created by Kosh on 31 Dec 2016, 1:36 AM - */ - -public class RepoPullRequestPagerFragment extends BaseFragment implements - RepoPullRequestPagerMvp.View { - - public static final String TAG = RepoPullRequestPagerFragment.class.getSimpleName(); - - @BindView(R.id.tabs) TabLayout tabs; - @BindView(R.id.pager) ViewPagerView pager; - @State HashSet counts = new HashSet<>(); - private RepoPagerMvp.View repoCallback; - - public static RepoPullRequestPagerFragment newInstance(@NonNull String repoId, @NonNull String login) { - RepoPullRequestPagerFragment view = new RepoPullRequestPagerFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .end()); - return view; - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() instanceof RepoPagerMvp.View) { - repoCallback = (RepoPagerMvp.View) getParentFragment(); - } else if (context instanceof RepoPagerMvp.View) { - repoCallback = (RepoPagerMvp.View) context; - } - } - - @Override public void onDetach() { - repoCallback = null; - super.onDetach(); - } - - @Override protected int fragmentLayout() { - return R.layout.centered_tabbed_viewpager; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - String repoId = getArguments().getString(BundleConstant.ID); - String login = getArguments().getString(BundleConstant.EXTRA); - if (login == null || repoId == null) throw new NullPointerException("repoId || login is null???"); - pager.setAdapter(new FragmentsPagerAdapter(getChildFragmentManager(), - FragmentPagerAdapterModel.buildForRepoPullRequest(getContext(), login, repoId))); - tabs.setupWithViewPager(pager); - if (savedInstanceState != null && !counts.isEmpty()) { - Stream.of(counts).forEach(this::updateCount); - } - tabs.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(pager) { - @Override public void onTabReselected(TabLayout.Tab tab) { - super.onTabReselected(tab); - onScrollTop(tab.getPosition()); - } - }); - } - - @Override public void onScrollTop(int index) { - if (pager == null || pager.getAdapter() == null) return; - Fragment fragment = (BaseFragment) pager.getAdapter().instantiateItem(pager, index); - if (fragment instanceof BaseFragment) { - ((BaseFragment) fragment).onScrollTop(index); - } - } - - @NonNull @Override public RepoPullRequestPagerPresenter providePresenter() { - return new RepoPullRequestPagerPresenter(); - } - - @Override public void onSetBadge(int tabIndex, int count) { - TabsCountStateModel model = new TabsCountStateModel(); - model.setTabIndex(tabIndex); - model.setCount(count); - counts.add(model); - if (tabs != null) { - updateCount(model); - } - } - - @Override public int getCurrentItem() { - return pager != null ? pager.getCurrentItem() : 0; - } - - @Override public void onScrolled(boolean isUp) { - if (repoCallback != null) repoCallback.onScrolled(isUp); - } - - private void updateCount(@NonNull TabsCountStateModel model) { - TextView tv = ViewHelper.getTabTextView(tabs, model.getTabIndex()); - tv.setText(SpannableBuilder.builder() - .append(model.getTabIndex() == 0 ? getString(R.string.opened) : getString(R.string.closed)) - .append(" ") - .append("(") - .bold(String.valueOf(model.getCount())) - .append(")")); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/RepoPullRequestPagerMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/RepoPullRequestPagerMvp.java deleted file mode 100644 index 4699f18ba..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/RepoPullRequestPagerMvp.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests; - -import androidx.annotation.IntRange; - -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; - -/** - * Created by Kosh on 31 Dec 2016, 1:35 AM - */ - -public interface RepoPullRequestPagerMvp { - - interface View extends BaseMvp.FAView, RepoPagerMvp.TabsBadgeListener { - @IntRange(from = 0, to = 1) int getCurrentItem(); - - void onScrolled(boolean isUp); - } - - interface Presenter extends BaseMvp.FAPresenter {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/RepoPullRequestPagerPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/RepoPullRequestPagerPresenter.java deleted file mode 100644 index 588b69145..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/RepoPullRequestPagerPresenter.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests; - -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -/** - * Created by Kosh on 31 Dec 2016, 1:36 AM - */ - -class RepoPullRequestPagerPresenter extends BasePresenter implements RepoPullRequestPagerMvp.Presenter {} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/RepoPullRequestFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/RepoPullRequestFragment.java deleted file mode 100644 index 8931b18ed..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/RepoPullRequestFragment.java +++ /dev/null @@ -1,201 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.PullsIssuesParser; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.PullRequestAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; -import com.fastaccess.ui.modules.repos.extras.popup.IssuePopupFragment; -import com.fastaccess.ui.modules.repos.pull_requests.RepoPullRequestPagerMvp; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.PullRequestPagerActivity; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class RepoPullRequestFragment extends BaseFragment implements RepoPullRequestMvp.View { - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private PullRequestAdapter adapter; - private RepoPullRequestPagerMvp.View pagerCallback; - private RepoPagerMvp.TabsBadgeListener tabsBadgeListener; - - public static RepoPullRequestFragment newInstance(@NonNull String repoId, @NonNull String login, @NonNull IssueState issueState) { - RepoPullRequestFragment view = new RepoPullRequestFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.EXTRA_TWO, issueState) - .end()); - return view; - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() instanceof RepoPullRequestPagerMvp.View) { - pagerCallback = (RepoPullRequestPagerMvp.View) getParentFragment(); - } else if (context instanceof RepoPullRequestPagerMvp.View) { - pagerCallback = (RepoPullRequestPagerMvp.View) context; - } - if (getParentFragment() instanceof RepoPagerMvp.TabsBadgeListener) { - tabsBadgeListener = (RepoPagerMvp.TabsBadgeListener) getParentFragment(); - } else if (context instanceof RepoPagerMvp.TabsBadgeListener) { - tabsBadgeListener = (RepoPagerMvp.TabsBadgeListener) context; - } - } - - @Override public void onDetach() { - tabsBadgeListener = null; - super.onDetach(); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new NullPointerException("Bundle is null, therefore, issues can't be proceeded."); - } - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - adapter = new PullRequestAdapter(getPresenter().getPullRequests(), true); - adapter.setListener(getPresenter()); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.setAdapter(adapter); - recycler.addKeyLineDivider(); - recycler.addOnScrollListener(getLoadMore()); - if (savedInstanceState == null) { - getPresenter().onFragmentCreated(getArguments()); - } else if (getPresenter().getPullRequests().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - stateLayout.setEmptyText(R.string.no_pull_requests); - fastScroller.attachRecyclerView(recycler); - } - - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (resultCode == Activity.RESULT_OK) { - if (requestCode == RepoPullRequestMvp.PULL_REQUEST_REQUEST_CODE) { - boolean isClose = data.getExtras().getBoolean(BundleConstant.EXTRA); - boolean isOpened = data.getExtras().getBoolean(BundleConstant.EXTRA_TWO); - if (isClose || isOpened) { - onRefresh(); - } - } - } - } - - @NonNull @Override public RepoPullRequestPresenter providePresenter() { - return new RepoPullRequestPresenter(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showProgress(@StringRes int resId) { - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore(getPresenter()) { - @Override public void onScrolled(boolean isUp) { - super.onScrolled(isUp); - if (pagerCallback != null) pagerCallback.onScrolled(isUp); - } - }; - } - onLoadMore.setParameter(getIssueState()); - return onLoadMore; - } - - @Override public void onUpdateCount(int totalCount) { - if (tabsBadgeListener != null) tabsBadgeListener.onSetBadge(getPresenter().getIssueState() == IssueState.open ? 0 : 1, totalCount); - } - - @Override public void onOpenPullRequest(@NonNull PullsIssuesParser parser) { - Intent intent = PullRequestPagerActivity.createIntent(getContext(), parser.getRepoId(), parser.getLogin(), - parser.getNumber(), false, isEnterprise()); - startActivityForResult(intent, RepoPullRequestMvp.PULL_REQUEST_REQUEST_CODE); - } - - @Override public void onShowPullRequestPopup(@NonNull PullRequest item) { - IssuePopupFragment.showPopup(getChildFragmentManager(), item); - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, getIssueState()); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private IssueState getIssueState() { - return ((IssueState) getArguments().getSerializable(BundleConstant.EXTRA_TWO)); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/RepoPullRequestMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/RepoPullRequestMvp.java deleted file mode 100644 index bee294656..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/RepoPullRequestMvp.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.PullsIssuesParser; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -interface RepoPullRequestMvp { - - int PULL_REQUEST_REQUEST_CODE = 1003; - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - - void onUpdateCount(int totalCount); - - void onOpenPullRequest(@NonNull PullsIssuesParser parser); - - void onShowPullRequestPopup(@NonNull PullRequest item); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - void onFragmentCreated(@NonNull Bundle bundle); - - void onWorkOffline(); - - @NonNull ArrayList getPullRequests(); - - @NonNull IssueState getIssueState(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/RepoPullRequestPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/RepoPullRequestPresenter.java deleted file mode 100644 index 5cc7ac5d2..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/RepoPullRequestPresenter.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.data.dao.PullsIssuesParser; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RepoQueryProvider; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class RepoPullRequestPresenter extends BasePresenter implements RepoPullRequestMvp.Presenter { - - @com.evernote.android.state.State String login; - @com.evernote.android.state.State String repoId; - @com.evernote.android.state.State IssueState issueState; - private ArrayList pullRequests = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - onWorkOffline(); - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable IssueState parameter) { - if (parameter == null) { - sendToView(RepoPullRequestMvp.View::hideProgress); - return false; - } - this.issueState = parameter; - if (page == 1) { - onCallCountApi(issueState); - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0) { - sendToView(RepoPullRequestMvp.View::hideProgress); - return false; - } - if (repoId == null || login == null) return false; - makeRestCall(RestProvider.getPullRequestService(isEnterprise()).getPullRequests(login, repoId, parameter.name(), page), response -> { - lastPage = response.getLast(); - if (getCurrentPage() == 1) { - manageDisposable(PullRequest.save(response.getItems(), login, repoId)); - } - sendToView(view -> view.onNotifyAdapter(response.getItems(), page)); - }); - return true; - } - - @Override public void onFragmentCreated(@NonNull Bundle bundle) { - repoId = bundle.getString(BundleConstant.ID); - login = bundle.getString(BundleConstant.EXTRA); - issueState = (IssueState) bundle.getSerializable(BundleConstant.EXTRA_TWO); - if (!InputHelper.isEmpty(login) && !InputHelper.isEmpty(repoId)) { - onCallApi(1, issueState); - } - } - - private void onCallCountApi(@NonNull IssueState issueState) { - manageDisposable(RxHelper.getObservable(RestProvider.getPullRequestService(isEnterprise()) - .getPullsWithCount(RepoQueryProvider.getIssuesPullRequestQuery(login, repoId, issueState, true), 0)) - .subscribe(pullRequestPageable -> sendToView(view -> view.onUpdateCount(pullRequestPageable.getTotalCount())), - Throwable::printStackTrace)); - } - - @Override public void onWorkOffline() { - if (pullRequests.isEmpty()) { - manageDisposable(RxHelper.getSingle(PullRequest.getPullRequests(repoId, login, issueState)) - .subscribe(pulls -> sendToView(view -> { - view.onNotifyAdapter(pulls, 1); - view.onUpdateCount(pulls.size()); - }))); - } else { - sendToView(BaseMvp.FAView::hideProgress); - } - } - - @NonNull public ArrayList getPullRequests() { - return pullRequests; - } - - @NonNull @Override public IssueState getIssueState() { - return issueState; - } - - @Override public void onItemClick(int position, View v, PullRequest item) { - PullsIssuesParser parser = PullsIssuesParser.getForPullRequest(item.getHtmlUrl()); - if (parser != null && getView() != null) { - getView().onOpenPullRequest(parser); - } - } - - @Override public void onItemLongClick(int position, View v, PullRequest item) { - if (getView() != null) getView().onShowPullRequestPopup(item); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/PullRequestPagerActivity.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/PullRequestPagerActivity.java deleted file mode 100644 index 5f2aaa4be..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/PullRequestPagerActivity.java +++ /dev/null @@ -1,593 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request.details; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.floatingactionbutton.FloatingActionButton; -import com.google.android.material.tabs.TabLayout; -import androidx.fragment.app.Fragment; -import androidx.core.content.ContextCompat; -import androidx.viewpager.widget.ViewPager; -import androidx.cardview.widget.CardView; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.CommentRequestModel; -import com.fastaccess.data.dao.FragmentPagerAdapterModel; -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.data.dao.ReviewRequestModel; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.PinnedPullRequests; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.AnimHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.Logger; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.ui.adapter.FragmentsPagerAdapter; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment; -import com.fastaccess.ui.modules.main.premium.PremiumActivity; -import com.fastaccess.ui.modules.repos.RepoPagerActivity; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; -import com.fastaccess.ui.modules.repos.extras.assignees.AssigneesDialogFragment; -import com.fastaccess.ui.modules.repos.extras.labels.LabelsDialogFragment; -import com.fastaccess.ui.modules.repos.extras.locking.LockIssuePrBottomSheetDialog; -import com.fastaccess.ui.modules.repos.extras.milestone.create.MilestoneDialogFragment; -import com.fastaccess.ui.modules.repos.issues.create.CreateIssueActivity; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.files.PullRequestFilesFragment; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.timeline.timeline.PullRequestTimelineFragment; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.merge.MergePullRequestDialogFragment; -import com.fastaccess.ui.modules.reviews.changes.ReviewChangesActivity; -import com.fastaccess.ui.widgets.AvatarLayout; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.ForegroundImageView; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.ViewPagerView; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; - -import java.util.ArrayList; - -import butterknife.BindView; -import butterknife.OnClick; - -/** - * Created by Kosh on 10 Dec 2016, 9:23 AM - */ - -public class PullRequestPagerActivity extends BaseActivity - implements PullRequestPagerMvp.View { - - @BindView(R.id.startGist) ForegroundImageView startGist; - @BindView(R.id.forkGist) ForegroundImageView forkGist; - @BindView(R.id.avatarLayout) AvatarLayout avatarLayout; - @BindView(R.id.headerTitle) FontTextView title; - @BindView(R.id.size) FontTextView size; - @BindView(R.id.date) FontTextView date; - @BindView(R.id.tabs) TabLayout tabs; - @BindView(R.id.pager) ViewPagerView pager; - @BindView(R.id.fab) FloatingActionButton fab; - @BindView(R.id.detailsIcon) View detailsIcon; - @BindView(R.id.reviewsCount) FontTextView reviewsCount; - @BindView(R.id.prReviewHolder) CardView prReviewHolder; - @State boolean isClosed; - @State boolean isOpened; - private CommentEditorFragment commentEditorFragment; - - public static Intent createIntent(@NonNull Context context, @NonNull String repoId, @NonNull String login, int number) { - return createIntent(context, repoId, login, number, false); - } - - public static Intent createIntent(@NonNull Context context, @NonNull String repoId, @NonNull String login, int number, boolean showRepoBtn) { - return createIntent(context, repoId, login, number, showRepoBtn, false); - } - - public static Intent createIntent(@NonNull Context context, @NonNull String repoId, @NonNull String login, - int number, boolean showRepoBtn, boolean isEnterprise) { - return createIntent(context, repoId, login, number, showRepoBtn, isEnterprise, 0); - } - - public static Intent createIntent(@NonNull Context context, @NonNull String repoId, @NonNull String login, - int number, boolean showRepoBtn, boolean isEnterprise, long commentId) { - Intent intent = new Intent(context, PullRequestPagerActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.ID, number) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.EXTRA_TWO, repoId) - .put(BundleConstant.EXTRA_THREE, showRepoBtn) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .put(BundleConstant.EXTRA_SIX, commentId) - .end()); - return intent; - } - - @OnClick(R.id.detailsIcon) void onTitleClick() { - if (getPresenter().getPullRequest() != null && !InputHelper.isEmpty(getPresenter().getPullRequest().getTitle())) - MessageDialogView.newInstance(String.format("%s/%s", getPresenter().getLogin(), getPresenter().getRepoId()), - getPresenter().getPullRequest().getTitle(), false, true) - .show(getSupportFragmentManager(), MessageDialogView.TAG); - } - - @OnClick(R.id.submitReviews) void onSubmitReviews(View view) { - addPrReview(view); - } - - @OnClick(R.id.cancelReview) void onCancelReviews(View view) { - MessageDialogView.newInstance(getString(R.string.cancel_reviews), getString(R.string.confirm_message), - false, Bundler.start() - .put(BundleConstant.YES_NO_EXTRA, true) - .put(BundleConstant.EXTRA_TYPE, true) - .end()) - .show(getSupportFragmentManager(), MessageDialogView.TAG); - } - - @Override protected int layout() { - return R.layout.issue_pager_activity; - } - - @Override protected boolean isTransparent() { - return true; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @NonNull @Override public PullRequestPagerPresenter providePresenter() { - return new PullRequestPagerPresenter(); - } - - @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - commentEditorFragment = (CommentEditorFragment) getSupportFragmentManager().findFragmentById(R.id.commentFragment); - if (savedInstanceState == null) { - getPresenter().onActivityCreated(getIntent()); - } else { - if (getPresenter().getPullRequest() != null) onSetupIssue(false); - } - fab.hide(); - startGist.setVisibility(View.GONE); - forkGist.setVisibility(View.GONE); - if (getPresenter().showToRepoBtn()) showNavToRepoItem(); - } - - @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (resultCode == RESULT_OK) { - if (requestCode == BundleConstant.REQUEST_CODE) { - if (data == null) return; - Bundle bundle = data.getExtras(); - PullRequest pullRequest = bundle.getParcelable(BundleConstant.ITEM); - if (pullRequest != null) { - getPresenter().onUpdatePullRequest(pullRequest); - } else { - getPresenter().onRefresh(); - } - } - } - } - - @Override public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.pull_request_menu, menu); - menu.findItem(R.id.merge).setVisible(false); - return super.onCreateOptionsMenu(menu); - } - - @Override public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == android.R.id.home) { - onNavToRepoClicked(); - return true; - } - PullRequest pullRequest = getPresenter().getPullRequest(); - if (pullRequest == null) return false; - if (item.getItemId() == R.id.share) { - ActivityHelper.shareUrl(this, pullRequest.getHtmlUrl()); - return true; - } else if (item.getItemId() == R.id.closeIssue) { - MessageDialogView.newInstance( - pullRequest.getState() == IssueState.open ? getString(R.string.close_issue) : getString(R.string.re_open_issue), - getString(R.string.confirm_message), Bundler.start().put(BundleConstant.EXTRA, true).end()) - .show(getSupportFragmentManager(), MessageDialogView.TAG); - return true; - } else if (item.getItemId() == R.id.lockIssue) { - if (!getPresenter().isLocked()) { - LockIssuePrBottomSheetDialog.Companion - .newInstance() - .show(getSupportFragmentManager(), MessageDialogView.TAG); - } else { - MessageDialogView.newInstance(getString(R.string.unlock_issue), getString(R.string.unlock_issue_details), - Bundler.start().put(BundleConstant.EXTRA_TWO, true) - .put(BundleConstant.YES_NO_EXTRA, true) - .end()) - .show(getSupportFragmentManager(), MessageDialogView.TAG); - } - return true; - } else if (item.getItemId() == R.id.labels) { - LabelsDialogFragment.newInstance(getPresenter().getPullRequest() != null ? getPresenter().getPullRequest().getLabels() : null, - getPresenter().getRepoId(), getPresenter().getLogin()) - .show(getSupportFragmentManager(), "LabelsDialogFragment"); - return true; - } else if (item.getItemId() == R.id.edit) { - CreateIssueActivity.startForResult(this, getPresenter().getLogin(), getPresenter().getRepoId(), pullRequest, isEnterprise()); - return true; - } else if (item.getItemId() == R.id.milestone) { - MilestoneDialogFragment.newInstance(getPresenter().getLogin(), getPresenter().getRepoId()) - .show(getSupportFragmentManager(), "MilestoneDialogFragment"); - return true; - } else if (item.getItemId() == R.id.assignees) { - AssigneesDialogFragment.newInstance(getPresenter().getLogin(), getPresenter().getRepoId(), true) - .show(getSupportFragmentManager(), "AssigneesDialogFragment"); - return true; - } else if (item.getItemId() == R.id.reviewers) { - AssigneesDialogFragment.newInstance(getPresenter().getLogin(), getPresenter().getRepoId(), false) - .show(getSupportFragmentManager(), "AssigneesDialogFragment"); - return true; - } else if (item.getItemId() == R.id.merge) { - if (getPresenter().getPullRequest() != null) { - String msg = getPresenter().getPullRequest().getTitle(); - MergePullRequestDialogFragment.newInstance(msg).show(getSupportFragmentManager(), "MergePullRequestDialogFragment"); - } - } else if (item.getItemId() == R.id.browser) { - ActivityHelper.startCustomTab(this, pullRequest.getHtmlUrl()); - return true; - } else if (item.getItemId() == R.id.reviewChanges) { - if (PrefGetter.isProEnabled()) { - addPrReview(item.getActionView() == null ? title : item.getActionView()); - } else { - PremiumActivity.Companion.startActivity(this); - } - return true; - } else if (item.getItemId() == R.id.subscribe) { - getPresenter().onSubscribeOrMute(false); - return true; - } else if (item.getItemId() == R.id.mute) { - getPresenter().onSubscribeOrMute(true); - return true; - } else if (item.getItemId() == R.id.pinUnpin) { - if (PrefGetter.isProEnabled()) { - getPresenter().onPinUnpinPullRequest(); - } else { - PremiumActivity.Companion.startActivity(this); - } - return true; - } - return super.onOptionsItemSelected(item); - } - - @Override public boolean onPrepareOptionsMenu(Menu menu) { - MenuItem closeIssue = menu.findItem(R.id.closeIssue); - MenuItem lockIssue = menu.findItem(R.id.lockIssue); - MenuItem milestone = menu.findItem(R.id.milestone); - MenuItem labels = menu.findItem(R.id.labels); - MenuItem assignees = menu.findItem(R.id.assignees); - MenuItem edit = menu.findItem(R.id.edit); - MenuItem editMenu = menu.findItem(R.id.editMenu); - MenuItem merge = menu.findItem(R.id.merge); - MenuItem reviewers = menu.findItem(R.id.reviewers); - MenuItem pinUnpin = menu.findItem(R.id.pinUnpin); - boolean isOwner = getPresenter().isOwner(); - boolean isLocked = getPresenter().isLocked(); - boolean isCollaborator = getPresenter().isCollaborator(); - boolean isRepoOwner = getPresenter().isRepoOwner(); - boolean isMergable = getPresenter().isMergeable(); - merge.setVisible(isMergable && (isRepoOwner || isCollaborator)); - reviewers.setVisible((isRepoOwner || isCollaborator)); - editMenu.setVisible(isOwner || isCollaborator || isRepoOwner); - milestone.setVisible(isCollaborator || isRepoOwner); - labels.setVisible(isCollaborator || isRepoOwner); - assignees.setVisible(isCollaborator || isRepoOwner); - edit.setVisible(isCollaborator || isRepoOwner || isOwner); - if (getPresenter().getPullRequest() != null) { - boolean isPinned = PinnedPullRequests.isPinned(getPresenter().getPullRequest().getId()); - pinUnpin.setIcon(isPinned ? ContextCompat.getDrawable(this, R.drawable.ic_pin_filled) - : ContextCompat.getDrawable(this, R.drawable.ic_pin)); - closeIssue.setVisible(isRepoOwner || (isOwner || isCollaborator) && getPresenter().getPullRequest().getState() == IssueState.open); - lockIssue.setVisible(isRepoOwner || isCollaborator && getPresenter().getPullRequest().getState() == IssueState.open); - closeIssue.setTitle(getPresenter().getPullRequest().getState() == IssueState.closed ? getString(R.string.re_open) : getString(R.string - .close)); - lockIssue.setTitle(isLocked ? getString(R.string.unlock_issue) : getString(R.string.lock_issue)); - } else { - closeIssue.setVisible(false); - lockIssue.setVisible(false); - } - return super.onPrepareOptionsMenu(menu); - } - - @Override public void onSetupIssue(boolean update) { - hideProgress(); - if (getPresenter().getPullRequest() == null) { - return; - } - invalidateOptionsMenu(); - PullRequest pullRequest = getPresenter().getPullRequest(); - setTaskName(pullRequest.getRepoId() + " - " + pullRequest.getTitle()); - updateViews(pullRequest); - if (update) { - PullRequestTimelineFragment issueDetailsView = getPullRequestTimelineFragment(); - if (issueDetailsView != null && getPresenter().getPullRequest() != null) { - issueDetailsView.onUpdateHeader(); - } - } else { - if (pager.getAdapter() == null) { - pager.setAdapter(new FragmentsPagerAdapter(getSupportFragmentManager(), FragmentPagerAdapterModel.buildForPullRequest(this, - pullRequest))); - tabs.setupWithViewPager(pager); - tabs.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(pager) { - @Override public void onTabReselected(TabLayout.Tab tab) { - super.onTabReselected(tab); - onScrollTop(tab.getPosition()); - } - }); - } else { - onUpdateTimeline(); - } - } - pager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { - @Override public void onPageSelected(int position) { - hideShowFab(); - super.onPageSelected(position); - - } - }); - initTabs(pullRequest); - hideShowFab(); - AnimHelper.mimicFabVisibility(getPresenter().hasReviewComments(), prReviewHolder, null); - reviewsCount.setText(String.format("%s", getPresenter().getCommitComment().size())); - } - - @Override public void onScrollTop(int index) { - if (pager == null || pager.getAdapter() == null) return; - Fragment fragment = (BaseFragment) pager.getAdapter().instantiateItem(pager, index); - if (fragment instanceof BaseFragment) { - ((BaseFragment) fragment).onScrollTop(index); - } - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (isOk) { - if (bundle != null) { - if (bundle.getBoolean(BundleConstant.EXTRA_TYPE)) { - hideAndClearReviews(); - return; - } - } - getPresenter().onHandleConfirmDialog(bundle); - } - } - - @Override public void onSelectedLabels(@NonNull ArrayList labels) { - getPresenter().onPutLabels(labels); - } - - @Override public void showSuccessIssueActionMsg(boolean isClose) { - hideProgress(); - if (isClose) { - isOpened = false; - isClosed = true; - showMessage(getString(R.string.success), getString(R.string.success_closed)); - } else { - isOpened = true; - isClosed = false; - showMessage(getString(R.string.success), getString(R.string.success_re_opened)); - } - } - - @Override public void showErrorIssueActionMsg(boolean isClose) { - hideProgress(); - if (isClose) { - showMessage(getString(R.string.error), getString(R.string.error_closing_issue)); - } else { - showMessage(getString(R.string.error), getString(R.string.error_re_opening_issue)); - } - } - - @Override public void onUpdateTimeline() { - supportInvalidateOptionsMenu(); - PullRequestTimelineFragment pullRequestDetailsView = getPullRequestTimelineFragment(); - if (pullRequestDetailsView != null && getPresenter().getPullRequest() != null) { - pullRequestDetailsView.onRefresh(); - } - } - - @Override public void onMileStoneSelected(@NonNull MilestoneModel milestoneModel) { - getPresenter().onPutMilestones(milestoneModel); - } - - @Override public void onFinishActivity() { - hideProgress(); - finish(); - } - - @Override public void onUpdateMenu() { - invalidateOptionsMenu(); - } - - @Override public void onAddComment(CommentRequestModel comment) { - getPresenter().onAddComment(comment); - AnimHelper.mimicFabVisibility(getPresenter().hasReviewComments(), prReviewHolder, null); - reviewsCount.setText(String.format("%s", getPresenter().getCommitComment().size())); - Logger.e(reviewsCount.getText(), prReviewHolder.getVisibility()); - } - - @Override public void onMerge(@NonNull String msg, @NonNull String mergeMethod) { - getPresenter().onMerge(msg, mergeMethod); - } - - @Override public void onNavToRepoClicked() { - Intent intent = ActivityHelper.editBundle(RepoPagerActivity.createIntent(this, getPresenter().getRepoId(), - getPresenter().getLogin(), RepoPagerMvp.PULL_REQUEST), isEnterprise()); - startActivity(intent); - finish(); - } - - @Override public void finish() { - Intent intent = new Intent(); - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA, isClosed) - .put(BundleConstant.EXTRA_TWO, isOpened) - .end()); - setResult(RESULT_OK, intent); - super.finish(); - } - - @Override public void onSelectedAssignees(@NonNull ArrayList users, boolean isAssignees) { - hideProgress(); - getPresenter().onPutAssignees(users, isAssignees); - } - - @Nullable @Override public PullRequest getData() { - return getPresenter().getPullRequest(); - } - - @Override public void onSendActionClicked(@NonNull String text, Bundle bundle) { - PullRequestTimelineFragment fragment = getPullRequestTimelineFragment(); - if (fragment != null) { - fragment.onHandleComment(text, bundle); - } - } - - private PullRequestTimelineFragment getPullRequestTimelineFragment() { - if (pager == null || pager.getAdapter() == null) return null; - return (PullRequestTimelineFragment) pager.getAdapter().instantiateItem(pager, 0); - } - - @Override public void onTagUser(@NonNull String username) { - commentEditorFragment.onAddUserName(username); - } - - @Override public void onCreateComment(@NonNull String text, @Nullable Bundle bundle) { - commentEditorFragment.onCreateComment(text, bundle); - } - - @Override public void onSuccessfullyReviewed() { - hideAndClearReviews(); - pager.setCurrentItem(0); - } - - @SuppressWarnings("ConstantConditions") @Override public void onClearEditText() { - if (commentEditorFragment != null && commentEditorFragment.commentText != null) commentEditorFragment.commentText.setText(""); - } - - @Override public ArrayList getNamesToTag() { - PullRequestTimelineFragment fragment = getPullRequestTimelineFragment(); - if (fragment != null) { - return fragment.getNamesToTag(); - } - return new ArrayList<>(); - } - - @Override public void onLock(String reason) { - getPresenter().onLockUnlockConversations(reason); - } - - protected void hideAndClearReviews() { - getPresenter().getCommitComment().clear(); - AnimHelper.mimicFabVisibility(false, prReviewHolder, null); - if (pager == null || pager.getAdapter() == null) return; - PullRequestFilesFragment fragment = (PullRequestFilesFragment) pager.getAdapter().instantiateItem(pager, 2); - if (fragment != null) { - fragment.onRefresh(); - } - - } - - private void addPrReview(@NonNull View view) { - PullRequest pullRequest = getPresenter().getPullRequest(); - if (pullRequest == null) return; - User author = pullRequest.getUser() != null ? pullRequest.getUser() : - pullRequest.getHead() != null && pullRequest.getHead().getAuthor() != null ? - pullRequest.getHead().getAuthor() : pullRequest.getUser(); - if (author == null) return; - ReviewRequestModel requestModel = new ReviewRequestModel(); - requestModel.setComments(getPresenter().getCommitComment().isEmpty() ? null : getPresenter().getCommitComment()); - requestModel.setCommitId(pullRequest.getHead().getSha()); - boolean isAuthor = Login.getUser().getLogin().equalsIgnoreCase(author.getLogin()); - ReviewChangesActivity.Companion.startForResult(requestModel, getPresenter().getRepoId(), - getPresenter().getLogin(), pullRequest.getNumber(), isAuthor, isEnterprise(), pullRequest.isMerged() - || pullRequest.getState() == IssueState.closed) - .show(getSupportFragmentManager(), ReviewChangesActivity.class.getSimpleName()); - } - - private void initTabs(@NonNull PullRequest pullRequest) { - TabLayout.Tab tab1 = tabs.getTabAt(0); - TabLayout.Tab tab2 = tabs.getTabAt(1); - TabLayout.Tab tab3 = tabs.getTabAt(2); - if (tab3 != null) { - tab3.setText(SpannableBuilder.builder() - .append(getString(R.string.files)) - .append(" ") - .append("(") - .append(String.valueOf(pullRequest.getChangedFiles())) - .append(")")); - } - if (tab2 != null) { - tab2.setText(SpannableBuilder.builder() - .append(getString(R.string.commits)) - .append(" ") - .append("(") - .append(String.valueOf(pullRequest.getCommits())) - .append(")")); - } - if (tab1 != null) { - tab1.setText(SpannableBuilder.builder() - .append(getString(R.string.details)) - .append(" ") - .append("(") - .append(String.valueOf(pullRequest.getComments())) - .append(")")); - } - } - - private void updateViews(@NonNull PullRequest pullRequest) { - setTitle(String.format("#%s", pullRequest.getNumber())); - if (getSupportActionBar() != null) { - getSupportActionBar().setSubtitle(pullRequest.getRepoId()); - } - date.setText(SpannableBuilder.builder().append(getPresenter().getMergeBy(pullRequest, getApplicationContext()))); - size.setVisibility(View.GONE); - User userModel = pullRequest.getUser(); - if (userModel != null) { - title.setText(SpannableBuilder.builder().append(userModel.getLogin()).append("/").append(pullRequest.getTitle())); - avatarLayout.setUrl(userModel.getAvatarUrl(), userModel.getLogin(), false, - LinkParserHelper.isEnterprise(pullRequest.getUrl())); - } else { - title.setText(SpannableBuilder.builder().append(pullRequest.getTitle())); - } - detailsIcon.setVisibility(View.VISIBLE); - } - - private void hideShowFab() { - if (getPresenter().isLocked() && !getPresenter().isOwner() && !getPresenter().isCollaborator()) { - getSupportFragmentManager().beginTransaction() - .setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out) - .hide(commentEditorFragment).commit(); - return; - } - if (pager.getCurrentItem() == 0) { - getSupportFragmentManager().beginTransaction().show(commentEditorFragment) - .setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out) - .commit(); - } else { - getSupportFragmentManager().beginTransaction().hide(commentEditorFragment) - .setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out) - .commit(); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/PullRequestPagerMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/PullRequestPagerMvp.java deleted file mode 100644 index 848002922..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/PullRequestPagerMvp.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request.details; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment; -import com.fastaccess.ui.modules.repos.extras.assignees.AssigneesMvp; -import com.fastaccess.ui.modules.repos.extras.labels.LabelsMvp; -import com.fastaccess.ui.modules.repos.extras.locking.LockIssuePrCallback; -import com.fastaccess.ui.modules.repos.issues.issue.details.IssuePagerMvp; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.files.PullRequestFilesMvp; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.merge.MergePullReqeustMvp; -import com.fastaccess.ui.modules.reviews.changes.ReviewChangesMvp; -import com.fastaccess.ui.widgets.SpannableBuilder; - -import java.util.ArrayList; - -/** - * Created by Kosh on 10 Dec 2016, 9:21 AM - */ - -public interface PullRequestPagerMvp { - - interface View extends BaseMvp.FAView, LabelsMvp.SelectedLabelsListener, - AssigneesMvp.SelectedAssigneesListener, MergePullReqeustMvp.MergeCallback, - IssuePagerMvp.IssuePrCallback, PullRequestFilesMvp.PatchCallback, - CommentEditorFragment.CommentListener, ReviewChangesMvp.ReviewSubmissionCallback, - LockIssuePrCallback { - - void onSetupIssue(boolean update); - - void showSuccessIssueActionMsg(boolean isClose); - - void showErrorIssueActionMsg(boolean isClose); - - void onUpdateTimeline(); - - void onMileStoneSelected(@NonNull MilestoneModel milestoneModel); - - void onFinishActivity(); - - void onUpdateMenu(); - } - - interface Presenter extends BaseMvp.FAPresenter, PullRequestFilesMvp.CommitCommentCallback { - - @Nullable PullRequest getPullRequest(); - - void onActivityCreated(@Nullable Intent intent); - - void onWorkOffline(); - - boolean isOwner(); - - boolean isRepoOwner(); - - boolean isLocked(); - - boolean isMergeable(); - - boolean showToRepoBtn(); - - void onHandleConfirmDialog(@Nullable Bundle bundle); - - void onOpenCloseIssue(); - - void onLockUnlockConversations(String reason); - - @NonNull SpannableBuilder getMergeBy(@NonNull PullRequest pullRequest, @NonNull Context context); - - void onMerge(String s, String msg); - - void onPutLabels(@NonNull ArrayList labels); - - void onPutMilestones(@NonNull MilestoneModel milestone); - - void onPutAssignees(@NonNull ArrayList users, boolean isAssignee); - - String getLogin(); - - String getRepoId(); - - boolean isCollaborator(); - - void onUpdatePullRequest(@NonNull PullRequest pullRequestModel); - - void onRefresh(); - - void onPinUnpinPullRequest(); - - void onSubscribeOrMute(boolean mute); - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/PullRequestPagerPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/PullRequestPagerPresenter.java deleted file mode 100644 index db383c682..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/PullRequestPagerPresenter.java +++ /dev/null @@ -1,346 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request.details; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.text.TextUtils; - -import com.annimon.stream.Collectors; -import com.annimon.stream.Stream; -import com.fastaccess.R; -import com.fastaccess.data.dao.AssigneesRequestModel; -import com.fastaccess.data.dao.CommentRequestModel; -import com.fastaccess.data.dao.IssueRequestModel; -import com.fastaccess.data.dao.LabelListModel; -import com.fastaccess.data.dao.LabelModel; -import com.fastaccess.data.dao.LockIssuePrModel; -import com.fastaccess.data.dao.MergeRequestModel; -import com.fastaccess.data.dao.MilestoneModel; -import com.fastaccess.data.dao.NotificationSubscriptionBodyModel; -import com.fastaccess.data.dao.PullsIssuesParser; -import com.fastaccess.data.dao.UsersListModel; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.PinnedPullRequests; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.data.dao.types.IssueState; -import com.fastaccess.data.service.IssueService; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.widgets.SpannableBuilder; - -import java.util.ArrayList; - -import io.reactivex.Observable; -import retrofit2.Response; - -/** - * Created by Kosh on 10 Dec 2016, 9:23 AM - */ - -class PullRequestPagerPresenter extends BasePresenter implements PullRequestPagerMvp.Presenter { - @com.evernote.android.state.State PullRequest pullRequest; - @com.evernote.android.state.State int issueNumber; - @com.evernote.android.state.State String login; - @com.evernote.android.state.State String repoId; - @com.evernote.android.state.State boolean isCollaborator; - @com.evernote.android.state.State boolean showToRepoBtn; - @com.evernote.android.state.State ArrayList reviewComments = new ArrayList<>(); - - @Nullable @Override public PullRequest getPullRequest() { - return pullRequest; - } - - @Override public void onError(@NonNull Throwable throwable) { - if (RestProvider.getErrorCode(throwable) == 404) { - sendToView(BaseMvp.FAView::onOpenUrlInBrowser); - } else { - onWorkOffline(); - } - super.onError(throwable); - } - - @Override public void onActivityCreated(@Nullable Intent intent) { - if (intent != null && intent.getExtras() != null) { - issueNumber = intent.getExtras().getInt(BundleConstant.ID); - login = intent.getExtras().getString(BundleConstant.EXTRA); - repoId = intent.getExtras().getString(BundleConstant.EXTRA_TWO); - showToRepoBtn = intent.getExtras().getBoolean(BundleConstant.EXTRA_THREE); - if (pullRequest != null) { - sendToView(view -> view.onSetupIssue(false)); - return; - } else if (issueNumber > 0 && !InputHelper.isEmpty(login) && !InputHelper.isEmpty(repoId)) { - callApi(); - return; - } - } - sendToView(view -> view.onSetupIssue(false)); - } - - @Override public void onWorkOffline() { - if (pullRequest == null) { - manageDisposable(PullRequest.getPullRequestByNumber(issueNumber, repoId, login) - .subscribe(pullRequestModel -> { - if (pullRequestModel != null) { - pullRequest = pullRequestModel; - sendToView(view -> view.onSetupIssue(false)); - } - })); - } - } - - @Override public boolean isOwner() { - if (getPullRequest() == null) return false; - User userModel = getPullRequest() != null ? getPullRequest().getUser() : null; - Login me = Login.getUser(); - PullsIssuesParser parser = PullsIssuesParser.getForIssue(getPullRequest().getHtmlUrl()); - return (userModel != null && userModel.getLogin().equalsIgnoreCase(me.getLogin())) - || (parser != null && parser.getLogin().equalsIgnoreCase(me.getLogin())); - } - - @Override public boolean isRepoOwner() { - if (getPullRequest() == null) return false; - Login me = Login.getUser(); - return TextUtils.equals(login, me.getLogin()); - } - - @Override public boolean isLocked() { - return getPullRequest() != null && getPullRequest().isLocked(); - } - - @Override public boolean isMergeable() { - return getPullRequest() != null && getPullRequest().isMergeable() && !getPullRequest().isMerged(); - } - - @Override public boolean showToRepoBtn() { - return showToRepoBtn; - } - - @Override public void onHandleConfirmDialog(@Nullable Bundle bundle) { - if (bundle != null) { - boolean proceedCloseIssue = bundle.getBoolean(BundleConstant.EXTRA); - boolean proceedLockUnlock = bundle.getBoolean(BundleConstant.EXTRA_TWO); - if (proceedCloseIssue) { - onOpenCloseIssue(); - } else if (proceedLockUnlock) { - onLockUnlockConversations(null); - } - } - } - - @Override public void onLockUnlockConversations(String reason) { - PullRequest currentPullRequest = getPullRequest(); - if (currentPullRequest == null) return; - IssueService service = RestProvider.getIssueService(isEnterprise()); - LockIssuePrModel model = null; - if (!isLocked() && !InputHelper.isEmpty(reason)) { - model = new LockIssuePrModel(true, reason); - } - Observable> observable = RxHelper - .getObservable(model == null ? service.unlockIssue(login, repoId, issueNumber) : - service.lockIssue(model, login, repoId, issueNumber)); - makeRestCall(observable, booleanResponse -> { - int code = booleanResponse.code(); - if (code == 204) { - pullRequest.setLocked(!isLocked()); - sendToView(view -> view.onSetupIssue(false)); - } - }); - } - - @Override public void onOpenCloseIssue() { - if (getPullRequest() != null) { - IssueRequestModel requestModel = IssueRequestModel.clone(getPullRequest(), true); - manageDisposable(RxHelper.getObservable(RestProvider.getPullRequestService(isEnterprise()).editPullRequest(login, repoId, - issueNumber, requestModel)) - .doOnSubscribe(disposable -> sendToView(view -> view.showProgress(0))) - .subscribe(issue -> { - if (issue != null) { - sendToView(view -> view.showSuccessIssueActionMsg(getPullRequest().getState() == IssueState.open)); - issue.setRepoId(getPullRequest().getRepoId()); - issue.setLogin(getPullRequest().getLogin()); - pullRequest = issue; - sendToView(view -> view.onSetupIssue(false)); - } - }, throwable -> sendToView(view -> view.showErrorIssueActionMsg(getPullRequest().getState() == IssueState.open)))); - } - } - - @NonNull @Override public SpannableBuilder getMergeBy(@NonNull PullRequest pullRequest, @NonNull Context context) { - return PullRequest.getMergeBy(pullRequest, context, false); - } - - @Override public void onPutLabels(@NonNull ArrayList labels) { - makeRestCall(RestProvider.getIssueService(isEnterprise()).putLabels(login, repoId, issueNumber, - Stream.of(labels).filter(value -> value != null && value.getName() != null) - .map(LabelModel::getName).collect(Collectors.toList())), - labelModels -> { - sendToView(view -> updateTimeline(view, R.string.labels_added_successfully)); - LabelListModel listModel = new LabelListModel(); - listModel.addAll(labels); - pullRequest.setLabels(listModel); - manageObservable(pullRequest.save(pullRequest).toObservable()); - }); - } - - @Override public void onPutMilestones(@NonNull MilestoneModel milestone) { - pullRequest.setMilestone(milestone); - IssueRequestModel issueRequestModel = IssueRequestModel.clone(pullRequest, false); - makeRestCall(RestProvider.getPullRequestService(isEnterprise()).editIssue(login, repoId, issueNumber, issueRequestModel), - pr -> { - this.pullRequest.setMilestone(pr.getMilestone()); - manageObservable(pr.save(pullRequest).toObservable()); - sendToView(view -> updateTimeline(view, R.string.labels_added_successfully)); - }); - - } - - @Override public void onPutAssignees(@NonNull ArrayList users, boolean isAssignees) { - AssigneesRequestModel assigneesRequestModel = new AssigneesRequestModel(); - ArrayList assignees = Stream.of(users) - .map(User::getLogin) - .collect(Collectors.toCollection(ArrayList::new)); - if (isAssignees) { - assigneesRequestModel.setAssignees(assignees.isEmpty() ? Stream.of(pullRequest.getAssignees()).map(User::getLogin).toList() : assignees); - makeRestCall(!assignees.isEmpty() ? - RestProvider.getIssueService(isEnterprise()).putAssignees(login, repoId, issueNumber, assigneesRequestModel) : - RestProvider.getIssueService(isEnterprise()).deleteAssignees(login, repoId, issueNumber, assigneesRequestModel), - pullRequestResponse -> { - UsersListModel usersListModel = new UsersListModel(); - usersListModel.addAll(users); - this.pullRequest.setAssignees(usersListModel); - manageObservable(pullRequest.save(pullRequest).toObservable()); - sendToView(view -> updateTimeline(view, R.string.assignee_added)); - } - ); - } else { - assigneesRequestModel.setReviewers(assignees); - makeRestCall(RestProvider.getPullRequestService(isEnterprise()).putReviewers(login, repoId, issueNumber, assigneesRequestModel), - pullRequestResponse -> sendToView(view -> updateTimeline(view, R.string.reviewer_added)) - ); - } - } - - @Override public void onMerge(@NonNull String msg, @NonNull String mergeMethod) { - if (isMergeable() && (isCollaborator() || isRepoOwner())) {//double the checking - if (getPullRequest() == null || getPullRequest().getHead() == null || getPullRequest().getHead().getSha() == null) return; - MergeRequestModel mergeRequestModel = new MergeRequestModel(); - mergeRequestModel.setSha(getPullRequest().getHead().getSha()); - mergeRequestModel.setCommitMessage(msg); - mergeRequestModel.setMergeMethod(mergeMethod.toLowerCase()); - manageDisposable(RxHelper.getObservable(RestProvider.getPullRequestService(isEnterprise()) - .mergePullRequest(login, repoId, issueNumber, mergeRequestModel)) - .doOnSubscribe(disposable -> sendToView(view -> view.showProgress(0))) - .subscribe(mergeResponseModel -> { - if (mergeResponseModel.isMerged()) { - pullRequest.setMerged(true); - sendToView(view -> updateTimeline(view, R.string.success_merge)); - } else { - sendToView(view -> view.showErrorMessage(mergeResponseModel.getMessage())); - } - }, throwable -> sendToView(view -> view.showErrorMessage(throwable.getMessage()))) - ); - } - } - - @Override public String getLogin() { - return login; - } - - @Override public String getRepoId() { - return repoId; - } - - @Override public boolean isCollaborator() { - return isCollaborator; - } - - @Override public void onUpdatePullRequest(@NonNull PullRequest pullRequestModel) { - this.pullRequest.setTitle(pullRequestModel.getTitle()); - this.pullRequest.setBody(pullRequestModel.getBody()); - this.pullRequest.setBodyHtml(pullRequestModel.getBodyHtml()); - this.pullRequest.setLogin(login); - this.pullRequest.setRepoId(repoId); - manageObservable(pullRequest.save(pullRequest).toObservable()); - sendToView(view -> view.onSetupIssue(true)); - } - - @Override public void onRefresh() { - callApi(); - } - - @Override public void onPinUnpinPullRequest() { - if (getPullRequest() == null) return; - PinnedPullRequests.pinUpin(getPullRequest()); - sendToView(PullRequestPagerMvp.View::onUpdateMenu); - } - - @NonNull @Override public ArrayList getCommitComment() { - return reviewComments; - } - - @Override public void onAddComment(@NonNull CommentRequestModel comment) { - int index = reviewComments.indexOf(comment); - if (index != -1) { - reviewComments.set(index, comment); - } else { - reviewComments.add(comment); - } - } - - @Override public boolean hasReviewComments() { - return reviewComments.size() > 0; - } - - @Override public void onSubscribeOrMute(boolean mute) { - if (getPullRequest() == null) return; - makeRestCall(mute ? RestProvider.getNotificationService(isEnterprise()).subscribe(getPullRequest().getId(), - new NotificationSubscriptionBodyModel(false, true)) - : RestProvider.getNotificationService(isEnterprise()).subscribe(getPullRequest().getId(), - new NotificationSubscriptionBodyModel(true, false)), - booleanResponse -> { - if (booleanResponse.code() == 204 || booleanResponse.code() == 200) { - sendToView(view -> view.showMessage(R.string.success, R.string.successfully_submitted)); - } else { - sendToView(view -> view.showMessage(R.string.error, R.string.network_error)); - } - }); - } - - private void callApi() { - Login loggedInUser = Login.getUser(); - if (loggedInUser == null) return; - makeRestCall(RxHelper.getObservable(Observable.zip(RestProvider.getPullRequestService(isEnterprise()) - .getPullRequest(login, repoId, issueNumber), - RestProvider.getRepoService(isEnterprise()).isCollaborator(login, repoId, loggedInUser.getLogin()), - RestProvider.getIssueService(isEnterprise()).getIssue(login, repoId, issueNumber), - (pullRequestModel, booleanResponse, issue) -> { - this.pullRequest = pullRequestModel; - if (issue != null) { - this.pullRequest.setReactions(issue.getReactions()); - this.pullRequest.setTitle(issue.getTitle()); - this.pullRequest.setBody(issue.getBody()); - this.pullRequest.setBodyHtml(issue.getBodyHtml()); - } - this.pullRequest.setLogin(login); - this.pullRequest.setRepoId(repoId); - isCollaborator = booleanResponse.code() == 204; - return pullRequest; - })), pullRequest -> { - sendToView(view -> view.onSetupIssue(false)); - manageDisposable(PinnedPullRequests.updateEntry(pullRequest.getId())); - manageObservable(pullRequest.save(pullRequest).toObservable()); - }); - } - - private void updateTimeline(PullRequestPagerMvp.View view, int assignee_added) { - view.showMessage(R.string.success, assignee_added); - view.onUpdateTimeline(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/commits/PullRequestCommitsFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/commits/PullRequestCommitsFragment.java deleted file mode 100644 index 1ffd7e19a..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/commits/PullRequestCommitsFragment.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.commits; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Commit; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.CommitsAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class PullRequestCommitsFragment extends BaseFragment - implements PullRequestCommitsMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private CommitsAdapter adapter; - - public static PullRequestCommitsFragment newInstance(@NonNull String repoId, @NonNull String login, long number) { - PullRequestCommitsFragment view = new PullRequestCommitsFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.EXTRA_TWO, number) - .end()); - return view; - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new NullPointerException("Bundle is null, therefore, PullRequestCommitsFragment can't be proceeded."); - } - stateLayout.setEmptyText(R.string.no_commits); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - adapter = new CommitsAdapter(getPresenter().getCommits()); - adapter.setListener(getPresenter()); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.setAdapter(adapter); - recycler.addKeyLineDivider(); - recycler.addOnScrollListener(getLoadMore()); - if (savedInstanceState == null) { - getPresenter().onFragmentCreated(getArguments()); - } else if (getPresenter().getCommits().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public PullRequestCommitsPresenter providePresenter() { - return new PullRequestCommitsPresenter(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @SuppressWarnings("unchecked") @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore(getPresenter()); - } - return onLoadMore; - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, null); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/commits/PullRequestCommitsMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/commits/PullRequestCommitsMvp.java deleted file mode 100644 index f04f6a369..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/commits/PullRequestCommitsMvp.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.commits; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.Commit; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -interface PullRequestCommitsMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - void onFragmentCreated(@NonNull Bundle bundle); - - @NonNull ArrayList getCommits(); - - void onWorkOffline(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/commits/PullRequestCommitsPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/commits/PullRequestCommitsPresenter.java deleted file mode 100644 index d8765e47e..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/commits/PullRequestCommitsPresenter.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.commits; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.data.dao.model.Commit; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.repos.code.commit.details.CommitPagerActivity; - -import java.util.ArrayList; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class PullRequestCommitsPresenter extends BasePresenter implements PullRequestCommitsMvp.Presenter { - @com.evernote.android.state.State String login; - @com.evernote.android.state.State String repoId; - @com.evernote.android.state.State long number; - private ArrayList commits = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - onWorkOffline(); - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable Object parameter) { - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0) { - sendToView(PullRequestCommitsMvp.View::hideProgress); - return false; - } - if (repoId == null || login == null) return false; - makeRestCall(RestProvider.getPullRequestService(isEnterprise()).getPullRequestCommits(login, repoId, number, page), - response -> { - lastPage = response.getLast(); - if (getCurrentPage() == 1) { - manageDisposable(Commit.save(response.getItems(), repoId, login, number)); - } - sendToView(view -> view.onNotifyAdapter(response.getItems(), page)); - }); - return true; - } - - @Override public void onFragmentCreated(@NonNull Bundle bundle) { - repoId = bundle.getString(BundleConstant.ID); - login = bundle.getString(BundleConstant.EXTRA); - number = bundle.getLong(BundleConstant.EXTRA_TWO); - if (!InputHelper.isEmpty(login) && !InputHelper.isEmpty(repoId)) { - onCallApi(1, null); - } - } - - @NonNull @Override public ArrayList getCommits() { - return commits; - } - - @Override public void onWorkOffline() { - if (commits.isEmpty()) { - manageDisposable(RxHelper.getSingle(Commit.getCommits(repoId, login, number)) - .subscribe(models -> sendToView(view -> view.onNotifyAdapter(models, 1)))); - } else { - sendToView(BaseMvp.FAView::hideProgress); - } - } - - @Override public void onItemClick(int position, View v, Commit item) { - CommitPagerActivity.createIntentForOffline(v.getContext(), item); - } - - @Override public void onItemLongClick(int position, View v, Commit item) {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/files/PullRequestFilesFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/files/PullRequestFilesFragment.java deleted file mode 100644 index 59f02f7b0..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/files/PullRequestFilesFragment.java +++ /dev/null @@ -1,270 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.files; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.CommentRequestModel; -import com.fastaccess.data.dao.CommitFileChanges; -import com.fastaccess.data.dao.CommitFileModel; -import com.fastaccess.data.dao.CommitLinesModel; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.adapter.CommitFilesAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.main.premium.PremiumActivity; -import com.fastaccess.ui.modules.repos.issues.issue.details.IssuePagerMvp; -import com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.files.fullscreen.FullScreenFileChangeActivity; -import com.fastaccess.ui.modules.reviews.AddReviewDialogFragment; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class PullRequestFilesFragment extends BaseFragment - implements PullRequestFilesMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - @State HashMap toggleMap = new LinkedHashMap<>(); - @BindView(R.id.changes) FontTextView changes; - @BindView(R.id.addition) FontTextView addition; - @BindView(R.id.deletion) FontTextView deletion; - - private PullRequestFilesMvp.PatchCallback viewCallback; - private OnLoadMore onLoadMore; - private CommitFilesAdapter adapter; - private IssuePagerMvp.IssuePrCallback issueCallback; - - public static PullRequestFilesFragment newInstance(@NonNull String repoId, @NonNull String login, long number) { - PullRequestFilesFragment view = new PullRequestFilesFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.EXTRA_TWO, number) - .end()); - return view; - } - - @SuppressWarnings("unchecked") @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() instanceof IssuePagerMvp.IssuePrCallback) { - issueCallback = (IssuePagerMvp.IssuePrCallback) getParentFragment(); - } else if (context instanceof IssuePagerMvp.IssuePrCallback) { - issueCallback = (IssuePagerMvp.IssuePrCallback) context; - } else { - throw new IllegalArgumentException(String.format("%s or parent fragment must implement IssuePagerMvp.IssuePrCallback", context.getClass() - .getSimpleName())); - } - if (getParentFragment() instanceof PullRequestFilesMvp.PatchCallback) { - viewCallback = (PullRequestFilesMvp.PatchCallback) getParentFragment(); - } else if (context instanceof PullRequestFilesMvp.PatchCallback) { - viewCallback = (PullRequestFilesMvp.PatchCallback) context; - } - } - - @Override public void onDetach() { - issueCallback = null; - viewCallback = null; - super.onDetach(); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override protected int fragmentLayout() { - return R.layout.pull_request_files_layout; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getArguments() == null) { - throw new NullPointerException("Bundle is null, therefore, PullRequestFilesFragment can't be proceeded."); - } - setupChanges(); - stateLayout.setEmptyText(R.string.no_commits); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - adapter = new CommitFilesAdapter(getPresenter().getFiles(), this, this); - adapter.setListener(getPresenter()); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - if (savedInstanceState == null) { - getPresenter().onFragmentCreated(getArguments()); - } else if (getPresenter().getFiles().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - fastScroller.attachRecyclerView(recycler); - } - - private void setupChanges() { - PullRequest pullRequest = issueCallback.getData(); - if (pullRequest != null) { - addition.setText(String.valueOf(pullRequest.getAdditions())); - deletion.setText(String.valueOf(pullRequest.getDeletions())); - changes.setText(String.valueOf(pullRequest.getChangedFiles())); - } - } - - @NonNull @Override public PullRequestFilesPresenter providePresenter() { - return new PullRequestFilesPresenter(); - } - - @Override public void showProgress(@StringRes int resId) { - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @SuppressWarnings("unchecked") @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore(getPresenter()); - } - return onLoadMore; - } - - @Override public void onOpenForResult(int position, @NonNull CommitFileChanges model) { - FullScreenFileChangeActivity.Companion.startActivityForResult(this, model, position, false); - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, null); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onToggle(long position, boolean isCollapsed) { - CommitFileChanges model = adapter.getItem((int) position); - if (model == null) return; - if (model.getCommitFileModel().getPatch() == null) { - if ("renamed".equalsIgnoreCase(model.getCommitFileModel().getStatus())) { - SchemeParser.launchUri(getContext(), model.getCommitFileModel().getBlobUrl()); - return; - } - ActivityHelper.startCustomTab(getActivity(), adapter.getItem((int) position).getCommitFileModel().getBlobUrl()); - } - toggleMap.put(position, isCollapsed); - } - - @Override public boolean isCollapsed(long position) { - Boolean toggle = toggleMap.get(position); - return toggle != null && toggle; - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - @Override public void onPatchClicked(int groupPosition, int childPosition, View v, CommitFileModel commit, CommitLinesModel item) { - if (item.getText().startsWith("@@")) return; - if (PrefGetter.isProEnabled()) { - AddReviewDialogFragment.Companion.newInstance(item, Bundler.start() - .put(BundleConstant.ITEM, commit.getFilename()) - .put(BundleConstant.EXTRA_TWO, groupPosition) - .put(BundleConstant.EXTRA_THREE, childPosition) - .end()) - .show(getChildFragmentManager(), "AddReviewDialogFragment"); - } else { - PremiumActivity.Companion.startActivity(getContext()); - } - } - - @Override public void onCommentAdded(@NonNull String comment, @NonNull CommitLinesModel item, Bundle bundle) { - if (bundle != null) { - String path = bundle.getString(BundleConstant.ITEM); - if (path == null) return; - CommentRequestModel commentRequestModel = new CommentRequestModel(); - commentRequestModel.setBody(comment); - commentRequestModel.setPath(path); - commentRequestModel.setPosition(item.getPosition()); - if (viewCallback != null) viewCallback.onAddComment(commentRequestModel); - int groupPosition = bundle.getInt(BundleConstant.EXTRA_TWO); - int childPosition = bundle.getInt(BundleConstant.EXTRA_THREE); - CommitFileChanges commitFileChanges = adapter.getItem(groupPosition); - List models = commitFileChanges.getLinesModel(); - if (models != null && !models.isEmpty()) { - CommitLinesModel current = models.get(childPosition); - if (current != null) { - current.setHasCommentedOn(true); - } - models.set(childPosition, current); - adapter.notifyItemChanged(groupPosition); - } - } - } - - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - if (resultCode == Activity.RESULT_OK) { - if (requestCode == FullScreenFileChangeActivity.Companion.getFOR_RESULT_CODE() && data != null) { - List comments = data.getParcelableArrayListExtra(BundleConstant.ITEM); - if (comments != null && !comments.isEmpty()) { - if (viewCallback != null) { - for (CommentRequestModel comment : comments) { - viewCallback.onAddComment(comment); - } - showMessage(R.string.success, R.string.comments_added_successfully); - } - } - } - } - super.onActivityResult(requestCode, resultCode, data); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/files/PullRequestFilesMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/files/PullRequestFilesMvp.java deleted file mode 100644 index 633db903d..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/files/PullRequestFilesMvp.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.files; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.CommentRequestModel; -import com.fastaccess.data.dao.CommitFileChanges; -import com.fastaccess.data.dao.CommitFileModel; -import com.fastaccess.data.dao.CommitLinesModel; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.callback.OnToggleView; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.reviews.callback.ReviewCommentListener; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -public interface PullRequestFilesMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener, - OnToggleView, OnPatchClickListener, ReviewCommentListener { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - - void onOpenForResult(int position, @NonNull CommitFileChanges linesModel); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - void onFragmentCreated(@NonNull Bundle bundle); - - @NonNull ArrayList getFiles(); - - void onWorkOffline(); - } - - interface OnPatchClickListener { - void onPatchClicked(int groupPosition, int childPosition, android.view.View v, CommitFileModel commit, CommitLinesModel item); - } - - interface PatchCallback { - void onAddComment(CommentRequestModel comment); - } - - interface CommitCommentCallback { - @NonNull ArrayList getCommitComment(); - - void onAddComment(@NonNull CommentRequestModel comment); - - boolean hasReviewComments(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/files/PullRequestFilesPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/files/PullRequestFilesPresenter.java deleted file mode 100644 index 7c00fd689..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/files/PullRequestFilesPresenter.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.files; - -import android.app.Activity; -import android.net.Uri; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.MenuInflater; -import android.view.View; -import android.widget.PopupMenu; - -import com.fastaccess.R; -import com.fastaccess.data.dao.CommitFileChanges; -import com.fastaccess.data.dao.CommitFileModel; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.code.CodeViewerActivity; -import com.fastaccess.ui.modules.repos.code.commit.details.CommitPagerActivity; - -import java.util.ArrayList; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class PullRequestFilesPresenter extends BasePresenter implements PullRequestFilesMvp.Presenter { - - @com.evernote.android.state.State String login; - @com.evernote.android.state.State String repoId; - @com.evernote.android.state.State long number; - private ArrayList files = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public void onError(@NonNull Throwable throwable) { - onWorkOffline(); - super.onError(throwable); - } - - @Override public boolean onCallApi(int page, @Nullable Object parameter) { - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0) { - sendToView(PullRequestFilesMvp.View::hideProgress); - return false; - } - if (repoId == null || login == null) return false; - makeRestCall(RestProvider.getPullRequestService(isEnterprise()).getPullRequestFiles(login, repoId, number, page) - .flatMap(commitFileModelPageable -> { - if (commitFileModelPageable != null) { - lastPage = commitFileModelPageable.getLast(); - if (commitFileModelPageable.getItems() != null) { - return Observable.just(CommitFileChanges.construct(commitFileModelPageable.getItems())); - } - } - return Observable.empty(); - }), - response -> sendToView(view -> view.onNotifyAdapter(response, page))); - return true; - } - - @Override public void onFragmentCreated(@NonNull Bundle bundle) { - repoId = bundle.getString(BundleConstant.ID); - login = bundle.getString(BundleConstant.EXTRA); - number = bundle.getLong(BundleConstant.EXTRA_TWO); - if (!InputHelper.isEmpty(login) && !InputHelper.isEmpty(repoId)) { - onCallApi(1, null); - } - } - - @NonNull @Override public ArrayList getFiles() { - return files; - } - - @Override public void onWorkOffline() { - sendToView(BaseMvp.FAView::hideProgress); - } - - @Override public void onItemClick(int position, View v, CommitFileChanges model) { - if (v.getId() == R.id.patchList) { - sendToView(view -> view.onOpenForResult(position, model)); - } else if (v.getId() == R.id.open) { - CommitFileModel item = model.getCommitFileModel(); - PopupMenu popup = new PopupMenu(v.getContext(), v); - MenuInflater inflater = popup.getMenuInflater(); - inflater.inflate(R.menu.commit_row_menu, popup.getMenu()); - popup.setOnMenuItemClickListener(item1 -> { - switch (item1.getItemId()) { - case R.id.open: - v.getContext().startActivity(CodeViewerActivity.createIntent(v.getContext(), item.getContentsUrl(), item.getBlobUrl())); - break; - case R.id.share: - ActivityHelper.shareUrl(v.getContext(), item.getBlobUrl()); - break; - case R.id.download: - Activity activity = ActivityHelper.getActivity(v.getContext()); - if (activity == null) break; - if (ActivityHelper.checkAndRequestReadWritePermission(activity)) { - RestProvider.downloadFile(v.getContext(), item.getRawUrl()); - } - break; - case R.id.copy: - AppHelper.copyToClipboard(v.getContext(), item.getBlobUrl()); - break; - } - return true; - }); - popup.show(); - } - } - - @Override public void onItemLongClick(int position, View v, CommitFileChanges item) { - v.getContext().startActivity(CommitPagerActivity.createIntent(v.getContext(), repoId, login, - Uri.parse(item.getCommitFileModel().getContentsUrl()).getQueryParameter("ref"))); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/files/fullscreen/FullScreenFileChangeActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/files/fullscreen/FullScreenFileChangeActivity.kt deleted file mode 100644 index 7ad7685ca..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/files/fullscreen/FullScreenFileChangeActivity.kt +++ /dev/null @@ -1,177 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.files.fullscreen - -import android.app.Activity -import android.content.Intent -import android.net.Uri -import android.os.Bundle -import androidx.fragment.app.Fragment -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout -import android.view.Menu -import android.view.MenuItem -import android.view.View -import android.widget.TextView -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.data.dao.CommentRequestModel -import com.fastaccess.data.dao.CommitFileChanges -import com.fastaccess.data.dao.CommitLinesModel -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.helper.PrefGetter -import com.fastaccess.ui.adapter.CommitLinesAdapter -import com.fastaccess.ui.base.BaseActivity -import com.fastaccess.ui.modules.main.premium.PremiumActivity -import com.fastaccess.ui.modules.reviews.AddReviewDialogFragment -import com.fastaccess.ui.widgets.StateLayout -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller - -/** - * Created by Hashemsergani on 24.09.17. - */ - -class FullScreenFileChangeActivity : BaseActivity(), FullScreenFileChangeMvp.View { - - @BindView(R.id.recycler) lateinit var recycler: DynamicRecyclerView - @BindView(R.id.refresh) lateinit var refresh: SwipeRefreshLayout - @BindView(R.id.stateLayout) lateinit var stateLayout: StateLayout - @BindView(R.id.fastScroller) lateinit var fastScroller: RecyclerViewFastScroller - @BindView(R.id.changes) lateinit var changes: TextView - @BindView(R.id.deletion) lateinit var deletion: TextView - @BindView(R.id.addition) lateinit var addition: TextView - - val commentList = arrayListOf() - - private val adapter by lazy { CommitLinesAdapter(arrayListOf(), this) } - - override fun layout(): Int = R.layout.full_screen_file_changes_layout - - override fun isTransparent(): Boolean = false - - override fun canBack(): Boolean = true - - override fun isSecured(): Boolean = false - - override fun providePresenter(): FullScreenFileChangePresenter = FullScreenFileChangePresenter() - - override fun onNotifyAdapter(model: CommitLinesModel) { - adapter.addItem(model) - } - - override fun showMessage(titleRes: Int, msgRes: Int) { - hideProgress() - super.showMessage(titleRes, msgRes) - } - - override fun showMessage(titleRes: String, msgRes: String) { - hideProgress() - super.showMessage(titleRes, msgRes) - } - - override fun showErrorMessage(msgRes: String) { - hideProgress() - super.showErrorMessage(msgRes) - } - - override fun showProgress(resId: Int) { - stateLayout.showProgress() - refresh.isRefreshing = true - } - - override fun hideProgress() { - stateLayout.hideProgress() - refresh.isRefreshing = false - } - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - refresh.isEnabled = false - recycler.adapter = adapter - val padding = resources.getDimensionPixelSize(R.dimen.spacing_normal) - recycler.setPadding(padding, 0, padding, 0) - fastScroller.attachRecyclerView(recycler) - presenter.onLoad(intent) - presenter.model?.let { model -> - title = Uri.parse(model.commitFileModel.filename).lastPathSegment - addition.text = model.commitFileModel?.additions.toString() - deletion.text = model.commitFileModel?.deletions.toString() - changes.text = model.commitFileModel?.changes.toString() - } - } - - override fun onCreateOptionsMenu(menu: Menu?): Boolean { - menuInflater.inflate(R.menu.done_menu, menu) - menu?.findItem(R.id.submit)?.setIcon(R.drawable.ic_done) - return super.onCreateOptionsMenu(menu) - } - - override fun onOptionsItemSelected(item: MenuItem?): Boolean { - return when (item?.itemId) { - R.id.submit -> { - sendResult() - true - } - else -> super.onOptionsItemSelected(item) - } - } - - override fun onItemClick(position: Int, v: View, item: CommitLinesModel) { - if (item.text.startsWith("@@")) return - val commit = presenter.model?.commitFileModel ?: return - if (PrefGetter.isProEnabled()) { - AddReviewDialogFragment.newInstance(item, Bundler.start() - .put(BundleConstant.ITEM, commit.filename) - .put(BundleConstant.EXTRA_TWO, presenter.position) - .put(BundleConstant.EXTRA_THREE, position) - .end()) - .show(supportFragmentManager, "AddReviewDialogFragment") - } else { - PremiumActivity.startActivity(this) - } - } - - override fun onItemLongClick(position: Int, v: View?, item: CommitLinesModel?) { - - } - - override fun onCommentAdded(comment: String, item: CommitLinesModel, bundle: Bundle?) { - if (bundle != null) { - val path = bundle.getString(BundleConstant.ITEM) ?: return - val commentRequestModel = CommentRequestModel() - commentRequestModel.body = comment - commentRequestModel.path = path - commentRequestModel.position = item.position - commentList.add(commentRequestModel) - val childPosition = bundle.getInt(BundleConstant.EXTRA_THREE) - val current = adapter.getItem(childPosition) - if (current != null) { - current.isHasCommentedOn = true - adapter.swapItem(current, childPosition) - } - if (presenter.isCommit) { - sendResult() - } - } - } - - private fun sendResult() { - val intent = Intent() - intent.putExtras(Bundler.start().putParcelableArrayList(BundleConstant.ITEM, commentList).end()) - setResult(Activity.RESULT_OK, intent) - finish() - } - - - companion object { - val FOR_RESULT_CODE = 1002 - fun startActivityForResult(fragment: Fragment, model: CommitFileChanges, position: Int, isCommit: Boolean = false) { - val intent = Intent(fragment.context, FullScreenFileChangeActivity::class.java) - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA, model) - .put(BundleConstant.ITEM, position) - .put(BundleConstant.YES_NO_EXTRA, isCommit) - .end()) - fragment.startActivityForResult(intent, FOR_RESULT_CODE) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/files/fullscreen/FullScreenFileChangeMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/files/fullscreen/FullScreenFileChangeMvp.kt deleted file mode 100644 index 398eedff4..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/files/fullscreen/FullScreenFileChangeMvp.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.files.fullscreen - -import android.content.Intent -import com.fastaccess.data.dao.CommitLinesModel -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.modules.reviews.callback.ReviewCommentListener -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created by Hashemsergani on 24.09.17. - */ - -interface FullScreenFileChangeMvp { - interface View : BaseMvp.FAView, BaseViewHolder.OnItemClickListener, ReviewCommentListener { - fun onNotifyAdapter(model: CommitLinesModel) - } - - interface Presenter { - fun onLoad(intent: Intent) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/files/fullscreen/FullScreenFileChangePresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/files/fullscreen/FullScreenFileChangePresenter.kt deleted file mode 100644 index 5e5915f31..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/files/fullscreen/FullScreenFileChangePresenter.kt +++ /dev/null @@ -1,39 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.files.fullscreen - -import android.content.Intent -import com.fastaccess.data.dao.CommitFileChanges -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.RxHelper -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import io.reactivex.Observable - -/** - * Created by Hashemsergani on 24.09.17. - */ -class FullScreenFileChangePresenter : BasePresenter(), FullScreenFileChangeMvp.Presenter { - - var model: CommitFileChanges? = null - var position: Int = -1 - var isCommit: Boolean = false - - override fun onLoad(intent: Intent) { - intent.extras?.let { - position = it.getInt(BundleConstant.ITEM) - model = it.getParcelable(BundleConstant.EXTRA) - isCommit = it.getBoolean(BundleConstant.YES_NO_EXTRA) - } - model?.let { - manageDisposable(RxHelper.getObservable(Observable.fromIterable(it.linesModel)) - .doOnSubscribe({ sendToView { it.showProgress(0) } }) - .flatMap { Observable.just(it) } - .subscribe - ({ - sendToView { v -> v.onNotifyAdapter(it) } - }, { - onError(it) - }, { - sendToView { it.hideProgress() } - })) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/timeline/timeline/PullRequestTimelineFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/timeline/timeline/PullRequestTimelineFragment.java deleted file mode 100644 index b55ecd51a..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/timeline/timeline/PullRequestTimelineFragment.java +++ /dev/null @@ -1,434 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.timeline.timeline; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import android.view.View; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.EditReviewCommentModel; -import com.fastaccess.data.dao.ReviewCommentModel; -import com.fastaccess.data.dao.TimelineModel; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.data.dao.types.ReactionTypes; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.provider.timeline.CommentsHelper; -import com.fastaccess.ui.adapter.IssuesTimelineAdapter; -import com.fastaccess.ui.adapter.viewholder.TimelineCommentsViewHolder; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.editor.EditorActivity; -import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment; -import com.fastaccess.ui.modules.repos.issues.issue.details.IssuePagerMvp; -import com.fastaccess.ui.modules.repos.reactions.ReactionsDialogFragment; -import com.fastaccess.ui.widgets.AppbarRefreshLayout; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.dialog.MessageDialogView; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 31 Mar 2017, 7:35 PM - */ - -public class PullRequestTimelineFragment extends BaseFragment - implements PullRequestTimelineMvp.View { - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) AppbarRefreshLayout refresh; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @State HashMap toggleMap = new LinkedHashMap<>(); - private IssuesTimelineAdapter adapter; - private OnLoadMore onLoadMore; - private CommentEditorFragment.CommentListener commentsCallback; - - private IssuePagerMvp.IssuePrCallback issueCallback; - - @NonNull public static PullRequestTimelineFragment newInstance() { - return new PullRequestTimelineFragment(); - } - - @SuppressWarnings("unchecked") @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() instanceof IssuePagerMvp.IssuePrCallback) { - issueCallback = (IssuePagerMvp.IssuePrCallback) getParentFragment(); - } else if (context instanceof IssuePagerMvp.IssuePrCallback) { - issueCallback = (IssuePagerMvp.IssuePrCallback) context; - } else { - throw new IllegalArgumentException(String.format("%s or parent fragment must implement IssuePagerMvp.IssuePrCallback", context.getClass() - .getSimpleName())); - } - if (getParentFragment() instanceof CommentEditorFragment.CommentListener) { - commentsCallback = (CommentEditorFragment.CommentListener) getParentFragment(); - } else if (context instanceof CommentEditorFragment.CommentListener) { - commentsCallback = (CommentEditorFragment.CommentListener) context; - } else { - throw new IllegalArgumentException(String.format("%s or parent fragment must implement CommentEditorFragment.CommentListener", - context.getClass().getSimpleName())); - } - } - - @Override public void onDetach() { - issueCallback = null; - commentsCallback = null; - super.onDetach(); - } - - @Override public void onRefresh() { - getPresenter().onCallApi(1, getPullRequest()); - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (getPullRequest() == null) { - throw new NullPointerException("PullRequest went missing!!!"); - } - boolean isMerged = getPresenter().isMerged(getPullRequest()); - adapter = new IssuesTimelineAdapter(getPresenter().getEvents(), this, true, - this, isMerged, getPresenter(), getPullRequest().getLogin(), getPullRequest().getUser().getLogin()); - stateLayout.setEmptyText(R.string.no_events); - recycler.setEmptyView(stateLayout, refresh); - refresh.setOnRefreshListener(this); - stateLayout.setOnReloadListener(this); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - fastScroller.setVisibility(View.VISIBLE); - fastScroller.attachRecyclerView(recycler); - recycler.addDivider(TimelineCommentsViewHolder.class); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.addOnScrollListener(getLoadMore()); - if (savedInstanceState == null) { - onSetHeader(new TimelineModel(getPullRequest())); - onRefresh(); - } else if (getPresenter().getEvents().isEmpty() || getPresenter().getEvents().size() == 1) { - onRefresh(); - } - } - - @NonNull @Override public PullRequestTimelinePresenter providePresenter() { - return new PullRequestTimelinePresenter(); - } - - @Override public void showProgress(@StringRes int resId) { - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onToggle(long position, boolean isCollapsed) { - toggleMap.put(position, isCollapsed); - } - - @Override public boolean isCollapsed(long position) { - return toggleMap.get(position) != null && toggleMap.get(position); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null) { - adapter.subList(1, adapter.getItemCount()); - return; - } - if (page == 1) { - adapter.subList(1, adapter.getItemCount()); - } - adapter.addItems(items); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter()); - } - onLoadMore.setParameter(getPullRequest()); - return onLoadMore; - } - - @Override public void onEditComment(@NonNull Comment item) { - Intent intent = new Intent(getContext(), EditorActivity.class); - if (getPullRequest() == null) return; - intent.putExtras(Bundler - .start() - .put(BundleConstant.ID, getPullRequest().getRepoId()) - .put(BundleConstant.EXTRA_TWO, getPullRequest().getLogin()) - .put(BundleConstant.EXTRA_THREE, getPullRequest().getNumber()) - .put(BundleConstant.EXTRA_FOUR, item.getId()) - .put(BundleConstant.EXTRA, item.getBody()) - .put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraType.EDIT_ISSUE_COMMENT_EXTRA) - .putStringArrayList("participants", CommentsHelper.getUsersByTimeline(adapter.getData())) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise()) - .end()); - View view = getFromView(); - ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE); - } - - @Override public void onEditReviewComment(@NonNull ReviewCommentModel item, int groupPosition, int childPosition) { - EditReviewCommentModel model = new EditReviewCommentModel(); - model.setCommentPosition(childPosition); - model.setGroupPosition(groupPosition); - model.setInReplyTo(item.getId()); - Intent intent = new Intent(getContext(), EditorActivity.class); - if (getPullRequest() == null) return; - intent.putExtras(Bundler - .start() - .put(BundleConstant.ID, getPullRequest().getRepoId()) - .put(BundleConstant.EXTRA_TWO, getPullRequest().getLogin()) - .put(BundleConstant.EXTRA_THREE, getPullRequest().getNumber()) - .put(BundleConstant.EXTRA_FOUR, item.getId()) - .put(BundleConstant.EXTRA, item.getBody()) - .put(BundleConstant.REVIEW_EXTRA, model) - .put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraType.EDIT_REVIEW_COMMENT_EXTRA) - .putStringArrayList("participants", CommentsHelper.getUsersByTimeline(adapter.getData())) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise()) - .end()); - View view = getFromView(); - ActivityHelper.startReveal(this, intent, view, BundleConstant.REVIEW_REQUEST_CODE); - } - - @Override public void onRemove(@NonNull TimelineModel timelineModel) { - hideProgress(); - adapter.removeItem(timelineModel); - } - - @Override public void onShowDeleteMsg(long id) { - MessageDialogView.newInstance(getString(R.string.delete), getString(R.string.confirm_message), - Bundler.start() - .put(BundleConstant.EXTRA, id) - .put(BundleConstant.YES_NO_EXTRA, false) - .end()) - .show(getChildFragmentManager(), MessageDialogView.TAG); - } - - @Override public void onReply(User user, String message) { - Intent intent = new Intent(getContext(), EditorActivity.class); - if (getPullRequest() == null) return; - intent.putExtras(Bundler - .start() - .put(BundleConstant.ID, getPullRequest().getRepoId()) - .put(BundleConstant.EXTRA_TWO, getPullRequest().getLogin()) - .put(BundleConstant.EXTRA_THREE, getPullRequest().getNumber()) - .put(BundleConstant.EXTRA, "@" + user.getLogin()) - .put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraType.NEW_ISSUE_COMMENT_EXTRA) - .putStringArrayList("participants", CommentsHelper.getUsersByTimeline(adapter.getData())) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise()) - .put("message", message) - .end()); - View view = getFromView(); - ActivityHelper.startReveal(this, intent, view, BundleConstant.REQUEST_CODE); - } - - @Override public void onHandleComment(@NonNull String text, @Nullable Bundle bundle) { - getPresenter().onHandleComment(text, bundle); - } - - @Override public void onReplyOrCreateReview(@Nullable User user, @Nullable String message, - int groupPosition, int childPosition, - @NonNull EditReviewCommentModel model) { - Intent intent = new Intent(getContext(), EditorActivity.class); - if (getPullRequest() == null) return; - intent.putExtras(Bundler - .start() - .put(BundleConstant.ID, getPullRequest().getRepoId()) - .put(BundleConstant.EXTRA_TWO, getPullRequest().getLogin()) - .put(BundleConstant.EXTRA_THREE, getPullRequest().getNumber()) - .put(BundleConstant.EXTRA, user != null ? "@" + user.getLogin() : "") - .put(BundleConstant.REVIEW_EXTRA, model) - .put(BundleConstant.EXTRA_TYPE, BundleConstant.ExtraType.NEW_REVIEW_COMMENT_EXTRA) - .putStringArrayList("participants", CommentsHelper.getUsersByTimeline(adapter.getData())) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise()) - .put("message", message) - .end()); - View view = getFromView(); - ActivityHelper.startReveal(this, intent, view, BundleConstant.REVIEW_REQUEST_CODE); - } - - @Override public void addComment(@NonNull TimelineModel timelineModel) { - onHideBlockingProgress(); - adapter.addItem(timelineModel); - if (commentsCallback != null) commentsCallback.onClearEditText(); - } - - @NonNull @Override public ArrayList getNamesToTag() { - return CommentsHelper.getUsersByTimeline(adapter.getData()); - } - - @Override public void onHideBlockingProgress() { - hideProgress(); - super.hideProgress(); - } - - @Override public void showReactionsPopup(@NonNull ReactionTypes type, @NonNull String login, @NonNull String repoId, - long idOrNumber, int reactionType) { - ReactionsDialogFragment.newInstance(login, repoId, type, idOrNumber, reactionType).show(getChildFragmentManager(), "ReactionsDialogFragment"); - } - - @Override public void onShowReviewDeleteMsg(long commentId, int groupPosition, int commentPosition) { - MessageDialogView.newInstance(getString(R.string.delete), getString(R.string.confirm_message), - Bundler.start() - .put(BundleConstant.EXTRA, commentId) - .put(BundleConstant.YES_NO_EXTRA, true) - .put(BundleConstant.EXTRA_TWO, groupPosition) - .put(BundleConstant.EXTRA_THREE, commentPosition) - .end()) - .show(getChildFragmentManager(), MessageDialogView.TAG); - } - - @Override public void onRemoveReviewComment(int groupPosition, int commentPosition) { - hideProgress(); - TimelineModel timelineModel = adapter.getItem(groupPosition); - if (timelineModel != null && timelineModel.getGroupedReviewModel() != null) { - if (timelineModel.getGroupedReviewModel().getComments() != null) { - timelineModel.getGroupedReviewModel().getComments().remove(commentPosition); - if (timelineModel.getGroupedReviewModel().getComments().isEmpty()) { - adapter.removeItem(groupPosition); - } else { - adapter.notifyItemChanged(groupPosition); - } - } - } - } - - @Override public void onSetHeader(@NonNull TimelineModel timelineModel) { - if (adapter != null) { - if (adapter.isEmpty()) { - adapter.addItem(timelineModel, 0); - } else { - adapter.swapItem(timelineModel, 0); - } - } - } - - @Nullable @Override public PullRequest getPullRequest() { - return issueCallback.getData(); - } - - @Override public void onUpdateHeader() { - if (getPullRequest() == null) return; - onSetHeader(new TimelineModel(getPullRequest())); - } - - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (resultCode == Activity.RESULT_OK) { - if (data == null) { - onRefresh(); - return; - } - Bundle bundle = data.getExtras(); - if (bundle != null) { - boolean isNew = bundle.getBoolean(BundleConstant.EXTRA); - if (requestCode == BundleConstant.REQUEST_CODE) { - Comment commentsModel = bundle.getParcelable(BundleConstant.ITEM); - if (commentsModel == null) { - onRefresh(); // bundle size is too large? refresh the api - return; - } - if (isNew) { - adapter.addItem(TimelineModel.constructComment(commentsModel)); - recycler.smoothScrollToPosition(adapter.getItemCount()); - } else { - int position = adapter.getItem(TimelineModel.constructComment(commentsModel)); - if (position != -1) { - adapter.swapItem(TimelineModel.constructComment(commentsModel), position); - recycler.smoothScrollToPosition(position); - } else { - adapter.addItem(TimelineModel.constructComment(commentsModel)); - recycler.smoothScrollToPosition(adapter.getItemCount()); - } - } - } else if (requestCode == BundleConstant.REVIEW_REQUEST_CODE) { - EditReviewCommentModel commentModel = bundle.getParcelable(BundleConstant.ITEM); - if (commentModel == null) { - onRefresh(); // bundle size is too large? refresh the api - return; - } - TimelineModel timelineModel = adapter.getItem(commentModel.getGroupPosition()); - if (isNew) { - if (timelineModel.getGroupedReviewModel() != null && timelineModel.getGroupedReviewModel().getComments() != null) { - timelineModel.getGroupedReviewModel().getComments().add(commentModel.getCommentModel()); - adapter.notifyItemChanged(commentModel.getGroupPosition()); - } else { - onRefresh(); - } - } else { - if (timelineModel.getGroupedReviewModel() != null && timelineModel.getGroupedReviewModel().getComments() != null) { - timelineModel.getGroupedReviewModel().getComments().set(commentModel.getCommentPosition(), commentModel.getCommentModel - ()); - adapter.notifyItemChanged(commentModel.getGroupPosition()); - } else { - onRefresh(); - } - } - } - } else { - onRefresh(); // bundle size is too large? refresh the api - } - } - } - - @Override public void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle) { - super.onMessageDialogActionClicked(isOk, bundle); - if (isOk) { - getPresenter().onHandleDeletion(bundle); - } - } - - @Override public boolean isPreviouslyReacted(long id, int vId) { - return getPresenter().isPreviouslyReacted(id, vId); - } - - @Override public boolean isCallingApi(long id, int vId) { - return getPresenter().isCallingApi(id, vId); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - @Override public void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } - - private View getFromView() { - return getActivity() != null && getActivity().findViewById(R.id.fab) != null ? getActivity().findViewById(R.id.fab) : recycler; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/timeline/timeline/PullRequestTimelineMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/timeline/timeline/PullRequestTimelineMvp.java deleted file mode 100644 index e440250b5..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/timeline/timeline/PullRequestTimelineMvp.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.timeline.timeline; - -import android.os.Bundle; -import androidx.annotation.IdRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.EditReviewCommentModel; -import com.fastaccess.data.dao.ReviewCommentModel; -import com.fastaccess.data.dao.TimelineModel; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.data.dao.types.ReactionTypes; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.provider.timeline.ReactionsProvider; -import com.fastaccess.ui.adapter.callback.OnToggleView; -import com.fastaccess.ui.adapter.callback.ReactionsCallback; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import net.grandcentrix.thirtyinch.callonmainthread.CallOnMainThread; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 31 Mar 2017, 7:15 PM - */ - -public interface PullRequestTimelineMvp { - - interface ReviewCommentCallback { - void onClick(int groupPosition, int commentPosition, @NonNull android.view.View view, @NonNull ReviewCommentModel model); - - void onLongClick(int groupPosition, int commentPosition, @NonNull android.view.View view, @NonNull ReviewCommentModel model); - } - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener, - OnToggleView, ReactionsCallback { - - @CallOnMainThread void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - - void onEditComment(@NonNull Comment item); - - void onEditReviewComment(@NonNull ReviewCommentModel item, int groupPosition, int childPosition); - - void onRemove(@NonNull TimelineModel timelineModel); - - void onShowDeleteMsg(long id); - - void onReply(User user, String message); - - void showReactionsPopup(@NonNull ReactionTypes type, @NonNull String login, @NonNull String repoId, long idOrNumber, @ReactionsProvider - .ReactionType int reactionType); - - void onShowReviewDeleteMsg(long commentId, int groupPosition, int commentPosition); - - void onRemoveReviewComment(int groupPosition, int commentPosition); - - void onSetHeader(@NonNull TimelineModel timelineModel); - - @Nullable PullRequest getPullRequest(); - - void onUpdateHeader(); - - @CallOnMainThread void showReload(); - - void onHandleComment(String text, @Nullable Bundle bundle); - - void onReplyOrCreateReview(@Nullable User user, @Nullable String message, int groupPosition, int childPosition, - @NonNull EditReviewCommentModel model); - - void addComment(@NonNull TimelineModel timelineModel); - - @NonNull ArrayList getNamesToTag(); - - void onHideBlockingProgress(); - } - - interface Presenter extends BaseMvp.FAPresenter, BaseViewHolder.OnItemClickListener, - ReviewCommentCallback, BaseMvp.PaginationListener { - - @NonNull ArrayList getEvents(); - - void onWorkOffline(); - - void onHandleDeletion(@Nullable Bundle bundle); - - boolean isPreviouslyReacted(long commentId, int vId); - - void onHandleReaction(@IdRes int vId, long idOrNumber, @ReactionsProvider.ReactionType int reactionType); - - boolean isMerged(PullRequest pullRequest); - - boolean isCallingApi(long id, int vId); - - void onHandleComment(@NonNull String text, @Nullable Bundle bundle); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/timeline/timeline/PullRequestTimelinePresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/timeline/timeline/PullRequestTimelinePresenter.java deleted file mode 100644 index 102d09512..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/details/timeline/timeline/PullRequestTimelinePresenter.java +++ /dev/null @@ -1,456 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request.details.timeline.timeline; - -import android.app.Activity; -import android.net.Uri; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.util.SparseArray; -import android.view.View; -import android.widget.PopupMenu; - -import com.fastaccess.R; -import com.fastaccess.data.dao.CommentRequestModel; -import com.fastaccess.data.dao.EditReviewCommentModel; -import com.fastaccess.data.dao.GroupedReviewModel; -import com.fastaccess.data.dao.PullRequestStatusModel; -import com.fastaccess.data.dao.ReviewCommentModel; -import com.fastaccess.data.dao.TimelineModel; -import com.fastaccess.data.dao.model.Comment; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.data.dao.model.PullRequest; -import com.fastaccess.data.dao.timeline.GenericEvent; -import com.fastaccess.data.dao.timeline.SourceModel; -import com.fastaccess.data.dao.types.IssueEventType; -import com.fastaccess.data.dao.types.ReactionTypes; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.provider.timeline.CommentsHelper; -import com.fastaccess.provider.timeline.ReactionsProvider; -import com.fastaccess.provider.timeline.TimelineConverter; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.filter.issues.FilterIssuesActivity; -import com.fastaccess.ui.modules.repos.issues.create.CreateIssueActivity; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 31 Mar 2017, 7:17 PM - */ - -public class PullRequestTimelinePresenter extends BasePresenter implements PullRequestTimelineMvp.Presenter { - private ArrayList timeline = new ArrayList<>(); - private SparseArray pages = new SparseArray<>(); - private ReactionsProvider reactionsProvider; - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - @com.evernote.android.state.State boolean isCollaborator; - - @Override public void onItemClick(int position, View v, TimelineModel item) { - if (getView() == null) return; - PullRequest pullRequest = getView().getPullRequest(); - if (pullRequest != null) { - if (item.getType() == TimelineModel.COMMENT) { - if (v.getId() == R.id.commentMenu) { - PopupMenu popupMenu = new PopupMenu(v.getContext(), v); - popupMenu.inflate(R.menu.comments_menu); - String username = Login.getUser().getLogin(); - boolean isOwner = CommentsHelper.isOwner(username, pullRequest.getLogin(), item.getComment().getUser().getLogin()) - || isCollaborator; - popupMenu.getMenu().findItem(R.id.delete).setVisible(isOwner); - popupMenu.getMenu().findItem(R.id.edit).setVisible(isOwner); - popupMenu.setOnMenuItemClickListener(item1 -> { - if (getView() == null) return false; - if (item1.getItemId() == R.id.delete) { - getView().onShowDeleteMsg(item.getComment().getId()); - } else if (item1.getItemId() == R.id.reply) { - getView().onReply(item.getComment().getUser(), item.getComment().getBodyHtml()); - } else if (item1.getItemId() == R.id.edit) { - getView().onEditComment(item.getComment()); - } else if (item1.getItemId() == R.id.share) { - ActivityHelper.shareUrl(v.getContext(), item.getComment().getHtmlUrl()); - } - return true; - }); - popupMenu.show(); - } else { - onHandleReaction(v.getId(), item.getComment().getId(), ReactionsProvider.COMMENT); - } - } else if (item.getType() == TimelineModel.EVENT) { - GenericEvent issueEventModel = item.getGenericEvent(); - if (issueEventModel.getCommitUrl() != null) { - SchemeParser.launchUri(v.getContext(), Uri.parse(issueEventModel.getCommitUrl())); - } else if (issueEventModel.getLabel() != null) { - FilterIssuesActivity.startActivity(v, pullRequest.getLogin(), pullRequest.getRepoId(), false, - true, isEnterprise(), "label:\"" + issueEventModel.getLabel().getName() + "\""); - } else if (issueEventModel.getMilestone() != null) { - FilterIssuesActivity.startActivity(v, pullRequest.getLogin(), pullRequest.getRepoId(), false, - true, isEnterprise(), "milestone:\"" + issueEventModel.getMilestone().getTitle() + "\""); - } else if (issueEventModel.getAssignee() != null) { - FilterIssuesActivity.startActivity(v, pullRequest.getLogin(), pullRequest.getRepoId(), false, - true, isEnterprise(), "assignee:\"" + issueEventModel.getAssignee().getLogin() + "\""); - } else if (issueEventModel.getEvent() == IssueEventType.committed) { - SchemeParser.launchUri(v.getContext(), issueEventModel.getUrl().replace("git/", "")); - } else { - SourceModel sourceModel = issueEventModel.getSource(); - if (sourceModel != null) { - if (sourceModel.getCommit() != null) { - SchemeParser.launchUri(v.getContext(), sourceModel.getCommit().getUrl()); - } else if (sourceModel.getPullRequest() != null) { - SchemeParser.launchUri(v.getContext(), sourceModel.getPullRequest().getUrl()); - } else if (sourceModel.getIssue() != null) { - SchemeParser.launchUri(v.getContext(), sourceModel.getIssue().getHtmlUrl()); - } else if (sourceModel.getRepository() != null) { - SchemeParser.launchUri(v.getContext(), sourceModel.getRepository().getUrl()); - } - } - } - } else if (item.getType() == TimelineModel.HEADER) { - if (v.getId() == R.id.commentMenu) { - PopupMenu popupMenu = new PopupMenu(v.getContext(), v); - popupMenu.inflate(R.menu.comments_menu); - String username = Login.getUser().getLogin(); - boolean isOwner = CommentsHelper.isOwner(username, item.getPullRequest().getLogin(), - item.getPullRequest().getUser().getLogin()) || isCollaborator; - popupMenu.getMenu().findItem(R.id.edit).setVisible(isOwner); - popupMenu.setOnMenuItemClickListener(item1 -> { - if (getView() == null) return false; - if (item1.getItemId() == R.id.reply) { - getView().onReply(item.getPullRequest().getUser(), item.getPullRequest().getBodyHtml()); - } else if (item1.getItemId() == R.id.edit) { - Activity activity = ActivityHelper.getActivity(v.getContext()); - if (activity == null) return false; - CreateIssueActivity.startForResult(activity, - item.getPullRequest().getLogin(), item.getPullRequest().getRepoId(), - item.getPullRequest(), isEnterprise()); - } else if (item1.getItemId() == R.id.share) { - ActivityHelper.shareUrl(v.getContext(), item.getPullRequest().getHtmlUrl()); - } - return true; - }); - popupMenu.show(); - } else { - onHandleReaction(v.getId(), item.getPullRequest().getNumber(), ReactionsProvider.HEADER); - } - } else if (item.getType() == TimelineModel.GROUP) { - GroupedReviewModel reviewModel = item.getGroupedReviewModel(); - if (v.getId() == R.id.addCommentPreview) { - if (getView() != null) { - EditReviewCommentModel model = new EditReviewCommentModel(); - model.setCommentPosition(-1); - model.setGroupPosition(position); - model.setInReplyTo(reviewModel.getId()); - getView().onReplyOrCreateReview(null, null, position, -1, model); - - } - } - } - } - } - - @Override public void onItemLongClick(int position, View v, TimelineModel item) { - if (getView() == null || getView().getPullRequest() == null) return; - if (item.getType() == TimelineModel.COMMENT || item.getType() == TimelineModel.HEADER) { - if (v.getId() == R.id.commentMenu && item.getType() == TimelineModel.COMMENT) { - Comment comment = item.getComment(); - if (getView() != null) getView().onReply(comment.getUser(), comment.getBody()); - } else { - PullRequest pullRequest = getView().getPullRequest(); - String login = pullRequest.getLogin(); - String repoId = pullRequest.getRepoId(); - if (!InputHelper.isEmpty(login) && !InputHelper.isEmpty(repoId)) { - ReactionTypes type = ReactionTypes.get(v.getId()); - if (type != null) { - if (item.getType() == TimelineModel.HEADER) { - getView().showReactionsPopup(type, login, repoId, item.getPullRequest().getNumber(), ReactionsProvider.HEADER); - } else { - getView().showReactionsPopup(type, login, repoId, item.getComment().getId(), ReactionsProvider.COMMENT); - } - } else { - onItemClick(position, v, item); - } - } - } - } else { - onItemClick(position, v, item); - } - } - - @NonNull @Override public ArrayList getEvents() { - return timeline; - } - - @Override public void onWorkOffline() { - //TODO - } - - @Override public void onHandleDeletion(@Nullable Bundle bundle) { - if (getView() == null || getView().getPullRequest() == null) return; - if (bundle != null) { - PullRequest pullRequest = getView().getPullRequest(); - String login = pullRequest.getLogin(); - String repoId = pullRequest.getRepoId(); - long commId = bundle.getLong(BundleConstant.EXTRA, 0); - boolean isReviewComment = bundle.getBoolean(BundleConstant.YES_NO_EXTRA); - if (commId != 0 && !isReviewComment) { - makeRestCall(RestProvider.getIssueService(isEnterprise()).deleteIssueComment(login, repoId, commId), - booleanResponse -> sendToView(view -> { - if (booleanResponse.code() == 204) { - Comment comment = new Comment(); - comment.setId(commId); - view.onRemove(TimelineModel.constructComment(comment)); - } else { - view.showMessage(R.string.error, R.string.error_deleting_comment); - } - })); - } else { - int groupPosition = bundle.getInt(BundleConstant.EXTRA_TWO); - int commentPosition = bundle.getInt(BundleConstant.EXTRA_THREE); - makeRestCall(RestProvider.getReviewService(isEnterprise()).deleteComment(login, repoId, commId), - booleanResponse -> sendToView(view -> { - if (booleanResponse.code() == 204) { - view.onRemoveReviewComment(groupPosition, commentPosition); - } else { - view.showMessage(R.string.error, R.string.error_deleting_comment); - } - })); - } - } - } - - @Override public void onHandleReaction(int vId, long idOrNumber, @ReactionsProvider.ReactionType int reactionType) { - if (getView() == null || getView().getPullRequest() == null) return; - PullRequest pullRequest = getView().getPullRequest(); - String login = pullRequest.getLogin(); - String repoId = pullRequest.getRepoId(); - Observable observable = getReactionsProvider().onHandleReaction(vId, idOrNumber, login, repoId, reactionType, isEnterprise()); - if (observable != null) //noinspection unchecked - manageObservable(observable); - } - - @Override public boolean isMerged(PullRequest pullRequest) { - return pullRequest != null && (pullRequest.isMerged() || !InputHelper.isEmpty(pullRequest.getMergedAt())); - } - - @Override public boolean isCallingApi(long id, int vId) { - return getReactionsProvider().isCallingApi(id, vId); - } - - @Override public void onHandleComment(@NonNull String text, @Nullable Bundle bundle) { - if (getView() == null) return; - PullRequest pullRequest = getView().getPullRequest(); - if (pullRequest != null) { - if (bundle == null) { - CommentRequestModel commentRequestModel = new CommentRequestModel(); - commentRequestModel.setBody(text); - manageDisposable(RxHelper.getObservable(RestProvider.getIssueService(isEnterprise()).createIssueComment(pullRequest.getLogin(), - pullRequest.getRepoId(), pullRequest.getNumber(), commentRequestModel)) - .doOnSubscribe(disposable -> sendToView(view -> view.showBlockingProgress(0))) - .subscribe(comment -> sendToView(view -> view.addComment(TimelineModel.constructComment(comment))), - throwable -> { - onError(throwable); - sendToView(PullRequestTimelineMvp.View::onHideBlockingProgress); - })); - } - } - } - - @Override public boolean isPreviouslyReacted(long commentId, int vId) { - return getReactionsProvider().isPreviouslyReacted(commentId, vId); - } - - @NonNull private ReactionsProvider getReactionsProvider() { - if (reactionsProvider == null) { - reactionsProvider = new ReactionsProvider(); - } - return reactionsProvider; - } - - @Override public void onClick(int groupPosition, int commentPosition, @NonNull View v, @NonNull ReviewCommentModel comment) { - if (getView() == null || getView().getPullRequest() == null) return; - if (v.getId() == R.id.commentMenu) { - PopupMenu popupMenu = new PopupMenu(v.getContext(), v); - popupMenu.inflate(R.menu.comments_menu); - String username = Login.getUser().getLogin(); - boolean isOwner = CommentsHelper.isOwner(username, getView().getPullRequest().getLogin(), comment.getUser().getLogin()) || isCollaborator; - popupMenu.getMenu().findItem(R.id.delete).setVisible(isOwner); - popupMenu.getMenu().findItem(R.id.edit).setVisible(isOwner); - popupMenu.setOnMenuItemClickListener(item1 -> { - if (getView() == null) return false; - if (item1.getItemId() == R.id.delete) { - getView().onShowReviewDeleteMsg(comment.getId(), groupPosition, commentPosition); - } else if (item1.getItemId() == R.id.reply) { - EditReviewCommentModel model = new EditReviewCommentModel(); - model.setGroupPosition(groupPosition); - model.setCommentPosition(commentPosition); - model.setInReplyTo(comment.getId()); - getView().onReplyOrCreateReview(comment.getUser(), comment.getBodyHtml(), groupPosition, commentPosition, model); - } else if (item1.getItemId() == R.id.edit) { - getView().onEditReviewComment(comment, groupPosition, commentPosition); - } else if (item1.getItemId() == R.id.share) { - ActivityHelper.shareUrl(v.getContext(), comment.getHtmlUrl()); - } - return true; - }); - popupMenu.show(); - } else { - onHandleReaction(v.getId(), comment.getId(), ReactionsProvider.REVIEW_COMMENT); - } - } - - @Override public void onLongClick(int groupPosition, int commentPosition, @NonNull View v, @NonNull ReviewCommentModel model) { - if (getView() == null || getView().getPullRequest() == null) return; - PullRequest pullRequest = getView().getPullRequest(); - String login = pullRequest.getLogin(); - String repoId = pullRequest.getRepoId(); - if (!InputHelper.isEmpty(login) && !InputHelper.isEmpty(repoId)) { - ReactionTypes type = ReactionTypes.get(v.getId()); - if (type != null) { - getView().showReactionsPopup(type, login, repoId, model.getId(), ReactionsProvider.REVIEW_COMMENT); - } else { - onClick(groupPosition, commentPosition, v, model); - } - } - } - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public boolean onCallApi(int page, @Nullable PullRequest parameter) { - if (parameter == null) { - sendToView(BaseMvp.FAView::hideProgress); - return false; - } - String login = parameter.getLogin(); - String repoId = parameter.getRepoId(); - int number = parameter.getNumber(); - if (page <= 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - pages.clear(); - } - if (page > lastPage || lastPage == 0) { - sendToView(PullRequestTimelineMvp.View::hideProgress); - return false; - } - if (page == 1) { - manageObservable(RestProvider.getRepoService(isEnterprise()).isCollaborator(login, repoId, - Login.getUser().getLogin()) - .doOnNext(booleanResponse -> isCollaborator = booleanResponse.code() == 204)); - } - setCurrentPage(page); - if (parameter.getHead() != null) { - Observable> observable = Observable.zip( - RestProvider.getIssueService(isEnterprise()).getTimeline(login, repoId, number, page), - RestProvider.getReviewService(isEnterprise()).getPrReviewComments(login, repoId, number), - RestProvider.getPullRequestService(isEnterprise()).getPullStatus(login, repoId, parameter.getHead().getSha()) - .onErrorReturn(throwable -> RestProvider.getPullRequestService(isEnterprise()).getPullStatus(login, repoId, - parameter.getBase().getSha()).blockingFirst(new PullRequestStatusModel())), - (response, comments, status) -> { - if (response != null) { - lastPage = response.getLast(); - List models = TimelineConverter.INSTANCE.convert(response.getItems(), comments); - if (page == 1 && status != null) { - status.setMergable(parameter.isMergeable()); - status.setMergeableState(parameter.getMergeableState()); - if (status.getState() != null) { - models.add(0, new TimelineModel(status)); - } - } - return models; - } else { - return Collections.emptyList(); - } - }); - makeRestCall(observable, timeline -> sendToView(view -> view.onNotifyAdapter(timeline, page))); - return true; - } - return false; - } -// -// @Nullable private Observable getTimelineObservable(Response response, -// boolean isMergeable) { -// if (!response.hasErrors()) { -// PullRequestTimelineQuery.Data data = response.data(); -// if (data != null) { -// PullRequestTimelineQuery.Repository repo = data.repository(); -// PullRequestTimelineQuery.PullRequest pullRequest = repo != null ? repo.pullRequest() : null; -// if (pullRequest != null) { -// PullRequestTimelineQuery.Timeline timeline = pullRequest.timeline(); -// lastPage = timeline.pageInfo().hasNextPage() ? Integer.MAX_VALUE : 0; -// pages.clear(); -// ArrayList models = new ArrayList<>(); -// PullRequestTimelineQuery.PullRequestCommits pullRequestCommits = pullRequest.pullRequestCommits(); -// List commits = pullRequestCommits.pullRequestCommit(); -// if (commits != null && !commits.isEmpty() && page <= 1) { -// PullRequestTimelineQuery.Status status = commits.get(0).commit().status(); -// if (status != null) { -// models.add(new PullRequestTimelineModel(status, isMergeable)); -// } -// } -// List edges = timeline.edges(); -// if (edges != null) { -// Stream.of(edges).forEachIndexed((i, edge) -> pages.append(i, edge.cursor())); -// } -// List nodes = timeline.nodes(); -// if (nodes != null) { -// for (PullRequestTimelineQuery.Node node : nodes) { -// models.add(new PullRequestTimelineModel(node)); -// } -// } -// return RxHelper.getObservable(Observable.fromIterable(models)); -// } -// } -// } -// return null; -// } -// -// @NonNull private PullRequestTimelineQuery getTimelineBuilder(@NonNull String login, @NonNull String repoId, int number, int page) { -// return PullRequestTimelineQuery.builder() -// .owner(login) -// .name(repoId) -// .number(number) -// .page(getPage()) -// .build(); -// } -// -// @Nullable private String getPage() { -// return pages.size() != 0 ? pages.valueAt(pages.size() - 1) : ""; -// } -// -// private void loadEverything(@NonNull String login, @NonNull String repoId, int number, -// @NonNull String sha, boolean isMergeable, int page) { -// PullRequestTimelineQuery query = getTimelineBuilder(login, repoId, number, page); -// ApolloCall apolloCall = App.getInstance().getApolloClient().query(query); -// Observable observable = Rx2Apollo.from(apolloCall) -// .flatMap(response -> { -// Observable models = getTimelineObservable(response, isMergeable); -// return models != null ? models : RxHelper.getObservable(Observable.fromIterable(new ArrayList<>())); -// }); -// makeRestCall(observable.toList().toObservable(), -// pullRequestTimelineModels -> sendToView(view -> view.onNotifyAdapter(pullRequestTimelineModels, page))); -// } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/merge/MergePullReqeustMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/merge/MergePullReqeustMvp.java deleted file mode 100644 index 8daff5d50..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/merge/MergePullReqeustMvp.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request.merge; - -import androidx.annotation.NonNull; - -import com.fastaccess.ui.base.mvp.BaseMvp; - -/** - * Created by Kosh on 18 Mar 2017, 12:11 PM - */ - -public interface MergePullReqeustMvp { - - interface MergeCallback { - void onMerge(@NonNull String msg, @NonNull String mergeMethod); - } - - interface View extends BaseMvp.FAView { - - } - - interface Presenter {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/merge/MergePullRequestDialogFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/merge/MergePullRequestDialogFragment.java deleted file mode 100644 index 79a29eef4..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/merge/MergePullRequestDialogFragment.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request.merge; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.textfield.TextInputLayout; -import androidx.appcompat.widget.AppCompatSpinner; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.ui.base.BaseDialogFragment; -import com.fastaccess.ui.modules.main.premium.PremiumActivity; - -import org.jetbrains.annotations.NotNull; - -import butterknife.BindView; -import butterknife.OnClick; -import butterknife.OnItemSelected; - -/** - * Created by Kosh on 18 Mar 2017, 12:13 PM - */ - -public class MergePullRequestDialogFragment extends BaseDialogFragment - implements MergePullReqeustMvp.View { - - @BindView(R.id.title) TextInputLayout title; - @BindView(R.id.mergeMethod) AppCompatSpinner mergeMethod; - - private MergePullReqeustMvp.MergeCallback mergeCallback; - - public static MergePullRequestDialogFragment newInstance(@Nullable String title) { - MergePullRequestDialogFragment view = new MergePullRequestDialogFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.EXTRA, title) - .end()); - return view; - } - - @Override public void onAttach(@NotNull Context context) { - super.onAttach(context); - if (context instanceof MergePullReqeustMvp.MergeCallback) { - mergeCallback = (MergePullReqeustMvp.MergeCallback) context; - } else if (getParentFragment() instanceof MergePullReqeustMvp.MergeCallback) { - mergeCallback = (MergePullReqeustMvp.MergeCallback) getParentFragment(); - } - } - - @Override public void onDetach() { - mergeCallback = null; - super.onDetach(); - } - - @Override protected int fragmentLayout() { - return R.layout.merge_dialog_layout; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (savedInstanceState == null) { - String titleMsg = getArguments().getString(BundleConstant.EXTRA); - if (!InputHelper.isEmpty(titleMsg)) { - if (title.getEditText() != null) title.getEditText().setText(titleMsg); - } - } - } - - @NonNull @Override public MergePullRequestPresenter providePresenter() { - return new MergePullRequestPresenter(); - } - - @OnClick({R.id.cancel, R.id.ok}) public void onClick(View view) { - if (view.getId() == R.id.ok) { - boolean isEmpty = InputHelper.isEmpty(title); - title.setError(isEmpty ? getString(R.string.required_field) : null); - if (isEmpty) return; - mergeCallback.onMerge(InputHelper.toString(title), mergeMethod.getSelectedItem().toString().toLowerCase()); - } - dismiss(); - } - - @OnItemSelected(R.id.mergeMethod) void onItemSelect(int position) { - if (position > 0) { - if (!PrefGetter.isProEnabled()) { - mergeMethod.setSelection(0); - PremiumActivity.Companion.startActivity(getContext()); - } - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/merge/MergePullRequestPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/merge/MergePullRequestPresenter.java deleted file mode 100644 index ab2f86ae8..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/pull_requests/pull_request/merge/MergePullRequestPresenter.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fastaccess.ui.modules.repos.pull_requests.pull_request.merge; - -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -/** - * Created by Kosh on 18 Mar 2017, 12:13 PM - */ - -public class MergePullRequestPresenter extends BasePresenter implements MergePullReqeustMvp.Presenter {} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/reactions/ReactionsDialogFragment.java b/app/src/main/java/com/fastaccess/ui/modules/repos/reactions/ReactionsDialogFragment.java deleted file mode 100644 index c39d99812..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/reactions/ReactionsDialogFragment.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.fastaccess.ui.modules.repos.reactions; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import com.google.android.material.appbar.AppBarLayout; -import androidx.appcompat.widget.Toolbar; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.data.dao.types.ReactionTypes; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.provider.timeline.CommentsHelper; -import com.fastaccess.provider.timeline.ReactionsProvider; -import com.fastaccess.ui.adapter.UsersAdapter; -import com.fastaccess.ui.base.BaseDialogFragment; -import com.fastaccess.ui.widgets.AppbarRefreshLayout; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 11 Apr 2017, 11:30 AM - */ - -public class ReactionsDialogFragment extends BaseDialogFragment - implements ReactionsDialogMvp.View { - - @BindView(R.id.toolbar) Toolbar toolbar; - @BindView(R.id.appbar) AppBarLayout appbar; - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) AppbarRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private UsersAdapter adapter; - private OnLoadMore onLoadMore; - - public static ReactionsDialogFragment newInstance(@NonNull String login, @NonNull String repoId, - @NonNull ReactionTypes type, long idOrNumber, - @ReactionsProvider.ReactionType int reactionType) { - ReactionsDialogFragment view = new ReactionsDialogFragment(); - view.setArguments(Bundler.start() - .put(BundleConstant.EXTRA_TYPE, type) - .put(BundleConstant.EXTRA, repoId) - .put(BundleConstant.EXTRA_TWO, login) - .put(BundleConstant.EXTRA_THREE, reactionType) - .put(BundleConstant.ID, idOrNumber) - .end()); - return view; - } - - @Override protected int fragmentLayout() { - return R.layout.milestone_dialog_layout; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - toolbar.setNavigationIcon(R.drawable.ic_clear); - toolbar.setNavigationOnClickListener(v -> dismiss()); - stateLayout.setEmptyText(R.string.no_reactions); - stateLayout.setOnReloadListener(v -> getPresenter().onCallApi(1, null)); - refresh.setOnRefreshListener(() -> getPresenter().onCallApi(1, null)); - recycler.setEmptyView(stateLayout, refresh); - adapter = new UsersAdapter(getPresenter().getUsers()); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - recycler.setAdapter(adapter); - recycler.addOnScrollListener(getLoadMore()); - if (savedInstanceState == null) { - getPresenter().onFragmentCreated(getArguments()); - } - toolbar.setTitle(SpannableBuilder.builder().append(getString(R.string.reactions)) - .append(" ") - .append(CommentsHelper.getEmoji(getPresenter().getReactionType()))); - fastScroller.attachRecyclerView(recycler); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @SuppressWarnings("unchecked") @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore(getPresenter()); - } - return onLoadMore; - } - - @NonNull @Override public ReactionsDialogPresenter providePresenter() { - return new ReactionsDialogPresenter(); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/reactions/ReactionsDialogMvp.java b/app/src/main/java/com/fastaccess/ui/modules/repos/reactions/ReactionsDialogMvp.java deleted file mode 100644 index 87ed349eb..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/reactions/ReactionsDialogMvp.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.fastaccess.ui.modules.repos.reactions; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 11 Apr 2017, 11:19 AM - */ - -public interface ReactionsDialogMvp { - - interface View extends BaseMvp.FAView { - void onNotifyAdapter(@Nullable List items, int page); - - @NonNull OnLoadMore getLoadMore(); - } - - interface Presenter extends BaseMvp.PaginationListener { - void onFragmentCreated(@Nullable Bundle bundle); - - @NonNull ArrayList getUsers(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/reactions/ReactionsDialogPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/repos/reactions/ReactionsDialogPresenter.java deleted file mode 100644 index 2bd4bb951..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/reactions/ReactionsDialogPresenter.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.fastaccess.ui.modules.repos.reactions; - -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.annimon.stream.Collectors; -import com.annimon.stream.Stream; -import com.fastaccess.data.dao.Pageable; -import com.fastaccess.data.dao.ReactionsModel; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.data.dao.types.ReactionTypes; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.timeline.ReactionsProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -import io.reactivex.Observable; - -/** - * Created by Kosh on 11 Apr 2017, 11:20 AM - */ - -public class ReactionsDialogPresenter extends BasePresenter implements ReactionsDialogMvp.Presenter { - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - private ArrayList users = new ArrayList<>(); - @com.evernote.android.state.State String login; - @com.evernote.android.state.State String repoId; - @com.evernote.android.state.State long id; - @com.evernote.android.state.State ReactionTypes reactionType; - @com.evernote.android.state.State @ReactionsProvider.ReactionType int reactionTypeMode; - - @Override public void onFragmentCreated(@Nullable Bundle bundle) { - if (bundle != null) { - repoId = bundle.getString(BundleConstant.EXTRA); - login = bundle.getString(BundleConstant.EXTRA_TWO); - id = bundle.getLong(BundleConstant.ID); - reactionType = (ReactionTypes) bundle.getSerializable(BundleConstant.EXTRA_TYPE); - reactionTypeMode = bundle.getInt(BundleConstant.EXTRA_THREE); - onCallApi(1, null); - } - } - - @NonNull @Override public ArrayList getUsers() { - return users; - } - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public boolean onCallApi(int page, @Nullable Object parameter) { - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - if (page > lastPage || lastPage == 0 || (login == null || repoId == null || reactionType == null)) { - sendToView(ReactionsDialogMvp.View::hideProgress); - return false; - } - setCurrentPage(page); - Observable> observable = null; - switch (reactionTypeMode) { - case ReactionsProvider.COMMENT: - observable = RestProvider.getReactionsService(isEnterprise()) - .getIssueCommentReaction(login, repoId, id, reactionType.getContent(), page); - break; - case ReactionsProvider.COMMIT: - observable = RestProvider.getReactionsService(isEnterprise()) - .getCommitReaction(login, repoId, id, reactionType.getContent(), page); - break; - case ReactionsProvider.HEADER: - observable = RestProvider.getReactionsService(isEnterprise()) - .getIssueReaction(login, repoId, id, reactionType.getContent(), page); - break; - case ReactionsProvider.REVIEW_COMMENT: - observable = RestProvider.getReactionsService(isEnterprise()) - .getPullRequestReactions(login, repoId, id, reactionType.getContent(), page); - break; - } - if (observable == null) { - throw new NullPointerException("Reaction is null?"); - } - makeRestCall(observable, response -> { - lastPage = response.getLast(); - sendToView(view -> view.onNotifyAdapter(Stream.of(response.getItems()) - .filter(reactionsModel -> reactionsModel.getUser() != null) - .map(ReactionsModel::getUser) - .collect(Collectors.toList()), page)); - }); - return true; - } - - ReactionTypes getReactionType() { - return reactionType; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/wiki/WikiActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/wiki/WikiActivity.kt deleted file mode 100644 index ed869ea62..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/wiki/WikiActivity.kt +++ /dev/null @@ -1,191 +0,0 @@ -package com.fastaccess.ui.modules.repos.wiki - -import android.content.Context -import android.content.Intent -import android.net.Uri -import android.os.Bundle -import com.google.android.material.navigation.NavigationView -import androidx.drawerlayout.widget.DrawerLayout -import android.view.Gravity -import android.view.Menu -import android.view.MenuItem -import android.view.View -import android.widget.ProgressBar -import butterknife.BindView -import com.evernote.android.state.State -import com.fastaccess.R -import com.fastaccess.data.dao.NameParser -import com.fastaccess.data.dao.wiki.WikiContentModel -import com.fastaccess.helper.ActivityHelper -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.provider.scheme.LinkParserHelper -import com.fastaccess.ui.base.BaseActivity -import com.fastaccess.ui.modules.repos.RepoPagerActivity -import com.fastaccess.ui.widgets.StateLayout -import com.prettifier.pretty.PrettifyWebView - -/** - * Created by Kosh on 13 Jun 2017, 8:35 PM - */ -class WikiActivity : BaseActivity(), WikiMvp.View { - - @BindView(R.id.wikiSidebar) lateinit var navMenu: NavigationView - @BindView(R.id.drawer) lateinit var drawerLayout: DrawerLayout - @BindView(R.id.progress) lateinit var progressbar: ProgressBar - @BindView(R.id.stateLayout) lateinit var stateLayout: StateLayout - @BindView(R.id.webView) lateinit var webView: PrettifyWebView - - @State var wiki = WikiContentModel(null, null, arrayListOf()) - @State var selectedTitle: String = "Home" - - override fun layout(): Int = R.layout.wiki_activity_layout - - override fun isTransparent(): Boolean = true - - override fun providePresenter(): WikiPresenter = WikiPresenter() - - override fun onLoadContent(wiki: WikiContentModel) { - hideProgress() - this.wiki = wiki - if (wiki.sidebar.isNotEmpty()) { - loadMenu() - } - if (wiki.content != null) { - val baseUrl = Uri.Builder().scheme(LinkParserHelper.PROTOCOL_HTTPS) - .authority(LinkParserHelper.HOST_DEFAULT) - .appendPath(presenter.login) - .appendPath(presenter.repoId) - .appendPath("wiki") - .build() - .toString() - webView.setWikiContent(wiki.content, baseUrl) - } - } - - override fun onSetPage(page: String) { - selectedTitle = page - } - - override fun canBack(): Boolean = true - - override fun isSecured(): Boolean = false - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - if (savedInstanceState != null) { - onLoadContent(wiki) - } else { - presenter.onActivityCreated(intent) - } - navMenu.setNavigationItemSelectedListener { - onSidebarClicked(it) - return@setNavigationItemSelectedListener true - } - - toolbar?.subtitle = presenter.login + "/" + presenter.repoId - setTaskName("${presenter.login}/${presenter.repoId} - Wiki - $selectedTitle") - } - - override fun onCreateOptionsMenu(menu: Menu?): Boolean { - menuInflater.inflate(R.menu.trending_menu, menu) - menu?.findItem(R.id.menu)?.setIcon(R.drawable.ic_menu) - return super.onCreateOptionsMenu(menu) - } - - override fun onOptionsItemSelected(item: MenuItem?): Boolean { - when (item?.itemId) { - R.id.menu -> { - drawerLayout.openDrawer(Gravity.END) - return true - } - R.id.share -> { - ActivityHelper.shareUrl( - this, "${LinkParserHelper.PROTOCOL_HTTPS}://${LinkParserHelper.HOST_DEFAULT}/" + - "${presenter.login}/${presenter.repoId}/wiki/$selectedTitle" - ) - return true - } - android.R.id.home -> { - if (!presenter.login.isNullOrEmpty() && !presenter.repoId.isNullOrEmpty()) { - val nameParse = NameParser("") - nameParse.name = presenter.repoId!! - nameParse.username = presenter.login!! - nameParse.isEnterprise = isEnterprise - RepoPagerActivity.startRepoPager(this, nameParse) - } - finish() - return true - } - else -> return super.onOptionsItemSelected(item) - } - } - - override fun showMessage(titleRes: Int, msgRes: Int) { - hideProgress() - super.showMessage(titleRes, msgRes) - } - - override fun showMessage(titleRes: String, msgRes: String) { - hideProgress() - super.showMessage(titleRes, msgRes) - } - - override fun showErrorMessage(msgRes: String) { - hideProgress() - super.showErrorMessage(msgRes) - } - - override fun showProgress(resId: Int) { - progressbar.visibility = View.VISIBLE - stateLayout.showProgress() - } - - override fun hideProgress() { - progressbar.visibility = View.GONE - stateLayout.hideProgress() - } - - override fun showPrivateRepoError() { - onLoadContent(WikiContentModel("

${getString(R.string.private_wiki_error_msg)}

", null, listOf())) - } - - private fun onSidebarClicked(item: MenuItem) { - this.selectedTitle = item.title.toString() - setTaskName("${presenter.login}/${presenter.repoId} - Wiki - $selectedTitle") - closeDrawerLayout() - wiki.sidebar.first { it.title?.toLowerCase() == item.title.toString().toLowerCase() } - .let { presenter.onSidebarClicked(it) } - } - - private fun closeDrawerLayout() { - drawerLayout.closeDrawer(Gravity.END) - } - - private fun loadMenu() { - navMenu.menu.clear() - wiki.sidebar.onEach { - navMenu.menu.add(R.id.languageGroup, it.title?.hashCode()!!, Menu.NONE, it.title) - .setCheckable(true) - .isChecked = it.title.toLowerCase() == selectedTitle.toLowerCase() - } - } - - companion object { - fun getWiki(context: Context, repoId: String?, username: String?): Intent { - return getWiki(context, repoId, username, null) - } - - fun getWiki(context: Context, repoId: String?, username: String?, page: String?): Intent { - val intent = Intent(context, WikiActivity::class.java) - intent.putExtras( - Bundler.start() - .put(BundleConstant.ID, repoId) - .put(BundleConstant.EXTRA, username) - .put(BundleConstant.EXTRA_TWO, page) - .end() - ) - return intent - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/wiki/WikiMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/wiki/WikiMvp.kt deleted file mode 100644 index 0ed37bed8..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/wiki/WikiMvp.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.fastaccess.ui.modules.repos.wiki - -import android.content.Intent -import com.fastaccess.data.dao.wiki.WikiContentModel -import com.fastaccess.data.dao.wiki.WikiSideBarModel -import com.fastaccess.ui.base.mvp.BaseMvp - -/** - * Created by Kosh on 13 Jun 2017, 8:11 PM - */ -interface WikiMvp { - interface View : BaseMvp.FAView { - fun onLoadContent(wiki: WikiContentModel) - fun onSetPage(page: String) - fun showPrivateRepoError() - } - - interface Presenter { - fun onActivityCreated(intent: Intent?) - fun onSidebarClicked(sidebar: WikiSideBarModel) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/wiki/WikiPresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/wiki/WikiPresenter.kt deleted file mode 100644 index 124029259..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/wiki/WikiPresenter.kt +++ /dev/null @@ -1,114 +0,0 @@ -package com.fastaccess.ui.modules.repos.wiki - -import android.content.Intent -import com.fastaccess.BuildConfig -import com.fastaccess.R -import com.fastaccess.data.dao.wiki.FirebaseWikiConfigModel -import com.fastaccess.data.dao.wiki.WikiContentModel -import com.fastaccess.data.dao.wiki.WikiSideBarModel -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.RxHelper -import com.fastaccess.provider.rest.jsoup.JsoupProvider -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import com.github.b3er.rxfirebase.database.RxFirebaseDatabase -import com.google.firebase.database.FirebaseDatabase -import io.reactivex.Observable -import org.jsoup.Jsoup -import org.jsoup.nodes.Document -import retrofit2.HttpException -import java.util.* - -/** - * Created by Kosh on 13 Jun 2017, 8:14 PM - */ -class WikiPresenter : BasePresenter(), WikiMvp.Presenter { - - @com.evernote.android.state.State var repoId: String? = null - @com.evernote.android.state.State var login: String? = null - private var firebaseWikiConfigModel: FirebaseWikiConfigModel? = null - - override fun onActivityCreated(intent: Intent?) { - if (intent != null) { - val bundle = intent.extras - repoId = bundle?.getString(BundleConstant.ID) - login = bundle?.getString(BundleConstant.EXTRA) - val page = bundle?.getString(BundleConstant.EXTRA_TWO) - if (!page.isNullOrEmpty()) { - sendToView { it.onSetPage(page) } - } - if (!repoId.isNullOrEmpty() && !login.isNullOrEmpty()) { - onSidebarClicked(WikiSideBarModel("Home", "$login/$repoId/wiki" + if (!page.isNullOrEmpty()) "/$page" else "")) - } - } - } - - override fun onSidebarClicked(sidebar: WikiSideBarModel) { - if (firebaseWikiConfigModel == null) { - manageDisposable( - RxHelper.getSingle(RxFirebaseDatabase.data(FirebaseDatabase.getInstance().reference.child("github_wiki"))) - .doOnSubscribe { sendToView { it.showProgress(0) } } - .map { - firebaseWikiConfigModel = FirebaseWikiConfigModel.map(it.value as? HashMap) - return@map firebaseWikiConfigModel - } - .subscribe( - { callApi(sidebar) }, - { callApi(sidebar) } - ) - ) - } else { - callApi(sidebar) - } - } - - private fun callApi(sidebar: WikiSideBarModel) { - manageViewDisposable(RxHelper.getObservable(JsoupProvider.getWiki().getWiki(sidebar.link)) - .flatMap { s -> RxHelper.getObservable(getWikiContent(s)) } - .doOnSubscribe { sendToView { it.showProgress(0) } } - .subscribe( - { response -> sendToView { view -> view.onLoadContent(response) } }, - { throwable -> - if (throwable is HttpException) { - if (throwable.code() == 404) { - sendToView { it.showPrivateRepoError() } - return@subscribe - } - } - onError(throwable) - }, - { sendToView { it.hideProgress() } } - ) - ) - } - - private fun getWikiContent(body: String?): Observable { - return Observable.fromPublisher { s -> - val document: Document = Jsoup.parse(body, "") - val firebaseWikiConfigModel = firebaseWikiConfigModel ?: kotlin.run { - s.onNext(WikiContentModel("

No Wiki

", "", arrayListOf())) - s.onComplete() - return@fromPublisher - } - val wikiWrapper = document.select(firebaseWikiConfigModel.wikiWrapper) - if (!wikiWrapper.isNullOrEmpty()) { - val header = wikiWrapper.select(firebaseWikiConfigModel.wikiHeader)?.text() - val subHeaderText = wikiWrapper.select(firebaseWikiConfigModel.wikiSubHeader)?.text() - val wikiContent = wikiWrapper.select(firebaseWikiConfigModel.wikiContent) - val wikiBody = wikiContent?.select(firebaseWikiConfigModel.wikiBody)?.html() - val rightBarList = wikiContent?.select(firebaseWikiConfigModel.sideBarUl)?.select(firebaseWikiConfigModel.sideBarList) - val headerHtml = "

$header

$subHeaderText

" - val content = "$headerHtml $wikiBody" - s.onNext(WikiContentModel(content, null, rightBarList?.map { - WikiSideBarModel( - it.select(firebaseWikiConfigModel.sideBarListTitle).text(), - it.select(firebaseWikiConfigModel.sideBarListTitle).attr(firebaseWikiConfigModel.sideBarListLink) - ) - } ?: listOf())) - } else { - s.onNext(WikiContentModel("

No Wiki

", "", arrayListOf())) - } - - s.onComplete() - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/reviews/AddReviewDialogFragment.kt b/app/src/main/java/com/fastaccess/ui/modules/reviews/AddReviewDialogFragment.kt deleted file mode 100644 index baa17f839..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/reviews/AddReviewDialogFragment.kt +++ /dev/null @@ -1,116 +0,0 @@ -package com.fastaccess.ui.modules.reviews - -import android.content.Context -import android.graphics.Color -import android.os.Bundle -import androidx.core.content.ContextCompat -import androidx.appcompat.widget.Toolbar -import android.view.View -import android.widget.TextView -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.data.dao.CommitLinesModel -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.helper.InputHelper -import com.fastaccess.helper.ViewHelper -import com.fastaccess.ui.base.BaseDialogFragment -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment -import com.fastaccess.ui.modules.reviews.callback.ReviewCommentListener -import com.fastaccess.ui.widgets.SpannableBuilder - -/** - * Created by Kosh on 24 Jun 2017, 12:32 PM - */ -class AddReviewDialogFragment : BaseDialogFragment>() { - - @BindView(R.id.toolbar) lateinit var toolbar: Toolbar - @BindView(R.id.text) lateinit var textView: TextView - @BindView(R.id.lineNo) lateinit var lineNo: TextView - - private val commentEditorFragment: CommentEditorFragment? by lazy { - childFragmentManager.findFragmentByTag("CommentEditorFragment") as CommentEditorFragment? - } - private val spacePattern = "\\s+".toRegex() - - private var commentCallback: ReviewCommentListener? = null - - override fun onAttach(context: Context) { - super.onAttach(context) - commentCallback = if (parentFragment is ReviewCommentListener) { - parentFragment as ReviewCommentListener - } else { - context as ReviewCommentListener - } - } - - override fun onDetach() { - commentCallback = null - super.onDetach() - } - - override fun fragmentLayout(): Int = R.layout.review_comment_dialog_layout - - override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { - if (savedInstanceState == null) { - val fragment = CommentEditorFragment() - fragment.arguments = Bundler.start().put(BundleConstant.YES_NO_EXTRA, true).end() - childFragmentManager.beginTransaction() - .replace(R.id.commentFragmentContainer, fragment, "CommentEditorFragment") - .commitNow() - } - arguments?.getParcelable(BundleConstant.ITEM)?.let { item -> - lineNo.text = SpannableBuilder.builder() - .append(if (item.leftLineNo >= 0) String.format("%s.", item.leftLineNo) else "") - .append(if (item.rightLineNo >= 0) String.format("%s.", item.rightLineNo) else "") - lineNo.visibility = if (InputHelper.isEmpty(lineNo)) View.GONE else View.VISIBLE - - val context = context ?: return - when (item.color) { - CommitLinesModel.ADDITION -> textView.setBackgroundColor(ViewHelper.getPatchAdditionColor(context)) - CommitLinesModel.DELETION -> textView.setBackgroundColor(ViewHelper.getPatchDeletionColor(context)) - CommitLinesModel.PATCH -> textView.setBackgroundColor(ViewHelper.getPatchRefColor(context)) - else -> textView.setBackgroundColor(Color.TRANSPARENT) - } - if (item.noNewLine) { - textView.text = SpannableBuilder.builder().append(item.text.replace(spacePattern, " ")).append(" ") - .append(ContextCompat.getDrawable(context, R.drawable.ic_newline)) - } else { - textView.text = item.text.replace(spacePattern, " ") - } - toolbar.setTitle(R.string.add_comment) - toolbar.setNavigationIcon(R.drawable.ic_clear) - toolbar.setNavigationOnClickListener { dismiss() } - toolbar.inflateMenu(R.menu.add_menu) - toolbar.setOnMenuItemClickListener { - if (commentEditorFragment?.getEditText()?.text.isNullOrEmpty()) { - commentEditorFragment?.getEditText()?.error = getString(R.string.required_field) - } else { - commentEditorFragment?.getEditText()?.error = null - commentCallback?.onCommentAdded( - InputHelper.toString(commentEditorFragment?.getEditText()?.text), - item, arguments!!.getBundle(BundleConstant.EXTRA) - ) - dismiss() - } - return@setOnMenuItemClickListener true - } - } - - } - - override fun providePresenter(): BasePresenter = BasePresenter() - - companion object { - fun newInstance(commitLinesModel: CommitLinesModel, bundle: Bundle? = null): AddReviewDialogFragment { - val dialog = AddReviewDialogFragment() - dialog.arguments = Bundler.start() - .put(BundleConstant.ITEM, commitLinesModel) - .put(BundleConstant.EXTRA, bundle) - .end() - return dialog - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/reviews/callback/ReviewCommentListener.kt b/app/src/main/java/com/fastaccess/ui/modules/reviews/callback/ReviewCommentListener.kt deleted file mode 100644 index 2c9e8ad4a..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/reviews/callback/ReviewCommentListener.kt +++ /dev/null @@ -1,11 +0,0 @@ -package com.fastaccess.ui.modules.reviews.callback - -import android.os.Bundle -import com.fastaccess.data.dao.CommitLinesModel - -/** - * Created by Kosh on 24 Jun 2017, 12:38 PM - */ -interface ReviewCommentListener { - fun onCommentAdded(comment: String, item: CommitLinesModel, bundle: Bundle?) -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesActivity.kt deleted file mode 100644 index 2b9d562ff..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesActivity.kt +++ /dev/null @@ -1,151 +0,0 @@ -package com.fastaccess.ui.modules.reviews.changes - -import android.content.Context -import android.os.Bundle -import androidx.core.content.ContextCompat -import androidx.appcompat.widget.Toolbar -import android.view.View -import android.widget.Spinner -import butterknife.BindView -import com.evernote.android.state.State -import com.fastaccess.R -import com.fastaccess.data.dao.ReviewRequestModel -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.helper.InputHelper -import com.fastaccess.ui.base.BaseDialogFragment -import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment - -/** - * Created by Kosh on 25 Jun 2017, 1:25 AM - */ -class ReviewChangesActivity : BaseDialogFragment(), ReviewChangesMvp.View { - - @BindView(R.id.toolbar) lateinit var toolbar: Toolbar - @BindView(R.id.reviewMethod) lateinit var spinner: Spinner - - @State var reviewRequest: ReviewRequestModel? = null - @State var repoId: String? = null - @State var owner: String? = null - @State var number: Long? = null - @State var isClosed: Boolean = false - @State var isAuthor: Boolean = false - - private var subimssionCallback: ReviewChangesMvp.ReviewSubmissionCallback? = null - - private val commentEditorFragment: CommentEditorFragment? by lazy { - childFragmentManager.findFragmentByTag("commentContainer") as CommentEditorFragment? - } - - override fun onAttach(context: Context) { - super.onAttach(context) - if (parentFragment is ReviewChangesMvp.ReviewSubmissionCallback) { - subimssionCallback = parentFragment as ReviewChangesMvp.ReviewSubmissionCallback - } else if (context is ReviewChangesMvp.ReviewSubmissionCallback) { - subimssionCallback = context - } - } - - override fun onDetach() { - subimssionCallback = null - super.onDetach() - } - - override fun providePresenter(): ReviewChangesPresenter = ReviewChangesPresenter() - - override fun fragmentLayout(): Int = R.layout.add_review_dialog_layout - - override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { - if (savedInstanceState == null) { - val fragment = CommentEditorFragment() - fragment.arguments = Bundler.start().put(BundleConstant.YES_NO_EXTRA, true).end() - childFragmentManager.beginTransaction() - .replace(R.id.commentContainer, fragment, "commentContainer") - .commit() - val bundle = arguments!! - reviewRequest = bundle.getParcelable(BundleConstant.EXTRA) - repoId = bundle.getString(BundleConstant.EXTRA_TWO) - owner = bundle.getString(BundleConstant.EXTRA_THREE) - number = bundle.getLong(BundleConstant.ID) - isClosed = bundle.getBoolean(BundleConstant.EXTRA_FIVE) - isAuthor = bundle.getBoolean(BundleConstant.EXTRA_FOUR) - } - toolbar.navigationIcon = ContextCompat.getDrawable(context!!, R.drawable.ic_clear) - toolbar.inflateMenu(R.menu.done_menu) - toolbar.setNavigationOnClickListener { dismiss() } - toolbar.setOnMenuItemClickListener { - if (it.itemId == R.id.submit) { - if (spinner.selectedItemPosition != 0 && commentEditorFragment?.getEditText()?.text.isNullOrEmpty()) { - commentEditorFragment?.getEditText()?.error = getString(R.string.required_field) - } else { - commentEditorFragment?.getEditText()?.error = null - presenter.onSubmit(reviewRequest!!, repoId!!, owner!!, number!!, InputHelper.toString(commentEditorFragment?.getEditText()?.text) - , spinner.selectedItem as String) - } - } - return@setOnMenuItemClickListener true - } - - if (isAuthor || isClosed) { - spinner.setSelection(2, true) - spinner.isEnabled = false - } - } - - override fun onSuccessfullySubmitted() { - hideProgress() - subimssionCallback?.onSuccessfullyReviewed() - dismiss() - } - - override fun onErrorSubmitting() { - showErrorMessage(getString(R.string.network_error)) - } - - override fun showMessage(titleRes: Int, msgRes: Int) { - hideProgress() - super.showMessage(titleRes, msgRes) - } - - override fun showMessage(titleRes: String, msgRes: String) { - hideProgress() - super.showMessage(titleRes, msgRes) - } - - override fun showErrorMessage(msgRes: String) { - hideProgress() - super.showErrorMessage(msgRes) - } - - override fun onSendActionClicked(text: String, bundle: Bundle?) {} - - override fun onTagUser(username: String) {} - - override fun onClearEditText() { - commentEditorFragment?.commentText?.setText("") - } - - override fun getNamesToTag(): ArrayList? { - return arrayListOf() - } - - companion object { - fun startForResult(reviewChanges: ReviewRequestModel, repoId: String, owner: String, number: Long, - isAuthor: Boolean, isEnterprise: Boolean, isClosed: Boolean): ReviewChangesActivity { - val fragment = ReviewChangesActivity() - val bundle = Bundler.start() - .put(BundleConstant.EXTRA, reviewChanges) - .put(BundleConstant.EXTRA_TWO, repoId) - .put(BundleConstant.EXTRA_THREE, owner) - .put(BundleConstant.EXTRA_FOUR, isAuthor) - .put(BundleConstant.ID, number) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .put(BundleConstant.EXTRA_FIVE, isClosed) - .end() - fragment.arguments = bundle - return fragment - } - } - - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesMvp.kt deleted file mode 100644 index 57ff1671c..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesMvp.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.fastaccess.ui.modules.reviews.changes - -import com.fastaccess.data.dao.ReviewRequestModel -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.modules.editor.comment.CommentEditorFragment - -/** - * Created by Kosh on 25 Jun 2017, 1:15 AM - */ -interface ReviewChangesMvp { - - interface View : BaseMvp.FAView, CommentEditorFragment.CommentListener { - fun onSuccessfullySubmitted() - fun onErrorSubmitting() - } - - interface Presenter { - fun onSubmit(reviewRequest: ReviewRequestModel, repoId: String, owner: String, number: Long, comment: String, method: String) - } - - interface ReviewSubmissionCallback { - fun onSuccessfullyReviewed() - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesPresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesPresenter.kt deleted file mode 100644 index 7667fbb45..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/reviews/changes/ReviewChangesPresenter.kt +++ /dev/null @@ -1,23 +0,0 @@ -package com.fastaccess.ui.modules.reviews.changes - -import com.fastaccess.data.dao.ReviewRequestModel -import com.fastaccess.provider.rest.RestProvider -import com.fastaccess.ui.base.mvp.presenter.BasePresenter - -/** - * Created by Kosh on 25 Jun 2017, 1:16 AM - */ -class ReviewChangesPresenter : BasePresenter(), ReviewChangesMvp.Presenter { - - override fun onSubmit(reviewRequest: ReviewRequestModel, repoId: String, owner: String, number: Long, comment: String, method: String) { - reviewRequest.body = comment - reviewRequest.event = method.replace(" ", "_").toUpperCase() - makeRestCall(RestProvider.getReviewService(isEnterprise).submitPrReview(owner, repoId, number, reviewRequest), { - if (it.isSuccessful && it.code() == 200) { - sendToView { it.onSuccessfullySubmitted() } - } else { - sendToView { it.onErrorSubmitting() } - } - }, false) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/SearchActivity.java b/app/src/main/java/com/fastaccess/ui/modules/search/SearchActivity.java deleted file mode 100644 index 32c1c4217..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/SearchActivity.java +++ /dev/null @@ -1,182 +0,0 @@ -package com.fastaccess.ui.modules.search; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.google.android.material.appbar.AppBarLayout; -import com.google.android.material.tabs.TabLayout; -import androidx.fragment.app.Fragment; -import android.text.Editable; -import android.view.View; -import android.widget.ArrayAdapter; -import android.widget.TextView; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.FragmentPagerAdapterModel; -import com.fastaccess.data.dao.TabsCountStateModel; -import com.fastaccess.data.dao.model.SearchHistory; -import com.fastaccess.helper.AnimHelper; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.ui.adapter.FragmentsPagerAdapter; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.widgets.FontAutoCompleteEditText; -import com.fastaccess.ui.widgets.ForegroundImageView; -import com.fastaccess.ui.widgets.ViewPagerView; - -import java.text.NumberFormat; -import java.util.HashSet; -import java.util.LinkedHashSet; - -import butterknife.BindView; -import butterknife.OnClick; -import butterknife.OnEditorAction; -import butterknife.OnTextChanged; - -/** - * Created by Kosh on 08 Dec 2016, 8:22 PM - */ - -public class SearchActivity extends BaseActivity implements SearchMvp.View { - - @BindView(R.id.searchEditText) FontAutoCompleteEditText searchEditText; - @BindView(R.id.clear) ForegroundImageView clear; - @BindView(R.id.tabs) TabLayout tabs; - @BindView(R.id.appbar) AppBarLayout appbar; - @BindView(R.id.pager) ViewPagerView pager; - @State HashSet tabsCountSet = new LinkedHashSet<>(); - - private NumberFormat numberFormat = NumberFormat.getNumberInstance(); - private ArrayAdapter adapter; - - - public static Intent getIntent(@NonNull Context context, @Nullable String query) { - Intent intent = new Intent(context, SearchActivity.class); - intent.putExtra("search", query); - return intent; - } - - @OnTextChanged(value = R.id.searchEditText, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) - void onTextChange(Editable s) { - String text = s.toString(); - if (text.length() == 0) { - AnimHelper.animateVisibility(clear, false); - } else { - AnimHelper.animateVisibility(clear, true); - } - } - - @OnClick(R.id.search) void onSearchClicked() { - getPresenter().onSearchClicked(pager, searchEditText); - } - - @OnEditorAction(R.id.searchEditText) boolean onEditor() { - onSearchClicked(); - return true; - } - - @OnClick(value = {R.id.clear}) void onClear(View view) { - if (view.getId() == R.id.clear) { - searchEditText.setText(""); - } - } - - @Override protected int layout() { - return R.layout.search_layout; - } - - @Override protected boolean isTransparent() { - return false; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @NonNull @Override public SearchPresenter providePresenter() { - return new SearchPresenter(); - } - - @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setTitle(""); - pager.setAdapter(new FragmentsPagerAdapter(getSupportFragmentManager(), FragmentPagerAdapterModel.buildForSearch(this))); - tabs.setupWithViewPager(pager); - searchEditText.setAdapter(getAdapter()); - searchEditText.setOnItemClickListener((parent, view, position, id) -> getPresenter().onSearchClicked(pager, searchEditText)); - if (!tabsCountSet.isEmpty()) { - setupTab(); - } - if (savedInstanceState == null && getIntent() != null) { - if (getIntent().hasExtra("search")) { - searchEditText.setText(getIntent().getStringExtra("search")); - getPresenter().onSearchClicked(pager, searchEditText); - } - } - tabs.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(pager) { - @Override public void onTabReselected(TabLayout.Tab tab) { - super.onTabReselected(tab); - onScrollTop(tab.getPosition()); - } - }); - } - - @Override public void onNotifyAdapter(@Nullable SearchHistory query) { - if (query == null) getAdapter().notifyDataSetChanged(); - else getAdapter().add(query); - } - - @Override public void onSetCount(int count, int index) { - TabsCountStateModel model = new TabsCountStateModel(); - model.setCount(count); - model.setTabIndex(index); - tabsCountSet.add(model); - TextView textView = ViewHelper.getTabTextView(tabs, index); - if (index == 0) { - textView.setText(String.format("%s(%s)", getString(R.string.repos), numberFormat.format(count))); - } else if (index == 1) { - textView.setText(String.format("%s(%s)", getString(R.string.users), numberFormat.format(count))); - } else if (index == 2) { - textView.setText(String.format("%s(%s)", getString(R.string.issues), numberFormat.format(count))); - } else if (index == 3) { - textView.setText(String.format("%s(%s)", getString(R.string.code), numberFormat.format(count))); - } - } - - @Override public void onScrollTop(int index) { - if (pager == null || pager.getAdapter() == null) return; - Fragment fragment = (BaseFragment) pager.getAdapter().instantiateItem(pager, index); - if (fragment instanceof BaseFragment) { - ((BaseFragment) fragment).onScrollTop(index); - } - } - - private ArrayAdapter getAdapter() { - if (adapter == null) adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, getPresenter().getHints()); - return adapter; - } - - private void setupTab() { - for (TabsCountStateModel model : tabsCountSet) { - int index = model.getTabIndex(); - int count = model.getCount(); - TextView textView = ViewHelper.getTabTextView(tabs, index); - if (index == 0) { - textView.setText(String.format("%s(%s)", getString(R.string.repos), numberFormat.format(count))); - } else if (index == 1) { - textView.setText(String.format("%s(%s)", getString(R.string.users), numberFormat.format(count))); - } else if (index == 2) { - textView.setText(String.format("%s(%s)", getString(R.string.issues), numberFormat.format(count))); - } else if (index == 3) { - textView.setText(String.format("%s(%s)", getString(R.string.code), numberFormat.format(count))); - } - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/SearchMvp.java b/app/src/main/java/com/fastaccess/ui/modules/search/SearchMvp.java deleted file mode 100644 index bc10ac31a..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/SearchMvp.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.fastaccess.ui.modules.search; - -import androidx.annotation.IntRange; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.viewpager.widget.ViewPager; -import android.widget.AutoCompleteTextView; - -import com.fastaccess.data.dao.model.SearchHistory; -import com.fastaccess.ui.base.mvp.BaseMvp; - -import java.util.ArrayList; - -/** - * Created by Kosh on 08 Dec 2016, 8:19 PM - */ - -public interface SearchMvp { - - interface View extends BaseMvp.FAView { - void onNotifyAdapter(@Nullable SearchHistory query); - - void onSetCount(int count, @IntRange(from = 0, to = 3) int index); - } - - interface Presenter extends BaseMvp.FAPresenter { - - @NonNull ArrayList getHints(); - - void onSearchClicked(@NonNull ViewPager viewPager, @NonNull AutoCompleteTextView editText); - - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/SearchPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/search/SearchPresenter.java deleted file mode 100644 index 50e79c59c..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/SearchPresenter.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.fastaccess.ui.modules.search; - -import androidx.annotation.NonNull; -import androidx.viewpager.widget.ViewPager; -import android.widget.AutoCompleteTextView; - -import com.annimon.stream.Stream; -import com.fastaccess.R; -import com.fastaccess.data.dao.model.SearchHistory; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.search.code.SearchCodeFragment; -import com.fastaccess.ui.modules.search.issues.SearchIssuesFragment; -import com.fastaccess.ui.modules.search.repos.SearchReposFragment; -import com.fastaccess.ui.modules.search.users.SearchUsersFragment; - -import java.util.ArrayList; - - -/** - * Created by Kosh on 08 Dec 2016, 8:20 PM - */ -public class SearchPresenter extends BasePresenter implements SearchMvp.Presenter { - private ArrayList hints = new ArrayList<>(); - - @Override protected void onAttachView(@NonNull SearchMvp.View view) { - super.onAttachView(view); - if (hints.isEmpty()) { - manageDisposable(SearchHistory.getHistory() - .subscribe(strings -> { - hints.clear(); - if (strings != null) hints.addAll(strings); - view.onNotifyAdapter(null); - })); - } - } - - @NonNull @Override public ArrayList getHints() { - return hints; - } - - @Override public void onSearchClicked(@NonNull ViewPager viewPager, @NonNull AutoCompleteTextView editText) { - boolean isEmpty = InputHelper.isEmpty(editText) || InputHelper.toString(editText).length() < 2; - editText.setError(isEmpty ? editText.getResources().getString(R.string.minimum_three_chars) : null); - if (!isEmpty) { - editText.dismissDropDown(); - AppHelper.hideKeyboard(editText); - String query = InputHelper.toString(editText); - SearchReposFragment repos = (SearchReposFragment) viewPager.getAdapter().instantiateItem(viewPager, 0); - SearchUsersFragment users = (SearchUsersFragment) viewPager.getAdapter().instantiateItem(viewPager, 1); - SearchIssuesFragment issues = (SearchIssuesFragment) viewPager.getAdapter().instantiateItem(viewPager, 2); - SearchCodeFragment code = (SearchCodeFragment) viewPager.getAdapter().instantiateItem(viewPager, 3); - repos.onQueueSearch(query); - users.onQueueSearch(query); - issues.onQueueSearch(query); - code.onQueueSearch(query, true); - boolean noneMatch = Stream.of(hints).noneMatch(value -> value.getText().equalsIgnoreCase(query)); - if (noneMatch) { - SearchHistory searchHistory = new SearchHistory(query); - manageObservable(searchHistory.save(searchHistory).toObservable()); - sendToView(view -> view.onNotifyAdapter(new SearchHistory(query))); - } - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/SearchUserActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/search/SearchUserActivity.kt deleted file mode 100644 index a6083567d..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/SearchUserActivity.kt +++ /dev/null @@ -1,109 +0,0 @@ -package com.fastaccess.ui.modules.search - -import android.content.Context -import android.content.Intent -import android.os.Bundle -import android.text.Editable -import android.view.View -import android.widget.CheckBox -import butterknife.BindView -import butterknife.OnClick -import butterknife.OnEditorAction -import butterknife.OnTextChanged -import com.evernote.android.state.State -import com.fastaccess.R -import com.fastaccess.helper.AnimHelper -import com.fastaccess.helper.AppHelper -import com.fastaccess.helper.InputHelper -import com.fastaccess.ui.base.BaseActivity -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import com.fastaccess.ui.modules.search.repos.SearchReposFragment -import com.fastaccess.ui.widgets.FontAutoCompleteEditText - -class SearchUserActivity : BaseActivity>() { - - @BindView(R.id.forkCheckBox) lateinit var forkCheckBox: CheckBox - @BindView(R.id.clear) lateinit var clear: View - @BindView(R.id.searchEditText) lateinit var searchEditText: FontAutoCompleteEditText - - @State var username = "" - @State var searchTerm = "" - - @OnTextChanged(value = [R.id.searchEditText], callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) - fun onTextChange(str: Editable) { - searchTerm = str.toString() - if (searchTerm.isEmpty()) { - AnimHelper.animateVisibility(clear, false) - } else { - AnimHelper.animateVisibility(clear, true) - } - } - - @OnClick(R.id.search) fun onSearchClicked() { - searchTerm = searchEditText.text.toString() - makeSearch() - } - - @OnClick(R.id.forkCheckBox) fun checkBoxClicked() { - onSearchClicked() - } - - @OnEditorAction(R.id.searchEditText) fun onEditor(): Boolean { - onSearchClicked() - return true - } - - @OnClick(R.id.clear) internal fun onClear(view: View) { - if (view.id == R.id.clear) { - searchEditText.setText("") - } - } - - override fun layout(): Int = R.layout.activity_search_user - - override fun isTransparent(): Boolean = false - - override fun canBack(): Boolean = true - - override fun providePresenter(): BasePresenter = BasePresenter() - - override fun isSecured(): Boolean = false - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - if (savedInstanceState == null) { - val args = intent.extras - username = args?.getString(USERNAME) ?: "" - if (InputHelper.isEmpty(username)) { - finish() - return - } - searchTerm = args?.getString(SEARCH_TERM) ?: "" - supportFragmentManager.beginTransaction() - .replace(R.id.containerFragment, SearchReposFragment.newInstance(), "SearchReposFragment") - .commit() - } - searchEditText.setText(searchTerm) - onSearchClicked() - } - - private fun makeSearch() { - val query = "user:$username $searchTerm fork:${forkCheckBox.isChecked}" - getFragment()?.onQueueSearch(query) - } - - private fun getFragment() = AppHelper.getFragmentByTag(supportFragmentManager, "SearchReposFragment") as? SearchReposFragment? - - companion object { - val USERNAME = "username" - val SEARCH_TERM = "search" - - fun getIntent(context: Context, username: String, searchTerm: String?): Intent { - val intent = Intent(context, SearchUserActivity::class.java) - intent.putExtra(USERNAME, username) - intent.putExtra(SEARCH_TERM, searchTerm) - return intent - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/code/SearchCodeFragment.java b/app/src/main/java/com/fastaccess/ui/modules/search/code/SearchCodeFragment.java deleted file mode 100644 index 141859372..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/code/SearchCodeFragment.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.fastaccess.ui.modules.search.code; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.SearchCodeModel; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.adapter.SearchCodeAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.search.SearchMvp; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class SearchCodeFragment extends BaseFragment implements SearchCodeMvp.View { - - @State String searchQuery = ""; - @State boolean showRepoName; - - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private SearchCodeAdapter adapter; - private SearchMvp.View countCallback; - - public static SearchCodeFragment newInstance() { - return new SearchCodeFragment(); - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (context instanceof SearchMvp.View) { - countCallback = (SearchMvp.View) context; - } - } - - @Override public void onDetach() { - countCallback = null; - super.onDetach(); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override public void onSetTabCount(int count) { - if (countCallback != null) countCallback.onSetCount(count, 3); - } - - @Override protected int fragmentLayout() { - return R.layout.small_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - stateLayout.setEmptyText(R.string.no_search_results); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - adapter = new SearchCodeAdapter(getPresenter().getCodes()); - adapter.showRepoName(showRepoName); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - recycler.addDivider(); - if (!InputHelper.isEmpty(searchQuery) && getPresenter().getCodes().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - if (InputHelper.isEmpty(searchQuery)) { - stateLayout.showEmptyState(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public SearchCodePresenter providePresenter() { - return new SearchCodePresenter(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showProgress(@StringRes int resId) { - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @Override public void onSetSearchQuery(@NonNull String query, boolean showRepoName) { - this.searchQuery = query; - this.showRepoName = showRepoName; - getLoadMore().reset(); - adapter.clear(); - adapter.showRepoName(showRepoName); - if (!InputHelper.isEmpty(query)) { - recycler.removeOnScrollListener(getLoadMore()); - recycler.addOnScrollListener(getLoadMore()); - onRefresh(); - } - } - - @Override public void onQueueSearch(@NonNull String query) { - this.searchQuery = query; - if (getView() != null) - onSetSearchQuery(query, false); - } - - @Override public void onQueueSearch(@NonNull String query, boolean showRepoName) { - this.searchQuery = query; - if (getView() != null) - onSetSearchQuery(query, showRepoName); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter(), searchQuery); - } - onLoadMore.setParameter(searchQuery); - return onLoadMore; - } - - @Override public void onItemClicked(@NonNull SearchCodeModel item) { - if (item.getUrl() != null) { - SchemeParser.launchUri(getContext(), item.getHtmlUrl()); - } else { - showErrorMessage(getString(R.string.no_url)); - } - } - - @Override public void onRefresh() { - if (searchQuery.length() == 0) { - refresh.setRefreshing(false); - return; - } - getPresenter().onCallApi(1, searchQuery); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/code/SearchCodeMvp.java b/app/src/main/java/com/fastaccess/ui/modules/search/code/SearchCodeMvp.java deleted file mode 100644 index f59391869..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/code/SearchCodeMvp.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.fastaccess.ui.modules.search.code; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.SearchCodeModel; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -interface SearchCodeMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - void onSetTabCount(int count); - - void onSetSearchQuery(@NonNull String query, boolean showRepoName); - - void onQueueSearch(@NonNull String query); - - void onQueueSearch(@NonNull String query, boolean showRepoName); - - @NonNull OnLoadMore getLoadMore(); - - void onItemClicked(@NonNull SearchCodeModel item); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getCodes(); - - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/code/SearchCodePresenter.java b/app/src/main/java/com/fastaccess/ui/modules/search/code/SearchCodePresenter.java deleted file mode 100644 index 953f20d3a..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/code/SearchCodePresenter.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.fastaccess.ui.modules.search.code; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.SearchCodeModel; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class SearchCodePresenter extends BasePresenter implements SearchCodeMvp.Presenter { - - private ArrayList codes = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public boolean onCallApi(int page, @Nullable String parameter) { - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0 || parameter == null) { - sendToView(SearchCodeMvp.View::hideProgress); - return false; - } - makeRestCall(RestProvider.getSearchService(isEnterprise()).searchCode(parameter, page), - response -> { - lastPage = response.getLast(); - sendToView(view -> { - view.onNotifyAdapter(response.isIncompleteResults() ? null : response.getItems(), page); - if (!response.isIncompleteResults()) { - view.onSetTabCount(response.getTotalCount()); - } else { - view.onSetTabCount(0); - view.showMessage(R.string.error, R.string.search_results_warning); - } - }); - }); - return true; - } - - @NonNull @Override public ArrayList getCodes() { - return codes; - } - - @Override public void onItemClick(int position, View v, SearchCodeModel item) { - if (getView() != null) { - getView().onItemClicked(item); - } - } - - @Override public void onItemLongClick(int position, View v, SearchCodeModel item) {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/issues/SearchIssuesFragment.java b/app/src/main/java/com/fastaccess/ui/modules/search/issues/SearchIssuesFragment.java deleted file mode 100644 index 754e065e5..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/issues/SearchIssuesFragment.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.fastaccess.ui.modules.search.issues; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.IssuesAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.repos.extras.popup.IssuePopupFragment; -import com.fastaccess.ui.modules.search.SearchMvp; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class SearchIssuesFragment extends BaseFragment implements SearchIssuesMvp.View { - - @State String searchQuery = ""; - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private IssuesAdapter adapter; - private SearchMvp.View countCallback; - - public static SearchIssuesFragment newInstance() { - return new SearchIssuesFragment(); - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (context instanceof SearchMvp.View) { - countCallback = (SearchMvp.View) context; - } - } - - @Override public void onDetach() { - countCallback = null; - super.onDetach(); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override public void onSetTabCount(int count) { - if (countCallback != null) countCallback.onSetCount(count, 2); - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - stateLayout.setEmptyText(R.string.no_search_results); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - adapter = new IssuesAdapter(getPresenter().getIssues(), false, true, true); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - recycler.addDivider(); - if (!InputHelper.isEmpty(searchQuery) && getPresenter().getIssues().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - if (InputHelper.isEmpty(searchQuery)) { - stateLayout.showEmptyState(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public SearchIssuesPresenter providePresenter() { - return new SearchIssuesPresenter(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showProgress(@StringRes int resId) { - - refresh.setRefreshing(true); - - stateLayout.showProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @Override public void onSetSearchQuery(@NonNull String query) { - this.searchQuery = query; - getLoadMore().reset(); - adapter.clear(); - if (!InputHelper.isEmpty(query)) { - recycler.removeOnScrollListener(getLoadMore()); - recycler.addOnScrollListener(getLoadMore()); - onRefresh(); - } - } - - @Override public void onQueueSearch(@NonNull String query) { - this.searchQuery = query; - if (getView() != null) - onSetSearchQuery(query); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter(), searchQuery); - } - onLoadMore.setParameter(searchQuery); - return onLoadMore; - } - - @Override public void onShowPopupDetails(@NonNull Issue item) { - IssuePopupFragment.showPopup(getChildFragmentManager(), item); - } - - @Override public void onRefresh() { - if (searchQuery.length() == 0) { - refresh.setRefreshing(false); - return; - } - getPresenter().onCallApi(1, searchQuery); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/issues/SearchIssuesMvp.java b/app/src/main/java/com/fastaccess/ui/modules/search/issues/SearchIssuesMvp.java deleted file mode 100644 index 74b9c7b9e..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/issues/SearchIssuesMvp.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.fastaccess.ui.modules.search.issues; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -interface SearchIssuesMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - void onSetTabCount(int count); - - void onSetSearchQuery(@NonNull String query); - - void onQueueSearch(@NonNull String query); - - @NonNull OnLoadMore getLoadMore(); - - void onShowPopupDetails(@NonNull Issue item); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getIssues(); - - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/issues/SearchIssuesPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/search/issues/SearchIssuesPresenter.java deleted file mode 100644 index 169b38f5c..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/issues/SearchIssuesPresenter.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.fastaccess.ui.modules.search.issues; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Issue; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class SearchIssuesPresenter extends BasePresenter implements SearchIssuesMvp.Presenter { - - private ArrayList issues = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public boolean onCallApi(int page, @Nullable String parameter) { - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0 || parameter == null) { - sendToView(SearchIssuesMvp.View::hideProgress); - return false; - } - makeRestCall(RestProvider.getSearchService(isEnterprise()).searchIssues(parameter, page), - response -> { - lastPage = response.getLast(); - sendToView(view -> { - view.onNotifyAdapter(response.isIncompleteResults() ? null : response.getItems(), page); - if (!response.isIncompleteResults()) { - view.onSetTabCount(response.getTotalCount()); - } else { - view.onSetTabCount(0); - view.showMessage(R.string.error, R.string.search_results_warning); - } - }); - }); - return true; - } - - @NonNull @Override public ArrayList getIssues() { - return issues; - } - - @Override public void onItemClick(int position, View v, Issue item) { - SchemeParser.launchUri(v.getContext(), item.getHtmlUrl()); - } - - @Override public void onItemLongClick(int position, View v, Issue item) { - if (getView() != null) getView().onShowPopupDetails(item); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/repos/SearchReposFragment.java b/app/src/main/java/com/fastaccess/ui/modules/search/repos/SearchReposFragment.java deleted file mode 100644 index 32b19e4bb..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/repos/SearchReposFragment.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.fastaccess.ui.modules.search.repos; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.ReposAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.search.SearchMvp; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class SearchReposFragment extends BaseFragment implements SearchReposMvp.View { - - @State String searchQuery = ""; - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private ReposAdapter adapter; - private SearchMvp.View countCallback; - - public static SearchReposFragment newInstance() { - return new SearchReposFragment(); - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (context instanceof SearchMvp.View) { - countCallback = (SearchMvp.View) context; - } - } - - @Override public void onDetach() { - countCallback = null; - super.onDetach(); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override public void onSetTabCount(int count) { - if (countCallback != null) countCallback.onSetCount(count, 0); - } - - @Override protected int fragmentLayout() { - return R.layout.micro_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - if (savedInstanceState == null) { - stateLayout.hideProgress(); - } - stateLayout.setEmptyText(R.string.no_search_results); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - adapter = new ReposAdapter(getPresenter().getRepos(), true, true); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - recycler.addKeyLineDivider(); - if (!InputHelper.isEmpty(searchQuery) && getPresenter().getRepos().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - if (InputHelper.isEmpty(searchQuery)) { - stateLayout.showEmptyState(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public SearchReposPresenter providePresenter() { - return new SearchReposPresenter(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showProgress(@StringRes int resId) { - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @Override public void onSetSearchQuery(@NonNull String query) { - this.searchQuery = query; - getLoadMore().reset(); - adapter.clear(); - if (!InputHelper.isEmpty(query)) { - recycler.removeOnScrollListener(getLoadMore()); - recycler.addOnScrollListener(getLoadMore()); - onRefresh(); - } - } - - @Override public void onQueueSearch(@NonNull String query) { - this.searchQuery = query; - if (getView() != null) - onSetSearchQuery(query); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter(), searchQuery); - } - onLoadMore.setParameter(searchQuery); - return onLoadMore; - } - - @Override public void onRefresh() { - if (searchQuery.length() == 0) { - refresh.setRefreshing(false); - return; - } - getPresenter().onCallApi(1, searchQuery); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/repos/SearchReposMvp.java b/app/src/main/java/com/fastaccess/ui/modules/search/repos/SearchReposMvp.java deleted file mode 100644 index 4cab608e0..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/repos/SearchReposMvp.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.fastaccess.ui.modules.search.repos; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -interface SearchReposMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - void onSetTabCount(int count); - - void onSetSearchQuery(@NonNull String query); - - void onQueueSearch(@NonNull String query); - - @NonNull OnLoadMore getLoadMore(); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getRepos(); - - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/repos/SearchReposPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/search/repos/SearchReposPresenter.java deleted file mode 100644 index 40db014b3..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/repos/SearchReposPresenter.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.fastaccess.ui.modules.search.repos; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.Repo; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class SearchReposPresenter extends BasePresenter implements SearchReposMvp.Presenter { - - private ArrayList repos = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public boolean onCallApi(int page, @Nullable String parameter) { - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0 || parameter == null) { - sendToView(SearchReposMvp.View::hideProgress); - return false; - } - makeRestCall(RestProvider.getSearchService(isEnterprise()).searchRepositories(parameter, page), - response -> { - lastPage = response.getLast(); - sendToView(view -> { - view.onNotifyAdapter(response.isIncompleteResults() ? null : response.getItems(), page); - if (!response.isIncompleteResults()) { - view.onSetTabCount(response.getTotalCount()); - } else { - view.onSetTabCount(0); - view.showMessage(R.string.error, R.string.search_results_warning); - } - }); - }); - return true; - } - - @NonNull @Override public ArrayList getRepos() { - return repos; - } - - @Override public void onItemClick(int position, View v, Repo item) { - SchemeParser.launchUri(v.getContext(), item.getHtmlUrl()); - } - - @Override public void onItemLongClick(int position, View v, Repo item) {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/repos/files/SearchFileActivity.java b/app/src/main/java/com/fastaccess/ui/modules/search/repos/files/SearchFileActivity.java deleted file mode 100644 index 5ce390093..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/repos/files/SearchFileActivity.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.fastaccess.ui.modules.search.repos.files; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.widget.AppCompatSpinner; -import android.text.Editable; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.helper.AnimHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.modules.search.code.SearchCodeFragment; -import com.fastaccess.ui.widgets.FontEditText; -import com.fastaccess.ui.widgets.ForegroundImageView; - -import butterknife.BindView; -import butterknife.OnClick; -import butterknife.OnEditorAction; -import butterknife.OnItemSelected; -import butterknife.OnTextChanged; -import butterknife.OnTouch; - -public class SearchFileActivity extends BaseActivity implements SearchFileMvp.View { - - @BindView(R.id.searchEditText) FontEditText searchEditText; - @BindView(R.id.clear) ForegroundImageView clear; - @BindView(R.id.searchOptions) AppCompatSpinner searchOptions; - private boolean onSpinnerTouched; - - private SearchCodeFragment searchCodeFragment; - - public static Intent createIntent(@NonNull Context context, @NonNull String login, @NonNull String repoId, boolean isEnterprise) { - Intent intent = new Intent(context, SearchFileActivity.class); - intent.putExtra(BundleConstant.ID, repoId); - intent.putExtra(BundleConstant.EXTRA, login); - intent.putExtra(BundleConstant.IS_ENTERPRISE, isEnterprise); - return intent; - } - - @OnTouch(R.id.searchOptions) boolean onTouch() { - onSpinnerTouched = true; - return false; - } - - @OnItemSelected(R.id.searchOptions) void onOptionSelected() { - if (onSpinnerTouched) { - onSearch(); - } - } - - @OnTextChanged(value = R.id.searchEditText, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) void onTextChange(Editable s) { - String text = s.toString(); - if (text.length() == 0) { - AnimHelper.animateVisibility(clear, false); - } else { - AnimHelper.animateVisibility(clear, true); - } - } - - @OnEditorAction(R.id.searchEditText) boolean onEditor() { - onSearch(); - return true; - } - - @OnClick(value = {R.id.clear}) void onClear(View view) { - if (view.getId() == R.id.clear) { - searchEditText.setText(""); - } - } - - @OnClick(R.id.search) void onSearchClicked() { - onSearch(); - } - - @Override protected int layout() { - return R.layout.activity_search_file; - } - - @Override protected boolean isTransparent() { - return false; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @NonNull @Override public SearchFilePresenter providePresenter() { - return new SearchFilePresenter(); - } - - @Override protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - getPresenter().onActivityCreated(getIntent().getExtras()); - searchCodeFragment = ((SearchCodeFragment) getSupportFragmentManager().findFragmentById(R.id.filesFragment)); - } - - @Override public void onValidSearchQuery(@NonNull String query) { - searchCodeFragment.onSetSearchQuery(query, false); - } - - private void onSearch() { - getPresenter().onSearchClicked(searchEditText, searchOptions.getSelectedItemPosition() == 0); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/repos/files/SearchFileMvp.java b/app/src/main/java/com/fastaccess/ui/modules/search/repos/files/SearchFileMvp.java deleted file mode 100644 index 49c9d8de7..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/repos/files/SearchFileMvp.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.fastaccess.ui.modules.search.repos.files; - -import android.os.Bundle; -import androidx.annotation.NonNull; - -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.FontEditText; - - -interface SearchFileMvp { - - interface View extends BaseMvp.FAView { - void onValidSearchQuery(@NonNull String query); - } - - interface Presenter extends BaseMvp.FAPresenter { - void onSearchClicked(@NonNull FontEditText editText, boolean inPath); - - void onActivityCreated(Bundle extras); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/repos/files/SearchFilePresenter.java b/app/src/main/java/com/fastaccess/ui/modules/search/repos/files/SearchFilePresenter.java deleted file mode 100644 index d9f98dd60..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/repos/files/SearchFilePresenter.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.fastaccess.ui.modules.search.repos.files; - -import android.os.Bundle; -import androidx.annotation.NonNull; - -import com.fastaccess.R; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.widgets.FontEditText; - -public class SearchFilePresenter extends BasePresenter implements SearchFileMvp.Presenter { - @com.evernote.android.state.State String repoId; - @com.evernote.android.state.State String login; - - @Override protected void onAttachView(@NonNull SearchFileMvp.View view) { - super.onAttachView(view); - } - - @Override public void onSearchClicked(@NonNull FontEditText editText, boolean inPath) { - boolean isEmpty = InputHelper.isEmpty(editText) || InputHelper.toString(editText).length() < 2; - editText.setError(isEmpty ? editText.getResources().getString(R.string.minimum_three_chars) : null); - if (!isEmpty) { - AppHelper.hideKeyboard(editText); - String query = InputHelper.toString(editText); - if (getView() != null && isViewAttached()) getView().onValidSearchQuery(modifyQueryForFileSearch(query, inPath)); - } - } - - @Override public void onActivityCreated(Bundle extras) { - repoId = extras.getString(BundleConstant.ID); - login = extras.getString(BundleConstant.EXTRA); - } - - @NonNull private String modifyQueryForFileSearch(@NonNull String query, boolean inPath) { - //restrict the search to file paths and the current repo user is looking at - return query + "+" + "in:" + (inPath ? "path" : "" + "file") + "+" + "repo:" + login + "/" + repoId; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/users/SearchUsersFragment.java b/app/src/main/java/com/fastaccess/ui/modules/search/users/SearchUsersFragment.java deleted file mode 100644 index ec5ed8fce..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/users/SearchUsersFragment.java +++ /dev/null @@ -1,169 +0,0 @@ -package com.fastaccess.ui.modules.search.users; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.view.View; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.adapter.UsersAdapter; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.search.SearchMvp; -import com.fastaccess.ui.widgets.StateLayout; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 03 Dec 2016, 3:56 PM - */ - -public class SearchUsersFragment extends BaseFragment implements SearchUsersMvp.View { - @State String searchQuery = ""; - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.refresh) SwipeRefreshLayout refresh; - @BindView(R.id.stateLayout) StateLayout stateLayout; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - private OnLoadMore onLoadMore; - private UsersAdapter adapter; - private SearchMvp.View countCallback; - - public static SearchUsersFragment newInstance() { - return new SearchUsersFragment(); - } - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (context instanceof SearchMvp.View) { - countCallback = (SearchMvp.View) context; - } - } - - @Override public void onDetach() { - countCallback = null; - super.onDetach(); - } - - @Override public void onNotifyAdapter(@Nullable List items, int page) { - hideProgress(); - if (items == null || items.isEmpty()) { - adapter.clear(); - return; - } - if (page <= 1) { - adapter.insertItems(items); - } else { - adapter.addItems(items); - } - } - - @Override public void onSetTabCount(int count) { - if (countCallback != null) countCallback.onSetCount(count, 1); - } - - @Override protected int fragmentLayout() { - return R.layout.small_grid_refresh_list; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - stateLayout.setEmptyText(R.string.no_search_results); - getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal()); - stateLayout.setOnReloadListener(this); - refresh.setOnRefreshListener(this); - recycler.setEmptyView(stateLayout, refresh); - adapter = new UsersAdapter(getPresenter().getUsers()); - adapter.setListener(getPresenter()); - recycler.setAdapter(adapter); - recycler.addKeyLineDivider(); - if (savedInstanceState != null) { - if (!InputHelper.isEmpty(searchQuery) && getPresenter().getUsers().isEmpty() && !getPresenter().isApiCalled()) { - onRefresh(); - } - } - if (InputHelper.isEmpty(searchQuery)) { - stateLayout.showEmptyState(); - } - fastScroller.attachRecyclerView(recycler); - } - - @NonNull @Override public SearchUsersPresenter providePresenter() { - return new SearchUsersPresenter(); - } - - @Override public void hideProgress() { - refresh.setRefreshing(false); - stateLayout.hideProgress(); - } - - @Override public void showProgress(@StringRes int resId) { - refresh.setRefreshing(true); - stateLayout.showProgress(); - } - - @Override public void showErrorMessage(@NonNull String message) { - showReload(); - super.showErrorMessage(message); - } - - @Override public void showMessage(int titleRes, int msgRes) { - showReload(); - super.showMessage(titleRes, msgRes); - } - - @Override public void onSetSearchQuery(@NonNull String query) { - this.searchQuery = query; - getLoadMore().reset(); - adapter.clear(); - if (!InputHelper.isEmpty(query)) { - recycler.removeOnScrollListener(getLoadMore()); - recycler.addOnScrollListener(getLoadMore()); - onRefresh(); - } - } - - @Override public void onQueueSearch(@NonNull String query) { - this.searchQuery = query; - if (getView() != null) - onSetSearchQuery(query); - } - - @NonNull @Override public OnLoadMore getLoadMore() { - if (onLoadMore == null) { - onLoadMore = new OnLoadMore<>(getPresenter(), searchQuery); - } - onLoadMore.setParameter(searchQuery); - return onLoadMore; - } - - @Override public void onRefresh() { - if (searchQuery.length() == 0) { - refresh.setRefreshing(false); - return; - } - getPresenter().onCallApi(1, searchQuery); - } - - @Override public void onClick(View view) { - onRefresh(); - } - - @Override public void onScrollTop(int index) { - super.onScrollTop(index); - if (recycler != null) recycler.scrollToPosition(0); - } - - private void showReload() { - hideProgress(); - stateLayout.showReload(adapter.getItemCount()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/users/SearchUsersMvp.java b/app/src/main/java/com/fastaccess/ui/modules/search/users/SearchUsersMvp.java deleted file mode 100644 index d901435ae..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/users/SearchUsersMvp.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.fastaccess.ui.modules.search.users; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.fastaccess.data.dao.model.User; -import com.fastaccess.provider.rest.loadmore.OnLoadMore; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 03 Dec 2016, 3:45 PM - */ - -interface SearchUsersMvp { - - interface View extends BaseMvp.FAView, SwipeRefreshLayout.OnRefreshListener, android.view.View.OnClickListener { - void onNotifyAdapter(@Nullable List items, int page); - - void onSetTabCount(int count); - - void onSetSearchQuery(@NonNull String query); - - void onQueueSearch(@NonNull String query); - - @NonNull OnLoadMore getLoadMore(); - } - - interface Presenter extends BaseMvp.FAPresenter, - BaseViewHolder.OnItemClickListener, - BaseMvp.PaginationListener { - - @NonNull ArrayList getUsers(); - - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/search/users/SearchUsersPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/search/users/SearchUsersPresenter.java deleted file mode 100644 index b812b65cc..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/search/users/SearchUsersPresenter.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.fastaccess.ui.modules.search.users; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.User; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import java.util.ArrayList; - -/** - * Created by Kosh on 03 Dec 2016, 3:48 PM - */ - -class SearchUsersPresenter extends BasePresenter implements SearchUsersMvp.Presenter { - - private ArrayList users = new ArrayList<>(); - private int page; - private int previousTotal; - private int lastPage = Integer.MAX_VALUE; - - @Override public int getCurrentPage() { - return page; - } - - @Override public int getPreviousTotal() { - return previousTotal; - } - - @Override public void setCurrentPage(int page) { - this.page = page; - } - - @Override public void setPreviousTotal(int previousTotal) { - this.previousTotal = previousTotal; - } - - @Override public boolean onCallApi(int page, @Nullable String parameter) { - if (page == 1) { - lastPage = Integer.MAX_VALUE; - sendToView(view -> view.getLoadMore().reset()); - } - setCurrentPage(page); - if (page > lastPage || lastPage == 0 || parameter == null) { - sendToView(SearchUsersMvp.View::hideProgress); - return false; - } - makeRestCall(RestProvider.getSearchService(isEnterprise()).searchUsers(parameter, page), - response -> { - lastPage = response.getLast(); - sendToView(view -> { - view.onNotifyAdapter(response.isIncompleteResults() ? null : response.getItems(), page); - if (!response.isIncompleteResults()) { - view.onSetTabCount(response.getTotalCount()); - } else { - view.onSetTabCount(0); - view.showMessage(R.string.error, R.string.search_results_warning); - } - }); - }); - return true; - } - - @NonNull @Override public ArrayList getUsers() { - return users; - } - - @Override public void onItemClick(int position, View v, User item) { - - } - - @Override public void onItemLongClick(int position, View v, User item) {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/settings/LanguageBottomSheetDialog.java b/app/src/main/java/com/fastaccess/ui/modules/settings/LanguageBottomSheetDialog.java deleted file mode 100644 index 3f536ffd3..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/settings/LanguageBottomSheetDialog.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.fastaccess.ui.modules.settings; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.Gravity; -import android.view.View; -import android.view.ViewGroup; -import android.widget.RadioButton; -import android.widget.RadioGroup; - -import com.annimon.stream.Stream; -import com.fastaccess.R; -import com.fastaccess.data.dao.AppLanguageModel; -import com.fastaccess.helper.Logger; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.ui.base.BaseBottomSheetDialog; -import com.fastaccess.ui.widgets.FontTextView; - -import java.util.List; - -import butterknife.BindView; -import io.reactivex.functions.Action; - -/** - * Created by JediB on 5/12/2017. - */ - -public class LanguageBottomSheetDialog extends BaseBottomSheetDialog { - public interface LanguageDialogListener { - void onLanguageChanged(Action action); - } - - public static final String TAG = LanguageBottomSheetDialog.class.getSimpleName(); - - @BindView(R.id.title) FontTextView title; - @BindView(R.id.picker) RadioGroup radioGroup; - private LanguageDialogListener listener; - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (context instanceof LanguageDialogListener) { - listener = (LanguageDialogListener) context; - } - } - - @Override public void onDetach() { - listener = null; - super.onDetach(); - } - - @Override protected int layoutRes() { - return R.layout.picker_dialog; - } - - @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - String language = PrefGetter.getAppLanguage(); - String[] values = getResources().getStringArray(R.array.languages_array_values); - List languageModels = Stream.of(getResources().getStringArray(R.array.languages_array)) - .mapIndexed((index, s) -> new AppLanguageModel(values[index], s)) - .sortBy(AppLanguageModel::getLabel) - .toList(); - int padding = getResources().getDimensionPixelSize(R.dimen.spacing_xs_large); - for (int i = 0; i < languageModels.size(); i++) { - RadioButton radioButtonView = new RadioButton(getContext()); - RadioGroup.LayoutParams params = new RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); - radioButtonView.setLayoutParams(params); - AppLanguageModel model = languageModels.get(i); - radioButtonView.setText(model.getLabel()); - radioButtonView.setId(i); - radioButtonView.setTag(model.getValue()); - radioButtonView.setGravity(Gravity.CENTER_VERTICAL); - radioButtonView.setPadding(padding, padding, padding, padding); - radioGroup.addView(radioButtonView); - if (model.getValue().equalsIgnoreCase(language)) radioGroup.check(i); - } - radioGroup.setOnCheckedChangeListener((group, checkedId) -> { - String tag = (String) radioGroup.getChildAt(checkedId).getTag(); - Logger.e(tag); - if (!tag.equalsIgnoreCase(language)) { - PrefGetter.setAppLangauge(tag); - if (listener != null) listener.onLanguageChanged(this::dismiss); - } - }); - - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/settings/SettingsActivity.java b/app/src/main/java/com/fastaccess/ui/modules/settings/SettingsActivity.java deleted file mode 100644 index 4efe6dc74..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/settings/SettingsActivity.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.fastaccess.ui.modules.settings; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import androidx.annotation.NonNull; -import android.widget.ListView; - -import com.fastaccess.R; -import com.fastaccess.data.dao.SettingsModel; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.ui.adapter.SettingsAdapter; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.modules.settings.category.SettingsCategoryActivity; -import com.fastaccess.ui.modules.theme.ThemeActivity; -import com.fastaccess.ui.modules.theme.code.ThemeCodeActivity; - -import net.grandcentrix.thirtyinch.TiPresenter; - -import java.util.ArrayList; - -import butterknife.BindView; -import io.reactivex.functions.Action; - -public class SettingsActivity extends BaseActivity implements LanguageBottomSheetDialog.LanguageDialogListener { - - @BindView(R.id.settingsList) ListView settingsList; - - private static int THEME_CHANGE = 32; - private ArrayList settings = new ArrayList<>(); - - @Override protected int layout() { - return R.layout.activity_settings; - } - - @Override protected boolean isTransparent() { - return false; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setToolbarIcon(R.drawable.ic_back); - setTitle(getString(R.string.settings)); - if (savedInstanceState == null) { - setResult(RESULT_CANCELED); - } - settings.add(new SettingsModel(R.drawable.ic_color_lens, getString(R.string.theme_title), SettingsModel.THEME)); - settings.add(new SettingsModel(R.drawable.ic_color_lens, getString(R.string.choose_code_theme), SettingsModel.CODE_THEME)); - settings.add(new SettingsModel(R.drawable.ic_edit, getString(R.string.customization), SettingsModel.CUSTOMIZATION)); - settings.add(new SettingsModel(R.drawable.ic_ring, getString(R.string.notifications), SettingsModel.NOTIFICATION)); - settings.add(new SettingsModel(R.drawable.ic_settings, getString(R.string.behavior), SettingsModel.BEHAVIOR)); - settings.add(new SettingsModel(R.drawable.ic_backup, getString(R.string.backup), SettingsModel.BACKUP)); - settings.add(new SettingsModel(R.drawable.ic_language, getString(R.string.app_language), SettingsModel.LANGUAGE)); - settingsList.setAdapter(new SettingsAdapter(this, settings)); - settingsList.setOnItemClickListener((parent, view, position, id) -> { - SettingsModel settingsModel = (SettingsModel) parent.getItemAtPosition(position); - Intent intent = new Intent(this, SettingsCategoryActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.ITEM, settingsModel.getSettingsType()) - .put(BundleConstant.EXTRA, settingsModel.getTitle()) - .end()); - if (settingsModel.getSettingsType() == SettingsModel.LANGUAGE) { - showLanguageList(); - } else if (settingsModel.getSettingsType() == SettingsModel.THEME) { - ActivityHelper.startReveal(this, new Intent(this, ThemeActivity.class), view, THEME_CHANGE); - } else if (settingsModel.getSettingsType() == SettingsModel.CODE_THEME) { - ActivityHelper.startReveal(this, new Intent(this, ThemeCodeActivity.class), view, THEME_CHANGE); - } else { - ActivityHelper.startReveal(this, intent, view); - } - }); - } - - @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { - if (requestCode == THEME_CHANGE && resultCode == RESULT_OK) { - setResult(resultCode); - finish(); - } - } - - @NonNull @Override public TiPresenter providePresenter() { - return new BasePresenter(); - } - - private void showLanguageList() { - LanguageBottomSheetDialog languageBottomSheetDialog = new LanguageBottomSheetDialog(); - languageBottomSheetDialog.onAttach((Context) this); - languageBottomSheetDialog.show(getSupportFragmentManager(), "LanguageBottomSheetDialog"); - } - - @Override public void onLanguageChanged(Action action) { - try { - action.run();//dismiss dialog avoid leakage - } catch (Exception e) { - e.printStackTrace(); - } - setResult(RESULT_OK); - finish(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryActivity.java b/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryActivity.java deleted file mode 100644 index 3f8e71965..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryActivity.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.fastaccess.ui.modules.settings.category; - -import android.os.Bundle; -import androidx.annotation.NonNull; - -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.SettingsModel; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.ui.base.BaseActivity; - -import net.grandcentrix.thirtyinch.TiPresenter; - -public class SettingsCategoryActivity extends BaseActivity implements SettingsCategoryFragment.SettingsCallback { - - @State String title; - @SettingsModel.SettingsType @State int settingsType; - @State boolean needRecreation; - - @Override protected int layout() { - return R.layout.activity_settings_category; - } - - @Override protected boolean isTransparent() { - return false; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setResult(RESULT_CANCELED); - if (savedInstanceState == null) { - Bundle bundle = getIntent().getExtras(); - title = bundle.getString(BundleConstant.EXTRA); - settingsType = bundle.getInt(BundleConstant.ITEM); - getSupportFragmentManager() - .beginTransaction() - .replace(R.id.settingsContainer, new SettingsCategoryFragment(), SettingsCategoryFragment.TAG) - .commit(); - } - setTitle(title); - } - - @NonNull @Override public TiPresenter providePresenter() { - return new SettingsCategoryPresenter(); - } - - @SettingsModel.SettingsType @Override public int getSettingsType() { - return settingsType; - } - - @Override public void onThemeChanged() { - needRecreation = true; - } - - @Override public void onBackPressed() { - if (needRecreation) { - super.onThemeChanged(); - return; - } - super.onBackPressed(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryFragment.java b/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryFragment.java deleted file mode 100644 index 1eefb3386..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryFragment.java +++ /dev/null @@ -1,363 +0,0 @@ -package com.fastaccess.ui.modules.settings.category; - -import android.Manifest; -import android.content.Context; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.media.RingtoneManager; -import android.net.Uri; -import android.os.Bundle; -import android.os.Environment; -import androidx.annotation.NonNull; -import androidx.core.content.ContextCompat; -import androidx.preference.Preference; -import androidx.preference.PreferenceFragmentCompat; -import android.util.Log; -import android.widget.Toast; - -import com.bumptech.glide.Glide; -import com.fastaccess.App; -import com.fastaccess.R; -import com.fastaccess.data.dao.SettingsModel; -import com.fastaccess.data.dao.model.SearchHistory; -import com.fastaccess.helper.FileHelper; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.helper.PrefHelper; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.tasks.notification.NotificationSchedulerJobTask; -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.settings.sound.NotificationSoundBottomSheet; -import com.fastaccess.ui.modules.settings.sound.NotificationSoundMvp; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.lang.reflect.Type; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; -import java.util.Map; - -import es.dmoral.toasty.Toasty; -import io.reactivex.Observable; -import io.reactivex.disposables.CompositeDisposable; - -import static android.app.Activity.RESULT_OK; - -public class SettingsCategoryFragment extends PreferenceFragmentCompat implements - Preference.OnPreferenceChangeListener, NotificationSoundMvp.NotificationSoundListener { - - public static final String TAG = SettingsCategoryFragment.class.getSimpleName(); - - public interface SettingsCallback { - @SettingsModel.SettingsType int getSettingsType(); - } - - private static int PERMISSION_REQUEST_CODE = 128; - private static int RESTORE_REQUEST_CODE = 256; - private static int SOUND_REQUEST_CODE = 257; - - private BaseMvp.FAView callback; - private String appColor; - private String appLanguage; - - private Preference notificationTime; - private Preference notificationRead; - private Preference notificationSound; - private Preference notificationSoundPath; - private SettingsCallback settingsCallback; - private CompositeDisposable disposable = new CompositeDisposable(); - - @Override public void onAttach(Context context) { - super.onAttach(context); - this.callback = (BaseMvp.FAView) context; - this.settingsCallback = (SettingsCallback) context; - appColor = PrefHelper.getString("appColor"); - appLanguage = PrefHelper.getString("app_language"); - } - - @Override public void onDetach() { - callback = null; - settingsCallback = null; - super.onDetach(); - } - - @Override public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - } - - @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { - switch (settingsCallback.getSettingsType()) { - case SettingsModel.BACKUP: - addBackup(); - break; - case SettingsModel.BEHAVIOR: - addBehaviour(); - break; - case SettingsModel.CUSTOMIZATION: - addCustomization(); - break; - case SettingsModel.NOTIFICATION: - addNotifications(); - break; - default: - Toast.makeText(App.getInstance(), "You reached the impossible :'(", Toast.LENGTH_SHORT).show(); - } - } - - @Override public boolean onPreferenceChange(Preference preference, Object newValue) { - if (preference.getKey().equalsIgnoreCase("notificationEnabled")) { - if ((boolean) newValue) { - getPreferenceScreen().addPreference(notificationTime); - getPreferenceScreen().addPreference(notificationRead); - getPreferenceScreen().addPreference(notificationSound); - getPreferenceScreen().addPreference(notificationSoundPath); - NotificationSchedulerJobTask.scheduleJob(App.getInstance(), - PrefGetter.getNotificationTaskDuration(), true); - } else { - getPreferenceScreen().removePreference(notificationTime); - getPreferenceScreen().removePreference(notificationRead); - getPreferenceScreen().removePreference(notificationSound); - getPreferenceScreen().removePreference(notificationSoundPath); - NotificationSchedulerJobTask.scheduleJob(App.getInstance(), -1, true); - } - return true; - } else if (preference.getKey().equalsIgnoreCase("notificationTime")) { - NotificationSchedulerJobTask.scheduleJob(App.getInstance(), - PrefGetter.notificationDurationMillis((String) newValue), true); - return true; - } else if (preference.getKey().equalsIgnoreCase("recylerViewAnimation")) { - callback.onThemeChanged(); - return true; - } else if (preference.getKey().equalsIgnoreCase("rect_avatar")) { - callback.onThemeChanged(); - return true; - } else if (preference.getKey().equalsIgnoreCase("appColor")) { - if (newValue.toString().equalsIgnoreCase(appColor)) - return true; - Toasty.warning(App.getInstance(), getString(R.string.change_theme_warning), Toast.LENGTH_LONG).show(); - callback.onThemeChanged(); - return true; - } else if (preference.getKey().equalsIgnoreCase("app_language")) { - if (newValue.toString().equalsIgnoreCase(appLanguage)) - return true; - callback.onThemeChanged(); - return true; - } - return false; - } - - @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - if (requestCode == PERMISSION_REQUEST_CODE) { - if (permissions[0].equals(Manifest.permission.WRITE_EXTERNAL_STORAGE)) { - if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { - Map settings = PrefHelper.getAll(); - settings.remove("token"); - String json = new Gson().toJson(settings); - String path = Environment.getExternalStorageDirectory() + File.separator + "FastHub"; - File folder = new File(path); - folder.mkdirs(); - File backup = new File(folder, "backup.json"); - try { - backup.createNewFile(); - FileOutputStream outputStream = new FileOutputStream(backup); - OutputStreamWriter myOutWriter = new OutputStreamWriter(outputStream); - myOutWriter.append(json); - - myOutWriter.close(); - - outputStream.flush(); - outputStream.close(); - } catch (IOException e) { - Log.e(getTag(), "Couldn't backup: " + e.toString()); - } - PrefHelper.set("backed_up", new SimpleDateFormat("MM/dd", Locale.ENGLISH).format(new Date())); - findPreference("backup").setSummary(getString(R.string.backup_summary, getString(R.string.now))); - Toasty.success(App.getInstance(), getString(R.string.backed_up)).show(); - } else { - Toasty.error(App.getInstance(), getString(R.string.permission_failed)).show(); - } - } else if (permissions[0].equals(Manifest.permission.READ_EXTERNAL_STORAGE)) { - if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { - showFileChooser(); - } else { - Toasty.error(App.getInstance(), getString(R.string.permission_failed)).show(); - } - } - } - - } - - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - if (resultCode == RESULT_OK) { - if (requestCode == RESTORE_REQUEST_CODE) { - restoreData(data); - } else if (requestCode == SOUND_REQUEST_CODE) { - Uri ringtone = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); - if (notificationSoundPath != null && notificationSoundPath.isVisible()) { - notificationSoundPath.setDefaultValue(ringtone.toString()); - } - } - } - } - - @Override public void onSoundSelected(Uri uri) { - PrefGetter.setNotificationSound(uri); - if (notificationSoundPath != null && notificationSoundPath.isVisible()) - notificationSoundPath.setSummary(FileHelper.getRingtoneName(getContext(), uri)); - } - - @Override public void onDestroyView() { - disposable.clear(); - super.onDestroyView(); - } - - @Override public void onDestroy() { - disposable.clear(); - super.onDestroy(); - } - - private void showFileChooser() { - Intent intent = new Intent(Intent.ACTION_GET_CONTENT); - intent.setType("application/json"); - startActivityForResult(Intent.createChooser(intent, getString(R.string.select_backup)), RESTORE_REQUEST_CODE); - } - - private void addBackup() { - addPreferencesFromResource(R.xml.backup_settings); - findPreference("backup").setOnPreferenceClickListener((Preference preference) -> { - if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) { - Map preferences = PrefHelper.getAll(); - preferences.remove("token"); - String json = new Gson().toJson(preferences); - String path = FileHelper.PATH; - File folder = new File(path); - folder.mkdirs(); - File backup = new File(folder, "backup.json"); - try { - backup.createNewFile(); - try (FileOutputStream outputStream = new FileOutputStream(backup)) { - try (OutputStreamWriter myOutWriter = new OutputStreamWriter(outputStream)) { - myOutWriter.append(json); - } - } - } catch (IOException e) { - Log.e(getTag(), "Couldn't backup: " + e.toString()); - } - PrefHelper.set("backed_up", new SimpleDateFormat("MM/dd", Locale.ENGLISH).format(new Date())); - Toasty.success(App.getInstance(), getString(R.string.backed_up)).show(); - } else { - requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE); - } - return true; - }); - if (PrefHelper.getString("backed_up") != null) { - findPreference("backup").setSummary(SpannableBuilder.builder() - .append(getString(R.string.backup_summary, PrefHelper.getString("backed_up"))) - .append("\n") - .append(FileHelper.PATH)); - } else { - findPreference("backup").setSummary(""); - } - findPreference("restore").setOnPreferenceClickListener(preference -> { - if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) { - showFileChooser(); - } else { - requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE); - } - return true; - }); - } - - private void addCustomization() { - addPreferencesFromResource(R.xml.customization_settings); - findPreference("enable_ads").setVisible(false); - findPreference("recylerViewAnimation").setOnPreferenceChangeListener(this); - findPreference("rect_avatar").setOnPreferenceChangeListener(this); - findPreference("appColor").setOnPreferenceChangeListener(this); - } - - private void addBehaviour() { - addPreferencesFromResource(R.xml.behaviour_settings); - findPreference("clear_search").setOnPreferenceClickListener(preference -> { - callback.showMessage(R.string.success, R.string.deleted); - SearchHistory.deleteAll(); - return true; - }); - findPreference("clear_image_cache").setOnPreferenceClickListener(preference -> { - final Glide glide = Glide.get(App.getInstance()); - disposable.add(RxHelper.getObservable(Observable.fromCallable(() -> { - glide.clearDiskCache(); - return true; - })).subscribe(aBoolean -> { - glide.clearMemory(); - Toasty.info(App.getInstance(), getString(R.string.restart_app_message), Toast.LENGTH_LONG).show(); - })); - return true; - }); - } - - private void addNotifications() { - addPreferencesFromResource(R.xml.notification_settings); - notificationTime = findPreference("notificationTime"); - notificationRead = findPreference("markNotificationAsRead"); - notificationSound = findPreference("notificationSound"); - notificationTime.setOnPreferenceChangeListener(this); - findPreference("notificationEnabled").setOnPreferenceChangeListener(this); - notificationSoundPath = findPreference("notification_sound_path"); - notificationSoundPath.setSummary(FileHelper.getRingtoneName(getContext(), PrefGetter.getNotificationSound())); - notificationSoundPath.setOnPreferenceClickListener(preference -> { - NotificationSoundBottomSheet.Companion.newInstance(FileHelper.getRingtoneName(getContext(), PrefGetter.getNotificationSound())) - .show(getChildFragmentManager(), "NotificationSoundBottomSheet"); - return true; - }); - if (!PrefHelper.getBoolean("notificationEnabled")) { - getPreferenceScreen().removePreference(notificationTime); - getPreferenceScreen().removePreference(notificationRead); - getPreferenceScreen().removePreference(notificationSound); - getPreferenceScreen().removePreference(notificationSoundPath); - } - } - - private void restoreData(Intent data) { - StringBuilder json = new StringBuilder(); - try { - try (InputStream inputStream = getContext().getContentResolver().openInputStream(data.getData())) { - if (inputStream != null) { - try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { - String line; - while ((line = reader.readLine()) != null) { - json.append(line); - } - } - } - } - } catch (IOException e) { - Toasty.error(App.getInstance(), getString(R.string.error)).show(); - } - if (!InputHelper.isEmpty(json)) { - try { - Gson gson = new Gson(); - Type typeOfHashMap = new TypeToken>() {}.getType(); - Map savedPref = gson.fromJson(json.toString(), typeOfHashMap); - if (savedPref != null && !savedPref.isEmpty()) { - for (Map.Entry stringEntry : savedPref.entrySet()) { - PrefHelper.set(stringEntry.getKey(), stringEntry.getValue()); - } - } - callback.onThemeChanged(); - } catch (Exception ignored) { - Toasty.error(App.getInstance(), getString(R.string.error), Toast.LENGTH_SHORT).show(); - } - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryMvp.java b/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryMvp.java deleted file mode 100644 index 043fe7e3d..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryMvp.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.fastaccess.ui.modules.settings.category; - -import com.fastaccess.ui.base.mvp.BaseMvp; - -/** - * Created by JediB on 5/12/2017. - */ - -public interface SettingsCategoryMvp { - interface Presenter extends BaseMvp.FAPresenter { - - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryPresenter.java deleted file mode 100644 index 4b447e733..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/settings/category/SettingsCategoryPresenter.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.fastaccess.ui.modules.settings.category; - -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -/** - * Created by JediB on 5/12/2017. - */ - -class SettingsCategoryPresenter extends BasePresenter implements SettingsCategoryMvp.Presenter{} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/settings/sound/NotificationSoundBottomSheet.kt b/app/src/main/java/com/fastaccess/ui/modules/settings/sound/NotificationSoundBottomSheet.kt deleted file mode 100644 index c329db5b6..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/settings/sound/NotificationSoundBottomSheet.kt +++ /dev/null @@ -1,117 +0,0 @@ -package com.fastaccess.ui.modules.settings.sound - -import android.content.Context -import android.media.MediaPlayer -import android.os.Bundle -import android.view.Gravity -import android.view.View -import android.view.ViewGroup -import android.widget.Button -import android.widget.RadioButton -import android.widget.RadioGroup -import butterknife.BindView -import com.fastaccess.R -import com.fastaccess.data.dao.NotificationSoundModel -import com.fastaccess.helper.BundleConstant -import com.fastaccess.helper.Bundler -import com.fastaccess.ui.base.BaseMvpBottomSheetDialogFragment -import com.fastaccess.ui.widgets.FontTextView - -/** - * Created by kosh on 23/07/2017. - */ -class NotificationSoundBottomSheet : BaseMvpBottomSheetDialogFragment(), NotificationSoundMvp.View { - - @BindView(R.id.title) lateinit var title: FontTextView - @BindView(R.id.picker) lateinit var radioGroup: RadioGroup - @BindView(R.id.ok) lateinit var okButton: Button - - private val padding: Int by lazy { resources.getDimensionPixelSize(R.dimen.spacing_xs_large) } - private var canPlaySound: Boolean = false - private val mediaPlayer = MediaPlayer() - - private var listener: NotificationSoundMvp.NotificationSoundListener? = null - - override fun onAttach(context: Context) { - super.onAttach(context) - listener = if (parentFragment is NotificationSoundMvp.NotificationSoundListener) { - parentFragment as NotificationSoundMvp.NotificationSoundListener - } else { - context as NotificationSoundMvp.NotificationSoundListener - } - } - - override fun onDetach() { - super.onDetach() - } - - override fun fragmentLayout(): Int = R.layout.picker_dialog - - override fun providePresenter(): NotificationSoundPresenter = NotificationSoundPresenter() - - override fun onAddSound(sound: NotificationSoundModel) { - val radioButtonView = RadioButton(context) - val params = RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) - radioButtonView.layoutParams = params - radioButtonView.id = (radioGroup.childCount) - radioButtonView.setPadding(padding, padding, padding, padding) - radioButtonView.gravity = Gravity.CENTER_VERTICAL - radioButtonView.tag = sound - if (sound.isSelected) { - radioButtonView.isChecked = true - } - radioButtonView.text = sound.name - radioGroup.addView(radioButtonView) - } - - override fun onCompleted() { - canPlaySound = true - } - - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - title.text = getString(R.string.sound_chooser_title) - okButton.visibility = View.VISIBLE - presenter.loadSounds(arguments?.getString(BundleConstant.EXTRA)) - okButton.setOnClickListener { - val selectedView: View? = radioGroup.getChildAt(radioGroup.checkedRadioButtonId) - selectedView?.let { - val sound = it.tag as NotificationSoundModel - listener?.onSoundSelected(sound.uri) - } - dismiss() - } - radioGroup.setOnCheckedChangeListener { radioGroup, id -> - if (!canPlaySound) return@setOnCheckedChangeListener - val sound = radioGroup.getChildAt(id).tag as NotificationSoundModel - if (mediaPlayer.isPlaying) { - mediaPlayer.stop() - } - mediaPlayer.reset() - sound.uri?.let { - mediaPlayer.setDataSource(requireContext(), it) - mediaPlayer.prepare() - mediaPlayer.start() - } - } - } - - override fun onDestroyView() { - release() - super.onDestroyView() - } - - private fun release() { - if (mediaPlayer.isPlaying) mediaPlayer.stop() - mediaPlayer.release() - } - - companion object { - fun newInstance(default: String? = null): NotificationSoundBottomSheet { - val fragment = NotificationSoundBottomSheet() - fragment.arguments = Bundler.start().put(BundleConstant.EXTRA, default).end() - return fragment - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/settings/sound/NotificationSoundMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/settings/sound/NotificationSoundMvp.kt deleted file mode 100644 index 7c214e669..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/settings/sound/NotificationSoundMvp.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.fastaccess.ui.modules.settings.sound - -import android.net.Uri -import com.fastaccess.data.dao.NotificationSoundModel -import com.fastaccess.ui.base.mvp.BaseMvp - -/** - * Created by kosh on 23/07/2017. - */ - -interface NotificationSoundMvp { - interface View : BaseMvp.FAView { - fun onAddSound(sound: NotificationSoundModel) - fun onCompleted() - } - - interface Presenter { - fun loadSounds(default: String? = null) - } - - interface NotificationSoundListener { - fun onSoundSelected(uri: Uri? = null) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/settings/sound/NotificationSoundPresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/settings/sound/NotificationSoundPresenter.kt deleted file mode 100644 index 40e9114ba..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/settings/sound/NotificationSoundPresenter.kt +++ /dev/null @@ -1,23 +0,0 @@ -package com.fastaccess.ui.modules.settings.sound - -import com.fastaccess.App -import com.fastaccess.data.dao.NotificationSoundModel -import com.fastaccess.helper.FileHelper -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import io.reactivex.Observable - -/** - * Created by kosh on 23/07/2017. - */ -class NotificationSoundPresenter : BasePresenter(), NotificationSoundMvp.Presenter { - override fun loadSounds(default: String?) { - manageObservable(Observable.fromPublisher { s -> - val sounds = FileHelper.getNotificationSounds(App.getInstance(), default) - sounds.filterNotNull() - .sortedBy { !it.isSelected } - .onEach { s.onNext(it) } - s.onComplete() - }.doOnNext({ t -> sendToView { it.onAddSound(t) } }) - .doOnComplete { sendToView { it.onCompleted() } }) - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/theme/ThemeActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/theme/ThemeActivity.kt deleted file mode 100644 index aade56189..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/theme/ThemeActivity.kt +++ /dev/null @@ -1,101 +0,0 @@ -package com.fastaccess.ui.modules.theme - -import android.animation.Animator -import android.animation.AnimatorListenerAdapter -import android.os.Build -import android.os.Bundle -import android.view.View -import android.view.ViewAnimationUtils -import butterknife.BindView -import butterknife.OnClick -import com.fastaccess.R -import com.fastaccess.data.dao.FragmentPagerAdapterModel -import com.fastaccess.helper.PrefGetter -import com.fastaccess.ui.adapter.FragmentsPagerAdapter -import com.fastaccess.ui.base.BaseActivity -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import com.fastaccess.ui.modules.main.premium.PremiumActivity -import com.fastaccess.ui.modules.theme.fragment.ThemeFragmentMvp -import com.fastaccess.ui.widgets.CardsPagerTransformerBasic -import com.fastaccess.ui.widgets.ViewPagerView - - -/** - * Created by Kosh on 08 Jun 2017, 10:34 PM - */ - -class ThemeActivity : BaseActivity>(), ThemeFragmentMvp.ThemeListener { - - @BindView(R.id.pager) lateinit var pager: ViewPagerView - @BindView(R.id.parentLayout) lateinit var parentLayout: View - - @OnClick(R.id.premium) fun onOpenPremium() { - PremiumActivity.startActivity(this) - } - - override fun layout(): Int = R.layout.theme_viewpager - - override fun isTransparent(): Boolean = false - - override fun canBack(): Boolean = true - - override fun isSecured(): Boolean = false - - override fun providePresenter(): BasePresenter { - return BasePresenter() - } - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - pager.adapter = FragmentsPagerAdapter(supportFragmentManager, FragmentPagerAdapterModel.buildForTheme()) - pager.clipToPadding = false - val partialWidth = resources.getDimensionPixelSize(R.dimen.spacing_s_large) - val pageMargin = resources.getDimensionPixelSize(R.dimen.spacing_normal) - val pagerPadding = partialWidth + pageMargin - pager.pageMargin = pageMargin - pager.setPageTransformer(true, CardsPagerTransformerBasic(4, 10)) - pager.setPadding(pagerPadding, pagerPadding, pagerPadding, pagerPadding) - if (savedInstanceState == null) { - val theme = PrefGetter.getThemeType(this) - pager.setCurrentItem(theme - 1, true) - } - } - - override fun onChangePrimaryDarkColor(color: Int, darkIcons: Boolean) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - val view = window.decorView - view.systemUiVisibility = if (darkIcons) View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR else view.systemUiVisibility and View - .SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.inv() - } - val cx = parentLayout.width / 2 - val cy = parentLayout.height / 2 - if (parentLayout.isAttachedToWindow) { - val finalRadius = Math.hypot(cx.toDouble(), cy.toDouble()).toFloat() - val anim = ViewAnimationUtils.createCircularReveal(parentLayout, cx, cy, 0f, finalRadius) - anim.addListener(object : AnimatorListenerAdapter() { - override fun onAnimationEnd(animation: Animator?) { - super.onAnimationEnd(animation) - window?.statusBarColor = color - changeNavColor(color) - } - }) - parentLayout.setBackgroundColor(color) - anim.start() - } else { - parentLayout.setBackgroundColor(color) - window.statusBarColor = color - changeNavColor(color) - } - } - - private fun changeNavColor(color: Int) { - window?.navigationBarColor = color - } - - override fun onThemeApplied() { - showMessage(R.string.success, R.string.change_theme_warning) - onThemeChanged() - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/theme/code/ThemeCodeActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/theme/code/ThemeCodeActivity.kt deleted file mode 100644 index 29be78a88..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/theme/code/ThemeCodeActivity.kt +++ /dev/null @@ -1,74 +0,0 @@ -package com.fastaccess.ui.modules.theme.code - -import android.app.Activity -import android.os.Bundle -import android.view.View -import android.widget.ProgressBar -import android.widget.Spinner -import butterknife.BindView -import butterknife.OnClick -import butterknife.OnItemSelected -import com.fastaccess.R -import com.fastaccess.helper.PrefGetter -import com.fastaccess.ui.adapter.SpinnerAdapter -import com.fastaccess.ui.base.BaseActivity -import com.prettifier.pretty.PrettifyWebView -import com.prettifier.pretty.helper.CodeThemesHelper - -/** - * Created by Kosh on 21 Jun 2017, 2:01 PM - */ - -class ThemeCodeActivity : BaseActivity(), ThemeCodeMvp.View { - - @BindView(R.id.themesList) lateinit var spinner: Spinner - @BindView(R.id.webView) lateinit var webView: PrettifyWebView - @BindView(R.id.readmeLoader) lateinit var progress: ProgressBar - - override fun layout(): Int = R.layout.theme_code_layout - - override fun isTransparent(): Boolean = false - - override fun canBack(): Boolean = true - - override fun isSecured(): Boolean = false - - override fun providePresenter(): ThemeCodePresenter = ThemeCodePresenter() - - @OnClick(R.id.done) fun onSaveTheme() { - val theme = spinner.selectedItem as String - PrefGetter.setCodeTheme(theme) - setResult(Activity.RESULT_OK) - finish() - } - - override fun onInitAdapter(list: List) { - val adapter = SpinnerAdapter(this, list) - spinner.adapter = adapter - val themePosition = list.indexOf(PrefGetter.getCodeTheme()) - if (themePosition >= 0) spinner.setSelection(themePosition) - } - - @OnItemSelected(R.id.themesList) fun onItemSelect() { - val theme = spinner.selectedItem as String - progress.visibility = View.VISIBLE - webView.setThemeSource(CodeThemesHelper.CODE_EXAMPLE, theme) - } - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - progress.visibility = View.VISIBLE - webView.setOnContentChangedListener(this) - title = "" - presenter.onLoadThemes() - } - - override fun onContentChanged(p: Int) { - progress.let { - it.progress = p - if (p == 100) it.visibility = View.GONE - } - } - - override fun onScrollChanged(reachedTop: Boolean, scroll: Int) {} -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/theme/code/ThemeCodeMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/theme/code/ThemeCodeMvp.kt deleted file mode 100644 index 02b6de67c..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/theme/code/ThemeCodeMvp.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.fastaccess.ui.modules.theme.code - -import com.fastaccess.ui.base.mvp.BaseMvp -import com.prettifier.pretty.PrettifyWebView - -/** - * Created by Kosh on 22 Jun 2017, 11:50 PM - */ -interface ThemeCodeMvp { - - interface View : BaseMvp.FAView, PrettifyWebView.OnContentChangedListener { - fun onInitAdapter(list: List) - } - - interface Presenter { - fun onLoadThemes() - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/theme/code/ThemeCodePresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/theme/code/ThemeCodePresenter.kt deleted file mode 100644 index 4f7d0292d..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/theme/code/ThemeCodePresenter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.fastaccess.ui.modules.theme.code - -import com.fastaccess.helper.RxHelper -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import com.prettifier.pretty.helper.CodeThemesHelper -import io.reactivex.Observable - -/** - * Created by Kosh on 22 Jun 2017, 11:52 PM - */ - -class ThemeCodePresenter : BasePresenter(), ThemeCodeMvp.Presenter { - - override fun onLoadThemes() { - manageDisposable(RxHelper.getObservable(Observable.just(CodeThemesHelper.listThemes())) - .subscribe({ list -> sendToView { it.onInitAdapter(list) } }, { onError(it) })) - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/theme/fragment/ThemeFragment.kt b/app/src/main/java/com/fastaccess/ui/modules/theme/fragment/ThemeFragment.kt deleted file mode 100644 index 1a01bd965..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/theme/fragment/ThemeFragment.kt +++ /dev/null @@ -1,166 +0,0 @@ -package com.fastaccess.ui.modules.theme.fragment - -import android.app.Activity -import android.content.Context -import android.content.Intent -import android.graphics.Color -import android.os.Bundle -import com.google.android.material.floatingactionbutton.FloatingActionButton -import androidx.appcompat.widget.Toolbar -import android.view.ContextThemeWrapper -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import butterknife.BindView -import butterknife.ButterKnife -import butterknife.Unbinder -import com.fastaccess.R -import com.fastaccess.helper.* -import com.fastaccess.ui.base.BaseFragment -import com.fastaccess.ui.modules.main.donation.DonateActivity -import com.fastaccess.ui.modules.main.premium.PremiumActivity -import com.fastaccess.ui.widgets.SpannableBuilder - -/** - * Created by Kosh on 08 Jun 2017, 10:53 PM - */ - -class ThemeFragment : BaseFragment(), ThemeFragmentMvp.View { - - @BindView(R.id.apply) lateinit var apply: FloatingActionButton - @BindView(R.id.toolbar) lateinit var toolbar: Toolbar - - private var unbinder: Unbinder? = null - - private val THEME = "appTheme" - private var primaryDarkColor: Int = 0 - private var theme: Int = 0 - private var themeListener: ThemeFragmentMvp.ThemeListener? = null - - override fun onAttach(context: Context) { - super.onAttach(context) - themeListener = context as ThemeFragmentMvp.ThemeListener - } - - override fun onDetach() { - themeListener = null - super.onDetach() - } - - override fun fragmentLayout(): Int = 0 - - override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { - apply.setOnClickListener { - setTheme() - } - if (isPremiumTheme()) { - toolbar.title = SpannableBuilder.builder().foreground(getString(R.string.premium_theme), Color.RED) - } - toolbar.setNavigationOnClickListener { activity?.onBackPressed() } - } - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - super.onCreateView(inflater, container, savedInstanceState) - theme = arguments!!.getInt(BundleConstant.ITEM) - val contextThemeWrapper = ContextThemeWrapper(activity, theme) - primaryDarkColor = ViewHelper.getPrimaryDarkColor(contextThemeWrapper) - val localInflater = inflater.cloneInContext(contextThemeWrapper) - val view = localInflater.inflate(R.layout.theme_layout, container, false)!! - unbinder = ButterKnife.bind(this, view) - return view - } - - override fun providePresenter(): ThemeFragmentPresenter { - return ThemeFragmentPresenter() - } - - override fun setUserVisibleHint(isVisibleToUser: Boolean) { - super.setUserVisibleHint(isVisibleToUser) - if (isVisibleToUser) { - if (themeListener != null) { - themeListener!!.onChangePrimaryDarkColor(primaryDarkColor, theme == R.style.ThemeLight) - } - } - } - - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - super.onActivityResult(requestCode, resultCode, data) - if (resultCode == Activity.RESULT_OK) { - val productKey = data?.getStringExtra(BundleConstant.ITEM) - productKey?.let { - when (it) { - getString(R.string.amlod_theme_purchase) -> setTheme(getString(R.string.amlod_theme_mode)) - getString(R.string.midnight_blue_theme_purchase) -> setTheme(getString(R.string.mid_night_blue_theme_mode)) - getString(R.string.theme_bluish_purchase) -> setTheme(getString(R.string.bluish_theme)) - } - } - } - } - - companion object { - fun newInstance(style: Int): ThemeFragment { - val fragment = ThemeFragment() - fragment.arguments = Bundler.start() - .put(BundleConstant.ITEM, style) - .end() - return fragment - } - } - - private fun setTheme() { - when (theme) { - R.style.ThemeLight -> setTheme(getString(R.string.light_theme_mode)) - R.style.ThemeDark -> setTheme(getString(R.string.dark_theme_mode)) - R.style.ThemeAmlod -> applyAmlodTheme() - R.style.ThemeBluish -> applyBluishTheme() - R.style.ThemeMidnight -> applyMidnightTheme() - } - } - - private fun applyBluishTheme() { - if (!isGoogleSupported()) return - if (PrefGetter.isBluishEnabled() || PrefGetter.isProEnabled()) { - setTheme(getString(R.string.bluish_theme)) - } else { - DonateActivity.start(this, getString(R.string.theme_bluish_purchase)) - } - } - - private fun applyAmlodTheme() { - if (!isGoogleSupported()) return - if (PrefGetter.isAmlodEnabled() || PrefGetter.isProEnabled()) { - setTheme(getString(R.string.amlod_theme_mode)) - } else { - DonateActivity.start(this, getString(R.string.amlod_theme_purchase)) - } - } - - private fun applyMidnightTheme() { - if (!isGoogleSupported()) return - if (PrefGetter.isProEnabled() || PrefGetter.isAllFeaturesUnlocked()) { - setTheme(getString(R.string.mid_night_blue_theme_mode)) - } else { - PremiumActivity.startActivity(context!!) - } - } - - private fun setTheme(theme: String) { - PrefHelper.set(THEME, theme) - themeListener?.onThemeApplied() - } - - private fun isPremiumTheme(): Boolean = theme != R.style.ThemeLight && theme != R.style.ThemeDark - - private fun isGoogleSupported(): Boolean { - if (AppHelper.isGoogleAvailable(context!!)) { - return true - } - showErrorMessage(getString(R.string.common_google_play_services_unsupported_text)) - return false - } - - override fun onDestroyView() { - super.onDestroyView() - unbinder?.unbind() - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/theme/fragment/ThemeFragmentMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/theme/fragment/ThemeFragmentMvp.kt deleted file mode 100644 index 033b5a2f1..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/theme/fragment/ThemeFragmentMvp.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.fastaccess.ui.modules.theme.fragment - -import androidx.annotation.ColorInt - -import com.fastaccess.ui.base.mvp.BaseMvp - -/** - * Created by Kosh on 08 Jun 2017, 10:52 PM - */ - -interface ThemeFragmentMvp { - - interface ThemeListener { - fun onChangePrimaryDarkColor(@ColorInt color: Int, darkIcons: Boolean) - - fun onThemeApplied() - } - - interface View : BaseMvp.FAView - - interface Presenter -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/theme/fragment/ThemeFragmentPresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/theme/fragment/ThemeFragmentPresenter.kt deleted file mode 100644 index d6980c928..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/theme/fragment/ThemeFragmentPresenter.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.fastaccess.ui.modules.theme.fragment - -import com.fastaccess.ui.base.mvp.presenter.BasePresenter - -/** - * Created by Kosh on 08 Jun 2017, 10:52 PM - */ - -class ThemeFragmentPresenter : BasePresenter(), ThemeFragmentMvp.Presenter diff --git a/app/src/main/java/com/fastaccess/ui/modules/trending/TrendingActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/trending/TrendingActivity.kt deleted file mode 100644 index 6567b4ffb..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/trending/TrendingActivity.kt +++ /dev/null @@ -1,244 +0,0 @@ -package com.fastaccess.ui.modules.trending - -import android.content.Context -import android.content.Intent -import android.graphics.drawable.GradientDrawable -import android.os.Bundle -import android.os.Handler -import androidx.annotation.ColorInt -import com.google.android.material.navigation.NavigationView -import androidx.drawerlayout.widget.DrawerLayout -import android.text.Editable -import android.view.Gravity -import android.view.Menu -import android.view.MenuItem -import android.view.View -import android.widget.TextView -import butterknife.BindView -import butterknife.OnClick -import butterknife.OnEditorAction -import butterknife.OnTextChanged -import com.evernote.android.state.State -import com.fastaccess.R -import com.fastaccess.helper.* -import com.fastaccess.provider.scheme.LinkParserHelper -import com.fastaccess.ui.base.BaseActivity -import com.fastaccess.ui.modules.main.MainActivity -import com.fastaccess.ui.modules.trending.fragment.TrendingFragment -import com.fastaccess.ui.widgets.FontEditText -import java.util.* - - -/** - * Created by Kosh on 30 May 2017, 10:57 PM - */ - -class TrendingActivity : BaseActivity(), TrendingMvp.View { - private var trendingFragment: TrendingFragment? = null - - @BindView(R.id.navMenu) lateinit var navMenu: NavigationView - @BindView(R.id.daily) lateinit var daily: TextView - @BindView(R.id.weekly) lateinit var weekly: TextView - @BindView(R.id.monthly) lateinit var monthly: TextView - @BindView(R.id.drawer) lateinit var drawerLayout: DrawerLayout - @BindView(R.id.clear) lateinit var clear: View - @BindView(R.id.searchEditText) lateinit var searchEditText: FontEditText - - - @State var selectedTitle: String = "All" - - @OnTextChanged(value = [R.id.searchEditText], callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) fun onTextChange(s: Editable) { - val text = s.toString() - if (text.isEmpty()) { - AnimHelper.animateVisibility(clear, false) - } else { - AnimHelper.animateVisibility(clear, true) - } - } - - @OnEditorAction(R.id.searchEditText) fun onSearch(): Boolean { - presenter.onFilterLanguage(InputHelper.toString(searchEditText)) - ViewHelper.hideKeyboard(searchEditText) - return true - } - - @OnClick(R.id.daily) fun onDailyClicked() { - Logger.e() - daily.isSelected = true - weekly.isSelected = false - monthly.isSelected = false - setValues() - } - - @OnClick(R.id.weekly) fun onWeeklyClicked() { - weekly.isSelected = true - daily.isSelected = false - monthly.isSelected = false - setValues() - } - - @OnClick(R.id.monthly) fun onMonthlyClicked() { - monthly.isSelected = true - weekly.isSelected = false - daily.isSelected = false - setValues() - } - - @OnClick(R.id.clear) fun onClearSearch() { - ViewHelper.hideKeyboard(searchEditText) - searchEditText.setText("") - onClearMenu() - presenter.onLoadLanguage() - } - - override fun layout(): Int = R.layout.trending_activity_layout - - override fun isTransparent(): Boolean = true - - override fun canBack(): Boolean = true - - override fun isSecured(): Boolean = false - - override fun providePresenter(): TrendingPresenter = TrendingPresenter() - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - navMenu.itemIconTintList = null - trendingFragment = supportFragmentManager.findFragmentById(R.id.trendingFragment) as? TrendingFragment - navMenu.setNavigationItemSelectedListener { item -> - closeDrawerLayout() - onItemClicked(item) - } - setupIntent(savedInstanceState) - if (savedInstanceState == null) { - presenter.onLoadLanguage() - } else { - Handler().postDelayed({ - Logger.e(searchEditText.text) - if (InputHelper.isEmpty(searchEditText)) { //searchEditText.text is always empty even tho there is a text in it !!!!!!! - presenter.onLoadLanguage() - } else { - presenter.onFilterLanguage(InputHelper.toString(searchEditText)) - } - }, 300) - } - onSelectTrending() - } - - override fun onCreateOptionsMenu(menu: Menu?): Boolean { - menuInflater.inflate(R.menu.trending_menu, menu) - return super.onCreateOptionsMenu(menu) - } - - override fun onOptionsItemSelected(item: MenuItem?): Boolean { - return when (item?.itemId) { - R.id.menu -> { - drawerLayout.openDrawer(Gravity.END) - true - } - R.id.share -> { - ActivityHelper.shareUrl( - this, "${LinkParserHelper.PROTOCOL_HTTPS}://${LinkParserHelper.HOST_DEFAULT}" + - "/trending/$selectedTitle" - ) - return true - } - android.R.id.home -> { - startActivity(Intent(this, MainActivity::class.java)) - finish() - true - } - else -> super.onOptionsItemSelected(item) - } - } - - override fun onAppend(title: String, color: Int) { - navMenu.menu.add(R.id.languageGroup, title.hashCode(), Menu.NONE, title) - .setCheckable(true) - .setIcon(createOvalShape(color)) - .isChecked = title.toLowerCase() == selectedTitle.toLowerCase() - } - - override fun onClearMenu() { - navMenu.menu.clear() - } - - private fun onItemClicked(item: MenuItem?): Boolean { - selectedTitle = when (item?.title.toString()) { - "All" -> "" - else -> item?.title.toString() - } - Logger.e(selectedTitle) - setValues() - return true - } - - private fun closeDrawerLayout() { - drawerLayout.closeDrawer(Gravity.END) - } - - private fun setValues() { - closeDrawerLayout() - Logger.e(selectedTitle, getSince()) - trendingFragment?.onSetQuery(selectedTitle, getSince()) - } - - private fun getSince(): String { - return when { - daily.isSelected -> "daily" - weekly.isSelected -> "weekly" - monthly.isSelected -> "monthly" - else -> "daily" - } - } - - private fun setupIntent(savedInstanceState: Bundle?) { - if (savedInstanceState == null) { - if (intent != null && intent.extras != null) { - val bundle = intent.extras - if (bundle != null) { - val lang: String = bundle.getString(BundleConstant.EXTRA) ?: "All" - val query: String? = bundle.getString(BundleConstant.EXTRA_TWO) - if (lang.isNotEmpty()) { - selectedTitle = lang - } - if (query.isNullOrEmpty()) { - daily.isSelected = true - } else { - when (query.toLowerCase(Locale.getDefault())) { - "daily" -> daily.isSelected = true - "weekly" -> weekly.isSelected = true - "monthly" -> monthly.isSelected = true - } - } - } else { - daily.isSelected = true - } - } else { - daily.isSelected = true - } - setValues() - } - } - - private fun createOvalShape(@ColorInt color: Int): GradientDrawable { - val drawable = GradientDrawable() - drawable.shape = GradientDrawable.OVAL - drawable.setSize(24, 24) - drawable.setColor(color) - return drawable - } - - companion object { - fun getTrendingIntent(context: Context, lang: String?, query: String?): Intent { - val intent = Intent(context, TrendingActivity::class.java) - intent.putExtras( - Bundler.start() - .put(BundleConstant.EXTRA, lang) - .put(BundleConstant.EXTRA_TWO, query) - .end() - ) - return intent - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/trending/TrendingMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/trending/TrendingMvp.kt deleted file mode 100644 index f2971223d..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/trending/TrendingMvp.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.fastaccess.ui.modules.trending - -import androidx.annotation.ColorInt -import com.fastaccess.ui.base.mvp.BaseMvp - -/** - * Created by Kosh on 30 May 2017, 10:51 PM - */ - -interface TrendingMvp { - interface View : BaseMvp.FAView { - fun onAppend(title: String, @ColorInt color: Int) - fun onClearMenu() - } - - interface Presenter { - fun onLoadLanguage() - - fun onFilterLanguage(key: String) - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/trending/TrendingPresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/trending/TrendingPresenter.kt deleted file mode 100644 index 438a3d281..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/trending/TrendingPresenter.kt +++ /dev/null @@ -1,39 +0,0 @@ -package com.fastaccess.ui.modules.trending - -import android.graphics.Color -import com.fastaccess.helper.RxHelper -import com.fastaccess.provider.colors.ColorsProvider -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import io.reactivex.Observable - -/** - * Created by Kosh on 30 May 2017, 10:55 PM - */ - -class TrendingPresenter : BasePresenter(), TrendingMvp.Presenter { - override fun onFilterLanguage(key: String) { - manageObservable(RxHelper.getObservable(Observable.fromIterable(ColorsProvider.languages())) - .doOnSubscribe { sendToView { it.onClearMenu() } } - .filter { it.toLowerCase().contains(key.toLowerCase()) } - .doOnNext { sendWithColor(it) }) - } - - private fun sendWithColor(t: String) { - val color = ColorsProvider.getColor(t) - if (color != null) { - try { - val lanColor = Color.parseColor(color.color) - sendToView { it.onAppend(t, lanColor) } - } catch (e: Exception) { - sendToView { it.onAppend(t, Color.LTGRAY) } - } - } else { - sendToView { it.onAppend(t, Color.LTGRAY) } - } - } - - override fun onLoadLanguage() { - manageObservable(RxHelper.getObservable(Observable.fromIterable(ColorsProvider.languages())) - .doOnNext { sendWithColor(it) }) - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/trending/fragment/TrendingFragment.kt b/app/src/main/java/com/fastaccess/ui/modules/trending/fragment/TrendingFragment.kt deleted file mode 100644 index 8c78474a9..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/trending/fragment/TrendingFragment.kt +++ /dev/null @@ -1,93 +0,0 @@ -package com.fastaccess.ui.modules.trending.fragment - -import android.os.Bundle -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout -import android.view.View -import butterknife.BindView -import com.evernote.android.state.State -import com.fastaccess.R -import com.fastaccess.data.dao.TrendingModel -import com.fastaccess.helper.Logger -import com.fastaccess.ui.adapter.TrendingAdapter -import com.fastaccess.ui.base.BaseFragment -import com.fastaccess.ui.widgets.StateLayout -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller -import kotlin.math.sin - -/** - * Created by Kosh on 30 May 2017, 11:37 PM - */ - -class TrendingFragment : BaseFragment(), TrendingFragmentMvp.View { - - @BindView(R.id.recycler) lateinit var recycler: DynamicRecyclerView - @BindView(R.id.refresh) lateinit var refresh: SwipeRefreshLayout - @BindView(R.id.stateLayout) lateinit var stateLayout: StateLayout - @BindView(R.id.fastScroller) lateinit var fastScroller: RecyclerViewFastScroller - - private val adapter by lazy { TrendingAdapter(presenter.getTendingList()) } - - @State var lang: String = "" - @State var since: String = "" - - override fun providePresenter(): TrendingFragmentPresenter = TrendingFragmentPresenter() - - override fun fragmentLayout(): Int = R.layout.small_grid_refresh_list - - override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { - stateLayout.setEmptyText(R.string.no_trending) - recycler.setEmptyView(stateLayout, refresh) - refresh.setOnRefreshListener { onCallApi() } - stateLayout.setOnReloadListener { onCallApi() } - adapter.listener = presenter - recycler.adapter = adapter - fastScroller.attachRecyclerView(recycler) - } - - override fun onNotifyAdapter(items: List) { - adapter.insertItems(items) - } - - override fun onSetQuery(lang: String, since: String) { - this.lang = lang - this.since = since - Logger.e(lang, since) - adapter.clear() - presenter.onCallApi(lang, since) - } - - override fun showProgress(resId: Int) { - refresh.isRefreshing = true - stateLayout.showProgress() - } - - override fun hideProgress() { - refresh.isRefreshing = false - stateLayout.hideProgress() - stateLayout.showReload(adapter.itemCount) - } - - override fun showMessage(titleRes: Int, msgRes: Int) { - hideProgress() - super.showMessage(titleRes, msgRes) - } - - override fun showMessage(titleRes: String, msgRes: String) { - hideProgress() - super.showMessage(titleRes, msgRes) - } - - override fun showErrorMessage(msgRes: String) { - hideProgress() - super.showErrorMessage(msgRes) - } - - private fun onCallApi() { - presenter.onCallApi(lang, since) - } - - override fun clearAdapter() { - adapter.clear() - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/trending/fragment/TrendingFragmentMvp.kt b/app/src/main/java/com/fastaccess/ui/modules/trending/fragment/TrendingFragmentMvp.kt deleted file mode 100644 index c3957d2f5..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/trending/fragment/TrendingFragmentMvp.kt +++ /dev/null @@ -1,23 +0,0 @@ -package com.fastaccess.ui.modules.trending.fragment - - -import com.fastaccess.data.dao.TrendingModel -import com.fastaccess.ui.base.mvp.BaseMvp -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder - -/** - * Created by Kosh on 30 May 2017, 11:03 PM - */ - -interface TrendingFragmentMvp { - interface View : BaseMvp.FAView { - fun onNotifyAdapter(items: List) - fun onSetQuery(lang: String, since: String) - fun clearAdapter() - } - - interface Presenter : BaseViewHolder.OnItemClickListener { - fun onCallApi(lang: String, since: String) - fun getTendingList(): ArrayList - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/trending/fragment/TrendingFragmentPresenter.kt b/app/src/main/java/com/fastaccess/ui/modules/trending/fragment/TrendingFragmentPresenter.kt deleted file mode 100644 index 1f6f5954e..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/trending/fragment/TrendingFragmentPresenter.kt +++ /dev/null @@ -1,111 +0,0 @@ -package com.fastaccess.ui.modules.trending.fragment - -import android.view.View -import com.fastaccess.data.dao.FirebaseTrendingConfigModel -import com.fastaccess.data.dao.TrendingModel -import com.fastaccess.helper.Logger -import com.fastaccess.helper.RxHelper -import com.fastaccess.provider.rest.jsoup.JsoupProvider -import com.fastaccess.ui.base.mvp.presenter.BasePresenter -import com.fastaccess.ui.modules.repos.RepoPagerActivity -import com.github.b3er.rxfirebase.database.RxFirebaseDatabase -import com.google.firebase.database.FirebaseDatabase -import io.reactivex.Observable -import io.reactivex.disposables.Disposable -import org.jsoup.Jsoup -import java.util.* -import kotlin.collections.ArrayList - -/** - * Created by Kosh on 30 May 2017, 11:04 PM - */ - -class TrendingFragmentPresenter : BasePresenter(), TrendingFragmentMvp.Presenter { - - private var disposel: Disposable? = null - - private val trendingList: ArrayList = ArrayList() - private var firebaseTrendingConfigModel: FirebaseTrendingConfigModel? = null - - override fun getTendingList(): ArrayList { - return trendingList - } - - override fun onItemLongClick(position: Int, v: View?, item: TrendingModel?) {} - - override fun onItemClick(position: Int, v: View?, item: TrendingModel?) { - val split = item?.title?.trim()?.split("/") ?: return - v?.context?.let { it.startActivity(RepoPagerActivity.createIntent(it, split[1].trim(), split[0].trim())) } - } - - override fun onCallApi(lang: String, since: String) { - disposel?.let { if (!it.isDisposed) it.dispose() } - val config = firebaseTrendingConfigModel - - if (config == null) { - manageDisposable(RxHelper.getSingle(RxFirebaseDatabase.data(FirebaseDatabase.getInstance().reference.child("github_trending"))) - .doOnSubscribe { sendToView { it.showProgress(0) } } - .map { - firebaseTrendingConfigModel = FirebaseTrendingConfigModel - .map(it.value as? HashMap) - return@map firebaseTrendingConfigModel - } - .subscribe( - { callApi(lang, since) }, - { callApi(lang, since) } - ) - ) - } else { - callApi(lang, since) - } - } - - private fun callApi( - lang: String, - since: String - ) { - val model = firebaseTrendingConfigModel ?: FirebaseTrendingConfigModel() - - val language = if (lang == "All") "" else lang.replace(" ", "_").toLowerCase(Locale.getDefault()) - - disposel = RxHelper.getObservable(JsoupProvider.getTrendingService(model.pathUrl).getTrending(language, since)) - .doOnSubscribe { - sendToView { - it.showProgress(0) - it.clearAdapter() - } - }.flatMap { - RxHelper.getObservable(getTrendingObservable(it.body() ?: "", model)) - }.subscribe( - { response -> sendToView { view -> view.onNotifyAdapter(response) } }, - { throwable -> onError(throwable) }, - { sendToView { it.hideProgress() } } - ) - manageDisposable(disposel) - } - - - private fun getTrendingObservable(html: String, trendingModel: FirebaseTrendingConfigModel): Observable> { - return Observable.fromPublisher { s -> - val document = Jsoup.parse(html, "") - val list = document.select(trendingModel.listName) - val trendingList = arrayListOf() - list.select(trendingModel.listNameSublistTag)?.let { li -> - trendingList.addAll(li.map { body -> - val trendingLang = kotlin.runCatching { body.select(trendingModel.language).text() } - .getOrNull() ?: kotlin.runCatching { body.select(trendingModel.languageFallback).text() }.getOrNull() - val todayStars = kotlin.runCatching { body.select(trendingModel.todayStars).text() } - .getOrNull() ?: kotlin.runCatching { body.select(trendingModel.todayStarsFallback).text() }.getOrNull() - val title = kotlin.runCatching { body.select(trendingModel.title).text() }.getOrNull() - val description = kotlin.runCatching { body.select(trendingModel.description).text() }.getOrNull() - val stars = kotlin.runCatching { body.select(trendingModel.stars).text() }.getOrNull() - val forks = kotlin.runCatching { body.select(trendingModel.forks).text() }.getOrNull() - TrendingModel(title, description, trendingLang, stars, forks, todayStars) - }) - } - Logger.e(trendingList as List?) - s.onNext(trendingList) - s.onComplete() - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/user/UserPagerActivity.java b/app/src/main/java/com/fastaccess/ui/modules/user/UserPagerActivity.java deleted file mode 100644 index 097aaf969..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/user/UserPagerActivity.java +++ /dev/null @@ -1,332 +0,0 @@ -package com.fastaccess.ui.modules.user; - -import android.app.Application; -import android.app.Service; -import android.content.Context; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import androidx.annotation.NonNull; -import com.google.android.material.floatingactionbutton.FloatingActionButton; -import com.google.android.material.tabs.TabLayout; -import androidx.fragment.app.Fragment; -import androidx.viewpager.widget.ViewPager; -import android.view.Menu; -import android.view.MenuItem; -import android.widget.TextView; - -import com.annimon.stream.Stream; -import com.evernote.android.state.State; -import com.fastaccess.R; -import com.fastaccess.data.dao.FragmentPagerAdapterModel; -import com.fastaccess.data.dao.TabsCountStateModel; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.Logger; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.provider.scheme.LinkParserHelper; -import com.fastaccess.ui.adapter.FragmentsPagerAdapter; -import com.fastaccess.ui.base.BaseActivity; -import com.fastaccess.ui.base.BaseFragment; -import com.fastaccess.ui.modules.main.MainActivity; -import com.fastaccess.ui.modules.profile.org.repos.OrgReposFragment; -import com.fastaccess.ui.modules.profile.repos.ProfileReposFragment; -import com.fastaccess.ui.widgets.SpannableBuilder; -import com.fastaccess.ui.widgets.ViewPagerView; - -import java.util.HashSet; - -import butterknife.BindView; -import butterknife.OnClick; -import shortbread.Shortcut; - -/** - * Created by Kosh on 03 Dec 2016, 8:00 AM - */ - -@Shortcut(id = "profile", icon = R.drawable.ic_app_shortcut_profile, shortLabelRes = R.string.profile, backStack = {MainActivity.class}, rank = 4) -public class UserPagerActivity extends BaseActivity implements UserPagerMvp.View { - - @BindView(R.id.tabs) TabLayout tabs; - @BindView(R.id.tabbedPager) ViewPagerView pager; - @BindView(R.id.fab) FloatingActionButton fab; - @State int index; - @State String login; - @State boolean isOrg; - @State HashSet counts = new HashSet<>(); - - public static void startActivity(@NonNull Context context, @NonNull String login, boolean isOrg, - boolean isEnterprise, int index) { - context.startActivity(createIntent(context, login, isOrg, isEnterprise, index)); - } - - public static Intent createIntent(@NonNull Context context, @NonNull String login) { - return createIntent(context, login, false); - } - - public static Intent createIntent(@NonNull Context context, @NonNull String login, boolean isOrg) { - return createIntent(context, login, isOrg, false, -1); - } - - public static Intent createIntent(@NonNull Context context, @NonNull String login, boolean isOrg, - boolean isEnterprise, int index) { - Intent intent = new Intent(context, UserPagerActivity.class); - intent.putExtras(Bundler.start() - .put(BundleConstant.EXTRA, login) - .put(BundleConstant.IS_ENTERPRISE, isEnterprise) - .put(BundleConstant.EXTRA_TYPE, isOrg) - .put(BundleConstant.EXTRA_TWO, index) - .end()); - if (context instanceof Service || context instanceof Application) { - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - } - return intent; - } - - @Override protected int layout() { - return R.layout.tabbed_pager_layout; - } - - @Override protected boolean isTransparent() { - return true; - } - - @Override protected boolean canBack() { - return true; - } - - @Override protected boolean isSecured() { - return false; - } - - @NonNull @Override public UserPagerPresenter providePresenter() { - return new UserPagerPresenter(); - } - - @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - Login currentUser = Login.getUser(); - if (currentUser == null) { - onRequireLogin(); - return; - } - if (savedInstanceState == null) { - if (getIntent() != null && getIntent().getExtras() != null) { - login = getIntent().getExtras().getString(BundleConstant.EXTRA); - isOrg = getIntent().getExtras().getBoolean(BundleConstant.EXTRA_TYPE); - index = getIntent().getExtras().getInt(BundleConstant.EXTRA_TWO, -1); - if (!InputHelper.isEmpty(login)) { - if (isOrg) { - getPresenter().checkOrgMembership(login); - } else { - if (!Login.getUser().getLogin().equalsIgnoreCase(login)) getPresenter().onCheckBlocking(login); - } - } - } else { - Login user = Login.getUser(); - if (user == null) { - onRequireLogin(); - return; - } - login = user.getLogin(); - } - } - if (InputHelper.isEmpty(login)) { - finish(); - return; - } - setTaskName(login); - setTitle(login); - if (login.equalsIgnoreCase(currentUser.getLogin())) { - selectProfile(); - } - if (!isOrg) { - FragmentsPagerAdapter adapter = new FragmentsPagerAdapter(getSupportFragmentManager(), - FragmentPagerAdapterModel.buildForProfile(this, login)); - pager.setAdapter(adapter); - tabs.setTabGravity(TabLayout.GRAVITY_FILL); - tabs.setTabMode(TabLayout.MODE_SCROLLABLE); - tabs.setupWithViewPager(pager); - if (savedInstanceState == null) { - if (index != -1) { - pager.setCurrentItem(index); - } - } - } else { - if (getPresenter().getIsMember() == -1) { - getPresenter().checkOrgMembership(login); - } else { - onInitOrg(getPresenter().isMember == 1); - } - } - tabs.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(pager) { - @Override public void onTabReselected(TabLayout.Tab tab) { - super.onTabReselected(tab); - onScrollTop(tab.getPosition()); - } - }); - pager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { - @Override public void onPageSelected(int position) { - super.onPageSelected(position); - hideShowFab(position); - } - }); - if (!isOrg) { - if (savedInstanceState != null && !counts.isEmpty()) { - Stream.of(counts).forEach(this::updateCount); - } - } - hideShowFab(pager.getCurrentItem()); - } - - @Override public void onScrollTop(int index) { - if (pager == null || pager.getAdapter() == null) return; - Fragment fragment = (BaseFragment) pager.getAdapter().instantiateItem(pager, index); - if (fragment instanceof BaseFragment) { - ((BaseFragment) fragment).onScrollTop(index); - } - } - - @Override public void hideProgress() { - super.hideProgress(); - } - - @Override public void onNavigateToFollowers() { - pager.setCurrentItem(5); - } - - @Override public void onNavigateToFollowing() { - pager.setCurrentItem(6); - } - - @Override public void onInitOrg(boolean isMember) { - hideProgress(); - FragmentsPagerAdapter adapter = new FragmentsPagerAdapter(getSupportFragmentManager(), - FragmentPagerAdapterModel.buildForOrg(this, login, isMember)); - pager.setAdapter(adapter); - tabs.setTabGravity(TabLayout.GRAVITY_FILL); - tabs.setTabMode(TabLayout.MODE_SCROLLABLE); - tabs.setupWithViewPager(pager); - setTaskName(login); - } - - @Override public void onUserBlocked() { - showMessage(R.string.success, R.string.user_blocked); - onInvalidateMenu(); - } - - @Override public void onInvalidateMenu() { - hideProgress(); - supportInvalidateOptionsMenu(); - } - - @Override public void onUserUnBlocked() { - showMessage(R.string.success, R.string.user_unblocked); - onInvalidateMenu(); - } - - @Override public void onCheckType(boolean isOrg) { - if (!this.isOrg == isOrg) { - startActivity(this, login, isOrg, isEnterprise(), index); - finish(); - } - } - - @Override public void onSetBadge(int tabIndex, int count) { - TabsCountStateModel model = new TabsCountStateModel(); - model.setTabIndex(tabIndex); - model.setCount(count); - counts.add(model); - if (tabs != null) { - updateCount(model); - } - } - - @OnClick(R.id.fab) public void onRepoFilterClicked() { - if (isOrg) { - int position; - if (getPresenter().getIsMember() == 1) { - position = 2; - } else { - position = 1; - } - OrgReposFragment fragment = ((OrgReposFragment) pager.getAdapter().instantiateItem(pager, position)); - fragment.onRepoFilterClicked(); - } else { - ProfileReposFragment fragment = ((ProfileReposFragment) pager.getAdapter().instantiateItem(pager, 2)); - fragment.onRepoFilterClicked(); - } - } - - @Override public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.share_menu, menu); - return super.onCreateOptionsMenu(menu); - } - - @Override public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == R.id.share && !InputHelper.isEmpty(login)) { - ActivityHelper.shareUrl(this, new Uri.Builder().scheme("https") - .authority(LinkParserHelper.HOST_DEFAULT) - .appendPath(login) - .toString()); - return true; - } else if (item.getItemId() == R.id.block && !InputHelper.isEmpty(login)) { - getPresenter().onBlockUser(login); - } - return super.onOptionsItemSelected(item); - } - - @Override public boolean onPrepareOptionsMenu(Menu menu) { - Logger.e(getPresenter().isUserBlockedRequested(), getPresenter().isUserBlocked()); - if (getPresenter().isUserBlockedRequested()) { - Login login = Login.getUser(); - if (login != null && !isOrg) { - String username = login.getLogin(); - if (!username.equalsIgnoreCase(this.login)) { - menu.findItem(R.id.block) - .setIcon(getPresenter().isUserBlocked() ? R.drawable.ic_unlock : R.drawable.ic_lock) - .setTitle(getPresenter().isUserBlocked() ? getString(R.string.unblock) : getString(R.string.block)) - .setVisible(true); - } - } - } - return super.onPrepareOptionsMenu(menu); - } - - private void hideShowFab(int position) { - if (isOrg) { - if (getPresenter().getIsMember() == 1) { - if (position == 2) { - fab.show(); - } else { - fab.hide(); - } - } else { - if (position == 1) { - fab.show(); - } else { - fab.hide(); - } - } - } else { - if (position == 2) { - fab.show(); - } else { - fab.hide(); - } - } - } - - private void updateCount(@NonNull TabsCountStateModel model) { - TextView tv = ViewHelper.getTabTextView(tabs, model.getTabIndex()); - tv.setText(SpannableBuilder.builder() - .append(getString(R.string.starred)) - .append(" ") - .append("(") - .bold(String.valueOf(model.getCount())) - .append(")")); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/user/UserPagerMvp.java b/app/src/main/java/com/fastaccess/ui/modules/user/UserPagerMvp.java deleted file mode 100644 index c5f1cd169..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/user/UserPagerMvp.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.fastaccess.ui.modules.user; - -import androidx.annotation.NonNull; - -import com.fastaccess.ui.base.mvp.BaseMvp; -import com.fastaccess.ui.modules.profile.ProfilePagerMvp; -import com.fastaccess.ui.modules.repos.RepoPagerMvp; - -/** - * Created by Kosh on 04 Dec 2016, 1:11 PM - */ - -public interface UserPagerMvp { - - interface View extends BaseMvp.FAView, ProfilePagerMvp.View, RepoPagerMvp.TabsBadgeListener { - void onInitOrg(boolean isMember); - - void onUserBlocked(); - - void onInvalidateMenu(); - - void onUserUnBlocked(); - } - - interface Presenter extends BaseMvp.FAPresenter { - - void onCheckBlocking(@NonNull String login); - - void checkOrgMembership(@NonNull String org); - - void onBlockUser(@NonNull String login); - - void onUnblockUser(@NonNull String login); - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/user/UserPagerPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/user/UserPagerPresenter.java deleted file mode 100644 index 32db4e745..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/user/UserPagerPresenter.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.fastaccess.ui.modules.user; - -import androidx.annotation.NonNull; - -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import lombok.Getter; - -/** - * Created by Kosh on 03 Dec 2016, 8:00 AM - */ - -@Getter class UserPagerPresenter extends BasePresenter implements UserPagerMvp.Presenter { - @com.evernote.android.state.State int isMember = -1; - @com.evernote.android.state.State boolean isUserBlocked; - @com.evernote.android.state.State boolean isUserBlockedRequested; - - @Override public void onCheckBlocking(@NonNull String login) { - makeRestCall(RestProvider.getUserService(isEnterprise()).isUserBlocked(login), - booleanResponse -> sendToView(view -> { - isUserBlockedRequested = true; - isUserBlocked = booleanResponse.code() == 204; - view.onInvalidateMenu(); - })); - } - - @Override public void checkOrgMembership(@NonNull String org) { - makeRestCall(RestProvider.getOrgService(isEnterprise()).isMember(org, Login.getUser().getLogin()), - booleanResponse -> sendToView(view -> { - isMember = booleanResponse.code() == 204 ? 1 : 0; - view.onInitOrg(isMember == 1); - })); - } - - @Override public void onBlockUser(@NonNull String login) { - if (isUserBlocked()) { - onUnblockUser(login); - } else { - makeRestCall(RestProvider.getUserService(isEnterprise()).blockUser(login), - booleanResponse -> sendToView(view -> { - isUserBlocked = true; - view.onUserBlocked(); - })); - } - } - - @Override public void onUnblockUser(@NonNull String login) { - makeRestCall(RestProvider.getUserService(isEnterprise()).unBlockUser(login), - booleanResponse -> sendToView(view -> { - isUserBlocked = false; - view.onUserUnBlocked(); - })); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/AppbarRefreshLayout.java b/app/src/main/java/com/fastaccess/ui/widgets/AppbarRefreshLayout.java deleted file mode 100644 index 52e681d0d..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/AppbarRefreshLayout.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.content.Context; -import androidx.annotation.NonNull; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.util.AttributeSet; - -import com.fastaccess.R; - - -/** - * Created by kosh on 7/30/2015. CopyRights @ - */ -public class AppbarRefreshLayout extends SwipeRefreshLayout { - - public AppbarRefreshLayout(@NonNull Context context) { - super(context, null); - } - - public AppbarRefreshLayout(@NonNull Context context, AttributeSet attrs) { - super(context, attrs); - setColorSchemeResources(R.color.material_amber_700, R.color.material_blue_700, R.color.material_purple_700, R.color.material_lime_700); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/AutoLinearLayout.java b/app/src/main/java/com/fastaccess/ui/widgets/AutoLinearLayout.java deleted file mode 100644 index a9a2eba67..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/AutoLinearLayout.java +++ /dev/null @@ -1,495 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.content.Context; -import android.content.res.TypedArray; -import androidx.core.view.GravityCompat; -import android.util.AttributeSet; -import android.view.Gravity; -import android.view.View; -import android.widget.FrameLayout; - -import com.fastaccess.R; - -import java.util.ArrayList; - -public class AutoLinearLayout extends FrameLayout { - - private int mOrientation; - private int mGravity = Gravity.TOP | GravityCompat.START; - - private final static int HORIZONTAL = 0; - private final static int VERTICAL = 1; - - private ArrayList mListPositions = new ArrayList<>(); - - public AutoLinearLayout(Context context) { - super(context); - init(context, null, 0, 0); - } - - public AutoLinearLayout(Context context, AttributeSet attrs) { - super(context, attrs); - init(context, attrs, 0, 0); - } - - public AutoLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - init(context, attrs, defStyleAttr, 0); - } - - public AutoLinearLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - init(context, attrs, defStyleAttr, defStyleRes); - } - - @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - if (mOrientation == VERTICAL) { - measureVertical(widthMeasureSpec, heightMeasureSpec); - } else { - measureHorizontal(widthMeasureSpec, heightMeasureSpec); - } - } - - @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { - mListPositions.clear(); - if (mOrientation == VERTICAL) - layoutVertical(left, top, right, bottom); - else - layoutHorizontal(left, top, right, bottom); - } - - private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AutoLinearLayout, defStyleAttr, defStyleRes); - try { - mOrientation = a.getInt(R.styleable.AutoLinearLayout_auto_orientation, HORIZONTAL); - int gravity = a.getInt(R.styleable.AutoLinearLayout_auto_gravity, -1); - if (gravity >= 0) { - setGravity(gravity); - } - } finally { - a.recycle(); - } - } - - private void measureHorizontal(int widthMeasureSpec, int heightMeasureSpec) { - int wSize = MeasureSpec.getSize(widthMeasureSpec) - (getPaddingLeft() + getPaddingRight()); - - //Scrollview case - if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED) - wSize = Integer.MAX_VALUE; - - int count = getChildCount(); - int rowWidth = 0; - int totalHeight = 0; - int rowMaxHeight = 0; - int childWidth; - int childHeight; - int maxRowWidth = getPaddingLeft() + getPaddingRight(); - - for (int i = 0; i < count; i++) { - final View child = getChildAt(i); - if (child.getVisibility() != GONE) { - measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0); - final LayoutParams lp = (LayoutParams) child.getLayoutParams(); - childWidth = child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin; - childHeight = child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin; - //keep max height value stored - rowMaxHeight = Math.max(rowMaxHeight, childHeight); - - //exceed max width start new row and update total height - if (childWidth + rowWidth > wSize) { - totalHeight += rowMaxHeight; - maxRowWidth = Math.max(maxRowWidth, rowWidth); - rowWidth = childWidth; - rowMaxHeight = childHeight; - } else { - rowWidth += childWidth; - } - } - } - //plus last child height and width - if (rowWidth != 0) { - maxRowWidth = Math.max(maxRowWidth, rowWidth); - totalHeight += rowMaxHeight; - } - - //set width to max value - if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED) - wSize = maxRowWidth + (getPaddingLeft() + getPaddingRight()); - - setMeasuredDimension(resolveSize(wSize, widthMeasureSpec), - resolveSize(totalHeight + getPaddingTop() + getPaddingBottom(), heightMeasureSpec)); - } - - private void measureVertical(int widthMeasureSpec, int heightMeasureSpec) { - int hSize = MeasureSpec.getSize(heightMeasureSpec) - (getPaddingTop() + getPaddingBottom()); - - int count = getChildCount(); - int columnHeight = 0; - int totalWidth = 0, maxColumnHeight = 0; - int columnMaxWidth = 0; - int childWidth; - int childHeight; - - //Scrollview case - if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.UNSPECIFIED) - hSize = Integer.MAX_VALUE; - - for (int i = 0; i < count; i++) { - final View child = getChildAt(i); - if (child.getVisibility() != GONE) { - measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0); - final LayoutParams lp = (LayoutParams) child.getLayoutParams(); - childWidth = child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin; - childHeight = child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin; - //keep max width value stored - columnMaxWidth = Math.max(columnMaxWidth, childWidth); - - //exceed max height start new column and update total width - if (childHeight + columnHeight > hSize) { - totalWidth += columnMaxWidth; - maxColumnHeight = Math.max(maxColumnHeight, columnHeight); - columnHeight = childHeight; - columnMaxWidth = childWidth; - } else { - columnHeight += childHeight; - } - } - } - //plus last child width - if (columnHeight != 0) { - maxColumnHeight = Math.max(maxColumnHeight, columnHeight); - totalWidth += columnMaxWidth; - } - - //set height to max value - if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.UNSPECIFIED) - hSize = maxColumnHeight + (getPaddingTop() + getPaddingBottom()); - - setMeasuredDimension(resolveSize(totalWidth + getPaddingRight() + getPaddingLeft(), - widthMeasureSpec), resolveSize(hSize, heightMeasureSpec)); - } - - /** - * Arranges the children in columns. Takes care about child margin, padding, gravity and - * child layout gravity. - * - * @param left - * parent left - * @param top - * parent top - * @param right - * parent right - * @param bottom - * parent bottom - */ - private void layoutVertical(int left, int top, int right, int bottom) { - final int count = getChildCount(); - if (count == 0) - return; - - final int width = right - getPaddingLeft() - left - getPaddingRight(); - final int height = bottom - getPaddingTop() - top - getPaddingBottom(); - - int childTop = getPaddingTop(); - int childLeft = getPaddingLeft(); - - int totalHorizontal = getPaddingLeft() + getPaddingRight(); - int totalVertical = 0; - int column = 0; - int maxChildWidth = 0; - for (int i = 0; i < count; i++) { - final View child = getChildAt(i); - if (child != null && child.getVisibility() != View.GONE) { - //if child is not updated yet call measure - if (child.getMeasuredHeight() == 0 || child.getMeasuredWidth() == 0) - child.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), - MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST)); - - LayoutParams lp = (LayoutParams) child.getLayoutParams(); - final int childWidth = child.getMeasuredWidth(); - final int childHeight = child.getMeasuredHeight(); - //if there is not enough space jump to another column - if (childTop + childHeight + lp.topMargin + lp.bottomMargin > height + getPaddingTop()) { - //before change column update positions if the gravity is present - updateChildPositionVertical(height, totalVertical, column, maxChildWidth); - childTop = getPaddingTop(); - childLeft += maxChildWidth; - maxChildWidth = 0; - column++; - totalVertical = 0; - } - - childTop += lp.topMargin; - mListPositions.add(new ViewPosition(childLeft, childTop, column)); - //check max child width - int currentWidth = childWidth + lp.leftMargin + lp.rightMargin; - if (maxChildWidth < currentWidth) - maxChildWidth = currentWidth; - //get ready for next child - childTop += childHeight + lp.bottomMargin; - totalVertical += childHeight + lp.topMargin + lp.bottomMargin; - } - } - - //update positions for last column - updateChildPositionVertical(height, totalVertical, column, maxChildWidth); - totalHorizontal += childLeft + maxChildWidth; - //final update for horizontal gravities and layout views - updateChildPositionHorizontal(width, totalHorizontal, column, 0); - //mListPositions.clear(); - } - - /** - * Arranges the children in rows. Takes care about child margin, padding, gravity and - * child layout gravity. Analog to vertical. - * - * @param left - * parent left - * @param top - * parent top - * @param right - * parent right - * @param bottom - * parent bottom - */ - private void layoutHorizontal(int left, int top, int right, int bottom) { - final int count = getChildCount(); - if (count == 0) - return; - - final int width = right - getPaddingLeft() - left - getPaddingRight(); - final int height = bottom - getPaddingTop() - top - getPaddingBottom(); - - int childTop = getPaddingTop(); - int childLeft = getPaddingLeft(); - - int totalHorizontal = 0; - int totalVertical = getPaddingTop() + getPaddingBottom(); - int row = 0; - int maxChildHeight = 0; - for (int i = 0; i < count; i++) { - final View child = getChildAt(i); - - if (child != null && child.getVisibility() != View.GONE) { - if (child.getMeasuredHeight() == 0 || child.getMeasuredWidth() == 0) - child.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), - MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST)); - - LayoutParams lp = (LayoutParams) child.getLayoutParams(); - final int childWidth = child.getMeasuredWidth(); - final int childHeight = child.getMeasuredHeight(); - - if (childLeft + childWidth + lp.leftMargin + lp.rightMargin > width + getPaddingLeft()) { - updateChildPositionHorizontal(width, totalHorizontal, row, maxChildHeight); - childLeft = getPaddingLeft(); - childTop += maxChildHeight; - maxChildHeight = 0; - row++; - totalHorizontal = 0; - } - - childLeft += lp.leftMargin; - mListPositions.add(new ViewPosition(childLeft, childTop, row)); - - int currentHeight = childHeight + lp.topMargin + lp.bottomMargin; - if (maxChildHeight < currentHeight) - maxChildHeight = currentHeight; - - childLeft += childWidth + lp.rightMargin; - totalHorizontal += childWidth + lp.rightMargin + lp.leftMargin; - } - } - - updateChildPositionHorizontal(width, totalHorizontal, row, maxChildHeight); - totalVertical += childTop + maxChildHeight; - updateChildPositionVertical(height, totalVertical, row, 0); - //mListPositions.clear(); - } - - /** - * Updates children positions. Takes cares about gravity and layout gravity. - * Finally layout children to parent if needed. - * - * @param parentHeight - * parent parentHeight - * @param totalSize - * total vertical size used by children in a column - * @param column - * column number - * @param maxChildWidth - * the biggest child width - */ - private void updateChildPositionVertical(int parentHeight, int totalSize, int column, int maxChildWidth) { - for (int i = 0; i < mListPositions.size(); i++) { - ViewPosition pos = mListPositions.get(i); - final View child = getChildAt(i); - //(android:gravity) - //update children position inside parent layout - if (mOrientation == HORIZONTAL || pos.position == column) { - updateTopPositionByGravity(pos, parentHeight - totalSize, mGravity); - } - //(android:layout_gravity) - //update children position inside their space - if (mOrientation == VERTICAL && pos.position == column) { - LayoutParams lp = (LayoutParams) child.getLayoutParams(); - int size = maxChildWidth - child.getMeasuredWidth() - lp.leftMargin - lp.rightMargin; - updateLeftPositionByGravity(pos, size, lp.gravity); - } - //update children into layout parent - if (mOrientation == HORIZONTAL) - layout(child, pos); - } - } - - /** - * Updates children positions. Takes cares about gravity and layout gravity. - * Finally layout children to parent if needed. Analog to vertical. - * - * @param parentWidth - * parent parentWidth - * @param totalSize - * total horizontal size used by children in a row - * @param row - * row number - * @param maxChildHeight - * the biggest child height - */ - private void updateChildPositionHorizontal(int parentWidth, int totalSize, int row, int maxChildHeight) { - for (int i = 0; i < mListPositions.size(); i++) { - ViewPosition pos = mListPositions.get(i); - final View child = getChildAt(i); - - if (mOrientation == VERTICAL || pos.position == row) { - updateLeftPositionByGravity(pos, parentWidth - totalSize, mGravity); - } - - if (mOrientation == HORIZONTAL && pos.position == row) { - LayoutParams lp = (LayoutParams) child.getLayoutParams(); - int size = maxChildHeight - child.getMeasuredHeight() - lp.topMargin - lp.bottomMargin; - updateTopPositionByGravity(pos, size, lp.gravity); - } - - if (mOrientation == VERTICAL) - layout(child, pos); - } - } - - private void updateLeftPositionByGravity(ViewPosition pos, int size, int gravity) { - switch (gravity & Gravity.HORIZONTAL_GRAVITY_MASK) { - case GravityCompat.END: - pos.left += (size > 0) ? size : 0; - break; - - case Gravity.CENTER_HORIZONTAL: - pos.left += ((size > 0) ? size : 0) / 2; - break; - } - } - - private void updateTopPositionByGravity(ViewPosition pos, int size, int gravity) { - switch (gravity & Gravity.VERTICAL_GRAVITY_MASK) { - case Gravity.BOTTOM: - pos.top += (size > 0) ? size : 0; - break; - - case Gravity.CENTER_VERTICAL: - pos.top += ((size > 0) ? size : 0) / 2; - break; - } - } - - private void layout(View child, ViewPosition pos) { - LayoutParams lp = (LayoutParams) child.getLayoutParams(); - - if (mOrientation == HORIZONTAL) - child.layout(pos.left, pos.top + lp.topMargin, pos.left + child.getMeasuredWidth(), pos.top + - child.getMeasuredHeight() + lp.topMargin); - else - child.layout(pos.left + lp.leftMargin, pos.top, pos.left + child.getMeasuredWidth() + - lp.leftMargin, pos.top + child.getMeasuredHeight()); - } - - /** - * Describes how the child views are positioned. Defaults to GRAVITY_TOP. If - * this layout has a VERTICAL orientation, this controls where all the child - * views are placed if there is extra vertical space. If this layout has a - * HORIZONTAL orientation, this controls the alignment of the children. - * - * @param gravity - * See {@link Gravity} - */ - private void setGravity(int gravity) { - if (mGravity != gravity) { - if ((gravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) { - gravity |= GravityCompat.START; - } - - if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) { - gravity |= Gravity.TOP; - } - - mGravity = gravity; - requestLayout(); - } - } - - public void setHorizontalGravity(int horizontalGravity) { - final int gravity = horizontalGravity & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK; - if ((mGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) != gravity) { - mGravity = (mGravity & ~GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK) | gravity; - requestLayout(); - } - } - - public void setVerticalGravity(int verticalGravity) { - final int gravity = verticalGravity & Gravity.VERTICAL_GRAVITY_MASK; - if ((mGravity & Gravity.VERTICAL_GRAVITY_MASK) != gravity) { - mGravity = (mGravity & ~Gravity.VERTICAL_GRAVITY_MASK) | gravity; - requestLayout(); - } - } - - /** - * Should the layout be a column or a row. - * - * @param orientation - * Pass HORIZONTAL or VERTICAL. Default value is HORIZONTAL. - */ - public void setOrientation(int orientation) { - if (mOrientation != orientation) { - mOrientation = orientation; - requestLayout(); - } - } - - /** - * Returns the current orientation. - * - * @return either {@link #HORIZONTAL} or {@link #VERTICAL} - */ - public int getOrientation() { - return mOrientation; - } - - /** - * Helper inner class that stores child position - */ - private static class ViewPosition { - int left; - int top; - int position; //row or column - - ViewPosition(int l, int t, int p) { - this.left = l; - this.top = t; - this.position = p; - } - - @Override - public String toString() { - return "left-" + left + " top" + top + " pos" + position; - } - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/AvatarLayout.java b/app/src/main/java/com/fastaccess/ui/widgets/AvatarLayout.java deleted file mode 100644 index 702469fb2..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/AvatarLayout.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.content.Context; - -import androidx.annotation.AttrRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StyleRes; -import androidx.core.content.ContextCompat; -import androidx.appcompat.widget.TooltipCompat; - -import android.util.AttributeSet; -import android.view.View; -import android.widget.FrameLayout; - -import com.bumptech.glide.Glide; -import com.bumptech.glide.load.engine.DiskCacheStrategy; -import com.bumptech.glide.signature.ObjectKey; -import com.fastaccess.R; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.ui.modules.user.UserPagerActivity; - -import butterknife.BindView; -import butterknife.ButterKnife; -import butterknife.OnClick; -import cn.gavinliu.android.lib.shapedimageview.ShapedImageView; - -/** - * Created by Kosh on 14 Nov 2016, 7:59 PM - */ - -public class AvatarLayout extends FrameLayout { - - @BindView(R.id.avatar) ShapedImageView avatar; - @Nullable private String login; - private boolean isOrg; - private boolean isEnterprise; - - @OnClick(R.id.avatar) void onClick(@NonNull View view) { - if (InputHelper.isEmpty(login)) return; - UserPagerActivity.startActivity(view.getContext(), login, isOrg, isEnterprise, -1); - } - - public AvatarLayout(@NonNull Context context) { - super(context); - } - - public AvatarLayout(@NonNull Context context, @Nullable AttributeSet attrs) { - super(context, attrs); - } - - public AvatarLayout(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - public AvatarLayout(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - } - - @Override protected void onAttachedToWindow() { - super.onAttachedToWindow(); - } - - @Override protected void onFinishInflate() { - super.onFinishInflate(); - inflate(getContext(), R.layout.avatar_layout, this); - if (isInEditMode()) return; - ButterKnife.bind(this); - setBackground(); - if (PrefGetter.isRectAvatar()) { - avatar.setShape(ShapedImageView.SHAPE_MODE_ROUND_RECT, 15); - } - } - - public void setUrl(@Nullable String url, @Nullable String login, boolean isOrg, boolean isEnterprise) { - setUrl(url, login, isOrg, isEnterprise, false); - } - - public void setUrl(@Nullable String url, @Nullable String login, boolean isOrg, boolean isEnterprise, boolean reload) { - this.login = login; - this.isOrg = isOrg; - this.isEnterprise = isEnterprise; - avatar.setContentDescription(login); - if (login != null) { - TooltipCompat.setTooltipText(avatar, login); - } else { - avatar.setOnClickListener(null); - avatar.setOnLongClickListener(null); - } - Glide.with(getContext()) - .load(url) - .fallback(ContextCompat.getDrawable(getContext(), R.drawable.ic_fasthub_mascot)) - .diskCacheStrategy(DiskCacheStrategy.ALL) - .signature(new ObjectKey(reload ? String.valueOf(System.currentTimeMillis()) : "0")) - .dontAnimate() - .into(avatar); - } - - private void setBackground() { - if (PrefGetter.isRectAvatar()) { - setBackgroundResource(R.drawable.rect_shape); - } else { - setBackgroundResource(R.drawable.circle_shape); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/CardsPagerTransformerBasic.kt b/app/src/main/java/com/fastaccess/ui/widgets/CardsPagerTransformerBasic.kt deleted file mode 100644 index 7e2a073f1..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/CardsPagerTransformerBasic.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.fastaccess.ui.widgets - -import androidx.viewpager.widget.ViewPager -import android.view.View - -class CardsPagerTransformerBasic(private val baseElevation: Int, private val raisingElevation: Int) : ViewPager.PageTransformer { - override fun transformPage(page: View, position: Float) { - val absPosition = Math.abs(position) - if (absPosition >= 1) { - page.elevation = baseElevation.toFloat() - } else { - page.elevation = (1 - absPosition) * raisingElevation + baseElevation - } - } - - -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/widgets/ColorPickerPreference.java b/app/src/main/java/com/fastaccess/ui/widgets/ColorPickerPreference.java deleted file mode 100644 index bd3c919a6..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/ColorPickerPreference.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.PorterDuff; -import androidx.preference.Preference; -import androidx.preference.PreferenceViewHolder; -import android.util.AttributeSet; -import android.util.TypedValue; -import android.widget.Button; -import android.widget.TextView; - -import com.fastaccess.R; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.helper.ViewHelper; - -import java.util.ArrayList; -import java.util.HashMap; - -import petrov.kristiyan.colorpicker.ColorPicker; - -/** - * Created by Hamad on 6/11/17. - */ - -public class ColorPickerPreference extends Preference implements ColorPicker.OnChooseColorListener { - - public ColorPickerPreference(Context context) { - super(context); - init(); - } - - public ColorPickerPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - init(); - } - - public ColorPickerPreference(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - init(); - } - - public ColorPickerPreference(Context context, AttributeSet attrs) { - super(context, attrs); - init(); - } - - private void init() { - setWidgetLayoutResource(R.layout.preference_widget_color); - } - - @Override - protected void onClick() { - super.onClick(); - - int selected_color = getSelectedColor(); - String title = String.format("Accent Color: (Currently: %s)", getSelectedColorName()); - ColorPicker colorPicker = new ColorPicker(getContext()); - colorPicker.setRoundColorButton(true); - colorPicker.setColors(R.array.theme_colors_hex); - colorPicker.setDefaultColorButton(selected_color); - colorPicker.setTitle(title); - TextView title_tv = colorPicker.getDialogViewLayout().findViewById(R.id.title); - title_tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14); - colorPicker.getPositiveButton().setTextColor(ViewHelper.getPrimaryTextColor(getContext())); - colorPicker.getNegativeButton().setTextColor(ViewHelper.getPrimaryTextColor(getContext())); - colorPicker.setOnChooseColorListener(this); - colorPicker.show(); - } - - @Override - public void onBindViewHolder(PreferenceViewHolder holder) { - super.onBindViewHolder(holder); - final Button colorButton = (Button) holder.findViewById(R.id.color); - colorButton.setBackgroundResource(R.drawable.circle_shape); - colorButton.getBackground().setColorFilter(getSelectedColor(), PorterDuff.Mode.SRC_IN); - } - - private int getSelectedColor() { - TypedArray colorTypedArray = getContext().getResources().obtainTypedArray(R.array.theme_colors_hex); - String[] colorNames = getContext().getResources().getStringArray(R.array.theme_colors); - - ArrayList colors = new ArrayList<>(); - for (int i = 0; i < colorTypedArray.length(); i++) { - colors.add(colorTypedArray.getColor(i, 0)); - } - colorTypedArray.recycle(); - HashMap preferenceValueToColor = new HashMap<>(); - - for(int i=0; i 0) { - int lines = split.length; - int index = -1; - for (int i = 0; i < lines; i++) { - if (truncate && (lines - i) > 2) continue; - String token = split[i]; - if (i < (lines - 1)) { - token = token.concat("\n"); - } - char firstChar = token.charAt(0); - int color = Color.TRANSPARENT; - if (token.startsWith("@@")) { - color = patchRefColor; - } else if (firstChar == '+') { - color = patchAdditionColor; - } else if (firstChar == '-') { - color = patchDeletionColor; - } - index = token.indexOf("\\ No newline at end of file"); - if (index != -1) { - token = token.replace("\\ No newline at end of file", ""); - } - SpannableString spannableDiff = new SpannableString(token); - if (color != Color.TRANSPARENT) { - DiffLineSpan span = new DiffLineSpan(color); - spannableDiff.setSpan(span, 0, token.length(), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE); - } - builder.append(spannableDiff); - } - if (index != -1) { - builder.insert(builder.length() - 1, - SpannableBuilder.builder().append(ContextCompat.getDrawable(App.getInstance(), R.drawable.ic_newline))); - } - } - } - builder.setSpan(new TypefaceSpan("monospace"), 0, builder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - return builder; - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/FloatingActionButtonBehavior.java b/app/src/main/java/com/fastaccess/ui/widgets/FloatingActionButtonBehavior.java deleted file mode 100644 index 2b81f3d7d..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/FloatingActionButtonBehavior.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.content.Context; -import androidx.annotation.NonNull; -import androidx.coordinatorlayout.widget.CoordinatorLayout; -import com.google.android.material.floatingactionbutton.FloatingActionButton; -import com.google.android.material.snackbar.Snackbar; -import android.util.AttributeSet; -import android.view.View; -import android.view.ViewGroup; - -import java.util.List; - -import it.sephiroth.android.library.bottomnavigation.BottomNavigation; - -import static android.util.Log.INFO; -import static it.sephiroth.android.library.bottomnavigation.MiscUtils.log; - -@SuppressWarnings("unused") -public class FloatingActionButtonBehavior extends CoordinatorLayout.Behavior { - private static final String TAG = FloatingActionButtonBehavior.class.getSimpleName(); - private int navigationBarHeight = 0; - - public FloatingActionButtonBehavior() { - super(); - } - - public FloatingActionButtonBehavior(Context context, AttributeSet attrs) { - super(context, attrs); - } - - @Override public void onAttachedToLayoutParams(@NonNull final CoordinatorLayout.LayoutParams lp) { - // super.onAttachedToLayoutParams(lp); - } - - @Override public boolean layoutDependsOn(final CoordinatorLayout parent, final FloatingActionButton child, final View dependency) { - if (BottomNavigation.class.isInstance(dependency)) { - return true; - } else if (Snackbar.SnackbarLayout.class.isInstance(dependency)) { - return true; - } - return super.layoutDependsOn(parent, child, dependency); - } - - @Override public boolean onDependentViewChanged(@NonNull - final CoordinatorLayout parent, @NonNull - final FloatingActionButton child, final View dependency) { - log(TAG, INFO, "onDependentViewChanged: " + dependency); - final List list = parent.getDependencies(child); - ViewGroup.MarginLayoutParams params = ((ViewGroup.MarginLayoutParams) child.getLayoutParams()); - int bottomMargin = (params.bottomMargin + params.rightMargin) - (params.topMargin + params.leftMargin); - float t = 0; - float t2 = 0; - float t3 = 0; - boolean result = false; - for (View dep : list) { - if (Snackbar.SnackbarLayout.class.isInstance(dep)) { - t += dep.getTranslationY() - dep.getHeight(); - result = true; - } else if (BottomNavigation.class.isInstance(dep)) { - BottomNavigation navigation = (BottomNavigation) dep; - t2 = navigation.getTranslationY() - navigation.getHeight() + bottomMargin; - t += t2; - result = true; - - if (navigationBarHeight > 0) { - if (!navigation.isExpanded()) { - child.hide(); - } else { - child.show(); - } - } - } - } - - if (navigationBarHeight > 0 && t2 < 0) { - t = Math.min(t2, t + navigationBarHeight); - } - - child.setTranslationY(t); - return result; - } - - @Override public void onDependentViewRemoved(final CoordinatorLayout parent, final FloatingActionButton child, final View dependency) { - super.onDependentViewRemoved(parent, child, dependency); - } - - public void setNavigationBarHeight(final int height) { - this.navigationBarHeight = height; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/widgets/FontAutoCompleteEditText.java b/app/src/main/java/com/fastaccess/ui/widgets/FontAutoCompleteEditText.java deleted file mode 100644 index e499cf2ad..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/FontAutoCompleteEditText.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.content.Context; -import androidx.annotation.NonNull; -import androidx.appcompat.widget.AppCompatAutoCompleteTextView; -import android.util.AttributeSet; -import android.view.inputmethod.EditorInfo; - -import com.fastaccess.helper.TypeFaceHelper; - -/** - * Created by Kosh on 8/18/2015. copyrights are reserved - */ -public class FontAutoCompleteEditText extends AppCompatAutoCompleteTextView { - - public FontAutoCompleteEditText(@NonNull Context context) { - super(context); - init(); - } - - public FontAutoCompleteEditText(@NonNull Context context, AttributeSet attrs) { - super(context, attrs); - init(); - - } - - public FontAutoCompleteEditText(@NonNull Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - init(); - } - - private void init() { - if (isInEditMode()) return; - if (isInEditMode()) return; - setInputType(getInputType() | EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_FLAG_NO_FULLSCREEN); - setImeOptions(getImeOptions() | EditorInfo.IME_FLAG_NO_FULLSCREEN); - TypeFaceHelper.applyTypeface(this); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/FontButton.java b/app/src/main/java/com/fastaccess/ui/widgets/FontButton.java deleted file mode 100644 index 7ec788276..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/FontButton.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.content.Context; -import androidx.annotation.NonNull; -import androidx.appcompat.widget.AppCompatButton; -import android.util.AttributeSet; - -import com.fastaccess.helper.TypeFaceHelper; - - -/** - * Created by Kosh on 8/18/2015. copyrights are reserved - */ -public class FontButton extends AppCompatButton { - - public FontButton(@NonNull Context context) { - super(context); - init(); - } - - public FontButton(@NonNull Context context, AttributeSet attrs) { - super(context, attrs); - init(); - } - - public FontButton(@NonNull Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - init(); - } - - private void init() { - if (isInEditMode()) return; - TypeFaceHelper.applyTypeface(this); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/widgets/FontCheckbox.java b/app/src/main/java/com/fastaccess/ui/widgets/FontCheckbox.java deleted file mode 100644 index b0730a73b..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/FontCheckbox.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.content.Context; -import androidx.annotation.NonNull; -import androidx.appcompat.widget.AppCompatCheckBox; -import android.util.AttributeSet; - -import com.fastaccess.helper.TypeFaceHelper; - - -/** - * Created by Kosh on 8/18/2015. copyrights are reserved - */ -public class FontCheckbox extends AppCompatCheckBox { - - public FontCheckbox(@NonNull Context context) { - super(context); - init(); - } - - public FontCheckbox(@NonNull Context context, AttributeSet attrs) { - super(context, attrs); - init(); - } - - public FontCheckbox(@NonNull Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - init(); - } - - private void init() { - if (isInEditMode()) return; - TypeFaceHelper.applyTypeface(this); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/FontEditText.java b/app/src/main/java/com/fastaccess/ui/widgets/FontEditText.java deleted file mode 100644 index 03e4a0aaf..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/FontEditText.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.annotation.SuppressLint; -import android.content.Context; -import androidx.annotation.NonNull; -import androidx.appcompat.widget.AppCompatEditText; -import android.util.AttributeSet; -import android.view.inputmethod.EditorInfo; - -import com.crashlytics.android.Crashlytics; -import com.fastaccess.helper.TypeFaceHelper; - -/** - * Created by Kosh on 8/18/2015. copyrights are reserved - */ -public class FontEditText extends AppCompatEditText { - - public FontEditText(@NonNull Context context) { - super(context); - init(); - } - - public FontEditText(@NonNull Context context, AttributeSet attrs) { - super(context, attrs); - init(); - - } - - public FontEditText(@NonNull Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - init(); - } - - private void init() { - if (isInEditMode()) return; - setInputType(getInputType() | EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_FLAG_NO_FULLSCREEN); - setImeOptions(getImeOptions() | EditorInfo.IME_FLAG_NO_FULLSCREEN); - TypeFaceHelper.applyTypeface(this); - } - - @SuppressLint("SetTextI18n") public void setText(CharSequence text, BufferType type) { - try { - super.setText(text, type); - } catch (Exception e) { - setText("I tried, but your OEM just sucks because they modify the framework components and therefore causing the app to crash!" + ".\nFastHub"); - Crashlytics.logException(e); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/FontRadioButton.java b/app/src/main/java/com/fastaccess/ui/widgets/FontRadioButton.java deleted file mode 100644 index d40221d6c..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/FontRadioButton.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.content.Context; -import androidx.annotation.NonNull; -import androidx.appcompat.widget.AppCompatRadioButton; -import android.util.AttributeSet; - -import com.fastaccess.helper.TypeFaceHelper; - - -/** - * Created by Kosh on 8/18/2015. copyrights are reserved - */ -public class FontRadioButton extends AppCompatRadioButton { - - public FontRadioButton(@NonNull Context context) { - super(context); - init(); - } - - public FontRadioButton(@NonNull Context context, AttributeSet attrs) { - super(context, attrs); - init(); - } - - public FontRadioButton(@NonNull Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - init(); - } - - private void init() { - if (isInEditMode()) return; - TypeFaceHelper.applyTypeface(this); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/FontSwitchView.java b/app/src/main/java/com/fastaccess/ui/widgets/FontSwitchView.java deleted file mode 100644 index d67263743..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/FontSwitchView.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.content.Context; -import androidx.annotation.NonNull; -import androidx.appcompat.widget.SwitchCompat; -import android.util.AttributeSet; - -import com.fastaccess.helper.TypeFaceHelper; - - -/** - * Created by Kosh on 8/18/2015. copyrights are reserved - */ -public class FontSwitchView extends SwitchCompat { - - public FontSwitchView(@NonNull Context context) { - super(context); - init(); - } - - public FontSwitchView(@NonNull Context context, AttributeSet attrs) { - super(context, attrs); - init(); - - } - - public FontSwitchView(@NonNull Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - init(); - } - - private void init() { - if (isInEditMode()) return; - TypeFaceHelper.applyTypeface(this); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/FontTextView.java b/app/src/main/java/com/fastaccess/ui/widgets/FontTextView.java deleted file mode 100644 index fd52772db..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/FontTextView.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.drawable.Drawable; -import android.graphics.drawable.ScaleDrawable; -import android.os.Parcelable; - -import androidx.annotation.ColorInt; -import androidx.annotation.DrawableRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.core.content.ContextCompat; -import androidx.appcompat.widget.AppCompatTextView; - -import android.util.AttributeSet; -import android.view.Gravity; - -import com.crashlytics.android.Crashlytics; -import com.evernote.android.state.State; -import com.evernote.android.state.StateSaver; -import com.fastaccess.R; -import com.fastaccess.helper.TypeFaceHelper; -import com.fastaccess.helper.ViewHelper; - - -/** - * Created by Kosh on 8/18/2015. copyrights are reserved - */ -public class FontTextView extends AppCompatTextView { - - @State int tintColor = -1; - @State boolean selected; - - public FontTextView(@NonNull Context context) { - this(context, null); - } - - public FontTextView(@NonNull Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public FontTextView(@NonNull Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - init(context, attrs); - } - - @Override public Parcelable onSaveInstanceState() { - return StateSaver.saveInstanceState(this, super.onSaveInstanceState()); - } - - @Override public void onRestoreInstanceState(Parcelable state) { - super.onRestoreInstanceState(StateSaver.restoreInstanceState(this, state)); - tintDrawables(tintColor); - setSelected(selected); - } - - @Override public void setSelected(boolean selected) { - super.setSelected(selected); - this.selected = selected; - } - - @Override public void setTextCursorDrawable(@Nullable Drawable textCursorDrawable) { - try { - super.setTextCursorDrawable(textCursorDrawable); - } catch (Exception e) { - Crashlytics.logException(e); - } - } - - @Override public void setTextCursorDrawable(int textCursorDrawable) { - try { - super.setTextCursorDrawable(textCursorDrawable); - } catch (Exception e) { - Crashlytics.logException(e); - } - } - - private void init(@NonNull Context context, @Nullable AttributeSet attributeSet) { - if (attributeSet != null) { - TypedArray tp = context.obtainStyledAttributes(attributeSet, R.styleable.FontTextView); - try { - int color = tp.getColor(R.styleable.FontTextView_drawableColor, -1); - tintDrawables(color); - } finally { - tp.recycle(); - } - } - if (isInEditMode()) return; - setFreezesText(true); - TypeFaceHelper.applyTypeface(this); - } - - public void tintDrawables(@ColorInt int color) { - if (color != -1) { - this.tintColor = color; - Drawable[] drawables = getCompoundDrawablesRelative(); - for (Drawable drawable : drawables) { - if (drawable == null) continue; - ViewHelper.tintDrawable(drawable, color); - } - } - } - - public void setEventsIcon(@DrawableRes int drawableRes) { - Drawable drawable = ContextCompat.getDrawable(getContext(), drawableRes); - int width = drawable.getIntrinsicWidth(); - int height = drawable.getIntrinsicHeight(); - drawable.setBounds(0, 0, width / 2, height / 2); - ScaleDrawable sd = new ScaleDrawable(drawable, Gravity.CENTER, 0.6f, 0.6f); - sd.setLevel(8000); - ViewHelper.tintDrawable(drawable, ViewHelper.getTertiaryTextColor(getContext())); - setCompoundDrawablesWithIntrinsicBounds(sd, null, null, null); - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/ForegroundImageView.java b/app/src/main/java/com/fastaccess/ui/widgets/ForegroundImageView.java deleted file mode 100644 index e8a1b078e..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/ForegroundImageView.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.content.Context; -import androidx.annotation.ColorInt; -import androidx.annotation.NonNull; -import androidx.appcompat.widget.AppCompatImageView; -import androidx.appcompat.widget.TooltipCompat; -import android.util.AttributeSet; - -import com.fastaccess.helper.ViewHelper; - -public class ForegroundImageView extends AppCompatImageView { - - public ForegroundImageView(@NonNull Context context) { - this(context, null); - } - - public ForegroundImageView(@NonNull Context context, AttributeSet attrs) { - this(context, attrs, 0); - if (getContentDescription() != null) { - TooltipCompat.setTooltipText(this, getContentDescription()); - } - } - - public ForegroundImageView(@NonNull Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - public void tintDrawableColor(@ColorInt int color) { - ViewHelper.tintDrawable(getDrawable(), color); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/widgets/ForegroundRelativeLayout.java b/app/src/main/java/com/fastaccess/ui/widgets/ForegroundRelativeLayout.java deleted file mode 100644 index 4b8ac853f..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/ForegroundRelativeLayout.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.Canvas; -import android.graphics.drawable.Drawable; -import androidx.annotation.NonNull; -import android.util.AttributeSet; -import android.view.ViewOutlineProvider; -import android.widget.RelativeLayout; - -import com.fastaccess.R; - -/** - * An extension to {@link RelativeLayout} which has a foreground drawable. - */ -public class ForegroundRelativeLayout extends RelativeLayout { - - private Drawable foreground; - - @SuppressLint("CustomViewStyleable") - public ForegroundRelativeLayout(@NonNull Context context, AttributeSet attrs) { - super(context, attrs); - TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ForegroundView); - final Drawable d = a.getDrawable(R.styleable.ForegroundView_android_foreground); - if (d != null) { - setForeground(d); - } - a.recycle(); - setOutlineProvider(ViewOutlineProvider.BOUNDS); - } - - @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { - super.onSizeChanged(w, h, oldw, oldh); - if (foreground != null) { - foreground.setBounds(0, 0, w, h); - } - } - - @Override public boolean hasOverlappingRendering() { - return false; - } - - @Override protected boolean verifyDrawable(@NonNull Drawable who) { - return super.verifyDrawable(who) || (who == foreground); - } - - @Override public void jumpDrawablesToCurrentState() { - super.jumpDrawablesToCurrentState(); - if (foreground != null) foreground.jumpToCurrentState(); - } - - @Override protected void drawableStateChanged() { - if (isInEditMode()) return; - super.drawableStateChanged(); - if (foreground != null && foreground.isStateful()) { - foreground.setState(getDrawableState()); - } - } - - public Drawable getForeground() { - return foreground; - } - - public void setForeground(Drawable drawable) { - if (foreground != drawable) { - if (foreground != null) { - foreground.setCallback(null); - unscheduleDrawable(foreground); - } - - foreground = drawable; - - if (foreground != null) { - foreground.setBounds(getLeft(), getTop(), getRight(), getBottom()); - setWillNotDraw(false); - foreground.setCallback(this); - if (foreground.isStateful()) { - foreground.setState(getDrawableState()); - } - } else { - setWillNotDraw(true); - } - invalidate(); - } - } - - @Override public void draw(@NonNull Canvas canvas) { - super.draw(canvas); - if (foreground != null) { - foreground.draw(canvas); - } - } - - @Override public void drawableHotspotChanged(float x, float y) { - super.drawableHotspotChanged(x, y); - if (foreground != null) { - foreground.setHotspot(x, y); - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/widgets/LabelSpan.java b/app/src/main/java/com/fastaccess/ui/widgets/LabelSpan.java deleted file mode 100644 index d673bb86f..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/LabelSpan.java +++ /dev/null @@ -1,169 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.graphics.Paint.FontMetricsInt; -import android.graphics.RectF; -import androidx.annotation.NonNull; -import androidx.core.text.TextUtilsCompat; -import androidx.core.view.ViewCompat; -import android.text.Spanned; -import android.text.TextPaint; -import android.text.TextUtils; -import android.text.style.CharacterStyle; -import android.text.style.ReplacementSpan; - -import com.fastaccess.helper.ViewHelper; - -import java.util.Locale; - - -/** - * adopted class from Android source code & modified to fit FastHub need. - */ - -public class LabelSpan extends ReplacementSpan { - public interface SpanDimensions { - int getPadding(); - - int getPaddingExtraWidth(); - - int getPaddingAfter(); - - int getMaxWidth(); - - float getRoundedCornerRadius(); - - int getMarginTop(); - - boolean isRtl(); - } - - private final TextPaint txtPaint = new TextPaint(); - private final FontMetricsInt fontMetrics = new FontMetricsInt(); - private final int color; - private final SpanDimensions dims; - - private LabelSpan(int color, @NonNull SpanDimensions dims) { - this.color = color; - txtPaint.bgColor = color; - this.dims = dims; - } - - public LabelSpan(int color) { - this(color, new SpanDimensions() { - @Override public int getPadding() { - return 6; - } - - @Override public int getPaddingExtraWidth() { - return 0; - } - - @Override public int getPaddingAfter() { - return 0; - } - - @Override public int getMaxWidth() { - return 1000;//random number - } - - @Override public float getRoundedCornerRadius() { - return 5; - } - - @Override public int getMarginTop() { - return 8; - } - - @Override public boolean isRtl() { - return TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == ViewCompat.LAYOUT_DIRECTION_RTL; - } - }); - } - - @Override public int getSize(@NonNull Paint paint, CharSequence text, int start, int end, FontMetricsInt fm) { - setupFontMetrics(text, start, end, fm, paint); - if (fm != null) { - final int padding = dims.getPadding(); - final int margin = dims.getMarginTop(); - fm.ascent = Math.min(fm.top, fm.ascent - padding) - margin; - fm.descent = Math.max(fm.bottom, padding); - fm.top = fm.ascent; - fm.bottom = fm.descent; - } - return measureWidth(txtPaint, text, start, end, dims.isRtl()); - } - - private int measureWidth(Paint paint, CharSequence text, int start, int end, - boolean includePaddingAfter) { - final int paddingW = dims.getPadding() + dims.getPaddingExtraWidth(); - final int maxWidth = dims.getMaxWidth(); - int w = (int) paint.measureText(text, start, end) + 2 * paddingW; - if (includePaddingAfter) { - w += dims.getPaddingAfter(); - } - if (w > maxWidth) { - w = maxWidth; - } - return w; - } - - private void setupFontMetrics(CharSequence text, int start, int end, FontMetricsInt fm, Paint p) { - txtPaint.set(p); - final CharacterStyle[] otherSpans = ((Spanned) text).getSpans(start, end, CharacterStyle.class); - for (CharacterStyle otherSpan : otherSpans) { - otherSpan.updateDrawState(txtPaint); - } - txtPaint.setTextSize(p.getTextSize()); - if (fm != null) { - txtPaint.getFontMetricsInt(fm); - } - } - - @Override public void draw(@NonNull Canvas canvas, CharSequence text, int start, int end, - float x, int top, int y, int bottom, @NonNull Paint paint) { - final int padding = dims.getPadding(); - final int paddingW = padding + dims.getPaddingExtraWidth(); - final int maxWidth = dims.getMaxWidth(); - setupFontMetrics(text, start, end, fontMetrics, paint); - final int bgWidth = measureWidth(txtPaint, text, start, end, false); - fontMetrics.top = Math.min(fontMetrics.top, fontMetrics.ascent - padding); - fontMetrics.bottom = Math.max(fontMetrics.bottom, padding); - top = y + fontMetrics.top - fontMetrics.bottom; - bottom = y; - y = bottom - fontMetrics.bottom; - final boolean isRtl = dims.isRtl(); - final int paddingAfter = dims.getPaddingAfter(); - if (txtPaint.bgColor != 0) { - final int prevColor = txtPaint.getColor(); - final Paint.Style prevStyle = txtPaint.getStyle(); - txtPaint.setColor(txtPaint.bgColor); - txtPaint.setStyle(Paint.Style.FILL); - final float left; - if (isRtl) { - left = x + paddingAfter; - } else { - left = x; - } - final float right = left + bgWidth; - final RectF rect = new RectF(left, top, right, bottom); - final float radius = dims.getRoundedCornerRadius(); - canvas.drawRoundRect(rect, radius, radius, txtPaint); - txtPaint.setColor(prevColor); - txtPaint.setStyle(prevStyle); - } - if (bgWidth == maxWidth) { - text = TextUtils.ellipsize(text.subSequence(start, end).toString(), txtPaint, bgWidth - 2 * paddingW, TextUtils.TruncateAt.MIDDLE); - start = 0; - end = text.length(); - } - float textX = x + paddingW; - if (isRtl) { - textX += paddingAfter; - } - if (color != Color.TRANSPARENT) txtPaint.setColor(ViewHelper.generateTextColor(color)); - canvas.drawText(text, start, end, textX, y, txtPaint); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/NestedCoordinatorLayout.java b/app/src/main/java/com/fastaccess/ui/widgets/NestedCoordinatorLayout.java deleted file mode 100644 index 0c0d8a1b2..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/NestedCoordinatorLayout.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.content.Context; -import androidx.annotation.NonNull; -import androidx.coordinatorlayout.widget.CoordinatorLayout; -import androidx.core.view.NestedScrollingChild; -import androidx.core.view.NestedScrollingChildHelper; -import android.util.AttributeSet; -import android.view.View; - -/** - * Created by Kosh on 13 Aug 2016, 1:11 PM - */ - -public class NestedCoordinatorLayout extends CoordinatorLayout implements NestedScrollingChild { - - private NestedScrollingChildHelper mChildHelper; - - public NestedCoordinatorLayout(@NonNull Context context) { - super(context); - mChildHelper = new NestedScrollingChildHelper(this); - setNestedScrollingEnabled(true); - } - - public NestedCoordinatorLayout(@NonNull Context context, AttributeSet attrs) { - super(context, attrs); - mChildHelper = new NestedScrollingChildHelper(this); - setNestedScrollingEnabled(true); - } - - public NestedCoordinatorLayout(@NonNull Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - mChildHelper = new NestedScrollingChildHelper(this); - setNestedScrollingEnabled(true); - } - - @Override public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes) { - /* Enable the scrolling behavior of our own children */ - boolean tHandled = super.onStartNestedScroll(child, target, nestedScrollAxes); - /* Enable the scrolling behavior of the parent's other children */ - return startNestedScroll(nestedScrollAxes) || tHandled; - } - - @Override public void onStopNestedScroll(View target) { - /* Disable the scrolling behavior of our own children */ - super.onStopNestedScroll(target); - /* Disable the scrolling behavior of the parent's other children */ - stopNestedScroll(); - } - - @Override public void onNestedPreScroll(View target, int dx, int dy, int[] consumed) { - int[][] tConsumed = new int[2][2]; - super.onNestedPreScroll(target, dx, dy, tConsumed[0]); - dispatchNestedPreScroll(dx, dy, tConsumed[1], null); - consumed[0] = tConsumed[0][0] + tConsumed[1][0]; - consumed[1] = tConsumed[0][1] + tConsumed[1][1]; - } - - @Override public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { - super.onNestedScroll(target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); - dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, null); - } - - @Override public boolean onNestedPreFling(View target, float velocityX, float velocityY) { - boolean tHandled = super.onNestedPreFling(target, velocityX, velocityY); - return dispatchNestedPreFling(velocityX, velocityY) || tHandled; - } - - @Override public boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed) { - boolean tHandled = super.onNestedFling(target, velocityX, velocityY, consumed); - return dispatchNestedFling(velocityX, velocityY, consumed) || tHandled; - } - - @Override public void setNestedScrollingEnabled(boolean enabled) { - mChildHelper.setNestedScrollingEnabled(enabled); - } - - @Override public boolean isNestedScrollingEnabled() { - return mChildHelper.isNestedScrollingEnabled(); - } - - @Override public boolean startNestedScroll(int axes) { - return mChildHelper.startNestedScroll(axes); - } - - @Override public void stopNestedScroll() { - mChildHelper.stopNestedScroll(); - } - - @Override public boolean hasNestedScrollingParent() { - return mChildHelper.hasNestedScrollingParent(); - } - - @Override public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) { - return mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, - dyUnconsumed, offsetInWindow); - } - - @Override public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow) { - return mChildHelper.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow); - } - - @Override public boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed) { - return mChildHelper.dispatchNestedFling(velocityX, velocityY, consumed); - } - - @Override public boolean dispatchNestedPreFling(float velocityX, float velocityY) { - return mChildHelper.dispatchNestedPreFling(velocityX, velocityY); - } -} - diff --git a/app/src/main/java/com/fastaccess/ui/widgets/SpannableBuilder.java b/app/src/main/java/com/fastaccess/ui/widgets/SpannableBuilder.java deleted file mode 100644 index 54e24dfc3..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/SpannableBuilder.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.graphics.drawable.Drawable; -import androidx.annotation.ColorInt; -import android.text.SpannableStringBuilder; -import android.text.TextPaint; -import android.text.style.BackgroundColorSpan; -import android.text.style.ClickableSpan; -import android.text.style.ForegroundColorSpan; -import android.text.style.ImageSpan; -import android.text.style.StyleSpan; -import android.text.style.URLSpan; -import android.view.View; - -import com.fastaccess.helper.InputHelper; - -import static android.graphics.Typeface.BOLD; - -/** - * Created by Kosh on 15 Nov 2016, 9:26 PM - */ - -public class SpannableBuilder extends SpannableStringBuilder { - - private SpannableBuilder() {} - - public static SpannableBuilder builder() { - return new SpannableBuilder(); - } - - public SpannableBuilder append(final CharSequence text, final Object span) { - if (!InputHelper.isEmpty(text)) { - append(text); - if (span != null) { - final int length = length(); - setSpan(span, length - text.length(), length, SPAN_EXCLUSIVE_EXCLUSIVE); - } - } - return this; - } - - @Override public SpannableBuilder append(char text) { - if (text != 0) super.append(text); - return this; - } - - @Override public SpannableBuilder append(CharSequence text) { - if (text != null) super.append(text); - return this; - } - - public SpannableBuilder append(Object span) { - setSpan(span, length() - 1, length(), SPAN_EXCLUSIVE_EXCLUSIVE); - return this; - } - - public SpannableBuilder append(Drawable drawable) { - if (drawable != null) { - drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); - append(' ', new ImageSpan(drawable)); - } - return this; - } - - public SpannableBuilder append(final char text, final Object span) { - append(text); - if (!InputHelper.isEmpty(span)) { - final int length = length(); - setSpan(span, length - 1, length, SPAN_EXCLUSIVE_EXCLUSIVE); - } - return this; - } - - public SpannableBuilder bold(CharSequence text, final Object span) { - if (!InputHelper.isEmpty(text)) { - text = SpannableBuilder.builder().bold(text); - append(text, span); - } - return this; - } - - public SpannableBuilder bold(final CharSequence text) { - if (!InputHelper.isEmpty(text)) return append(text, new StyleSpan(BOLD)); - return this; - } - - public SpannableBuilder background(final CharSequence text, final int color) { - if (!InputHelper.isEmpty(text)) - return append(text, new BackgroundColorSpan(color)); - return this; - } - - public SpannableBuilder foreground(final CharSequence text, @ColorInt int color) { - if (!InputHelper.isEmpty(text)) return append(text, new ForegroundColorSpan(color)); - return this; - } - - public SpannableBuilder foreground(final char text, @ColorInt int color) { - return append(text, new ForegroundColorSpan(color)); - } - - public SpannableBuilder url(final CharSequence text, final View.OnClickListener listener) { - if (!InputHelper.isEmpty(text)) - return append(text, new URLSpan(text.toString()) { - @Override - public void onClick(View widget) { - listener.onClick(widget); - } - }); - return this; - } - - public SpannableBuilder url(final CharSequence text) { - if (!InputHelper.isEmpty(text)) return append(text, new URLSpan(text.toString())); - return this; - } - - public SpannableBuilder clickable(final CharSequence text, final View.OnClickListener listener) { - if (!InputHelper.isEmpty(text)) return append(text, new ClickableSpan() { - @Override public void updateDrawState(TextPaint ds) { - ds.setColor(ds.linkColor); - ds.setUnderlineText(false); - } - - @Override public void onClick(View widget) { - listener.onClick(widget); - } - }); - return this; - } - -} - diff --git a/app/src/main/java/com/fastaccess/ui/widgets/StateLayout.java b/app/src/main/java/com/fastaccess/ui/widgets/StateLayout.java deleted file mode 100644 index bf58cc068..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/StateLayout.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.content.Context; -import android.os.Parcelable; -import androidx.annotation.NonNull; -import androidx.annotation.StringRes; -import androidx.core.widget.NestedScrollView; -import android.util.AttributeSet; - -import com.evernote.android.state.State; -import com.evernote.android.state.StateSaver; -import com.fastaccess.R; - -import butterknife.BindView; -import butterknife.ButterKnife; -import butterknife.OnClick; - -/** - * Created by Kosh on 20 Nov 2016, 12:21 AM - */ -public class StateLayout extends NestedScrollView { - - private static final int SHOW_PROGRESS_STATE = 1; - private static final int HIDE_PROGRESS_STATE = 2; - private static final int HIDE_RELOAD_STATE = 3; - private static final int SHOW_RELOAD_STATE = 4; - private static final int SHOW_EMPTY_STATE = 7; - private static final int HIDDEN = 5; - private static final int SHOWN = 6; - private OnClickListener onReloadListener; - - @BindView(R.id.empty_text) FontTextView emptyText; - @BindView(R.id.reload) FontButton reload; - - @State int layoutState = HIDDEN; - @State String emptyTextValue; - @State boolean showReload = true; - - @OnClick(R.id.reload) void onReload() { - if (onReloadListener != null) { - onReloadListener.onClick(reload); - } - } - - public StateLayout(Context context) { - super(context); - } - - public StateLayout(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public StateLayout(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - public void showProgress() { - layoutState = SHOW_PROGRESS_STATE; - setVisibility(VISIBLE); - emptyText.setVisibility(GONE); - reload.setVisibility(GONE); - } - - public void hideProgress() { - layoutState = HIDE_PROGRESS_STATE; - emptyText.setVisibility(VISIBLE); - reload.setVisibility(VISIBLE); - setVisibility(GONE); - } - - public void hideReload() { - layoutState = HIDE_RELOAD_STATE; - reload.setVisibility(GONE); - emptyText.setVisibility(GONE); - setVisibility(GONE); - } - - public void showReload(int adapterCount) { - showReload = adapterCount == 0; - showReload(); - } - - protected void showReload() { - hideProgress(); - if (showReload) { - layoutState = SHOW_RELOAD_STATE; - reload.setVisibility(VISIBLE); - emptyText.setVisibility(VISIBLE); - setVisibility(VISIBLE); - } - } - - public void setEmptyText(@StringRes int resId) { - setEmptyText(getResources().getString(resId)); - } - - public void setEmptyText(@NonNull String text) { - this.emptyTextValue = text; - emptyText.setText(emptyTextValue); - } - - public void showEmptyState() { - hideProgress(); - hideReload(); - setVisibility(VISIBLE); - emptyText.setVisibility(VISIBLE); - layoutState = SHOW_EMPTY_STATE;// last so it override visibility state. - } - - public void setOnReloadListener(OnClickListener onReloadListener) { - this.onReloadListener = onReloadListener; - } - - @Override public void setVisibility(int visibility) { - super.setVisibility(visibility); - if (visibility == GONE || visibility == INVISIBLE) { - layoutState = HIDDEN; - } else { - layoutState = SHOWN; - } - } - - @Override protected void onFinishInflate() { - super.onFinishInflate(); - inflate(getContext(), R.layout.empty_layout, this); - if (isInEditMode()) return; - ButterKnife.bind(this); - emptyText.setFreezesText(true); - } - - @Override protected void onDetachedFromWindow() { - onReloadListener = null; - super.onDetachedFromWindow(); - } - - @Override public Parcelable onSaveInstanceState() { - return StateSaver.saveInstanceState(this, super.onSaveInstanceState()); - } - - @Override public void onRestoreInstanceState(Parcelable state) { - super.onRestoreInstanceState(StateSaver.restoreInstanceState(this, state)); - onHandleLayoutState(); - } - - private void onHandleLayoutState() { - setEmptyText(emptyTextValue); - switch (layoutState) { - case SHOW_PROGRESS_STATE: - showProgress(); - break; - case HIDE_PROGRESS_STATE: - hideProgress(); - break; - case HIDE_RELOAD_STATE: - hideReload(); - break; - case SHOW_RELOAD_STATE: - showReload(); - break; - case HIDDEN: - setVisibility(GONE); - break; - case SHOW_EMPTY_STATE: - showEmptyState(); - break; - case SHOWN: - setVisibility(VISIBLE); - showReload(); - break; - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/TabletBehavior.java b/app/src/main/java/com/fastaccess/ui/widgets/TabletBehavior.java deleted file mode 100644 index b5d7549a5..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/TabletBehavior.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.content.Context; -import com.google.android.material.appbar.AppBarLayout; -import androidx.coordinatorlayout.widget.CoordinatorLayout; -import androidx.appcompat.widget.Toolbar; -import android.util.AttributeSet; -import android.view.View; - -import it.sephiroth.android.library.bottomnavigation.BottomNavigation; -import it.sephiroth.android.library.bottomnavigation.VerticalScrollingBehavior; - -public class TabletBehavior extends VerticalScrollingBehavior { - - public TabletBehavior(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public void setLayoutValues(int bottomNavWidth, int topInset, boolean translucentStatus) {} - - public boolean layoutDependsOn(CoordinatorLayout parent, BottomNavigation child, View dependency) { - return AppBarLayout.class.isInstance(dependency) || Toolbar.class.isInstance(dependency); - } - - public boolean onDependentViewChanged(CoordinatorLayout parent, BottomNavigation child, View dependency) { - return true; - } - - public void onDependentViewRemoved(CoordinatorLayout parent, BottomNavigation child, View dependency) { - super.onDependentViewRemoved(parent, child, dependency); - } - - public boolean onLayoutChild(CoordinatorLayout parent, BottomNavigation child, int layoutDirection) { - return super.onLayoutChild(parent, child, layoutDirection); - } - - public void onNestedVerticalOverScroll(CoordinatorLayout coordinatorLayout, BottomNavigation child, int direction, int currentOverScroll, int - totalOverScroll) { - } - - public void onDirectionNestedPreScroll(CoordinatorLayout coordinatorLayout, BottomNavigation child, View target, int dx, int dy, int[] - consumed, int scrollDirection) { - } - - protected boolean onNestedDirectionFling(CoordinatorLayout coordinatorLayout, BottomNavigation child, View target, float velocityX, float - velocityY, int scrollDirection) { - return false; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/widgets/ViewPagerView.java b/app/src/main/java/com/fastaccess/ui/widgets/ViewPagerView.java deleted file mode 100644 index 6faa46596..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/ViewPagerView.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.fastaccess.ui.widgets; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.res.TypedArray; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.viewpager.widget.PagerAdapter; -import androidx.viewpager.widget.ViewPager; -import android.util.AttributeSet; -import android.view.MotionEvent; - -import static android.R.attr.enabled; - - -/** - * Created by kosh20111 on 10/8/2015. - *

- * Viewpager that has scrolling animation by default - */ -public class ViewPagerView extends ViewPager { - - private boolean isEnabled; - - public ViewPagerView(Context context) { - super(context); - } - - public ViewPagerView(@NonNull Context context, AttributeSet attrs) { - super(context, attrs); - int[] attrsArray = {enabled}; - TypedArray array = context.obtainStyledAttributes(attrs, attrsArray); - isEnabled = array.getBoolean(0, true); - array.recycle(); - } - - @Override public boolean isEnabled() { - return isEnabled; - } - - @Override public void setEnabled(boolean enabled) { - this.isEnabled = enabled; - requestLayout(); - } - - @Override public void setAdapter(@Nullable PagerAdapter adapter) { - super.setAdapter(adapter); - if (isInEditMode()) return; - if (adapter != null) { - setOffscreenPageLimit(adapter.getCount()); - } - } - - @SuppressLint("ClickableViewAccessibility") @Override public boolean onTouchEvent(MotionEvent event) { - try { - return !isEnabled() || super.onTouchEvent(event); - } catch (IllegalArgumentException ex) { - ex.printStackTrace(); - } - return false; - } - - @Override public boolean onInterceptTouchEvent(MotionEvent event) { - try { - return isEnabled() && super.onInterceptTouchEvent(event); - } catch (IllegalArgumentException ex) { - ex.printStackTrace(); - } - return false; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/color/ColorGenerator.java b/app/src/main/java/com/fastaccess/ui/widgets/color/ColorGenerator.java deleted file mode 100644 index 0d1f215ca..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/color/ColorGenerator.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.fastaccess.ui.widgets.color; - -import android.content.Context; -import androidx.annotation.ColorInt; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.annimon.stream.Objects; -import com.fastaccess.helper.AppHelper; - -import java.util.Arrays; -import java.util.List; - -public class ColorGenerator { - - private static ColorGenerator MATERIAL; - private static ColorGenerator MATERIAL_DARK; - - static { - MATERIAL = create(Arrays.asList( - 0xff1976d2, - 0xff00838f, - 0xff512da8, - 0xff2e7d32, - 0xff283593, - 0xff01579b, - 0xffc51162, - 0xff6a1b9a, - 0xffd50000, - 0xff00695c - )); - MATERIAL_DARK = create(Arrays.asList( - 0xffffc107, - 0xffffc400, - 0xff2196f3, - 0xff2979ff, - 0xffa1887f, - 0xff4dd0e1, - 0xff00acc1, - 0xffe64a19, - 0xff9575cd, - 0xff66bb6a - )); - } - - private final List colors; - - private static ColorGenerator create(List colorList) { - return new ColorGenerator(colorList); - } - - private ColorGenerator(List colorList) { - colors = colorList; - } - - private int getColor(@Nullable Object key) { - key = Objects.toString(key, "default"); - return colors.get(Math.abs(key.hashCode()) % colors.size()); - } - - @ColorInt public static int getColor(@NonNull Context context, @Nullable Object object) { - if (AppHelper.isNightMode(context.getResources())) { - return MATERIAL_DARK.getColor(object); - } else { - return MATERIAL.getColor(object); - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/widgets/contributions/ContributionsDay.java b/app/src/main/java/com/fastaccess/ui/widgets/contributions/ContributionsDay.java deleted file mode 100644 index ff6f70524..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/contributions/ContributionsDay.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.fastaccess.ui.widgets.contributions; - -/** - * Copyright 2016 Javier González - * All right reserved. - */ -public class ContributionsDay { - - public int year = Integer.MIN_VALUE; - public int month = Integer.MIN_VALUE; - public int day = Integer.MIN_VALUE; - - // Level is used to record the color of the block - public int level = Integer.MIN_VALUE; - // Data is used to calculated the height of the pillar - private int data = Integer.MIN_VALUE; - - public ContributionsDay(int year, int month, int day, int level, int data) { - this.year = year; - this.month = month; - this.day = day; - this.level = level; - this.data = data; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/contributions/ContributionsProvider.java b/app/src/main/java/com/fastaccess/ui/widgets/contributions/ContributionsProvider.java deleted file mode 100644 index 4e44f9b75..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/contributions/ContributionsProvider.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.fastaccess.ui.widgets.contributions; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.helper.InputHelper; - -import java.util.ArrayList; -import java.util.List; - -/** - * Copyright 2016 Javier González - * All right reserved. - */ -public class ContributionsProvider { - - private final static String FILL_STRING = "fill=\""; - private final static String DATA_STRING = "data-count=\""; - private final static String DATE_STRING = "data-date=\""; - - @NonNull public List getContributions(@Nullable String string) { - ArrayList contributions = new ArrayList<>(); - if (InputHelper.isEmpty(string)) return contributions; - int fillPos = -1; - int dataPos = -1; - int datePos = -1; - while (true) { - fillPos = string.indexOf(FILL_STRING, fillPos + 1); - dataPos = string.indexOf(DATA_STRING, dataPos + 1); - datePos = string.indexOf(DATE_STRING, datePos + 1); - if (fillPos == -1) break; - int level = 0; - String levelString = string.substring(fillPos + FILL_STRING.length(), fillPos + FILL_STRING.length() + 7); - switch (levelString) { - case "#eeeeee": - level = 0; - break; - case "#d6e685": - level = 1; - break; - case "#8cc665": - level = 2; - break; - case "#44a340": - level = 3; - break; - case "#1e6823": - level = 4; - break; - case "#ebedf0": - level = 0; - break; - case "#239a3b": - level = 1; - break; - case "#c6e48b": - level = 2; - break; - case "#7bc96f": - level = 3; - break; - case "#196127": - level = 4; - break; - } - - int dataEndPos = string.indexOf("\"", dataPos + DATA_STRING.length()); - String dataString = string.substring(dataPos + DATA_STRING.length(), dataEndPos); - int data = Integer.valueOf(dataString); - String dateString = string.substring(datePos + DATE_STRING.length(), datePos + DATE_STRING.length() + 11); - contributions.add(new ContributionsDay( - Integer.valueOf(dateString.substring(0, 4)), - Integer.valueOf(dateString.substring(5, 7)), - Integer.valueOf(dateString.substring(8, 10)), - level, - data - )); - } - - return contributions; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/contributions/GitHubContributionsView.java b/app/src/main/java/com/fastaccess/ui/widgets/contributions/GitHubContributionsView.java deleted file mode 100644 index b53a707f7..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/contributions/GitHubContributionsView.java +++ /dev/null @@ -1,386 +0,0 @@ -package com.fastaccess.ui.widgets.contributions; - -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Matrix; -import android.graphics.Paint; -import android.graphics.Point; -import android.graphics.Rect; -import android.util.AttributeSet; -import android.view.View; -import android.view.ViewGroup; -import android.view.WindowManager; - -import com.fastaccess.R; -import com.fastaccess.ui.widgets.contributions.utils.ColorsUtils; -import com.fastaccess.ui.widgets.contributions.utils.DatesUtils; - -import java.util.List; - -/** - * Copyright 2016 Javier González - * All right reserved. - */ - -public class GitHubContributionsView extends View { - private static final String BASE_COLOR = "#D6E685"; // default of Github - - private int baseColor = Color.parseColor(BASE_COLOR); - private int baseEmptyColor = Color.rgb(238, 238, 238); - private int backgroundBaseColor = Color.TRANSPARENT; - private int textColor = Color.BLACK; - private boolean displayMonth = false; - private int lastWeeks = 53; - private String username; - private Rect rect; - private Paint monthTextPaint; - private Matrix matrix = new Matrix(); - private Paint paint = new Paint(); - private Paint blockPaint; - private Bitmap bitmap = null; - private int height; - private Point point = new Point(); - - public GitHubContributionsView(Context context) { - super(context); - init(context, null, 0, 0); - } - - public GitHubContributionsView(Context context, AttributeSet attrs) { - super(context, attrs); - init(context, attrs, 0, 0); - } - - public GitHubContributionsView(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - init(context, attrs, defStyleAttr, 0); - } - - public GitHubContributionsView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - init(context, attrs, defStyleAttr, defStyleRes); - } - - private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getSize(point); - final TypedArray attributes = context.getTheme().obtainStyledAttributes( - attrs, R.styleable.GitHubContributionsView, defStyleAttr, defStyleRes); - initAttributes(attributes); - - rect = new Rect(); - monthTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG); - blockPaint = new Paint(Paint.ANTI_ALIAS_FLAG); - blockPaint.setStyle(Paint.Style.FILL); - } - - private void initAttributes(TypedArray attributes) { - baseColor = attributes.getColor(R.styleable.GitHubContributionsView_baseColor, baseColor); - baseEmptyColor = attributes.getColor(R.styleable.GitHubContributionsView_baseEmptyColor, baseEmptyColor); - backgroundBaseColor = attributes.getColor(R.styleable.GitHubContributionsView_backgroundBaseColor, backgroundBaseColor); - textColor = attributes.getColor(R.styleable.GitHubContributionsView_textColor, textColor); - displayMonth = attributes.getBoolean(R.styleable.GitHubContributionsView_displayMonth, displayMonth); - lastWeeks = attributes.getInt(R.styleable.GitHubContributionsView_lastWeeks, lastWeeks); - if (attributes.getString(R.styleable.GitHubContributionsView_username) != null) { - username = attributes.getString(R.styleable.GitHubContributionsView_username); - if (!isInEditMode()) { - loadUserName(username); - } - } - } - - /** - * Set a base color for blocks. - * The tone depends on the number of contributions for a day. - * Supported formats See {@link Color#parseColor(String)} - * - * @param baseColor - * base color supported formats - */ - public void setBaseColor(String baseColor) { - try { - this.baseColor = Color.parseColor(baseColor); - } catch (IllegalArgumentException e) { - e.printStackTrace(); - } - invalidate(); - } - - /** - * Set a base color for blocks. - * The tone depends on the number of contributions for a day. - * - * @param color - * resource color - */ - public void setBaseColor(int color) { - this.baseColor = color; - invalidate(); - } - - /** - * Set a base empty color for blocks without contributions. - * Supported formats See {@link Color#parseColor(String)} - * - * @param baseColor - * base color supported formats - */ - public void setBaseEmptyColor(String baseColor) { - try { - this.baseEmptyColor = Color.parseColor(baseColor); - } catch (IllegalArgumentException e) { - e.printStackTrace(); - } - invalidate(); - } - - /** - * Set a base empty color for blocks without contributions. - * - * @param color - * resource color - */ - public void setBaseEmptyColor(int color) { - this.baseEmptyColor = color; - invalidate(); - } - - /** - * Sets the background color for this contributions view. - * - * @param backgroundBaseColor - * the color of the background - */ - public void setBackgroundBaseColor(String backgroundBaseColor) { - try { - this.backgroundBaseColor = Color.parseColor(backgroundBaseColor); - } catch (IllegalArgumentException e) { - e.printStackTrace(); - } - invalidate(); - } - - /** - * Sets the background color for this contributions view. - * - * @param backgroundBaseColor - * the color of the background - */ - public void setBackgroundBaseColor(int backgroundBaseColor) { - this.backgroundBaseColor = backgroundBaseColor; - invalidate(); - } - - /** - * Set a text color for month names. - * Supported formats See {@link Color#parseColor(String)} - * - * @param textColor - * text color supported formats - */ - public void setTextColor(String textColor) { - try { - this.textColor = Color.parseColor(textColor); - } catch (IllegalArgumentException e) { - e.printStackTrace(); - } - invalidate(); - } - - /** - * Set a text color for month names. - * - * @param textColor - * resource color - */ - public void setTextColor(int textColor) { - this.textColor = textColor; - invalidate(); - } - - /** - * Set the number of weeks that you want to display. - * You can set minimum 2 weeks but is not recommended. 1 week is impossible. - * You can set maximum 53 weeks (1 year = 52.14 weeks). - * By default is 53 (52 weeks and the current week). - * - * @param lastWeeks - * number of week (2..53) - */ - public void setLastWeeks(int lastWeeks) { - if (lastWeeks >= 2 && lastWeeks <= 53) { - this.lastWeeks = lastWeeks; - invalidate(); - } else { - throw new RuntimeException("The last weeks should be a number between 2 and 53"); - } - } - - /** - * Set if you want to see the name of the months - * If you send true, the component height increase - * - * @param displayMonth - * true or false - */ - public void displayMonth(boolean displayMonth) { - this.displayMonth = displayMonth; - invalidate(); - } - - /** - * Load and show contributions information for a user / organization - * - * @param username - * also, can be an organization - */ - private void loadUserName(String username) { - this.username = username; - clearContribution(); - } - - /** - * Clean de component. - */ - private void clearContribution() { - bitmap = null; - invalidate(); - } - - public void onResponse() { - adjustHeight(height); - invalidate(); - } - - @Override protected void onDraw(Canvas canvas) { - super.onDraw(canvas); - if (bitmap != null) { - canvas.drawBitmap(bitmap, matrix, paint); - } else { - drawPlaceholder(canvas); - } - } - - public Bitmap drawOnCanvas(List contributionsFilter, List contributions) { - if ((contributionsFilter == null || contributions == null) || (contributionsFilter.isEmpty() || contributions.isEmpty())) { - return null; - } - if (bitmap == null) { - int padding = getResources().getDimensionPixelSize(R.dimen.spacing_large); - int width = point.x - padding; - int verticalBlockNumber = 7; - int horizontalBlockNumber = getHorizontalBlockNumber(contributionsFilter.size(), verticalBlockNumber); - float marginBlock = (1.0F - 0.1F); - float blockWidth = width / (float) horizontalBlockNumber * marginBlock; - float spaceWidth = width / (float) horizontalBlockNumber - blockWidth; - float topMargin = (displayMonth) ? 7f : 0; - float monthTextHeight = (displayMonth) ? blockWidth * 1.5F : 0; - int height = (int) ((blockWidth + spaceWidth) * 7 + topMargin + monthTextHeight); - bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); - Canvas canvas1 = new Canvas(bitmap); - // Background - blockPaint.setColor(backgroundBaseColor); - canvas1.drawRect(0, (topMargin + monthTextHeight), width, height + monthTextHeight, blockPaint); - monthTextPaint.setColor(textColor); - monthTextPaint.setTextSize(monthTextHeight); - // draw the blocks - int currentWeekDay = DatesUtils.getWeekDayFromDate( - contributions.get(0).year, - contributions.get(0).month, - contributions.get(0).day); - float x = 0; - float y = (currentWeekDay - 7) % 7 * (blockWidth + spaceWidth) + (topMargin + monthTextHeight); - for (ContributionsDay day : contributionsFilter) { - blockPaint.setColor(ColorsUtils.calculateLevelColor(baseColor, baseEmptyColor, day.level)); - canvas1.drawRect(x, y, x + blockWidth, y + blockWidth, blockPaint); - if (DatesUtils.isFirstDayOfWeek(day.year, day.month, day.day + 1)) { - // another column - x += blockWidth + spaceWidth; - y = topMargin + monthTextHeight; - if (DatesUtils.isFirstWeekOfMount(day.year, day.month, day.day + 1)) { - canvas1.drawText(DatesUtils.getShortMonthName(day.year, day.month, day.day + 1), x, monthTextHeight, - monthTextPaint); - } - - } else { - y += blockWidth + spaceWidth; - } - } - this.height = height; - } - return bitmap; - } - - private void adjustHeight(int height) { - ViewGroup.LayoutParams ll = getLayoutParams(); - if (height != ll.height) { - ll.height = height; - setLayoutParams(ll); - } - } - - private void drawPlaceholder(Canvas canvas) { - if (!isInEditMode()) return; - canvas.getClipBounds(rect); - int width = rect.width(); - - int verticalBlockNumber = 7; - int horizontalBlockNumber = getHorizontalBlockNumber(lastWeeks * 7, verticalBlockNumber); - - float marginBlock = (1.0F - 0.1F); - float blockWidth = width / (float) horizontalBlockNumber * marginBlock; - float spaceWidth = width / (float) horizontalBlockNumber - blockWidth; - - float monthTextHeight = (displayMonth) ? blockWidth * 1.5F : 0; - float topMargin = (displayMonth) ? 7f : 0; - - monthTextPaint.setTextSize(monthTextHeight); - - int height = (int) ((blockWidth + spaceWidth) * 7 + topMargin + monthTextHeight); - - // Background - blockPaint.setColor(backgroundBaseColor); - canvas.drawRect(0, (topMargin + monthTextHeight), width, height + monthTextHeight, blockPaint); - - - float x = 0; - float y = 0 - * (blockWidth + spaceWidth) - + (topMargin + monthTextHeight); - - for (int i = 1; i < (lastWeeks * 7) + 1; i++) { - - blockPaint.setColor(ColorsUtils.calculateLevelColor(baseColor, baseEmptyColor, 0)); - canvas.drawRect(x, y, x + blockWidth, y + blockWidth, blockPaint); - - if (i % 7 == 0) { - // another column - x += blockWidth + spaceWidth; - y = topMargin + monthTextHeight; - - } else { - y += blockWidth + spaceWidth; - } - } - - // Resize component - ViewGroup.LayoutParams ll = getLayoutParams(); - ll.height = height; - setLayoutParams(ll); - } - - private int getHorizontalBlockNumber(int total, int divider) { - boolean isInteger = total % divider == 0; - int result = total / divider; - return (isInteger) ? result : result + 1; - } - - public List getLastContributions(List contributions) { - int lastWeekDays = contributions.size() % 7; - int lastDays = (lastWeekDays > 0) ? lastWeekDays + (lastWeeks - 1) * 7 : lastWeeks * 7; - return contributions.subList(contributions.size() - lastDays, contributions.size()); - } -} - diff --git a/app/src/main/java/com/fastaccess/ui/widgets/contributions/utils/ColorsUtils.java b/app/src/main/java/com/fastaccess/ui/widgets/contributions/utils/ColorsUtils.java deleted file mode 100644 index 7eb553b4c..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/contributions/utils/ColorsUtils.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.fastaccess.ui.widgets.contributions.utils; - -import android.graphics.Color; - -/** - * Copyright 2016 Javier González - * All right reserved. - */ -public class ColorsUtils { - - /** - * Calculate the value for different color. - * - * @param baseColor - * Value of base color. - * @param emptyColor - * Value of empty color - * @param level - * Level. - * @return The value for the level of the base color. - */ - public static int calculateLevelColor(int baseColor, int emptyColor, int level) { - if (level == 0) { - return emptyColor; - } - return Color.rgb( - calculateR(Color.red(baseColor), level), - calculateG(Color.green(baseColor), level), - calculateB(Color.blue(baseColor), level)); - } - - /** - * Calculate the red value for different level. - * - * @param baseR - * Red value of base color. - * @param level - * Level. - * @return The red value for the level of the base color. - */ - private static int calculateR(int baseR, int level) { - switch (level) { - case 0: - return 238; - case 1: - return baseR; - case 2: - return (int) (baseR * (9 + 46 + 15) / (37f + 9 + 46 + 15)); - case 3: - return (int) (baseR * (46 + 15) / (37f + 9 + 46 + 15)); - case 4: - return (int) (baseR * (15) / (37f + 9 + 46 + 15)); - default: - return 238; - } - } - - /** - * Calculate the green value for different level. - * - * @param baseG - * Green value of base color. - * @param level - * Level. - * @return The green value for the level of the base color. - */ - private static int calculateG(int baseG, int level) { - switch (level) { - case 0: - return 238; - case 1: - return baseG; - case 2: - return (int) (baseG * (35 + 59 + 104) / (32f + 35 + 59 + 104)); - case 3: - return (int) (baseG * (59 + 104) / (32f + 35 + 59 + 104)); - case 4: - return (int) (baseG * (104) / (32f + 35 + 59 + 104)); - default: - return 238; - } - } - - /** - * Calculate the blue value for different level. - * - * @param baseB - * Blue value of base color. - * @param level - * Level. - * @return The blue value for the level of the base color. - */ - private static int calculateB(int baseB, int level) { - switch (level) { - case 0: - return 238; - case 1: - return baseB; - case 2: - return (int) (baseB * (37 + 29 + 35) / (32f + 37 + 29 + 35)); - case 3: - return (int) (baseB * (29 + 35) / (32f + 37 + 29 + 35)); - case 4: - return (int) (baseB * (35) / (32f + 37 + 29 + 35)); - default: - return 238; - } - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/contributions/utils/DatesUtils.java b/app/src/main/java/com/fastaccess/ui/widgets/contributions/utils/DatesUtils.java deleted file mode 100644 index 7243980cf..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/contributions/utils/DatesUtils.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.fastaccess.ui.widgets.contributions.utils; - -import android.annotation.SuppressLint; - -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Locale; - -/** - * Copyright 2016 Javier González - * All right reserved. - */ -public class DatesUtils { - - /** - * Get the day of week from a date. - * 0 for SUN. - * 1 for MON. - * . - * . - * . - * 6 for SAT. - * - * @param year - * The year of the date. - * @param month - * The month of the date. - * @param day - * The day of month of the date. - * @return Integer to determine the day of week. - */ - @SuppressLint("WrongConstant") public static int getWeekDayFromDate(int year, int month, int day) { - Calendar calendar = Calendar.getInstance(); - calendar.set(year, month - 1, day); - calendar.add(Calendar.SECOND, 0); - calendar.setFirstDayOfWeek(Calendar.SUNDAY); - return calendar.get(Calendar.DAY_OF_WEEK) - 1; - } - - /** - * Get the short month name for a certain date. - * - * @param year - * The year of the date. - * @param month - * The month of the date. - * @param day - * The day of the date. - * @return The short name of the month. - */ - @SuppressLint("WrongConstant") public static String getShortMonthName(int year, int month, int day) { - Calendar calendar = Calendar.getInstance(); - calendar.set(year, month - 1, day); - calendar.add(Calendar.SECOND, 0); - SimpleDateFormat month_date = new SimpleDateFormat("MMM", Locale.US); - return month_date.format(calendar.getTime()); - } - - /** - * Return if the date given is a first week of mount - * - * @param year - * The year of the date. - * @param month - * The month of the date. - * @param day - * The day of the date. - * @return true or false - */ - @SuppressLint("WrongConstant") public static boolean isFirstWeekOfMount(int year, int month, int day) { - Calendar calendar = Calendar.getInstance(); - calendar.set(year, month - 1, day); - calendar.add(Calendar.SECOND, 0); - calendar.setFirstDayOfWeek(Calendar.SUNDAY); - - return calendar.get(Calendar.DAY_OF_WEEK_IN_MONTH) == 1; - } - - /** - * Return if the date given is a first day of week - * - * @param year - * The year of the date. - * @param month - * The month of the date. - * @param day - * The day of the date. - * @return true or false - */ - @SuppressLint("WrongConstant") public static boolean isFirstDayOfWeek(int year, int month, int day) { - Calendar calendar = Calendar.getInstance(); - calendar.set(year, month - 1, day); - calendar.add(Calendar.SECOND, 0); - calendar.setFirstDayOfWeek(Calendar.SUNDAY); - - return calendar.get(Calendar.DAY_OF_WEEK) == 1; - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/dialog/ListDialogView.java b/app/src/main/java/com/fastaccess/ui/widgets/dialog/ListDialogView.java deleted file mode 100644 index 348b06926..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/dialog/ListDialogView.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.fastaccess.ui.widgets.dialog; - -import android.content.Context; -import android.os.Bundle; -import android.os.Parcelable; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.ui.adapter.SimpleListAdapter; -import com.fastaccess.ui.base.BaseDialogFragment; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; -import com.fastaccess.ui.widgets.FontTextView; -import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder; -import com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView; -import com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller; - -import net.grandcentrix.thirtyinch.TiPresenter; - -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; - -import butterknife.BindView; - -/** - * Created by Kosh on 31 Dec 2016, 3:19 PM - */ - -public class ListDialogView extends BaseDialogFragment implements BaseViewHolder.OnItemClickListener { - - public static final String TAG = ListDialogView.class.getSimpleName(); - - @BindView(R.id.title) FontTextView title; - @BindView(R.id.recycler) DynamicRecyclerView recycler; - @BindView(R.id.fastScroller) RecyclerViewFastScroller fastScroller; - - public interface onSimpleItemSelection { - void onItemSelected(O item); - } - - @Nullable private onSimpleItemSelection onSimpleItemSelection; - - @Override protected int fragmentLayout() { - return R.layout.simple_list_dialog; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - ArrayList objects = getArguments().getParcelableArrayList(BundleConstant.ITEM); - String titleText = getArguments().getString(BundleConstant.EXTRA); - title.setText(titleText); - if (objects != null) { - SimpleListAdapter adapter = new SimpleListAdapter<>(objects, this); - recycler.addDivider(); - recycler.setAdapter(adapter); - } else { - dismiss(); - } - fastScroller.attachRecyclerView(recycler); - } - - @Override public void onAttach(@NotNull Context context) { - super.onAttach(context); - if (getParentFragment() != null && getParentFragment() instanceof onSimpleItemSelection) { - onSimpleItemSelection = (onSimpleItemSelection) getParentFragment(); - } else if (context instanceof onSimpleItemSelection) { - onSimpleItemSelection = (onSimpleItemSelection) context; - } - } - - @Override public void onDetach() { - super.onDetach(); - onSimpleItemSelection = null; - } - - @NonNull @Override public TiPresenter providePresenter() { - return new BasePresenter(); - } - - @SuppressWarnings("unchecked") @Override public void onItemClick(int position, View v, O item) { - if (onSimpleItemSelection != null) { - onSimpleItemSelection.onItemSelected(item); - } - dismiss(); - } - - @Override public void onItemLongClick(int position, View v, O item) {} - - public void initArguments(@NonNull String title, @NonNull ArrayList objects) { - setArguments(Bundler.start() - .put(BundleConstant.EXTRA, title) - .putParcelableArrayList(BundleConstant.ITEM, objects) - .end()); - } - - public void initArguments(@NonNull String title, @NonNull List objects) { - setArguments(Bundler.start() - .put(BundleConstant.EXTRA, title) - .putParcelableArrayList(BundleConstant.ITEM, (ArrayList) objects) - .end()); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/dialog/MessageDialogView.java b/app/src/main/java/com/fastaccess/ui/widgets/dialog/MessageDialogView.java deleted file mode 100644 index 47581af81..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/dialog/MessageDialogView.java +++ /dev/null @@ -1,174 +0,0 @@ -package com.fastaccess.ui.widgets.dialog; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.helper.BundleConstant; -import com.fastaccess.helper.Bundler; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.ui.base.BaseBottomSheetDialog; -import com.fastaccess.ui.widgets.FontButton; -import com.fastaccess.ui.widgets.FontTextView; -import com.prettifier.pretty.PrettifyWebView; - -import butterknife.BindView; -import butterknife.OnClick; - -/** - * Created by Kosh on 16 Sep 2016, 2:15 PM - */ - -public class MessageDialogView extends BaseBottomSheetDialog { - - public static final String TAG = MessageDialogView.class.getSimpleName(); - - public interface MessageDialogViewActionCallback { - - void onMessageDialogActionClicked(boolean isOk, @Nullable Bundle bundle); - - void onDialogDismissed(); - - } - - @BindView(R.id.prettifyWebView) PrettifyWebView prettifyWebView; - @BindView(R.id.title) FontTextView title; - @BindView(R.id.message) FontTextView message; - @BindView(R.id.cancel) FontButton cancel; - @BindView(R.id.ok) FontButton ok; - - @Nullable private MessageDialogViewActionCallback callback; - - @Override public void onAttach(Context context) { - super.onAttach(context); - if (getParentFragment() != null && getParentFragment() instanceof MessageDialogViewActionCallback) { - callback = (MessageDialogViewActionCallback) getParentFragment(); - } else if (context instanceof MessageDialogViewActionCallback) { - callback = (MessageDialogViewActionCallback) context; - } - } - - @Override public void onDetach() { - super.onDetach(); - callback = null; - } - - @OnClick({R.id.cancel, R.id.ok}) public void onClick(@NonNull View view) { - if (callback != null) { - isAlreadyHidden = true; - callback.onMessageDialogActionClicked(view.getId() == R.id.ok, getArguments().getBundle("bundle")); - } - dismiss(); - } - - @Override protected int layoutRes() { - return R.layout.message_dialog; - } - - @SuppressWarnings("ConstantConditions") @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - Bundle bundle = getArguments(); - title.setText(bundle.getString("bundleTitle")); - String msg = bundle.getString("bundleMsg"); - if (bundle.getBoolean("isMarkDown")) { - if (msg != null) { - message.setVisibility(View.GONE); - prettifyWebView.setVisibility(View.VISIBLE); - prettifyWebView.setGithubContent(msg, null, false, false); - prettifyWebView.setNestedScrollingEnabled(false); - } - } else { - message.setText(msg); - } - if (bundle != null) { - boolean hideCancel = bundle.getBoolean("hideCancel"); - if (hideCancel) cancel.setVisibility(View.GONE); - initButton(bundle); - } - } - - private void initButton(@NonNull Bundle bundle) { - Bundle extra = bundle.getBundle("bundle"); - if (extra != null) { - boolean yesNo = extra.getBoolean(BundleConstant.YES_NO_EXTRA); - if (yesNo) { - ok.setText(R.string.yes); - cancel.setText(R.string.no); - } else { - boolean hideButtons = extra.getBoolean("hide_buttons"); - String primaryExtra = extra.getString("primary_extra"); - String secondaryExtra = extra.getString("secondary_extra"); - if (hideButtons) { - ok.setVisibility(View.GONE); - cancel.setVisibility(View.GONE); - } else if (!InputHelper.isEmpty(primaryExtra)) { - ok.setText(primaryExtra); - if (!InputHelper.isEmpty(secondaryExtra)) cancel.setText(secondaryExtra); - ok.setVisibility(View.VISIBLE); - cancel.setVisibility(View.VISIBLE); - } - } - } - } - - @Override protected void onDismissedByScrolling() { - super.onDismissedByScrolling(); - if (callback != null) callback.onDialogDismissed(); - } - - @Override protected void onHidden() { - if (callback != null) callback.onDialogDismissed(); - super.onHidden(); - } - - @NonNull public static MessageDialogView newInstance(@NonNull String bundleTitle, @NonNull String bundleMsg) { - return newInstance(bundleTitle, bundleMsg, null); - } - - @NonNull public static MessageDialogView newInstance(@NonNull String bundleTitle, @NonNull String bundleMsg, boolean isMarkDown) { - return newInstance(bundleTitle, bundleMsg, isMarkDown, null); - } - - @NonNull public static MessageDialogView newInstance(@NonNull String bundleTitle, @NonNull String bundleMsg, - boolean isMarkDown, boolean hideCancel) { - return newInstance(bundleTitle, bundleMsg, isMarkDown, hideCancel, null); - } - - @NonNull public static MessageDialogView newInstance(@NonNull String bundleTitle, @NonNull String bundleMsg, boolean isMarkDown, - @Nullable Bundle bundle) { - MessageDialogView messageDialogView = new MessageDialogView(); - messageDialogView.setArguments(getBundle(bundleTitle, bundleMsg, isMarkDown, bundle, false)); - return messageDialogView; - } - - @NonNull public static MessageDialogView newInstance(@NonNull String bundleTitle, @NonNull String bundleMsg, boolean isMarkDown, - boolean hideCancel, @Nullable Bundle bundle) { - MessageDialogView messageDialogView = new MessageDialogView(); - messageDialogView.setArguments(getBundle(bundleTitle, bundleMsg, isMarkDown, bundle, hideCancel)); - return messageDialogView; - } - - @NonNull public static MessageDialogView newInstance(@NonNull String bundleTitle, @NonNull String bundleMsg, @Nullable Bundle bundle) { - return newInstance(bundleTitle, bundleMsg, false, bundle); - } - - private static Bundle getBundle(String bundleTitle, String bundleMsg, boolean isMarkDown, Bundle bundle, boolean hideCancel) { - return Bundler.start() - .put("bundleTitle", bundleTitle) - .put("bundleMsg", bundleMsg) - .put("bundle", bundle) - .put("isMarkDown", isMarkDown) - .put("hideCancel", hideCancel) - .end(); - } - - @NonNull public static Bundle getYesNoBundle(@NonNull Context context) { - return Bundler.start() - .put("primary_extra", context.getString(R.string.yes)) - .put("secondary_extra", context.getString(R.string.no)) - .end(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/dialog/ProgressDialogFragment.java b/app/src/main/java/com/fastaccess/ui/widgets/dialog/ProgressDialogFragment.java deleted file mode 100644 index 5bf73fe15..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/dialog/ProgressDialogFragment.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.fastaccess.ui.widgets.dialog; - -import android.app.Dialog; -import android.content.res.Resources; -import android.graphics.Color; -import android.graphics.drawable.ColorDrawable; -import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.StringRes; -import android.view.View; -import android.view.Window; - -import com.fastaccess.R; -import com.fastaccess.helper.Bundler; -import com.fastaccess.ui.base.BaseDialogFragment; -import com.fastaccess.ui.base.mvp.presenter.BasePresenter; - -import net.grandcentrix.thirtyinch.TiPresenter; - -/** - * Created by Kosh on 09 Dec 2016, 5:18 PM - */ - -public class ProgressDialogFragment extends BaseDialogFragment { - - public ProgressDialogFragment() { - suppressAnimation = true; - } - - public static final String TAG = ProgressDialogFragment.class.getSimpleName(); - - @NonNull public static ProgressDialogFragment newInstance(@NonNull Resources resources, @StringRes int msgId, boolean isCancelable) { - return newInstance(resources.getString(msgId), isCancelable); - } - - @NonNull public static ProgressDialogFragment newInstance(@NonNull String msg, boolean isCancelable) { - ProgressDialogFragment fragment = new ProgressDialogFragment(); - fragment.setArguments(Bundler.start() - .put("msg", msg) - .put("isCancelable", isCancelable) - .end()); - return fragment; - } - - @Override protected int fragmentLayout() { - return R.layout.progress_dialog_layout; - } - - @Override protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - - } - - @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { - Dialog dialog = super.onCreateDialog(savedInstanceState); - dialog.setCancelable(false); - setCancelable(false); - Window window = dialog.getWindow(); - if (window != null) { - window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); - window.setDimAmount(0); - } - return dialog; - } - - @NonNull @Override public TiPresenter providePresenter() { - return new BasePresenter(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/markdown/MarkDownLayout.kt b/app/src/main/java/com/fastaccess/ui/widgets/markdown/MarkDownLayout.kt deleted file mode 100644 index 23520f009..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/markdown/MarkDownLayout.kt +++ /dev/null @@ -1,175 +0,0 @@ -package com.fastaccess.ui.widgets.markdown - -import android.annotation.SuppressLint -import android.content.Context -import com.google.android.material.snackbar.Snackbar -import androidx.transition.TransitionManager -import androidx.fragment.app.FragmentManager -import android.util.AttributeSet -import android.view.View -import android.widget.EditText -import android.widget.HorizontalScrollView -import android.widget.LinearLayout -import butterknife.BindView -import butterknife.ButterKnife -import butterknife.OnClick -import com.fastaccess.R -import com.fastaccess.helper.AppHelper -import com.fastaccess.helper.InputHelper -import com.fastaccess.helper.ViewHelper -import com.fastaccess.provider.emoji.Emoji -import com.fastaccess.provider.markdown.MarkDownProvider -import com.fastaccess.ui.modules.editor.emoji.EmojiBottomSheet -import com.fastaccess.ui.modules.editor.popup.EditorLinkImageDialogFragment - -/** - * Created by kosh on 11/08/2017. - */ -class MarkDownLayout : LinearLayout { - - private val sentFromFastHub: String by lazy { - "\n\n_" + resources.getString(R.string.sent_from_fasthub, AppHelper.getDeviceName(), "", - "[" + resources.getString(R.string.app_name) + "](https://play.google.com/store/apps/details?id=com.fastaccess.github)") + "_" - } - - var markdownListener: MarkdownListener? = null - var selectionIndex = 0 - @BindView(R.id.editorIconsHolder) lateinit var editorIconsHolder: HorizontalScrollView - @BindView(R.id.addEmoji) lateinit var addEmojiView: View - - constructor(context: Context?) : super(context) - constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) - constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) - - override fun onFinishInflate() { - super.onFinishInflate() - orientation = HORIZONTAL - View.inflate(context, R.layout.markdown_buttons_layout, this) - if (isInEditMode) return - ButterKnife.bind(this) - } - - override fun onDetachedFromWindow() { - markdownListener = null - super.onDetachedFromWindow() - } - - @OnClick(R.id.view) fun onViewMarkDown() { - markdownListener?.let { - it.getEditText().let { editText -> - TransitionManager.beginDelayedTransition(this) - if (editText.isEnabled && !InputHelper.isEmpty(editText)) { - editText.isEnabled = false - selectionIndex = editText.selectionEnd - MarkDownProvider.setMdText(editText, InputHelper.toString(editText)) - editorIconsHolder.visibility = View.INVISIBLE - addEmojiView.visibility = View.INVISIBLE - ViewHelper.hideKeyboard(editText) - } else { - editText.setText(it.getSavedText()) - editText.setSelection(selectionIndex) - editText.isEnabled = true - editorIconsHolder.visibility = View.VISIBLE - addEmojiView.visibility = View.VISIBLE - ViewHelper.showKeyboard(editText) - } - } - } - } - - @OnClick(R.id.headerOne, R.id.headerTwo, R.id.headerThree, R.id.bold, R.id.italic, R.id.strikethrough, - R.id.bullet, R.id.header, R.id.code, R.id.numbered, R.id.quote, R.id.link, R.id.image, - R.id.unCheckbox, R.id.checkbox, R.id.inlineCode, R.id.addEmoji, - R.id.signature) - fun onActions(v: View) { - markdownListener?.let { - it.getEditText().let { editText -> - if (!editText.isEnabled) { - Snackbar.make(this, R.string.error_highlighting_editor, Snackbar.LENGTH_SHORT).show() - } else { - when { - v.id == R.id.link -> EditorLinkImageDialogFragment.newInstance(true, getSelectedText()) - .show(it.fragmentManager(), "EditorLinkImageDialogFragment") - v.id == R.id.image -> EditorLinkImageDialogFragment.newInstance(false, getSelectedText()) - .show(it.fragmentManager(), "EditorLinkImageDialogFragment") - v.id == R.id.addEmoji -> { - ViewHelper.hideKeyboard(it.getEditText()) - EmojiBottomSheet().show(it.fragmentManager(), "EmojiBottomSheet") - } - else -> onActionClicked(editText, v.id) - } - } - } - } - } - - @SuppressLint("SetTextI18n") - private fun onActionClicked(editText: EditText, id: Int) { - if (editText.selectionEnd == -1 || editText.selectionStart == -1) { - return - } - when (id) { - R.id.headerOne -> MarkDownProvider.addHeader(editText, 1) - R.id.headerTwo -> MarkDownProvider.addHeader(editText, 2) - R.id.headerThree -> MarkDownProvider.addHeader(editText, 3) - R.id.bold -> MarkDownProvider.addBold(editText) - R.id.italic -> MarkDownProvider.addItalic(editText) - R.id.strikethrough -> MarkDownProvider.addStrikeThrough(editText) - R.id.numbered -> MarkDownProvider.addList(editText, "1.") - R.id.bullet -> MarkDownProvider.addList(editText, "-") - R.id.header -> MarkDownProvider.addDivider(editText) - R.id.code -> MarkDownProvider.addCode(editText) - R.id.quote -> MarkDownProvider.addQuote(editText) - R.id.checkbox -> MarkDownProvider.addList(editText, "- [x]") - R.id.unCheckbox -> MarkDownProvider.addList(editText, "- [ ]") - R.id.inlineCode -> MarkDownProvider.addInlinleCode(editText) - R.id.signature -> { - markdownListener?.getEditText()?.let { - if (!it.text.toString().contains(sentFromFastHub)) { - it.setText("${it.text}$sentFromFastHub") - } else { - it.setText(it.text.toString().replace(sentFromFastHub, "")) - } - editText.setSelection(it.text.length) - editText.requestFocus() - } - } - } - } - - fun onEmojiAdded(emoji: Emoji?) { - markdownListener?.getEditText()?.let { editText -> - ViewHelper.showKeyboard(editText) - emoji?.let { - MarkDownProvider.insertAtCursor(editText, ":${it.aliases[0]}:") - } - } - } - - interface MarkdownListener { - fun getEditText(): EditText - fun fragmentManager(): FragmentManager - fun getSavedText(): CharSequence? - } - - fun onAppendLink(title: String?, link: String?, isLink: Boolean) { - markdownListener?.let { - if (isLink) { - MarkDownProvider.addLink(it.getEditText(), InputHelper.toString(title), InputHelper.toString(link)) - } else { - MarkDownProvider.addPhoto(it.getEditText(), InputHelper.toString(title), InputHelper.toString(link)) - } - } - } - - private fun getSelectedText(): String? { - markdownListener?.getEditText()?.let { - if (!it.text.toString().isBlank()) { - val selectionStart = it.selectionStart - val selectionEnd = it.selectionEnd - return it.text.toString().substring(selectionStart, selectionEnd) - } - } - return null - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/widgets/markdown/MarkdownEditText.kt b/app/src/main/java/com/fastaccess/ui/widgets/markdown/MarkdownEditText.kt deleted file mode 100644 index f5773defa..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/markdown/MarkdownEditText.kt +++ /dev/null @@ -1,111 +0,0 @@ -package com.fastaccess.ui.widgets.markdown - -import android.annotation.SuppressLint -import android.content.Context -import android.util.AttributeSet -import android.view.View -import android.widget.ArrayAdapter -import android.widget.ListView -import android.widget.TextView -import com.crashlytics.android.Crashlytics -import com.fastaccess.ui.widgets.FontEditText -import java.util.* - - -/** - * Created by kosh on 14/08/2017. - */ -class MarkdownEditText : FontEditText { - - var savedText: CharSequence? = "" - private var mention: ListView? = null - private var listDivider: View? = null - private var inMentionMode = -1 - private var participants: ArrayList? = null - - constructor(context: Context) : super(context) - constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) - constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) - - fun initListView(mention: ListView?, listDivider: View?, participants: ArrayList?) { - this.mention = mention - this.listDivider = listDivider - this.participants = participants - this.participants?.let { - mention?.setOnItemClickListener { _, _, position, _ -> - try { - if (inMentionMode != -1) { - val complete = mention.adapter.getItem(position).toString() + " " - val end = selectionEnd - text?.replace(inMentionMode, end, complete, 0, complete.length) - inMentionMode = -1 - } - } catch (ignored: Exception) { - } - mention.visibility = GONE - listDivider?.visibility = GONE - } - } - } - - override fun onTextChanged(text: CharSequence?, start: Int, lengthBefore: Int, lengthAfter: Int) { - super.onTextChanged(text, start, lengthBefore, lengthAfter) - if (isEnabled) { - savedText = text - text?.let { - mention(it) - } - } - } - - fun mention(charSequence: CharSequence) { - try { - var lastChar: Char = 0.toChar() - if (charSequence.isNotEmpty()) lastChar = charSequence[charSequence.length - 1] - if (lastChar.toInt() != 0) { - if (lastChar == '@') { - inMentionMode = selectionEnd - mention?.visibility = GONE - listDivider?.visibility = GONE - return - } else if (lastChar == ' ') - inMentionMode = -1 - else if (inMentionMode > -1) - updateMentionList(charSequence.toString().substring(inMentionMode, selectionEnd)) - else { - val copy = text.toString().substring(0, selectionEnd) - val list = copy.split("\\s+".toRegex()) - val last = list[list.size - 1] - if (last.startsWith("@")) { - inMentionMode = copy.lastIndexOf("@") + 1 - updateMentionList(charSequence.toString().substring(inMentionMode, selectionEnd)) - } - } - } else { - inMentionMode = -1 - } - if (inMentionMode > -1) mention?.let { - it.visibility = if (inMentionMode > 0) View.VISIBLE else GONE - listDivider!!.visibility = it.visibility - } - } catch (ignored: Exception) { - } - } - - private fun updateMentionList(mentioning: String) { - participants?.let { - val mentions = it.filter { - it.toLowerCase(Locale.getDefault()) - .startsWith( - mentioning.replace("@", "").toLowerCase(Locale.getDefault()) - ) - } - val adapter = ArrayAdapter( - context, android.R.layout.simple_list_item_1, - android.R.id.text1, mentions.subList(0, Math.min(mentions.size, 3)) - ) - mention?.setAdapter(adapter) - } - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/BaseRecyclerAdapter.java b/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/BaseRecyclerAdapter.java deleted file mode 100644 index 405d46365..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/BaseRecyclerAdapter.java +++ /dev/null @@ -1,270 +0,0 @@ -package com.fastaccess.ui.widgets.recyclerview; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.recyclerview.widget.GridLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import androidx.recyclerview.widget.StaggeredGridLayoutManager; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.helper.AnimHelper; -import com.fastaccess.helper.PrefGetter; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Kosh on 17 May 2016, 7:10 PM - */ -public abstract class BaseRecyclerAdapter> extends RecyclerView.Adapter { - - private final static int PROGRESS_TYPE = 2017; - - @NonNull private List data; - @Nullable private P listener; - private int lastKnowingPosition = -1; - private boolean enableAnimation = PrefGetter.isRVAnimationEnabled(); - private boolean showedGuide; - private GuideListener guideListener; - private boolean progressAdded; - private int rowWidth; - - protected BaseRecyclerAdapter() { - this(new ArrayList<>()); - } - - protected BaseRecyclerAdapter(@NonNull List data) { - this(data, null); - } - - protected BaseRecyclerAdapter(@NonNull List data, @Nullable P listener) { - this.data = data; - this.listener = listener; - } - - protected BaseRecyclerAdapter(@Nullable P listener) { - this(new ArrayList<>(), listener); - } - - protected abstract VH viewHolder(ViewGroup parent, int viewType); - - protected abstract void onBindView(VH holder, int position); - - @NonNull public List getData() { - return data; - } - - public M getItemByPosition(int position) { - return data.get(position); - } - - public M getItem(int position) { - return data.get(position); - } - - public int getItem(M t) { - return data.indexOf(t); - } - - @SuppressWarnings("unchecked") @Override public VH onCreateViewHolder(ViewGroup parent, int viewType) { - if (viewType == PROGRESS_TYPE) { - addSpanLookup(parent); - return (VH) ProgressBarViewHolder.newInstance(parent); - } else { - return viewHolder(parent, viewType); - } - } - - @Override public void onBindViewHolder(@NonNull VH holder, int position) { - if (holder instanceof ProgressBarViewHolder) { - if (holder.itemView.getLayoutParams() instanceof StaggeredGridLayoutManager.LayoutParams) { - StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) holder.itemView.getLayoutParams(); - layoutParams.setFullSpan(true); - } - } else if (getItem(position) != null) { - animate(holder, position); - onBindView(holder, position); - onShowGuide(holder, position); - } - } - - @Override public int getItemViewType(int position) { - if (getItem(position) == null) { - return PROGRESS_TYPE; - } - return super.getItemViewType(position); - } - - @Override public int getItemCount() { - return data.size(); - } - - @SuppressWarnings("unchecked") - private void onShowGuide(@NonNull VH holder, int position) {// give the flexibility to other adapters to override this - if (position == 0 && !isShowedGuide() && guideListener != null) { - guideListener.onShowGuide(holder.itemView, getItem(position)); - showedGuide = true; - } - } - - private void animate(@NonNull VH holder, int position) { - if (isEnableAnimation() && position > lastKnowingPosition) { - AnimHelper.startBeatsAnimation(holder.itemView); - lastKnowingPosition = position; - } - } - - public void insertItems(@NonNull List items) { - data.clear(); - data.addAll(items); - notifyDataSetChanged(); - progressAdded = false; - } - - public void addItem(M item, int position) { - data.add(position, item); - notifyItemInserted(position); - } - - public void addItem(M item) { - removeProgress(); - data.add(item); - if (data.size() == 0) { - notifyDataSetChanged(); - } else { - notifyItemInserted(data.size() - 1); - } - } - - @SuppressWarnings("WeakerAccess") public void addItems(@NonNull List items) { - removeProgress(); - data.addAll(items); - notifyItemRangeInserted(getItemCount(), (getItemCount() + items.size()) - 1); - } - - @SuppressWarnings("WeakerAccess") public void removeItem(int position) { - data.remove(position); - notifyItemRemoved(position); - } - - public void removeItem(M item) { - int position = data.indexOf(item); - if (position != -1) removeItem(position); - } - - public void removeItems(@NonNull List items) { - int prevSize = getItemCount(); - data.removeAll(items); - notifyItemRangeRemoved(prevSize, Math.abs(data.size() - prevSize)); - } - - public void swapItem(@NonNull M model) { - int index = getItem(model); - swapItem(model, index); - } - - public void swapItem(@NonNull M model, int position) { - if (position != -1) { - data.set(position, model); - notifyItemChanged(position); - } - } - - public void subList(int fromPosition, int toPosition) { - if (data.isEmpty()) return; - data.subList(fromPosition, toPosition).clear(); - notifyItemRangeRemoved(fromPosition, toPosition); - } - - public void clear() { - progressAdded = false; - data.clear(); - notifyDataSetChanged(); - } - - public boolean isEmpty() { - return data.isEmpty(); - } - - public void setEnableAnimation(boolean enableAnimation) { - this.enableAnimation = enableAnimation; - notifyDataSetChanged(); - } - - @SuppressWarnings("WeakerAccess") public boolean isEnableAnimation() { - return enableAnimation; - } - - @SuppressWarnings("WeakerAccess") @Nullable public P getListener() { - return listener; - } - - public void setListener(@Nullable P listener) { - this.listener = listener; - notifyDataSetChanged(); - } - - public void setGuideListener(GuideListener guideListener) { - this.guideListener = guideListener; - } - - public int getRowWidth() { - return rowWidth; - } - - public void setRowWidth(int rowWidth) { - if (this.rowWidth == 0) { - this.rowWidth = rowWidth; - notifyDataSetChanged(); - } - } - - private boolean isShowedGuide() { - return showedGuide; - } - - @Override public void onViewDetachedFromWindow(VH holder) { - holder.onViewIsDetaching(); - super.onViewDetachedFromWindow(holder); - } - - public void addProgress() { - if (!progressAdded && !isEmpty()) { - addItem(null); - progressAdded = true; - } - } - - public boolean isProgressAdded() { - return progressAdded; - } - - private void removeProgress() { - if (!isEmpty()) { - M m = getItem(getItemCount() - 1); - if (m == null) { - removeItem(getItemCount() - 1); - } - progressAdded = false; - } - } - - private void addSpanLookup(ViewGroup parent) { - if (parent instanceof RecyclerView) { - if (((RecyclerView) parent).getLayoutManager() instanceof GridLayoutManager) { - GridLayoutManager layoutManager = ((GridLayoutManager) ((RecyclerView) parent).getLayoutManager()); - layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { - @Override public int getSpanSize(int position) { - return getItemViewType(position) == PROGRESS_TYPE ? layoutManager.getSpanCount() : 1; - } - }); - } - } - } - - public interface GuideListener { - void onShowGuide(@NonNull View itemView, @NonNull M model); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/BaseViewHolder.java b/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/BaseViewHolder.java deleted file mode 100644 index 80a3e5d49..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/BaseViewHolder.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.fastaccess.ui.widgets.recyclerview; - -import androidx.annotation.LayoutRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.recyclerview.widget.RecyclerView; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import butterknife.ButterKnife; - -/** - * Created by Kosh on 17 May 2016, 7:13 PM - */ -public abstract class BaseViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener { - - public interface OnItemClickListener { - void onItemClick(int position, View v, T item); - - void onItemLongClick(int position, View v, T item); - } - - @Nullable protected final BaseRecyclerAdapter adapter; - - public static View getView(@NonNull ViewGroup parent, @LayoutRes int layoutRes) { - return LayoutInflater.from(parent.getContext()).inflate(layoutRes, parent, false); - } - - protected BaseViewHolder(@NonNull View itemView) { - this(itemView, null); - } - - public BaseViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter) { - super(itemView); - ButterKnife.bind(this, itemView); - this.adapter = adapter; - itemView.setOnClickListener(this); - itemView.setOnLongClickListener(this); - } - - @SuppressWarnings("unchecked") @Override public void onClick(View v) { - if (adapter != null && adapter.getListener() != null) { - int position = getAdapterPosition(); - if (position != RecyclerView.NO_POSITION && position < adapter.getItemCount()) - adapter.getListener().onItemClick(position, v, adapter.getItem(position)); - } - } - - @SuppressWarnings("unchecked") @Override public boolean onLongClick(View v) { - if (adapter != null && adapter.getListener() != null) { - int position = getAdapterPosition(); - if (position != RecyclerView.NO_POSITION && position < adapter.getItemCount()) - adapter.getListener().onItemLongClick(position, v, adapter.getItem(position)); - } - return true; - } - - public abstract void bind(@NonNull T t); - - protected void onViewIsDetaching() {} - -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/BottomPaddingDecoration.java b/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/BottomPaddingDecoration.java deleted file mode 100644 index f64b5560e..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/BottomPaddingDecoration.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.fastaccess.ui.widgets.recyclerview; - -import android.content.Context; -import android.graphics.Rect; -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.GridLayoutManager; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import androidx.recyclerview.widget.StaggeredGridLayoutManager; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.helper.ViewHelper; - -class BottomPaddingDecoration extends RecyclerView.ItemDecoration { - private final int bottomPadding; - - private BottomPaddingDecoration(int bottomOffset) { - bottomPadding = bottomOffset; - } - - private BottomPaddingDecoration(@NonNull Context context) { - this(ViewHelper.toPx(context, context.getResources().getDimensionPixelSize(R.dimen.fab_spacing))); - } - - public static BottomPaddingDecoration with(int bottomPadding) { - return new BottomPaddingDecoration(bottomPadding); - } - - public static BottomPaddingDecoration with(@NonNull Context context) { - return new BottomPaddingDecoration(context); - } - - @Override public void getItemOffsets(@NonNull Rect outRect, View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { - super.getItemOffsets(outRect, view, parent, state); - int dataSize = state.getItemCount(); - int position = parent.getChildAdapterPosition(view); - if (parent.getLayoutManager() instanceof GridLayoutManager) { - GridLayoutManager grid = (GridLayoutManager) parent.getLayoutManager(); - if ((dataSize - position) <= grid.getSpanCount()) { - outRect.set(0, 0, 0, bottomPadding); - } else { - outRect.set(0, 0, 0, 0); - } - } else if (parent.getLayoutManager() instanceof LinearLayoutManager) { - if (dataSize > 0 && position == dataSize - 1) { - outRect.set(0, 0, 0, bottomPadding); - } else { - outRect.set(0, 0, 0, 0); - } - } else if (parent.getLayoutManager() instanceof StaggeredGridLayoutManager) { - StaggeredGridLayoutManager grid = (StaggeredGridLayoutManager) parent.getLayoutManager(); - if ((dataSize - position) <= grid.getSpanCount()) { - outRect.set(0, 0, 0, bottomPadding); - } else { - outRect.set(0, 0, 0, 0); - } - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/DynamicRecyclerView.java b/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/DynamicRecyclerView.java deleted file mode 100644 index 29b31c041..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/DynamicRecyclerView.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.fastaccess.ui.widgets.recyclerview; - -import android.content.Context; -import android.content.res.Resources; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.recyclerview.widget.GridLayoutManager; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import androidx.recyclerview.widget.StaggeredGridLayoutManager; -import android.util.AttributeSet; -import android.view.View; - -import com.fastaccess.R; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.ui.widgets.StateLayout; - - -/** - * Created by Kosh on 9/24/2015. copyrights are reserved - *

- * recyclerview which will showParentOrSelf/showParentOrSelf itself base on adapter - */ -public class DynamicRecyclerView extends RecyclerView { - - private StateLayout emptyView; - @Nullable private View parentView; - private BottomPaddingDecoration bottomPaddingDecoration; - - @NonNull private AdapterDataObserver observer = new AdapterDataObserver() { - @Override public void onChanged() { - showEmptyView(); - } - - @Override public void onItemRangeInserted(int positionStart, int itemCount) { - super.onItemRangeInserted(positionStart, itemCount); - showEmptyView(); - } - - @Override public void onItemRangeRemoved(int positionStart, int itemCount) { - super.onItemRangeRemoved(positionStart, itemCount); - showEmptyView(); - } - }; - - public DynamicRecyclerView(@NonNull Context context) { - this(context, null); - } - - public DynamicRecyclerView(@NonNull Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public DynamicRecyclerView(@NonNull Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - @Override public void setAdapter(@Nullable Adapter adapter) { - super.setAdapter(adapter); - if (isInEditMode()) return; - if (adapter != null) { - adapter.registerAdapterDataObserver(observer); - observer.onChanged(); - } - } - - - public void removeBottomDecoration() { - if (bottomPaddingDecoration != null) { - removeItemDecoration(bottomPaddingDecoration); - bottomPaddingDecoration = null; - } - } - - public void addDecoration() { - bottomPaddingDecoration = BottomPaddingDecoration.with(getContext()); - addItemDecoration(bottomPaddingDecoration); - } - - private void showEmptyView() { - Adapter adapter = getAdapter(); - if (adapter != null) { - if (emptyView != null) { - if (adapter.getItemCount() == 0) { - showParentOrSelf(false); - } else { - showParentOrSelf(true); - } - } - } else { - if (emptyView != null) { - showParentOrSelf(false); - } - } - } - - private void showParentOrSelf(boolean showRecyclerView) { - if (parentView != null) - parentView.setVisibility(VISIBLE); - setVisibility(VISIBLE); - emptyView.setVisibility(!showRecyclerView ? VISIBLE : GONE); - } - - public void setEmptyView(@NonNull StateLayout emptyView, @Nullable View parentView) { - this.emptyView = emptyView; - this.parentView = parentView; - showEmptyView(); - } - - public void setEmptyView(@NonNull StateLayout emptyView) { - setEmptyView(emptyView, null); - } - - public void hideProgress(@NonNull StateLayout view) { - view.hideProgress(); - } - - public void showProgress(@NonNull StateLayout view) { - view.showProgress(); - } - - public void addKeyLineDivider() { - if (canAddDivider()) { - Resources resources = getResources(); - addItemDecoration(new InsetDividerDecoration(resources.getDimensionPixelSize(R.dimen.divider_height), - resources.getDimensionPixelSize(R.dimen.keyline_2), ViewHelper.getListDivider(getContext()))); - } - } - - public void addDivider() { - if (canAddDivider()) { - Resources resources = getResources(); - addItemDecoration(new InsetDividerDecoration(resources.getDimensionPixelSize(R.dimen.divider_height), 0, - ViewHelper.getListDivider(getContext()))); - } - } - - public void addNormalSpacingDivider() { - addDivider(); - } - - public void addDivider(@NonNull Class toDivide) { - if (canAddDivider()) { - Resources resources = getResources(); - addItemDecoration(new InsetDividerDecoration(resources.getDimensionPixelSize(R.dimen.divider_height), 0, - ViewHelper.getListDivider(getContext()), toDivide)); - } - } - - private boolean canAddDivider() { - if (getLayoutManager() != null) { - if (getLayoutManager() instanceof GridLayoutManager) { - return ((GridLayoutManager) getLayoutManager()).getSpanCount() == 1; - } else if (getLayoutManager() instanceof LinearLayoutManager) { - return true; - } else if (getLayoutManager() instanceof StaggeredGridLayoutManager) { - return ((StaggeredGridLayoutManager) getLayoutManager()).getSpanCount() == 1; - } - } - return false; - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/InsetDividerDecoration.java b/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/InsetDividerDecoration.java deleted file mode 100644 index 17677ee72..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/InsetDividerDecoration.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.fastaccess.ui.widgets.recyclerview; - -import android.graphics.Canvas; -import android.graphics.Paint; -import androidx.annotation.ColorInt; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.recyclerview.widget.RecyclerView; -import android.view.View; - -/** - * A decoration which draws a horizontal divider between {@link RecyclerView.ViewHolder}s of a given - * type; with a left inset. - * this class adopted from Plaid - */ -class InsetDividerDecoration extends RecyclerView.ItemDecoration { - - @NonNull private final Paint paint; - private final int inset; - private final int height; - private final Class toDivide; - - InsetDividerDecoration(int divider, int leftInset, @ColorInt int dividerColor) { - this(divider, leftInset, dividerColor, null); - } - - InsetDividerDecoration(int divider, int leftInset, @ColorInt int dividerColor, @Nullable Class toDivide) { - this.inset = leftInset; - this.height = divider; - this.paint = new Paint(); - this.paint.setColor(dividerColor); - this.paint.setStyle(Paint.Style.STROKE); - this.paint.setStrokeWidth(divider); - this.toDivide = toDivide; - } - - @Override public void onDrawOver(@NonNull Canvas canvas, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { - int childCount = parent.getChildCount(); - if (childCount < 2) return; - RecyclerView.LayoutManager lm = parent.getLayoutManager(); - float[] lines = new float[childCount * 4]; - boolean hasDividers = false; - for (int i = 0; i < childCount; i++) { - View child = parent.getChildAt(i); - RecyclerView.ViewHolder viewHolder = parent.getChildViewHolder(child); - if (!(viewHolder instanceof ProgressBarViewHolder)) { - boolean canDivide = toDivide == null || viewHolder.getClass() == toDivide; - if (canDivide) { - int position = parent.getChildAdapterPosition(child); - if (child.isActivated() || (i + 1 < childCount && parent.getChildAt(i + 1).isActivated())) { - continue; - } - if (position != (state.getItemCount() - 1)) { - lines[i * 4] = inset == 0 ? inset : inset + lm.getDecoratedLeft(child); - lines[(i * 4) + 2] = lm.getDecoratedRight(child); - int y = lm.getDecoratedBottom(child) + (int) child.getTranslationY() - height; - lines[(i * 4) + 1] = y; - lines[(i * 4) + 3] = y; - hasDividers = true; - } - } - } - } - if (hasDividers) { - canvas.drawLines(lines, paint); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/ProgressBarViewHolder.java b/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/ProgressBarViewHolder.java deleted file mode 100644 index 845cf9b21..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/ProgressBarViewHolder.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.fastaccess.ui.widgets.recyclerview; - -import androidx.annotation.NonNull; -import android.view.View; -import android.view.ViewGroup; - -import com.fastaccess.R; - -/** - * Created by kosh on 03/08/2017. - */ - -public class ProgressBarViewHolder extends BaseViewHolder { - - private ProgressBarViewHolder(@NonNull View itemView) { - super(itemView); - } - - public static ProgressBarViewHolder newInstance(ViewGroup viewGroup) { - return new ProgressBarViewHolder(getView(viewGroup, R.layout.progress_layout)); - } - - @Override public void bind(@NonNull Object o) { - - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/layout_manager/GridManager.java b/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/layout_manager/GridManager.java deleted file mode 100644 index 5da83d049..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/layout_manager/GridManager.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.fastaccess.ui.widgets.recyclerview.layout_manager; - -import android.content.Context; -import androidx.recyclerview.widget.GridLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import android.util.AttributeSet; - -/** - * Created by Kosh on 17 May 2016, 10:02 PM - */ -public class GridManager extends GridLayoutManager { - - private int iconSize; - - public GridManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - } - - public GridManager(Context context, int spanCount) { - super(context, spanCount); - } - - public GridManager(Context context, int spanCount, int orientation, boolean reverseLayout) { - super(context, spanCount, orientation, reverseLayout); - } - - @Override public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) { - try { - super.onLayoutChildren(recycler, state); - updateCount(); - } catch (Exception ignored) {} - } - - @Override public void onMeasure(RecyclerView.Recycler recycler, RecyclerView.State state, int widthSpec, int heightSpec) { - try { - super.onMeasure(recycler, state, widthSpec, heightSpec); - } catch (Exception ignored) {} - } - - private void updateCount() { - if (iconSize > 1) { - int spanCount = Math.max(1, getWidth() / iconSize); - if (spanCount < 1) { - spanCount = 1; - } - this.setSpanCount(spanCount); - } - } - - public int getIconSize() { - return iconSize; - } - - public void setIconSize(int iconSize) { - this.iconSize = iconSize; - updateCount(); - } -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/layout_manager/LinearManager.java b/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/layout_manager/LinearManager.java deleted file mode 100644 index 60806a83c..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/layout_manager/LinearManager.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fastaccess.ui.widgets.recyclerview.layout_manager; - -import android.content.Context; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import android.util.AttributeSet; - -/** - * Created by Kosh on 17 May 2016, 10:02 PM - */ -public class LinearManager extends LinearLayoutManager { - - public LinearManager(Context context) { - super(context); - } - - public LinearManager(Context context, int orientation, boolean reverseLayout) { - super(context, orientation, reverseLayout); - } - - public LinearManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - } - - @Override public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) { - try { - super.onLayoutChildren(recycler, state); - } catch (Exception ignored) {} - } - - @Override public void onMeasure(RecyclerView.Recycler recycler, RecyclerView.State state, int widthSpec, int heightSpec) { - try { - super.onMeasure(recycler, state, widthSpec, heightSpec); - } catch (Exception ignored) {} - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/layout_manager/StaggeredManager.java b/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/layout_manager/StaggeredManager.java deleted file mode 100644 index 0f866dda9..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/layout_manager/StaggeredManager.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.fastaccess.ui.widgets.recyclerview.layout_manager; - -import android.content.Context; -import androidx.recyclerview.widget.RecyclerView; -import androidx.recyclerview.widget.StaggeredGridLayoutManager; -import android.util.AttributeSet; - -/** - * Created by Kosh on 17 May 2016, 10:02 PM - */ -public class StaggeredManager extends StaggeredGridLayoutManager { - - public StaggeredManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - } - - public StaggeredManager(int spanCount, int orientation) { - super(spanCount, orientation); - } - - @Override public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) { - try { - super.onLayoutChildren(recycler, state); - } catch (Exception ignored) {} - } - - @Override public void onMeasure(RecyclerView.Recycler recycler, RecyclerView.State state, int widthSpec, int heightSpec) { - try { - super.onMeasure(recycler, state, widthSpec, heightSpec); - } catch (Exception ignored) {} - } - -} diff --git a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/scroll/InfiniteScroll.java b/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/scroll/InfiniteScroll.java deleted file mode 100644 index c197ce476..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/scroll/InfiniteScroll.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.fastaccess.ui.widgets.recyclerview.scroll; - -import androidx.recyclerview.widget.GridLayoutManager; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import androidx.recyclerview.widget.StaggeredGridLayoutManager; - -import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter; - -/** - * Created by Kosh on 8/2/2015. copyrights are reserved @ - */ -public abstract class InfiniteScroll extends RecyclerView.OnScrollListener { - private int visibleThreshold = 3; - private int currentPage = 0; - private int previousTotalItemCount = 0; - private boolean loading = true; - private int startingPageIndex = 0; - private RecyclerView.LayoutManager layoutManager; - private BaseRecyclerAdapter adapter; - private boolean newlyAdded = true; - - public InfiniteScroll() {} - - private void initLayoutManager(RecyclerView.LayoutManager layoutManager) { - this.layoutManager = layoutManager; - if (layoutManager instanceof GridLayoutManager) { - visibleThreshold = visibleThreshold * ((GridLayoutManager) layoutManager).getSpanCount(); - } else if (layoutManager instanceof StaggeredGridLayoutManager) { - visibleThreshold = visibleThreshold * ((StaggeredGridLayoutManager) layoutManager).getSpanCount(); - } - } - - private int getLastVisibleItem(int[] lastVisibleItemPositions) { - int maxSize = 0; - for (int i = 0; i < lastVisibleItemPositions.length; i++) { - if (i == 0) { - maxSize = lastVisibleItemPositions[i]; - } else if (lastVisibleItemPositions[i] > maxSize) { - maxSize = lastVisibleItemPositions[i]; - } - } - return maxSize; - } - - @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { - if (newlyAdded) { - newlyAdded = false; - return; - } - onScrolled(dy > 0); - if (layoutManager == null) { - initLayoutManager(recyclerView.getLayoutManager()); - } - if (adapter == null) { - if (recyclerView.getAdapter() instanceof BaseRecyclerAdapter) { - adapter = (BaseRecyclerAdapter) recyclerView.getAdapter(); - } - } - if (adapter != null && adapter.isProgressAdded()) return; - - int lastVisibleItemPosition = 0; - int totalItemCount = layoutManager.getItemCount(); - if (layoutManager instanceof StaggeredGridLayoutManager) { - int[] lastVisibleItemPositions = ((StaggeredGridLayoutManager) layoutManager).findLastVisibleItemPositions(null); - lastVisibleItemPosition = getLastVisibleItem(lastVisibleItemPositions); - } else if (layoutManager instanceof GridLayoutManager) { - lastVisibleItemPosition = ((GridLayoutManager) layoutManager).findLastVisibleItemPosition(); - } else if (layoutManager instanceof LinearLayoutManager) { - lastVisibleItemPosition = ((LinearLayoutManager) layoutManager).findLastVisibleItemPosition(); - } - if (totalItemCount < previousTotalItemCount) { - this.currentPage = this.startingPageIndex; - this.previousTotalItemCount = totalItemCount; - if (totalItemCount == 0) { - this.loading = true; - } - } - if (loading && (totalItemCount > previousTotalItemCount)) { - loading = false; - previousTotalItemCount = totalItemCount; - } - if (!loading && (lastVisibleItemPosition + visibleThreshold) > totalItemCount) { - currentPage++; - boolean isCallingApi = onLoadMore(currentPage, totalItemCount); - loading = true; - if (adapter != null && isCallingApi) { - adapter.addProgress(); - } - } - } - - public void reset() { - this.currentPage = this.startingPageIndex; - this.previousTotalItemCount = 0; - this.loading = true; - } - - public void initialize(int page, int previousTotal) { - this.currentPage = page; - this.previousTotalItemCount = previousTotal; - this.loading = true; - } - - public abstract boolean onLoadMore(int page, int totalItemsCount); - - public void onScrolled(boolean isUp) {} - -} - diff --git a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/scroll/RecyclerViewFastScroller.java b/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/scroll/RecyclerViewFastScroller.java deleted file mode 100755 index a5a2842bc..000000000 --- a/app/src/main/java/com/fastaccess/ui/widgets/recyclerview/scroll/RecyclerViewFastScroller.java +++ /dev/null @@ -1,240 +0,0 @@ -package com.fastaccess.ui.widgets.recyclerview.scroll; - -import android.annotation.SuppressLint; -import android.app.Activity; -import android.content.Context; -import androidx.annotation.NonNull; -import com.google.android.material.appbar.AppBarLayout; -import androidx.recyclerview.widget.GridLayoutManager; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import androidx.recyclerview.widget.StaggeredGridLayoutManager; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.ViewTreeObserver; -import android.widget.FrameLayout; -import android.widget.ImageButton; -import android.widget.ImageView; - -import com.fastaccess.R; -import com.fastaccess.helper.ActivityHelper; -import com.fastaccess.helper.Logger; - -import it.sephiroth.android.library.bottomnavigation.BottomNavigation; - -public class RecyclerViewFastScroller extends FrameLayout { - - private static final int TRACK_SNAP_RANGE = 5; - private ImageView scrollerView; - private ImageButton scrollTop; - private int height; - private RecyclerView recyclerView; - private RecyclerView.LayoutManager layoutManager; - private AppBarLayout appBarLayout; - private BottomNavigation bottomNavigation; - private boolean toggled; - private boolean registeredObserver = false; - - public RecyclerViewFastScroller(Context context) { - super(context); - init(); - } - - public RecyclerViewFastScroller(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public RecyclerViewFastScroller(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - init(); - } - - @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { - super.onSizeChanged(w, h, oldw, oldh); - height = h; - } - - @SuppressLint("ClickableViewAccessibility") @Override public boolean onTouchEvent(@NonNull MotionEvent event) { - int action = event.getAction(); - switch (action) { - case MotionEvent.ACTION_DOWN: - if (event.getX() < (scrollerView.getX() - scrollerView.getPaddingStart())) return false; - scrollerView.setSelected(true); - hideAppbar(); - case MotionEvent.ACTION_MOVE: - float y = event.getY(); - setScrollerHeight(y); - setRecyclerViewPosition(y); - return true; - case MotionEvent.ACTION_UP: - case MotionEvent.ACTION_CANCEL: - scrollerView.setSelected(false); - showAppbar(); - return true; - } - return super.onTouchEvent(event); - } - - @Override protected void onDetachedFromWindow() { - if (recyclerView != null) { - recyclerView.removeOnScrollListener(onScrollListener); - safelyUnregisterObserver(); - } - appBarLayout = null; - bottomNavigation = null; - super.onDetachedFromWindow(); - } - - private void safelyUnregisterObserver() { - try {// rare case - if (registeredObserver && recyclerView.getAdapter() != null) { - recyclerView.getAdapter().unregisterAdapterDataObserver(observer); - } - } catch (Exception ignored) {} - } - - protected void init() { - setVisibility(GONE); - setClipChildren(false); - LayoutInflater inflater = LayoutInflater.from(getContext()); - inflater.inflate(R.layout.fastscroller_layout, this); - scrollerView = findViewById(R.id.fast_scroller_handle); - setVisibility(VISIBLE); - Activity activity = ActivityHelper.getActivity(getContext()); - if (activity != null) { - appBarLayout = activity.findViewById(R.id.appbar); - bottomNavigation = activity.findViewById(R.id.bottomNavigation); - } - } - - protected void hideAppbar() { - if (!toggled) { - if (appBarLayout != null) { - appBarLayout.setExpanded(false, true); - } - if (bottomNavigation != null) { - bottomNavigation.setExpanded(false, true); - } - toggled = true; - } - } - - protected void showAppbar() { - if (toggled) { - if (scrollerView.getY() == 0) { - if (appBarLayout != null) { - appBarLayout.setExpanded(true, true); - } - if (bottomNavigation != null) { - bottomNavigation.setExpanded(true, true); - } - toggled = false; - } - } - } - - public void attachRecyclerView(final RecyclerView recyclerView) { - if (this.recyclerView == null) { - this.recyclerView = recyclerView; - this.layoutManager = recyclerView.getLayoutManager(); - this.recyclerView.addOnScrollListener(onScrollListener); - if (recyclerView.getAdapter() != null && !registeredObserver) { - recyclerView.getAdapter().registerAdapterDataObserver(observer); - registeredObserver = true; - } - hideShow(); - initScrollHeight(); - } - } - - private void initScrollHeight() { - if (recyclerView.computeVerticalScrollOffset() == 0) { - this.recyclerView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { - @Override public boolean onPreDraw() { - RecyclerViewFastScroller.this.recyclerView.getViewTreeObserver().removeOnPreDrawListener(this); - iniHeight(); - return true; - } - }); - } else { - iniHeight(); - } - } - - protected void iniHeight() { - if (scrollerView.isSelected()) return; - int verticalScrollOffset = RecyclerViewFastScroller.this.recyclerView.computeVerticalScrollOffset(); - int verticalScrollRange = RecyclerViewFastScroller.this.computeVerticalScrollRange(); - float proportion = (float) verticalScrollOffset / ((float) verticalScrollRange - height); - setScrollerHeight(height * proportion); - } - - private void setRecyclerViewPosition(float y) { - Logger.e(y); - if (recyclerView != null) { - int itemCount = recyclerView.getAdapter().getItemCount(); - float proportion; - if (scrollerView.getY() == 0) { - proportion = 0f; - } else if (scrollerView.getY() + scrollerView.getHeight() >= height - TRACK_SNAP_RANGE) { - proportion = 1f; - } else { - proportion = y / (float) height; - } - int targetPos = getValueInRange(itemCount - 1, (int) (proportion * (float) itemCount)); - if (layoutManager instanceof StaggeredGridLayoutManager) { - ((StaggeredGridLayoutManager) layoutManager).scrollToPositionWithOffset(targetPos, 0); - } else if (layoutManager instanceof GridLayoutManager) { - ((GridLayoutManager) layoutManager).scrollToPositionWithOffset(targetPos, 0); - } else { - ((LinearLayoutManager) layoutManager).scrollToPositionWithOffset(targetPos, 0); - } - } - } - - private static int getValueInRange(int max, int value) { - return Math.min(Math.max(0, value), max); - } - - private void setScrollerHeight(float y) { - int handleHeight = scrollerView.getHeight(); - scrollerView.setY(getValueInRange(height - handleHeight, (int) (y - handleHeight / 2))); - } - - private final RecyclerView.OnScrollListener onScrollListener = new RecyclerView.OnScrollListener() { - @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { - if (scrollerView.isSelected()) return; - int verticalScrollOffset = recyclerView.computeVerticalScrollOffset(); - int verticalScrollRange = recyclerView.computeVerticalScrollRange(); - float proportion = (float) verticalScrollOffset / ((float) verticalScrollRange - height); - setScrollerHeight(height * proportion); - } - }; - - private final RecyclerView.AdapterDataObserver observer = new RecyclerView.AdapterDataObserver() { - @Override public void onItemRangeInserted(int positionStart, int itemCount) { - super.onItemRangeInserted(positionStart, itemCount); - hideShow(); - } - - @Override public void onItemRangeRemoved(int positionStart, int itemCount) { - super.onItemRangeRemoved(positionStart, itemCount); - hideShow(); - } - - @Override public void onChanged() { - super.onChanged(); - hideShow(); - - } - }; - - protected void hideShow() { - if (recyclerView != null && recyclerView.getAdapter() != null) { - setVisibility(recyclerView.getAdapter().getItemCount() > 10 ? VISIBLE : GONE); - } else { - setVisibility(GONE); - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/prettifier/pretty/NestedWebView.java b/app/src/main/java/com/prettifier/pretty/NestedWebView.java deleted file mode 100644 index 2d51d69d7..000000000 --- a/app/src/main/java/com/prettifier/pretty/NestedWebView.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.prettifier.pretty; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.os.Build; -import androidx.annotation.RequiresApi; -import androidx.core.view.MotionEventCompat; -import androidx.core.view.NestedScrollingChild; -import androidx.core.view.NestedScrollingChildHelper; -import androidx.core.view.ViewCompat; -import android.util.AttributeSet; -import android.view.MotionEvent; -import android.webkit.WebView; - -public class NestedWebView extends WebView implements NestedScrollingChild { - private int mLastY; - private final int[] mScrollOffset = new int[2]; - private final int[] mScrollConsumed = new int[2]; - private int mNestedOffsetY; - private NestedScrollingChildHelper mChildHelper; - private boolean firstScroll = true; - - - public NestedWebView(Context context) { - this(context, null); - } - - public NestedWebView(Context context, AttributeSet attrs) { - this(context, attrs, android.R.attr.webViewStyle); - } - - public NestedWebView(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - mChildHelper = new NestedScrollingChildHelper(this); - setNestedScrollingEnabled(true); - } - - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) - public NestedWebView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - } - - @SuppressLint("ClickableViewAccessibility") @Override public boolean onTouchEvent(MotionEvent ev) { - boolean returnValue; - MotionEvent event = MotionEvent.obtain(ev); - final int action = MotionEventCompat.getActionMasked(event); - if (action == MotionEvent.ACTION_DOWN) { - mNestedOffsetY = 0; - } - int eventY = (int) event.getY(); - event.offsetLocation(0, mNestedOffsetY); - switch (action) { - case MotionEvent.ACTION_MOVE: - int deltaY = mLastY - eventY; - // NestedPreScroll - if (dispatchNestedPreScroll(0, deltaY, mScrollConsumed, mScrollOffset)) { - deltaY -= mScrollConsumed[1]; - mLastY = eventY - mScrollOffset[1]; - event.offsetLocation(0, -mScrollOffset[1]); - mNestedOffsetY += mScrollOffset[1]; - } - returnValue = super.onTouchEvent(event); - - // NestedScroll - if (dispatchNestedScroll(0, mScrollOffset[1], 0, deltaY, mScrollOffset)) { - event.offsetLocation(0, mScrollOffset[1]); - mNestedOffsetY += mScrollOffset[1]; - mLastY -= mScrollOffset[1]; - } - break; - case MotionEvent.ACTION_DOWN: - returnValue = super.onTouchEvent(event); - if (firstScroll) { - mLastY = eventY - 5; - firstScroll = false; - } else { - mLastY = eventY; - } - startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL); - break; - default: - returnValue = super.onTouchEvent(event); - // end NestedScroll - stopNestedScroll(); - break; - } - return returnValue; - } - - @Override public void setNestedScrollingEnabled(boolean enabled) { - mChildHelper.setNestedScrollingEnabled(enabled); - } - - @Override public boolean isNestedScrollingEnabled() { - return mChildHelper.isNestedScrollingEnabled(); - } - - @Override public boolean startNestedScroll(int axes) { - return mChildHelper.startNestedScroll(axes); - } - - @Override public void stopNestedScroll() { - mChildHelper.stopNestedScroll(); - } - - @Override public boolean hasNestedScrollingParent() { - return mChildHelper.hasNestedScrollingParent(); - } - - @Override public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, - int[] offsetInWindow) { - return mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow); - } - - @Override public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow) { - return mChildHelper.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow); - } - - @Override public boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed) { - return mChildHelper.dispatchNestedFling(velocityX, velocityY, consumed); - } - - @Override public boolean dispatchNestedPreFling(float velocityX, float velocityY) { - return mChildHelper.dispatchNestedPreFling(velocityX, velocityY); - } - - - -} - diff --git a/app/src/main/java/com/prettifier/pretty/PrettifyWebView.java b/app/src/main/java/com/prettifier/pretty/PrettifyWebView.java deleted file mode 100644 index d7a8451fc..000000000 --- a/app/src/main/java/com/prettifier/pretty/PrettifyWebView.java +++ /dev/null @@ -1,269 +0,0 @@ -package com.prettifier.pretty; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.res.TypedArray; -import android.net.Uri; -import android.os.Build; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.util.AttributeSet; -import android.view.MotionEvent; -import android.view.View; -import android.webkit.WebChromeClient; -import android.webkit.WebResourceRequest; -import android.webkit.WebSettings; -import android.webkit.WebView; -import android.webkit.WebViewClient; - -import com.fastaccess.R; -import com.fastaccess.helper.AppHelper; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.Logger; -import com.fastaccess.helper.ViewHelper; -import com.fastaccess.provider.markdown.MarkDownProvider; -import com.fastaccess.provider.scheme.SchemeParser; -import com.fastaccess.ui.modules.code.CodeViewerActivity; -import com.prettifier.pretty.callback.MarkDownInterceptorInterface; -import com.prettifier.pretty.helper.GithubHelper; -import com.prettifier.pretty.helper.PrettifyHelper; - - -public class PrettifyWebView extends NestedWebView { - private OnContentChangedListener onContentChangedListener; - private boolean interceptTouch; - private boolean enableNestedScrolling; - - public interface OnContentChangedListener { - void onContentChanged(int progress); - - void onScrollChanged(boolean reachedTop, int scroll); - } - - public PrettifyWebView(Context context) { - super(context); - if (isInEditMode()) return; - initView(null); - } - - public PrettifyWebView(Context context, AttributeSet attrs) { - super(context, attrs); - initView(attrs); - } - - public PrettifyWebView(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(attrs); - } - - @Override public boolean onInterceptTouchEvent(MotionEvent p) { - return true; - } - - @SuppressLint("ClickableViewAccessibility") @Override public boolean onTouchEvent(MotionEvent event) { - if (getParent() != null) { - getParent().requestDisallowInterceptTouchEvent(interceptTouch); - } - return super.onTouchEvent(event); - } - - @SuppressLint("SetJavaScriptEnabled") private void initView(@Nullable AttributeSet attrs) { - if (isInEditMode()) return; - if (attrs != null) { - TypedArray tp = getContext().obtainStyledAttributes(attrs, R.styleable.PrettifyWebView); - try { - int color = tp.getColor(R.styleable.PrettifyWebView_webview_background, ViewHelper.getWindowBackground(getContext())); - setBackgroundColor(color); - } finally { - tp.recycle(); - } - } - setWebChromeClient(new ChromeClient()); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - setWebViewClient(new WebClient()); - } else { - setWebViewClient(new WebClientCompat()); - } - WebSettings settings = getSettings(); - settings.setJavaScriptEnabled(true); - settings.setAppCachePath(getContext().getCacheDir().getPath()); - settings.setAppCacheEnabled(true); - settings.setCacheMode(WebSettings.LOAD_NO_CACHE); - settings.setDefaultTextEncodingName("utf-8"); - settings.setLoadsImagesAutomatically(true); - settings.setBlockNetworkImage(false); - setOnLongClickListener((view) -> { - WebView.HitTestResult result = getHitTestResult(); - if (hitLinkResult(result) && !InputHelper.isEmpty(result.getExtra())) { - AppHelper.copyToClipboard(getContext(), result.getExtra()); - return true; - } - return false; - }); - } - - @Override protected void onScrollChanged(int l, int t, int oldl, int oldt) { - super.onScrollChanged(l, t, oldl, oldt); - if (onContentChangedListener != null) { - onContentChangedListener.onScrollChanged(t == 0, t); - } - } - - @Override protected void onDetachedFromWindow() { - onContentChangedListener = null; - super.onDetachedFromWindow(); - } - - private boolean hitLinkResult(WebView.HitTestResult result) { - return result.getType() == WebView.HitTestResult.SRC_ANCHOR_TYPE || result.getType() == HitTestResult.IMAGE_TYPE || - result.getType() == HitTestResult.SRC_IMAGE_ANCHOR_TYPE; - } - - public void setOnContentChangedListener(@NonNull OnContentChangedListener onContentChangedListener) { - this.onContentChangedListener = onContentChangedListener; - } - - public void setThemeSource(@NonNull String source, @Nullable String theme) { - if (!InputHelper.isEmpty(source)) { - WebSettings settings = getSettings(); - settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING); - setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); - settings.setSupportZoom(true); - settings.setBuiltInZoomControls(true); - settings.setDisplayZoomControls(false); - String page = PrettifyHelper.generateContent(source, theme); - loadCode(page); - } - } - - public void setSource(@NonNull String source, boolean wrap) { - if (!InputHelper.isEmpty(source)) { - WebSettings settings = getSettings(); - settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING); - setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); - settings.setSupportZoom(!wrap); - settings.setBuiltInZoomControls(!wrap); - if (!wrap) settings.setDisplayZoomControls(false); - String page = PrettifyHelper.generateContent(source, AppHelper.isNightMode(getResources()), wrap); - loadCode(page); - } - } - - private void loadCode(String page) { - post(() -> loadDataWithBaseURL("file:///android_asset/highlight/", page, "text/html", "utf-8", null)); - } - - public void scrollToLine(@NonNull String url) { - String[] lineNo = getLineNo(url); - if (lineNo != null && lineNo.length > 1) { - loadUrl("javascript:scrollToLineNumber('" + lineNo[0] + "', '" + lineNo[1] + "')"); - } else if (lineNo != null) { - loadUrl("javascript:scrollToLineNumber('" + lineNo[0] + "', '0')"); - } - } - - public static String[] getLineNo(@Nullable String url) { - String lineNo[] = null; - if (url != null) { - try { - Uri uri = Uri.parse(url); - String lineNumber = uri.getEncodedFragment(); - if (lineNumber != null) { - lineNo = lineNumber.replaceAll("L", "").split("-"); - } - } catch (Exception ignored) {} - } - return lineNo; - } - - public void setGithubContentWithReplace(@NonNull String source, @Nullable String baseUrl, boolean replace) { - setGithubContent(source, baseUrl, false); - addJavascriptInterface(new MarkDownInterceptorInterface(this, false), "Android"); - String page = GithubHelper.generateContent(getContext(), source, baseUrl, AppHelper.isNightMode(getResources()), false, replace); - post(() -> loadDataWithBaseURL("file:///android_asset/md/", page, "text/html", "utf-8", null)); - } - - public void setGithubContent(@NonNull String source, @Nullable String baseUrl, boolean toggleNestScrolling) { - setGithubContent(source, baseUrl, toggleNestScrolling, true); - } - - public void setWikiContent(@NonNull String source, @Nullable String baseUrl) { - addJavascriptInterface(new MarkDownInterceptorInterface(this, true), "Android"); - String page = GithubHelper.generateContent(getContext(), source, baseUrl, AppHelper.isNightMode(getResources()), AppHelper.isNightMode - (getResources()), true); - post(() -> loadDataWithBaseURL("file:///android_asset/md/", page, "text/html", "utf-8", null)); - } - - public void setGithubContent(@NonNull String source, @Nullable String baseUrl, boolean toggleNestScrolling, boolean enableBridge) { - if (enableBridge) addJavascriptInterface(new MarkDownInterceptorInterface(this, toggleNestScrolling), "Android"); - String page = GithubHelper.generateContent(getContext(), source, baseUrl, AppHelper.isNightMode(getResources()), - AppHelper.isNightMode(getResources()), false); - post(() -> loadDataWithBaseURL("file:///android_asset/md/", page, "text/html", "utf-8", null)); - } - - public void loadImage(@NonNull String url, boolean isSvg) { - WebSettings settings = getSettings(); - settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); - setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); - settings.setSupportZoom(true); - settings.setBuiltInZoomControls(true); - settings.setDisplayZoomControls(false); - String html; - if (isSvg) { - html = url; - } else { - html = "" + - ""; - } - Logger.e(html); - loadData(html, "text/html", null); - } - - public void setInterceptTouch(boolean interceptTouch) { - this.interceptTouch = interceptTouch; - } - - public void setEnableNestedScrolling(boolean enableNestedScrolling) { - if (this.enableNestedScrolling != enableNestedScrolling) { - setNestedScrollingEnabled(enableNestedScrolling); - this.enableNestedScrolling = enableNestedScrolling; - } - } - - private void startActivity(@Nullable Uri url) { - if (url == null) return; - if (MarkDownProvider.isImage(url.toString())) { - CodeViewerActivity.startActivity(getContext(), url.toString(), url.toString()); - } else { - String lastSegment = url.getEncodedFragment(); - if (lastSegment != null || url.toString().startsWith("#") || url.toString().indexOf('#') != -1) { - return; - } - SchemeParser.launchUri(getContext(), url, true); - } - } - - private class ChromeClient extends WebChromeClient { - @Override public void onProgressChanged(WebView view, int progress) { - super.onProgressChanged(view, progress); - if (onContentChangedListener != null) { - onContentChangedListener.onContentChanged(progress); - } - } - } - - private class WebClient extends WebViewClient { - @Override public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { - startActivity(request.getUrl()); - return true; - } - } - - private class WebClientCompat extends WebViewClient { - @SuppressWarnings("deprecation") @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { - startActivity(Uri.parse(url)); - return true; - } - - } -} \ No newline at end of file diff --git a/app/src/main/java/com/prettifier/pretty/callback/MarkDownInterceptorInterface.java b/app/src/main/java/com/prettifier/pretty/callback/MarkDownInterceptorInterface.java deleted file mode 100644 index 3a4f00f65..000000000 --- a/app/src/main/java/com/prettifier/pretty/callback/MarkDownInterceptorInterface.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.prettifier.pretty.callback; - -import android.webkit.JavascriptInterface; - -import com.prettifier.pretty.PrettifyWebView; - -/** - * Created by Kosh on 13 Dec 2016, 3:01 PM - */ - -public class MarkDownInterceptorInterface { - private PrettifyWebView prettifyWebView; - private boolean toggleNestScrolling; - - public MarkDownInterceptorInterface(PrettifyWebView prettifyWebView) { - this(prettifyWebView, false); - } - - public MarkDownInterceptorInterface(PrettifyWebView prettifyWebView, boolean toggleNestScrolling) { - this.prettifyWebView = prettifyWebView; - this.toggleNestScrolling = toggleNestScrolling; - } - - @JavascriptInterface public void startIntercept() { - if (prettifyWebView != null) { - prettifyWebView.setInterceptTouch(true); - if (toggleNestScrolling) prettifyWebView.setEnableNestedScrolling(false); - } - } - - @JavascriptInterface public void stopIntercept() { - if (prettifyWebView != null) { - prettifyWebView.setInterceptTouch(false); - if (toggleNestScrolling) prettifyWebView.setEnableNestedScrolling(true); - } - } -} diff --git a/app/src/main/java/com/prettifier/pretty/helper/CodeThemesHelper.java b/app/src/main/java/com/prettifier/pretty/helper/CodeThemesHelper.java deleted file mode 100644 index 87974e6f8..000000000 --- a/app/src/main/java/com/prettifier/pretty/helper/CodeThemesHelper.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.prettifier.pretty.helper; - -import androidx.annotation.NonNull; - -import com.annimon.stream.Stream; -import com.fastaccess.App; -import com.fastaccess.helper.InputHelper; -import com.fastaccess.helper.PrefGetter; - -import java.io.IOException; -import java.util.Collections; -import java.util.List; - -/** - * Created by Kosh on 21 Jun 2017, 1:44 PM - */ - -public class CodeThemesHelper { - - @NonNull public static List listThemes() { - try { - List list = Stream.of(App.getInstance().getAssets().list("highlight/styles/themes")) - .map(s -> "themes/" + s) - .toList(); - list.add(0, "prettify.css"); - list.add(1, "prettify_dark.css"); - return list; - } catch (IOException e) { - e.printStackTrace(); - } - return Collections.emptyList(); - } - - @NonNull public static String getTheme(boolean isDark) { - String theme = PrefGetter.getCodeTheme(); - if (InputHelper.isEmpty(theme) || !exists(theme)) { - return !isDark ? "prettify.css" : "prettify_dark.css"; - } - return theme; - } - - private static boolean exists(@NonNull String theme) { - return listThemes().contains(theme); - } - - - public static final String CODE_EXAMPLE = - "class ThemeCodeActivity : BaseActivity(), ThemeCodeMvp.View {\n" + - "\n" + - " val spinner: AppCompatSpinner by bindView(R.id.themesList)\n" + - " val webView: PrettifyWebView by bindView(R.id.webView)\n" + - " val progress: ProgressBar? by bindView(R.id.readmeLoader)\n" + - "\n" + - " override fun layout(): Int = R.layout.theme_code_layout\n" + - "\n" + - " override fun isTransparent(): Boolean = false\n" + - "\n" + - " override fun canBack(): Boolean = true\n" + - "\n" + - " override fun isSecured(): Boolean = false\n" + - "\n" + - " override fun providePresenter(): ThemeCodePresenter = ThemeCodePresenter()\n" + - "\n" + - " @OnClick(R.id.done) fun onSaveTheme() {\n" + - " val theme = spinner.selectedItem as String\n" + - " PrefGetter.setCodeTheme(theme)\n" + - " setResult(Activity.RESULT_OK)\n" + - " finish()\n" + - " }\n" + - "\n" + - " override fun onInitAdapter(list: List) {\n" + - " spinner.adapter = ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item, list)\n" + - " }\n" + - "\n" + - " @OnItemSelected(R.id.themesList) fun onItemSelect() {\n" + - " val theme = spinner.selectedItem as String\n" + - " webView.setThemeSource(CodeThemesHelper.CODE_EXAMPLE, theme)\n" + - " }\n" + - "\n" + - "\n" + - " override fun onCreate(savedInstanceState: Bundle?) {\n" + - " super.onCreate(savedInstanceState)\n" + - " progress?.visibility = View.VISIBLE\n" + - " webView.setOnContentChangedListener(this)\n" + - " title = \"\"\n" + - " presenter.onLoadThemes()\n" + - " }\n" + - "\n" + - " override fun onContentChanged(p: Int) {\n" + - " progress?.let {\n" + - " it.progress = p\n" + - " if (p == 100) it.visibility = View.GONE\n" + - " }\n" + - " }\n" + - "\n" + - " override fun onScrollChanged(reachedTop: Boolean, scroll: Int) {}\n" + - "}"; -} diff --git a/app/src/main/java/com/prettifier/pretty/helper/GithubHelper.java b/app/src/main/java/com/prettifier/pretty/helper/GithubHelper.java deleted file mode 100644 index 73859e428..000000000 --- a/app/src/main/java/com/prettifier/pretty/helper/GithubHelper.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.prettifier.pretty.helper; - -import android.content.Context; -import android.net.Uri; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.fastaccess.data.dao.NameParser; -import com.fastaccess.helper.PrefGetter; -import com.fastaccess.helper.ViewHelper; - -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; -import org.jsoup.nodes.Element; -import org.jsoup.select.Elements; - -import java.util.ArrayList; - -/** - * Created by Kosh on 25 Dec 2016, 9:12 PM - */ - -public class GithubHelper { - - @NonNull public static String generateContent(@NonNull Context context, @NonNull String source, - @Nullable String baseUrl, boolean dark, - boolean isWiki, boolean replace) { - if (baseUrl == null) { - return mergeContent(context, Jsoup.parse(source).html(), dark); - } else { - return mergeContent(context, parseReadme(source, baseUrl, isWiki), dark); - } - } - - @NonNull private static String parseReadme(@NonNull String source, @NonNull String baseUrl, boolean isWiki) { - NameParser nameParser = new NameParser(baseUrl); - String owner = nameParser.getUsername(); - String repoName = nameParser.getName(); - Uri uri = Uri.parse(baseUrl); - ArrayList paths = new ArrayList<>(uri.getPathSegments()); - StringBuilder builder = new StringBuilder(); - builder.append(owner).append("/").append(repoName).append("/"); - boolean containsMaster = paths.size() > 3; - if (!containsMaster) { - builder.append("master/"); - } else { - paths.remove("blob"); - } - paths.remove(owner); - paths.remove(repoName); - for (String path : paths) { - if (!path.equalsIgnoreCase(uri.getLastPathSegment())) { - builder.append(path).append("/"); - } - } - String baseLinkUrl = !isWiki ? getLinkBaseUrl(baseUrl) : baseUrl; - return getParsedHtml(source, owner, repoName, !isWiki ? builder.toString() : baseUrl, baseLinkUrl, isWiki); - } - - @NonNull private static String getParsedHtml(@NonNull String source, String owner, String repoName, - String builder, String baseLinkUrl, boolean isWiki) { - Document document = Jsoup.parse(source, ""); - Elements imageElements = document.getElementsByTag("img"); - if (imageElements != null && !imageElements.isEmpty()) { - for (Element element : imageElements) { - String src = element.attr("src"); - if (src != null && !(src.startsWith("http://") || src.startsWith("https://"))) { - String finalSrc; - if (src.startsWith("/" + owner + "/" + repoName)) { - finalSrc = "https://raw.githubusercontent.com/" + src; - } else { - finalSrc = "https://raw.githubusercontent.com/" + builder + src; - } - element.attr("src", finalSrc); - } - } - } - Elements linkElements = document.getElementsByTag("a"); - if (linkElements != null && !linkElements.isEmpty()) { - for (Element element : linkElements) { - String href = element.attr("href"); - if (href.startsWith("#") || href.startsWith("http://") || href.startsWith("https://") || href.startsWith("mailto:")) { - continue; - } - element.attr("href", baseLinkUrl + (isWiki && href.startsWith("wiki") - ? href.replaceFirst("wiki", "") : href)); - } - } - return document.html(); - } - - @NonNull private static String getLinkBaseUrl(@NonNull String baseUrl) { - NameParser nameParser = new NameParser(baseUrl); - String owner = nameParser.getUsername(); - String repoName = nameParser.getName(); - Uri uri = Uri.parse(baseUrl); - ArrayList paths = new ArrayList<>(uri.getPathSegments()); - StringBuilder builder = new StringBuilder(); - builder.append("https://").append(uri.getAuthority()).append("/").append(owner).append("/").append(repoName).append("/"); - boolean containsMaster = paths.size() > 3 && paths.get(2).equalsIgnoreCase("blob"); - if (!containsMaster) { - builder.append("blob/master/"); - } - paths.remove(owner); - paths.remove(repoName); - for (String path : paths) { - if (!path.equalsIgnoreCase(uri.getLastPathSegment())) { - builder.append(path).append("/"); - } - } - return builder.toString(); - } - - @NonNull private static String mergeContent(@NonNull Context context, @NonNull String source, boolean dark) { - return "\n" + - "\n" + - "\n" + - " \n" + - " " + - " \n" + - "\n" + getCodeStyle(context, dark) + "\n" + - " \n" + - "\n" + - "\n" + - "\n" + source + - "\n\n" + - "\n" + - "\n" + - "\n"; - } - - @NonNull private static String getStyle(boolean dark) { - return dark ? "./github_dark.css" : "./github.css"; - } - - @NonNull private static String getCodeStyle(@NonNull Context context, boolean isDark) { - if (!isDark) return ""; - String primaryColor = getCodeBackgroundColor(context); - String accentColor = "#" + Integer.toHexString(ViewHelper.getAccentColor(context)).substring(2).toUpperCase(); - return ""; - } - - @NonNull private static String getCodeBackgroundColor(@NonNull Context context) { - @PrefGetter.ThemeType int themeType = PrefGetter.getThemeType(); - if (themeType == PrefGetter.BLUISH) { - return "#" + Integer.toHexString(ViewHelper.getPrimaryDarkColor(context)).substring(2).toUpperCase(); - } - return "#" + Integer.toHexString(ViewHelper.getPrimaryColor(context)).substring(2).toUpperCase(); - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/prettifier/pretty/helper/PrettifyHelper.java b/app/src/main/java/com/prettifier/pretty/helper/PrettifyHelper.java deleted file mode 100644 index 3cdf1f4a7..000000000 --- a/app/src/main/java/com/prettifier/pretty/helper/PrettifyHelper.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.prettifier.pretty.helper; - -import androidx.annotation.NonNull; - -/** - * Created by Kosh on 25 Dec 2016, 9:12 PM - */ - -public class PrettifyHelper { - - @NonNull private static String getHtmlContent(@NonNull String css, @NonNull String text, boolean wrap, boolean isDark) { - return "\n" + - "\n" + - "\n" + - " \n" + - " \n" + - "" + (!wrap ? "\n" : "") + "" + - LINE_NO_CSS + "\n" + - " " + (wrap ? WRAPPED_STYLE : "") + "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "

" + text + "
\n" + - "\n" + - "\n" + - "\n" + - ""; - } - - @NonNull private static final String WRAPPED_STYLE = - ""; - - private static final String LINE_NO_CSS = ""; - - @NonNull public static String generateContent(@NonNull String source, String theme) { - return getHtmlContent(theme, getFormattedSource(source), false, false); - } - - @NonNull public static String generateContent(@NonNull String source, boolean isDark, boolean wrap) { - return getHtmlContent(getStyle(isDark), getFormattedSource(source), wrap, isDark); - } - - @NonNull private static String getFormattedSource(@NonNull String source) { - return source.replaceAll("<", "<") - .replaceAll(">", ">"); - } - - @NonNull private static String getStyle(boolean isDark) { - return CodeThemesHelper.getTheme(isDark); - } - - private static boolean textTooLarge(@NonNull String text) { - return text.length() > 304800;//>roughly 300kb ? disable highlighting to avoid crash. - } - -} diff --git a/app/src/main/java/com/zzhoujay/markdown/style/CodeSpan.java b/app/src/main/java/com/zzhoujay/markdown/style/CodeSpan.java deleted file mode 100644 index e12b9f34f..000000000 --- a/app/src/main/java/com/zzhoujay/markdown/style/CodeSpan.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.zzhoujay.markdown.style; - -import android.graphics.Canvas; -import android.graphics.Paint; -import android.graphics.drawable.Drawable; -import android.graphics.drawable.GradientDrawable; -import android.text.style.ReplacementSpan; - -/** - * Created by zhou on 16-7-2. - * 代码Span - */ -public class CodeSpan extends ReplacementSpan { - - private float radius = 10; - - private Drawable drawable; - private float padding; - private int width; - private int textColor; - - public CodeSpan(int color) { - GradientDrawable d = new GradientDrawable(); - d.setColor(color); - d.setCornerRadius(radius); - drawable = d; - } - - public CodeSpan(int color, int textColor, float radius) { - this.radius = radius; - this.textColor = textColor; - GradientDrawable d = new GradientDrawable(); - d.setColor(color); - d.setCornerRadius(radius); - drawable = d; - } - - @Override public int getSize(Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fm) { - padding = paint.measureText("t"); - width = (int) (paint.measureText(text, start, end) + padding * 2); - return width; - } - - @Override public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) { - drawable.setBounds((int) x, top, (int) x + width, bottom); - drawable.draw(canvas); - if (textColor != 0) { - paint.setColor(textColor); - } - canvas.drawText(text, start, end, x + padding, y, paint); - } - -} diff --git a/app/src/main/java/com/zzhoujay/markdown/style/FontSpan.java b/app/src/main/java/com/zzhoujay/markdown/style/FontSpan.java deleted file mode 100644 index aeff93a8d..000000000 --- a/app/src/main/java/com/zzhoujay/markdown/style/FontSpan.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.zzhoujay.markdown.style; - -import android.annotation.SuppressLint; -import android.text.ParcelableSpan; -import android.text.TextPaint; -import android.text.style.StyleSpan; - -/** - * Created by zhou on 2016/11/10. - * FontSpan - */ -@SuppressLint("ParcelCreator") -public class FontSpan extends StyleSpan implements ParcelableSpan { - - private final float size; - private final int color; - - public FontSpan(float size, int style) { - super(style); - this.size = size; - this.color = -1; - } - - public FontSpan(float size, int style, int color) { - super(style); - this.size = size; - this.color = color; - } - - @Override - public void updateMeasureState(TextPaint p) { - super.updateMeasureState(p); - p.setTextSize(p.getTextSize() * size); - } - - @Override - public void updateDrawState(TextPaint tp) { - super.updateDrawState(tp); - updateMeasureState(tp); - if (color != -1) tp.setColor(color); - } -} diff --git a/app/src/main/java/com/zzhoujay/markdown/style/LinkSpan.java b/app/src/main/java/com/zzhoujay/markdown/style/LinkSpan.java deleted file mode 100644 index 056090c94..000000000 --- a/app/src/main/java/com/zzhoujay/markdown/style/LinkSpan.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.zzhoujay.markdown.style; - -import android.text.TextPaint; -import android.text.style.URLSpan; - -/** - * Created by zhou on 16-7-2. - * 链接Span - */ -public class LinkSpan extends URLSpan { - - private int color; - - public LinkSpan(String url, int color) { - super(url); - this.color = color; - } - - @Override - public void updateDrawState(TextPaint ds) { - super.updateDrawState(ds); - ds.setColor(color); - ds.setUnderlineText(false); - } - -} diff --git a/app/src/main/java/com/zzhoujay/markdown/style/MarkDownQuoteSpan.java b/app/src/main/java/com/zzhoujay/markdown/style/MarkDownQuoteSpan.java deleted file mode 100644 index bf2275247..000000000 --- a/app/src/main/java/com/zzhoujay/markdown/style/MarkDownQuoteSpan.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.zzhoujay.markdown.style; - -import android.graphics.Canvas; -import android.graphics.Paint; -import android.text.Layout; -import android.text.style.QuoteSpan; - -/** - * Created by zhou on 16-6-25. - * 引用Span - */ -public class MarkDownQuoteSpan extends QuoteSpan { - - private static final int STRIPE_WIDTH = 15; - private static final int GAP_WIDTH = 40; - - public MarkDownQuoteSpan() { - super(); - } - - public MarkDownQuoteSpan(int color) { - super(color); - } - - @Override - public void drawLeadingMargin(Canvas c, Paint p, int x, int dir, int top, int baseline, int bottom, CharSequence text, int start, int end, - boolean first, Layout layout) { - Paint.Style style = p.getStyle(); - int color = p.getColor(); - p.setStyle(Paint.Style.FILL); - p.setColor(getColor()); - c.drawRect(x, top, x + dir * STRIPE_WIDTH, bottom, p); - p.setStyle(style); - p.setColor(color); - } - - @Override public int getLeadingMargin(boolean first) { - return STRIPE_WIDTH + GAP_WIDTH; - } - -} diff --git a/app/src/main/res/color/search_tab_highlighter.xml b/app/src/main/res/color/search_tab_highlighter.xml deleted file mode 100644 index 9bd12757b..000000000 --- a/app/src/main/res/color/search_tab_highlighter.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable-nodpi/web_hi_res_512.png b/app/src/main/res/drawable-nodpi/web_hi_res_512.png deleted file mode 100755 index fcb3043a6..000000000 Binary files a/app/src/main/res/drawable-nodpi/web_hi_res_512.png and /dev/null differ diff --git a/app/src/main/res/drawable-small/splash_screen_drawable.xml b/app/src/main/res/drawable-small/splash_screen_drawable.xml deleted file mode 100644 index d40947f90..000000000 --- a/app/src/main/res/drawable-small/splash_screen_drawable.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - diff --git a/app/src/main/res/drawable-v26/ic_app_shortcut_github.xml b/app/src/main/res/drawable-v26/ic_app_shortcut_github.xml deleted file mode 100644 index 747f232ee..000000000 --- a/app/src/main/res/drawable-v26/ic_app_shortcut_github.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable-v26/ic_app_shortcut_issues.xml b/app/src/main/res/drawable-v26/ic_app_shortcut_issues.xml deleted file mode 100644 index a6a3cb6f2..000000000 --- a/app/src/main/res/drawable-v26/ic_app_shortcut_issues.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable-v26/ic_app_shortcut_pinned.xml b/app/src/main/res/drawable-v26/ic_app_shortcut_pinned.xml deleted file mode 100644 index 596399ba8..000000000 --- a/app/src/main/res/drawable-v26/ic_app_shortcut_pinned.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable-v26/ic_app_shortcut_profile.xml b/app/src/main/res/drawable-v26/ic_app_shortcut_profile.xml deleted file mode 100644 index 1bae31866..000000000 --- a/app/src/main/res/drawable-v26/ic_app_shortcut_profile.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable-v26/ic_app_shortcut_pull_requests.xml b/app/src/main/res/drawable-v26/ic_app_shortcut_pull_requests.xml deleted file mode 100644 index 01856928c..000000000 --- a/app/src/main/res/drawable-v26/ic_app_shortcut_pull_requests.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/circle_shape.xml b/app/src/main/res/drawable/circle_shape.xml deleted file mode 100644 index 43dff935e..000000000 --- a/app/src/main/res/drawable/circle_shape.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/fastscroller_bubble.xml b/app/src/main/res/drawable/fastscroller_bubble.xml deleted file mode 100755 index 30d3322f7..000000000 --- a/app/src/main/res/drawable/fastscroller_bubble.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_add_emoji.xml b/app/src/main/res/drawable/ic_add_emoji.xml deleted file mode 100644 index 25d14098b..000000000 --- a/app/src/main/res/drawable/ic_add_emoji.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_brower.xml b/app/src/main/res/drawable/ic_brower.xml deleted file mode 100644 index 2085b09e3..000000000 --- a/app/src/main/res/drawable/ic_brower.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_circle_small.xml b/app/src/main/res/drawable/ic_circle_small.xml deleted file mode 100644 index 5b3f8b8a6..000000000 --- a/app/src/main/res/drawable/ic_circle_small.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_feedback.xml b/app/src/main/res/drawable/ic_feedback.xml deleted file mode 100644 index a7ab9a19f..000000000 --- a/app/src/main/res/drawable/ic_feedback.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/ic_image.xml b/app/src/main/res/drawable/ic_image.xml deleted file mode 100644 index 811cdf85a..000000000 --- a/app/src/main/res/drawable/ic_image.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_notification.xml b/app/src/main/res/drawable/ic_notification.xml deleted file mode 100644 index 92b786e2a..000000000 --- a/app/src/main/res/drawable/ic_notification.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_notifications_none.xml b/app/src/main/res/drawable/ic_notifications_none.xml deleted file mode 100644 index 4838f051c..000000000 --- a/app/src/main/res/drawable/ic_notifications_none.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_person.xml b/app/src/main/res/drawable/ic_person.xml deleted file mode 100644 index cd59a3e61..000000000 --- a/app/src/main/res/drawable/ic_person.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_profile.xml b/app/src/main/res/drawable/ic_profile.xml deleted file mode 100644 index 2c2f3a35b..000000000 --- a/app/src/main/res/drawable/ic_profile.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_repo.xml b/app/src/main/res/drawable/ic_repo.xml deleted file mode 100644 index 72a4d2fe3..000000000 --- a/app/src/main/res/drawable/ic_repo.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_search.xml b/app/src/main/res/drawable/ic_search.xml deleted file mode 100644 index 3fea06807..000000000 --- a/app/src/main/res/drawable/ic_search.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/splash_screen_drawable.xml b/app/src/main/res/drawable/splash_screen_drawable.xml deleted file mode 100644 index 78ef1a1b8..000000000 --- a/app/src/main/res/drawable/splash_screen_drawable.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/main_fragment_front_layout.xml b/app/src/main/res/layout/main_fragment_front_layout.xml new file mode 100644 index 000000000..e8215d4e4 --- /dev/null +++ b/app/src/main/res/layout/main_fragment_front_layout.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layouts/main_layouts/layout-land/bottom_fab.xml b/app/src/main/res/layouts/main_layouts/layout-land/bottom_fab.xml deleted file mode 100644 index f543c0801..000000000 --- a/app/src/main/res/layouts/main_layouts/layout-land/bottom_fab.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout-land/fragment_container.xml b/app/src/main/res/layouts/main_layouts/layout-land/fragment_container.xml deleted file mode 100644 index 73de28ee4..000000000 --- a/app/src/main/res/layouts/main_layouts/layout-land/fragment_container.xml +++ /dev/null @@ -1,11 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout-land/header_title_with_toolbar.xml b/app/src/main/res/layouts/main_layouts/layout-land/header_title_with_toolbar.xml deleted file mode 100644 index c41fbd761..000000000 --- a/app/src/main/res/layouts/main_layouts/layout-land/header_title_with_toolbar.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout-land/issues_bottom_navigation.xml b/app/src/main/res/layouts/main_layouts/layout-land/issues_bottom_navigation.xml deleted file mode 100644 index 39b4d36bf..000000000 --- a/app/src/main/res/layouts/main_layouts/layout-land/issues_bottom_navigation.xml +++ /dev/null @@ -1,10 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout-land/main_bottom_navigation.xml b/app/src/main/res/layouts/main_layouts/layout-land/main_bottom_navigation.xml deleted file mode 100644 index ac4ad8a5d..000000000 --- a/app/src/main/res/layouts/main_layouts/layout-land/main_bottom_navigation.xml +++ /dev/null @@ -1,10 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout-land/profile_follow_action_layout.xml b/app/src/main/res/layouts/main_layouts/layout-land/profile_follow_action_layout.xml deleted file mode 100644 index 9f0f152d1..000000000 --- a/app/src/main/res/layouts/main_layouts/layout-land/profile_follow_action_layout.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout-land/repo_file_header_layout.xml b/app/src/main/res/layouts/main_layouts/layout-land/repo_file_header_layout.xml deleted file mode 100644 index 079958ee3..000000000 --- a/app/src/main/res/layouts/main_layouts/layout-land/repo_file_header_layout.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout-sw600dp/bottom_fab.xml b/app/src/main/res/layouts/main_layouts/layout-sw600dp/bottom_fab.xml deleted file mode 100644 index 297e804b3..000000000 --- a/app/src/main/res/layouts/main_layouts/layout-sw600dp/bottom_fab.xml +++ /dev/null @@ -1,13 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout-sw600dp/fragment_container.xml b/app/src/main/res/layouts/main_layouts/layout-sw600dp/fragment_container.xml deleted file mode 100644 index 73de28ee4..000000000 --- a/app/src/main/res/layouts/main_layouts/layout-sw600dp/fragment_container.xml +++ /dev/null @@ -1,11 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout-sw600dp/header_title_with_toolbar.xml b/app/src/main/res/layouts/main_layouts/layout-sw600dp/header_title_with_toolbar.xml deleted file mode 100644 index 501e152b3..000000000 --- a/app/src/main/res/layouts/main_layouts/layout-sw600dp/header_title_with_toolbar.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout-sw600dp/issues_bottom_navigation.xml b/app/src/main/res/layouts/main_layouts/layout-sw600dp/issues_bottom_navigation.xml deleted file mode 100644 index 39b4d36bf..000000000 --- a/app/src/main/res/layouts/main_layouts/layout-sw600dp/issues_bottom_navigation.xml +++ /dev/null @@ -1,10 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout-sw600dp/main_bottom_navigation.xml b/app/src/main/res/layouts/main_layouts/layout-sw600dp/main_bottom_navigation.xml deleted file mode 100644 index ac4ad8a5d..000000000 --- a/app/src/main/res/layouts/main_layouts/layout-sw600dp/main_bottom_navigation.xml +++ /dev/null @@ -1,10 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout-sw600dp/repo_file_header_layout.xml b/app/src/main/res/layouts/main_layouts/layout-sw600dp/repo_file_header_layout.xml deleted file mode 100644 index 48113abf4..000000000 --- a/app/src/main/res/layouts/main_layouts/layout-sw600dp/repo_file_header_layout.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/accounts_menu_layout.xml b/app/src/main/res/layouts/main_layouts/layout/accounts_menu_layout.xml deleted file mode 100644 index 90eb1c3f4..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/accounts_menu_layout.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/activity_fragment_layout.xml b/app/src/main/res/layouts/main_layouts/layout/activity_fragment_layout.xml deleted file mode 100644 index eca941841..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/activity_fragment_layout.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/activity_main.xml b/app/src/main/res/layouts/main_layouts/layout/activity_main.xml new file mode 100644 index 000000000..f3b5c51ab --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/activity_main.xml @@ -0,0 +1,9 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/activity_main_view.xml b/app/src/main/res/layouts/main_layouts/layout/activity_main_view.xml deleted file mode 100644 index b9a218ca7..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/activity_main_view.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/activity_search_file.xml b/app/src/main/res/layouts/main_layouts/layout/activity_search_file.xml deleted file mode 100644 index 3362c3e1d..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/activity_search_file.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/activity_search_user.xml b/app/src/main/res/layouts/main_layouts/layout/activity_search_user.xml deleted file mode 100644 index 4b7f77bd0..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/activity_search_user.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layouts/main_layouts/layout/activity_settings.xml b/app/src/main/res/layouts/main_layouts/layout/activity_settings.xml deleted file mode 100644 index 92bf4d943..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/activity_settings.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - diff --git a/app/src/main/res/layouts/main_layouts/layout/activity_settings_category.xml b/app/src/main/res/layouts/main_layouts/layout/activity_settings_category.xml deleted file mode 100644 index 8da74ff58..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/activity_settings_category.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/add_banner_layout.xml b/app/src/main/res/layouts/main_layouts/layout/add_banner_layout.xml deleted file mode 100644 index 6022f74f1..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/add_banner_layout.xml +++ /dev/null @@ -1,9 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/add_gist_file_layout.xml b/app/src/main/res/layouts/main_layouts/layout/add_gist_file_layout.xml deleted file mode 100644 index 99d983cff..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/add_gist_file_layout.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/add_label_layout.xml b/app/src/main/res/layouts/main_layouts/layout/add_label_layout.xml new file mode 100644 index 000000000..0a93933af --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/add_label_layout.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/add_milestone_layout.xml b/app/src/main/res/layouts/main_layouts/layout/add_milestone_layout.xml new file mode 100644 index 000000000..d690df522 --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/add_milestone_layout.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/add_review_dialog_layout.xml b/app/src/main/res/layouts/main_layouts/layout/add_review_dialog_layout.xml deleted file mode 100644 index eab741add..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/add_review_dialog_layout.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/bottom_fab.xml b/app/src/main/res/layouts/main_layouts/layout/bottom_fab.xml deleted file mode 100644 index c91e78b6b..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/bottom_fab.xml +++ /dev/null @@ -1,16 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/branches_tabbed_viewpager.xml b/app/src/main/res/layouts/main_layouts/layout/branches_tabbed_viewpager.xml deleted file mode 100644 index 20950f765..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/branches_tabbed_viewpager.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - diff --git a/app/src/main/res/layouts/main_layouts/layout/centered_tabbed_viewpager.xml b/app/src/main/res/layouts/main_layouts/layout/centered_tabbed_viewpager.xml deleted file mode 100644 index 95dacffcb..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/centered_tabbed_viewpager.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/comment_box_layout.xml b/app/src/main/res/layouts/main_layouts/layout/comment_box_layout.xml deleted file mode 100644 index 81ae2130a..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/comment_box_layout.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layouts/main_layouts/layout/commit_file_full_layout.xml b/app/src/main/res/layouts/main_layouts/layout/commit_file_full_layout.xml deleted file mode 100644 index 4973dff2a..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/commit_file_full_layout.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/commit_pager_activity.xml b/app/src/main/res/layouts/main_layouts/layout/commit_pager_activity.xml deleted file mode 100644 index 7fe9294cd..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/commit_pager_activity.xml +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/commit_with_branch_layout.xml b/app/src/main/res/layouts/main_layouts/layout/commit_with_branch_layout.xml deleted file mode 100644 index f57c518f4..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/commit_with_branch_layout.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/create_gist_layout.xml b/app/src/main/res/layouts/main_layouts/layout/create_gist_layout.xml deleted file mode 100644 index a0377824c..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/create_gist_layout.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/create_issue_layout.xml b/app/src/main/res/layouts/main_layouts/layout/create_issue_layout.xml deleted file mode 100644 index 400312f65..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/create_issue_layout.xml +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/create_label_layout.xml b/app/src/main/res/layouts/main_layouts/layout/create_label_layout.xml deleted file mode 100644 index 52584ecec..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/create_label_layout.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/create_milestone_layout.xml b/app/src/main/res/layouts/main_layouts/layout/create_milestone_layout.xml deleted file mode 100644 index 08864539d..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/create_milestone_layout.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/delete_repo_file_layout.xml b/app/src/main/res/layouts/main_layouts/layout/delete_repo_file_layout.xml deleted file mode 100644 index aa523e925..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/delete_repo_file_layout.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/dialog_picker.xml b/app/src/main/res/layouts/main_layouts/layout/dialog_picker.xml deleted file mode 100644 index d5e44c25e..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/dialog_picker.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/edit_issue_pr_fragment_layout.xml b/app/src/main/res/layouts/main_layouts/layout/edit_issue_pr_fragment_layout.xml new file mode 100644 index 000000000..da988f5d6 --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/edit_issue_pr_fragment_layout.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/edit_project_column_note_layout.xml b/app/src/main/res/layouts/main_layouts/layout/edit_project_column_note_layout.xml deleted file mode 100644 index a55dcc918..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/edit_project_column_note_layout.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/edit_repo_file_layout.xml b/app/src/main/res/layouts/main_layouts/layout/edit_repo_file_layout.xml deleted file mode 100644 index 4a6af64ef..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/edit_repo_file_layout.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/editor_layout.xml b/app/src/main/res/layouts/main_layouts/layout/editor_layout.xml deleted file mode 100644 index 711b8f6bb..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/editor_layout.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/emoji_popup_layout.xml b/app/src/main/res/layouts/main_layouts/layout/emoji_popup_layout.xml deleted file mode 100644 index 6eeb95447..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/emoji_popup_layout.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/fab_micro_grid_refresh_list.xml b/app/src/main/res/layouts/main_layouts/layout/fab_micro_grid_refresh_list.xml deleted file mode 100644 index f65a66b4e..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/fab_micro_grid_refresh_list.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/fab_simple_refresh_list_layout.xml b/app/src/main/res/layouts/main_layouts/layout/fab_simple_refresh_list_layout.xml new file mode 100644 index 000000000..bf357a096 --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/fab_simple_refresh_list_layout.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/filter_bottom_sheet.xml b/app/src/main/res/layouts/main_layouts/layout/filter_bottom_sheet.xml deleted file mode 100644 index 835c93507..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/filter_bottom_sheet.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/filter_issues_popup.xml b/app/src/main/res/layouts/main_layouts/layout/filter_issues_popup.xml deleted file mode 100644 index 6b77bb955..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/filter_issues_popup.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/filter_issues_prs_layout.xml b/app/src/main/res/layouts/main_layouts/layout/filter_issues_prs_layout.xml deleted file mode 100644 index 02cb8e6dc..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/filter_issues_prs_layout.xml +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/fragment_container.xml b/app/src/main/res/layouts/main_layouts/layout/fragment_container.xml deleted file mode 100644 index 62d87ed8c..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/fragment_container.xml +++ /dev/null @@ -1,10 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/full_screen_file_changes_layout.xml b/app/src/main/res/layouts/main_layouts/layout/full_screen_file_changes_layout.xml deleted file mode 100644 index 779d3d328..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/full_screen_file_changes_layout.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/general_viewer_layout.xml b/app/src/main/res/layouts/main_layouts/layout/general_viewer_layout.xml deleted file mode 100644 index d63cf4f85..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/general_viewer_layout.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layouts/main_layouts/layout/gists_activity_layout.xml b/app/src/main/res/layouts/main_layouts/layout/gists_activity_layout.xml deleted file mode 100644 index 8d6953d25..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/gists_activity_layout.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/gists_pager_layout.xml b/app/src/main/res/layouts/main_layouts/layout/gists_pager_layout.xml deleted file mode 100644 index 73961251a..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/gists_pager_layout.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/header_title_with_toolbar.xml b/app/src/main/res/layouts/main_layouts/layout/header_title_with_toolbar.xml deleted file mode 100644 index 8a9a79029..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/header_title_with_toolbar.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/icon_row_item.xml b/app/src/main/res/layouts/main_layouts/layout/icon_row_item.xml deleted file mode 100644 index 97cbe2a58..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/icon_row_item.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/issue_pager_activity.xml b/app/src/main/res/layouts/main_layouts/layout/issue_pager_activity.xml deleted file mode 100644 index 9f3959012..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/issue_pager_activity.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/issue_popup_layout.xml b/app/src/main/res/layouts/main_layouts/layout/issue_popup_layout.xml deleted file mode 100644 index 753843f30..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/issue_popup_layout.xml +++ /dev/null @@ -1,281 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/issue_pr_bottomsheet_layout.xml b/app/src/main/res/layouts/main_layouts/layout/issue_pr_bottomsheet_layout.xml new file mode 100644 index 000000000..578b8c379 --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/issue_pr_bottomsheet_layout.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/issue_pr_fragment_layout.xml b/app/src/main/res/layouts/main_layouts/layout/issue_pr_fragment_layout.xml new file mode 100644 index 000000000..de26b78d1 --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/issue_pr_fragment_layout.xml @@ -0,0 +1,15 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/issue_pr_view_layout.xml b/app/src/main/res/layouts/main_layouts/layout/issue_pr_view_layout.xml new file mode 100644 index 000000000..0a7cefdfb --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/issue_pr_view_layout.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/issues_bottom_navigation.xml b/app/src/main/res/layouts/main_layouts/layout/issues_bottom_navigation.xml deleted file mode 100644 index ea6e188c4..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/issues_bottom_navigation.xml +++ /dev/null @@ -1,10 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/issues_prs_fragment_layout.xml b/app/src/main/res/layouts/main_layouts/layout/issues_prs_fragment_layout.xml new file mode 100644 index 000000000..44817f953 --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/issues_prs_fragment_layout.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/license_viewer_layout.xml b/app/src/main/res/layouts/main_layouts/layout/license_viewer_layout.xml deleted file mode 100644 index 995d5e7ec..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/license_viewer_layout.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - diff --git a/app/src/main/res/layouts/main_layouts/layout/login_chooser_activity_layout.xml b/app/src/main/res/layouts/main_layouts/layout/login_chooser_activity_layout.xml new file mode 100644 index 000000000..07310e066 --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/login_chooser_activity_layout.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/login_chooser_fragment_layout.xml b/app/src/main/res/layouts/main_layouts/layout/login_chooser_fragment_layout.xml new file mode 100644 index 000000000..9fd2cbb9d --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/login_chooser_fragment_layout.xml @@ -0,0 +1,254 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/login_chooser_layout.xml b/app/src/main/res/layouts/main_layouts/layout/login_chooser_layout.xml deleted file mode 100644 index fe5f17c09..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/login_chooser_layout.xml +++ /dev/null @@ -1,268 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/login_form_layout.xml b/app/src/main/res/layouts/main_layouts/layout/login_form_layout.xml index eee3e3f2f..27f106f5e 100644 --- a/app/src/main/res/layouts/main_layouts/layout/login_form_layout.xml +++ b/app/src/main/res/layouts/main_layouts/layout/login_form_layout.xml @@ -5,192 +5,185 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/material_indigo_700" - android:fitsSystemWindows="true" - android:orientation="vertical" - app:statusBarBackground="@color/material_indigo_900" - tools:context=".ui.modules.login.LoginActivity" - tools:ignore="Overdraw"> - - + android:background="?android:windowBackground" + android:orientation="vertical"> + - + + - - + android:layout_height="match_parent"> - - - - - - - - - - - - - - - - - - - - + android:layout_height="wrap_content"> - + android:orientation="vertical"> - - - - - - - - + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + android:layout_gravity="center" + android:padding="@dimen/spacing_s_large" + android:visibility="gone"/> + + - + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/main_bottom_navigation.xml b/app/src/main/res/layouts/main_layouts/layout/main_bottom_navigation.xml deleted file mode 100644 index 5d9d934e5..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/main_bottom_navigation.xml +++ /dev/null @@ -1,10 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/main_fragment_layout.xml b/app/src/main/res/layouts/main_layouts/layout/main_fragment_layout.xml new file mode 100644 index 000000000..9111cab29 --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/main_fragment_layout.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/main_nav_fragment_layout.xml b/app/src/main/res/layouts/main_layouts/layout/main_nav_fragment_layout.xml deleted file mode 100644 index 76326e199..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/main_nav_fragment_layout.xml +++ /dev/null @@ -1,14 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/markdown_link_image_dialog_layout.xml b/app/src/main/res/layouts/main_layouts/layout/markdown_link_image_dialog_layout.xml deleted file mode 100644 index 6063e71ab..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/markdown_link_image_dialog_layout.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/merge_dialog_layout.xml b/app/src/main/res/layouts/main_layouts/layout/merge_dialog_layout.xml deleted file mode 100644 index 77dfa1abe..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/merge_dialog_layout.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/micro_grid_refresh_list.xml b/app/src/main/res/layouts/main_layouts/layout/micro_grid_refresh_list.xml deleted file mode 100644 index 1f9efe2db..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/micro_grid_refresh_list.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/milestone_dialog_layout.xml b/app/src/main/res/layouts/main_layouts/layout/milestone_dialog_layout.xml deleted file mode 100644 index 1426e6def..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/milestone_dialog_layout.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/notification_activity_layout.xml b/app/src/main/res/layouts/main_layouts/layout/notification_activity_layout.xml deleted file mode 100644 index 1094bf28d..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/notification_activity_layout.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/notifications_bottom_sheet_layout.xml b/app/src/main/res/layouts/main_layouts/layout/notifications_bottom_sheet_layout.xml deleted file mode 100644 index 386d47c8a..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/notifications_bottom_sheet_layout.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/picker_dialog.xml b/app/src/main/res/layouts/main_layouts/layout/picker_dialog.xml deleted file mode 100644 index 24a1c943c..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/picker_dialog.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/playstore_review_layout_warning.xml b/app/src/main/res/layouts/main_layouts/layout/playstore_review_layout_warning.xml deleted file mode 100644 index 9b1049010..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/playstore_review_layout_warning.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/pr_fragment_layout.xml b/app/src/main/res/layouts/main_layouts/layout/pr_fragment_layout.xml new file mode 100644 index 000000000..c12b1237f --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/pr_fragment_layout.xml @@ -0,0 +1,15 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/pr_view_layout.xml b/app/src/main/res/layouts/main_layouts/layout/pr_view_layout.xml new file mode 100644 index 000000000..fc9d6caad --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/pr_view_layout.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/pro_features_layout.xml b/app/src/main/res/layouts/main_layouts/layout/pro_features_layout.xml deleted file mode 100644 index e3c5b89c2..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/pro_features_layout.xml +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/profile_bottom_sheet.xml b/app/src/main/res/layouts/main_layouts/layout/profile_bottom_sheet.xml new file mode 100644 index 000000000..bcd6dc715 --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/profile_bottom_sheet.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/profile_follow_action_layout.xml b/app/src/main/res/layouts/main_layouts/layout/profile_follow_action_layout.xml deleted file mode 100644 index 05ba94bb9..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/profile_follow_action_layout.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/profile_fragment_layout.xml b/app/src/main/res/layouts/main_layouts/layout/profile_fragment_layout.xml new file mode 100644 index 000000000..eeee5643c --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/profile_fragment_layout.xml @@ -0,0 +1,359 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/project_columns_layout.xml b/app/src/main/res/layouts/main_layouts/layout/project_columns_layout.xml deleted file mode 100644 index f8b9ffa4f..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/project_columns_layout.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/projects_activity_layout.xml b/app/src/main/res/layouts/main_layouts/layout/projects_activity_layout.xml deleted file mode 100644 index 75d054159..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/projects_activity_layout.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/pull_request_files_layout.xml b/app/src/main/res/layouts/main_layouts/layout/pull_request_files_layout.xml deleted file mode 100644 index de055b8e0..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/pull_request_files_layout.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/quick_input_layout.xml b/app/src/main/res/layouts/main_layouts/layout/quick_input_layout.xml new file mode 100644 index 000000000..a236eb5d1 --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/quick_input_layout.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/repo_file_header_layout.xml b/app/src/main/res/layouts/main_layouts/layout/repo_file_header_layout.xml deleted file mode 100644 index f83a357ee..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/repo_file_header_layout.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/repo_file_layout.xml b/app/src/main/res/layouts/main_layouts/layout/repo_file_layout.xml deleted file mode 100644 index ea41890b3..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/repo_file_layout.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/repo_header_icons_layout.xml b/app/src/main/res/layouts/main_layouts/layout/repo_header_icons_layout.xml deleted file mode 100644 index 09b9b6453..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/repo_header_icons_layout.xml +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/repo_pager_activity.xml b/app/src/main/res/layouts/main_layouts/layout/repo_pager_activity.xml deleted file mode 100644 index 0f2982901..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/repo_pager_activity.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/review_changes_bottom_layout.xml b/app/src/main/res/layouts/main_layouts/layout/review_changes_bottom_layout.xml deleted file mode 100644 index ab19f3ad0..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/review_changes_bottom_layout.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/review_comment_dialog_layout.xml b/app/src/main/res/layouts/main_layouts/layout/review_comment_dialog_layout.xml deleted file mode 100644 index 1ba57aa9b..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/review_comment_dialog_layout.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/search_fragment_layout.xml b/app/src/main/res/layouts/main_layouts/layout/search_fragment_layout.xml new file mode 100644 index 000000000..21979bc75 --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/search_fragment_layout.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/search_layout.xml b/app/src/main/res/layouts/main_layouts/layout/search_layout.xml deleted file mode 100644 index 43876314c..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/search_layout.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/settings_layout.xml b/app/src/main/res/layouts/main_layouts/layout/settings_layout.xml deleted file mode 100644 index 8da74ff58..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/settings_layout.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/small_grid_refresh_list.xml b/app/src/main/res/layouts/main_layouts/layout/small_grid_refresh_list.xml deleted file mode 100644 index 043b423c7..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/small_grid_refresh_list.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/submit_review_layout.xml b/app/src/main/res/layouts/main_layouts/layout/submit_review_layout.xml deleted file mode 100644 index e7caa0d4c..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/submit_review_layout.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/support_development_layout.xml b/app/src/main/res/layouts/main_layouts/layout/support_development_layout.xml deleted file mode 100644 index 6626d2245..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/support_development_layout.xml +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/tabbed_pager_layout.xml b/app/src/main/res/layouts/main_layouts/layout/tabbed_pager_layout.xml deleted file mode 100644 index 5b95249c7..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/tabbed_pager_layout.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/tabbed_viewpager.xml b/app/src/main/res/layouts/main_layouts/layout/tabbed_viewpager.xml deleted file mode 100644 index 987b11524..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/tabbed_viewpager.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/tending_buttons_layout.xml b/app/src/main/res/layouts/main_layouts/layout/tending_buttons_layout.xml deleted file mode 100644 index 584c7eb8a..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/tending_buttons_layout.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/theme_code_layout.xml b/app/src/main/res/layouts/main_layouts/layout/theme_code_layout.xml deleted file mode 100644 index b844d3ee0..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/theme_code_layout.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layouts/main_layouts/layout/theme_layout.xml b/app/src/main/res/layouts/main_layouts/layout/theme_layout.xml deleted file mode 100644 index 8de081fe6..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/theme_layout.xml +++ /dev/null @@ -1,1000 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/theme_viewpager.xml b/app/src/main/res/layouts/main_layouts/layout/theme_viewpager.xml deleted file mode 100644 index 1d5cefac5..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/theme_viewpager.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/title_header_layout.xml b/app/src/main/res/layouts/main_layouts/layout/title_header_layout.xml deleted file mode 100644 index 393c004b5..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/title_header_layout.xml +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/toolbar_activity_layout.xml b/app/src/main/res/layouts/main_layouts/layout/toolbar_activity_layout.xml deleted file mode 100644 index c3b4f65c2..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/toolbar_activity_layout.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/trending_activity_layout.xml b/app/src/main/res/layouts/main_layouts/layout/trending_activity_layout.xml deleted file mode 100644 index 4e84bad24..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/trending_activity_layout.xml +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/trending_fragment_layout.xml b/app/src/main/res/layouts/main_layouts/layout/trending_fragment_layout.xml new file mode 100644 index 000000000..a2e01c2c2 --- /dev/null +++ b/app/src/main/res/layouts/main_layouts/layout/trending_fragment_layout.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/vertical_refresh_list.xml b/app/src/main/res/layouts/main_layouts/layout/vertical_refresh_list.xml deleted file mode 100644 index da12bb032..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/vertical_refresh_list.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/view_pager_activity_layout.xml b/app/src/main/res/layouts/main_layouts/layout/view_pager_activity_layout.xml deleted file mode 100644 index 5f10c5d88..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/view_pager_activity_layout.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/wiki_activity_layout.xml b/app/src/main/res/layouts/main_layouts/layout/wiki_activity_layout.xml deleted file mode 100644 index 6f9628fb1..000000000 --- a/app/src/main/res/layouts/main_layouts/layout/wiki_activity_layout.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout-land/appbar_start_margin.xml b/app/src/main/res/layouts/other_layouts/layout-land/appbar_start_margin.xml deleted file mode 100644 index 4bca7cb2d..000000000 --- a/app/src/main/res/layouts/other_layouts/layout-land/appbar_start_margin.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout-sw600dp/appbar_start_margin.xml b/app/src/main/res/layouts/other_layouts/layout-sw600dp/appbar_start_margin.xml deleted file mode 100644 index 13eb25b20..000000000 --- a/app/src/main/res/layouts/other_layouts/layout-sw600dp/appbar_start_margin.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/appbar_elevation_dark.xml b/app/src/main/res/layouts/other_layouts/layout/appbar_elevation_dark.xml deleted file mode 100644 index b01049db6..000000000 --- a/app/src/main/res/layouts/other_layouts/layout/appbar_elevation_dark.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/appbar_start_margin.xml b/app/src/main/res/layouts/other_layouts/layout/appbar_start_margin.xml deleted file mode 100644 index 3be32137d..000000000 --- a/app/src/main/res/layouts/other_layouts/layout/appbar_start_margin.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/appbar_tabbed_elevation.xml b/app/src/main/res/layouts/other_layouts/layout/appbar_tabbed_elevation.xml deleted file mode 100644 index 02d7d106f..000000000 --- a/app/src/main/res/layouts/other_layouts/layout/appbar_tabbed_elevation.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/avatar_layout.xml b/app/src/main/res/layouts/other_layouts/layout/avatar_layout.xml deleted file mode 100644 index a9a21c876..000000000 --- a/app/src/main/res/layouts/other_layouts/layout/avatar_layout.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/bottm_bar_menu_layout.xml b/app/src/main/res/layouts/other_layouts/layout/bottm_bar_menu_layout.xml new file mode 100644 index 000000000..1aba02a96 --- /dev/null +++ b/app/src/main/res/layouts/other_layouts/layout/bottm_bar_menu_layout.xml @@ -0,0 +1,21 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/dialog_guide_layout.xml b/app/src/main/res/layouts/other_layouts/layout/dialog_guide_layout.xml deleted file mode 100644 index a7fb75dbb..000000000 --- a/app/src/main/res/layouts/other_layouts/layout/dialog_guide_layout.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/drawer_header.xml b/app/src/main/res/layouts/other_layouts/layout/drawer_header.xml deleted file mode 100644 index 5a9045e8f..000000000 --- a/app/src/main/res/layouts/other_layouts/layout/drawer_header.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/empty_layout.xml b/app/src/main/res/layouts/other_layouts/layout/empty_layout.xml deleted file mode 100644 index 34cdd4564..000000000 --- a/app/src/main/res/layouts/other_layouts/layout/empty_layout.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/fastscroller_layout.xml b/app/src/main/res/layouts/other_layouts/layout/fastscroller_layout.xml deleted file mode 100755 index 1aad0c51d..000000000 --- a/app/src/main/res/layouts/other_layouts/layout/fastscroller_layout.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/filter_issue_pr_layout.xml b/app/src/main/res/layouts/other_layouts/layout/filter_issue_pr_layout.xml new file mode 100644 index 000000000..208326e68 --- /dev/null +++ b/app/src/main/res/layouts/other_layouts/layout/filter_issue_pr_layout.xml @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/filter_search_layout.xml b/app/src/main/res/layouts/other_layouts/layout/filter_search_layout.xml new file mode 100644 index 000000000..d089b4eb5 --- /dev/null +++ b/app/src/main/res/layouts/other_layouts/layout/filter_search_layout.xml @@ -0,0 +1,484 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/filter_trending_layout.xml b/app/src/main/res/layouts/other_layouts/layout/filter_trending_layout.xml new file mode 100644 index 000000000..c09564fd9 --- /dev/null +++ b/app/src/main/res/layouts/other_layouts/layout/filter_trending_layout.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/home_button.xml b/app/src/main/res/layouts/other_layouts/layout/home_button.xml deleted file mode 100644 index c028c2113..000000000 --- a/app/src/main/res/layouts/other_layouts/layout/home_button.xml +++ /dev/null @@ -1,9 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/lock_issue_pr_dialog.xml b/app/src/main/res/layouts/other_layouts/layout/lock_issue_pr_dialog.xml deleted file mode 100644 index 03bd7b8b9..000000000 --- a/app/src/main/res/layouts/other_layouts/layout/lock_issue_pr_dialog.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/lock_unlock_issue_pr_layout.xml b/app/src/main/res/layouts/other_layouts/layout/lock_unlock_issue_pr_layout.xml new file mode 100644 index 000000000..89f8f564d --- /dev/null +++ b/app/src/main/res/layouts/other_layouts/layout/lock_unlock_issue_pr_layout.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/message_dialog.xml b/app/src/main/res/layouts/other_layouts/layout/message_dialog.xml deleted file mode 100644 index e6b9f9678..000000000 --- a/app/src/main/res/layouts/other_layouts/layout/message_dialog.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/nav_menu_layout.xml b/app/src/main/res/layouts/other_layouts/layout/nav_menu_layout.xml deleted file mode 100644 index a512c4e13..000000000 --- a/app/src/main/res/layouts/other_layouts/layout/nav_menu_layout.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/progress_dialog_layout.xml b/app/src/main/res/layouts/other_layouts/layout/progress_dialog_layout.xml deleted file mode 100644 index 25708be1f..000000000 --- a/app/src/main/res/layouts/other_layouts/layout/progress_dialog_layout.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/simple_footer_list_dialog.xml b/app/src/main/res/layouts/other_layouts/layout/simple_footer_list_dialog.xml deleted file mode 100644 index afc08519b..000000000 --- a/app/src/main/res/layouts/other_layouts/layout/simple_footer_list_dialog.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/simple_list_dialog.xml b/app/src/main/res/layouts/other_layouts/layout/simple_list_dialog.xml deleted file mode 100644 index fd1f2aba0..000000000 --- a/app/src/main/res/layouts/other_layouts/layout/simple_list_dialog.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/single_container_layout.xml b/app/src/main/res/layouts/other_layouts/layout/single_container_layout.xml deleted file mode 100644 index 95359fde4..000000000 --- a/app/src/main/res/layouts/other_layouts/layout/single_container_layout.xml +++ /dev/null @@ -1,8 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/other_layouts/layout/state_layout.xml b/app/src/main/res/layouts/other_layouts/layout/state_layout.xml deleted file mode 100644 index 670b1d378..000000000 --- a/app/src/main/res/layouts/other_layouts/layout/state_layout.xml +++ /dev/null @@ -1,7 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout-sw600dp/login_row_item_menu.xml b/app/src/main/res/layouts/row_layouts/layout-sw600dp/login_row_item_menu.xml deleted file mode 100644 index 2b34fdf51..000000000 --- a/app/src/main/res/layouts/row_layouts/layout-sw600dp/login_row_item_menu.xml +++ /dev/null @@ -1,17 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout-sw600dp/repos_row_item_menu.xml b/app/src/main/res/layouts/row_layouts/layout-sw600dp/repos_row_item_menu.xml deleted file mode 100644 index 30b5fec9c..000000000 --- a/app/src/main/res/layouts/row_layouts/layout-sw600dp/repos_row_item_menu.xml +++ /dev/null @@ -1,18 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/add_filter_row_layout.xml b/app/src/main/res/layouts/row_layouts/layout/add_filter_row_layout.xml deleted file mode 100644 index b9f2ec609..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/add_filter_row_layout.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/assignees_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/assignees_row_item.xml new file mode 100644 index 000000000..7f6a3895d --- /dev/null +++ b/app/src/main/res/layouts/row_layouts/layout/assignees_row_item.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/branches_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/branches_row_item.xml deleted file mode 100644 index bb3b0c1d6..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/branches_row_item.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/column_card_row_layout.xml b/app/src/main/res/layouts/row_layouts/layout/column_card_row_layout.xml deleted file mode 100644 index 1c7156e37..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/column_card_row_layout.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/comment_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/comment_row_item.xml new file mode 100644 index 000000000..7a5feab66 --- /dev/null +++ b/app/src/main/res/layouts/row_layouts/layout/comment_row_item.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/comment_small_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/comment_small_row_item.xml new file mode 100644 index 000000000..899a6a044 --- /dev/null +++ b/app/src/main/res/layouts/row_layouts/layout/comment_small_row_item.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/comments_dropdown_layout.xml b/app/src/main/res/layouts/row_layouts/layout/comments_dropdown_layout.xml deleted file mode 100644 index 2c50457e5..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/comments_dropdown_layout.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/comments_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/comments_row_item.xml deleted file mode 100644 index 9cccb9dc7..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/comments_row_item.xml +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/commit_file_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/commit_file_row_item.xml deleted file mode 100644 index 65db80251..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/commit_file_row_item.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/commit_line_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/commit_line_row_item.xml deleted file mode 100644 index fa051077e..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/commit_line_row_item.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/commit_with_comment_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/commit_with_comment_row_item.xml new file mode 100644 index 000000000..3c68ca942 --- /dev/null +++ b/app/src/main/res/layouts/row_layouts/layout/commit_with_comment_row_item.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/emoji_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/emoji_row_item.xml deleted file mode 100644 index 775724a96..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/emoji_row_item.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/fasthub_notification_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/fasthub_notification_row_item.xml deleted file mode 100644 index 87ee8ede2..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/fasthub_notification_row_item.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/feeds_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/feeds_row_item.xml index b87a0f839..e6050913f 100644 --- a/app/src/main/res/layouts/row_layouts/layout/feeds_row_item.xml +++ b/app/src/main/res/layouts/row_layouts/layout/feeds_row_item.xml @@ -1,70 +1,86 @@ - + android:paddingEnd="@dimen/spacing_xs_large" + android:paddingBottom="@dimen/spacing_normal"> - - - + android:layout_gravity="center" + android:orientation="vertical"> + android:orientation="horizontal"> - + - + + + + + + tools:text="To some, a believer is a sex for loving." /> - + android:layout_gravity="center" + android:layout_marginStart="@dimen/spacing_normal" + android:gravity="start|center" + android:maxLines="1" + tools:text="An two hour ago" /> + + + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/feeds_row_no_image_item.xml b/app/src/main/res/layouts/row_layouts/layout/feeds_row_no_image_item.xml deleted file mode 100644 index 1d7194e4f..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/feeds_row_no_image_item.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/file_path_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/file_path_row_item.xml deleted file mode 100644 index e25e17472..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/file_path_row_item.xml +++ /dev/null @@ -1,15 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/gist_files_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/gist_files_row_item.xml deleted file mode 100644 index c023d2c1e..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/gist_files_row_item.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/grouped_commit_comment_row.xml b/app/src/main/res/layouts/row_layouts/layout/grouped_commit_comment_row.xml deleted file mode 100644 index 1ab1ba860..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/grouped_commit_comment_row.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/grouped_review_timeline_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/grouped_review_timeline_row_item.xml deleted file mode 100644 index 1cfe41ad6..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/grouped_review_timeline_row_item.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/icon_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/icon_row_item.xml new file mode 100644 index 000000000..e1d0de06e --- /dev/null +++ b/app/src/main/res/layouts/row_layouts/layout/icon_row_item.xml @@ -0,0 +1,9 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/issue_content_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/issue_content_row_item.xml new file mode 100644 index 000000000..bca0e55e7 --- /dev/null +++ b/app/src/main/res/layouts/row_layouts/layout/issue_content_row_item.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/issue_detail_header_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/issue_detail_header_row_item.xml deleted file mode 100644 index 221b34044..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/issue_detail_header_row_item.xml +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/issue_header_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/issue_header_row_item.xml new file mode 100644 index 000000000..131556481 --- /dev/null +++ b/app/src/main/res/layouts/row_layouts/layout/issue_header_row_item.xml @@ -0,0 +1,214 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/issue_no_image_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/issue_no_image_row_item.xml deleted file mode 100644 index 71e236225..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/issue_no_image_row_item.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/issue_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/issue_row_item.xml deleted file mode 100644 index 90990a9a6..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/issue_row_item.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/issue_timeline_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/issue_timeline_row_item.xml deleted file mode 100644 index a744a8411..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/issue_timeline_row_item.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/issues_prs_main_screen_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/issues_prs_main_screen_row_item.xml new file mode 100644 index 000000000..ef14dc099 --- /dev/null +++ b/app/src/main/res/layouts/row_layouts/layout/issues_prs_main_screen_row_item.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/label_color_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/label_color_row_item.xml new file mode 100644 index 000000000..47851a2fc --- /dev/null +++ b/app/src/main/res/layouts/row_layouts/layout/label_color_row_item.xml @@ -0,0 +1,11 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/label_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/label_row_item.xml index 77e3b1634..ad89070b1 100644 --- a/app/src/main/res/layouts/row_layouts/layout/label_row_item.xml +++ b/app/src/main/res/layouts/row_layouts/layout/label_row_item.xml @@ -4,36 +4,39 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_margin="@dimen/grid_spacing" - android:foreground="?android:selectableItemBackground" - android:paddingBottom="@dimen/spacing_normal" - android:paddingEnd="@dimen/spacing_xs_large" - android:paddingStart="@dimen/spacing_xs_large" - android:paddingTop="@dimen/spacing_normal"> + android:layout_marginBottom="@dimen/spacing_micro" + android:layout_marginTop="@dimen/spacing_micro" + android:foreground="?selectableItemBackground"> + android:layout_gravity="center" + android:background="?card_background" + android:padding="@dimen/spacing_xs_large"> - - + android:maxLines="2" + tools:text="Label 1"/> + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/language_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/language_row_item.xml new file mode 100644 index 000000000..a89acf906 --- /dev/null +++ b/app/src/main/res/layouts/row_layouts/layout/language_row_item.xml @@ -0,0 +1,17 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/login_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/login_row_item.xml deleted file mode 100644 index fe4a34c41..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/login_row_item.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/login_row_item_menu.xml b/app/src/main/res/layouts/row_layouts/layout/login_row_item_menu.xml deleted file mode 100644 index 2fc886631..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/login_row_item_menu.xml +++ /dev/null @@ -1,17 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/milestone_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/milestone_row_item.xml index 1f07e71a8..709e3b551 100644 --- a/app/src/main/res/layouts/row_layouts/layout/milestone_row_item.xml +++ b/app/src/main/res/layouts/row_layouts/layout/milestone_row_item.xml @@ -1,60 +1,28 @@ - + android:background="?selectableItemBackground" + android:orientation="horizontal" + android:padding="@dimen/spacing_xs_large"> - + android:layout_gravity="center" + android:layout_weight="1" + tools:text="V5.4"/> - - - - - - - - - + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/no_emojies_comments_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/no_emojies_comments_row_item.xml deleted file mode 100644 index 54e5bdb6a..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/no_emojies_comments_row_item.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/notification_header_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/notification_header_row_item.xml deleted file mode 100644 index b07cec381..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/notification_header_row_item.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/notification_main_screen_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/notification_main_screen_row_item.xml new file mode 100644 index 000000000..c8cea86c7 --- /dev/null +++ b/app/src/main/res/layouts/row_layouts/layout/notification_main_screen_row_item.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/notifications_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/notifications_row_item.xml deleted file mode 100644 index 7533b339a..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/notifications_row_item.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/org_profile_overview_layout.xml b/app/src/main/res/layouts/row_layouts/layout/org_profile_overview_layout.xml deleted file mode 100644 index 1f2d3dfb8..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/org_profile_overview_layout.xml +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/organization_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/organization_row_item.xml new file mode 100644 index 000000000..cce473d8f --- /dev/null +++ b/app/src/main/res/layouts/row_layouts/layout/organization_row_item.xml @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/pr_header_row_item.xml b/app/src/main/res/layouts/row_layouts/layout/pr_header_row_item.xml new file mode 100644 index 000000000..425c748ec --- /dev/null +++ b/app/src/main/res/layouts/row_layouts/layout/pr_header_row_item.xml @@ -0,0 +1,371 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/row_layouts/layout/preference_widget_color.xml b/app/src/main/res/layouts/row_layouts/layout/preference_widget_color.xml deleted file mode 100644 index bb8fb8ca4..000000000 --- a/app/src/main/res/layouts/row_layouts/layout/preference_widget_color.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - -