[
  {
    "path": ".gitignore",
    "content": "*.iml\n.gradle\n/local.properties\n/build\n/.gradle/\n/.idea/\n/sample/build/\n/fragment/build/\n"
  },
  {
    "path": "LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2017 Yan Zhenjie\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\n"
  },
  {
    "path": "README.md",
    "content": "﻿严振杰的主页：[http://www.yanzhenjie.com](http://www.yanzhenjie.com)  \n严振杰的博客：[http://blog.yanzhenjie.com](http://blog.yanzhenjie.com)  \n\n**欢迎加入QQ技术交流群：[46523908](http://jq.qq.com/?_wv=1027&k=40hvC7E)**\n\n关于Fragment、NoFragment的使用看博客：[【2016Ending，2017Starting】NoFragment之Fragment玩法新姿势](http://blog.csdn.net/yanzhenjie1003/article/details/54562328)。\n\n# 特点\n1. 支持传统`Fragment`的所有用法。\n2. 支持`startFragmentForResult(Fragment)`、`onFragmentResult(int, int, Bundle)`，原生只有Activity。\n3. 支持同一个`Fragment`启动多个实例。\n5. 支持自动维护`Back Stack`，不会错乱。\n6. 支持在`Fragment`中直接`setToolbar()`、`setTitle()`、`displayHomeButton()`。\n7. 返回键和`homeButton`自动处理，支持开发者拦截处理。\n8. 支持`ActionBar Menu`、溢出`Menu`等。\n9. 开发者不用管跳转逻辑、back键处理、Toolbar加载菜单等。\n\n# 使用方法\n* Gradle一句话远程依赖\n```groovy\ncompile 'com.yanzhenjie:fragment:1.0.1'\n```\n* Maven:\n```xml\n<dependency>\n  <groupId>com.yanzhenjie</groupId>\n  <artifactId>fragment</artifactId>\n  <version>1.0.1</version>\n  <type>pom</type>\n</dependency>\n```\n\n* Eclipse ADT\n请放弃治疗。\n\n# 图示\n第一种，结合ToolBar、Menu的演示：\n\n<image src=\"https://github.com/yanzhenjie/NoFragment/blob/master/image/2.gif?raw=true\" width=\"280px\"/>\n\n第二种，结合Toolbar、Menu + OverFlower的演示：\n\n<image src=\"https://github.com/yanzhenjie/NoFragment/blob/master/image/3.gif?raw=true\" width=\"280px\"/>\n\n第三种，`startFragmentForResult()`、`onFragmentResult()`演示：\n\n<image src=\"https://github.com/yanzhenjie/NoFragment/blob/master/image/4.gif?raw=true\" width=\"280px\"/>\n\n第四种，不保存的在回退栈的演示：\n\n<image src=\"https://github.com/yanzhenjie/NoFragment/blob/master/image/5.gif?raw=true\" width=\"280px\"/>\n\n# 代码展示\n你的宿主`Activity`需要继承`CompatActivity`，然后启动一个`Fragment`：\n```java\npublic class MainActivity extends CompatActivity {\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n\n        /*\n         * 一句话即可，不要怀疑自己的眼睛，这是真的。\n         */\n        startFragment(MainFragment.class);\n    }\n\n    @Override\n    protected int fragmentLayoutId() {\n        return R.id.fragment_root;\n    }\n\n}\n```\n\n之后在Fragment中互相跳转，你可以不用管物理Back键被按下之类的：\n\n## 一、以`standard`模式启动一个`Fragment`\n```java\nstartFragment(MoreMenuFragment.class);\n```\n\n## 二、以`startActivityForResult()`方式启动一个`Fragment`\n```java\n// 启动，等待回调结果。\nstartFragmentForResult(StartResultFragment.class, 100);\n\n// 不论怎样回来都会回调onFragmentResult()。\n@Override\npublic void onFragmentResult(int requestCode, int resultCode, @Nullable Bundle result) {\n    switch (requestCode) {\n        case 100: {\n            if (resultCode == RESULT_OK) {\n                // 操作成功：result就是调用的Fragment返回的结果。\n            } else if (resultCode == RESULT_CANCELED) {\n                // 操作取消。\n            }\n            break;\n        }\n    }\n}\n```\n\n在`StartResultFragment`中如果要返回结果，那么：\n```java\nBundle bundle = new Bundle();\nbundle.putString(\"message\", result);\nsetResult(RESULT_OK, bundle);\nfinish();\n```\n\n当然你也不设置，那么`resultCode`的默认值是`RESULT_CANCELED`。\n\n## 三、跳转时带参数\n```java\n// 封装参数：\nBundle bundle = new Bundle();\nbundle.putString(\"hehe\", \"呵呵哒\");\nbundle.putString(\"meng\", \"萌萌哒\");\nbundle.putString(\"bang\", \"棒棒哒\");\nbundle.putString(\"meme\", \"么么哒\");\n\n// 在Activity中或者Fragment调用此方法：  \nNoFragment fragment = fragment(ArgumentFragment.class, bundle);\n\n// 最后启动：\nstartFragment(fragment);\n```\n\n## 四、跳转的`Fragment`不保存在`Back Stack`\n这种方式显示的`fragment`中如果调用了其它`fragment`，从其它`fragment`中回来时，这个`fragment`将会跳过，不会显示，也就是说：A-B-C-[back]-A，从A到B，B不加入回退栈，B再到C，C按下返回键，或者调用`finish()`方法，将会直接回到A。\n```java\nstartFragment(StackFragment.class, false);\n```\n\n## 五、同一个Fragment，启动多个实例\n```java\nstartFragment(MoreMenuFragment.class);\nstartFragment(MoreMenuFragment.class);\nstartFragment(MoreMenuFragment.class);\nstartFragment(MoreMenuFragment.class);\n```\n比如我们这里调用四次，那么回退栈中有四个`MoreMenuFragment`，按下返回键时将一个个退出。\n\n## 六、Toolbar菜单的加载和处理\n我们知道MD设计中，Toolbar的菜单很好看，而且利用Toolbar也很好加载，那么NoFragment也是完美支持的，当重写了`onCreateOptionsMenu()`方法后，调用`setToolbar(Toolbar)`方法时，将会调用`onCreateOptionsMenu()`方法，此时你就该加载菜单了，当然也只需要一句话。\n\n```java\n@Override\npublic void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n    // Load your menu.\n    inflater.inflate(R.menu.menu_fragment_main, menu);\n}\n```\n\n当用户点击meun的item时将会回调这个方法，和原生Activity是一样的。\n```java\n@Override\npublic boolean onOptionsItemSelected(MenuItem item) {\n    // Handle menu item click.\n    int id = item.getItemId();\n    switch (id) {\n        case R.id.action_settings: {\n            Snackbar.make(mToolbar, R.string.action_settings, Snackbar.LENGTH_SHORT).show();\n            break;\n        }\n        case R.id.action_exit: {\n            Snackbar.make(mToolbar, R.string.action_exit, Snackbar.LENGTH_SHORT).show();\n            break;\n        }\n    }\n    return true;\n}\n```\n\n## 七、Toolbar的返回按钮的处理\n在正常开发中给Toolbar设置返回按钮也要好几行代码的，如果使用了NoFragment，那么：\n```java\n@Override\npublic void onActivityCreated(@Nullable Bundle savedInstanceState) {\n    super.onActivityCreated(savedInstanceState);\n\n    // 首先设置Toolbar：\n    setToolbar(mToolbar);\n\n    // 设置标题：\n    setTitle(R.string.title_fragment_main);\n\n    // 显示返回按钮，图标开发者指定：\n    displayHomeAsUpEnabled(R.drawable.ic_close_white);\n}\n```\n\n设置了返回按钮后，用户点击返回按钮将自动杀死当前`Fragment`，当然你也可以拦截用户的返回行为：\n```java\n@Override\n    public boolean onInterceptToolbarBack() {\n        // 返回true将拦截，返回false将不拦截。\n        return true;\n    }\n```\n\n# 混淆\n```text\n-keep public class * extends android.support.v4.app.Fragment\n```\n\n# License\n```text\nCopyright 2017 Yan Zhenjie\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```"
  },
  {
    "path": "build.gradle",
    "content": "apply from: \"config.gradle\"\n\nbuildscript {\n    repositories {\n        jcenter()\n    }\n    dependencies {\n        classpath 'com.android.tools.build:gradle:2.3.1'\n        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'\n        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'\n    }\n}\n\nallprojects {\n    repositories {\n        jcenter()\n    }\n}\n\ntask clean(type: Delete) {\n    delete rootProject.buildDir\n}\n"
  },
  {
    "path": "config.gradle",
    "content": "ext {\n    plugins = [\n            library    : 'com.android.library',\n            application: 'com.android.application',\n            maven      : 'com.github.dcendents.android-maven',\n            bintray    : 'com.jfrog.bintray'\n    ]\n\n    android = [\n            // build.\n            compileSdkVersion: 25,\n            buildToolsVersion: \"25.0.2\",\n\n            // defaultConfig.\n            applicationId    : \"com.yanzhenjie.fragment.sample\",\n            minSdkVersion    : 11,\n            targetSdkVersion : 25,\n            versionCode      : 11,\n            versionName      : \"1.01\",\n    ]\n\n    dependencies = [\n            // android-support\n            design     : 'com.android.support:design:25.3.1',\n            appcompat  : 'com.android.support:appcompat-v7:25.3.1',\n            permission : 'com.yanzhenjie:permission:1.0.5',\n            fragment   : 'com.yanzhenjie:fragment:1.0.2',\n            alertdialog: 'com.yanzhenjie.alertdialog:alertdialog:1.0.0'\n    ]\n\n}"
  },
  {
    "path": "fragment/build.gradle",
    "content": "apply plugin: rootProject.ext.plugins.library\n\nandroid {\n    compileSdkVersion rootProject.ext.android.compileSdkVersion\n    buildToolsVersion rootProject.ext.android.buildToolsVersion\n\n    defaultConfig {\n        minSdkVersion rootProject.ext.android.minSdkVersion\n        targetSdkVersion rootProject.ext.android.targetSdkVersion\n    }\n}\n\ndependencies {\n    compile rootProject.ext.dependencies.appcompat\n}\n\napply from: \"maven.gradle\"\n"
  },
  {
    "path": "fragment/maven.gradle",
    "content": "apply plugin: rootProject.ext.plugins.maven\napply plugin: rootProject.ext.plugins.bintray\n\nversion = \"1.0.2\"\n\ndef siteUrl = 'https://github.com/yanzhenjie/NoFragment'\ndef gitUrl = 'git@github.com:yanzhenjie/NoFragment.git'\ngroup = \"com.yanzhenjie\"\n\ninstall {\n    repositories.mavenInstaller {\n        pom {\n            project {\n                packaging 'aar'\n                name 'Fragment for Android'\n                description 'Fragment for Android'\n                url siteUrl\n                licenses {\n                    license {\n                        name 'The Apache Software License, Version 2.0'\n                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'\n                    }\n                }\n                developers {\n                    developer {\n                        id 'yanzhenjie'\n                        name 'yanzhenjie'\n                        email 'smallajax@foxmail.com'\n                    }\n                }\n                scm {\n                    connection gitUrl\n                    developerConnection gitUrl\n                    url siteUrl\n                }\n            }\n        }\n    }\n}\ntask sourcesJar(type: Jar) {\n    from android.sourceSets.main.java.srcDirs\n    classifier = 'sources'\n}\ntask javadoc(type: Javadoc) {\n    source = android.sourceSets.main.java.srcDirs\n    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))\n    failOnError false\n}\ntask javadocJar(type: Jar, dependsOn: javadoc) {\n    classifier = 'javadoc'\n    from javadoc.destinationDir\n}\nartifacts {\n    archives javadocJar\n    archives sourcesJar\n}\n\nProperties properties = new Properties()\nproperties.load(project.rootProject.file('local.properties').newDataInputStream())\nbintray {\n    user = properties.getProperty(\"bintray.user\")\n    key = properties.getProperty(\"bintray.apikey\")\n\n    configurations = ['archives']\n    pkg {\n        repo = \"maven\"\n        name = \"fragment\"\n        userOrg = 'yolanda'\n        websiteUrl = siteUrl\n        vcsUrl = gitUrl\n        licenses = [\"Apache-2.0\"]\n        publish = true\n        version {\n            gpg {\n                sign = true\n                passphrase = properties.getProperty(\"bintray.gpg.password\")\n            }\n        }\n    }\n}"
  },
  {
    "path": "fragment/src/main/AndroidManifest.xml",
    "content": "<manifest\n    package=\"com.yanzhenjie.fragment\"/>\n\n"
  },
  {
    "path": "fragment/src/main/java/com/yanzhenjie/fragment/CompatActivity.java",
    "content": "/*\n * Copyright © Yan Zhenjie. All Rights Reserved\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 */\npackage com.yanzhenjie.fragment;\n\nimport android.os.Bundle;\nimport android.support.annotation.IdRes;\nimport android.support.annotation.Nullable;\nimport android.support.v4.app.Fragment;\nimport android.support.v4.app.FragmentManager;\nimport android.support.v4.app.FragmentTransaction;\nimport android.support.v7.app.AppCompatActivity;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.concurrent.atomic.AtomicInteger;\n\n/**\n * <p>Must extends CompatActivity.</p>\n * Created by Yan Zhenjie on 2017/1/13.\n */\npublic abstract class CompatActivity extends AppCompatActivity {\n\n    public static final int REQUEST_CODE_INVALID = -1;\n\n    private FragmentManager mFManager;\n    private AtomicInteger mAtomicInteger = new AtomicInteger();\n    private List<NoFragment> mFragmentStack = new ArrayList<>();\n    private Map<NoFragment, FragmentStackEntity> mFragmentEntityMap = new HashMap<>();\n\n    static class FragmentStackEntity {\n        private FragmentStackEntity() {\n        }\n\n        private boolean isSticky = false;\n        private int requestCode = REQUEST_CODE_INVALID;\n        @ResultCode\n        int resultCode = RESULT_CANCELED;\n        Bundle result = null;\n    }\n\n    public final <T extends NoFragment> T fragment(Class<T> fragmentClass) {\n        //noinspection unchecked\n        return (T) Fragment.instantiate(this, fragmentClass.getName());\n    }\n\n    public final <T extends NoFragment> T fragment(Class<T> fragmentClass, Bundle bundle) {\n        //noinspection unchecked\n        return (T) Fragment.instantiate(this, fragmentClass.getName(), bundle);\n    }\n\n    @Override\n    protected void onCreate(@Nullable Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        mFManager = getSupportFragmentManager();\n    }\n\n    /**\n     * Show a fragment.\n     *\n     * @param clazz fragment class.\n     */\n    public final <T extends NoFragment> void startFragment(Class<T> clazz) {\n        try {\n            NoFragment targetFragment = clazz.newInstance();\n            startFragment(null, targetFragment, true, REQUEST_CODE_INVALID);\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n    }\n\n    /**\n     * Show a fragment.\n     *\n     * @param clazz       fragment class.\n     * @param stickyStack sticky to back stack.\n     */\n    public final <T extends NoFragment> void startFragment(Class<T> clazz, boolean stickyStack) {\n        try {\n            NoFragment targetFragment = clazz.newInstance();\n            startFragment(null, targetFragment, stickyStack, REQUEST_CODE_INVALID);\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n    }\n\n    /**\n     * Show a fragment.\n     *\n     * @param targetFragment fragment to display.\n     * @param <T>            {@link NoFragment}.\n     */\n    public final <T extends NoFragment> void startFragment(T targetFragment) {\n        startFragment(null, targetFragment, true, REQUEST_CODE_INVALID);\n    }\n\n    /**\n     * Show a fragment.\n     *\n     * @param targetFragment fragment to display.\n     * @param stickyStack    sticky back stack.\n     * @param <T>            {@link NoFragment}.\n     */\n    public final <T extends NoFragment> void startFragment(T targetFragment, boolean stickyStack) {\n        startFragment(null, targetFragment, stickyStack, REQUEST_CODE_INVALID);\n    }\n\n    /**\n     * Show a fragment for result.\n     *\n     * @param clazz       fragment to display.\n     * @param requestCode requestCode.\n     * @param <T>         {@link NoFragment}.\n     * @deprecated use {@link #startFragmentForResult(Class, int)} instead.\n     */\n    @Deprecated\n    public final <T extends NoFragment> void startFragmentForResquest(Class<T> clazz, int requestCode) {\n        startFragmentForResult(clazz, requestCode);\n    }\n\n    /**\n     * Show a fragment for result.\n     *\n     * @param targetFragment fragment to display.\n     * @param requestCode    requestCode.\n     * @param <T>            {@link NoFragment}.\n     * @deprecated use {@link #startFragmentForResult(NoFragment, int)} instead.\n     */\n    @Deprecated\n    public final <T extends NoFragment> void startFragmentForResquest(T targetFragment, int requestCode) {\n        startFragmentForResult(targetFragment, requestCode);\n    }\n\n    /**\n     * Show a fragment for result.\n     *\n     * @param clazz       fragment to display.\n     * @param requestCode requestCode.\n     * @param <T>         {@link NoFragment}.\n     */\n    public final <T extends NoFragment> void startFragmentForResult(Class<T> clazz, int requestCode) {\n        if (requestCode == REQUEST_CODE_INVALID)\n            throw new IllegalArgumentException(\"The requestCode must be positive integer.\");\n        try {\n            NoFragment targetFragment = clazz.newInstance();\n            startFragment(null, targetFragment, true, requestCode);\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n    }\n\n    /**\n     * Show a fragment for result.\n     *\n     * @param targetFragment fragment to display.\n     * @param requestCode    requestCode.\n     * @param <T>            {@link NoFragment}.\n     */\n    public final <T extends NoFragment> void startFragmentForResult(T targetFragment, int requestCode) {\n        if (requestCode == REQUEST_CODE_INVALID)\n            throw new IllegalArgumentException(\"The requestCode must be positive integer.\");\n        startFragment(null, targetFragment, true, requestCode);\n    }\n\n    /**\n     * Show a fragment.\n     *\n     * @param thisFragment Now show fragment, can be null.\n     * @param thatFragment fragment to display.\n     * @param stickyStack  sticky back stack.\n     * @param requestCode  requestCode.\n     * @param <T>          {@link NoFragment}.\n     */\n    protected final <T extends NoFragment> void startFragment(T thisFragment, T thatFragment,\n                                                              boolean stickyStack, int requestCode) {\n        FragmentTransaction fragmentTransaction = mFManager.beginTransaction();\n        if (thisFragment != null) {\n            FragmentStackEntity thisStackEntity = mFragmentEntityMap.get(thisFragment);\n            if (thisStackEntity != null) {\n                if (thisStackEntity.isSticky) {\n                    thisFragment.onPause();\n                    thisFragment.onStop();\n                    fragmentTransaction.hide(thisFragment);\n                } else {\n                    fragmentTransaction.remove(thisFragment).commit();\n                    fragmentTransaction.commitNow();\n                    fragmentTransaction = mFManager.beginTransaction();\n\n                    mFragmentEntityMap.remove(thisFragment);\n                    mFragmentStack.remove(thisFragment);\n                }\n            }\n        }\n\n        String fragmentTag = thatFragment.getClass().getSimpleName() + mAtomicInteger.incrementAndGet();\n        fragmentTransaction.add(fragmentLayoutId(), thatFragment, fragmentTag);\n        fragmentTransaction.addToBackStack(fragmentTag);\n        fragmentTransaction.commit();\n\n        FragmentStackEntity fragmentStackEntity = new FragmentStackEntity();\n        fragmentStackEntity.isSticky = stickyStack;\n        fragmentStackEntity.requestCode = requestCode;\n        thatFragment.setStackEntity(fragmentStackEntity);\n        mFragmentEntityMap.put(thatFragment, fragmentStackEntity);\n\n        mFragmentStack.add(thatFragment);\n    }\n\n    /**\n     * When the back off.\n     */\n    protected final boolean onBackStackFragment() {\n        if (mFragmentStack.size() > 1) {\n            mFManager.popBackStack();\n            NoFragment inFragment = mFragmentStack.get(mFragmentStack.size() - 2);\n\n            FragmentTransaction fragmentTransaction = mFManager.beginTransaction();\n            fragmentTransaction.show(inFragment);\n            fragmentTransaction.commit();\n\n            NoFragment outFragment = mFragmentStack.get(mFragmentStack.size() - 1);\n            inFragment.onResume();\n\n            FragmentStackEntity stackEntity = mFragmentEntityMap.get(outFragment);\n            mFragmentStack.remove(outFragment);\n            mFragmentEntityMap.remove(outFragment);\n\n            if (stackEntity.requestCode != REQUEST_CODE_INVALID) {\n                inFragment.onFragmentResult(stackEntity.requestCode, stackEntity.resultCode, stackEntity.result);\n            }\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public void onBackPressed() {\n        if (!onBackStackFragment()) {\n            finish();\n        }\n    }\n\n    /**\n     * Should be returned to display fragments id of {@link android.view.ViewGroup}.\n     *\n     * @return resource id of {@link android.view.ViewGroup}.\n     */\n    protected abstract\n    @IdRes\n    int fragmentLayoutId();\n\n}"
  },
  {
    "path": "fragment/src/main/java/com/yanzhenjie/fragment/NoFragment.java",
    "content": "/*\n * Copyright © Yan Zhenjie. All Rights Reserved\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 */\npackage com.yanzhenjie.fragment;\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.content.Intent;\nimport android.graphics.drawable.Drawable;\nimport android.os.Bundle;\nimport android.support.annotation.DrawableRes;\nimport android.support.annotation.NonNull;\nimport android.support.annotation.Nullable;\nimport android.support.v4.app.Fragment;\nimport android.support.v4.content.ContextCompat;\nimport android.support.v7.view.SupportMenuInflater;\nimport android.support.v7.widget.Toolbar;\nimport android.view.MenuItem;\nimport android.view.View;\n\n/**\n * Created by Yan Zhenjie on 2017/1/13.\n */\npublic class NoFragment extends Fragment {\n\n    public static final int RESULT_OK = Activity.RESULT_OK;\n    public static final int RESULT_CANCELED = Activity.RESULT_CANCELED;\n\n    private static final int REQUEST_CODE_INVALID = CompatActivity.REQUEST_CODE_INVALID;\n\n    /**\n     * Create a new instance of a Fragment with the given class name.  This is the same as calling its empty constructor.\n     *\n     * @param context       context.\n     * @param fragmentClass class of fragment.\n     * @param <T>           subclass of {@link NoFragment}.\n     * @return new instance.\n     * @deprecated In {@code Activity} with {@link CompatActivity#fragment(Class)} instead;\n     * in the {@code Fragment} width {@link #fragment(Class)} instead.\n     */\n    @Deprecated\n    public static <T extends NoFragment> T instantiate(Context context, Class<T> fragmentClass) {\n        //noinspection unchecked\n        return (T) instantiate(context, fragmentClass.getName(), null);\n    }\n\n    /**\n     * Create a new instance of a Fragment with the given class name.  This is the same as calling its empty constructor.\n     *\n     * @param context       context.\n     * @param fragmentClass class of fragment.\n     * @param bundle        argument.\n     * @param <T>           subclass of {@link NoFragment}.\n     * @return new instance.\n     * @deprecated In {@code Activity} with {@link CompatActivity#fragment(Class, Bundle)} instead;\n     * in the {@code Fragment} width {@link #fragment(Class, Bundle)} instead.\n     */\n    @Deprecated\n    public static <T extends NoFragment> T instantiate(Context context, Class<T> fragmentClass, Bundle bundle) {\n        //noinspection unchecked\n        return (T) instantiate(context, fragmentClass.getName(), bundle);\n    }\n\n    /**\n     * Create a new instance of a Fragment with the given class name.  This is the same as calling its empty constructor.\n     *\n     * @param fragmentClass class of fragment.\n     * @param <T>           subclass of {@link NoFragment}.\n     * @return new instance.\n     */\n    public final <T extends NoFragment> T fragment(Class<T> fragmentClass) {\n        //noinspection unchecked\n        return (T) instantiate(getContext(), fragmentClass.getName(), null);\n    }\n\n    /**\n     * Create a new instance of a Fragment with the given class name.  This is the same as calling its empty constructor.\n     *\n     * @param fragmentClass class of fragment.\n     * @param bundle        argument.\n     * @param <T>           subclass of {@link NoFragment}.\n     * @return new instance.\n     */\n    public final <T extends NoFragment> T fragment(Class<T> fragmentClass, Bundle bundle) {\n        //noinspection unchecked\n        return (T) instantiate(getContext(), fragmentClass.getName(), bundle);\n    }\n\n    /**\n     * Toolbar.\n     */\n    private Toolbar mToolbar;\n\n    /**\n     * CompatActivity.\n     */\n    private CompatActivity mActivity;\n\n    /**\n     * Get BaseActivity.\n     *\n     * @return {@link CompatActivity}.\n     */\n    protected final CompatActivity getCompatActivity() {\n        return mActivity;\n    }\n\n    /**\n     * Start activity.\n     *\n     * @param clazz class for activity.\n     * @param <T>   {@link Activity}.\n     */\n    protected final <T extends Activity> void startActivity(Class<T> clazz) {\n        startActivity(new Intent(mActivity, clazz));\n    }\n\n    /**\n     * Start activity and finish my parent.\n     *\n     * @param clazz class for activity.\n     * @param <T>   {@link Activity}.\n     */\n    protected final <T extends Activity> void startActivityFinish(Class<T> clazz) {\n        startActivity(new Intent(mActivity, clazz));\n        mActivity.finish();\n    }\n\n    @Override\n    public void onAttach(Context context) {\n        super.onAttach(context);\n        mActivity = (CompatActivity) context;\n    }\n\n    /**\n     * Destroy me.\n     */\n    public void finish() {\n        mActivity.onBackPressed();\n    }\n\n    /**\n     * Set Toolbar.\n     *\n     * @param toolbar {@link Toolbar}.\n     */\n    public final void setToolbar(@NonNull Toolbar toolbar) {\n        this.mToolbar = toolbar;\n        onCreateOptionsMenu(mToolbar.getMenu(), new SupportMenuInflater(mActivity));\n        mToolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {\n            @Override\n            public boolean onMenuItemClick(MenuItem item) {\n                return onOptionsItemSelected(item);\n            }\n        });\n    }\n\n    /**\n     * Display home up button.\n     *\n     * @param drawableId drawable id.\n     */\n    public final void displayHomeAsUpEnabled(@DrawableRes int drawableId) {\n        displayHomeAsUpEnabled(ContextCompat.getDrawable(mActivity, drawableId));\n    }\n\n    /**\n     * Display home up button.\n     *\n     * @param drawable {@link Drawable}.\n     */\n    public final void displayHomeAsUpEnabled(Drawable drawable) {\n        mToolbar.setNavigationIcon(drawable);\n        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {\n            @Override\n            public void onClick(View view) {\n                if (!onInterceptToolbarBack())\n                    finish();\n            }\n        });\n    }\n\n    /**\n     * Override this method, intercept backPressed of ToolBar.\n     *\n     * @return true, other wise false.\n     */\n    public boolean onInterceptToolbarBack() {\n        return false;\n    }\n\n    /**\n     * Get Toolbar.\n     *\n     * @return {@link Toolbar}.\n     */\n    protected final\n    @Nullable\n    Toolbar getToolbar() {\n        return mToolbar;\n    }\n\n    /**\n     * Set title.\n     *\n     * @param title title.\n     */\n    protected void setTitle(CharSequence title) {\n        if (mToolbar != null)\n            mToolbar.setTitle(title);\n    }\n\n    /**\n     * Set title.\n     *\n     * @param titleId string resource id from {@code string.xml}.\n     */\n    protected void setTitle(int titleId) {\n        if (mToolbar != null)\n            mToolbar.setTitle(titleId);\n    }\n\n    /**\n     * Set sub title.\n     *\n     * @param title sub title.\n     */\n    protected void setSubtitle(CharSequence title) {\n        if (mToolbar != null)\n            mToolbar.setSubtitle(title);\n    }\n\n    /**\n     * Set sub title.\n     *\n     * @param titleId string resource id from {@code string.xml}.\n     */\n    protected void setSubtitle(int titleId) {\n        if (mToolbar != null)\n            mToolbar.setSubtitle(titleId);\n    }\n\n    // ------------------------- Stack ------------------------- //\n\n    /**\n     * Stack info.\n     */\n    private CompatActivity.FragmentStackEntity mStackEntity;\n\n    /**\n     * Set result.\n     *\n     * @param resultCode result code, one of {@link NoFragment#RESULT_OK}, {@link NoFragment#RESULT_CANCELED}.\n     */\n    protected final void setResult(@ResultCode int resultCode) {\n        mStackEntity.resultCode = resultCode;\n    }\n\n    /**\n     * Set result.\n     *\n     * @param resultCode resultCode, use {@link }.\n     * @param result     {@link Bundle}.\n     */\n    protected final void setResult(@ResultCode int resultCode, @NonNull Bundle result) {\n        mStackEntity.resultCode = resultCode;\n        mStackEntity.result = result;\n    }\n\n    /**\n     * Get the resultCode for requestCode.\n     */\n    final void setStackEntity(@NonNull CompatActivity.FragmentStackEntity stackEntity) {\n        this.mStackEntity = stackEntity;\n    }\n\n    /**\n     * You should override it.\n     *\n     * @param resultCode resultCode.\n     * @param result     {@link Bundle}.\n     */\n    public void onFragmentResult(int requestCode, @ResultCode int resultCode, @Nullable Bundle result) {\n    }\n\n    /**\n     * Show a fragment.\n     *\n     * @param clazz fragment class.\n     * @param <T>   {@link NoFragment}.\n     */\n    public final <T extends NoFragment> void startFragment(Class<T> clazz) {\n        try {\n            NoFragment targetFragment = clazz.newInstance();\n            startFragment(targetFragment, true, REQUEST_CODE_INVALID);\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n    }\n\n    /**\n     * Show a fragment.\n     *\n     * @param clazz       fragment class.\n     * @param stickyStack sticky to back stack.\n     * @param <T>         {@link NoFragment}.\n     */\n    public final <T extends NoFragment> void startFragment(Class<T> clazz, boolean stickyStack) {\n        try {\n            NoFragment targetFragment = clazz.newInstance();\n            startFragment(targetFragment, stickyStack, REQUEST_CODE_INVALID);\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n    }\n\n    /**\n     * Show a fragment.\n     *\n     * @param targetFragment fragment to display.\n     * @param <T>            {@link NoFragment}.\n     */\n    public final <T extends NoFragment> void startFragment(T targetFragment) {\n        startFragment(targetFragment, true, REQUEST_CODE_INVALID);\n    }\n\n    /**\n     * Show a fragment.\n     *\n     * @param targetFragment fragment to display.\n     * @param stickyStack    sticky back stack.\n     * @param <T>            {@link NoFragment}.\n     */\n    public final <T extends NoFragment> void startFragment(T targetFragment, boolean stickyStack) {\n        startFragment(targetFragment, stickyStack, REQUEST_CODE_INVALID);\n    }\n\n    /**\n     * Show a fragment for result.\n     *\n     * @param clazz       fragment to display.\n     * @param requestCode requestCode.\n     * @param <T>         {@link NoFragment}.\n     * @deprecated use {@link #startFragmentForResult(Class, int)} instead.\n     */\n    @Deprecated\n    public final <T extends NoFragment> void startFragmentForResquest(Class<T> clazz, int requestCode) {\n        startFragmentForResult(clazz, requestCode);\n    }\n\n    /**\n     * Show a fragment for result.\n     *\n     * @param targetFragment fragment to display.\n     * @param requestCode    requestCode.\n     * @param <T>            {@link NoFragment}.\n     * @deprecated use {@link #startFragmentForResult(Class, int)} instead.\n     */\n    @Deprecated\n    public final <T extends NoFragment> void startFragmentForResquest(T targetFragment, int requestCode) {\n        startFragmentForResult(targetFragment, requestCode);\n    }\n\n    /**\n     * Show a fragment for result.\n     *\n     * @param clazz       fragment to display.\n     * @param requestCode requestCode.\n     * @param <T>         {@link NoFragment}.\n     */\n    public final <T extends NoFragment> void startFragmentForResult(Class<T> clazz, int requestCode) {\n        try {\n            NoFragment targetFragment = clazz.newInstance();\n            startFragment(targetFragment, true, requestCode);\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n    }\n\n    /**\n     * Show a fragment for result.\n     *\n     * @param targetFragment fragment to display.\n     * @param requestCode    requestCode.\n     * @param <T>            {@link NoFragment}.\n     */\n    public final <T extends NoFragment> void startFragmentForResult(T targetFragment, int requestCode) {\n        startFragment(targetFragment, true, requestCode);\n    }\n\n    /**\n     * Show a fragment.\n     *\n     * @param targetFragment fragment to display.\n     * @param stickyStack    sticky back stack.\n     * @param requestCode    requestCode.\n     * @param <T>            {@link NoFragment}.\n     */\n    private <T extends NoFragment> void startFragment(T targetFragment, boolean stickyStack, int requestCode) {\n        mActivity.startFragment(this, targetFragment, stickyStack, requestCode);\n    }\n\n}\n"
  },
  {
    "path": "fragment/src/main/java/com/yanzhenjie/fragment/ResultCode.java",
    "content": "/*\n * Copyright © Yan Zhenjie. All Rights Reserved\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 */\npackage com.yanzhenjie.fragment;\n\nimport android.support.annotation.IntDef;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\n\n/**\n * Created by Yan Zhenjie on 2017/1/15.\n */\n@IntDef({NoFragment.RESULT_OK, NoFragment.RESULT_CANCELED})\n@Retention(RetentionPolicy.SOURCE)\npublic @interface ResultCode {\n}\n"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "#Fri Apr 21 14:20:40 CST 2017\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-3.3-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.\norg.gradle.jvmargs=-Xmx1536m\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\n"
  },
  {
    "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": "sample/build.gradle",
    "content": "apply plugin: rootProject.ext.plugins.application\n\nandroid {\n    compileSdkVersion rootProject.ext.android.compileSdkVersion\n    buildToolsVersion rootProject.ext.android.buildToolsVersion\n\n    defaultConfig {\n        applicationId rootProject.ext.android.applicationId\n        minSdkVersion rootProject.ext.android.minSdkVersion\n        targetSdkVersion rootProject.ext.android.targetSdkVersion\n        versionCode rootProject.ext.android.versionCode\n        versionName rootProject.ext.android.versionName\n\n        compileOptions {\n            sourceCompatibility JavaVersion.VERSION_1_8\n            targetCompatibility JavaVersion.VERSION_1_8\n        }\n\n        jackOptions {\n            enabled true\n        }\n    }\n}\n\ndependencies {\n    compile rootProject.ext.dependencies.design\n    compile rootProject.ext.dependencies.fragment\n    compile rootProject.ext.dependencies.alertdialog\n}\n"
  },
  {
    "path": "sample/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.yanzhenjie.fragment.sample\">\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:launchMode=\"standard\"\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    </application>\n\n</manifest>"
  },
  {
    "path": "sample/src/main/java/com/yanzhenjie/fragment/sample/MainActivity.java",
    "content": "/*\n * Copyright © Yan Zhenjie. All Rights Reserved\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 */\npackage com.yanzhenjie.fragment.sample;\n\nimport android.os.Bundle;\n\nimport com.yanzhenjie.fragment.CompatActivity;\nimport com.yanzhenjie.fragment.sample.fragment.MainFragment;\n\n\n/**\n * Created by Yan Zhenjie on 2017/1/15.\n */\npublic class MainActivity extends CompatActivity {\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n\n        /*\n         * 继承CompatActivity后，显示一个fragment就这么简单，不要怀疑自己的眼睛，这是真的。\n         */\n        startFragment(MainFragment.class);\n    }\n\n    @Override\n    protected int fragmentLayoutId() {\n        return R.id.fragment_root;\n    }\n\n}\n"
  },
  {
    "path": "sample/src/main/java/com/yanzhenjie/fragment/sample/adapter/RecyclerAdapter.java",
    "content": "/*\n * Copyright © Yan Zhenjie. All Rights Reserved\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 */\npackage com.yanzhenjie.fragment.sample.adapter;\n\nimport android.content.Context;\nimport android.support.v7.widget.RecyclerView;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\n\nimport com.yanzhenjie.fragment.sample.R;\n\n/**\n * Created by Yan Zhenjie on 2017/1/15.\n */\npublic class RecyclerAdapter extends RecyclerView.Adapter<RecyclerAdapter.ItemViewHolder> {\n\n    private LayoutInflater mLayoutInflater;\n    private int itemCount;\n\n    public RecyclerAdapter(Context context, int itemCount) {\n        mLayoutInflater = LayoutInflater.from(context);\n        this.itemCount = itemCount;\n    }\n\n    @Override\n    public ItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {\n        return new ItemViewHolder(mLayoutInflater.inflate(R.layout.item, parent, false));\n    }\n\n    @Override\n    public void onBindViewHolder(ItemViewHolder holder, int position) {\n    }\n\n    @Override\n    public int getItemCount() {\n        return itemCount;\n    }\n\n    static class ItemViewHolder extends RecyclerView.ViewHolder {\n\n        public ItemViewHolder(View itemView) {\n            super(itemView);\n        }\n    }\n\n}\n"
  },
  {
    "path": "sample/src/main/java/com/yanzhenjie/fragment/sample/fragment/ArgumentFragment.java",
    "content": "/*\n * Copyright © Yan Zhenjie. All Rights Reserved\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 */\npackage com.yanzhenjie.fragment.sample.fragment;\n\nimport android.os.Bundle;\nimport android.support.annotation.Nullable;\nimport android.support.v7.widget.Toolbar;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.TextView;\n\nimport com.yanzhenjie.fragment.NoFragment;\nimport com.yanzhenjie.fragment.sample.R;\n\n/**\n * Created by Yan Zhenjie on 2017/1/15.\n */\npublic class ArgumentFragment extends NoFragment {\n\n    private Toolbar mToolbar;\n    private TextView mTvMessage;\n\n    @Nullable\n    @Override\n    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {\n        return inflater.inflate(R.layout.fragment_argument, container, false);\n    }\n\n    @Override\n    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {\n        mToolbar = (Toolbar) view.findViewById(R.id.toolbar);\n        mTvMessage = (TextView) view.findViewById(R.id.tv_message);\n    }\n\n    @Override\n    public void onActivityCreated(@Nullable Bundle savedInstanceState) {\n        super.onActivityCreated(savedInstanceState);\n\n        setToolbar(mToolbar);\n        setTitle(R.string.title_fragment_argument);\n        displayHomeAsUpEnabled(R.drawable.ic_close_white);\n\n        Bundle bundle = getArguments();\n        String message = bundle.getString(\"hehe\") + \"\\r\\n\";\n        message += bundle.getString(\"meng\") + \"\\r\\n\";\n        message += bundle.getString(\"bang\") + \"\\r\\n\";\n        message += bundle.getString(\"meme\") + \"\\r\\n\";\n\n        mTvMessage.setText(message);\n    }\n}\n"
  },
  {
    "path": "sample/src/main/java/com/yanzhenjie/fragment/sample/fragment/MainFragment.java",
    "content": "/*\n * Copyright © Yan Zhenjie. All Rights Reserved\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 */\npackage com.yanzhenjie.fragment.sample.fragment;\n\nimport android.os.Bundle;\nimport android.support.annotation.Nullable;\nimport android.support.design.widget.Snackbar;\nimport android.support.v7.widget.Toolbar;\nimport android.view.LayoutInflater;\nimport android.view.Menu;\nimport android.view.MenuInflater;\nimport android.view.MenuItem;\nimport android.view.View;\nimport android.view.ViewGroup;\n\nimport com.yanzhenjie.alertdialog.AlertDialog;\nimport com.yanzhenjie.fragment.NoFragment;\nimport com.yanzhenjie.fragment.sample.R;\n\n/**\n * Created by Yan Zhenjie on 2017/1/15.\n */\npublic class MainFragment extends NoFragment implements View.OnClickListener {\n\n    private Toolbar mToolbar;\n\n    @Nullable\n    @Override\n    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {\n        return inflater.inflate(R.layout.fragment_main, container, false);\n    }\n\n    @Override\n    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {\n        mToolbar = (Toolbar) view.findViewById(R.id.toolbar);\n        view.findViewById(R.id.btn_menu_more).setOnClickListener(this);\n        view.findViewById(R.id.btn_argument).setOnClickListener(this);\n        view.findViewById(R.id.btn_for_result).setOnClickListener(this);\n        view.findViewById(R.id.btn_stack).setOnClickListener(this);\n    }\n\n    @Override\n    public void onActivityCreated(@Nullable Bundle savedInstanceState) {\n        super.onActivityCreated(savedInstanceState);\n\n        // First must set toolbar, will invoke: onCreateOptionsMenu();\n        setToolbar(mToolbar);\n\n        // Set title for toolbar:\n        setTitle(R.string.title_fragment_main);\n\n        // Display close button.\n        displayHomeAsUpEnabled(R.drawable.ic_close_white);\n    }\n\n    @Override\n    public void onClick(View v) {\n        int id = v.getId();\n        switch (id) {\n            case R.id.btn_menu_more: {\n                startFragment(MoreMenuFragment.class);\n                break;\n            }\n            case R.id.btn_for_result: {\n                startFragmentForResquest(StartResultFragment.class, 100);\n                break;\n            }\n            case R.id.btn_argument: {\n                Bundle bundle = new Bundle();\n                bundle.putString(\"hehe\", \"呵呵哒\");\n                bundle.putString(\"meng\", \"萌萌哒\");\n                bundle.putString(\"bang\", \"棒棒哒\");\n                bundle.putString(\"meme\", \"么么哒\");\n\n                // Create fragment_menu for bundle.\n                NoFragment fragment = fragment(ArgumentFragment.class, bundle);\n\n                startFragment(fragment);\n                break;\n            }\n            case R.id.btn_stack: {\n                // Second argument false: don't join the back stack.\n                startFragment(StackFragment.class, false);\n                break;\n            }\n        }\n    }\n\n    @Override\n    public void onFragmentResult(int requestCode, int resultCode, @Nullable Bundle result) {\n        switch (requestCode) {\n            case 100: {\n                if (resultCode == RESULT_OK) {\n                    String message = result.getString(\"message\");\n                    AlertDialog.build(getContext())\n                            .setCancelable(true)\n                            .setTitle(R.string.result)\n                            .setMessage(message)\n                            .setPositiveButton(R.string.ok, (dialog, which) -> {\n                                // TODO nothing.\n                            })\n                            .show();\n                } else if (resultCode == RESULT_CANCELED) {\n                    Snackbar.make(mToolbar, R.string.message_canceled, Snackbar.LENGTH_SHORT).show();\n                }\n                break;\n            }\n        }\n    }\n\n    // ========================= Menu Sample ========================= //\n\n    @Override\n    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n        // Load your menu.\n        inflater.inflate(R.menu.menu_fragment_main, menu);\n    }\n\n    @Override\n    public boolean onOptionsItemSelected(MenuItem item) {\n        // Handle menu item click.\n        int id = item.getItemId();\n        switch (id) {\n            case R.id.action_settings: {\n                Snackbar.make(mToolbar, R.string.action_settings, Snackbar.LENGTH_SHORT).show();\n                break;\n            }\n            case R.id.action_exit: {\n                Snackbar.make(mToolbar, R.string.action_exit, Snackbar.LENGTH_SHORT).show();\n                break;\n            }\n        }\n        return true;\n    }\n\n    // ========================= Close Button ========================= //\n\n    @Override\n    public boolean onInterceptToolbarBack() {\n        // Intercept close button click event.\n        Snackbar.make(mToolbar, R.string.intercept_close, Snackbar.LENGTH_SHORT).show();\n        return true;\n    }\n}\n"
  },
  {
    "path": "sample/src/main/java/com/yanzhenjie/fragment/sample/fragment/MoreMenuFragment.java",
    "content": "/*\n * Copyright © Yan Zhenjie. All Rights Reserved\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 */\npackage com.yanzhenjie.fragment.sample.fragment;\n\nimport android.os.Bundle;\nimport android.support.annotation.Nullable;\nimport android.support.design.widget.Snackbar;\nimport android.support.v7.widget.LinearLayoutManager;\nimport android.support.v7.widget.RecyclerView;\nimport android.support.v7.widget.Toolbar;\nimport android.view.LayoutInflater;\nimport android.view.Menu;\nimport android.view.MenuInflater;\nimport android.view.MenuItem;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.Toast;\n\nimport com.yanzhenjie.fragment.NoFragment;\nimport com.yanzhenjie.fragment.sample.R;\nimport com.yanzhenjie.fragment.sample.adapter.RecyclerAdapter;\n\n/**\n * Created by Yan Zhenjie on 2017/1/15.\n */\npublic class MoreMenuFragment extends NoFragment {\n\n    private Toolbar mToolbar;\n    private RecyclerView mRecyclerView;\n\n    @Nullable\n    @Override\n    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {\n        return inflater.inflate(R.layout.fragment_menu, container, false);\n    }\n\n    @Override\n    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {\n        mToolbar = (Toolbar) view.findViewById(R.id.toolbar);\n        mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);\n    }\n\n    @Override\n    public void onActivityCreated(@Nullable Bundle savedInstanceState) {\n        super.onActivityCreated(savedInstanceState);\n\n        // First must set toolbar, will invoke: onCreateOptionsMenu();\n        setToolbar(mToolbar);\n\n        // Set title for toolbar:\n        setTitle(R.string.title_fragment_setting);\n\n        // Display close button.\n        displayHomeAsUpEnabled(R.drawable.ic_back_white);\n\n        mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));\n        mRecyclerView.setAdapter(new RecyclerAdapter(getContext(), 100));\n    }\n\n    @Override\n    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {\n        // Load your menu.\n        inflater.inflate(R.menu.menu_fragment_setting, menu);\n    }\n\n    @Override\n    public boolean onOptionsItemSelected(MenuItem item) {\n        // Handle menu item click.\n        int id = item.getItemId();\n        switch (id) {\n            case R.id.action_add_friend: {\n                Snackbar.make(mRecyclerView, R.string.action_add_friend, Snackbar.LENGTH_SHORT).show();\n                break;\n            }\n            case R.id.action_satisfied: {\n                Snackbar.make(mRecyclerView, R.string.action_satisfied, Snackbar.LENGTH_SHORT).show();\n                break;\n            }\n            case R.id.action_dissatisfied: {\n                Snackbar.make(mRecyclerView, R.string.action_dissatisfied, Snackbar.LENGTH_SHORT).show();\n                break;\n            }\n            case R.id.action_neutral: {\n                Snackbar.make(mRecyclerView, R.string.action_neutral, Snackbar.LENGTH_SHORT).show();\n                break;\n            }\n\n        }\n        return true;\n    }\n\n    @Override\n    public boolean onInterceptToolbarBack() {\n        Toast.makeText(getContext(), R.string.no_intercept_close, Toast.LENGTH_SHORT).show();\n        return false;\n    }\n\n}\n"
  },
  {
    "path": "sample/src/main/java/com/yanzhenjie/fragment/sample/fragment/StackFragment.java",
    "content": "/*\n * Copyright © Yan Zhenjie. All Rights Reserved\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 */\npackage com.yanzhenjie.fragment.sample.fragment;\n\nimport android.os.Bundle;\nimport android.support.annotation.Nullable;\nimport android.support.v7.widget.Toolbar;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.Button;\n\nimport com.yanzhenjie.fragment.NoFragment;\nimport com.yanzhenjie.fragment.sample.R;\n\n/**\n * Created by Yan Zhenjie on 2017/1/15.\n */\npublic class StackFragment extends NoFragment {\n\n    private Toolbar mToolbar;\n    private Button mBtnGo;\n\n    @Nullable\n    @Override\n    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {\n        return inflater.inflate(R.layout.fragment_stack, container, false);\n    }\n\n    @Override\n    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {\n        mToolbar = (Toolbar) view.findViewById(R.id.toolbar);\n        mBtnGo = (Button) view.findViewById(R.id.btn_go);\n    }\n\n    @Override\n    public void onActivityCreated(@Nullable Bundle savedInstanceState) {\n        super.onActivityCreated(savedInstanceState);\n\n        setToolbar(mToolbar);\n        setTitle(R.string.title_fragment_stack);\n        displayHomeAsUpEnabled(R.drawable.ic_back_white);\n\n        mBtnGo.setOnClickListener(v -> startFragment(StackNewFragment.class));\n    }\n}\n"
  },
  {
    "path": "sample/src/main/java/com/yanzhenjie/fragment/sample/fragment/StackNewFragment.java",
    "content": "/*\n * Copyright © Yan Zhenjie. All Rights Reserved\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 */\npackage com.yanzhenjie.fragment.sample.fragment;\n\nimport android.os.Bundle;\nimport android.support.annotation.Nullable;\nimport android.support.v7.widget.Toolbar;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.Button;\n\nimport com.yanzhenjie.fragment.NoFragment;\nimport com.yanzhenjie.fragment.sample.R;\n\n/**\n * Created by Yan Zhenjie on 2017/1/15.\n */\npublic class StackNewFragment extends NoFragment {\n\n    private Toolbar mToolbar;\n    private Button mBtnBack;\n\n    @Nullable\n    @Override\n    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {\n        return inflater.inflate(R.layout.fragment_stack_new, container, false);\n    }\n\n    @Override\n    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {\n        mToolbar = (Toolbar) view.findViewById(R.id.toolbar);\n        mBtnBack = (Button) view.findViewById(R.id.btn_back);\n    }\n\n    @Override\n    public void onActivityCreated(@Nullable Bundle savedInstanceState) {\n        super.onActivityCreated(savedInstanceState);\n\n        setToolbar(mToolbar);\n        setTitle(R.string.title_fragment_stack_new);\n        displayHomeAsUpEnabled(R.drawable.ic_back_white);\n\n        mBtnBack.setOnClickListener(v -> finish());\n    }\n\n}\n"
  },
  {
    "path": "sample/src/main/java/com/yanzhenjie/fragment/sample/fragment/StartResultFragment.java",
    "content": "/*\n * Copyright © Yan Zhenjie. All Rights Reserved\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 */\npackage com.yanzhenjie.fragment.sample.fragment;\n\nimport android.os.Bundle;\nimport android.support.annotation.Nullable;\nimport android.support.v7.widget.Toolbar;\nimport android.text.TextUtils;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.Button;\nimport android.widget.EditText;\n\nimport com.yanzhenjie.fragment.NoFragment;\nimport com.yanzhenjie.fragment.sample.R;\n\n/**\n * Created by Yan Zhenjie on 2017/1/15.\n */\npublic class StartResultFragment extends NoFragment {\n\n    private Toolbar mToolbar;\n    private EditText mEditText;\n    private Button mBtnBack;\n\n    @Nullable\n    @Override\n    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {\n        return inflater.inflate(R.layout.fragment_result, container, false);\n    }\n\n    @Override\n    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {\n        mToolbar = (Toolbar) view.findViewById(R.id.toolbar);\n        mEditText = (EditText) view.findViewById(R.id.edit);\n        mBtnBack = (Button) view.findViewById(R.id.btn_back);\n    }\n\n    @Override\n    public void onActivityCreated(@Nullable Bundle savedInstanceState) {\n        super.onActivityCreated(savedInstanceState);\n\n        setToolbar(mToolbar);\n\n        displayHomeAsUpEnabled(R.drawable.ic_back_white);\n        setTitle(R.string.title_fragment_result);\n\n        mBtnBack.setOnClickListener(v -> {\n            String result = mEditText.getText().toString();\n            if (TextUtils.isEmpty(result)) {\n                result = getString(R.string.message_null);\n            }\n            Bundle bundle = new Bundle();\n            bundle.putString(\"message\", result);\n            setResult(RESULT_OK, bundle);\n            finish();\n        });\n    }\n}\n"
  },
  {
    "path": "sample/src/main/res/layout/activity_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<FrameLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:id=\"@+id/fragment_root\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"/>\n"
  },
  {
    "path": "sample/src/main/res/layout/fragment_argument.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    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:fitsSystemWindows=\"true\">\n\n    <android.support.design.widget.AppBarLayout\n        android:id=\"@+id/appbar_layout\"\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=\"?actionBarSize\"\n            android:background=\"?attr/colorPrimary\"\n            app:layout_scrollFlags=\"scroll|enterAlways|snap\"\n            app:popupTheme=\"@style/AppTheme.PopupOverlay\"/>\n\n    </android.support.design.widget.AppBarLayout>\n\n    <LinearLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:padding=\"@dimen/dp_10\"\n        app:layout_behavior=\"@string/appbar_scrolling_view_behavior\">\n\n        <TextView\n            android:id=\"@+id/tv_message\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"/>\n    </LinearLayout>\n\n</android.support.design.widget.CoordinatorLayout>"
  },
  {
    "path": "sample/src/main/res/layout/fragment_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    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:fitsSystemWindows=\"true\">\n\n    <android.support.design.widget.AppBarLayout\n        android:id=\"@+id/appbar_layout\"\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=\"?actionBarSize\"\n            android:background=\"?attr/colorPrimary\"\n            app:popupTheme=\"@style/AppTheme.PopupOverlay\"/>\n\n    </android.support.design.widget.AppBarLayout>\n\n    <LinearLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:orientation=\"vertical\"\n        app:layout_behavior=\"@string/appbar_scrolling_view_behavior\">\n\n        <Button\n            android:id=\"@+id/btn_menu_more\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/button_menu_more\"/>\n\n        <Button\n            android:id=\"@+id/btn_argument\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/button_argument\"/>\n\n        <Button\n            android:id=\"@+id/btn_for_result\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/button_for_result\"\n            android:textAllCaps=\"false\"/>\n\n        <Button\n            android:id=\"@+id/btn_stack\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/button_stack\"/>\n\n    </LinearLayout>\n\n</android.support.design.widget.CoordinatorLayout>"
  },
  {
    "path": "sample/src/main/res/layout/fragment_menu.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    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:fitsSystemWindows=\"true\">\n\n    <android.support.design.widget.AppBarLayout\n        android:id=\"@+id/appbar_layout\"\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=\"?actionBarSize\"\n            android:background=\"?attr/colorPrimary\"\n            app:layout_scrollFlags=\"scroll|enterAlways|snap\"\n            app:popupTheme=\"@style/AppTheme.PopupOverlay\"/>\n\n    </android.support.design.widget.AppBarLayout>\n\n    <android.support.v7.widget.RecyclerView\n        android:id=\"@+id/recycler_view\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:layout_margin=\"@dimen/dp_25\"\n        app:layout_behavior=\"@string/appbar_scrolling_view_behavior\"/>\n\n</android.support.design.widget.CoordinatorLayout>"
  },
  {
    "path": "sample/src/main/res/layout/fragment_result.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    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:fitsSystemWindows=\"true\">\n\n    <android.support.design.widget.AppBarLayout\n        android:id=\"@+id/appbar_layout\"\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=\"?actionBarSize\"\n            android:background=\"?attr/colorPrimary\"\n            app:layout_scrollFlags=\"scroll|enterAlways|snap\"\n            app:popupTheme=\"@style/AppTheme.PopupOverlay\"/>\n\n    </android.support.design.widget.AppBarLayout>\n\n    <LinearLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:orientation=\"vertical\"\n        android:padding=\"@dimen/dp_10\"\n        app:layout_behavior=\"@string/appbar_scrolling_view_behavior\">\n\n        <android.support.design.widget.TextInputLayout\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\">\n\n            <android.support.design.widget.TextInputEditText\n                android:id=\"@+id/edit\"\n                android:layout_width=\"match_parent\"\n                android:layout_height=\"wrap_content\"\n                android:hint=\"@string/hint_input\"/>\n\n        </android.support.design.widget.TextInputLayout>\n\n        <Button\n            android:id=\"@+id/btn_back\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/button_back\"/>\n\n    </LinearLayout>\n\n</android.support.design.widget.CoordinatorLayout>"
  },
  {
    "path": "sample/src/main/res/layout/fragment_stack.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    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:fitsSystemWindows=\"true\">\n\n    <android.support.design.widget.AppBarLayout\n        android:id=\"@+id/appbar_layout\"\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=\"?actionBarSize\"\n            android:background=\"?attr/colorPrimary\"\n            app:layout_scrollFlags=\"scroll|enterAlways|snap\"\n            app:popupTheme=\"@style/AppTheme.PopupOverlay\"/>\n\n    </android.support.design.widget.AppBarLayout>\n\n    <LinearLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:orientation=\"vertical\"\n        android:padding=\"@dimen/dp_10\"\n        app:layout_behavior=\"@string/appbar_scrolling_view_behavior\">\n\n        <Button\n            android:id=\"@+id/btn_go\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/button_stack_new\"\n            android:textAllCaps=\"false\"/>\n\n        <TextView\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_marginTop=\"@dimen/dp_10\"\n            android:text=\"@string/hint_back_stack\"\n            android:textSize=\"@dimen/sp_16\"/>\n    </LinearLayout>\n\n</android.support.design.widget.CoordinatorLayout>"
  },
  {
    "path": "sample/src/main/res/layout/fragment_stack_new.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    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:fitsSystemWindows=\"true\">\n\n    <android.support.design.widget.AppBarLayout\n        android:id=\"@+id/appbar_layout\"\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=\"?actionBarSize\"\n            android:background=\"?attr/colorPrimary\"\n            app:layout_scrollFlags=\"scroll|enterAlways|snap\"\n            app:popupTheme=\"@style/AppTheme.PopupOverlay\"/>\n\n    </android.support.design.widget.AppBarLayout>\n\n    <LinearLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:orientation=\"vertical\"\n        android:padding=\"@dimen/dp_10\"\n        app:layout_behavior=\"@string/appbar_scrolling_view_behavior\">\n\n        <Button\n            android:id=\"@+id/btn_back\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/button_back\"/>\n\n        <TextView\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_marginTop=\"@dimen/dp_10\"\n            android:text=\"@string/hint_back_stack_new\"\n            android:textSize=\"@dimen/sp_16\"/>\n    </LinearLayout>\n\n</android.support.design.widget.CoordinatorLayout>"
  },
  {
    "path": "sample/src/main/res/layout/item.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:background=\"?selectableItemBackground\"\n    android:orientation=\"vertical\"\n    android:padding=\"@dimen/dp_10\">\n\n    <TextView\n        android:id=\"@+id/tv_title\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"@string/item_title\"/>\n\n    <TextView\n        android:id=\"@+id/tv_content\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_marginTop=\"@dimen/dp_10\"\n        android:text=\"@string/item_content\"/>\n\n</LinearLayout>"
  },
  {
    "path": "sample/src/main/res/menu/menu_fragment_main.xml",
    "content": "<menu\n    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:icon=\"@drawable/ic_settings_white\"\n        android:orderInCategory=\"100\"\n        android:title=\"@string/action_settings\"\n        app:showAsAction=\"always|withText\"/>\n    <item\n        android:id=\"@+id/action_exit\"\n        android:orderInCategory=\"100\"\n        android:title=\"@string/action_exit\"\n        app:showAsAction=\"always|withText\"/>\n</menu>\n"
  },
  {
    "path": "sample/src/main/res/menu/menu_fragment_setting.xml",
    "content": "<menu\n    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_add_friend\"\n        android:icon=\"@drawable/ic_person_add_white\"\n        android:orderInCategory=\"100\"\n        android:title=\"@string/action_add_friend\"\n        app:showAsAction=\"always|withText\"/>\n    <item\n        android:icon=\"@drawable/ic_more_white\"\n        android:orderInCategory=\"100\"\n        android:title=\"@string/action_mood\"\n        app:showAsAction=\"always|withText\">\n        <menu>\n            <item\n                android:id=\"@+id/action_satisfied\"\n                android:icon=\"@drawable/ic_sentiment_satisfied_black\"\n                android:orderInCategory=\"100\"\n                android:title=\"@string/action_satisfied\"\n                app:showAsAction=\"always|withText\"/>\n            <item\n                android:id=\"@+id/action_dissatisfied\"\n                android:icon=\"@drawable/ic_sentiment_dissatisfied_black\"\n                android:orderInCategory=\"100\"\n                android:title=\"@string/action_dissatisfied\"\n                app:showAsAction=\"always|withText\"/>\n            <item\n                android:id=\"@+id/action_neutral\"\n                android:icon=\"@drawable/ic_sentiment_neutral_black\"\n                android:orderInCategory=\"100\"\n                android:title=\"@string/action_neutral\"\n                app:showAsAction=\"always|withText\"/>\n        </menu>\n    </item>\n</menu>\n"
  },
  {
    "path": "sample/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</resources>\n"
  },
  {
    "path": "sample/src/main/res/values/dimens.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <dimen name=\"dp_10\">10dp</dimen>\n    <dimen name=\"dp_15\">10dp</dimen>\n    <dimen name=\"dp_20\">10dp</dimen>\n    <dimen name=\"dp_25\">10dp</dimen>\n    <dimen name=\"dp_30\">10dp</dimen>\n\n    <dimen name=\"sp_16\">16sp</dimen>\n    <dimen name=\"sp_18\">18sp</dimen>\n</resources>"
  },
  {
    "path": "sample/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">NoFragment</string>\n    <string name=\"ok\">好的</string>\n\n    <string name=\"title_fragment_main\">MainFragment</string>\n    <string name=\"button_menu_more\">溢出菜单</string>\n    <string name=\"button_argument\">传参数</string>\n    <string name=\"button_for_result\">StartFragmentForResult</string>\n    <string name=\"button_stack\">不保存回退栈</string>\n\n    <string name=\"item_title\">我是标题</string>\n    <string name=\"item_content\">我是内容</string>\n\n    <string name=\"intercept_close\">拦截关闭按钮点击事件</string>\n    <string name=\"action_settings\">设置</string>\n    <string name=\"action_exit\">退出</string>\n\n    <string name=\"title_fragment_setting\">MoreMenuFragment</string>\n    <string name=\"no_intercept_close\">不拦截关闭</string>\n    <string name=\"action_add_friend\">添加</string>\n    <string name=\"action_mood\">心情</string>\n    <string name=\"action_satisfied\">开心</string>\n    <string name=\"action_dissatisfied\">难过</string>\n    <string name=\"action_neutral\">一般</string>\n\n    <string name=\"title_fragment_argument\">ArgumentFragment</string>\n\n    <string name=\"title_fragment_result\">StartResultFragment</string>\n    <string name=\"result\">结果</string>\n    <string name=\"hint_input\">返回数据</string>\n    <string name=\"button_back\">返回</string>\n    <string name=\"message_canceled\">取消了操作</string>\n    <string name=\"message_null\">您没有填写返回内容</string>\n\n    <string name=\"title_fragment_stack\">StackFragment</string>\n    <string name=\"button_stack_new\">打开新的Fragment</string>\n    <string name=\"hint_back_stack\">等下返回的时候看不到我了就。</string>\n\n    <string name=\"title_fragment_stack_new\">StackNewFragment</string>\n    <string name=\"hint_back_stack_new\">返回的时候看不到调用我的页面。</string>\n\n</resources>\n"
  },
  {
    "path": "sample/src/main/res/values/styles.xml",
    "content": "<resources>\n\n    <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar\">\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": "settings.gradle",
    "content": "include ':sample', ':fragment'\n"
  }
]