[
  {
    "path": ".gitignore",
    "content": "*.iml\n.gradle\n/local.properties\n/.idea/workspace.xml\n/.idea/libraries\n.DS_Store\n/captures\n\n# Built application files\n*.apk\n*.ap_\n\n# Files for the Dalvik VM\n*.dex\n\n# Java class files\n*.class\n\n# Generated files\nbin/\ngen/\n\n# Gradle files\n.gradle/\nbuild/\n/*/build/\n\n# Local configuration file (sdk path, etc)\nlocal.properties\n\n# Proguard folder generated by Eclipse\nproguard/\n\n# Log Files\n*.log\n"
  },
  {
    "path": ".idea/.name",
    "content": "AndroidLibs"
  },
  {
    "path": ".idea/compiler.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"CompilerConfiguration\">\n    <resourceExtensions />\n    <wildcardResourcePatterns>\n      <entry name=\"!?*.java\" />\n      <entry name=\"!?*.form\" />\n      <entry name=\"!?*.class\" />\n      <entry name=\"!?*.groovy\" />\n      <entry name=\"!?*.scala\" />\n      <entry name=\"!?*.flex\" />\n      <entry name=\"!?*.kt\" />\n      <entry name=\"!?*.clj\" />\n      <entry name=\"!?*.aj\" />\n    </wildcardResourcePatterns>\n    <annotationProcessing>\n      <profile default=\"true\" name=\"Default\" enabled=\"false\">\n        <processorPath useClasspath=\"true\" />\n      </profile>\n    </annotationProcessing>\n  </component>\n</project>"
  },
  {
    "path": ".idea/copyright/profiles_settings.xml",
    "content": "<component name=\"CopyrightManager\">\n  <settings default=\"\" />\n</component>"
  },
  {
    "path": ".idea/encodings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"Encoding\">\n    <file url=\"PROJECT\" charset=\"UTF-8\" />\n  </component>\n</project>"
  },
  {
    "path": ".idea/gradle.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"GradleSettings\">\n    <option name=\"linkedExternalProjectsSettings\">\n      <GradleProjectSettings>\n        <option name=\"distributionType\" value=\"DEFAULT_WRAPPED\" />\n        <option name=\"externalProjectPath\" value=\"$PROJECT_DIR$\" />\n        <option name=\"modules\">\n          <set>\n            <option value=\"$PROJECT_DIR$\" />\n            <option value=\"$PROJECT_DIR$/app\" />\n            <option value=\"$PROJECT_DIR$/flowlayoutmanager\" />\n          </set>\n        </option>\n        <option name=\"myModules\">\n          <set>\n            <option value=\"$PROJECT_DIR$\" />\n            <option value=\"$PROJECT_DIR$/app\" />\n            <option value=\"$PROJECT_DIR$/flowlayoutmanager\" />\n          </set>\n        </option>\n      </GradleProjectSettings>\n    </option>\n  </component>\n</project>"
  },
  {
    "path": ".idea/misc.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"EntryPointsManager\">\n    <entry_points version=\"2.0\" />\n  </component>\n  <component name=\"NullableNotNullManager\">\n    <option name=\"myDefaultNullable\" value=\"android.support.annotation.Nullable\" />\n    <option name=\"myDefaultNotNull\" value=\"android.support.annotation.NonNull\" />\n    <option name=\"myNullables\">\n      <value>\n        <list size=\"4\">\n          <item index=\"0\" class=\"java.lang.String\" itemvalue=\"org.jetbrains.annotations.Nullable\" />\n          <item index=\"1\" class=\"java.lang.String\" itemvalue=\"javax.annotation.Nullable\" />\n          <item index=\"2\" class=\"java.lang.String\" itemvalue=\"edu.umd.cs.findbugs.annotations.Nullable\" />\n          <item index=\"3\" class=\"java.lang.String\" itemvalue=\"android.support.annotation.Nullable\" />\n        </list>\n      </value>\n    </option>\n    <option name=\"myNotNulls\">\n      <value>\n        <list size=\"4\">\n          <item index=\"0\" class=\"java.lang.String\" itemvalue=\"org.jetbrains.annotations.NotNull\" />\n          <item index=\"1\" class=\"java.lang.String\" itemvalue=\"javax.annotation.Nonnull\" />\n          <item index=\"2\" class=\"java.lang.String\" itemvalue=\"edu.umd.cs.findbugs.annotations.NonNull\" />\n          <item index=\"3\" class=\"java.lang.String\" itemvalue=\"android.support.annotation.NonNull\" />\n        </list>\n      </value>\n    </option>\n  </component>\n  <component name=\"ProjectLevelVcsManager\" settingsEditedManually=\"false\">\n    <OptionsSetting value=\"true\" id=\"Add\" />\n    <OptionsSetting value=\"true\" id=\"Remove\" />\n    <OptionsSetting value=\"true\" id=\"Checkout\" />\n    <OptionsSetting value=\"true\" id=\"Update\" />\n    <OptionsSetting value=\"true\" id=\"Status\" />\n    <OptionsSetting value=\"true\" id=\"Edit\" />\n    <ConfirmationsSetting value=\"0\" id=\"Add\" />\n    <ConfirmationsSetting value=\"0\" id=\"Remove\" />\n  </component>\n  <component name=\"ProjectRootManager\" version=\"2\" languageLevel=\"JDK_1_7\" default=\"true\" assert-keyword=\"true\" jdk-15=\"true\" project-jdk-name=\"1.8\" project-jdk-type=\"JavaSDK\">\n    <output url=\"file://$PROJECT_DIR$/build/classes\" />\n  </component>\n  <component name=\"ProjectType\">\n    <option name=\"id\" value=\"Android\" />\n  </component>\n</project>"
  },
  {
    "path": ".idea/modules.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"ProjectModuleManager\">\n    <modules>\n      <module fileurl=\"file://$PROJECT_DIR$/AndroidLibs.iml\" filepath=\"$PROJECT_DIR$/AndroidLibs.iml\" />\n      <module fileurl=\"file://$PROJECT_DIR$/app/app.iml\" filepath=\"$PROJECT_DIR$/app/app.iml\" />\n      <module fileurl=\"file://$PROJECT_DIR$/flowlayoutmanager/flowlayoutmanager.iml\" filepath=\"$PROJECT_DIR$/flowlayoutmanager/flowlayoutmanager.iml\" />\n    </modules>\n  </component>\n</project>"
  },
  {
    "path": ".idea/runConfigurations.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"RunConfigurationProducerService\">\n    <option name=\"ignoredProducers\">\n      <set>\n        <option value=\"org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer\" />\n        <option value=\"org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer\" />\n        <option value=\"org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer\" />\n      </set>\n    </option>\n  </component>\n</project>"
  },
  {
    "path": ".idea/vcs.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"VcsDirectoryMappings\">\n    <mapping directory=\"$PROJECT_DIR$\" vcs=\"Git\" />\n  </component>\n</project>"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    {one line to give the program's name and a brief idea of what it does.}\n    Copyright (C) {year}  {name of author}\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    {project}  Copyright (C) {year}  {fullname}\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<http://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n\n"
  },
  {
    "path": "README.md",
    "content": "FlowLayoutManager & Demo App\n===\nThis is home page of FlowLayoutManager & It's Demo App. Please check [feature video](https://youtu.be/eyCb1gYT9mA) for features.\n\nFollowing is links to lib & demo app\n- [Flow LayoutManager](flowlayoutmanager)\n- [Demo Application](app)\n"
  },
  {
    "path": "app/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "app/build.gradle",
    "content": "apply plugin: 'com.android.application'\n\nandroid {\n    compileSdkVersion androidCompileSdkVersion\n    buildToolsVersion androidBuildToolVersion\n\n    defaultConfig {\n        applicationId \"com.xiaofeng.androidlibs\"\n        minSdkVersion androidMinSdkVersion\n        targetSdkVersion androidTargetSdkVersion\n        versionCode 1\n        versionName \"1.0\"\n    }\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n        }\n    }\n    dexOptions {\n        incremental true\n    }\n    compileOptions {\n        sourceCompatibility JavaVersion.VERSION_1_7\n        targetCompatibility JavaVersion.VERSION_1_7\n    }\n}\n\ndependencies {\n    compile fileTree(include: ['*.jar'], dir: 'libs')\n    testCompile 'junit:junit:4.12'\n    compile(group: 'com.android.support', name: 'design', version: supportLibVersion)\n    compile(group: 'com.android.support', name: 'appcompat-v7', version: supportLibVersion)\n    compile(group: 'com.android.support', name: 'recyclerview-v7', version: supportLibVersion)\n    compile(group: 'com.android.support', name: 'recyclerview-v7', version: supportLibVersion)\n    compile 'com.xiaofeng.android:flowlayoutmanager:1.2.3.2'\n    compile 'us.feras.mdv:markdownview:1.1.0'\n    compile 'com.android.support:support-v4:23.3.0'\n}\n"
  },
  {
    "path": "app/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /home/xiaofeng/Android/Sdk/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the proguardFiles\n# directive in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n"
  },
  {
    "path": "app/src/androidTest/java/com/xiaofeng/androidlibs/ApplicationTest.java",
    "content": "package com.xiaofeng.androidlibs;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCase;\n\n/**\n * <a href=\"http://d.android.com/tools/testing/testing_android.html\">Testing Fundamentals</a>\n */\npublic class ApplicationTest extends ApplicationTestCase<Application> {\n\tpublic ApplicationTest() {\n\t\tsuper(Application.class);\n\t}\n}"
  },
  {
    "path": "app/src/main/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n          package=\"com.xiaofeng.androidlibs\">\n\n    <application\n        android:allowBackup=\"true\"\n        android:icon=\"@mipmap/ic_launcher\"\n        android:label=\"@string/app_name\"\n        android:supportsRtl=\"true\"\n        android:theme=\"@style/AppTheme\">\n        <activity\n            android:name=\".MainActivity\"\n            android:label=\"@string/app_name\"\n            android:theme=\"@style/AppTheme.NoActionBar\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\"/>\n\n                <category android:name=\"android.intent.category.LAUNCHER\"/>\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\".SettingsActivity\"\n            android:label=\"@string/title_activity_settings\"\n            android:parentActivityName=\".MainActivity\">\n        </activity>\n    </application>\n\n</manifest>"
  },
  {
    "path": "app/src/main/assets/instruction.md",
    "content": "- Tap on item to remove\n- Long press on item to add an item in front of it"
  },
  {
    "path": "app/src/main/java/com/xiaofeng/androidlibs/DemoAdapter.java",
    "content": "package com.xiaofeng.androidlibs;\n\nimport android.support.v7.widget.RecyclerView;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\n\nimport java.util.LinkedList;\nimport java.util.List;\n\n/**\n * Adapter for Demo item\n */\npublic class DemoAdapter extends RecyclerView.Adapter<DemoViewHolder> {\n\tList<String> items;\n\tprivate int maxLinesPerItem;\n\tprivate boolean showMeta = false;\n\tpublic DemoAdapter() {\n\t\tthis.items = new LinkedList<>();\n\t\tmaxLinesPerItem = 1;\n\t}\n\n\tpublic DemoAdapter(int maxLinesPerItem, List<String> items) {\n\t\tthis();\n\t\tthis.items.addAll(items);\n\t\tthis.maxLinesPerItem = maxLinesPerItem;\n\t}\n\n\t@Override\n\tpublic DemoViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {\n\t\treturn new DemoViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.listitem_tag, parent, false)).setShowMeta(showMeta);\n\t}\n\n\t@Override\n\tpublic void onBindViewHolder(final DemoViewHolder holder, final int position) {\n\t\tholder.setTagText(items.get(position));\n\t\tholder.tagSize.setClickable(false);\n\t\tholder.tagText.setClickable(false);\n\t\tholder.itemView.setOnClickListener(new View.OnClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tint adapterPosition = holder.getAdapterPosition();\n\t\t\t\titems.remove(adapterPosition);\n\t\t\t\tnotifyItemRemoved(adapterPosition);\n\t\t\t}\n\t\t});\n\t\tholder.itemView.setOnLongClickListener(new View.OnLongClickListener() {\n\t\t\t@Override\n\t\t\tpublic boolean onLongClick(View v) {\n\t\t\t\tint adapterPosition = holder.getAdapterPosition();\n\t\t\t\tList<String> newItems = DemoUtil.generate(1, 3, 14, maxLinesPerItem, true);\n\t\t\t\titems.addAll(adapterPosition, newItems);\n\t\t\t\tnotifyItemRangeInserted(adapterPosition, newItems.size());\n\t\t\t\treturn true;\n\t\t\t}\n\t\t});\n\t}\n\n\t@Override\n\tpublic int getItemCount() {\n\t\treturn items.size();\n\t}\n\n\tpublic void newItems(int maxLinesPerItem, List<String> newItems) {\n\t\tthis.maxLinesPerItem = maxLinesPerItem;\n\t\titems.clear();\n\t\titems.addAll(newItems);\n\t}\n\n\tpublic int getMaxLinesPerItem() {\n\t\treturn maxLinesPerItem;\n\t}\n\n\tpublic void setShowMeta(boolean showMeta) {\n\t\tthis.showMeta = showMeta;\n\t}\n}\n"
  },
  {
    "path": "app/src/main/java/com/xiaofeng/androidlibs/DemoUtil.java",
    "content": "package com.xiaofeng.androidlibs;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Random;\n\n/**\n * Utility for demo item generate\n */\npublic class DemoUtil {\n\tprivate static final Random random = new Random();\n\tprivate static final String STRING_BASE = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n\tpublic static List<String> generate(int total, int minLen, int maxLen, int maxLinesPerItem, boolean randomOrder) {\n\t\tArrayList<String> result = new ArrayList<>(total);\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i = 0; i < total; i ++) {\n\t\t\tsb.setLength(0);\n\t\t\tint lineCount = random.nextInt(maxLinesPerItem) + 1;\n\t\t\tList<String> lines = generate(lineCount, minLen, maxLen, randomOrder);\n\t\t\tboolean firstLine = true;\n\t\t\tfor (String line : lines) {\n\t\t\t\tif (firstLine) {\n\t\t\t\t\tfirstLine = false;\n\t\t\t\t} else {\n\t\t\t\t\tsb.append(\"\\n\");\n\t\t\t\t}\n\t\t\t\tsb.append(line);\n\t\t\t}\n\t\t\tresult.add(sb.toString());\n\t\t}\n\t\treturn result;\n\t}\n\tpublic static List<String> generate(int total, int minLen, int maxLen, boolean randomOrder) {\n\t\tint baseLen = STRING_BASE.length();\n\t\tArrayList<String> result = new ArrayList<>(total);\n\t\tint baseIndex, len;\n\t\tfor (int i = 0; i < total; i ++) {\n\t\t\tint index = i;\n\t\t\tif (randomOrder) {\n\t\t\t\tindex += random.nextInt(1000);\n\t\t\t}\n\t\t\tbaseIndex = index % baseLen;\n\t\t\tlen = random.nextInt(maxLen - minLen) + minLen;\n\t\t\tchar baseChar = STRING_BASE.charAt(baseIndex);\n\t\t\tchar[] chars = new char[len];\n\t\t\tfor (int j = 0; j < len; j ++) {\n\t\t\t\tchars[j] = baseChar;\n\t\t\t}\n\t\t\tresult.add(new String(chars));\n\t\t}\n\t\treturn result;\n\t}\n}\n"
  },
  {
    "path": "app/src/main/java/com/xiaofeng/androidlibs/DemoViewHolder.java",
    "content": "package com.xiaofeng.androidlibs;\n\nimport android.support.v7.widget.RecyclerView;\nimport android.view.View;\nimport android.widget.TextView;\n\npublic class DemoViewHolder extends RecyclerView.ViewHolder {\n\tboolean showMeta = false;\n\tTextView tagText, tagSize;\n\tpublic DemoViewHolder(View itemView) {\n\t\tsuper(itemView);\n\t\ttagText = (TextView)itemView.findViewById(R.id.tag_text);\n\t\ttagSize = (TextView)itemView.findViewById(R.id.tag_count);\n\t}\n\n\tpublic void setTagText(String tag) {\n\t\ttagText.setText(tag);\n\t\tif (showMeta) {\n\t\t\tString[] lines = tag.split(\"\\n\");\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tsb.append(\"(\").append(lines.length).append(\":\");\n\t\t\tint length = 0;\n\t\t\tboolean first = true;\n\t\t\tfor (String line : lines) {\n\t\t\t\tif (first) {\n\t\t\t\t\tfirst = false;\n\t\t\t\t} else {\n\t\t\t\t\tsb.append(\",\");\n\t\t\t\t}\n\t\t\t\tsb.append(line.length());\n\t\t\t\tlength += line.length();\n\t\t\t}\n\t\t\tsb.append(\":\").append(length).append(\")\");\n\t\t\ttagSize.setText(sb.toString());\n\t\t}\n\t}\n\n\tpublic DemoViewHolder setShowMeta(boolean showMeta) {\n\t\tthis.showMeta = showMeta;\n\t\tif (showMeta) {\n\t\t\ttagSize.setVisibility(View.VISIBLE);\n\t\t} else {\n\t\t\ttagSize.setVisibility(View.GONE);\n\t\t}\n\t\treturn this;\n\t}\n}\n"
  },
  {
    "path": "app/src/main/java/com/xiaofeng/androidlibs/GeneralPreferenceFragment.java",
    "content": "package com.xiaofeng.androidlibs;\n\nimport android.content.Context;\nimport android.os.Bundle;\nimport android.preference.EditTextPreference;\nimport android.preference.ListPreference;\nimport android.preference.Preference;\nimport android.preference.PreferenceFragment;\nimport android.preference.PreferenceManager;\n\nimport com.xiaofeng.androidlibs.util.ArrayUtil;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\n/**\n * This fragment shows general preferences only. It is used when the\n * activity is showing a two-pane settings UI.\n */\npublic class GeneralPreferenceFragment extends PreferenceFragment {\n\tpublic static class SummaryMapInfo {\n\t\tpublic final String summaryTemplate;\n\t\tpublic final String[] values;\n\t\tpublic final String[] entries;\n\n\t\tpublic SummaryMapInfo(String summaryTemplate, String[] values, String[] entries) {\n\t\t\tthis.summaryTemplate = summaryTemplate;\n\t\t\tthis.values = values;\n\t\t\tthis.entries = entries;\n\t\t}\n\t}\n\tprivate final Map<String, SummaryMapInfo> keySummaryInfoMap = new HashMap<>();\n\n\tprivate Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {\n\t\t@Override\n\t\tpublic boolean onPreferenceChange(Preference preference, Object value) {\n\t\t\tif (keySummaryInfoMap.containsKey(preference.getKey())) {\n\t\t\t\tSummaryMapInfo summaryMapInfo = keySummaryInfoMap.get(preference.getKey());\n\t\t\t\tif (preference instanceof ListPreference) {\n\t\t\t\t\tint index = ArrayUtil.indexOf(summaryMapInfo.values, value.toString());\n\t\t\t\t\tif (index != ArrayUtil.NOT_FOUND) {\n\t\t\t\t\t\tpreference.setSummary(String.format(summaryMapInfo.summaryTemplate, summaryMapInfo.entries[index]));\n\t\t\t\t\t}\n\t\t\t\t} else if (preference instanceof EditTextPreference) {\n\t\t\t\t\tpreference.setSummary(String.format(summaryMapInfo.summaryTemplate, value));\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t};\n\t@Override\n\tpublic void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\taddPreferencesFromResource(R.xml.pref_general);\n\n\t}\n\n\t@Override\n\tpublic void onAttach(Context context) {\n\t\tsuper.onAttach(context);\n\t\tkeySummaryInfoMap.put(getString(R.string.pref_key_max_items_per_line), new SummaryMapInfo(getString(R.string.pref_max_items_per_line_summary_template), getResources().getStringArray(R.array.pref_max_items_per_line_values), getResources().getStringArray(R.array.pref_max_items_per_line_entries)));\n\t\tkeySummaryInfoMap.put(getString(R.string.pref_key_alignment), new SummaryMapInfo(getString(R.string.pref_alignment_summary_template), getResources().getStringArray(R.array.pref_alignment_values), getResources().getStringArray(R.array.pref_alignment_entries)));\n\t\tkeySummaryInfoMap.put(getString(R.string.pref_key_max_lines_per_item), new SummaryMapInfo(getString(R.string.pref_max_lines_per_item_summary_template), null, null));\n\t}\n\n\t@Override\n\tpublic void onActivityCreated(Bundle savedInstanceState) {\n\t\tsuper.onActivityCreated(savedInstanceState);\n\t\tbindPreferenceSummaryToValue(findPreference(getString(R.string.pref_key_alignment)));\n\t\tbindPreferenceSummaryToValue(findPreference(getString(R.string.pref_key_max_items_per_line)));\n\t\tbindPreferenceSummaryToValue(findPreference(getString(R.string.pref_key_max_lines_per_item)));\n\t}\n\n\t/**\n\t * Binds a preference's summary to its value. More specifically, when the\n\t * preference's value is changed, its summary (line of text below the\n\t * preference title) is updated to reflect the value. The summary is also\n\t * immediately updated upon calling this method. The exact display format is\n\t * dependent on the type of preference.\n\t *\n\t * @see #sBindPreferenceSummaryToValueListener\n\t */\n\tprivate void bindPreferenceSummaryToValue(Preference preference) {\n\t\t// Set the listener to watch for value changes.\n\t\tpreference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);\n\n\t\t// Trigger the listener immediately with the preference's\n\t\t// current value.\n\t\tsBindPreferenceSummaryToValueListener.onPreferenceChange(preference,\n\t\t\t\tPreferenceManager\n\t\t\t\t\t\t.getDefaultSharedPreferences(preference.getContext())\n\t\t\t\t\t\t.getString(preference.getKey(), \"\"));\n\t}\n}\n"
  },
  {
    "path": "app/src/main/java/com/xiaofeng/androidlibs/MainActivity.java",
    "content": "package com.xiaofeng.androidlibs;\n\nimport android.content.Intent;\nimport android.content.SharedPreferences;\nimport android.graphics.Rect;\nimport android.os.Bundle;\nimport android.preference.PreferenceManager;\nimport android.support.v7.app.AppCompatActivity;\nimport android.support.v7.widget.RecyclerView;\nimport android.support.v7.widget.Toolbar;\nimport android.view.Menu;\nimport android.view.MenuItem;\nimport android.view.View;\n\nimport com.xiaofeng.flowlayoutmanager.Alignment;\nimport com.xiaofeng.flowlayoutmanager.FlowLayoutManager;\n\nimport us.feras.mdv.MarkdownView;\n\npublic class MainActivity extends AppCompatActivity {\n\n\tRecyclerView recyclerView;\n\tFlowLayoutManager flowLayoutManager;\n\tMarkdownView markdownView;\n\tprivate static final int REQ_CODE_SETTINGS = 101;\n\tprivate boolean settingChanged = false;\n\t@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.app_bar_main);\n\t\tToolbar toolbar = (Toolbar) findViewById(R.id.toolbar);\n\t\tsetSupportActionBar(toolbar);\n\t\tinit();\n\t}\n\n\tprivate void init() {\n\t\trecyclerView = (RecyclerView) findViewById(R.id.list);\n\t\tflowLayoutManager = new FlowLayoutManager().singleItemPerLine();\n\t\tflowLayoutManager.setAutoMeasureEnabled(true);\n\t\trecyclerView.setLayoutManager(flowLayoutManager);\n\t\trecyclerView.setAdapter(new DemoAdapter(1, DemoUtil.generate(2000, 3, 13, 1, false)));\n\t\trecyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {\n\t\t\t@Override\n\t\t\tpublic void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {\n\t\t\t\tsuper.getItemOffsets(outRect, view, parent, state);\n\t\t\t\toutRect.set(5, 5, 5, 5);\n\t\t\t}\n\t\t});\n\n\t\tmarkdownView = (MarkdownView)findViewById(R.id.instruction_mdown);\n\t\tmarkdownView.loadMarkdownFile(\"file:///android_asset/instruction.md\");\n\t\tloadSettingsFromSharedPref();\n\t}\n\n\t@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.main, menu);\n\t\treturn super.onCreateOptionsMenu(menu);\n\t}\n\n\t@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tif (item.getItemId() == R.id.action_settings) {\n\t\t\tstartActivityForResult(new Intent(this, SettingsActivity.class), REQ_CODE_SETTINGS);\n\t\t\treturn true;\n\t\t}\n\t\treturn super.onOptionsItemSelected(item);\n\t}\n\n\tprivate void loadSettingsFromSharedPref() {\n\t\tSharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);\n\t\tString itemsPerLineString = sharedPreferences.getString(getResources().getString(R.string.pref_key_max_items_per_line), getString(R.string.pref_max_items_per_line_default));\n\t\tint itemsPerLine = Integer.valueOf(itemsPerLineString);\n\n\t\tString alignmentString = sharedPreferences.getString(getResources().getString(R.string.pref_key_alignment), getString(R.string.pref_alignment_default));\n\t\tint alignmentInt = Integer.valueOf(alignmentString);\n\t\tAlignment[] alignments = Alignment.values();\n\t\tAlignment selectedAlignment = Alignment.LEFT;\n\t\tfor (Alignment alignment : alignments) {\n\t\t\tif (alignment.ordinal() == alignmentInt) {\n\t\t\t\tselectedAlignment = alignment;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n//\t\tboolean showMeta = sharedPreferences.getBoolean(getString(R.string.pref_key_show_meta), false);\n\n\t\tflowLayoutManager.maxItemsPerLine(itemsPerLine);\n\t\tflowLayoutManager.setAlignment(selectedAlignment);\n\t\tDemoAdapter demoAdapter = (DemoAdapter)recyclerView.getAdapter();\n//\t\tdemoAdapter.setShowMeta(showMeta);\n\t\tString maxLinesPerItemString = sharedPreferences.getString(getString(R.string.pref_key_max_lines_per_item), getString(R.string.pref_max_lines_per_item_default));\n\t\tint maxLinesPerItem = Integer.valueOf(maxLinesPerItemString);\n\t\tdemoAdapter.newItems(maxLinesPerItem, DemoUtil.generate(demoAdapter.getItemCount(), 3, 13, maxLinesPerItem, false));\n\t\trecyclerView.getAdapter().notifyItemRangeChanged(0, recyclerView.getAdapter().getItemCount());\n\t}\n\n\t@Override\n\tprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n\t\tsuper.onActivityResult(requestCode, resultCode, data);\n\t\tif (requestCode == REQ_CODE_SETTINGS) {\n\t\t\tsettingChanged = true;\n\t\t}\n\t}\n\n\t@Override\n\tpublic void onWindowFocusChanged(boolean hasFocus) {\n\t\tsuper.onWindowFocusChanged(hasFocus);\n\t\tif (hasFocus) {\n\t\t\tif (settingChanged) {\n\t\t\t\tsettingChanged = false;\n\t\t\t\trecyclerView.post(new Runnable() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\tloadSettingsFromSharedPref();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "app/src/main/java/com/xiaofeng/androidlibs/SettingsActivity.java",
    "content": "package com.xiaofeng.androidlibs;\n\n\nimport android.app.Activity;\nimport android.content.SharedPreferences;\nimport android.os.Bundle;\nimport android.preference.PreferenceActivity;\nimport android.preference.PreferenceManager;\nimport android.support.v7.app.ActionBar;\nimport android.support.v7.app.AppCompatActivity;\nimport android.view.Menu;\nimport android.view.MenuItem;\n\n/**\n * A {@link PreferenceActivity} that presents a set of application settings. On\n * handset devices, settings are presented as a single list. On tablets,\n * settings are split by category, with category headers shown to the left of\n * the list of settings.\n * <p>\n * See <a href=\"http://developer.android.com/design/patterns/settings.html\">\n * Android Design: Settings</a> for design guidelines and the <a\n * href=\"http://developer.android.com/guide/topics/ui/settings.html\">Settings\n * API Guide</a> for more information on developing a Settings UI.\n */\npublic class SettingsActivity extends AppCompatActivity {\n\n\t@Override\n\tprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetupActionBar();\n\t\tsetContentView(R.layout.activity_settings);\n\t\tPreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(new SharedPreferences.OnSharedPreferenceChangeListener() {\n\t\t\t@Override\n\t\t\tpublic void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {\n\n\t\t\t}\n\t\t});\n\t\tgetFragmentManager().beginTransaction().add(R.id.fragment_container, new GeneralPreferenceFragment(), \"General Settings\").commit();\n\t}\n\n\t/**\n\t * Set up the {@link android.app.ActionBar}, if the API is available.\n\t */\n\tprivate void setupActionBar() {\n\t\tActionBar actionBar = getSupportActionBar();\n\t\tif (actionBar != null) {\n\t\t\t// Show the Up button in the action bar.\n\t\t\tactionBar.setDisplayHomeAsUpEnabled(true);\n\t\t}\n\t}\n\n\t@Override\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.settings, menu);\n\t\treturn super.onCreateOptionsMenu(menu);\n\t}\n\n\t@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tif (item.getItemId() == R.id.done) {\n\t\t\tsetResult(Activity.RESULT_OK);\n\t\t\tfinish();\n\t\t}\n\t\treturn super.onOptionsItemSelected(item);\n\t}\n}\n"
  },
  {
    "path": "app/src/main/java/com/xiaofeng/androidlibs/util/ArrayUtil.java",
    "content": "package com.xiaofeng.androidlibs.util;\n\n/**\n * Created by xhan on 5/14/16.\n */\npublic class ArrayUtil {\n\tpublic static final int NOT_FOUND = -1;\n\tpublic static <T extends Comparable> int indexOf(T[] arr, T searchKey) {\n\t\tif (CollectionUtil.isEmpty(arr)) {\n\t\t\treturn NOT_FOUND;\n\t\t}\n\t\tint index = 0;\n\t\tfor (T arrItem : arr) {\n\t\t\tif (arrItem.compareTo(searchKey) == 0) {\n\t\t\t\treturn index;\n\t\t\t}\n\t\t\tindex ++;\n\t\t}\n\t\treturn NOT_FOUND;\n\t}\n}\n"
  },
  {
    "path": "app/src/main/java/com/xiaofeng/androidlibs/util/CollectionUtil.java",
    "content": "package com.xiaofeng.androidlibs.util;\n\n/**\n * Created by xhan on 5/14/16.\n */\npublic class CollectionUtil {\n\tpublic static <T> boolean isEmpty(T[] arr) {\n\t\tif (arr == null || arr.length == 0) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\n"
  },
  {
    "path": "app/src/main/res/drawable/side_nav_bar.xml",
    "content": "<shape xmlns:android=\"http://schemas.android.com/apk/res/android\"\n       android:shape=\"rectangle\">\n    <gradient\n        android:angle=\"135\"\n        android:centerColor=\"#4CAF50\"\n        android:endColor=\"#2E7D32\"\n        android:startColor=\"#81C784\"\n        android:type=\"linear\"/>\n</shape>"
  },
  {
    "path": "app/src/main/res/drawable-v21/ic_menu_camera.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:width=\"24dp\"\n        android:height=\"24dp\"\n        android:viewportHeight=\"24.0\"\n        android:viewportWidth=\"24.0\">\n    <path\n        android:fillColor=\"#FF000000\"\n        android:pathData=\"M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0\"/>\n    <path\n        android:fillColor=\"#FF000000\"\n        android:pathData=\"M9,2L7.17,4H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2H9zm3,15c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z\"/>\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable-v21/ic_menu_gallery.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:width=\"24dp\"\n        android:height=\"24dp\"\n        android:viewportHeight=\"24.0\"\n        android:viewportWidth=\"24.0\">\n    <path\n        android:fillColor=\"#FF000000\"\n        android:pathData=\"M22,16V4c0,-1.1 -0.9,-2 -2,-2H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2zm-11,-4l2.03,2.71L16,11l4,5H8l3,-4zM2,6v14c0,1.1 0.9,2 2,2h14v-2H4V6H2z\"/>\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable-v21/ic_menu_manage.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:width=\"24dp\"\n        android:height=\"24dp\"\n        android:viewportHeight=\"24.0\"\n        android:viewportWidth=\"24.0\">\n    <path\n        android:fillColor=\"#FF000000\"\n        android:pathData=\"M22.7,19l-9.1,-9.1c0.9,-2.3 0.4,-5 -1.5,-6.9 -2,-2 -5,-2.4 -7.4,-1.3L9,6 6,9 1.6,4.7C0.4,7.1 0.9,10.1 2.9,12.1c1.9,1.9 4.6,2.4 6.9,1.5l9.1,9.1c0.4,0.4 1,0.4 1.4,0l2.3,-2.3c0.5,-0.4 0.5,-1.1 0.1,-1.4z\"/>\n</vector>"
  },
  {
    "path": "app/src/main/res/drawable-v21/ic_menu_send.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:width=\"24dp\"\n        android:height=\"24dp\"\n        android:viewportHeight=\"24.0\"\n        android:viewportWidth=\"24.0\">\n    <path\n        android:fillColor=\"#FF000000\"\n        android:pathData=\"M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z\"/>\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable-v21/ic_menu_share.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:width=\"24dp\"\n        android:height=\"24dp\"\n        android:viewportHeight=\"24.0\"\n        android:viewportWidth=\"24.0\">\n    <path\n        android:fillColor=\"#FF000000\"\n        android:pathData=\"M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z\"/>\n</vector>\n"
  },
  {
    "path": "app/src/main/res/drawable-v21/ic_menu_slideshow.xml",
    "content": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:width=\"24dp\"\n        android:height=\"24dp\"\n        android:viewportHeight=\"24.0\"\n        android:viewportWidth=\"24.0\">\n    <path\n        android:fillColor=\"#FF000000\"\n        android:pathData=\"M4,6H2v14c0,1.1 0.9,2 2,2h14v-2H4V6zm16,-4H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4c0,-1.1 -0.9,-2 -2,-2zm-8,12.5v-9l6,4.5 -6,4.5z\"/>\n</vector>\n"
  },
  {
    "path": "app/src/main/res/layout/activity_settings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<FrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n             android:id=\"@+id/fragment_container\"\n              android:orientation=\"vertical\"\n              android:layout_width=\"match_parent\"\n              android:layout_height=\"match_parent\">\n\n</FrameLayout>"
  },
  {
    "path": "app/src/main/res/layout/app_bar_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<android.support.design.widget.CoordinatorLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:fitsSystemWindows=\"true\"\n    tools:context=\"com.xiaofeng.androidlibs.MainActivity\">\n\n    <android.support.design.widget.AppBarLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:theme=\"@style/AppTheme.AppBarOverlay\">\n\n        <android.support.v7.widget.Toolbar\n            android:id=\"@+id/toolbar\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"?attr/actionBarSize\"\n            android:background=\"?attr/colorPrimary\"\n            app:popupTheme=\"@style/AppTheme.PopupOverlay\"/>\n\n    </android.support.design.widget.AppBarLayout>\n    <include layout=\"@layout/content_main\"/>\n</android.support.design.widget.CoordinatorLayout>\n"
  },
  {
    "path": "app/src/main/res/layout/content_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:paddingBottom=\"@dimen/activity_vertical_margin\"\n    android:paddingLeft=\"@dimen/activity_horizontal_margin\"\n    android:paddingRight=\"@dimen/activity_horizontal_margin\"\n    android:paddingTop=\"@dimen/activity_vertical_margin\"\n    app:layout_behavior=\"@string/appbar_scrolling_view_behavior\"\n    tools:context=\"com.xiaofeng.androidlibs.MainActivity\"\n    tools:showIn=\"@layout/app_bar_main\"\n    android:orientation=\"vertical\">\n    <FrameLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:padding=\"8dp\"\n        android:background=\"@color/instructionBackground\">\n        <us.feras.mdv.MarkdownView\n            android:id=\"@+id/instruction_mdown\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:background=\"@color/instructionBackground\"/>\n    </FrameLayout>\n    <android.support.v7.widget.RecyclerView\n        android:id=\"@+id/list\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:background=\"@color/colorAccent\"/>\n</LinearLayout>\n"
  },
  {
    "path": "app/src/main/res/layout/listitem_tag.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n              android:orientation=\"horizontal\"\n              android:layout_width=\"wrap_content\"\n              android:layout_height=\"wrap_content\"\n              android:background=\"@color/colorPrimary\"\n    android:padding=\"10dp\">\n    <TextView\n        android:id=\"@+id/tag_text\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_marginRight=\"4dp\"\n        android:text=\"0000\"/>\n    <TextView\n        android:id=\"@+id/tag_count\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"(4)\"/>\n\n</LinearLayout>"
  },
  {
    "path": "app/src/main/res/layout/nav_header_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n              android:layout_width=\"match_parent\"\n              android:layout_height=\"@dimen/nav_header_height\"\n              android:background=\"@drawable/side_nav_bar\"\n              android:gravity=\"bottom\"\n              android:orientation=\"vertical\"\n              android:paddingBottom=\"@dimen/activity_vertical_margin\"\n              android:paddingLeft=\"@dimen/activity_horizontal_margin\"\n              android:paddingRight=\"@dimen/activity_horizontal_margin\"\n              android:paddingTop=\"@dimen/activity_vertical_margin\"\n              android:theme=\"@style/ThemeOverlay.AppCompat.Dark\">\n\n    <ImageView\n        android:id=\"@+id/imageView\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:paddingTop=\"@dimen/nav_header_vertical_spacing\"\n        android:src=\"@android:drawable/sym_def_app_icon\"/>\n\n    <TextView\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:paddingTop=\"@dimen/nav_header_vertical_spacing\"\n        android:text=\"Android Studio\"\n        android:textAppearance=\"@style/TextAppearance.AppCompat.Body1\"/>\n\n    <TextView\n        android:id=\"@+id/textView\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"android.studio@android.com\"/>\n\n</LinearLayout>\n"
  },
  {
    "path": "app/src/main/res/menu/main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\"\n      xmlns:app=\"http://schemas.android.com/apk/res-auto\">\n    <item\n        android:id=\"@+id/action_settings\"\n        android:orderInCategory=\"100\"\n        android:title=\"@string/action_settings\"\n        app:showAsAction=\"always\"/>\n</menu>\n"
  },
  {
    "path": "app/src/main/res/menu/settings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\"\n      xmlns:app=\"http://schemas.android.com/apk/res-auto\">\n    <item android:id=\"@+id/done\" android:title=\"DONE\" app:showAsAction=\"always\"/>\n</menu>"
  },
  {
    "path": "app/src/main/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"colorPrimary\">#3F51B5</color>\n    <color name=\"colorPrimaryDark\">#303F9F</color>\n    <color name=\"colorAccent\">#FF4081</color>\n    <color name=\"instructionBackground\">#ffff99</color>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/dimens.xml",
    "content": "<resources>\n    <!-- Default screen margins, per the Android Design guidelines. -->\n    <dimen name=\"nav_header_vertical_spacing\">16dp</dimen>\n    <dimen name=\"nav_header_height\">160dp</dimen>\n    <!-- Default screen margins, per the Android Design guidelines. -->\n    <dimen name=\"activity_horizontal_margin\">16dp</dimen>\n    <dimen name=\"activity_vertical_margin\">16dp</dimen>\n    <dimen name=\"fab_margin\">16dp</dimen>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/drawables.xml",
    "content": "<resources xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item name=\"ic_menu_camera\" type=\"drawable\">@android:drawable/ic_menu_camera</item>\n    <item name=\"ic_menu_gallery\" type=\"drawable\">@android:drawable/ic_menu_gallery</item>\n    <item name=\"ic_menu_slideshow\" type=\"drawable\">@android:drawable/ic_menu_slideshow</item>\n    <item name=\"ic_menu_manage\" type=\"drawable\">@android:drawable/ic_menu_manage</item>\n    <item name=\"ic_menu_share\" type=\"drawable\">@android:drawable/ic_menu_share</item>\n    <item name=\"ic_menu_send\" type=\"drawable\">@android:drawable/ic_menu_send</item>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/pref_keys.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <string name=\"pref_key_alignment\">pref_key_align</string>\n    <string name=\"pref_key_max_items_per_line\">pref_key_max_items_per_line</string>\n    <string name=\"pref_key_max_lines_per_item\">pref_key_max_lines_per_item</string>\n    <string name=\"pref_key_show_meta\">pref_key_show_meta</string>\n</resources>"
  },
  {
    "path": "app/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">AndroidLibs</string>\n    <string name=\"action_settings\">Settings</string>\n    <string name=\"item_per_line_desc\">Items per lines</string>\n    <string name=\"alignment_desc\">Alignment</string>\n    <string name=\"title_activity_settings\">Settings</string>\n\n    <!-- Strings related to Settings -->\n\n    <!-- Example General settings -->\n    <string name=\"pref_header_general\">General</string>\n\n    <string name=\"pref_title_alignment\">Alignment</string>\n    <string name=\"pref_summary_alignment_left\">Align to left</string>\n    <string name=\"pref_summary_alignment_right\">Align to right</string>\n    <string name=\"pref_title_max_items_per_line\">Items per line</string>\n    <string name=\"pref_max_items_per_line_summary_template\">Max item number per line: %1$s</string>\n    <string-array name=\"pref_max_items_per_line_entries\">\n        <item>1 item</item>\n        <item>2 items</item>\n        <item>No limit</item>\n    </string-array>\n    <string name=\"pref_max_items_per_line_default\">0</string>\n    <string-array name=\"pref_max_items_per_line_values\">\n        <item>1</item>\n        <item>2</item>\n        <item>@string/pref_max_items_per_line_default</item>\n    </string-array>\n\n\n    <string-array name=\"pref_alignment_entries\">\n        <item>Align to left</item>\n        <item>Align to right</item>\n    </string-array>\n    <string name=\"pref_alignment_default\">0</string>\n    <string-array name=\"pref_alignment_values\">\n        <item>@string/pref_alignment_default</item>\n        <item>1</item>\n    </string-array>\n    <string name=\"pref_alignment_summary_template\">Current alignment: %1$s</string>\n    <string name=\"pref_max_lines_per_item_title\">Max items per line</string>\n    <string name=\"pref_max_lines_per_item_default\">1</string>\n    <string name=\"pref_max_lines_per_item_summary_template\">Max lines per item: %1$s</string>\n    <string name=\"pref_show_meta_title\">Show metadata for each item</string>\n    <string name=\"pref_show_meta_summary_on\">Show metadata</string>\n    <string name=\"pref_show_meta_summary_off\">Hide metadata</string>\n    <bool name=\"pref_show_meta_default\">false</bool>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/styles.xml",
    "content": "<resources>\n\n    <!-- Base application theme. -->\n    <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar\">\n        <!-- Customize your theme here. -->\n        <item name=\"colorPrimary\">@color/colorPrimary</item>\n        <item name=\"colorPrimaryDark\">@color/colorPrimaryDark</item>\n        <item name=\"colorAccent\">@color/colorAccent</item>\n    </style>\n\n    <style name=\"AppTheme.NoActionBar\">\n        <item name=\"windowActionBar\">false</item>\n        <item name=\"windowNoTitle\">true</item>\n    </style>\n\n    <style name=\"AppTheme.AppBarOverlay\" parent=\"ThemeOverlay.AppCompat.Dark.ActionBar\"/>\n\n    <style name=\"AppTheme.PopupOverlay\" parent=\"ThemeOverlay.AppCompat.Light\"/>\n\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values-v21/styles.xml",
    "content": "<resources>\n\n    <style name=\"AppTheme.NoActionBar\">\n        <item name=\"windowActionBar\">false</item>\n        <item name=\"windowNoTitle\">true</item>\n        <item name=\"android:windowDrawsSystemBarBackgrounds\">true</item>\n        <item name=\"android:statusBarColor\">@android:color/transparent</item>\n    </style>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values-w820dp/dimens.xml",
    "content": "<resources>\n    <!-- Example customization of dimensions originally defined in res/values/dimens.xml\n         (such as screen margins) for screens with more than 820dp of available width. This\n         would include 7\" and 10\" devices in landscape (~960dp and ~1280dp respectively). -->\n    <dimen name=\"activity_horizontal_margin\">64dp</dimen>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/xml/pref_general.xml",
    "content": "<PreferenceScreen xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <ListPreference\n        android:key=\"@string/pref_key_alignment\"\n        android:title=\"@string/pref_title_alignment\"\n        android:defaultValue=\"@string/pref_alignment_default\"\n        android:entries=\"@array/pref_alignment_entries\"\n        android:entryValues=\"@array/pref_alignment_values\"/>\n    <ListPreference\n        android:key=\"@string/pref_key_max_items_per_line\"\n        android:title=\"@string/pref_title_max_items_per_line\"\n        android:defaultValue=\"@string/pref_max_items_per_line_default\"\n        android:entries=\"@array/pref_max_items_per_line_entries\"\n        android:entryValues=\"@array/pref_max_items_per_line_values\"/>\n    <EditTextPreference\n        android:key=\"@string/pref_key_max_lines_per_item\"\n        android:title=\"@string/pref_max_lines_per_item_title\"\n        android:defaultValue=\"@string/pref_max_lines_per_item_default\"\n        android:inputType=\"numberDecimal\"/>\n    <!--<SwitchPreference-->\n        <!--android:key=\"@string/pref_key_show_meta\"-->\n        <!--android:title=\"@string/pref_show_meta_title\"-->\n        <!--android:defaultValue=\"@bool/pref_show_meta_default\"-->\n        <!--android:summaryOn=\"@string/pref_show_meta_summary_on\"-->\n        <!--android:summaryOff=\"@string/pref_show_meta_summary_off\"/>-->\n\n</PreferenceScreen>\n"
  },
  {
    "path": "app/src/test/java/com/xiaofeng/androidlibs/ExampleUnitTest.java",
    "content": "package com.xiaofeng.androidlibs;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * To work on unit tests, switch the Test Artifact in the Build Variants view.\n */\npublic class ExampleUnitTest {\n\t@Test\n\tpublic void addition_isCorrect() throws Exception {\n\t\tassertEquals(4, 2 + 2);\n\t}\n}"
  },
  {
    "path": "build.gradle",
    "content": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n    repositories {\n        jcenter()\n    }\n    dependencies {\n        classpath 'com.android.tools.build:gradle:2.1.0'\n        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'\n        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'\n        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'\n        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'\n        // NOTE: Do not place your application dependencies here; they belong\n        // in the individual module build.gradle files\n    }\n}\n\nallprojects {\n    repositories {\n        jcenter()\n    }\n}\n\nsubprojects {\n    ext.supportLibVersion = \"23.3.0\"\n    ext.playServiceVersion = \"8.4.0\"\n    ext.androidBuildToolVersion = \"23.0.3\";\n    ext.androidCompileSdkVersion = 23\n    ext.androidMinSdkVersion = 16\n    ext.androidTargetSdkVersion = 23\n}\n\ntask clean(type: Delete) {\n    delete rootProject.buildDir\n}\n"
  },
  {
    "path": "flowlayoutmanager/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "flowlayoutmanager/.idea/.name",
    "content": "flowlayoutmanager"
  },
  {
    "path": "flowlayoutmanager/.idea/compiler.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"CompilerConfiguration\">\n    <resourceExtensions />\n    <wildcardResourcePatterns>\n      <entry name=\"!?*.java\" />\n      <entry name=\"!?*.form\" />\n      <entry name=\"!?*.class\" />\n      <entry name=\"!?*.groovy\" />\n      <entry name=\"!?*.scala\" />\n      <entry name=\"!?*.flex\" />\n      <entry name=\"!?*.kt\" />\n      <entry name=\"!?*.clj\" />\n      <entry name=\"!?*.aj\" />\n    </wildcardResourcePatterns>\n    <annotationProcessing>\n      <profile default=\"true\" name=\"Default\" enabled=\"false\">\n        <processorPath useClasspath=\"true\" />\n      </profile>\n    </annotationProcessing>\n  </component>\n</project>"
  },
  {
    "path": "flowlayoutmanager/.idea/copyright/profiles_settings.xml",
    "content": "<component name=\"CopyrightManager\">\n  <settings default=\"\" />\n</component>"
  },
  {
    "path": "flowlayoutmanager/.idea/encodings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"Encoding\">\n    <file url=\"PROJECT\" charset=\"UTF-8\" />\n  </component>\n</project>"
  },
  {
    "path": "flowlayoutmanager/.idea/gradle.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"GradleSettings\">\n    <option name=\"linkedExternalProjectsSettings\">\n      <GradleProjectSettings>\n        <option name=\"distributionType\" value=\"DEFAULT_WRAPPED\" />\n        <option name=\"externalProjectPath\" value=\"$PROJECT_DIR$\" />\n      </GradleProjectSettings>\n    </option>\n  </component>\n</project>"
  },
  {
    "path": "flowlayoutmanager/.idea/misc.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"ProjectLevelVcsManager\" settingsEditedManually=\"false\">\n    <OptionsSetting value=\"true\" id=\"Add\" />\n    <OptionsSetting value=\"true\" id=\"Remove\" />\n    <OptionsSetting value=\"true\" id=\"Checkout\" />\n    <OptionsSetting value=\"true\" id=\"Update\" />\n    <OptionsSetting value=\"true\" id=\"Status\" />\n    <OptionsSetting value=\"true\" id=\"Edit\" />\n    <ConfirmationsSetting value=\"0\" id=\"Add\" />\n    <ConfirmationsSetting value=\"0\" id=\"Remove\" />\n  </component>\n  <component name=\"ProjectRootManager\" version=\"2\" languageLevel=\"JDK_1_6\" default=\"true\" assert-keyword=\"true\" jdk-15=\"true\">\n    <output url=\"file://$PROJECT_DIR$/build/classes\" />\n  </component>\n  <component name=\"ProjectType\">\n    <option name=\"id\" value=\"Android\" />\n  </component>\n</project>"
  },
  {
    "path": "flowlayoutmanager/.idea/modules.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"ProjectModuleManager\">\n    <modules>\n      <module fileurl=\"file://$PROJECT_DIR$/flowlayoutmanager.iml\" filepath=\"$PROJECT_DIR$/flowlayoutmanager.iml\" />\n    </modules>\n  </component>\n</project>"
  },
  {
    "path": "flowlayoutmanager/.idea/runConfigurations.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"RunConfigurationProducerService\">\n    <option name=\"ignoredProducers\">\n      <set>\n        <option value=\"org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer\" />\n        <option value=\"org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer\" />\n        <option value=\"org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer\" />\n      </set>\n    </option>\n  </component>\n</project>"
  },
  {
    "path": "flowlayoutmanager/.idea/workspace.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"ChangeListManager\">\n    <list default=\"true\" id=\"f715bec9-02b3-4ff2-8398-220a6122ac49\" name=\"Default\" comment=\"\" />\n    <ignored path=\"flowlayoutmanager.iws\" />\n    <ignored path=\".idea/workspace.xml\" />\n    <ignored path=\"$PROJECT_DIR$/build/classes/\" />\n    <option name=\"EXCLUDED_CONVERTED_TO_IGNORED\" value=\"true\" />\n    <option name=\"TRACKING_ENABLED\" value=\"true\" />\n    <option name=\"SHOW_DIALOG\" value=\"false\" />\n    <option name=\"HIGHLIGHT_CONFLICTS\" value=\"true\" />\n    <option name=\"HIGHLIGHT_NON_ACTIVE_CHANGELIST\" value=\"false\" />\n    <option name=\"LAST_RESOLUTION\" value=\"IGNORE\" />\n  </component>\n  <component name=\"ChangesViewManager\" flattened_view=\"true\" show_ignored=\"false\" />\n  <component name=\"CreatePatchCommitExecutor\">\n    <option name=\"PATCH_PATH\" value=\"\" />\n  </component>\n  <component name=\"ExecutionTargetManager\" SELECTED_TARGET=\"default_target\" />\n  <component name=\"ExternalProjectsManager\">\n    <system id=\"GRADLE\">\n      <state>\n        <projects_view />\n      </state>\n    </system>\n  </component>\n  <component name=\"FavoritesManager\">\n    <favorites_list name=\"flowlayoutmanager\" />\n  </component>\n  <component name=\"GradleLocalSettings\">\n    <option name=\"externalProjectsViewState\">\n      <projects_view />\n    </option>\n  </component>\n  <component name=\"ProjectFrameBounds\">\n    <option name=\"x\" value=\"1440\" />\n    <option name=\"y\" value=\"23\" />\n    <option name=\"width\" value=\"1920\" />\n    <option name=\"height\" value=\"1053\" />\n  </component>\n  <component name=\"ProjectLevelVcsManager\" settingsEditedManually=\"false\">\n    <OptionsSetting value=\"true\" id=\"Add\" />\n    <OptionsSetting value=\"true\" id=\"Remove\" />\n    <OptionsSetting value=\"true\" id=\"Checkout\" />\n    <OptionsSetting value=\"true\" id=\"Update\" />\n    <OptionsSetting value=\"true\" id=\"Status\" />\n    <OptionsSetting value=\"true\" id=\"Edit\" />\n    <ConfirmationsSetting value=\"0\" id=\"Add\" />\n    <ConfirmationsSetting value=\"0\" id=\"Remove\" />\n  </component>\n  <component name=\"ProjectView\">\n    <navigator currentView=\"AndroidView\" proportions=\"\" version=\"1\">\n      <flattenPackages />\n      <showMembers />\n      <showModules />\n      <showLibraryContents />\n      <hideEmptyPackages />\n      <abbreviatePackageNames />\n      <autoscrollToSource />\n      <autoscrollFromSource />\n      <sortByType />\n      <manualOrder />\n      <foldersAlwaysOnTop value=\"true\" />\n    </navigator>\n    <panes>\n      <pane id=\"Scratches\" />\n      <pane id=\"PackagesPane\" />\n      <pane id=\"AndroidView\">\n        <subPane>\n          <PATH>\n            <PATH_ELEMENT>\n              <option name=\"myItemId\" value=\"flowlayoutmanager\" />\n              <option name=\"myItemType\" value=\"com.android.tools.idea.navigator.nodes.AndroidViewProjectNode\" />\n            </PATH_ELEMENT>\n            <PATH_ELEMENT>\n              <option name=\"myItemId\" value=\"Gradle Scripts\" />\n              <option name=\"myItemType\" value=\"com.android.tools.idea.navigator.nodes.AndroidBuildScriptsGroupNode\" />\n            </PATH_ELEMENT>\n          </PATH>\n          <PATH>\n            <PATH_ELEMENT>\n              <option name=\"myItemId\" value=\"flowlayoutmanager\" />\n              <option name=\"myItemType\" value=\"com.android.tools.idea.navigator.nodes.AndroidViewProjectNode\" />\n            </PATH_ELEMENT>\n            <PATH_ELEMENT>\n              <option name=\"myItemId\" value=\"flowlayoutmanager\" />\n              <option name=\"myItemType\" value=\"com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode\" />\n            </PATH_ELEMENT>\n          </PATH>\n          <PATH>\n            <PATH_ELEMENT>\n              <option name=\"myItemId\" value=\"flowlayoutmanager\" />\n              <option name=\"myItemType\" value=\"com.android.tools.idea.navigator.nodes.AndroidViewProjectNode\" />\n            </PATH_ELEMENT>\n            <PATH_ELEMENT>\n              <option name=\"myItemId\" value=\"flowlayoutmanager\" />\n              <option name=\"myItemType\" value=\"com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode\" />\n            </PATH_ELEMENT>\n            <PATH_ELEMENT>\n              <option name=\"myItemId\" value=\"src\" />\n              <option name=\"myItemType\" value=\"com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode\" />\n            </PATH_ELEMENT>\n          </PATH>\n          <PATH>\n            <PATH_ELEMENT>\n              <option name=\"myItemId\" value=\"flowlayoutmanager\" />\n              <option name=\"myItemType\" value=\"com.android.tools.idea.navigator.nodes.AndroidViewProjectNode\" />\n            </PATH_ELEMENT>\n            <PATH_ELEMENT>\n              <option name=\"myItemId\" value=\"flowlayoutmanager\" />\n              <option name=\"myItemType\" value=\"com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode\" />\n            </PATH_ELEMENT>\n            <PATH_ELEMENT>\n              <option name=\"myItemId\" value=\"src\" />\n              <option name=\"myItemType\" value=\"com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode\" />\n            </PATH_ELEMENT>\n            <PATH_ELEMENT>\n              <option name=\"myItemId\" value=\"main\" />\n              <option name=\"myItemType\" value=\"com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode\" />\n            </PATH_ELEMENT>\n          </PATH>\n        </subPane>\n      </pane>\n      <pane id=\"Scope\">\n        <subPane subId=\"Project Files\">\n          <PATH>\n            <PATH_ELEMENT USER_OBJECT=\"Root\">\n              <option name=\"myItemId\" value=\"\" />\n              <option name=\"myItemType\" value=\"\" />\n            </PATH_ELEMENT>\n          </PATH>\n        </subPane>\n      </pane>\n      <pane id=\"ProjectPane\" />\n    </panes>\n  </component>\n  <component name=\"PropertiesComponent\">\n    <property name=\"settings.editor.selected.configurable\" value=\"android.sdk-updates\" />\n    <property name=\"settings.editor.splitter.proportion\" value=\"0.2\" />\n  </component>\n  <component name=\"RunManager\">\n    <configuration default=\"true\" type=\"Application\" factoryName=\"Application\">\n      <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\" />\n      <option name=\"MAIN_CLASS_NAME\" />\n      <option name=\"VM_PARAMETERS\" />\n      <option name=\"PROGRAM_PARAMETERS\" />\n      <option name=\"WORKING_DIRECTORY\" value=\"$PROJECT_DIR$\" />\n      <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n      <option name=\"ALTERNATIVE_JRE_PATH\" />\n      <option name=\"ENABLE_SWING_INSPECTOR\" value=\"false\" />\n      <option name=\"ENV_VARIABLES\" />\n      <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n      <module name=\"\" />\n      <envs />\n      <method />\n    </configuration>\n    <configuration default=\"true\" type=\"JUnit\" factoryName=\"JUnit\">\n      <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\" />\n      <module name=\"\" />\n      <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n      <option name=\"ALTERNATIVE_JRE_PATH\" />\n      <option name=\"PACKAGE_NAME\" />\n      <option name=\"MAIN_CLASS_NAME\" />\n      <option name=\"METHOD_NAME\" />\n      <option name=\"TEST_OBJECT\" value=\"class\" />\n      <option name=\"VM_PARAMETERS\" value=\"-ea\" />\n      <option name=\"PARAMETERS\" />\n      <option name=\"WORKING_DIRECTORY\" value=\"$MODULE_DIR$\" />\n      <option name=\"ENV_VARIABLES\" />\n      <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n      <option name=\"TEST_SEARCH_SCOPE\">\n        <value defaultName=\"singleModule\" />\n      </option>\n      <envs />\n      <patterns />\n      <method />\n    </configuration>\n    <configuration default=\"true\" type=\"Remote\" factoryName=\"Remote\">\n      <option name=\"USE_SOCKET_TRANSPORT\" value=\"true\" />\n      <option name=\"SERVER_MODE\" value=\"false\" />\n      <option name=\"SHMEM_ADDRESS\" value=\"javadebug\" />\n      <option name=\"HOST\" value=\"localhost\" />\n      <option name=\"PORT\" value=\"5005\" />\n      <method />\n    </configuration>\n    <configuration default=\"true\" type=\"TestNG\" factoryName=\"TestNG\">\n      <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\" />\n      <module name=\"\" />\n      <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n      <option name=\"ALTERNATIVE_JRE_PATH\" />\n      <option name=\"SUITE_NAME\" />\n      <option name=\"PACKAGE_NAME\" />\n      <option name=\"MAIN_CLASS_NAME\" />\n      <option name=\"METHOD_NAME\" />\n      <option name=\"GROUP_NAME\" />\n      <option name=\"TEST_OBJECT\" value=\"CLASS\" />\n      <option name=\"VM_PARAMETERS\" value=\"-ea\" />\n      <option name=\"PARAMETERS\" />\n      <option name=\"WORKING_DIRECTORY\" value=\"$MODULE_DIR$\" />\n      <option name=\"OUTPUT_DIRECTORY\" />\n      <option name=\"ANNOTATION_TYPE\" />\n      <option name=\"ENV_VARIABLES\" />\n      <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n      <option name=\"TEST_SEARCH_SCOPE\">\n        <value defaultName=\"singleModule\" />\n      </option>\n      <option name=\"USE_DEFAULT_REPORTERS\" value=\"false\" />\n      <option name=\"PROPERTIES_FILE\" />\n      <envs />\n      <properties />\n      <listeners />\n      <method />\n    </configuration>\n    <configuration name=\"&lt;template&gt;\" type=\"Applet\" default=\"true\" selected=\"false\">\n      <option name=\"MAIN_CLASS_NAME\" />\n      <option name=\"HTML_FILE_NAME\" />\n      <option name=\"HTML_USED\" value=\"false\" />\n      <option name=\"WIDTH\" value=\"400\" />\n      <option name=\"HEIGHT\" value=\"300\" />\n      <option name=\"POLICY_FILE\" value=\"$APPLICATION_HOME_DIR$/bin/appletviewer.policy\" />\n      <option name=\"VM_PARAMETERS\" />\n    </configuration>\n    <configuration name=\"&lt;template&gt;\" type=\"#org.jetbrains.idea.devkit.run.PluginConfigurationType\" default=\"true\" selected=\"false\">\n      <option name=\"VM_PARAMETERS\" value=\"-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea\" />\n    </configuration>\n  </component>\n  <component name=\"ShelveChangesManager\" show_recycled=\"false\" />\n  <component name=\"TaskManager\">\n    <task active=\"true\" id=\"Default\" summary=\"Default task\">\n      <changelist id=\"f715bec9-02b3-4ff2-8398-220a6122ac49\" name=\"Default\" comment=\"\" />\n      <created>1451515463827</created>\n      <option name=\"number\" value=\"Default\" />\n      <updated>1451515463827</updated>\n    </task>\n    <servers />\n  </component>\n  <component name=\"ToolWindowManager\">\n    <frame x=\"1440\" y=\"23\" width=\"1920\" height=\"1053\" extended-state=\"0\" />\n    <editor active=\"false\" />\n    <layout>\n      <window_info id=\"TODO\" active=\"false\" anchor=\"bottom\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"6\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Messages\" active=\"false\" anchor=\"bottom\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"true\" show_stripe_button=\"true\" weight=\"0.32977587\" sideWeight=\"0.5\" order=\"-1\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Build Variants\" active=\"false\" anchor=\"left\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"-1\" side_tool=\"true\" content_ui=\"tabs\" />\n      <window_info id=\"Palette&#9;\" active=\"false\" anchor=\"left\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"-1\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Capture Analysis\" active=\"false\" anchor=\"right\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"-1\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Event Log\" active=\"false\" anchor=\"bottom\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"-1\" side_tool=\"true\" content_ui=\"tabs\" />\n      <window_info id=\"Maven Projects\" active=\"false\" anchor=\"right\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"-1\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Android Monitor\" active=\"false\" anchor=\"bottom\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"-1\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Version Control\" active=\"false\" anchor=\"bottom\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"-1\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Run\" active=\"false\" anchor=\"bottom\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"2\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Terminal\" active=\"false\" anchor=\"bottom\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"-1\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Captures\" active=\"false\" anchor=\"left\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.25\" sideWeight=\"0.5\" order=\"2\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Capture Tool\" active=\"false\" anchor=\"left\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"-1\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Gradle Console\" active=\"false\" anchor=\"bottom\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"-1\" side_tool=\"true\" content_ui=\"tabs\" />\n      <window_info id=\"Designer\" active=\"false\" anchor=\"right\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"-1\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Project\" active=\"true\" anchor=\"left\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"true\" show_stripe_button=\"true\" weight=\"0.24973376\" sideWeight=\"0.5\" order=\"0\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"AdbCommander\" active=\"false\" anchor=\"right\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"-1\" side_tool=\"true\" content_ui=\"tabs\" />\n      <window_info id=\"CodotaView\" active=\"false\" anchor=\"right\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"-1\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Gradle\" active=\"false\" anchor=\"right\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"-1\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Structure\" active=\"false\" anchor=\"left\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.25\" sideWeight=\"0.5\" order=\"1\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Android Model\" active=\"false\" anchor=\"right\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"-1\" side_tool=\"true\" content_ui=\"tabs\" />\n      <window_info id=\"Favorites\" active=\"false\" anchor=\"left\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"-1\" side_tool=\"true\" content_ui=\"tabs\" />\n      <window_info id=\"Debug\" active=\"false\" anchor=\"bottom\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.4\" sideWeight=\"0.5\" order=\"3\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Cvs\" active=\"false\" anchor=\"bottom\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.25\" sideWeight=\"0.5\" order=\"4\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Message\" active=\"false\" anchor=\"bottom\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"0\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Commander\" active=\"false\" anchor=\"right\" auto_hide=\"false\" internal_type=\"SLIDING\" type=\"SLIDING\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.4\" sideWeight=\"0.5\" order=\"0\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Inspection\" active=\"false\" anchor=\"bottom\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.4\" sideWeight=\"0.5\" order=\"5\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Hierarchy\" active=\"false\" anchor=\"right\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.25\" sideWeight=\"0.5\" order=\"2\" side_tool=\"false\" content_ui=\"combo\" />\n      <window_info id=\"Find\" active=\"false\" anchor=\"bottom\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.33\" sideWeight=\"0.5\" order=\"1\" side_tool=\"false\" content_ui=\"tabs\" />\n      <window_info id=\"Ant Build\" active=\"false\" anchor=\"right\" auto_hide=\"false\" internal_type=\"DOCKED\" type=\"DOCKED\" visible=\"false\" show_stripe_button=\"true\" weight=\"0.25\" sideWeight=\"0.5\" order=\"1\" side_tool=\"false\" content_ui=\"tabs\" />\n    </layout>\n  </component>\n  <component name=\"VcsContentAnnotationSettings\">\n    <option name=\"myLimit\" value=\"2678400000\" />\n  </component>\n  <component name=\"XDebuggerManager\">\n    <breakpoint-manager />\n    <watches-manager />\n  </component>\n</project>"
  },
  {
    "path": "flowlayoutmanager/README.md",
    "content": "FlowLayoutManager Readme\n===\n\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-FlowLayoutManager-green.svg?style=true)](https://android-arsenal.com/details/1/3733)\n\nOverview\n===\nFlowLayoutManager is a layoutManager that works with Android ___RecyclerView___ Widget, to layout views in flow style, with support of ___predictive animations___, item per line limit, auto measurement & alignments (left or right)\n\n[Google Play Link for Demo App](https://play.google.com/store/apps/details?id=com.xiaofeng.androidlibs)\n\n[Youtube Demo Video](https://youtu.be/eyCb1gYT9mA)\n\n![Feature GIF](https://cloud.githubusercontent.com/assets/15362031/15170689/fe3117d6-16fc-11e6-8ffc-3e90b9bf5430.gif)\nHow to use\n===\nsetup\n---\nAdd following to your build.gradle dependencies section\n```gradle\ncompile 'com.xiaofeng.android:flowlayoutmanager:1.2.3.2'\n```\n\nBasic layout\n---\n```java\nrecyclerView.setLayoutManager(new FlowLayoutManager());\n```\n\nPredictive animation\n---\nNo setup needed, when data changed, do not use notifyDatasetChanged, which will skip all animations, but use notifyItemXXX APIs, those APIs will trigger animations.\n\nItem per line limitation\n---\nSingle item per line\n```java\nrecyclerView.setLayoutManager(new FlowLayoutManager().singleItemPerLine());\n```\nor x items per line\n```java\nrecyclerView.setLayoutManager(new FlowLayoutManager().maxItemsPerLine(x));\n```\n\nto remove Item per line limitation\n```java\n((FlowLayoutManager)recyclerView.getLayoutManager()).removeItemPerLineLimit();\n```\n\nAuto measurement\n---\n```java\nFlowLayoutManager flowLayoutManager = new FlowLayoutManager();\nflowLayoutManager.setAutoMeasureEnabled(true);\nrecyclerView.setLayoutManager(flowLayoutManager);\n```\n\nAlignment\n---\n```java\nrecyclerView.setLayoutManager(new FlowLayoutManager().setAlignment(Alignment.LEFT));\n```\nAlignment could be LEFT or RIGHT.\n\nLicense\n=======\n\n    Copyright 2016 Xiaofeng Han\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n"
  },
  {
    "path": "flowlayoutmanager/build.gradle",
    "content": "// to publish run ./gradlew clean bintrayUpload\n\napply plugin: 'com.android.library'\napply plugin: 'com.github.dcendents.android-maven'\napply plugin: 'com.jfrog.bintray'\n\nproject.ext {\n    libVersion = '1.2.3.2'\n    libVersionCode = 7\n    libGroupId = 'com.xiaofeng.android'\n    libArtifactId = 'flowlayoutmanager'\n    gitUrl = 'git@github.com:xiaofeng-han/AndroidLibs.git'\n    siteUrl = 'https://github.com/xiaofeng-han/AndroidLibs'\n}\n\ngroup = 'com.xiaofeng.android'\nversion = libVersion\n\nandroid {\n    compileSdkVersion androidCompileSdkVersion\n    buildToolsVersion androidBuildToolVersion\n    resourcePrefix \"xiaofeng__\"\n    defaultConfig {\n        minSdkVersion androidMinSdkVersion\n        targetSdkVersion androidTargetSdkVersion\n        versionCode libVersionCode\n        versionName libVersion\n        testInstrumentationRunner \"android.support.test.runner.AndroidJUnitRunner\"\n    }\n    testOptions {\n        unitTests.returnDefaultValues = false;\n    }\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n        }\n    }\n    dexOptions {\n        incremental true\n    }\n    compileOptions {\n        sourceCompatibility JavaVersion.VERSION_1_7\n        targetCompatibility JavaVersion.VERSION_1_7\n    }\n}\n\ndependencies {\n    compile fileTree(include: ['*.jar'], dir: 'libs')\n    androidTestCompile 'junit:junit:4.12'\n    compile(group: 'com.android.support', name: 'appcompat-v7', version: supportLibVersion)\n    compile(group: 'com.android.support', name: 'recyclerview-v7', version: supportLibVersion)\n    androidTestCompile 'com.android.support:support-annotations:23.3.0'\n    androidTestCompile 'com.android.support.test:runner:0.5'\n}\n\nProperties properties = new Properties()\nproperties.load(project.rootProject.file('local.properties').newDataInputStream())\n\ninstall {\n    repositories.mavenInstaller {\n        // This generates POM.xml with proper parameters\n        pom {\n            project {\n                packaging 'aar'\n\n                // Add your description here\n                name 'FlowLayoutManager for android RecyclerView'\n                url siteUrl\n\n                // Set your license\n                licenses {\n                    license {\n                        name 'GPL-v3.0'\n                        url 'http://www.gnu.org/licenses/gpl-3.0.en.html'\n                    }\n                }\n                developers {\n                    developer {\n                        id 'xiaofeng-han'\n                        name 'Xiaofeng Han'\n                        email 'hhhanxf@gmail.com'\n                    }\n                }\n                scm {\n                    connection gitUrl\n                    developerConnection gitUrl\n                    url gitUrl\n\n                }\n            }\n        }\n    }\n}\n\ntask sourcesJar(type: Jar) {\n    from android.sourceSets.main.java.srcDirs\n    classifier = 'sources'\n}\n\ntask javadoc(type: Javadoc) {\n    source = android.sourceSets.main.java.srcDirs\n    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))\n}\n\ntask javadocJar(type: Jar, dependsOn: javadoc) {\n    classifier = 'javadoc'\n    from javadoc.destinationDir\n}\n\n\nartifacts {\n    archives sourcesJar\n    archives javadocJar\n}\n\nbintray {\n    user = properties.getProperty('bintray.user')\n    key = properties.getProperty('bintray.apikey')\n    configurations = ['archives']\n    pkg {\n        repo = 'maven'\n        name = 'FlowLayoutManager'\n        userOrg = 'hhhanxf'\n        licenses = ['GPL-3.0']\n        vcsUrl = gitUrl\n        githubRepo = 'xiaofeng-han/AndroidLibs'\n        githubReleaseNotesFile = 'README.md'\n        publish = true\n        version {\n            name = libVersion\n            desc = 'FLowLayoutManager'\n            released  = new Date()\n            vcsTag = libVersion\n            gpg {\n                sign = true\n                passphrase = properties.getProperty('bintray.gpg.password')\n            }\n        }\n    }\n}\n\ntask wrapper(type: Wrapper) {\n    gradleVersion = '2.10'\n}"
  },
  {
    "path": "flowlayoutmanager/gradle/wrapper/gradle-wrapper.properties",
    "content": "#Wed Oct 21 11:34:03 PDT 2015\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-2.10-all.zip\n"
  },
  {
    "path": "flowlayoutmanager/gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\nesac\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "flowlayoutmanager/gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto init\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto init\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:init\n@rem Get command-line arguments, handling Windowz variants\n\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\n\n:win9xME_args\n@rem Slurp the command line arguments.\nset CMD_LINE_ARGS=\nset _SKIP=2\n\n:win9xME_args_slurp\nif \"x%~1\" == \"x\" goto execute\n\nset CMD_LINE_ARGS=%*\ngoto execute\n\n:4NT_args\n@rem Get arguments from the 4NT Shell from JP Software\nset CMD_LINE_ARGS=%$\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "flowlayoutmanager/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /home/xiaofeng/Android/Sdk/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the proguardFiles\n# directive in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n"
  },
  {
    "path": "flowlayoutmanager/src/androidTest/java/com/xiaofeng/flowlayoutmanager/ApplicationTest.java",
    "content": "package com.xiaofeng.flowlayoutmanager;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCase;\n\n/**\n * <a href=\"http://d.android.com/tools/testing/testing_android.html\">Testing Fundamentals</a>\n */\npublic class ApplicationTest extends ApplicationTestCase<Application> {\n    public ApplicationTest() {\n        super(Application.class);\n    }\n}"
  },
  {
    "path": "flowlayoutmanager/src/androidTest/java/com/xiaofeng/flowlayoutmanager/CacheHelperTest.java",
    "content": "package com.xiaofeng.flowlayoutmanager;\n\nimport android.graphics.Point;\nimport android.test.InstrumentationTestCase;\n\nimport com.xiaofeng.flowlayoutmanager.cache.CacheHelper;\n\nimport org.junit.Test;\n\nimport static org.hamcrest.CoreMatchers.is;\nimport static org.hamcrest.MatcherAssert.assertThat;\n\n/**\n * Created by xhan on 4/27/16.\n */\npublic class CacheHelperTest extends InstrumentationTestCase {\n\t@Test\n\tpublic void testLineCountsNoLimit() throws Exception {\n\t\tFlowLayoutOptions layoutOptions = new FlowLayoutOptions();\n\t\tlayoutOptions.itemsPerLine = FlowLayoutOptions.ITEM_PER_LINE_NO_LIMIT;\n\t\tint contentAreaWidth = 10;\n\t\tCacheHelper cacheHelper = new CacheHelper(layoutOptions.itemsPerLine, contentAreaWidth);\n\t\tPoint[] items = new Point[] {\n\t\t\t\tnew Point(5, 1), new Point(2, 1)\n\t\t\t\t, new Point(4, 1), new Point(4, 1), new Point(2, 1)\n\t\t\t\t, new Point(9, 1)\n\t\t\t\t, new Point(2, 1), new Point(3, 2)};\n\t\tcacheHelper.add(0, items);\n\t\tint[] lineCounts = cacheHelper.getLineMap();\n\t\tassertThat(\"lineCounts should have 4 items\", lineCounts.length, is(4));\n\t\tassertThat(\"line 0 have 2 items\", lineCounts[0], is(2));\n\t\tassertThat(\"line 1 have 3 items\", lineCounts[1], is(3));\n\t\tassertThat(\"line 2 have 1 items\", lineCounts[2], is(1));\n\t\tassertThat(\"line 3 have 2 items\", lineCounts[3], is(2));\n\t}\n\n\t@Test\n\tpublic void testLineCountsWithLimit() throws Exception {\n\t\tFlowLayoutOptions layoutOptions = new FlowLayoutOptions();\n\t\tlayoutOptions.itemsPerLine = 2;\n\t\tint contentAreaWidth = 10;\n\t\tCacheHelper cacheHelper = new CacheHelper(layoutOptions.itemsPerLine, contentAreaWidth);\n\t\tPoint[] items = new Point[] {\n\t\t\t\tnew Point(5, 1), new Point(2, 1)\n\t\t\t\t, new Point(4, 1), new Point(4, 1)\n\t\t\t\t, new Point(2, 1)\n\t\t\t\t, new Point(9, 1)\n\t\t\t\t, new Point(2, 1), new Point(3, 2)};\n\t\tcacheHelper.add(0, items);\n\t\tint[] lineCounts = cacheHelper.getLineMap();\n\t\tassertThat(\"lineCounts should have 5 items\", lineCounts.length, is(5));\n\t\tassertThat(\"line 0 have 2 items\", lineCounts[0], is(2));\n\t\tassertThat(\"line 1 have 2 items\", lineCounts[1], is(2));\n\t\tassertThat(\"line 2 have 1 items\", lineCounts[2], is(1));\n\t\tassertThat(\"line 3 have 1 items\", lineCounts[3], is(1));\n\t\tassertThat(\"line 4 have 2 items\", lineCounts[4], is(2));\n\t}\n\n\tpublic void testItemLineIndex() {\n\t\tFlowLayoutOptions layoutOptions = new FlowLayoutOptions();\n\t\tlayoutOptions.itemsPerLine = 2;\n\t\tint contentAreaWidth = 10;\n\t\tCacheHelper cacheHelper = new CacheHelper(layoutOptions.itemsPerLine, contentAreaWidth);\n\t\tPoint[] items = new Point[] {\n\t\t\t\tnew Point(5, 1), new Point(2, 1)\n\t\t\t\t, new Point(4, 1), new Point(4, 1)\n\t\t\t\t, new Point(2, 1)\n\t\t\t\t, new Point(9, 1)\n\t\t\t\t, new Point(2, 1), new Point(3, 2)};\n\t\tcacheHelper.add(0, items);\n\n\t\tassertThat(\"1st item have line index 0\", cacheHelper.itemLineIndex(0), is(0));\n\t\tassertThat(\"3rd item have line index 1\", cacheHelper.itemLineIndex(2), is(1));\n\t\tassertThat(\"7th item have line index 4\", cacheHelper.itemLineIndex(6), is(4));\n\t\tassertThat(\"8th item have line index 4\", cacheHelper.itemLineIndex(7), is(4));\n\t\tassertThat(\"9th item have line index -1\", cacheHelper.itemLineIndex(8), is(CacheHelper.NOT_FOUND));\n\t}\n\n\tpublic void testHavePreviousLineCached() {\n\t\tFlowLayoutOptions layoutOptions = new FlowLayoutOptions();\n\t\tlayoutOptions.itemsPerLine = 2;\n\t\tint contentAreaWidth = 10;\n\t\tCacheHelper cacheHelper = new CacheHelper(layoutOptions.itemsPerLine, contentAreaWidth);\n\t\tPoint[] items = new Point[] {\n\t\t\t\tnew Point(5, 1), new Point(2, 1)\n\t\t\t\t, new Point(4, 1), new Point(4, 1)\n\t\t\t\t, new Point(2, 1)\n\t\t\t\t, new Point(9, 1)\n\t\t\t\t, new Point(2, 1), new Point(3, 2)};\n\t\tcacheHelper.add(0, items);\n\n\t\tassertThat(\"1st item do not have previous line cached\", cacheHelper.hasPreviousLineCached(0), is(false));\n\t\tassertThat(\"3rd item have previous line cached\", cacheHelper.hasPreviousLineCached(2), is(true));\n\t\tassertThat(\"8th item have previous line cached\", cacheHelper.hasPreviousLineCached(7), is(true));\n\t\tassertThat(\"9th item do not have previous line cached\", cacheHelper.hasPreviousLineCached(9), is(false));\n\t}\n\n\tpublic void testHaveNextLineCached() {\n\t\tFlowLayoutOptions layoutOptions = new FlowLayoutOptions();\n\t\tlayoutOptions.itemsPerLine = 2;\n\t\tint contentAreaWidth = 10;\n\t\tCacheHelper cacheHelper = new CacheHelper(layoutOptions.itemsPerLine, contentAreaWidth);\n\t\tPoint[] items = new Point[] {\n\t\t\t\tnew Point(5, 1), new Point(2, 1)\n\t\t\t\t, new Point(4, 1), new Point(4, 1)\n\t\t\t\t, new Point(2, 1)\n\t\t\t\t, new Point(9, 1)\n\t\t\t\t, new Point(2, 1), new Point(3, 2)};\n\t\tcacheHelper.add(0, items);\n\t\tassertThat(\"1st item have next line cached\", cacheHelper.hasNextLineCached(0), is(true));\n\t\tassertThat(\"3rd item have next line cached\", cacheHelper.hasNextLineCached(2), is(true));\n\t\tassertThat(\"8th item does not have next line cached\", cacheHelper.hasNextLineCached(7), is(false));\n\t\tassertThat(\"9th item do not have next line cached\", cacheHelper.hasNextLineCached(9), is(false));\n\t}\n\n\tpublic void testRemoveMiddle() {\n\t\tFlowLayoutOptions layoutOptions = new FlowLayoutOptions();\n\t\tlayoutOptions.itemsPerLine = 2;\n\t\tint contentAreaWidth = 10;\n\t\tCacheHelper cacheHelper = new CacheHelper(layoutOptions.itemsPerLine, contentAreaWidth);\n\t\tPoint[] items = new Point[] {\n\t\t\t\tnew Point(5, 1), new Point(2, 1)\n\t\t\t\t, new Point(4, 1), new Point(4, 1)\n\t\t\t\t, new Point(2, 1)\n\t\t\t\t, new Point(9, 1)\n\t\t\t\t, new Point(2, 1), new Point(3, 2)};\n\t\tcacheHelper.add(0, items);\n\n\t\tcacheHelper.remove(3, 1); // second 4 in second line\n\n\t\t// after remove it should be\n\t\t// 5, 2\n\t\t// 4, 2\n\t\t// 9\n\t\t// 2, 3\n\n\t\tint[] lineCounts = cacheHelper.getLineMap();\n\t\tassertThat(\"line counts should have 4 lines\", lineCounts.length, is(4));\n\t\tassertThat(\"line 1 have 2 items\", lineCounts[0], is(2));\n\t\tassertThat(\"line 2 have 2 items\", lineCounts[1], is(2));\n\t\tassertThat(\"line 3 have 1 items\", lineCounts[2], is(1));\n\t\tassertThat(\"line 4 have 1 items\", lineCounts[3], is(2));\n\n\t\tcacheHelper.remove(4, 1); // 9 is removed\n\t\t// after removal it should be\n\t\t// 5, 2\n\t\t// 4, 2\n\t\t// 2, 3\n\t\tlineCounts = cacheHelper.getLineMap();\n\t\tassertThat(\"line counts should have 3 lines\", lineCounts.length, is(3));\n\t\tassertThat(\"line 1 have 2 items\", lineCounts[0], is(2));\n\t\tassertThat(\"line 2 have 3 items\", lineCounts[1], is(2));\n\t\tassertThat(\"line 3 have 1 items\", lineCounts[2], is(2));\n\t}\n\n\tpublic void testAdd() throws Exception {\n\t\tFlowLayoutOptions layoutOptions = new FlowLayoutOptions();\n\t\tlayoutOptions.itemsPerLine = FlowLayoutOptions.ITEM_PER_LINE_NO_LIMIT;\n\t\tint contentAreaWidth = 10;\n\t\tCacheHelper cacheHelper = new CacheHelper(layoutOptions.itemsPerLine, contentAreaWidth);\n\n\t\tPoint[] items = new Point[] {\n\t\t\t\tnew Point(5, 1), new Point(2, 1)\n\t\t\t\t, new Point(4, 1), new Point(4, 1), new Point(2, 1)\n\t\t\t\t, new Point(2, 1), new Point(3, 2)};\n\t\tcacheHelper.add(0, items);\n\n\t\tcacheHelper.add(3, new Point(9, 2), new Point(1,1), new Point(2, 2));\n\t\t// after addition it should be:\n\t\t// 5, 2\n\t\t// 4\n\t\t// 9, 1\n\t\t// 2, 4, 2, 2\n\t\t// 3\n\n\t\tint[] lineCounts = cacheHelper.getLineMap();\n\t\tassertThat(\"should have 5 lines\", lineCounts.length, is(5));\n\n\t\tassertThat(\"line 1 have 2 items\", lineCounts[0], is(2));\n\t\tassertThat(\"line 2 have 1 items\", lineCounts[1], is(1));\n\t\tassertThat(\"line 3 have 2 items\", lineCounts[2], is(2));\n\t\tassertThat(\"line 4 have 4 items\", lineCounts[3], is(4));\n\t\tassertThat(\"line 5 have 1 items\", lineCounts[4], is(1));\n\t}\n\n\tpublic void testRemoveMultiple() throws Exception {\n\t\tFlowLayoutOptions layoutOptions = new FlowLayoutOptions();\n\t\tlayoutOptions.itemsPerLine = FlowLayoutOptions.ITEM_PER_LINE_NO_LIMIT;\n\t\tint contentAreaWidth = 10;\n\t\tCacheHelper cacheHelper = new CacheHelper(layoutOptions.itemsPerLine, contentAreaWidth);\n\n\t\tPoint[] items = new Point[] {\n\t\t\t\tnew Point(5, 1), new Point(2, 1)\n\t\t\t\t, new Point(4, 1), new Point(4, 1), new Point(2, 1)\n\t\t\t\t, new Point(2, 1), new Point(3, 2)};\n\t\tcacheHelper.add(0, items);\n\n\t\tcacheHelper.remove(3, 2);\n\t\t// after Remove it should be:\n\t\t// 5, 2\n\t\t// 4, 2, 3\n\n\t\tint[] lineCounts = cacheHelper.getLineMap();\n\t\tassertThat(\"should have 2 lines\", lineCounts.length, is(2));\n\n\t\tassertThat(\"line 1 have 2 items\", lineCounts[0], is(2));\n\t\tassertThat(\"line 2 have 3 items\", lineCounts[1], is(3));\n\t}\n\n\tpublic void testInvalidateSize() throws Exception {\n\t\tFlowLayoutOptions layoutOptions = new FlowLayoutOptions();\n\t\tlayoutOptions.itemsPerLine = FlowLayoutOptions.ITEM_PER_LINE_NO_LIMIT;\n\t\tint contentAreaWidth = 10;\n\t\tCacheHelper cacheHelper = new CacheHelper(layoutOptions.itemsPerLine, contentAreaWidth);\n\n\t\tPoint[] items = new Point[] {\n\t\t\t\tnew Point(5, 1), new Point(2, 1)\n\t\t\t\t, new Point(4, 1), new Point(4, 1), new Point(2, 1)\n\t\t\t\t, new Point(2, 1), new Point(3, 2)};\n\t\tcacheHelper.add(0, items);\n\n\t\tcacheHelper.invalidSizes(4, 2);\n\n\t\t// after invalidate it should be:\n\t\t// 5, 2\n\t\t// 4, 4\n\n\t\tint[] lineCounts = cacheHelper.getLineMap();\n\t\tassertThat(\"should have 2 lines\", lineCounts.length, is(2));\n\n\t\tassertThat(\"line 1 have 2 items\", lineCounts[0], is(2));\n\t\tassertThat(\"line 2 have 2 items\", lineCounts[1], is(2));\n\t}\n\n\tpublic void testOnItemInserted() throws Exception {\n\t\tFlowLayoutOptions layoutOptions = new FlowLayoutOptions();\n\t\tlayoutOptions.itemsPerLine = FlowLayoutOptions.ITEM_PER_LINE_NO_LIMIT;\n\t\tint contentAreaWidth = 10;\n\t\tCacheHelper cacheHelper = new CacheHelper(layoutOptions.itemsPerLine, contentAreaWidth);\n\n\t\tPoint[] items = new Point[] {\n\t\t\t\tnew Point(5, 1), new Point(2, 1)\n\t\t\t\t, new Point(4, 1), new Point(4, 1), new Point(2, 1)\n\t\t\t\t, new Point(2, 1), new Point(3, 2)};\n\t\tcacheHelper.add(0, items);\n\n\t\tcacheHelper.add(3, 2);\n\n\t\t// after onItemInserted\n\t\t// 5, 2\n\t\t// 4\n\t\tint[] lineCounts = cacheHelper.getLineMap();\n\t\tassertThat(\"line counts have 2 items\", lineCounts.length, is(2));\n\t\tassertThat(\"line 1 have 2 items\", lineCounts[0], is(2));\n\t\tassertThat(\"line 2 have 1 items\", lineCounts[1], is(1));\n\t}\n\n\tpublic void testRemoveBeyondEnd() throws Exception {\n\t\tFlowLayoutOptions layoutOptions = new FlowLayoutOptions();\n\t\tlayoutOptions.itemsPerLine = FlowLayoutOptions.ITEM_PER_LINE_NO_LIMIT;\n\t\tint contentAreaWidth = 10;\n\t\tCacheHelper cacheHelper = new CacheHelper(layoutOptions.itemsPerLine, contentAreaWidth);\n\n\t\tPoint[] items = new Point[] {\n\t\t\t\tnew Point(5, 1), new Point(2, 1)\n\t\t\t\t, new Point(4, 1), new Point(4, 1), new Point(2, 1)\n\t\t\t\t, new Point(2, 1), new Point(3, 2)};\n\t\tcacheHelper.add(0, items);\n\n\t\tcacheHelper.remove(5, 10);\n\t\t// should be\n\t\t// 5, 2,\n\t\t// 4, 4, 2\n\n\t\tint[] lineCounts = cacheHelper.getLineMap();\n\t\tassertThat(\"line counts have 2 items\", lineCounts.length, is(2));\n\t\tassertThat(\"line 1 have 2 items\", lineCounts[0], is(2));\n\t\tassertThat(\"line 2 have 3 items\", lineCounts[1], is(3));\n\t}\n\n\tpublic void testMoveForward() throws Exception {\n\t\tFlowLayoutOptions layoutOptions = new FlowLayoutOptions();\n\t\tlayoutOptions.itemsPerLine = FlowLayoutOptions.ITEM_PER_LINE_NO_LIMIT;\n\t\tint contentAreaWidth = 10;\n\t\tCacheHelper cacheHelper = new CacheHelper(layoutOptions.itemsPerLine, contentAreaWidth);\n\n\t\tPoint[] items = new Point[] {\n\t\t\t\tnew Point(5, 1), new Point(2, 1)\n\t\t\t\t, new Point(4, 1), new Point(4, 1), new Point(2, 1)\n\t\t\t\t, new Point(2, 1), new Point(3, 2)};\n\t\tcacheHelper.add(0, items);\n\n\t\tcacheHelper.move(5, 1, 2);\n\n\t\t// after move\n\t\t// 5, 2, 3\n\t\t// 2, 4, 4\n\t\t// 2\n\n\t\tint[] lineCounts = cacheHelper.getLineMap();\n\t\tassertThat(\"line counts have 3 items\", lineCounts.length, is(3));\n\t\tassertThat(\"line 1 have 3 items\", lineCounts[0], is(3));\n\t\tassertThat(\"line 2 have 3 items\", lineCounts[1], is(3));\n\t\tassertThat(\"line 3 have 1 items\", lineCounts[2], is(1));\n\t}\n\n\tpublic void testMoveBackward() throws Exception {\n\t\tFlowLayoutOptions layoutOptions = new FlowLayoutOptions();\n\t\tlayoutOptions.itemsPerLine = FlowLayoutOptions.ITEM_PER_LINE_NO_LIMIT;\n\t\tint contentAreaWidth = 10;\n\t\tCacheHelper cacheHelper = new CacheHelper(layoutOptions.itemsPerLine, contentAreaWidth);\n\n\t\tPoint[] items = new Point[] {\n\t\t\t\tnew Point(5, 1), new Point(2, 1)\n\t\t\t\t, new Point(4, 1), new Point(4, 1), new Point(2, 1)\n\t\t\t\t, new Point(2, 1), new Point(3, 2)};\n\t\tcacheHelper.add(0, items);\n\n\t\tcacheHelper.move(3, 6, 2);\n\n\t\t// after move\n\t\t// 5, 2\n\t\t// 4, 2, 4\n\t\t// 2, 3\n\n\t\tint[] lineCounts = cacheHelper.getLineMap();\n\t\tassertThat(\"line counts have 3 items\", lineCounts.length, is(3));\n\t\tassertThat(\"line 1 have 3 items\", lineCounts[0], is(2));\n\t\tassertThat(\"line 2 have 3 items\", lineCounts[1], is(3));\n\t\tassertThat(\"line 3 have 1 items\", lineCounts[2], is(2));\n\t}\n}\n"
  },
  {
    "path": "flowlayoutmanager/src/main/AndroidManifest.xml",
    "content": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.xiaofeng.flowlayoutmanager\">\n\n    <application\n        android:supportsRtl=\"true\">\n\n    </application>\n\n</manifest>\n"
  },
  {
    "path": "flowlayoutmanager/src/main/java/com/xiaofeng/flowlayoutmanager/Alignment.java",
    "content": "package com.xiaofeng.flowlayoutmanager;\n\n/**\n * Created by xhan on 4/11/16.\n */\npublic enum Alignment {\n\tLEFT,\n\tRIGHT\n}\n"
  },
  {
    "path": "flowlayoutmanager/src/main/java/com/xiaofeng/flowlayoutmanager/FlowLayoutManager.java",
    "content": "package com.xiaofeng.flowlayoutmanager;\n\nimport android.graphics.Point;\nimport android.graphics.PointF;\nimport android.graphics.Rect;\nimport android.support.annotation.Nullable;\nimport android.support.v7.widget.LinearSmoothScroller;\nimport android.support.v7.widget.RecyclerView;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.view.ViewTreeObserver;\n\nimport com.xiaofeng.flowlayoutmanager.cache.CacheHelper;\nimport com.xiaofeng.flowlayoutmanager.cache.Line;\n\nimport java.util.LinkedList;\nimport java.util.List;\n\n/**\n * Layout manager for flow views. support different view height, support item add/removed notification\n * support align to left/right edge. support scroll/smooth scroll.\n */\npublic class FlowLayoutManager extends RecyclerView.LayoutManager {\n\n\tprivate static final String LOG_TAG = \"FlowLayoutManager\";\n\tRecyclerView recyclerView;\n\tint firstChildAdapterPosition = 0;\n\tRecyclerView.Recycler recyclerRef;\n\tFlowLayoutOptions flowLayoutOptions;\n\tFlowLayoutOptions newFlowLayoutOptions;\n\tLayoutHelper layoutHelper;\n\tCacheHelper cacheHelper;\n\t@Nullable\n\tprivate ViewTreeObserver.OnGlobalLayoutListener globalLayoutListener;\n\n\tpublic FlowLayoutManager() {\n\t\tflowLayoutOptions = new FlowLayoutOptions();\n\t\tnewFlowLayoutOptions = FlowLayoutOptions.clone(flowLayoutOptions);\n\t}\n\n\t@Override\n\tpublic RecyclerView.LayoutParams generateDefaultLayoutParams() {\n\t\treturn new RecyclerView.LayoutParams(RecyclerView.LayoutParams.WRAP_CONTENT, RecyclerView.LayoutParams.WRAP_CONTENT);\n\t}\n\n\t@Override\n\tpublic void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {\n\t\tif (!cacheHelper.valid() && getChildCount() != 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (cacheHelper.contentAreaWidth() != layoutHelper.visibleAreaWidth()) {\n\t\t\tcacheHelper.contentAreaWidth(layoutHelper.visibleAreaWidth());\n\t\t}\n\n\t\trecyclerRef = recycler;\n\t\tif (state.isPreLayout()) {\n\t\t\tonPreLayoutChildren(recycler, state);\n\t\t} else {\n\t\t\tcacheHelper.startBatchSetting();\n\t\t\tonRealLayoutChildren(recycler);\n\t\t\tcacheHelper.endBatchSetting();\n\t\t}\n\n\t}\n\n\tprivate void onPreLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {\n\n\t\t// start from first view child\n\t\tint firstItemAdapterPosition = getChildAdapterPosition(0);\n\t\tif (firstItemAdapterPosition == RecyclerView.NO_POSITION) {\n\t\t\tdetachAndScrapAttachedViews(recycler);\n\t\t\treturn;\n\t\t}\n\t\tint currentItemPosition = firstItemAdapterPosition < 0 ? 0 : firstItemAdapterPosition;\n\t\tPoint point = layoutHelper.layoutStartPoint(LayoutContext.fromLayoutOptions(flowLayoutOptions));\n\t\tint x = point.x, y = point.y, height = 0;\n\t\tboolean newline;\n\t\tint real_x = point.x, real_y = point.y, real_height = 0;\n\t\tboolean real_newline;\n\t\tRect rect = new Rect();\n\t\tRect real_rect = new Rect();\n\t\t// detach all first.\n\t\tdetachAndScrapAttachedViews(recycler);\n\n\t\tLayoutContext beforeContext = LayoutContext.fromLayoutOptions(flowLayoutOptions);\n\n\t\t// this option use old options alignment & new options line limit to calc items for animation.\n\t\tLayoutContext afterContext = LayoutContext.clone(beforeContext);\n\t\tafterContext.layoutOptions.itemsPerLine = newFlowLayoutOptions.itemsPerLine;\n\n\t\t// track before removed and after removed layout in same time, to make sure only add items at\n\t\t// bottom that visible after item removed.\n\t\twhile (currentItemPosition < state.getItemCount()) {\n\t\t\tView child = recycler.getViewForPosition(currentItemPosition);\n\t\t\tboolean childRemoved = isChildRemoved(child);\n\t\t\t// act as removed view still there, to calc new items location.\n\t\t\tnewline = calcChildLayoutRect(child, x, y, height, beforeContext, rect);\n\t\t\tif (newline) {\n\t\t\t\tpoint = startNewline(rect, beforeContext);\n\t\t\t\tx = point.x;\n\t\t\t\ty = point.y;\n\t\t\t\theight = rect.height();\n\t\t\t\tbeforeContext.currentLineItemCount = 1;\n\t\t\t} else {\n\t\t\t\tx = advanceInSameLine(x, rect, beforeContext);\n\t\t\t\theight = Math.max(height, rect.height());\n\t\t\t\tbeforeContext.currentLineItemCount ++;\n\t\t\t}\n\n\t\t\tif (!childRemoved) {\n\t\t\t\treal_newline = calcChildLayoutRect(child, real_x, real_y, real_height, afterContext, real_rect);\n\t\t\t\tif (real_newline) {\n\t\t\t\t\tpoint = startNewline(real_rect, afterContext);\n\t\t\t\t\treal_x = point.x;\n\t\t\t\t\treal_y = point.y;\n\t\t\t\t\treal_height = real_rect.height();\n\t\t\t\t\tafterContext.currentLineItemCount = 1;\n\t\t\t\t} else {\n\t\t\t\t\treal_x = advanceInSameLine(real_x, real_rect, afterContext);\n\t\t\t\t\treal_height = Math.max(real_height, real_rect.height());\n\t\t\t\t\tafterContext.currentLineItemCount ++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// stop add new view if after removal, new items are not visible.\n\t\t\tif (!childVisible(true, real_x, real_y, real_x + rect.width(), real_y + rect.height())) {\n\t\t\t\trecycler.recycleView(child);\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tif (childRemoved) {\n\t\t\t\t\taddDisappearingView(child);\n\t\t\t\t} else {\n\t\t\t\t\taddView(child);\n\t\t\t\t}\n\t\t\t\tlayoutDecorated(child, rect.left, rect.top, rect.right, rect.bottom);\n\t\t\t}\n\t\t\tcurrentItemPosition ++;\n\t\t}\n\t\tflowLayoutOptions = FlowLayoutOptions.clone(newFlowLayoutOptions);\n\t}\n\n\tprivate void onRealLayoutChildren(RecyclerView.Recycler recycler) {\n\t\tdetachAndScrapAttachedViews(recycler);\n\t\tPoint startPoint = layoutStartPoint();\n\t\tint x = startPoint.x, y = startPoint.y;\n\t\tint itemCount = getItemCount();\n\t\tint height = 0;\n\t\tboolean newLine;\n\t\tRect rect = new Rect();\n\t\tLayoutContext layoutContext = LayoutContext.fromLayoutOptions(flowLayoutOptions);\n\t\tfor (int i = firstChildAdapterPosition; i < itemCount; i ++) {\n\t\t\tView child = recycler.getViewForPosition(i);\n\t\t\tnewLine = calcChildLayoutRect(child, x, y, height, layoutContext, rect);\n\t\t\tif (!childVisible(false, rect)) {\n\t\t\t\trecycler.recycleView(child);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\taddView(child);\n\t\t\t\tlayoutDecorated(child, rect.left, rect.top, rect.right, rect.bottom);\n\t\t\t\tcacheHelper.setItem(i, new Point(rect.width(), rect.height()));\n\t\t\t}\n\n\t\t\tif (newLine) {\n\t\t\t\tPoint lineInfo = startNewline(rect);\n\t\t\t\tx = lineInfo.x;\n\t\t\t\ty = lineInfo.y;\n\t\t\t\theight = rect.height();\n\t\t\t\tlayoutContext.currentLineItemCount = 1;\n\n\t\t\t} else {\n\t\t\t\tx = advanceInSameLine(x, rect, layoutContext);\n\t\t\t\theight = Math.max(height, rect.height());\n\t\t\t\tlayoutContext.currentLineItemCount ++;\n\t\t\t}\n\t\t}\n\t}\n\n\t@Override\n\tpublic boolean canScrollHorizontally() {\n\t\treturn false;\n\t}\n\n\t@Override\n\tpublic boolean canScrollVertically() {\n\t\tif (getChildCount() == 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tView firstChild = getChildAt(0);\n\t\tView lastChild = getChildAt(getChildCount() - 1);\n\t\tView topChild = getChildAt(getMaxHeightLayoutPositionInLine(0));\n\t\tView bottomChild = getChildAt(getMaxHeightLayoutPositionInLine(getChildCount() - 1));\n\t\tboolean topReached = false, bottomReached = false;\n\t\tif (getChildAdapterPosition(firstChild) == 0) {\n\t\t\tif (getDecoratedTop(topChild) >= topVisibleEdge()) {\n\t\t\t\ttopReached = true;\n\t\t\t}\n\t\t}\n\n\t\tif (getChildAdapterPosition(lastChild) == recyclerView.getAdapter().getItemCount() - 1) {\n\t\t\tif (getDecoratedBottom(bottomChild) <= bottomVisibleEdge()) {\n\t\t\t\tbottomReached = true;\n\t\t\t}\n\t\t}\n\t\treturn !(topReached && bottomReached);\n\t}\n\n\t@Override\n\tpublic int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) {\n\t\tif (dy == 0) {\n\t\t\treturn 0;\n\t\t}\n\t\tif (getItemCount() == 0) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tView firstChild = getChildAt(0);\n\t\tView lastChild = getChildAt(getChildCount() - 1);\n\t\tView topChild = getChildAt(getMaxHeightLayoutPositionInLine(0));\n\t\tView bottomChild = getChildAt(getMaxHeightLayoutPositionInLine(getChildCount() - 1));\n\t\tboolean topReached = false, bottomReached = false;\n\t\tif (getChildAdapterPosition(firstChild) == 0) {\n\t\t\tif (getDecoratedTop(topChild) >= topVisibleEdge()) {\n\t\t\t\ttopReached = true;\n\t\t\t}\n\t\t}\n\n\t\tif (getChildAdapterPosition(lastChild) == recyclerView.getAdapter().getItemCount() - 1) {\n\t\t\tif (getDecoratedBottom(bottomChild) <= bottomVisibleEdge()) {\n\t\t\t\tbottomReached = true;\n\t\t\t}\n\t\t}\n\n\t\tif (dy > 0 && bottomReached) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (dy < 0 && topReached) {\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn dy > 0? contentMoveUp(dy, recycler) : contentMoveDown(dy, recycler);\n\t}\n\n\t@Override\n\tpublic void onItemsChanged(RecyclerView recyclerView) {\n\t\tthis.flowLayoutOptions = FlowLayoutOptions.clone(newFlowLayoutOptions);\n\t\tif (cacheHelper != null) {\n\t\t\tcacheHelper.clear();\n\t\t}\n\t\tcacheHelper = new CacheHelper(flowLayoutOptions.itemsPerLine, layoutHelper.visibleAreaWidth());\n\t\tsuper.onItemsChanged(recyclerView);\n\n\t}\n\n\t@Override\n\tpublic void onItemsAdded(RecyclerView recyclerView, final int positionStart, final int itemCount) {\n\t\tcacheHelper.add(positionStart, itemCount);\n\t\tsuper.onItemsAdded(recyclerView, positionStart, itemCount);\n\t}\n\n\t@Override\n\tpublic void onItemsRemoved(RecyclerView recyclerView, final int positionStart, final int itemCount) {\n\t\tcacheHelper.remove(positionStart, itemCount);\n\t\tsuper.onItemsRemoved(recyclerView, positionStart, itemCount);\n\t}\n\n\t@Override\n\tpublic void onItemsUpdated(RecyclerView recyclerView, int positionStart, int itemCount) {\n\t\tcacheHelper.invalidSizes(positionStart, itemCount);\n\t\tsuper.onItemsUpdated(recyclerView, positionStart, itemCount);\n\t}\n\n\t@Override\n\tpublic void onItemsUpdated(RecyclerView recyclerView, int positionStart, int itemCount, Object payload) {\n\t\tcacheHelper.invalidSizes(positionStart, itemCount);\n\t\tsuper.onItemsUpdated(recyclerView, positionStart, itemCount, payload);\n\t}\n\n\t@Override\n\tpublic void onItemsMoved(RecyclerView recyclerView, final int from, final int to, int itemCount) {\n\t\tcacheHelper.move(from, to, itemCount);\n\t\tsuper.onItemsMoved(recyclerView, from, to, itemCount);\n\t}\n\n\t/**\n\t * Contents moving up to top\n\t */\n\tprivate int contentMoveUp(int dy, RecyclerView.Recycler recycler) {\n\t\tint actualDy = dy;\n\t\tint maxHeightIndex = getMaxHeightLayoutPositionInLine(getChildCount() - 1);\n\t\tView maxHeightItem = getChildAt(maxHeightIndex);\n\t\tint offscreenBottom = getDecoratedBottom(maxHeightItem) - bottomVisibleEdge();\n\t\tif (offscreenBottom >= dy) {\n\t\t\toffsetChildrenVertical(-dy);\n\t\t\treturn dy;\n\t\t}\n\t\twhile (getChildAdapterPosition(getChildCount() - 1) < getItemCount() - 1) {\n\t\t\taddNewLineAtBottom(recycler);\n\t\t\tmaxHeightIndex = getMaxHeightLayoutPositionInLine(getChildCount() - 1);\n\t\t\tmaxHeightItem = getChildAt(maxHeightIndex);\n\t\t\toffscreenBottom += getDecoratedMeasuredHeight(maxHeightItem);\n\t\t\tif (offscreenBottom >= dy) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (offscreenBottom < dy) {\n\t\t\tactualDy = offscreenBottom;\n\t\t}\n\t\toffsetChildrenVertical(-actualDy);\n\t\twhile (!lineVisible(0)) {\n\t\t\trecycleLine(0, recycler);\n\t\t}\n\t\tfirstChildAdapterPosition = getChildAdapterPosition(0);\n\t\treturn actualDy;\n\t}\n\n\t/**\n\t * Contents move down to bottom\n\t */\n\tprivate int contentMoveDown(int dy, RecyclerView.Recycler recycler) {\n\t\tint actualDy = dy;\n\t\tint maxHeightItemIndex = getMaxHeightLayoutPositionInLine(0);\n\t\tView maxHeightItem = getChildAt(maxHeightItemIndex);\n\n\t\t// scrolling\n\t\tint offScreenTop = topVisibleEdge() - getDecoratedTop(maxHeightItem);\n\t\tif (offScreenTop > Math.abs(actualDy)) {\n\t\t\toffsetChildrenVertical(-dy);\n\t\t\treturn dy;\n\t\t}\n\t\twhile (getChildAdapterPosition(0) > 0) {\n\t\t\taddNewLineAtTop(recycler);\n\t\t\tmaxHeightItemIndex = getMaxHeightLayoutPositionInLine(0);\n\t\t\tmaxHeightItem = getChildAt(maxHeightItemIndex);\n\t\t\toffScreenTop += getDecoratedMeasuredHeight(maxHeightItem);\n\t\t\tif (offScreenTop >= Math.abs(dy)) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (offScreenTop < Math.abs(dy)) {\n\t\t\tactualDy = -offScreenTop;\n\t\t}\n\n\t\toffsetChildrenVertical(-actualDy);\n\t\twhile (!lineVisible(getChildCount() - 1)) {\n\t\t\trecycleLine(getChildCount() - 1, recycler);\n\t\t}\n\t\tfirstChildAdapterPosition = getChildAdapterPosition(0);\n\t\treturn actualDy;\n\t}\n\n\t/**\n\t * Add new line of elements at top, to keep layout, have to virtually layout from beginning.\n\t * Here is an example to explain why: Say total width is 10, current line is [5, 2, 1], 3 numbers\n\t * before current line is 7, 2, 6. If you just look back, you could say previous line [2, 6], but there\n\t * is another possibility: [7, 2], [6]. You don't know which one is correct without knowing how the line\n\t * before previous one, same thing could happen to that line too, so you have to sort everything from beginning\n\t * or cache the result.\n\t */\n\tprivate void addNewLineAtTop(RecyclerView.Recycler recycler) {\n\t\tint x = layoutStartPoint().x, bottom = getDecoratedTop(getChildAt(getMaxHeightLayoutPositionInLine(0))), y;\n\t\tint height = 0;\n\t\tList<View> lineChildren = new LinkedList<>();\n\t\tint currentAdapterPosition = 0;\n\t\tint endAdapterPosition = getChildAdapterPosition(0) - 1;\n\t\tRect rect = new Rect();\n\t\tboolean newline;\n\t\tboolean firstItem = true;\n\t\tLayoutContext layoutContext = LayoutContext.fromLayoutOptions(flowLayoutOptions);\n\n\t\tint firstItemAdapterPosition = getChildAdapterPosition(0);\n\t\tif (cacheHelper.hasPreviousLineCached(firstItemAdapterPosition)) {\n\t\t\tint previousLineIndex = cacheHelper.itemLineIndex(firstItemAdapterPosition) - 1;\n\t\t\tLine previousLine = cacheHelper.getLine(previousLineIndex);\n\t\t\tint firstNewItemAdapterPosition = cacheHelper.firstItemIndex(previousLineIndex);\n\t\t\tfor (int i = 0; i < previousLine.itemCount; i ++) {\n\t\t\t\tView newView = recycler.getViewForPosition(firstNewItemAdapterPosition + i);\n\t\t\t\taddView(newView, i);\n\t\t\t\tlineChildren.add(newView);\n\t\t\t}\n\t\t\theight = previousLine.maxHeight;\n\t\t} else {\n\n\t\t\twhile (currentAdapterPosition <= endAdapterPosition) {\n\t\t\t\tView newChild = recycler.getViewForPosition(currentAdapterPosition);\n\n\t\t\t\tnewline = calcChildLayoutRect(newChild, x, 0, height, layoutContext, rect);\n\t\t\t\tcacheHelper.setItem(currentAdapterPosition, new Point(rect.width(), rect.height()));\n\t\t\t\t// add view to make sure not be recycled.\n\t\t\t\taddView(newChild, lineChildren.size());\n\t\t\t\tif (newline && !firstItem) {\n\t\t\t\t\t// end of one line, but not reach the top line yet. recycle the line and\n\t\t\t\t\t// move on to next.\n\t\t\t\t\tfor (View viewToRecycle : lineChildren) {\n\t\t\t\t\t\tremoveAndRecycleView(viewToRecycle, recycler);\n\t\t\t\t\t}\n\t\t\t\t\tlineChildren.clear();\n\t\t\t\t\tx = advanceInSameLine(layoutStartPoint().x, rect, layoutContext);\n\t\t\t\t\theight = rect.height();\n\t\t\t\t\tlayoutContext.currentLineItemCount = 1;\n\t\t\t\t} else {\n\t\t\t\t\tx = advanceInSameLine(x, rect, layoutContext);\n\t\t\t\t\theight = Math.max(height, rect.height());\n\t\t\t\t\tfirstItem = false;\n\t\t\t\t\tlayoutContext.currentLineItemCount++;\n\t\t\t\t}\n\t\t\t\tlineChildren.add(newChild);\n\n\t\t\t\tcurrentAdapterPosition++;\n\n\t\t\t}\n\t\t}\n\t\tx = layoutStartPoint().x;\n\t\ty = bottom - height;\n\t\tfirstItem = true;\n\t\tlayoutContext = LayoutContext.fromLayoutOptions(flowLayoutOptions);\n\t\tfor (int i = 0; i < lineChildren.size(); i ++) {\n\t\t\tView childView = lineChildren.get(i);\n\t\t\tnewline = calcChildLayoutRect(childView, x, y, height, layoutContext, rect);\n\t\t\tif (newline && firstItem) {\n\t\t\t\tint rectHeight = rect.height();\n\t\t\t\trect.top -= rectHeight;\n\t\t\t\trect.bottom -= rectHeight;\n\t\t\t\tfirstItem = false;\n\t\t\t}\n\t\t\tlayoutDecorated(childView, rect.left, rect.top, rect.right, rect.bottom);\n\t\t\tx = advanceInSameLine(x, rect, layoutContext);\n\t\t}\n\t}\n\n\t/**\n\t * Add new line at bottom of views.\n\t */\n\tprivate void addNewLineAtBottom(RecyclerView.Recycler recycler) {\n\t\tint x = layoutStartPoint().x, y = getDecoratedBottom(getChildAt(getMaxHeightLayoutPositionInLine(getChildCount() - 1)));\n\t\tint childAdapterPosition = getChildAdapterPosition(getChildCount() - 1) + 1;\n\t\t// no item to add\n\t\tif (childAdapterPosition == getItemCount()) {\n\t\t\treturn;\n\t\t}\n\t\tRect rect = new Rect();\n\t\tboolean newline;\n\t\tboolean firstItem = true;\n\t\tLayoutContext layoutContext = LayoutContext.fromLayoutOptions(flowLayoutOptions);\n\t\twhile (childAdapterPosition < getItemCount()) {\n\t\t\tView newChild = recycler.getViewForPosition(childAdapterPosition);\n\t\t\tnewline = calcChildLayoutRect(newChild, x, y, 0, layoutContext, rect);\n\t\t\tcacheHelper.setItem(childAdapterPosition, new Point(rect.width(), rect.height()));\n\t\t\tif (newline && !firstItem) {\n\t\t\t\trecycler.recycleView(newChild);\n\t\t\t\tlayoutContext.currentLineItemCount = 1;\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\taddView(newChild);\n\t\t\t\tlayoutDecorated(newChild, rect.left, rect.top, rect.right, rect.bottom);\n\t\t\t\tx = advanceInSameLine(x, rect, layoutContext);\n\t\t\t\tchildAdapterPosition ++;\n\t\t\t\tfirstItem = false;\n\t\t\t\tlayoutContext.currentLineItemCount ++;\n\t\t\t}\n\t\t}\n\t}\n\n\t@Override\n\tpublic void onAttachedToWindow(final RecyclerView view) {\n\t\tsuper.onAttachedToWindow(view);\n\t\tthis.recyclerView = view;\n\t\tlayoutHelper = new LayoutHelper(this, recyclerView);\n\t\tcacheHelper = new CacheHelper(flowLayoutOptions.itemsPerLine, layoutHelper.visibleAreaWidth());\n\t\tif (layoutHelper.visibleAreaWidth() == 0) {\n\t\t\tif (globalLayoutListener == null) {\n\t\t\t\tglobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onGlobalLayout() {\n\t\t\t\t\t\tview.getViewTreeObserver().removeOnGlobalLayoutListener(this);\n\t\t\t\t\t\tglobalLayoutListener = null;\n\t\t\t\t\t\tcacheHelper.contentAreaWidth(layoutHelper.visibleAreaWidth());\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\t\t\tview.getViewTreeObserver().addOnGlobalLayoutListener(globalLayoutListener);\n\t\t}\n\n\t}\n\n\t@Override\n\tpublic void onDetachedFromWindow(RecyclerView view, RecyclerView.Recycler recycler) {\n\t\tsuper.onDetachedFromWindow(view, recycler);\n\t\tif (globalLayoutListener != null) {\n\t\t\tview.getViewTreeObserver().removeOnGlobalLayoutListener(globalLayoutListener);\n\t\t\tglobalLayoutListener = null;\n\t\t}\n\t}\n\n\t@Override\n\tpublic boolean supportsPredictiveItemAnimations() {\n\t\treturn true;\n\t}\n\n\t@Override\n\tpublic void scrollToPosition(int position) {\n\t\tfirstChildAdapterPosition = position;\n\t\trequestLayout();\n\t}\n\n\t@Override\n\tpublic void smoothScrollToPosition(final RecyclerView recyclerView, final RecyclerView.State state, int position) {\n\t\tRecyclerView.SmoothScroller smoothScroller = new LinearSmoothScroller(recyclerView.getContext()) {\n\t\t\t@Override\n\t\t\tpublic PointF computeScrollVectorForPosition(int targetPosition) {\n\t\t\t\treturn new PointF(0, getOffsetOfItemToFirstChild(targetPosition, recyclerRef));\n\t\t\t}\n\t\t};\n\t\tsmoothScroller.setTargetPosition(position);\n\t\tstartSmoothScroll(smoothScroller);\n\t}\n\n\t@Override\n\tpublic void setAutoMeasureEnabled(boolean enabled) {\n\t\tsuper.setAutoMeasureEnabled(enabled);\n\t}\n\n\tprivate int leftVisibleEdge() {\n\t\treturn getPaddingLeft();\n\t}\n\n\tprivate int rightVisibleEdge() {\n\t\treturn getWidth() - getPaddingRight();\n\t}\n\n\tprivate int topVisibleEdge() {\n\t\treturn getPaddingTop();\n\t}\n\n\tprivate int bottomVisibleEdge() {\n\t\treturn getHeight() - getPaddingBottom();\n\t}\n\n\tprivate boolean childVisible(boolean preLayout, int left, int top, int right, int bottom) {\n\t\tif (recyclerView.getLayoutParams().height == ViewGroup.LayoutParams.WRAP_CONTENT) {\n\t\t\treturn true;\n\t\t}\n\t\treturn Rect.intersects(new Rect(leftVisibleEdge(), topVisibleEdge(), rightVisibleEdge(), bottomVisibleEdge()),\n\t\t\t\tnew Rect(left, top, right, bottom));\n\t}\n\n\tprivate boolean childVisible(boolean preLayout, Rect childRect) {\n\t\tif (!preLayout && recyclerView.getLayoutParams().height == ViewGroup.LayoutParams.WRAP_CONTENT) {\n\t\t\treturn true;\n\t\t}\n\t\treturn Rect.intersects(new Rect(leftVisibleEdge(), topVisibleEdge(), rightVisibleEdge(), bottomVisibleEdge()), childRect);\n\t}\n\n\tprivate int getMaxHeightLayoutPositionInLine(int layoutPosition) {\n\t\tfinal View child = getChildAt(layoutPosition);\n\t\tint maxIndexBefore = layoutPosition, maxIndexAfter = layoutPosition, maxHeightBefore = getDecoratedMeasuredHeight(child), maxHeightAfter = getDecoratedMeasuredHeight(child);\n\t\tint currentIndex = layoutPosition;\n\t\tLayoutContext layoutContext = LayoutContext.fromLayoutOptions(flowLayoutOptions);\n\t\twhile (currentIndex >= 0 && !isStartOfLine(currentIndex, layoutContext)) {\n\t\t\tfinal View beforeChild = getChildAt(currentIndex);\n\t\t\tif (getDecoratedMeasuredHeight(beforeChild) > maxHeightBefore) {\n\t\t\t\tmaxIndexBefore = currentIndex;\n\t\t\t\tmaxHeightBefore = getDecoratedMeasuredHeight(beforeChild);\n\t\t\t}\n\t\t\tcurrentIndex --;\n\t\t}\n\t\t// count in first one in line\n\t\tif (maxHeightBefore < getDecoratedMeasuredHeight(getChildAt(currentIndex))) {\n\t\t\tmaxIndexBefore = currentIndex;\n\t\t\tmaxHeightBefore = getDecoratedMeasuredHeight(getChildAt(currentIndex));\n\t\t}\n\n\t\tcurrentIndex = layoutPosition;\n\t\twhile (currentIndex < getChildCount() && !isEndOfLine(currentIndex, layoutContext)) {\n\t\t\tfinal View afterChild = getChildAt(currentIndex);\n\t\t\tif (getDecoratedMeasuredHeight(afterChild) > maxHeightAfter) {\n\t\t\t\tmaxIndexAfter = currentIndex;\n\t\t\t\tmaxHeightAfter = getDecoratedMeasuredHeight(afterChild);\n\t\t\t}\n\t\t\tcurrentIndex ++;\n\t\t}\n\t\t// count in last one in line\n\t\tif (maxHeightAfter < getDecoratedMeasuredHeight(getChildAt(currentIndex))) {\n\t\t\tmaxIndexAfter = currentIndex;\n\t\t\tmaxHeightAfter = getDecoratedMeasuredHeight(getChildAt(currentIndex));\n\t\t}\n\t\tif (maxHeightBefore >= maxHeightAfter) {\n\t\t\treturn maxIndexBefore;\n\t\t}\n\t\treturn maxIndexAfter;\n\t}\n\n\tprivate List<View> getAllViewsInLine(int index) {\n\t\tint firstItemIndex = index;\n\t\twhile(!isStartOfLine(firstItemIndex)) {\n\t\t\tfirstItemIndex --;\n\t\t}\n\n\t\tList<View> viewList = new LinkedList<>();\n\t\tviewList.add(getChildAt(firstItemIndex));\n\t\tint nextItemIndex = firstItemIndex + 1;\n\t\tLayoutContext layoutContext = LayoutContext.fromLayoutOptions(flowLayoutOptions);\n\t\twhile (nextItemIndex < getChildCount() && !isStartOfLine(nextItemIndex, layoutContext)) {\n\t\t\tviewList.add(getChildAt(nextItemIndex));\n\t\t\tnextItemIndex ++;\n\t\t}\n\t\treturn viewList;\n\t}\n\n\tprivate int getChildAdapterPosition(int layoutPosition) {\n\t\treturn getChildAdapterPosition(getChildAt(layoutPosition));\n\t}\n\n\tprivate int getChildAdapterPosition(View child) {\n\t\tif (child == null) {\n\t\t\treturn RecyclerView.NO_POSITION;\n\t\t}\n\t\treturn ((RecyclerView.LayoutParams)child.getLayoutParams()).getViewAdapterPosition();\n\t}\n\n\tpublic int getChildLayoutPosition(View child) {\n\t\treturn ((RecyclerView.LayoutParams)child.getLayoutParams()).getViewLayoutPosition();\n\t}\n\n\tprivate boolean lineVisible(int index) {\n\t\tint maxHeightItemIndex = getMaxHeightLayoutPositionInLine(index);\n\t\tView maxHeightItem = getChildAt(maxHeightItemIndex);\n\t\treturn Rect.intersects(new Rect(leftVisibleEdge(), topVisibleEdge(), rightVisibleEdge(), bottomVisibleEdge()),\n\t\t\t\tnew Rect(leftVisibleEdge(), getDecoratedTop(maxHeightItem), rightVisibleEdge(), getDecoratedBottom(maxHeightItem)));\n\t}\n\n\tprivate void recycleLine(int index, RecyclerView.Recycler recycler) {\n\t\tList<View> viewList = getAllViewsInLine(index);\n\t\tfor (View viewToRecycle : viewList) {\n\t\t\tremoveAndRecycleView(viewToRecycle, recycler);\n\t\t}\n\t}\n\n\tprivate int getOffsetOfItemToFirstChild(int adapterPosition, RecyclerView.Recycler recycler) {\n\t\tint firstChildPosition = getChildAdapterPosition(0);\n\t\tif (firstChildPosition == adapterPosition) {\n\t\t\t// first child is target, just make sure it is fully visible.\n\t\t\treturn topVisibleEdge() - getDecoratedTop(getChildAt(0));\n\t\t}\n\n\t\tif (adapterPosition > firstChildPosition) {\n\t\t\tint lastChildAdapterPosition = getChildAdapterPosition(getChildCount() - 1);\n\t\t\t// target child in screen, no need to calc.\n\t\t\tif (lastChildAdapterPosition >= adapterPosition) {\n\t\t\t\tint targetChildIndex = getChildCount() - 1 - (lastChildAdapterPosition - adapterPosition);\n\t\t\t\treturn getDecoratedTop(getChildAt(targetChildIndex)) - topVisibleEdge();\n\t\t\t} else {\n\t\t\t\t// target child is below screen edge\n\t\t\t\tint y = getDecoratedBottom(getChildAt(getMaxHeightLayoutPositionInLine(getChildCount() - 1))) - topVisibleEdge();\n\t\t\t\tint targetAdapterPosition = lastChildAdapterPosition + 1;\n\t\t\t\tint x = layoutStartPoint().x;\n\t\t\t\tint height = 0;\n\t\t\t\tRect rect = new Rect();\n\t\t\t\tboolean newline;\n\t\t\t\tLayoutContext layoutContext = LayoutContext.fromLayoutOptions(flowLayoutOptions);\n\t\t\t\twhile (targetAdapterPosition != adapterPosition) {\n\t\t\t\t\tView nextChild = recycler.getViewForPosition(targetAdapterPosition);\n\t\t\t\t\tnewline = calcChildLayoutRect(nextChild, x, y, height, layoutContext, rect);\n\t\t\t\t\tif (newline) {\n\t\t\t\t\t\tx = advanceInSameLine(layoutStartPoint().x, rect, layoutContext);\n\t\t\t\t\t\ty = rect.top;\n\t\t\t\t\t\theight = rect.height();\n\t\t\t\t\t\tlayoutContext.currentLineItemCount = 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tx = advanceInSameLine(x, rect, layoutContext);\n\t\t\t\t\t\theight = Math.max(height, getDecoratedMeasuredHeight(nextChild));\n\t\t\t\t\t\tlayoutContext.currentLineItemCount ++;\n\t\t\t\t\t}\n\t\t\t\t\trecycler.recycleView(nextChild);\n\t\t\t\t\ttargetAdapterPosition ++;\n\t\t\t\t}\n\t\t\t\treturn y;\n\t\t\t}\n\t\t} else {\n\t\t\t// target is off screen top, Need to start from beginning in data set\n\t\t\tint targetAdapterPosition = 0, x = layoutStartPoint().x, height = 0;\n\t\t\tint y = topVisibleEdge() - getDecoratedTop(getChildAt(0));\n\t\t\tRect rect = new Rect();\n\t\t\tboolean newline;\n\t\t\tLayoutContext layoutContext = LayoutContext.fromLayoutOptions(flowLayoutOptions);\n\t\t\twhile (targetAdapterPosition <= firstChildPosition) {\n\t\t\t\tView child = recycler.getViewForPosition(targetAdapterPosition);\n\t\t\t\tnewline = calcChildLayoutRect(child, x, y, height, rect);\n\t\t\t\tif (newline) {\n\t\t\t\t\tx = advanceInSameLine(layoutStartPoint().x, rect);\n\t\t\t\t\theight = rect.height();\n\t\t\t\t\tif (targetAdapterPosition >= adapterPosition) {\n\t\t\t\t\t\ty += height;\n\t\t\t\t\t}\n\t\t\t\t\tlayoutContext.currentLineItemCount = 1;\n\t\t\t\t} else {\n\t\t\t\t\tx = advanceInSameLine(x, rect);\n\t\t\t\t\theight = Math.max(height, getDecoratedMeasuredHeight(child));\n\t\t\t\t\tlayoutContext.currentLineItemCount ++;\n\t\t\t\t}\n\t\t\t\ttargetAdapterPosition ++;\n\t\t\t}\n\t\t\treturn -y;\n\t\t}\n\t}\n\n\t/**\n\t * Is child has been marked as removed.\n\t */\n\tprivate boolean isChildRemoved(View child) {\n\t\treturn ((RecyclerView.LayoutParams)child.getLayoutParams()).isItemRemoved();\n\t}\n\n\tpublic FlowLayoutManager setAlignment(Alignment alignment) {\n\t\tnewFlowLayoutOptions.alignment = alignment;\n\t\treturn this;\n\t}\n\n\tpublic FlowLayoutManager singleItemPerLine() {\n\t\tif (layoutHelper == null) {\n\t\t\tflowLayoutOptions.itemsPerLine = 1;\n\t\t} else {\n\t\t\tnewFlowLayoutOptions.itemsPerLine = 1;\n\t\t}\n\t\tif (cacheHelper != null) {\n\t\t\tcacheHelper.clear();\n\t\t}\n\t\tif (layoutHelper != null) {\n\t\t\tcacheHelper = new CacheHelper(1, layoutHelper.visibleAreaWidth());\n\t\t}\n\t\treturn this;\n\t}\n\n\tpublic FlowLayoutManager maxItemsPerLine(int itemsPerLine) {\n\t\tif (layoutHelper == null) {\n\t\t\tflowLayoutOptions.itemsPerLine = itemsPerLine;\n\t\t} else {\n\t\t\tnewFlowLayoutOptions.itemsPerLine = itemsPerLine;\n\t\t}\n\t\tif (cacheHelper != null) {\n\t\t\tcacheHelper.clear();\n\t\t}\n\t\tif (layoutHelper != null) {\n\t\t\tcacheHelper = new CacheHelper(itemsPerLine, layoutHelper.visibleAreaWidth());\n\t\t}\n\t\treturn this;\n\t}\n\n\tpublic FlowLayoutManager removeItemPerLineLimit() {\n\t\tif (layoutHelper == null) {\n\t\t\tflowLayoutOptions.itemsPerLine = FlowLayoutOptions.ITEM_PER_LINE_NO_LIMIT;\n\t\t} else {\n\t\t\tnewFlowLayoutOptions.itemsPerLine = FlowLayoutOptions.ITEM_PER_LINE_NO_LIMIT;\n\t\t}\n\t\tif (cacheHelper != null) {\n\t\t\tcacheHelper.clear();\n\t\t}\n\t\tif (layoutHelper != null) {\n\t\t\tcacheHelper = new CacheHelper(FlowLayoutOptions.ITEM_PER_LINE_NO_LIMIT, layoutHelper.visibleAreaWidth());\n\t\t}\n\t\treturn this;\n\t}\n\n\t/*****************alignment related functions*****************/\n\tprivate boolean calcChildLayoutRect(View child, int x, int y, int lineHeight, Rect rect) {\n\t\treturn calcChildLayoutRect(child, x, y, lineHeight, LayoutContext.fromLayoutOptions(flowLayoutOptions), rect);\n\t}\n\tprivate boolean calcChildLayoutRect(View child, int x, int y, int lineHeight, LayoutContext layoutContext, Rect rect) {\n\n\t\tboolean newLine;\n\t\tmeasureChildWithMargins(child, 0, 0);\n\t\tint childWidth = getDecoratedMeasuredWidth(child);\n\t\tint childHeight = getDecoratedMeasuredHeight(child);\n\t\tswitch (layoutContext.layoutOptions.alignment) {\n\t\t\tcase RIGHT:\n\t\t\t\tif (LayoutHelper.shouldStartNewline(x, childWidth, leftVisibleEdge(), rightVisibleEdge(), layoutContext)) {\n\t\t\t\t\tnewLine = true;\n\t\t\t\t\trect.left = rightVisibleEdge() - childWidth;\n\t\t\t\t\trect.top = y + lineHeight;\n\t\t\t\t\trect.right = rightVisibleEdge();\n\t\t\t\t\trect.bottom = rect.top + childHeight;\n\t\t\t\t} else {\n\t\t\t\t\tnewLine = false;\n\t\t\t\t\trect.left = x - childWidth;\n\t\t\t\t\trect.top = y;\n\t\t\t\t\trect.right = x;\n\t\t\t\t\trect.bottom = rect.top + childHeight;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase LEFT:\n\t\t\tdefault:\n\t\t\t\tif (LayoutHelper.shouldStartNewline(x, childWidth, leftVisibleEdge(), rightVisibleEdge(), layoutContext)) {\n\t\t\t\t\tnewLine = true;\n\t\t\t\t\trect.left = leftVisibleEdge();\n\t\t\t\t\trect.top = y + lineHeight;\n\t\t\t\t\trect.right = rect.left + childWidth;\n\t\t\t\t\trect.bottom = rect.top + childHeight;\n\t\t\t\t} else {\n\t\t\t\t\tnewLine = false;\n\t\t\t\t\trect.left = x;\n\t\t\t\t\trect.top = y;\n\t\t\t\t\trect.right = rect.left + childWidth;\n\t\t\t\t\trect.bottom = rect.top + childHeight;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn newLine;\n\t}\n\n\tprivate Point startNewline(Rect rect) {\n\t\treturn startNewline(rect, LayoutContext.fromLayoutOptions(flowLayoutOptions));\n\n\t}\n\tprivate Point startNewline(Rect rect, LayoutContext layoutContext) {\n\t\tswitch (layoutContext.layoutOptions.alignment) {\n\t\t\tcase RIGHT:\n\t\t\t\treturn new Point(rightVisibleEdge() - rect.width(), rect.top);\n\t\t\tcase LEFT:\n\t\t\tdefault:\n\t\t\t\treturn new Point(leftVisibleEdge() + rect.width(), rect.top);\n\t\t}\n\n\t}\n\n\tprivate int advanceInSameLine(int x, Rect rect) {\n\t\treturn advanceInSameLine(x, rect, LayoutContext.fromLayoutOptions(flowLayoutOptions));\n\t}\n\tprivate int advanceInSameLine(int x, Rect rect, LayoutContext layoutContext) {\n\t\tswitch (layoutContext.layoutOptions.alignment) {\n\t\t\tcase RIGHT:\n\t\t\t\treturn x - rect.width();\n\t\t\tcase LEFT:\n\t\t\tdefault:\n\t\t\t\treturn x + rect.width();\n\t\t}\n\t}\n\n\tprivate Point layoutStartPoint() {\n\t\treturn layoutHelper.layoutStartPoint(LayoutContext.fromLayoutOptions(flowLayoutOptions));\n\t}\n\n\tprivate boolean isStartOfLine(int index) {\n\t\treturn isStartOfLine(index, LayoutContext.fromLayoutOptions(flowLayoutOptions));\n\t}\n\tprivate boolean isStartOfLine(int index, LayoutContext layoutContext) {\n\t\tif (index == 0) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tswitch (layoutContext.layoutOptions.alignment) {\n\t\t\t\tcase RIGHT:\n\t\t\t\t\treturn getDecoratedRight(getChildAt(index)) >= rightVisibleEdge();\n\t\t\t\tcase LEFT:\n\t\t\t\tdefault:\n\t\t\t\t\treturn getDecoratedLeft(getChildAt(index)) <= leftVisibleEdge();\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate boolean isEndOfLine(int index) {\n\t\treturn isEndOfLine(index, LayoutContext.fromLayoutOptions(flowLayoutOptions));\n\t}\n\n\tprivate boolean isEndOfLine(int index, LayoutContext layoutContext) {\n\t\tif (LayoutHelper.hasItemsPerLineLimit(layoutContext.layoutOptions) && layoutContext.currentLineItemCount == layoutContext.layoutOptions.itemsPerLine) {\n\t\t\treturn true;\n\t\t}\n\t\tif (getChildCount() == 0 || index == getChildCount() - 1) {\n\t\t\treturn true;\n\t\t}\n\t\treturn isStartOfLine(index + 1, layoutContext);\n\t}\n\n}\n"
  },
  {
    "path": "flowlayoutmanager/src/main/java/com/xiaofeng/flowlayoutmanager/FlowLayoutOptions.java",
    "content": "package com.xiaofeng.flowlayoutmanager;\n\n/**\n * Created by xhan on 4/11/16.\n */\npublic class FlowLayoutOptions {\n\tpublic static final int ITEM_PER_LINE_NO_LIMIT = 0;\n\tpublic Alignment alignment = Alignment.LEFT;\n\tpublic int itemsPerLine = ITEM_PER_LINE_NO_LIMIT;\n\n\tpublic static FlowLayoutOptions clone(FlowLayoutOptions layoutOptions) {\n\t\tFlowLayoutOptions result = new FlowLayoutOptions();\n\t\tresult.alignment = layoutOptions.alignment;\n\t\tresult.itemsPerLine = layoutOptions.itemsPerLine;\n\t\treturn result;\n\t}\n}\n"
  },
  {
    "path": "flowlayoutmanager/src/main/java/com/xiaofeng/flowlayoutmanager/LayoutContext.java",
    "content": "package com.xiaofeng.flowlayoutmanager;\n\n/**\n * Created by xhan on 4/11/16.\n */\npublic class LayoutContext {\n\tpublic FlowLayoutOptions layoutOptions;\n\tpublic int currentLineItemCount;\n\n\tpublic static LayoutContext clone(LayoutContext layoutContext) {\n\t\tLayoutContext resultContext = new LayoutContext();\n\t\tresultContext.currentLineItemCount = layoutContext.currentLineItemCount;\n\t\tresultContext.layoutOptions = FlowLayoutOptions.clone(layoutContext.layoutOptions);\n\t\treturn resultContext;\n\t}\n\n\tpublic static LayoutContext fromLayoutOptions(FlowLayoutOptions layoutOptions) {\n\t\tLayoutContext layoutContext = new LayoutContext();\n\t\tlayoutContext.layoutOptions = layoutOptions;\n\t\treturn layoutContext;\n\t}\n}\n"
  },
  {
    "path": "flowlayoutmanager/src/main/java/com/xiaofeng/flowlayoutmanager/LayoutHelper.java",
    "content": "package com.xiaofeng.flowlayoutmanager;\n\nimport android.graphics.Point;\nimport android.support.v7.widget.RecyclerView;\n\n/**\n * Created by xhan on 4/11/16.\n */\npublic class LayoutHelper {\n\tRecyclerView.LayoutManager layoutManager;\n\tRecyclerView recyclerView;\n\n\tpublic LayoutHelper(RecyclerView.LayoutManager layoutManager, RecyclerView recyclerView) {\n\t\tthis.layoutManager = layoutManager;\n\t\tthis.recyclerView = recyclerView;\n\t}\n\n\tpublic int leftVisibleEdge() {\n\t\treturn recyclerView.getPaddingLeft();\n\t}\n\n\tpublic int rightVisibleEdge() {\n\t\treturn layoutManager.getWidth() - layoutManager.getPaddingRight();\n\t}\n\n\tpublic int visibleAreaWidth() {\n\t\treturn rightVisibleEdge() - leftVisibleEdge();\n\t}\n\n\tpublic int topVisibleEdge() {\n\t\treturn layoutManager.getPaddingTop();\n\t}\n\n\tpublic int bottomVisibleEdge() {\n\t\treturn layoutManager.getHeight() - layoutManager.getPaddingBottom();\n\t}\n\n\tpublic static boolean hasItemsPerLineLimit(FlowLayoutOptions layoutOptions) {\n\t\treturn layoutOptions.itemsPerLine > 0;\n\t}\n\n\tpublic static boolean shouldStartNewline(int x, int childWidth, int leftEdge, int rightEdge, LayoutContext layoutContext) {\n\t\tif (hasItemsPerLineLimit(layoutContext.layoutOptions) && layoutContext.currentLineItemCount == layoutContext.layoutOptions.itemsPerLine) {\n\t\t\treturn true;\n\t\t}\n\t\tswitch (layoutContext.layoutOptions.alignment) {\n\t\t\tcase RIGHT:\n\t\t\t\treturn x - childWidth < leftEdge;\n\t\t\tcase LEFT:\n\t\t\tdefault:\n\t\t\t\treturn x + childWidth > rightEdge;\n\t\t}\n\t}\n\n\tpublic Point layoutStartPoint(LayoutContext layoutContext) {\n\t\tswitch (layoutContext.layoutOptions.alignment) {\n\t\t\tcase RIGHT:\n\t\t\t\treturn new Point(rightVisibleEdge(), topVisibleEdge());\n\t\t\tdefault:\n\t\t\t\treturn new Point(leftVisibleEdge(), topVisibleEdge());\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "flowlayoutmanager/src/main/java/com/xiaofeng/flowlayoutmanager/cache/CacheHelper.java",
    "content": "package com.xiaofeng.flowlayoutmanager.cache;\n\nimport android.graphics.Point;\nimport android.util.SparseArray;\n\n/**\n * A Helper class that will save Line information (items count, total width etc.) and will be used\n * for layout, that will avoid low efficiency layout\n */\npublic class CacheHelper {\n\tpublic static final int NOT_FOUND = -1;\n\t/**\n\t * Item per line limit, set to 0 if no limit\n\t */\n\tfinal int itemPerLine;\n\t/**\n\t * The area width for content layout, must be greater than zero\n\t */\n\tint contentAreaWidth;\n\tSparseArray<Point> sizeMap;\n\tSparseArray<Line> lineMap;\n\tboolean batchSetting = false;\n\n\tpublic CacheHelper(int itemsPerLine, int contentAreaWidth) {\n\t\tthis.itemPerLine = itemsPerLine;\n\t\tthis.contentAreaWidth = contentAreaWidth;\n\t\tsizeMap = new SparseArray<>();\n\t\tlineMap = new SparseArray<>();\n\t}\n\n\t/**\n\t * Add measured items into cache\n\t */\n\tpublic void add(int startIndex, Point... sizes) {\n\t\tif (!valid()) {\n\t\t\treturn;\n\t\t}\n\t\tinvalidateLineMapAfter(startIndex);\n\t\tmakeSpace(startIndex, sizes.length);\n\t\tint index = startIndex;\n\t\tfor (Point size : sizes) {\n\t\t\tsizeMap.put(index ++, size);\n\t\t}\n\t\trefreshLineMap();\n\t}\n\n\t/**\n\t * Make space for {@param count} items\n\t */\n\tpublic void add(int startIndex, int count) {\n\t\tif (!valid()) {\n\t\t\treturn;\n\t\t}\n\t\tinvalidateLineMapAfter(startIndex);\n\t\tmakeSpace(startIndex, count);\n\t\trefreshLineMap();\n\t}\n\n\t/**\n\t * Sizes has been changed and new sizes not available yet, just remove them from cache\n\t * The line map will also be invalidate after the invalidated items\n\t * @param index\n\t * @param count\n\t */\n\tpublic void invalidSizes(int index, int count) {\n\t\tif (!valid()) {\n\t\t\treturn;\n\t\t}\n\t\tinvalidateLineMapAfter(index);\n\t\tint actualCount = actualCount(index, count);\n\t\tfor (int i = 0; i < actualCount; i ++) {\n\t\t\tsizeMap.remove(index + i);\n\t\t}\n\t\trefreshLineMap();\n\t}\n\n\tpublic void remove(int index, int count) {\n\t\tif (!valid()) {\n\t\t\treturn;\n\t\t}\n\t\tinvalidateLineMapAfter(index);\n\t\tint actualCount = actualCount(index, count);\n\t\tfor (int i = 0; i < actualCount; i ++) {\n\t\t\tsizeMap.remove(index + i);\n\t\t}\n\n\t\t// move everything behind to fill the hole.\n\t\tfor (int i = index + actualCount; i < sizeMap.size() + actualCount; i ++) {\n\t\t\tPoint tmp = sizeMap.get(i);\n\t\t\tsizeMap.remove(i);\n\t\t\tsizeMap.put(i - actualCount, tmp);\n\t\t}\n\t\trefreshLineMap();\n\t}\n\n\tpublic void setItem(int index, Point newSize) {\n\t\tif (!valid()) {\n\t\t\treturn;\n\t\t}\n\t\tif (sizeMap.get(index, null) != null) {\n\t\t\tPoint cachedPoint = sizeMap.get(index);\n\t\t\tif (!cachedPoint.equals(newSize)) {\n\t\t\t\tinvalidateLineMapAfter(index);\n\t\t\t\tsizeMap.put(index, newSize);\n\t\t\t\trefreshLineMap();\n\t\t\t}\n\t\t} else {\n\t\t\tinvalidateLineMapAfter(index);\n\t\t\tsizeMap.put(index, newSize);\n\t\t\trefreshLineMap();\n\t\t}\n\t}\n\n\t/**\n\t * Move items from one place to another. no check on parameter as invoker will make sure it is correct\n\t */\n\tpublic void move(int from, int to, int count) {\n\t\tif (!valid()) {\n\t\t\treturn;\n\t\t}\n\t\tinvalidateLineMapAfter(Math.min(from, to));\n\t\tPoint[] itemsToMove = new Point[count];\n\t\tfor (int i = from; i < from + count; i ++) {\n\t\t\titemsToMove[i - from] = sizeMap.get(i);\n\t\t}\n\t\tboolean movingForward = from - to > 0;\n\t\tint itemsToShift = Math.abs(from - to);\n\n\t\tif (!movingForward) {\n\t\t\titemsToShift -= count;\n\t\t}\n\t\tint shiftIndex = movingForward ? from - 1 : from + count;\n\t\tint shiftIndexStep = movingForward ? -1 : 1;\n\n\t\tint shifted = 0;\n\t\twhile (shifted < itemsToShift) {\n\t\t\tsizeMap.put(shiftIndex - (shiftIndexStep) * count, sizeMap.get(shiftIndex));\n\t\t\tshiftIndex += shiftIndexStep;\n\t\t\tshifted ++;\n\t\t}\n\n\t\tint setIndex = to;\n\t\tif (!movingForward) {\n\t\t\tsetIndex = from + itemsToShift;\n\t\t}\n\t\tfor (Point item : itemsToMove) {\n\t\t\tsizeMap.put(setIndex++, item);\n\t\t}\n\t\trefreshLineMap();\n\t}\n\n\tpublic int[] getLineMap() {\n\t\tif (!valid()) {\n\t\t\treturn new int[0];\n\t\t}\n\t\tint[] lineCounts = new int[this.lineMap.size()];\n\t\tfor (int i = 0; i < this.lineMap.size(); i ++) {\n\t\t\tlineCounts[i] = this.lineMap.get(i).itemCount;\n\t\t}\n\t\treturn lineCounts;\n\t}\n\n\tpublic int itemLineIndex(int itemIndex) {\n\t\tif (!valid()) {\n\t\t\treturn NOT_FOUND;\n\t\t}\n\t\tint itemCount = 0;\n\t\tfor (int i = 0; i < lineMap.size(); i ++) {\n\t\t\titemCount += lineMap.get(i).itemCount;\n\t\t\tif (itemCount >= itemIndex + 1) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn NOT_FOUND;\n\t}\n\n\tpublic Line containingLine(int itemIndex) {\n\t\tif (!valid()) {\n\t\t\treturn null;\n\t\t}\n\t\treturn getLine(itemLineIndex(itemIndex));\n\t}\n\n\tpublic int firstItemIndex(int lineIndex) {\n\t\tif (!valid()) {\n\t\t\treturn NOT_FOUND;\n\t\t}\n\t\tint itemCount = 0;\n\t\tfor (int i = 0; i < lineIndex; i ++) {\n\t\t\titemCount += lineMap.get(i).itemCount;\n\t\t}\n\t\treturn itemCount;\n\t}\n\n\tpublic Line getLine(int lineIndex) {\n\t\tif (!valid()) {\n\t\t\treturn null;\n\t\t}\n\t\treturn lineMap.get(lineIndex, null);\n\t}\n\n\tpublic boolean hasPreviousLineCached(int itemIndex) {\n\t\tif (!valid()) {\n\t\t\treturn false;\n\t\t}\n\t\tint lineIndex = itemLineIndex(itemIndex);\n\t\tif (lineIndex == NOT_FOUND) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (lineIndex > 0) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic boolean hasNextLineCached(int itemIndex) {\n\t\tif (!valid()) {\n\t\t\treturn false;\n\t\t}\n\t\tint lineIndex = itemLineIndex(itemIndex);\n\t\tif (lineIndex == NOT_FOUND) {\n\t\t\treturn false;\n\t\t}\n\t\treturn !lineMap.get(lineIndex + 1, Line.EMPTY_LINE).equals(Line.EMPTY_LINE);\n\t}\n\n\tpublic void clear() {\n\t\tsizeMap.clear();\n\t\tlineMap.clear();\n\t}\n\n\tpublic void contentAreaWidth(int width) {\n\t\tcontentAreaWidth = width;\n\t\tlineMap.clear();\n\t\trefreshLineMap();\n\t}\n\n\tpublic int contentAreaWidth() {\n\t\treturn contentAreaWidth;\n\t}\n\n\tpublic boolean valid() {\n\t\treturn contentAreaWidth > 0;\n\t}\n\n\tpublic void startBatchSetting() {\n\t\tbatchSetting = true;\n\t}\n\n\tpublic void endBatchSetting() {\n\t\tbatchSetting = false;\n\t\tlineMap.clear();\n\t\trefreshLineMap();\n\t}\n\n\t//===================== Helper methods ========================\n\n\t/**\n\t * Move item after startIndex to make {count} space(s)\n\t */\n\tprivate void makeSpace(int startIndex, int count) {\n\t\tfor (int i = sizeMap.size() - 1; i >= startIndex; i --) {\n\t\t\tsizeMap.put(i + count, sizeMap.get(i));\n\t\t}\n\t\tfor (int i = startIndex; i < startIndex + count; i ++) {\n\t\t\tsizeMap.remove(i);\n\t\t}\n\t}\n\n\t/**\n\t * Rebuild line map. and should stop if there is a hole (like item changed or item inserted but not measured)\n\t */\n\tprivate void refreshLineMap() {\n\t\tif (!valid() || batchSetting) {\n\t\t\treturn;\n\t\t}\n\t\tint index = refreshLineMapStartIndex();\n\t\tPoint cachedSize = sizeMap.get(index, null);\n\t\tint lineIndex = lineMap.size();\n\t\tint lineItemCount = 0;\n\t\tLine currentLine = containingLine(index);\n\n\t\tif (currentLine == null) {\n\t\t\tcurrentLine = new Line();\n\t\t} else {\n\t\t\tlineIndex = itemLineIndex(index);\n\t\t}\n\n\t\tint lineWidth = currentLine.totalWidth;\n\t\twhile (cachedSize != null) {\n\t\t\tlineWidth += cachedSize.x;\n\t\t\tlineItemCount ++;\n\t\t\tif (lineWidth <= contentAreaWidth) {\n\t\t\t\tif (itemPerLine > 0) { // have item per line limit\n\t\t\t\t\tif (lineItemCount > itemPerLine) { // exceed item per line limit\n\t\t\t\t\t\tlineMap.put(lineIndex, currentLine);\n\n\t\t\t\t\t\t// put this item to next line\n\t\t\t\t\t\tcurrentLine = new Line();\n\t\t\t\t\t\taddToLine(currentLine, cachedSize, index);\n\t\t\t\t\t\tlineIndex ++;\n\t\t\t\t\t\tlineWidth = cachedSize.x;\n\t\t\t\t\t\tlineItemCount = 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\taddToLine(currentLine, cachedSize, index);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\taddToLine(currentLine, cachedSize, index);\n\t\t\t\t}\n\t\t\t} else { // too wide to add this item, put line item count to index and put this one to new line\n\t\t\t\tlineMap.put(lineIndex, currentLine);\n\t\t\t\tcurrentLine = new Line();\n\t\t\t\taddToLine(currentLine, cachedSize, index);\n\t\t\t\tlineIndex ++;\n\t\t\t\tlineWidth = cachedSize.x;\n\t\t\t\tlineItemCount = 1;\n\n\t\t\t}\n\t\t\tindex ++;\n\t\t\tcachedSize = sizeMap.get(index, null);\n\t\t}\n\n\t\tif (currentLine.itemCount > 0) {\n\t\t\tlineMap.append(lineIndex, currentLine);\n\t\t}\n\t}\n\n\t/**\n\t * Add view info to line\n\t */\n\tprivate void addToLine(Line line, Point item, int index) {\n\t\tline.itemCount ++;\n\t\tline.totalWidth += item.x;\n\t\tline.maxHeight = item.y > line.maxHeight ? item.y : line.maxHeight;\n\t\tif (item.y == line.maxHeight) {\n\t\t\tline.maxHeightIndex = index;\n\t\t}\n\t}\n\n\t/**\n\t * return actual count from index to expected count or end of sizeMap\n\t */\n\tprivate int actualCount(int index, int count) {\n\t\treturn index + count > sizeMap.size() ? sizeMap.size() - index : count;\n\t}\n\n\t/**\n\t * Invalidate line map that contains item and all lines after\n\t * @param itemIndex\n\t */\n\tprivate void invalidateLineMapAfter(int itemIndex) {\n\t\tif (batchSetting) {\n\t\t\treturn;\n\t\t}\n\t\tint itemLineIndex = itemLineIndex(itemIndex);\n\t\tLine line = lineMap.get(itemLineIndex, null);\n\t\tif (line == null && lineMap.size() > 0) {\n\t\t\tlineMap.remove(lineMap.size() - 1);\n\t\t}\n\t\twhile (line != null) {\n\t\t\tlineMap.remove(itemLineIndex);\n\t\t\titemLineIndex ++;\n\t\t\tline = lineMap.get(itemLineIndex, null);\n\t\t}\n\t}\n\n\tprivate int refreshLineMapStartIndex() {\n\t\tint itemCount = 0;\n\t\tfor (int i = 0; i < lineMap.size(); i ++) {\n\t\t\titemCount += lineMap.get(i).itemCount;\n\t\t}\n\t\tif (itemCount >= sizeMap.size()) {\n\t\t\treturn NOT_FOUND;\n\t\t}\n\t\treturn itemCount;\n\t}\n\n\n\n\n}\n"
  },
  {
    "path": "flowlayoutmanager/src/main/java/com/xiaofeng/flowlayoutmanager/cache/Line.java",
    "content": "package com.xiaofeng.flowlayoutmanager.cache;\n\n/**\n * Created by xhan on 4/28/16.\n */\npublic class Line {\n\tpublic int itemCount;\n\tpublic int totalWidth;\n\tpublic int maxHeight;\n\tpublic int maxHeightIndex;\n\n\tpublic static final Line EMPTY_LINE = new Line();\n\tpublic Line() {\n\t\titemCount = 0;\n\t\ttotalWidth = 0;\n\t\tmaxHeight = 0;\n\t\tmaxHeightIndex = -1;\n\n\t}\n\n\tpublic Line clone() {\n\t\tLine clone = new Line();\n\t\tclone.itemCount = itemCount;\n\t\tclone.totalWidth = totalWidth;\n\t\tclone.maxHeight = maxHeight;\n\t\tclone.maxHeightIndex = maxHeightIndex;\n\t\treturn clone;\n\t}\n\n\t@Override\n\tpublic boolean equals(Object o) {\n\t\tif (this == o) return true;\n\t\tif (o == null || getClass() != o.getClass()) return false;\n\n\t\tLine line = (Line) o;\n\n\t\tif (itemCount != line.itemCount) return false;\n\t\tif (totalWidth != line.totalWidth) return false;\n\t\tif (maxHeight != line.maxHeight) return false;\n\t\treturn maxHeightIndex == line.maxHeightIndex;\n\n\t}\n\n\t@Override\n\tpublic int hashCode() {\n\t\tint result = itemCount;\n\t\tresult = 31 * result + totalWidth;\n\t\tresult = 31 * result + maxHeight;\n\t\tresult = 31 * result + maxHeightIndex;\n\t\treturn result;\n\t}\n\n\t@Override\n\tpublic String toString() {\n\t\treturn \"Line{\" +\n\t\t\t\t\"itemCount=\" + itemCount +\n\t\t\t\t\", totalWidth=\" + totalWidth +\n\t\t\t\t\", maxHeight=\" + maxHeight +\n\t\t\t\t\", maxHeightIndex=\" + maxHeightIndex +\n\t\t\t\t'}';\n\t}\n}\n"
  },
  {
    "path": "flowlayoutmanager/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">FlowLayoutManager</string>\n</resources>\n"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "#Wed Oct 21 11:34:03 PDT 2015\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-2.10-all.zip\n"
  },
  {
    "path": "gradle.properties",
    "content": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will override*\n# any settings specified in this file.\n\n# For more details on how to configure your build environment visit\n# http://www.gradle.org/docs/current/userguide/build_environment.html\n\n# Specifies the JVM arguments used for the daemon process.\n# The setting is particularly useful for tweaking memory settings.\n# Default value: -Xmx10248m -XX:MaxPermSize=256m\n# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8\n\n# When configured, Gradle will run in incubating parallel mode.\n# This option should only be used with decoupled projects. More details, visit\n# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects\n# org.gradle.parallel=true"
  },
  {
    "path": "gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\nesac\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto init\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto init\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:init\n@rem Get command-line arguments, handling Windowz variants\n\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\n\n:win9xME_args\n@rem Slurp the command line arguments.\nset CMD_LINE_ARGS=\nset _SKIP=2\n\n:win9xME_args_slurp\nif \"x%~1\" == \"x\" goto execute\n\nset CMD_LINE_ARGS=%*\ngoto execute\n\n:4NT_args\n@rem Get arguments from the 4NT Shell from JP Software\nset CMD_LINE_ARGS=%$\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "settings.gradle",
    "content": "include ':app', ':flowlayoutmanager'\n"
  }
]