[
  {
    "path": ".gitignore",
    "content": "*.iml\n.gradle\n/local.properties\n.idea\n.DS_Store\n/build\n/captures\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 {yyyy} {name of copyright owner}\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "# AndroidWeekly\n\n一个第三方 androidweekly.net 的客户端，主要用 jsoup 抓取了 androidweekly.net 的数据进行展示，很适合在空暇时间阅读浏览。\n\n## 目前实现的功能\n\n1. 文章列表\n2. 文章页面\n3. 收藏文章\n4. 调整文章字体大小\n5. 文章页面内建词典\n6. 文章分享\n7. 已读文章全文搜索\n8. 收藏导入导出\n\n欢迎提 pull request 或 issue 添加新功能，修 bug.\n\n## 下载\n\n[https://github.com/mzule/AndroidWeekly/releases](https://github.com/mzule/AndroidWeekly/releases)\n\n## 运行效果\n\n![](https://raw.githubusercontent.com/mzule/AndroidWeekly/master/art/translation.gif)\n![](https://raw.githubusercontent.com/mzule/AndroidWeekly/master/art/home.jpg)\n![](https://raw.githubusercontent.com/mzule/AndroidWeekly/master/art/favorite.jpg)\n![](https://raw.githubusercontent.com/mzule/AndroidWeekly/master/art/issue.jpg)\n![](https://raw.githubusercontent.com/mzule/AndroidWeekly/master/art/article.jpg)\n![](https://raw.githubusercontent.com/mzule/AndroidWeekly/master/art/search.jpg)\n\n## 感谢\n\n本项目用了部分开源项目，在此感谢。\n\n* [ButterKnife](https://github.com/JakeWharton/butterknife)\n* [EasyAdapter](https://github.com/mzule/EasyAdapter)\n* [glide](https://github.com/bumptech/glide)\n* [gson](https://github.com/google/gson)\n* [jsoup](http://jsoup.org/)\n* [LayoutAnnotation](https://github.com/mzule/LayoutAnnotation)\n* [material-icon-lib](https://github.com/code-mc/material-icon-lib)\n* [materialish-progress](https://github.com/pnikosis/materialish-progress)\n* [Snowball](http://snowballstem.org/)\n\n## 许可\n\nApache License  2.0\n\n*不可发布到应用市场*\n\n## 联系我\n\n任何相关问题都可以通过以下方式联系我。\n\n1. 提 issue\n1. 新浪微博 [http://weibo.com/mzule](http://weibo.com/mzule)\n1. 个人博客 [http://caodongping.me](http://caodongping.me)\n1. 邮件 \"mzule\".concat(\"4j\").concat(\"@\").concat(\"gmail.com\")\n\n"
  },
  {
    "path": "app/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "app/build.gradle",
    "content": "apply plugin: 'com.android.application'\napply plugin: 'android-apt'\n\nandroid {\n    compileSdkVersion 23\n    buildToolsVersion \"23.0.2\"\n\n    defaultConfig {\n        applicationId \"com.github.mzule.androidweekly\"\n        minSdkVersion 15\n        targetSdkVersion 23\n        versionCode 1\n        versionName \"1.0.1\"\n    }\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n        }\n    }\n}\n\ndependencies {\n    compile fileTree(include: ['*.jar'], dir: 'libs')\n    testCompile 'junit:junit:4.12'\n    compile 'com.android.support:appcompat-v7:23.1.1'\n    compile 'com.github.mzule.easyadapter:easyadapter:1.1.1'\n    compile 'com.jakewharton:butterknife:7.0.1'\n    compile 'org.jsoup:jsoup:1.8.3'\n    compile 'com.github.bumptech.glide:glide:3.7.0'\n    compile 'com.google.code.gson:gson:2.5'\n    compile 'net.steamcrafted:materialiconlib:1.0.9'\n    compile 'com.pnikosis:materialish-progress:1.7'\n    compile project(':snowball')\n    compile 'com.github.mzule.layoutannotation:library:1.0.4'\n    apt 'com.github.mzule.layoutannotation:compiler:1.0.3'\n}\n"
  },
  {
    "path": "app/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /Users/baidu/Library/Android/sdk/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the proguardFiles\n# directive in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n"
  },
  {
    "path": "app/src/androidTest/java/com/github/mzule/androidweekly/ApplicationTest.java",
    "content": "package com.github.mzule.androidweekly;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCase;\n\n/**\n * <a href=\"http://d.android.com/tools/testing/testing_android.html\">Testing Fundamentals</a>\n */\npublic class ApplicationTest extends ApplicationTestCase<Application> {\n    public ApplicationTest() {\n        super(Application.class);\n    }\n}"
  },
  {
    "path": "app/src/main/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.github.mzule.androidweekly\">\n\n    <uses-permission android:name=\"android.permission.INTERNET\" />\n    <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />\n    <uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\" />\n\n    <application\n        android:name=\".App\"\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 android:name=\".ui.activity.MainActivity\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n\n                <category android:name=\"android.intent.category.LAUNCHER\" />\n            </intent-filter>\n        </activity>\n        <activity android:name=\".ui.activity.ArticleActivity\" />\n        <activity android:name=\".ui.activity.FavoriteActivity\" />\n        <activity android:name=\".ui.activity.AboutActivity\" />\n        <activity\n            android:name=\".ui.activity.SearchActivity\"\n            android:windowSoftInputMode=\"stateAlwaysVisible\" />\n        <activity android:name=\".ui.activity.SearchResultActivity\" />\n    </application>\n\n</manifest>\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/App.java",
    "content": "package com.github.mzule.androidweekly;\n\nimport android.app.Application;\n\n/**\n * Created by CaoDongping on 3/24/16.\n */\npublic class App extends Application {\n    private static App instance;\n\n    public static App getInstance() {\n        return instance;\n    }\n\n    @Override\n    public void onCreate() {\n        super.onCreate();\n        instance = this;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/api/ApiCallback.java",
    "content": "package com.github.mzule.androidweekly.api;\n\n/**\n * Created by CaoDongping on 3/24/16.\n */\npublic interface ApiCallback<T> {\n\n    void onSuccess(T data, boolean fromCache);\n\n    void onFailure(Exception e);\n\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/api/ArticleApi.java",
    "content": "package com.github.mzule.androidweekly.api;\n\n\nimport android.os.Handler;\nimport android.text.TextUtils;\n\nimport com.github.mzule.androidweekly.api.parser.ArticleParsers;\nimport com.github.mzule.androidweekly.dao.ArticleDao;\nimport com.github.mzule.androidweekly.dao.IssueListKeeper;\nimport com.github.mzule.androidweekly.entity.Article;\nimport com.github.mzule.androidweekly.entity.Issue;\n\nimport org.jsoup.Jsoup;\nimport org.jsoup.nodes.Document;\nimport org.jsoup.nodes.Element;\nimport org.jsoup.select.Elements;\n\nimport java.net.URL;\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * Created by mzule on 3/16/16.\n */\npublic class ArticleApi {\n    //TODO new thread to threadhandler\n    private Handler handler = new Handler();\n    private ArticleDao articleDao;\n\n    public ArticleApi() {\n        articleDao = new ArticleDao();\n    }\n\n    public void getPage(final String issue, final ApiCallback<List<Object>> callback) {\n        new Thread() {\n            @Override\n            public void run() {\n                try {\n                    if (!readCache()) {\n                        postSuccess(doGetPage(issue), callback);\n                    }\n                } catch (final Exception e) {\n                    postError(e, callback);\n                }\n\n            }\n\n            private boolean readCache() {\n                if (!TextUtils.isEmpty(issue)) {\n                    List<Article> articles = articleDao.read(issue);\n                    if (!articles.isEmpty()) {\n                        postSuccess(new Response<>(make(articles), true), callback);\n                        return true;\n                    }\n                }\n                return false;\n            }\n\n            private List<Object> make(List<Article> articles) {\n                List<Object> ret = new ArrayList<>();\n                for (Article article : articles) {\n                    if (!ret.contains(article.getSection())) {\n                        ret.add(article.getSection());\n                    }\n                    ret.add(article);\n                }\n                return ret;\n            }\n        }.start();\n    }\n\n    public void getArchive(final ApiCallback<List<Issue>> callback) {\n        new Thread() {\n            @Override\n            public void run() {\n                try {\n                    List<Issue> issues = IssueListKeeper.read();\n                    if (issues != null && !issues.isEmpty()) {\n                        postSuccess(new Response<>(issues, true), callback);\n                    }\n                    postSuccess(doGetArchive(), callback);\n                } catch (Exception e) {\n                    postError(e, callback);\n                }\n            }\n        }.start();\n    }\n\n    private Response<List<Issue>> doGetArchive() throws Exception {\n        Document doc = Jsoup.parse(new URL(\"http://androidweekly.net/archive\"), 30000);\n        Elements lis = doc.getElementsByClass(\"archive-list\").get(0).getElementsByTag(\"li\");\n        List<Issue> issues = new ArrayList<>();\n        for (Element li : lis) {\n            String date = li.getElementsByTag(\"span\").get(0).text();\n            String name = li.getElementsByTag(\"h3\").text().split(\"\\\\|\")[0];\n            String url = li.getElementsByTag(\"a\").attr(\"href\");\n            issues.add(new Issue(name, url, date));\n        }\n        IssueListKeeper.save(issues);\n        return new Response<>(issues, false);\n    }\n\n    private Response<List<Object>> doGetPage(String issue) throws Exception {\n        List<Object> result = ArticleParsers.get(issue).parse(issue);\n        for (Object obj : result) {\n            if (obj instanceof Article) {\n                articleDao.save((Article) obj);\n            }\n        }\n        return new Response<>(result, false);\n    }\n\n    private <T> void postSuccess(final Response<T> result, final ApiCallback<T> callback) {\n        handler.post(new Runnable() {\n            @Override\n            public void run() {\n                callback.onSuccess(result.data, result.fromCache);\n            }\n        });\n    }\n\n    private <T> void postError(final Exception e, final ApiCallback<T> callback) {\n        e.printStackTrace();\n        handler.post(new Runnable() {\n            @Override\n            public void run() {\n                callback.onFailure(e);\n            }\n        });\n    }\n\n    static class Response<T> {\n        public T data;\n        public boolean fromCache;\n\n        public Response(T data, boolean fromCache) {\n            this.data = data;\n            this.fromCache = fromCache;\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/api/DictionaryApi.java",
    "content": "package com.github.mzule.androidweekly.api;\n\nimport android.os.Handler;\n\nimport com.github.mzule.androidweekly.entity.Dict;\nimport com.github.mzule.androidweekly.util.DictParser;\n\nimport java.net.URLEncoder;\n\n/**\n * Created by CaoDongping on 3/31/16.\n */\npublic class DictionaryApi {\n    private Handler handler = new Handler();\n\n    public void look(String q, final ApiCallback<Dict> callback) {\n        final String url = \"http://dict-co.iciba.com/api/dictionary.php?w=\" + URLEncoder.encode(q) + \"&key=A3950A86AC38B86FCDEE6EAC68931C25&type=xml\";\n\n        new Thread(new Runnable() {\n            @Override\n            public void run() {\n                try {\n                    final Dict result = new DictParser(url).parse();\n                    handler.post(new Runnable() {\n                        @Override\n                        public void run() {\n                            callback.onSuccess(result, false);\n                        }\n                    });\n                } catch (final Exception e) {\n                    e.printStackTrace();\n                    handler.post(new Runnable() {\n                        @Override\n                        public void run() {\n                            callback.onFailure(e);\n                        }\n                    });\n                }\n            }\n        }).start();\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/api/parser/ArticleParser.java",
    "content": "package com.github.mzule.androidweekly.api.parser;\n\nimport java.io.IOException;\nimport java.util.List;\n\n/**\n * Created by CaoDongping on 4/15/16.\n */\npublic interface ArticleParser {\n    List<Object> parse(String issue) throws IOException;\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/api/parser/ArticleParsers.java",
    "content": "package com.github.mzule.androidweekly.api.parser;\n\nimport android.support.annotation.WorkerThread;\n\n/**\n * Created by CaoDongping on 4/15/16.\n */\npublic class ArticleParsers {\n    @WorkerThread\n    public static ArticleParser get(String issue) {\n        if (issue == null || Integer.parseInt(issue.split(\"-\")[1]) > 102) {\n            return new FresherArticlesParser();\n        } else {\n            return new OlderArticlesParser();\n        }\n    }\n\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/api/parser/DocumentProvider.java",
    "content": "package com.github.mzule.androidweekly.api.parser;\n\nimport org.jsoup.Jsoup;\nimport org.jsoup.nodes.Document;\n\nimport java.io.IOException;\nimport java.net.URL;\n\n/**\n * Created by CaoDongping on 4/15/16.\n */\npublic class DocumentProvider {\n    public static Document get(String issue) throws IOException {\n        String url = \"http://androidweekly.net/\";\n        if (issue != null) {\n            url += issue;\n        }\n        return Jsoup.parse(new URL(url), 30000);\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/api/parser/FresherArticlesParser.java",
    "content": "package com.github.mzule.androidweekly.api.parser;\n\nimport com.github.mzule.androidweekly.entity.Article;\n\nimport org.jsoup.nodes.Document;\nimport org.jsoup.nodes.Element;\nimport org.jsoup.select.Elements;\n\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * Created by CaoDongping on 4/15/16.\n */\npublic class FresherArticlesParser implements ArticleParser {\n\n    @Override\n    public List<Object> parse(String issue) throws IOException {\n        Document doc = DocumentProvider.get(issue);\n        List<Object> articles = new ArrayList<>();\n        Elements tables = doc.getElementsByTag(\"table\");\n        String currentSection = null;\n        for (Element e : tables) {\n            Elements h2 = e.getElementsByTag(\"h2\");\n            Elements h5 = e.getElementsByTag(\"h5\");// 兼容issue-226 SPONSORED 在 h5 标签里面\n            if (!h2.isEmpty() || !h5.isEmpty()) {\n                currentSection = h2.size() > 0 ? h2.get(0).text() : h5.get(0).text();\n                if (!articles.contains(currentSection)) {\n                    articles.add(currentSection);\n                }\n            } else {\n                Elements tds = e.getElementsByTag(\"td\");\n                Element td = tds.get(tds.size() - 2);\n                String imageUrl = null;\n                if (tds.size() == 4) {\n                    imageUrl = tds.get(0).getElementsByTag(\"img\").get(0).attr(\"src\");\n                }\n                String title = td.getElementsByClass(\"article-headline\").get(0).text();\n                String brief = td.getElementsByTag(\"p\").get(0).text();\n                String link = td.getElementsByClass(\"article-headline\").get(0).attr(\"href\");\n                String domain = td.getElementsByTag(\"span\").get(0).text().replace(\"(\", \"\").replace(\")\", \"\");\n                if (issue == null) {\n                    String number = doc.getElementsByClass(\"issue-header\").get(0).getElementsByTag(\"span\").get(0).text();\n                    issue = \"/issues/issue-\" + number.replace(\"#\", \"\");\n                }\n                Article article = new Article();\n                article.setTitle(title);\n                article.setBrief(brief);\n                article.setLink(link);\n                article.setDomain(domain);\n                article.setIssue(issue);\n                article.setImageUrl(imageUrl);\n                article.setSection(currentSection);\n                articles.add(article);\n            }\n        }\n        return articles;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/api/parser/OlderArticlesParser.java",
    "content": "package com.github.mzule.androidweekly.api.parser;\n\nimport com.github.mzule.androidweekly.entity.Article;\n\nimport org.jsoup.nodes.Document;\nimport org.jsoup.nodes.Element;\nimport org.jsoup.select.Elements;\n\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * Created by CaoDongping on 4/15/16.\n */\npublic class OlderArticlesParser implements ArticleParser {\n\n    @Override\n    public List<Object> parse(String issue) throws IOException {\n        Document doc = DocumentProvider.get(issue);\n        List<Object> articles = new ArrayList<>();\n        Element root = doc.getElementsByClass(\"issue\").get(0);\n        while (root.children().size() == 1) {\n            root = root.child(0);\n        }\n        String currentSection = null;\n        for (Element e : root.children()) {\n            if (e.tagName().equals(\"h2\")) {\n                currentSection = e.text();\n                articles.add(currentSection);\n                continue;\n            }\n            if (e.tagName().equals(\"div\")) {\n                Elements img = e.getElementsByTag(\"img\");\n                if (!img.isEmpty()) {\n                    Article article = new Article();\n                    article.setImageUrl(img.get(0).attr(\"src\"));\n                    article.setTitle(e.getElementsByTag(\"a\").get(1).text());\n                    article.setLink(e.getElementsByTag(\"a\").get(1).attr(\"href\"));\n                    article.setBrief(e.getElementsByTag(\"p\").get(0).text());\n                    Elements span = e.getElementsByTag(\"span\");\n                    if (!span.isEmpty()) {\n                        article.setDomain(span.get(0).text().replace(\"(\", \"\").replace(\")\", \"\"));\n                    }\n                    article.setIssue(issue);\n                    article.setSection(currentSection);\n                    articles.add(article);\n                }\n            } else {\n                Article article = new Article();\n                Elements title = e.getElementsByTag(\"a\");\n                if (title.isEmpty()) {\n                    continue;\n                }\n                article.setTitle(title.get(0).text());\n                Elements span = e.getElementsByTag(\"span\");\n                if (!span.isEmpty()) {\n                    article.setDomain(span.get(0).text().replace(\"(\", \"\").replace(\")\", \"\"));\n                }\n                article.setLink(e.getElementsByTag(\"a\").get(0).attr(\"href\"));\n                article.setBrief(e.text());\n                article.setIssue(issue);\n                article.setSection(currentSection);\n                articles.add(article);\n            }\n        }\n        return articles;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/dao/ArticleDao.java",
    "content": "package com.github.mzule.androidweekly.dao;\n\nimport android.content.ContentValues;\nimport android.database.Cursor;\nimport android.database.sqlite.SQLiteDatabase;\nimport android.database.sqlite.SQLiteOpenHelper;\nimport android.support.annotation.NonNull;\n\nimport com.github.mzule.androidweekly.App;\nimport com.github.mzule.androidweekly.entity.Article;\nimport com.github.mzule.androidweekly.util.StemUtil;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * Created by CaoDongping on 4/2/16.\n */\npublic class ArticleDao extends SQLiteOpenHelper {\n    private static final String NAME = \"article\";\n    private static final int VERSION = 1;\n    private static final int INDEX_TITLE = 1;\n    private static final int INDEX_BRIEF = 2;\n    private static final int INDEX_LINK = 3;\n    private static final int INDEX_IMAGE_URL = 4;\n    private static final int INDEX_DOMAIN = 5;\n    private static final int INDEX_ISSUE = 6;\n    private static final int INDEX_SECTION = 7;\n\n    public ArticleDao() {\n        super(App.getInstance(), NAME, null, VERSION);\n    }\n\n    public List<Article> read(String issue) {\n        List<Article> articles = new ArrayList<>();\n        Cursor cursor = getReadableDatabase().rawQuery(\"SELECT * FROM ARTICLE WHERE ISSUE=?\", new String[]{issue});\n        while (cursor.moveToNext()) {\n            articles.add(read(cursor));\n        }\n        cursor.close();\n        return articles;\n    }\n\n    public List<Article> search(String q) {\n        q = StemUtil.stem(q);\n        List<Article> articles = new ArrayList<>();\n        Cursor cursor = getReadableDatabase().rawQuery(\"SELECT * FROM ARTICLE WHERE FTS MATCH ?\", new String[]{q});\n        while (cursor.moveToNext()) {\n            articles.add(read(cursor));\n        }\n        cursor.close();\n        return articles;\n    }\n\n    @NonNull\n    private Article read(Cursor cursor) {\n        Article article = new Article();\n        article.setTitle(cursor.getString(INDEX_TITLE));\n        article.setBrief(cursor.getString(INDEX_BRIEF));\n        article.setLink(cursor.getString(INDEX_LINK));\n        article.setImageUrl(cursor.getString(INDEX_IMAGE_URL));\n        article.setDomain(cursor.getString(INDEX_DOMAIN));\n        article.setIssue(cursor.getString(INDEX_ISSUE));\n        article.setSection(cursor.getString(INDEX_SECTION));\n        return article;\n    }\n\n    public void save(Article article) {\n        if (!checkExist(article)) {\n            ContentValues cv = new ContentValues();\n            cv.put(\"TITLE\", article.getTitle());\n            cv.put(\"BRIEF\", article.getBrief());\n            cv.put(\"LINK\", article.getLink());\n            cv.put(\"IMAGE_URL\", article.getImageUrl());\n            cv.put(\"DOMAIN\", article.getDomain());\n            cv.put(\"ISSUE\", article.getIssue());\n            cv.put(\"SECTION\", article.getSection());\n            cv.put(\"TYPE\", 0);// TODO add type for article\n            cv.put(\"FTS\", StemUtil.stem(article.getFTS()));\n            getWritableDatabase().insert(\"ARTICLE\", null, cv);\n        }\n    }\n\n    private boolean checkExist(Article article) {\n        Cursor cursor = getReadableDatabase().rawQuery(\"SELECT COUNT(*) FROM ARTICLE WHERE LINK=?\", new String[]{article.getLink()});\n        cursor.moveToNext();\n        int count = cursor.getInt(0);\n        cursor.close();\n        return count > 0;\n    }\n\n    @Override\n    public void onCreate(SQLiteDatabase db) {\n        db.execSQL(\"CREATE VIRTUAL TABLE ARTICLE USING fts3(\" +\n                \"ID INTEGER PRIMARY KEY AUTOINCREMENT, \" +\n                \"TITLE VARCHAR(255), \" +\n                \"BRIEF TEXT, \" +\n                \"LINK VARCHAR(255), \" +\n                \"IMAGE_URL VARCHAR(255), \" +\n                \"DOMAIN VARCHAR(255), \" +\n                \"ISSUE VARCHAR(255), \" +\n                \"SECTION VARCHAR(255), \" +\n                \"TYPE INTEGER, \" +\n                \"FTS TEXT)\");\n    }\n\n    @Override\n    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/dao/FavoriteDao.java",
    "content": "package com.github.mzule.androidweekly.dao;\n\nimport android.content.ContentValues;\nimport android.database.Cursor;\nimport android.database.sqlite.SQLiteDatabase;\nimport android.database.sqlite.SQLiteOpenHelper;\nimport android.os.Environment;\n\nimport com.github.mzule.androidweekly.App;\nimport com.github.mzule.androidweekly.entity.Article;\nimport com.github.mzule.androidweekly.entity.Favorite;\nimport com.github.mzule.androidweekly.util.IOUtil;\nimport com.github.mzule.androidweekly.util.JsonUtil;\nimport com.google.gson.reflect.TypeToken;\n\nimport java.io.File;\nimport java.io.FileWriter;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * Created by CaoDongping on 4/2/16.\n */\npublic class FavoriteDao extends SQLiteOpenHelper {\n    private static final String NAME = \"favorite\";\n    private static final int VERSION = 1;\n    private static final int INDEX_TITLE = 1;\n    private static final int INDEX_BRIEF = 2;\n    private static final int INDEX_LINK = 3;\n    private static final int INDEX_IMAGE_URL = 4;\n    private static final int INDEX_DOMAIN = 5;\n    private static final int INDEX_ISSUE = 6;\n    private static final int INDEX_SECTION = 7;\n    private static final int INDEX_TYPE = 8;\n    private static final int INDEX_TIME = 9;\n\n    public FavoriteDao() {\n        super(App.getInstance(), NAME, null, VERSION);\n    }\n\n    public List<Favorite> read() {\n        List<Favorite> favorites = new ArrayList<>();\n        Cursor cursor = getReadableDatabase().rawQuery(\"SELECT * FROM FAVORITE ORDER BY TIME DESC\", null);\n        while (cursor.moveToNext()) {\n            Article article = new Article();\n            article.setTitle(cursor.getString(INDEX_TITLE));\n            article.setBrief(cursor.getString(INDEX_BRIEF));\n            article.setLink(cursor.getString(INDEX_LINK));\n            article.setImageUrl(cursor.getString(INDEX_IMAGE_URL));\n            article.setDomain(cursor.getString(INDEX_DOMAIN));\n            article.setIssue(cursor.getString(INDEX_ISSUE));\n            article.setSection(cursor.getString(INDEX_SECTION));\n            Favorite favorite = new Favorite(article);\n            favorite.setTime(cursor.getLong(INDEX_TIME));\n            favorites.add(favorite);\n        }\n        cursor.close();\n        return favorites;\n    }\n\n    public boolean contains(Article article) {\n        Cursor cursor = getReadableDatabase().rawQuery(\"SELECT COUNT(*) FROM FAVORITE WHERE LINK=?\", new String[]{article.getLink()});\n        cursor.moveToNext();\n        int count = cursor.getInt(0);\n        cursor.close();\n        return count > 0;\n    }\n\n    public void save(Article article) {\n        if (!contains(article)) {\n            ContentValues cv = new ContentValues();\n            cv.put(\"TITLE\", article.getTitle());\n            cv.put(\"BRIEF\", article.getBrief());\n            cv.put(\"LINK\", article.getLink());\n            cv.put(\"IMAGE_URL\", article.getImageUrl());\n            cv.put(\"DOMAIN\", article.getDomain());\n            cv.put(\"ISSUE\", article.getIssue());\n            cv.put(\"SECTION\", article.getSection());\n            cv.put(\"TYPE\", 0);// TODO add type for article\n            cv.put(\"TIME\", System.currentTimeMillis());\n            getWritableDatabase().insert(\"FAVORITE\", null, cv);\n        }\n    }\n\n    public void save(Favorite favorite) {\n        Article article = favorite.getArticle();\n        if (!contains(article)) {\n            ContentValues cv = new ContentValues();\n            cv.put(\"TITLE\", article.getTitle());\n            cv.put(\"BRIEF\", article.getBrief());\n            cv.put(\"LINK\", article.getLink());\n            cv.put(\"IMAGE_URL\", article.getImageUrl());\n            cv.put(\"DOMAIN\", article.getDomain());\n            cv.put(\"ISSUE\", article.getIssue());\n            cv.put(\"SECTION\", article.getSection());\n            cv.put(\"TYPE\", 0);// TODO add type for article\n            cv.put(\"TIME\", favorite.getTime());\n            getWritableDatabase().insert(\"FAVORITE\", null, cv);\n        }\n    }\n\n    public void delete(Article article) {\n        getWritableDatabase().delete(\"FAVORITE\", \"LINK=?\", new String[]{article.getLink()});\n    }\n\n    public void exportToFile() throws IOException {\n        List<Favorite> all = read();\n        String json = JsonUtil.toJson(all);\n        File file = new File(Environment.getExternalStorageDirectory(), \"androidweeklyfavorite.json\");\n        if (!file.exists()) {\n            file.createNewFile();\n        }\n        FileWriter fileWriter = null;\n        try {\n            fileWriter = new FileWriter(file);\n            fileWriter.write(json);\n            fileWriter.flush();\n        } finally {\n            IOUtil.close(fileWriter);\n        }\n    }\n\n    public void importFromFile() throws IOException {\n        File file = new File(Environment.getExternalStorageDirectory(), \"androidweeklyfavorite.json\");\n        String json = IOUtil.read(file);\n        List<Favorite> favorites = JsonUtil.fromJson(json, new TypeToken<List<Favorite>>() {\n        }.getType());\n        if (favorites != null) {\n            for (Favorite favorite : favorites) {\n                save(favorite);\n            }\n        }\n    }\n\n    @Override\n    public void onCreate(SQLiteDatabase db) {\n        // 不创建一个与Article的外键引用是因为Article表是cache，可能会被清除。\n        db.execSQL(\"CREATE TABLE IF NOT EXISTS FAVORITE(\" +\n                \"ID INTEGER PRIMARY KEY AUTOINCREMENT, \" +\n                \"TITLE VARCHAR(255), \" +\n                \"BRIEF TEXT, \" +\n                \"LINK VARCHAR(255), \" +\n                \"IMAGE_URL VARCHAR(255), \" +\n                \"DOMAIN VARCHAR(255), \" +\n                \"ISSUE VARCHAR(255), \" +\n                \"SECTION VARCHAR(255), \" +\n                \"TYPE INTEGER, \" +\n                \"TIME INTEGER)\");\n    }\n\n    @Override\n    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {\n\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/dao/IssueListKeeper.java",
    "content": "package com.github.mzule.androidweekly.dao;\n\nimport android.content.Context;\nimport android.content.SharedPreferences;\n\nimport com.github.mzule.androidweekly.App;\nimport com.github.mzule.androidweekly.entity.Issue;\nimport com.github.mzule.androidweekly.util.JsonUtil;\nimport com.google.gson.reflect.TypeToken;\n\nimport java.util.Collections;\nimport java.util.List;\n\n/**\n * Created by CaoDongping on 4/2/16.\n */\npublic class IssueListKeeper {\n\n    public static void save(List<Issue> issues) {\n        getSharedPreferences().edit().putString(\"issues\", JsonUtil.toJson(issues)).apply();\n    }\n\n    public static List<Issue> read() {\n        String json = getSharedPreferences().getString(\"issues\", null);\n        List<Issue> issues = JsonUtil.fromJson(json, new TypeToken<List<Issue>>() {\n        }.getType());\n        return issues == null ? Collections.<Issue>emptyList() : issues;\n    }\n\n    private static SharedPreferences getSharedPreferences() {\n        return App.getInstance().getSharedPreferences(\"IssueList\", Context.MODE_PRIVATE);\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/dao/SearchHistoryKeeper.java",
    "content": "package com.github.mzule.androidweekly.dao;\n\nimport android.content.Context;\nimport android.content.SharedPreferences;\nimport android.text.TextUtils;\n\nimport com.github.mzule.androidweekly.App;\nimport com.github.mzule.androidweekly.util.JsonUtil;\nimport com.google.gson.reflect.TypeToken;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * Created by CaoDongping on 4/5/16.\n */\npublic class SearchHistoryKeeper {\n\n    private static final int MAX_SIZE = 5;\n\n    public static void save(String q) {\n        List<String> exist = read();\n        if (exist.contains(q)) {\n            exist.remove(q);\n        }\n        exist.add(0, q);\n        if (exist.size() > MAX_SIZE) {\n            exist = exist.subList(0, MAX_SIZE);\n        }\n        getSharedPreferences().edit().putString(\"q\", JsonUtil.toJson(exist)).apply();\n    }\n\n    public static List<String> read() {\n        String json = getSharedPreferences().getString(\"q\", null);\n        if (TextUtils.isEmpty(json)) {\n            return new ArrayList<>();\n        } else {\n            return JsonUtil.fromJson(json, new TypeToken<List<String>>() {\n            }.getType());\n        }\n    }\n\n    private static SharedPreferences getSharedPreferences() {\n        return App.getInstance().getSharedPreferences(\"SearchHistory\", Context.MODE_PRIVATE);\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/dao/TextZoomKeeper.java",
    "content": "package com.github.mzule.androidweekly.dao;\n\nimport android.content.Context;\nimport android.content.SharedPreferences;\n\nimport com.github.mzule.androidweekly.App;\n\n/**\n * Created by CaoDongping on 3/26/16.\n */\npublic class TextZoomKeeper {\n    public static void save(int zoom) {\n        getSharedPreferences().edit().putInt(\"zoom\", zoom).apply();\n    }\n\n    public static int read(int def) {\n        return getSharedPreferences().getInt(\"zoom\", def);\n    }\n\n    private static SharedPreferences getSharedPreferences() {\n        return App.getInstance().getSharedPreferences(\"TextZoom\", Context.MODE_PRIVATE);\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/entity/Article.java",
    "content": "package com.github.mzule.androidweekly.entity;\n\nimport java.io.Serializable;\nimport java.util.Arrays;\n\n/**\n * Created by CaoDongping on 3/24/16.\n */\npublic class Article implements Serializable {\n    private String title;\n    private String brief;\n    private String link;\n    private String imageUrl;\n    private String domain;\n    private String issue;\n    private String section;\n\n    public String getSection() {\n        return section;\n    }\n\n    public void setSection(String section) {\n        this.section = section;\n    }\n\n    public String getIssue() {\n        return issue;\n    }\n\n    public void setIssue(String issue) {\n        this.issue = issue;\n    }\n\n    public String getTitle() {\n        return title;\n    }\n\n    public void setTitle(String title) {\n        this.title = title;\n    }\n\n    public String getBrief() {\n        return brief;\n    }\n\n    public void setBrief(String brief) {\n        this.brief = brief;\n    }\n\n    public String getLink() {\n        return link;\n    }\n\n    public void setLink(String link) {\n        this.link = link;\n    }\n\n    public String getImageUrl() {\n        return imageUrl;\n    }\n\n    public void setImageUrl(String imageUrl) {\n        this.imageUrl = imageUrl;\n    }\n\n    public String getDomain() {\n        return domain;\n    }\n\n    public void setDomain(String domain) {\n        this.domain = domain;\n    }\n\n    public String getFTS() {\n        return title + \"\\n\" + brief;\n    }\n\n    @Override\n    public String toString() {\n        return Arrays.toString(new String[]{title, \"\\n\", brief, \"\\n\", link, \"\\n\", imageUrl, \"\\n\", domain, \"\\n\", \"\\n\"});\n    }\n\n    @Override\n    public int hashCode() {\n        return link == null ? 0 : link.hashCode();\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (o instanceof Article) {\n            Article other = (Article) o;\n            return link == null ? other.link == null : link.equals(other.link);\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/entity/Dict.java",
    "content": "package com.github.mzule.androidweekly.entity;\n\nimport android.text.TextUtils;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * Created by CaoDongping on 3/31/16.\n */\npublic class Dict {\n    private String key;\n    private List<String> ps;\n    private List<String> pos;\n    private List<String> pron;\n    private List<String> acceptation;\n    private List<Sent> sent;\n    private String fy;\n\n    public Dict() {\n        ps = new ArrayList<>();\n        pos = new ArrayList<>();\n        pron = new ArrayList<>();\n        acceptation = new ArrayList<>();\n        sent = new ArrayList<>();\n    }\n\n    public String getContent() {\n        StringBuilder sb = new StringBuilder();\n        for (int i = 0; i < getPs().size(); i++) {\n            sb.append(getPs().get(i)).append(\"\\n\");\n        }\n        if (!TextUtils.isEmpty(getFy())) {\n            sb.append(\"\\n\");\n            sb.append(getFy()).append(\"\\n\");\n        }\n        for (int i = 0; i < getPos().size(); i++) {\n            sb.append(\"\\n\");\n            sb.append(getPos().get(i)).append(\"\\n\");\n            sb.append(getAcceptation().get(i)).append(\"\\n\");\n        }\n        for (int i = 0; i < getSent().size(); i++) {\n            sb.append(\"\\n\");\n            sb.append(getSent().get(i).getOrig()).append(\"\\n\");\n            sb.append(getSent().get(i).getTrans()).append(\"\\n\");\n        }\n        return sb.toString().trim();\n    }\n\n    public void addPos(String pos) {\n        this.pos.add(pos);\n    }\n\n    public void addAcceptation(String acceptation) {\n        this.acceptation.add(acceptation);\n    }\n\n    public List<String> getPos() {\n        return pos;\n    }\n\n    public void setPos(List<String> pos) {\n        this.pos = pos;\n    }\n\n    public List<String> getAcceptation() {\n        return acceptation;\n    }\n\n    public void setAcceptation(List<String> acceptation) {\n        this.acceptation = acceptation;\n    }\n\n    public void addPs(String ps) {\n        this.ps.add(ps);\n    }\n\n    public void addPron(String pron) {\n        this.pron.add(pron);\n    }\n\n    public void addSent(Sent sent) {\n        this.sent.add(sent);\n    }\n\n    public String getKey() {\n        return key;\n    }\n\n    public void setKey(String key) {\n        this.key = key;\n    }\n\n    public List<String> getPs() {\n        return ps;\n    }\n\n    public void setPs(List<String> ps) {\n        this.ps = ps;\n    }\n\n    public List<String> getPron() {\n        return pron;\n    }\n\n    public void setPron(List<String> pron) {\n        this.pron = pron;\n    }\n\n    public List<Sent> getSent() {\n        return sent;\n    }\n\n    public void setSent(List<Sent> sent) {\n        this.sent = sent;\n    }\n\n    public String getFy() {\n        return fy;\n    }\n\n    public void setFy(String fy) {\n        this.fy = fy;\n    }\n\n    public static class Sent {\n        private String orig;\n        private String trans;\n\n        public String getOrig() {\n            return orig;\n        }\n\n        public void setOrig(String orig) {\n            this.orig = orig;\n        }\n\n        public String getTrans() {\n            return trans;\n        }\n\n        public void setTrans(String trans) {\n            this.trans = trans;\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/entity/Favorite.java",
    "content": "package com.github.mzule.androidweekly.entity;\n\nimport java.io.Serializable;\n\n/**\n * Created by CaoDongping on 3/28/16.\n */\npublic class Favorite implements Serializable {\n    private Article article;\n    private long time;\n\n    public Favorite(Article article) {\n        this.article = article;\n        this.time = System.currentTimeMillis();\n    }\n\n    public Article getArticle() {\n        return article;\n    }\n\n    public void setArticle(Article article) {\n        this.article = article;\n    }\n\n    public long getTime() {\n        return time;\n    }\n\n    public void setTime(long time) {\n        this.time = time;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        return o instanceof Favorite && article.equals(((Favorite) o).article);\n    }\n\n    @Override\n    public int hashCode() {\n        return article.hashCode();\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/entity/Issue.java",
    "content": "package com.github.mzule.androidweekly.entity;\n\nimport java.io.Serializable;\n\n/**\n * Created by CaoDongping on 3/25/16.\n */\npublic class Issue implements Serializable {\n    private String date;\n    private String name;\n    private String url;\n    private boolean active;\n\n    public Issue(String name) {\n        this.name = name;\n    }\n\n    public Issue(String name, boolean active) {\n        this.name = name;\n        this.active = active;\n    }\n\n    public Issue(String name, String url, String date) {\n        this.name = name;\n        this.url = url;\n        this.date = date;\n    }\n\n    public String getUrl() {\n        return url;\n    }\n\n    public void setUrl(String url) {\n        this.url = url;\n    }\n\n    public String getDate() {\n        return date;\n    }\n\n    public void setDate(String date) {\n        this.date = date;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public boolean isActive() {\n        return active;\n    }\n\n    public void setActive(boolean active) {\n        this.active = active;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/entity/TranslateResult.java",
    "content": "package com.github.mzule.androidweekly.entity;\n\nimport com.google.gson.annotations.SerializedName;\n\nimport java.util.List;\n\n/**\n * Created by CaoDongping on 3/30/16.\n */\npublic class TranslateResult {\n    private String from;\n    private String to;\n    @SerializedName(\"trans_result\")\n    private List<Result> result;\n\n    public String getFrom() {\n        return from;\n    }\n\n    public void setFrom(String from) {\n        this.from = from;\n    }\n\n    public String getTo() {\n        return to;\n    }\n\n    public void setTo(String to) {\n        this.to = to;\n    }\n\n    public List<Result> getResult() {\n        return result;\n    }\n\n    public void setResult(List<Result> result) {\n        this.result = result;\n    }\n\n    public String getDst() {\n        if (getResult() != null && !getResult().isEmpty()) {\n            return getResult().get(0).getDst();\n        }\n        return null;\n    }\n\n    public static class Result {\n        private String src;\n        private String dst;\n\n        public Result(String src, String dst) {\n            this.src = src;\n            this.dst = dst;\n        }\n\n        public String getSrc() {\n            return src;\n        }\n\n        public void setSrc(String src) {\n            this.src = src;\n        }\n\n        public String getDst() {\n            return dst;\n        }\n\n        public void setDst(String dst) {\n            this.dst = dst;\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/activity/AboutActivity.java",
    "content": "package com.github.mzule.androidweekly.ui.activity;\n\nimport android.content.Context;\nimport android.content.Intent;\nimport android.text.Html;\nimport android.text.method.LinkMovementMethod;\nimport android.widget.TextView;\n\nimport com.github.mzule.androidweekly.R;\nimport com.github.mzule.layoutannotation.Layout;\n\nimport butterknife.Bind;\n\n/**\n * Created by CaoDongping on 4/12/16.\n */\n@Layout(R.layout.activity_about)\npublic class AboutActivity extends BaseActivity {\n    @Bind(R.id.textView)\n    TextView textView;\n\n    public static Intent makeIntent(Context context) {\n        return new Intent(context, AboutActivity.class);\n    }\n\n    @Override\n    protected void afterBind() {\n        textView.setMovementMethod(LinkMovementMethod.getInstance());\n        textView.setText(Html.fromHtml(\"Copyright: <br/><a href='http://androidweekly.net/'>http://androidweekly.net/</a><br/>\" +\n                \"Github Host: <br/><a href='https://github.com/mzule/AndroidWeekly'>https://github.com/mzule/AndroidWeekly</a><br/>\" +\n                \"Contributor:<br/> <a href='sinaweibo://userinfo?uid=mzule'>mzule</a> / <a href='sinaweibo://userinfo?uid=maoruibin'>maoruibin</a> \"));\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/activity/ArticleActivity.java",
    "content": "package com.github.mzule.androidweekly.ui.activity;\n\nimport android.annotation.SuppressLint;\nimport android.content.ClipData;\nimport android.content.ClipboardManager;\nimport android.content.Context;\nimport android.content.Intent;\nimport android.support.v4.view.GravityCompat;\nimport android.support.v4.widget.DrawerLayout;\nimport android.view.View;\nimport android.webkit.WebSettings;\nimport android.webkit.WebView;\nimport android.webkit.WebViewClient;\nimport android.widget.Toast;\n\nimport com.github.mzule.androidweekly.R;\nimport com.github.mzule.androidweekly.dao.FavoriteDao;\nimport com.github.mzule.androidweekly.dao.TextZoomKeeper;\nimport com.github.mzule.androidweekly.entity.Article;\nimport com.github.mzule.androidweekly.ui.view.ProgressView;\nimport com.github.mzule.androidweekly.ui.view.TranslateView;\nimport com.github.mzule.layoutannotation.Layout;\n\nimport butterknife.Bind;\nimport butterknife.OnClick;\n\n/**\n * Created by CaoDongping on 3/24/16.\n */\n@Layout(R.layout.activity_article)\npublic class ArticleActivity extends BaseActivity {\n    @Bind(R.id.webView)\n    WebView webView;\n    @Bind(R.id.progressView)\n    ProgressView progressView;\n    @Bind(R.id.drawerLayout)\n    DrawerLayout drawerLayout;\n    @Bind(R.id.favoriteButton)\n    View favoriteButton;\n    private Article article;\n    private WebSettings settings;\n    private boolean changed;\n    private FavoriteDao favoriteDao;\n\n    public static Intent makeIntent(Context context, Article article) {\n        Intent intent = new Intent(context, ArticleActivity.class);\n        intent.putExtra(\"article\", article);\n        return intent;\n    }\n\n    @OnClick(R.id.favoriteButton)\n    void favorite(View v) {\n        changed = true;\n        v.setSelected(!v.isSelected());\n        if (v.isSelected()) {\n            favoriteDao.save(article);\n        } else {\n            favoriteDao.delete(article);\n        }\n        drawerLayout.closeDrawers();\n    }\n\n    @OnClick(R.id.increaseButton)\n    void increate() {\n        settings.setTextZoom(settings.getTextZoom() + 5);\n    }\n\n    @OnClick(R.id.decreaseButton)\n    void decrease() {\n        settings.setTextZoom(settings.getTextZoom() - 5);\n    }\n\n    @OnClick(R.id.translateButton)\n    void translateAndPaste(View v) {\n        new TranslateView(this).attachTo(this, null);\n        drawerLayout.closeDrawers();\n    }\n\n    @OnClick(R.id.shareButton)\n    void share() {\n        Intent intent = new Intent(Intent.ACTION_SEND);\n        intent.putExtra(Intent.EXTRA_TEXT, article.getTitle() + \" \" + article.getLink());\n        intent.setType(\"text/plain\");\n        startActivity(Intent.createChooser(intent, \"SHARE\"));\n\n        drawerLayout.closeDrawers();\n    }\n\n    @OnClick(R.id.copyUrlButton)\n    void copyUrl() {\n        ClipboardManager clipboard = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);\n        ClipData clip = ClipData.newPlainText(\"label\",article.getLink());\n        clipboard.setPrimaryClip(clip);\n        drawerLayout.closeDrawers();\n        Toast.makeText(ArticleActivity.this, \"已复制文章链接到粘贴板\", Toast.LENGTH_SHORT).show();\n    }\n\n    @SuppressLint(\"SetJavaScriptEnabled\")\n    @Override\n    protected void afterBind() {\n        favoriteDao = new FavoriteDao();\n        article = (Article) getIntent().getSerializableExtra(\"article\");\n        settings = webView.getSettings();\n        webView.loadUrl(article.getLink());\n        webView.setWebViewClient(new WebViewClient() {\n            @Override\n            public void onPageFinished(WebView view, String url) {\n                progressView.stop();\n            }\n        });\n        settings.setTextZoom(TextZoomKeeper.read(settings.getTextZoom()));\n        settings.setJavaScriptEnabled(true);\n        settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);\n        settings.setDomStorageEnabled(true);\n        favoriteButton.setSelected(favoriteDao.contains(article));\n    }\n\n    @Override\n    protected void onStop() {\n        super.onStop();\n        TextZoomKeeper.save(settings.getTextZoom());\n    }\n\n    @Override\n    public void finish() {\n        Intent intent = new Intent();\n        intent.putExtra(\"changed\", changed);\n        setResult(RESULT_OK, intent);\n        super.finish();\n    }\n\n    @Override\n    public void onBackPressed() {\n        if (drawerLayout.isDrawerOpen(GravityCompat.START)) {\n            drawerLayout.closeDrawers();\n        } else if (webView.canGoBack()) {\n            webView.goBack();\n        } else {\n            super.onBackPressed();\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/activity/BaseActivity.java",
    "content": "package com.github.mzule.androidweekly.ui.activity;\n\nimport android.os.Bundle;\nimport android.support.v4.app.FragmentActivity;\nimport android.view.View;\n\nimport com.github.mzule.androidweekly.R;\nimport com.github.mzule.androidweekly.ui.view.PopupView;\nimport com.github.mzule.androidweekly.util.Tinter;\nimport com.github.mzule.layoutannotation.LayoutBinder;\n\nimport butterknife.ButterKnife;\n\n/**\n * Created by CaoDongping on 3/24/16.\n */\npublic abstract class BaseActivity extends FragmentActivity {\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        LayoutBinder.bind(this);\n        ButterKnife.bind(this);\n        Tinter.enableIfSupport(this);\n        afterBind();\n    }\n\n    public void back(View v) {\n        onBackPressed();\n    }\n\n    @Override\n    public void onBackPressed() {\n        PopupView popupView = (PopupView) findViewById(R.id.popup_view_id);\n        if (popupView == null) {\n            super.onBackPressed();\n        } else {\n            popupView.finish();\n        }\n    }\n\n    protected abstract void afterBind();\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/activity/FavoriteActivity.java",
    "content": "package com.github.mzule.androidweekly.ui.activity;\n\nimport android.content.Context;\nimport android.content.Intent;\nimport android.support.v4.widget.DrawerLayout;\nimport android.view.View;\nimport android.widget.AdapterView;\nimport android.widget.ListView;\nimport android.widget.Toast;\n\nimport com.github.mzule.androidweekly.R;\nimport com.github.mzule.androidweekly.dao.FavoriteDao;\nimport com.github.mzule.androidweekly.entity.Article;\nimport com.github.mzule.androidweekly.entity.Favorite;\nimport com.github.mzule.androidweekly.ui.adapter.ArticleAdapter;\nimport com.github.mzule.androidweekly.util.DateUtil;\nimport com.github.mzule.layoutannotation.Layout;\n\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport butterknife.Bind;\nimport butterknife.OnClick;\nimport butterknife.OnItemClick;\n\n/**\n * Created by CaoDongping on 3/28/16.\n */\n@Layout(R.layout.activity_favorite)\npublic class FavoriteActivity extends BaseActivity {\n    private static final int REQUEST_CODE_OPEN_ARTICLE = 0x1;\n    @Bind(R.id.drawerLayout)\n    DrawerLayout drawerLayout;\n    @Bind(R.id.listView)\n    ListView listView;\n    private FavoriteDao favoriteDao;\n    private ArticleAdapter adapter;\n\n    public static Intent makeIntent(Context context) {\n        return new Intent(context, FavoriteActivity.class);\n    }\n\n    @OnItemClick(R.id.listView)\n    void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n        Object item = parent.getAdapter().getItem(position);\n        if (item instanceof Article) {\n            startActivityForResult(ArticleActivity.makeIntent(this, (Article) item), REQUEST_CODE_OPEN_ARTICLE);\n        }\n    }\n\n    @OnClick(R.id.exportButton)\n    void exportToFile() {\n        try {\n            favoriteDao.exportToFile();\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n        Toast.makeText(this, \"Export complete\", Toast.LENGTH_SHORT).show();\n        drawerLayout.closeDrawers();\n    }\n\n    @OnClick(R.id.importButton)\n    void importFromFile() {\n        try {\n            favoriteDao.importFromFile();\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n        adapter.clear();\n        adapter.addAndNotify(extract(favoriteDao.read()));\n        Toast.makeText(this, \"Import complete\", Toast.LENGTH_SHORT).show();\n        drawerLayout.closeDrawers();\n    }\n\n    @Override\n    protected void afterBind() {\n        favoriteDao = new FavoriteDao();\n        adapter = new ArticleAdapter(this);\n        listView.setAdapter(adapter);\n        renderFavorites();\n    }\n\n    private void renderFavorites() {\n        List<Favorite> favorites = favoriteDao.read();\n        adapter.clear();\n        adapter.addAndNotify(extract(favorites));\n    }\n\n    private List<Object> extract(List<Favorite> favorites) {\n        List<Object> ret = new ArrayList<>();\n        for (Favorite favorite : favorites) {\n            String time = DateUtil.format(favorite.getTime());\n            if (!ret.contains(time)) {\n                ret.add(time);\n            }\n            ret.add(favorite.getArticle());\n        }\n        return ret;\n    }\n\n    @Override\n    protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n        super.onActivityResult(requestCode, resultCode, data);\n        if (resultCode == RESULT_OK && requestCode == REQUEST_CODE_OPEN_ARTICLE) {\n            if (data.getBooleanExtra(\"changed\", false)) {\n                renderFavorites();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/activity/MainActivity.java",
    "content": "package com.github.mzule.androidweekly.ui.activity;\n\nimport android.support.v4.view.GravityCompat;\nimport android.support.v4.widget.DrawerLayout;\nimport android.view.View;\nimport android.widget.AdapterView;\nimport android.widget.ListView;\n\nimport com.github.mzule.androidweekly.R;\nimport com.github.mzule.androidweekly.api.ApiCallback;\nimport com.github.mzule.androidweekly.api.ArticleApi;\nimport com.github.mzule.androidweekly.entity.Article;\nimport com.github.mzule.androidweekly.entity.Issue;\nimport com.github.mzule.androidweekly.ui.adapter.ArticleAdapter;\nimport com.github.mzule.androidweekly.ui.adapter.SlideAdapter;\nimport com.github.mzule.androidweekly.ui.view.ProgressView;\nimport com.github.mzule.layoutannotation.Layout;\n\nimport java.util.List;\n\nimport butterknife.Bind;\nimport butterknife.OnClick;\nimport butterknife.OnItemClick;\n\n@Layout(R.layout.activity_main)\npublic class MainActivity extends BaseActivity {\n    @Bind(R.id.drawerLayout)\n    DrawerLayout drawerLayout;\n    @Bind(R.id.listView)\n    ListView listView;\n    @Bind(R.id.progressView)\n    ProgressView progressView;\n    @Bind(R.id.slideListView)\n    ListView slideListView;\n    private ArticleAdapter adapter;\n    private SlideAdapter slideAdapter;\n    private List<Issue> issues;\n    private ArticleApi articleApi;\n\n    @OnItemClick(R.id.slideListView)\n    void onSlideItemClick(AdapterView<?> parent, View view, int position, long id) {\n        Issue issue = (Issue) parent.getAdapter().getItem(position);\n        active(issue);\n        slideAdapter.notifyDataSetChanged();\n\n        sendArticleListRequest(issue.getUrl());\n\n        drawerLayout.closeDrawers();\n        progressView.start();\n    }\n\n    @OnItemClick(R.id.listView)\n    void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n        Object item = parent.getAdapter().getItem(position);\n        if (item instanceof Article) {\n            startActivity(ArticleActivity.makeIntent(this, (Article) item));\n        }\n    }\n\n    @OnClick(R.id.slideMenuButton)\n    void onSlideMenuClick() {\n        drawerLayout.openDrawer(GravityCompat.START);\n    }\n\n    @OnClick(R.id.favoriteButton)\n    void onFavoriteClick() {\n        startActivity(FavoriteActivity.makeIntent(this));\n        drawerLayout.closeDrawers();\n    }\n\n    @OnClick(R.id.searchButton)\n    void onSearchClicK() {\n        startActivity(SearchActivity.makeIntent(this));\n        drawerLayout.closeDrawers();\n    }\n\n    @OnClick(R.id.aboutButton)\n    void onAboutClick() {\n        startActivity(AboutActivity.makeIntent(this));\n        drawerLayout.closeDrawers();\n    }\n\n    @Override\n    protected void afterBind() {\n        articleApi = new ArticleApi();\n\n        adapter = new ArticleAdapter(this);\n        listView.setAdapter(adapter);\n\n        slideAdapter = new SlideAdapter(this);\n        slideListView.setAdapter(slideAdapter);\n\n        sendArticleListRequest(null);\n        sendIssueListRequest();\n    }\n\n    private void active(Issue issue) {\n        for (Issue i : issues) {\n            i.setActive(i == issue);\n        }\n    }\n\n    private void sendArticleListRequest(String issue) {\n        articleApi.getPage(issue, new ApiCallback<List<Object>>() {\n            @Override\n            public void onSuccess(List<Object> data, boolean fromCache) {\n                adapter.clear();\n                adapter.addAndNotify(data);\n                listView.setSelection(0);\n                progressView.stop();\n            }\n\n            @Override\n            public void onFailure(Exception e) {\n                progressView.stop();\n            }\n        });\n    }\n\n    private void sendIssueListRequest() {\n        articleApi.getArchive(new ApiCallback<List<Issue>>() {\n            @Override\n            public void onSuccess(List<Issue> data, boolean fromCache) {\n                issues = data;\n                slideAdapter.clear();\n                slideAdapter.addAndNotify(issues);\n                active(issues.get(0));\n            }\n\n            @Override\n            public void onFailure(Exception e) {\n            }\n        });\n    }\n\n    @Override\n    public void onBackPressed() {\n        if (drawerLayout.isDrawerOpen(GravityCompat.START)) {\n            drawerLayout.closeDrawers();\n        } else {\n            super.onBackPressed();\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/activity/SearchActivity.java",
    "content": "package com.github.mzule.androidweekly.ui.activity;\n\nimport android.content.Context;\nimport android.content.Intent;\nimport android.view.KeyEvent;\nimport android.view.View;\nimport android.widget.AdapterView;\nimport android.widget.EditText;\nimport android.widget.ListView;\nimport android.widget.TextView;\n\nimport com.github.mzule.androidweekly.R;\nimport com.github.mzule.androidweekly.dao.SearchHistoryKeeper;\nimport com.github.mzule.androidweekly.ui.adapter.SearchHistoryAdapter;\nimport com.github.mzule.layoutannotation.Layout;\n\nimport butterknife.Bind;\nimport butterknife.OnItemClick;\n\n/**\n * Created by CaoDongping on 4/5/16.\n */\n@Layout(R.layout.activity_search)\npublic class SearchActivity extends BaseActivity {\n    @Bind(R.id.queryInput)\n    EditText queryInput;\n    @Bind(R.id.listView)\n    ListView listView;\n    private SearchHistoryAdapter adapter;\n\n    public static Intent makeIntent(Context context) {\n        return new Intent(context, SearchActivity.class);\n    }\n\n    @OnItemClick(R.id.listView)\n    void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n        String q = (String) parent.getAdapter().getItem(position);\n        SearchHistoryKeeper.save(q);\n        startActivity(SearchResultActivity.makeIntent(this, q));\n    }\n\n    @Override\n    protected void afterBind() {\n        adapter = new SearchHistoryAdapter(this);\n        listView.setAdapter(adapter);\n        queryInput.setOnEditorActionListener(new TextView.OnEditorActionListener() {\n            @Override\n            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {\n                String q = queryInput.getText().toString().trim();\n                startActivity(SearchResultActivity.makeIntent(SearchActivity.this, q));\n                SearchHistoryKeeper.save(q);\n                queryInput.setText(\"\");\n                return true;\n            }\n        });\n    }\n\n    @Override\n    protected void onStart() {\n        super.onStart();\n        adapter.clear();\n        adapter.addAndNotify(SearchHistoryKeeper.read());\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/activity/SearchResultActivity.java",
    "content": "package com.github.mzule.androidweekly.ui.activity;\n\nimport android.content.Context;\nimport android.content.Intent;\nimport android.view.View;\nimport android.widget.AdapterView;\nimport android.widget.ListView;\n\nimport com.github.mzule.androidweekly.R;\nimport com.github.mzule.androidweekly.dao.ArticleDao;\nimport com.github.mzule.androidweekly.entity.Article;\nimport com.github.mzule.androidweekly.ui.adapter.ArticleAdapter;\nimport com.github.mzule.androidweekly.ui.view.NaviBar;\nimport com.github.mzule.layoutannotation.Layout;\n\nimport java.util.List;\n\nimport butterknife.Bind;\nimport butterknife.OnItemClick;\n\n/**\n * Created by CaoDongping on 4/5/16.\n */\n@Layout(R.layout.activity_search_result)\npublic class SearchResultActivity extends BaseActivity {\n    @Bind(R.id.naviBar)\n    NaviBar naviBar;\n    @Bind(R.id.listView)\n    ListView listView;\n\n    public static Intent makeIntent(Context context, String q) {\n        Intent intent = new Intent(context, SearchResultActivity.class);\n        intent.putExtra(\"q\", q);\n        return intent;\n    }\n\n    @OnItemClick(R.id.listView)\n    void onItemClick(AdapterView<?> parent, View view, int position, long id) {\n        Object item = parent.getAdapter().getItem(position);\n        if (item instanceof Article) {\n            startActivity(ArticleActivity.makeIntent(this, (Article) item));\n        }\n    }\n\n    @Override\n    protected void afterBind() {\n        String q = getIntent().getStringExtra(\"q\");\n        naviBar.setLeftText(q.toUpperCase());\n\n        ArticleDao articleDao = new ArticleDao();\n        List<Article> result = articleDao.search(q);\n        ArticleAdapter adapter = new ArticleAdapter(this);\n        listView.setAdapter(adapter);\n        adapter.addAndNotify(result);\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/adapter/ArticleAdapter.java",
    "content": "package com.github.mzule.androidweekly.ui.adapter;\n\nimport android.content.Context;\n\nimport com.github.mzule.androidweekly.entity.Article;\nimport com.github.mzule.androidweekly.ui.view.PinnedSectionListView;\nimport com.github.mzule.androidweekly.ui.viewtype.ArticleViewType;\nimport com.github.mzule.androidweekly.ui.viewtype.SectionViewType;\nimport com.github.mzule.easyadapter.TypePerEntityAdapter;\n\n/**\n * Created by CaoDongping on 3/24/16.\n */\npublic class ArticleAdapter extends TypePerEntityAdapter<Object> implements PinnedSectionListView.PinnedSectionListAdapter {\n\n    public ArticleAdapter(Context context) {\n        super(context);\n    }\n\n    @Override\n    protected void mapEntityViewTypes() {\n        mapEntityViewType(String.class, SectionViewType.class);\n        mapEntityViewType(Article.class, ArticleViewType.class);\n    }\n\n    @Override\n    public boolean isItemViewTypePinned(int viewType) {\n        return getRawViewType(SectionViewType.class) == viewType;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/adapter/SearchHistoryAdapter.java",
    "content": "package com.github.mzule.androidweekly.ui.adapter;\n\nimport android.content.Context;\n\nimport com.github.mzule.androidweekly.ui.viewtype.SearchHistoryViewType;\nimport com.github.mzule.easyadapter.SingleTypeAdapter;\nimport com.github.mzule.easyadapter.ViewType;\n\n/**\n * Created by CaoDongping on 4/5/16.\n */\npublic class SearchHistoryAdapter extends SingleTypeAdapter<String> {\n    public SearchHistoryAdapter(Context context) {\n        super(context);\n    }\n\n    @Override\n    protected Class<? extends ViewType> singleViewType() {\n        return SearchHistoryViewType.class;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/adapter/SlideAdapter.java",
    "content": "package com.github.mzule.androidweekly.ui.adapter;\n\nimport android.content.Context;\n\nimport com.github.mzule.androidweekly.entity.Issue;\nimport com.github.mzule.androidweekly.ui.viewtype.SlideIssueViewType;\nimport com.github.mzule.easyadapter.SingleTypeAdapter;\nimport com.github.mzule.easyadapter.ViewType;\n\n/**\n * Created by CaoDongping on 3/25/16.\n */\npublic class SlideAdapter extends SingleTypeAdapter<Issue> {\n\n    public SlideAdapter(Context context) {\n        super(context);\n    }\n\n    @Override\n    protected Class<? extends ViewType> singleViewType() {\n        return SlideIssueViewType.class;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/view/IconButton.java",
    "content": "package com.github.mzule.androidweekly.ui.view;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\n\nimport com.github.mzule.androidweekly.R;\n\nimport net.steamcrafted.materialiconlib.MaterialIconView;\n\n/**\n * Created by CaoDongping on 3/27/16.\n */\npublic class IconButton extends MaterialIconView {\n    public IconButton(Context context) {\n        super(context);\n    }\n\n    public IconButton(Context context, AttributeSet attrs) {\n        super(context, attrs);\n    }\n\n    public IconButton(Context context, AttributeSet attrs, int defStyle) {\n        super(context, attrs, defStyle);\n    }\n\n    @Override\n    public void setPressed(boolean pressed) {\n        super.setPressed(pressed);\n        if (pressed) {\n            setColor(getResources().getColor(R.color.white));\n            setBackgroundColor(getResources().getColor(R.color.colorPrimary));\n        } else if (!isSelected()) {\n            setColor(getResources().getColor(R.color.colorPrimary));\n            setBackgroundColor(getResources().getColor(R.color.transparent));\n        }\n    }\n\n    @Override\n    public void setSelected(boolean selected) {\n        super.setSelected(selected);\n        if (selected) {\n            setColor(getResources().getColor(R.color.white));\n            setBackgroundResource(R.color.colorPrimary);\n        } else {\n            setColor(getResources().getColor(R.color.colorPrimary));\n            setBackgroundResource(R.color.transparent);\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/view/NaviBar.java",
    "content": "package com.github.mzule.androidweekly.ui.view;\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport android.util.AttributeSet;\nimport android.widget.TextView;\n\nimport com.github.mzule.androidweekly.R;\nimport com.github.mzule.androidweekly.ui.view.base.BaseLinearLayout;\nimport com.github.mzule.layoutannotation.Layout;\n\nimport butterknife.Bind;\nimport butterknife.OnClick;\n\n/**\n * Created by CaoDongping on 4/5/16.\n */\n@Layout(R.layout.view_navi_bar)\npublic class NaviBar extends BaseLinearLayout {\n\n    @Bind(R.id.leftTextView)\n    TextView leftTextView;\n    @Bind(R.id.rightTextView)\n    TextView rightTextView;\n\n    public NaviBar(Context context) {\n        super(context);\n    }\n\n    public NaviBar(Context context, AttributeSet attrs) {\n        super(context, attrs);\n    }\n\n    public NaviBar(Context context, AttributeSet attrs, int defStyleAttr) {\n        super(context, attrs, defStyleAttr);\n    }\n\n    @Override\n    protected void init(Context context, AttributeSet attrs) {\n        super.init(context, attrs);\n        if (attrs != null) {\n            TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.NaviBar);\n            leftTextView.setText(a.getString(R.styleable.NaviBar_nb_left_text));\n            rightTextView.setText(a.getString(R.styleable.NaviBar_nb_right_text));\n            a.recycle();\n        }\n    }\n\n    @OnClick(R.id.backButton)\n    void back() {\n        if (getContext() instanceof Activity) {\n            ((Activity) getContext()).finish();\n        }\n    }\n\n    public void setLeftText(String text) {\n        leftTextView.setText(text);\n    }\n\n    public void setRightText(String text) {\n        rightTextView.setText(text);\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/view/PinnedSectionListView.java",
    "content": "/*\n * Copyright (C) 2013 Sergej Shafarenka, halfbit.de\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file kt 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\npackage com.github.mzule.androidweekly.ui.view;\n\nimport android.content.Context;\nimport android.database.DataSetObserver;\nimport android.graphics.Canvas;\nimport android.graphics.Color;\nimport android.graphics.PointF;\nimport android.graphics.Rect;\nimport android.graphics.drawable.GradientDrawable;\nimport android.graphics.drawable.GradientDrawable.Orientation;\nimport android.os.Parcelable;\nimport android.util.AttributeSet;\nimport android.view.MotionEvent;\nimport android.view.SoundEffectConstants;\nimport android.view.View;\nimport android.view.ViewConfiguration;\nimport android.view.accessibility.AccessibilityEvent;\nimport android.widget.AbsListView;\nimport android.widget.HeaderViewListAdapter;\nimport android.widget.ListAdapter;\nimport android.widget.ListView;\nimport android.widget.SectionIndexer;\n\nimport com.github.mzule.androidweekly.BuildConfig;\n\n\n/**\n * ListView, which is capable to pin section views at its top while the rest is still scrolled.\n */\npublic class PinnedSectionListView extends ListView {\n\n    //-- inner classes\n\n    // fields used for handling touch events\n    private final Rect mTouchRect = new Rect();\n    private final PointF mTouchPoint = new PointF();\n\n    //-- class fields\n    /**\n     * Delegating listener, can be null.\n     */\n    OnScrollListener mDelegateOnScrollListener;\n    /**\n     * Shadow for being recycled, can be null.\n     */\n    PinnedSection mRecycleSection;\n    /**\n     * shadow instance with a pinned view, can be null.\n     */\n    PinnedSection mPinnedSection;\n    /**\n     * Pinned view Y-translation. We use it to stick pinned view to the next section.\n     */\n    int mTranslateY;\n    private int mTouchSlop;\n    private View mTouchTarget;\n    private MotionEvent mDownEvent;\n    // fields used for drawing shadow under a pinned section\n    private GradientDrawable mShadowDrawable;\n    private int mSectionsDistanceY;\n    /**\n     * Scroll listener which does the magic\n     */\n    private final OnScrollListener mOnScrollListener = new OnScrollListener() {\n\n        @Override\n        public void onScrollStateChanged(AbsListView view, int scrollState) {\n            if (mDelegateOnScrollListener != null) { // delegate\n                mDelegateOnScrollListener.onScrollStateChanged(view, scrollState);\n            }\n        }\n\n        @Override\n        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {\n\n            if (mDelegateOnScrollListener != null) { // delegate\n                mDelegateOnScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);\n            }\n\n            // get expected adapter or fail fast\n            ListAdapter adapter = getAdapter();\n            if (adapter == null || visibleItemCount == 0) return; // nothing to do\n\n            final boolean isFirstVisibleItemSection =\n                    isItemViewTypePinned(adapter, adapter.getItemViewType(firstVisibleItem));\n\n            if (isFirstVisibleItemSection) {\n                View sectionView = getChildAt(0);\n                if (sectionView.getTop() == getPaddingTop()) { // view sticks to the top, no need for pinned shadow\n                    destroyPinnedShadow();\n                } else { // section doesn't stick to the top, make sure we have a pinned shadow\n                    ensureShadowForPosition(firstVisibleItem, firstVisibleItem, visibleItemCount);\n                }\n\n            } else { // section is not at the first visible position\n                int sectionPosition = findCurrentSectionPosition(firstVisibleItem);\n                if (sectionPosition > -1) { // we have section position\n                    ensureShadowForPosition(sectionPosition, firstVisibleItem, visibleItemCount);\n                } else { // there is no section for the first visible item, destroy shadow\n                    destroyPinnedShadow();\n                }\n            }\n        }\n\n        ;\n\n    };\n    /**\n     * Default change observer.\n     */\n    private final DataSetObserver mDataSetObserver = new DataSetObserver() {\n        @Override\n        public void onChanged() {\n            recreatePinnedShadow();\n        }\n\n        ;\n\n        @Override\n        public void onInvalidated() {\n            recreatePinnedShadow();\n        }\n    };\n    private int mShadowHeight;\n\n    public PinnedSectionListView(Context context, AttributeSet attrs) {\n        super(context, attrs);\n        initView();\n    }\n\n    public PinnedSectionListView(Context context, AttributeSet attrs, int defStyle) {\n        super(context, attrs, defStyle);\n        initView();\n    }\n\n    //-- constructors\n\n    public static boolean isItemViewTypePinned(ListAdapter adapter, int viewType) {\n        if (adapter instanceof HeaderViewListAdapter) {\n            adapter = ((HeaderViewListAdapter) adapter).getWrappedAdapter();\n        }\n        return ((PinnedSectionListAdapter) adapter).isItemViewTypePinned(viewType);\n    }\n\n    private void initView() {\n        setOnScrollListener(mOnScrollListener);\n        mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();\n        initShadow(false);\n    }\n\n    public void setShadowVisible(boolean visible) {\n        initShadow(visible);\n        if (mPinnedSection != null) {\n            View v = mPinnedSection.view;\n            invalidate(v.getLeft(), v.getTop(), v.getRight(), v.getBottom() + mShadowHeight);\n        }\n    }\n\n    //-- public API methods\n\n    public void initShadow(boolean visible) {\n        if (visible) {\n            if (mShadowDrawable == null) {\n                mShadowDrawable = new GradientDrawable(Orientation.TOP_BOTTOM,\n                        new int[]{Color.parseColor(\"#ffa0a0a0\"), Color.parseColor(\"#50a0a0a0\"), Color.parseColor(\"#00a0a0a0\")});\n                mShadowHeight = (int) (8 * getResources().getDisplayMetrics().density);\n            }\n        } else {\n            if (mShadowDrawable != null) {\n                mShadowDrawable = null;\n                mShadowHeight = 0;\n            }\n        }\n    }\n\n    //-- pinned section drawing methods\n\n    /**\n     * Create shadow wrapper with a pinned view for a view at given position\n     */\n    void createPinnedShadow(int position) {\n\n        // try to recycle shadow\n        PinnedSection pinnedShadow = mRecycleSection;\n        mRecycleSection = null;\n\n        // create new shadow, if needed\n        if (pinnedShadow == null) pinnedShadow = new PinnedSection();\n        // request new view using recycled view, if such\n        View pinnedView = getAdapter().getView(position, pinnedShadow.view, PinnedSectionListView.this);\n\n        // read layout parameters\n        LayoutParams layoutParams = (LayoutParams) pinnedView.getLayoutParams();\n        if (layoutParams == null) {\n            layoutParams = (LayoutParams) generateDefaultLayoutParams();\n            pinnedView.setLayoutParams(layoutParams);\n        }\n\n        int heightMode = MeasureSpec.getMode(layoutParams.height);\n        int heightSize = MeasureSpec.getSize(layoutParams.height);\n\n        if (heightMode == MeasureSpec.UNSPECIFIED) heightMode = MeasureSpec.EXACTLY;\n\n        int maxHeight = getHeight() - getListPaddingTop() - getListPaddingBottom();\n        if (heightSize > maxHeight) heightSize = maxHeight;\n\n        // measure & layout\n        int ws = MeasureSpec.makeMeasureSpec(getWidth() - getListPaddingLeft() - getListPaddingRight(), MeasureSpec.EXACTLY);\n        int hs = MeasureSpec.makeMeasureSpec(heightSize, heightMode);\n        pinnedView.measure(ws, hs);\n        pinnedView.layout(0, 0, pinnedView.getMeasuredWidth(), pinnedView.getMeasuredHeight());\n        mTranslateY = 0;\n\n        // initialize pinned shadow\n        pinnedShadow.view = pinnedView;\n        pinnedShadow.position = position;\n        pinnedShadow.id = getAdapter().getItemId(position);\n\n        // store pinned shadow\n        mPinnedSection = pinnedShadow;\n    }\n\n    /**\n     * Destroy shadow wrapper for currently pinned view\n     */\n    void destroyPinnedShadow() {\n        if (mPinnedSection != null) {\n            // keep shadow for being recycled later\n            mRecycleSection = mPinnedSection;\n            mPinnedSection = null;\n        }\n    }\n\n    /**\n     * Makes sure we have an actual pinned shadow for given position.\n     */\n    void ensureShadowForPosition(int sectionPosition, int firstVisibleItem, int visibleItemCount) {\n        if (visibleItemCount < 2) { // no need for creating shadow at all, we have a single visible item\n            destroyPinnedShadow();\n            return;\n        }\n\n        if (mPinnedSection != null\n                && mPinnedSection.position != sectionPosition) { // invalidate shadow, if required\n            destroyPinnedShadow();\n        }\n\n        if (mPinnedSection == null) { // create shadow, if empty\n            createPinnedShadow(sectionPosition);\n        }\n\n        // align shadow according to next section position, if needed\n        int nextPosition = sectionPosition + 1;\n        if (nextPosition < getCount()) {\n            int nextSectionPosition = findFirstVisibleSectionPosition(nextPosition,\n                    visibleItemCount - (nextPosition - firstVisibleItem));\n            if (nextSectionPosition > -1) {\n                View nextSectionView = getChildAt(nextSectionPosition - firstVisibleItem);\n                final int bottom = mPinnedSection.view.getBottom() + getPaddingTop();\n                mSectionsDistanceY = nextSectionView.getTop() - bottom;\n                if (mSectionsDistanceY < 0) {\n                    // next section overlaps pinned shadow, move it up\n                    mTranslateY = mSectionsDistanceY;\n                } else {\n                    // next section does not overlap with pinned, stick to top\n                    mTranslateY = 0;\n                }\n            } else {\n                // no other sections are visible, stick to top\n                mTranslateY = 0;\n                mSectionsDistanceY = Integer.MAX_VALUE;\n            }\n        }\n\n    }\n\n    int findFirstVisibleSectionPosition(int firstVisibleItem, int visibleItemCount) {\n        ListAdapter adapter = getAdapter();\n\n        int adapterDataCount = adapter.getCount();\n        if (getLastVisiblePosition() >= adapterDataCount)\n            return -1; // dataset has changed, no candidate\n\n        if (firstVisibleItem + visibleItemCount >= adapterDataCount) {//added to prevent index Outofbound (in case)\n            visibleItemCount = adapterDataCount - firstVisibleItem;\n        }\n\n        for (int childIndex = 0; childIndex < visibleItemCount; childIndex++) {\n            int position = firstVisibleItem + childIndex;\n            int viewType = adapter.getItemViewType(position);\n            if (isItemViewTypePinned(adapter, viewType)) return position;\n        }\n        return -1;\n    }\n\n    int findCurrentSectionPosition(int fromPosition) {\n        ListAdapter adapter = getAdapter();\n\n        if (fromPosition >= adapter.getCount()) return -1; // dataset has changed, no candidate\n\n        if (adapter instanceof SectionIndexer) {\n            // try fast way by asking section indexer\n            SectionIndexer indexer = (SectionIndexer) adapter;\n            int sectionPosition = indexer.getSectionForPosition(fromPosition);\n            int itemPosition = indexer.getPositionForSection(sectionPosition);\n            int typeView = adapter.getItemViewType(itemPosition);\n            if (isItemViewTypePinned(adapter, typeView)) {\n                return itemPosition;\n            } // else, no luck\n        }\n\n        // try slow way by looking through to the next section item above\n        for (int position = fromPosition; position >= 0; position--) {\n            int viewType = adapter.getItemViewType(position);\n            if (isItemViewTypePinned(adapter, viewType)) return position;\n        }\n        return -1; // no candidate found\n    }\n\n    void recreatePinnedShadow() {\n        destroyPinnedShadow();\n        ListAdapter adapter = getAdapter();\n        if (adapter != null && adapter.getCount() > 0) {\n            int firstVisiblePosition = getFirstVisiblePosition();\n            int sectionPosition = findCurrentSectionPosition(firstVisiblePosition);\n            if (sectionPosition == -1) return; // no views to pin, exit\n            ensureShadowForPosition(sectionPosition,\n                    firstVisiblePosition, getLastVisiblePosition() - firstVisiblePosition);\n        }\n    }\n\n    @Override\n    public void setOnScrollListener(OnScrollListener listener) {\n        if (listener == mOnScrollListener) {\n            super.setOnScrollListener(listener);\n        } else {\n            mDelegateOnScrollListener = listener;\n        }\n    }\n\n    @Override\n    public void onRestoreInstanceState(Parcelable state) {\n        super.onRestoreInstanceState(state);\n        post(new Runnable() {\n            @Override\n            public void run() { // restore pinned view after configuration change\n                recreatePinnedShadow();\n            }\n        });\n    }\n\n    @Override\n    public void setAdapter(ListAdapter adapter) {\n\n        // assert adapter in debug mode\n        if (BuildConfig.DEBUG && adapter != null) {\n            if (!(adapter instanceof PinnedSectionListAdapter))\n                throw new IllegalArgumentException(\"Does your adapter implement PinnedSectionListAdapter?\");\n            if (adapter.getViewTypeCount() < 2)\n                throw new IllegalArgumentException(\"Does your adapter handle at least two types\" +\n                        \" of views in getViewTypeCount() method: items and sections?\");\n        }\n\n        // unregister observer at old adapter and register on new one\n        ListAdapter oldAdapter = getAdapter();\n        if (oldAdapter != null) oldAdapter.unregisterDataSetObserver(mDataSetObserver);\n        if (adapter != null) adapter.registerDataSetObserver(mDataSetObserver);\n\n        // destroy pinned shadow, if new adapter is not same as old one\n        if (oldAdapter != adapter) destroyPinnedShadow();\n\n        super.setAdapter(adapter);\n    }\n\n    @Override\n    protected void onLayout(boolean changed, int l, int t, int r, int b) {\n        super.onLayout(changed, l, t, r, b);\n        if (mPinnedSection != null) {\n            int parentWidth = r - l - getPaddingLeft() - getPaddingRight();\n            int shadowWidth = mPinnedSection.view.getWidth();\n            if (parentWidth != shadowWidth) {\n                recreatePinnedShadow();\n            }\n        }\n    }\n\n    @Override\n    protected void dispatchDraw(Canvas canvas) {\n        super.dispatchDraw(canvas);\n\n        if (mPinnedSection != null) {\n\n            // prepare variables\n            int pLeft = getListPaddingLeft();\n            int pTop = getListPaddingTop();\n            View view = mPinnedSection.view;\n\n            // draw child\n            canvas.save();\n\n            int clipHeight = view.getHeight() +\n                    (mShadowDrawable == null ? 0 : Math.min(mShadowHeight, mSectionsDistanceY));\n            canvas.clipRect(pLeft, pTop, pLeft + view.getWidth(), pTop + clipHeight);\n\n            canvas.translate(pLeft, pTop + mTranslateY);\n            drawChild(canvas, mPinnedSection.view, getDrawingTime());\n\n            if (mShadowDrawable != null && mSectionsDistanceY > 0) {\n                mShadowDrawable.setBounds(mPinnedSection.view.getLeft(),\n                        mPinnedSection.view.getBottom(),\n                        mPinnedSection.view.getRight(),\n                        mPinnedSection.view.getBottom() + mShadowHeight);\n                mShadowDrawable.draw(canvas);\n            }\n\n            canvas.restore();\n        }\n    }\n\n    @Override\n    public boolean dispatchTouchEvent(MotionEvent ev) {\n\n        final float x = ev.getX();\n        final float y = ev.getY();\n        final int action = ev.getAction();\n\n        if (action == MotionEvent.ACTION_DOWN\n                && mTouchTarget == null\n                && mPinnedSection != null\n                && isPinnedViewTouched(mPinnedSection.view, x, y)) { // create touch target\n\n            // user touched pinned view\n            mTouchTarget = mPinnedSection.view;\n            mTouchPoint.x = x;\n            mTouchPoint.y = y;\n\n            // copy down event for eventually be used later\n            mDownEvent = MotionEvent.obtain(ev);\n        }\n\n        if (mTouchTarget != null) {\n            if (isPinnedViewTouched(mTouchTarget, x, y)) { // forward event to pinned view\n                mTouchTarget.dispatchTouchEvent(ev);\n            }\n\n            if (action == MotionEvent.ACTION_UP) { // perform onClick on pinned view\n                super.dispatchTouchEvent(ev);\n                performPinnedItemClick();\n                clearTouchTarget();\n\n            } else if (action == MotionEvent.ACTION_CANCEL) { // cancel\n                clearTouchTarget();\n\n            } else if (action == MotionEvent.ACTION_MOVE) {\n                if (Math.abs(y - mTouchPoint.y) > mTouchSlop) {\n\n                    // cancel sequence on touch target\n                    MotionEvent event = MotionEvent.obtain(ev);\n                    event.setAction(MotionEvent.ACTION_CANCEL);\n                    mTouchTarget.dispatchTouchEvent(event);\n                    event.recycle();\n\n                    // provide correct sequence to super class for further handling\n                    super.dispatchTouchEvent(mDownEvent);\n                    super.dispatchTouchEvent(ev);\n                    clearTouchTarget();\n\n                }\n            }\n\n            return true;\n        }\n\n        // call super if this was not our pinned view\n        return super.dispatchTouchEvent(ev);\n    }\n\n    //-- touch handling methods\n\n    private boolean isPinnedViewTouched(View view, float x, float y) {\n        view.getHitRect(mTouchRect);\n\n        // by taping top or bottom padding, the list performs on click on a border item.\n        // we don't add top padding here to keep behavior consistent.\n        mTouchRect.top += mTranslateY;\n\n        mTouchRect.bottom += mTranslateY + getPaddingTop();\n        mTouchRect.left += getPaddingLeft();\n        mTouchRect.right -= getPaddingRight();\n        return mTouchRect.contains((int) x, (int) y);\n    }\n\n    private void clearTouchTarget() {\n        mTouchTarget = null;\n        if (mDownEvent != null) {\n            mDownEvent.recycle();\n            mDownEvent = null;\n        }\n    }\n\n    private boolean performPinnedItemClick() {\n        if (mPinnedSection == null) return false;\n\n        OnItemClickListener listener = getOnItemClickListener();\n        if (listener != null && getAdapter().isEnabled(mPinnedSection.position)) {\n            View view = mPinnedSection.view;\n            playSoundEffect(SoundEffectConstants.CLICK);\n            if (view != null) {\n                view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);\n            }\n            listener.onItemClick(this, view, mPinnedSection.position, mPinnedSection.id);\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * List adapter to be implemented for being used with PinnedSectionListView adapter.\n     */\n    public static interface PinnedSectionListAdapter extends ListAdapter {\n        /**\n         * This method shall return 'true' if views of given type has to be pinned.\n         */\n        boolean isItemViewTypePinned(int viewType);\n    }\n\n    /**\n     * Wrapper class for pinned section view and its position in the list.\n     */\n    static class PinnedSection {\n        public View view;\n        public int position;\n        public long id;\n    }\n\n}"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/view/PopupView.java",
    "content": "package com.github.mzule.androidweekly.ui.view;\n\nimport android.animation.Animator;\nimport android.animation.AnimatorListenerAdapter;\nimport android.animation.ObjectAnimator;\nimport android.app.Activity;\nimport android.content.Context;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.view.animation.AccelerateInterpolator;\nimport android.widget.FrameLayout;\n\nimport com.github.mzule.androidweekly.R;\nimport com.github.mzule.androidweekly.ui.view.base.BaseRelativeLayout;\n\n\n/**\n * Created by CaoDongping on 11/30/15.\n */\npublic abstract class PopupView<T> extends BaseRelativeLayout {\n    public static final int ANIMATION_DIRECTION_BOTTOM_TO_TOP = 0;\n    public static final int ANIMATION_DIRECTION_TOP_TO_BOTTOM = 1;\n    public static final int ANIMATION_DIRECTION_LEFT_TO_RIGHT = 2;\n    public static final int ANIMATION_DIRECTION_RIGHT_TO_LEFT = 3;\n    public static final int ANIMATE_DURATION = 200;\n    private boolean inAnimation;\n\n    public PopupView(Context context) {\n        super(context, null, 0);\n    }\n\n    /**\n     * 显示到Activity上面去\n     *\n     * @param activity\n     * @param data\n     * @return\n     */\n    public PopupView<T> attachTo(Activity activity, T data) {\n        FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);\n        return attachTo(activity, data, lp);\n    }\n\n    /**\n     * 显示到Activity上面去\n     *\n     * @param activity\n     * @param data\n     * @param layoutParams\n     * @return\n     */\n    public PopupView<T> attachTo(Activity activity, T data, FrameLayout.LayoutParams layoutParams) {\n        setId(R.id.popup_view_id);\n        ViewGroup contentView = (ViewGroup) activity.findViewById(android.R.id.content);\n        if (null != contentView.findViewById(R.id.popup_view_id)) {\n            return this;\n        }\n        render(data);\n        contentView.addView(this, layoutParams);\n        animateIn();\n        return this;\n    }\n\n    protected int getAnimationDirection() {\n        return ANIMATION_DIRECTION_BOTTOM_TO_TOP;\n    }\n\n    /**\n     * 动画显示\n     */\n    protected void animateIn() {\n        if (inAnimation) {\n            return;\n        }\n        setVisibility(INVISIBLE);\n        inAnimation = true;\n        post(new Runnable() {\n            @Override\n            public void run() {\n                setVisibility(VISIBLE);\n                ObjectAnimator alpha = ObjectAnimator.ofFloat(getMaskView(), \"alpha\", 0, 1);\n                alpha.setDuration(ANIMATE_DURATION);\n                alpha.start();\n                int measuredHeight = getMainView().getMeasuredHeight();\n                int measuredWidth = getMainView().getMeasuredWidth();\n                ObjectAnimator translate;\n                switch (getAnimationDirection()) {\n                    case ANIMATION_DIRECTION_BOTTOM_TO_TOP:\n                        translate = ObjectAnimator.ofFloat(getMainView(), \"translationY\", measuredHeight, 0);\n                        break;\n                    case ANIMATION_DIRECTION_TOP_TO_BOTTOM:\n                        translate = ObjectAnimator.ofFloat(getMainView(), \"translationY\", -measuredHeight, 0);\n                        break;\n                    case ANIMATION_DIRECTION_LEFT_TO_RIGHT:\n                        translate = ObjectAnimator.ofFloat(getMainView(), \"translationX\", -measuredWidth, 0);\n                        break;\n                    case ANIMATION_DIRECTION_RIGHT_TO_LEFT:\n                        translate = ObjectAnimator.ofFloat(getMainView(), \"translationX\", measuredWidth, 0);\n                        break;\n                    default:\n                        throw new RuntimeException(\"unknown animation direction\");\n                }\n                translate.setInterpolator(new AccelerateInterpolator());\n                translate.setDuration(ANIMATE_DURATION);\n                translate.start();\n                translate.addListener(new AnimatorListenerAdapter() {\n                    @Override\n                    public void onAnimationEnd(Animator animation) {\n                        inAnimation = false;\n                    }\n                });\n            }\n        });\n    }\n\n    public void finish() {\n        finish(null);\n    }\n\n    /**\n     * 从当前Activity上移除\n     */\n    public void finish(final FinishCallback callback) {\n        if (!inAnimation) {\n            inAnimation = true;\n            ObjectAnimator alpha = ObjectAnimator.ofFloat(getMainView(), \"alpha\", 1, 0);\n            alpha.setDuration(ANIMATE_DURATION);\n            alpha.start();\n            int measuredHeight = getMainView().getMeasuredHeight();\n            int measuredWidth = getMainView().getMeasuredWidth();\n            ObjectAnimator translate;\n            switch (getAnimationDirection()) {\n                case ANIMATION_DIRECTION_BOTTOM_TO_TOP:\n                    translate = ObjectAnimator.ofFloat(getMainView(), \"translationY\", 0, measuredHeight);\n                    break;\n                case ANIMATION_DIRECTION_TOP_TO_BOTTOM:\n                    translate = ObjectAnimator.ofFloat(getMainView(), \"translationY\", 0, -measuredHeight);\n                    break;\n                case ANIMATION_DIRECTION_LEFT_TO_RIGHT:\n                    translate = ObjectAnimator.ofFloat(getMainView(), \"translationX\", 0, -measuredWidth);\n                    break;\n                case ANIMATION_DIRECTION_RIGHT_TO_LEFT:\n                    translate = ObjectAnimator.ofFloat(getMainView(), \"translationX\", 0, measuredWidth);\n                    break;\n                default:\n                    throw new RuntimeException(\"unknown animation direction\");\n            }\n            translate.setInterpolator(new AccelerateInterpolator());\n            translate.setDuration(ANIMATE_DURATION);\n            translate.start();\n            translate.addListener(new AnimatorListenerAdapter() {\n                @Override\n                public void onAnimationEnd(Animator animation) {\n                    if (getParent() instanceof ViewGroup) {\n                        ((ViewGroup) getParent()).removeView(PopupView.this);\n                    }\n                    inAnimation = false;\n                    if (callback != null) {\n                        callback.afterFinish();\n                    }\n                }\n            });\n        }\n    }\n\n    /**\n     * 渲染数据到UI\n     *\n     * @param data\n     */\n    protected abstract void render(T data);\n\n    /**\n     * 获取需要fadeIn显示的遮罩视图\n     *\n     * @return\n     */\n    protected abstract View getMaskView();\n\n\n    /**\n     * 获取需要translation的主UI视图\n     *\n     * @return\n     */\n    protected abstract View getMainView();\n\n    public interface FinishCallback {\n        void afterFinish();\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/view/ProgressView.java",
    "content": "package com.github.mzule.androidweekly.ui.view;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.view.View;\nimport android.view.ViewGroup;\n\nimport com.github.mzule.androidweekly.R;\nimport com.github.mzule.androidweekly.util.DensityUtil;\nimport com.pnikosis.materialishprogress.ProgressWheel;\n\n\n/**\n * Created by CaoDongping on 1/5/16.\n */\npublic class ProgressView extends ProgressWheel {\n    public ProgressView(Context context, AttributeSet attrs) {\n        super(context, attrs);\n        init();\n    }\n\n    public ProgressView(Context context) {\n        super(context);\n        init();\n    }\n\n    private void init() {\n        if (isInEditMode()) {\n            return;\n        }\n        setBarColor(getResources().getColor(R.color.colorPrimary));\n        setBarWidth(DensityUtil.dp2px(2));\n        spin();\n    }\n\n    public void start() {\n        setVisibility(VISIBLE);\n    }\n\n    public void stop() {\n        setVisibility(View.GONE);\n    }\n\n    @Override\n    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {\n        if (!isInEditMode() && getLayoutParams().width == ViewGroup.LayoutParams.WRAP_CONTENT && getLayoutParams().height == ViewGroup.LayoutParams.WRAP_CONTENT) {\n            super.onMeasure(DensityUtil.dp2px(40), DensityUtil.dp2px(40));\n        } else {\n            super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/view/TintStatusBar.java",
    "content": "package com.github.mzule.androidweekly.ui.view;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.view.View;\nimport android.view.ViewGroup;\n\nimport com.github.mzule.androidweekly.util.Tinter;\n\n/**\n * 占位符View,在支持Tint的设备上,高度为信号栏的高度,在不支持Tint的设备上,高度为0,可以用来作为UI布局的占位符\n * Created by CaoDongping on 11/11/15.\n */\npublic class TintStatusBar extends View {\n    private int statusBarHeight;\n\n    public TintStatusBar(Context context) {\n        super(context);\n        init();\n    }\n\n    public TintStatusBar(Context context, AttributeSet attrs) {\n        super(context, attrs);\n        init();\n    }\n\n    public TintStatusBar(Context context, AttributeSet attrs, int defStyleAttr) {\n        super(context, attrs, defStyleAttr);\n        init();\n    }\n\n    public void init() {\n        statusBarHeight = getStatusBarHeight();\n    }\n\n    @Override\n    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {\n        if (getLayoutParams().height == ViewGroup.LayoutParams.WRAP_CONTENT) {\n            int height = 0;\n            if (Tinter.isSupport()) {\n                height = statusBarHeight;\n            }\n            heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);\n        }\n        super.onMeasure(widthMeasureSpec, heightMeasureSpec);\n    }\n\n    public int getStatusBarHeight() {\n        int result = 0;\n        int resourceId = getResources().getIdentifier(\"status_bar_height\", \"dimen\", \"android\");\n        if (resourceId > 0) {\n            result = getResources().getDimensionPixelSize(resourceId);\n        }\n        return result;\n    }\n\n    public void setHeightPercent(float percent) {\n        ViewGroup.LayoutParams lp = getLayoutParams();\n        lp.height = (int) (statusBarHeight * percent);\n        setLayoutParams(lp);\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/view/TranslateView.java",
    "content": "package com.github.mzule.androidweekly.ui.view;\n\nimport android.app.Activity;\nimport android.content.ClipData;\nimport android.content.ClipboardManager;\nimport android.content.Context;\nimport android.support.annotation.Nullable;\nimport android.text.TextUtils;\nimport android.util.Log;\nimport android.view.View;\nimport android.widget.EditText;\n\nimport com.github.mzule.androidweekly.R;\nimport com.github.mzule.androidweekly.api.ApiCallback;\nimport com.github.mzule.androidweekly.api.DictionaryApi;\nimport com.github.mzule.androidweekly.entity.Dict;\nimport com.github.mzule.androidweekly.util.Keyboard;\nimport com.github.mzule.layoutannotation.Layout;\n\nimport butterknife.Bind;\nimport butterknife.OnClick;\n\n/**\n * Created by CaoDongping on 3/30/16.\n */\n@Layout(R.layout.view_translate)\npublic class TranslateView extends PopupView<Void> {\n    @Bind(R.id.queryInput)\n    EditText queryInput;\n    @Bind(R.id.resultView)\n    EditText resultView;\n    @Bind(R.id.buttonPanel)\n    View buttonPanel;\n\n    public TranslateView(Context context) {\n        super(context);\n    }\n\n    @OnClick(R.id.maskView)\n    @Override\n    public void finish() {\n        super.finish();\n        hideKeyboard();\n    }\n\n    private void hideKeyboard() {\n        if (getContext() instanceof Activity) {\n            Keyboard.hide((Activity) getContext());\n        }\n    }\n\n    @OnClick(R.id.clearButton)\n    void clear() {\n        queryInput.setText(\"\");\n        resultView.setText(\"\");\n        queryInput.requestFocus();\n        Keyboard.show(getContext());\n    }\n\n    @OnClick(R.id.translateButton)\n    void translate() {\n        new DictionaryApi().look(queryInput.getText().toString().toLowerCase(), new ApiCallback<Dict>() {\n            @Override\n            public void onSuccess(Dict data, boolean fromCache) {\n                resultView.setText(data.getContent());\n                resultView.setSelection(0);\n                hideKeyboard();\n                updateResultViewMaxHeight();\n            }\n\n            @Override\n            public void onFailure(Exception e) {\n                resultView.setText(Log.getStackTraceString(e));\n            }\n        });\n    }\n\n    @Override\n    protected void render(Void data) {\n        String paste = getPasteText();\n        queryInput.requestFocus();\n        if (!TextUtils.isEmpty(paste)) {\n            queryInput.setText(paste);\n            queryInput.setSelection(paste.length());\n            translate();\n        }\n    }\n\n    private void updateResultViewMaxHeight() {\n        int height = getResources().getDisplayMetrics().heightPixels;\n        resultView.setMaxHeight(height - queryInput.getBottom() - buttonPanel.getMeasuredHeight() - queryInput.getPaddingLeft());\n    }\n\n    @Nullable\n    private String getPasteText() {\n        String paste = null;\n        ClipboardManager manager = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);\n        ClipData clip = manager.getPrimaryClip();\n        if (clip != null && clip.getItemCount() > 0 && clip.getItemAt(0) != null) {\n            CharSequence text = clip.getItemAt(0).getText();\n            paste = text == null ? \"\" : text.toString();\n        }\n        return paste;\n    }\n\n    @Override\n    protected View getMaskView() {\n        return findViewById(R.id.maskView);\n    }\n\n    @Override\n    protected View getMainView() {\n        return findViewById(R.id.mainView);\n    }\n\n    @Override\n    protected int getAnimationDirection() {\n        return ANIMATION_DIRECTION_TOP_TO_BOTTOM;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/view/base/BaseLinearLayout.java",
    "content": "package com.github.mzule.androidweekly.ui.view.base;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.widget.LinearLayout;\n\nimport com.github.mzule.layoutannotation.LayoutBinder;\n\nimport butterknife.ButterKnife;\n\n/**\n * Created by CaoDongping on 8/30/16.\n */\n\npublic class BaseLinearLayout extends LinearLayout {\n\n    public BaseLinearLayout(Context context) {\n        super(context);\n        init(context, null);\n    }\n\n    public BaseLinearLayout(Context context, AttributeSet attrs) {\n        super(context, attrs);\n        init(context, attrs);\n    }\n\n    public BaseLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) {\n        super(context, attrs, defStyleAttr);\n        init(context, attrs);\n    }\n\n    protected void init(Context context, AttributeSet attrs) {\n        LayoutBinder.bind(this);\n        ButterKnife.bind(this);\n    }\n\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/view/base/BaseRelativeLayout.java",
    "content": "package com.github.mzule.androidweekly.ui.view.base;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.widget.RelativeLayout;\n\nimport com.github.mzule.layoutannotation.LayoutBinder;\n\nimport butterknife.ButterKnife;\n\n/**\n * Created by CaoDongping on 8/30/16.\n */\n\npublic class BaseRelativeLayout extends RelativeLayout {\n\n    public BaseRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) {\n        super(context, attrs, defStyleAttr);\n        init();\n    }\n\n    private void init() {\n        LayoutBinder.bind(this);\n        ButterKnife.bind(this);\n    }\n\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/viewtype/ArticleViewType.java",
    "content": "package com.github.mzule.androidweekly.ui.viewtype;\n\nimport android.text.TextUtils;\nimport android.view.View;\nimport android.widget.ImageView;\nimport android.widget.TextView;\n\nimport com.bumptech.glide.Glide;\nimport com.github.mzule.androidweekly.R;\nimport com.github.mzule.androidweekly.entity.Article;\nimport com.github.mzule.layoutannotation.Layout;\n\nimport butterknife.Bind;\n\n/**\n * Created by CaoDongping on 3/24/16.\n */\n@Layout(R.layout.item_article)\npublic class ArticleViewType extends BaseViewType<Article> {\n    @Bind(R.id.nameView)\n    TextView nameView;\n    @Bind(R.id.briefView)\n    TextView briefView;\n    @Bind(R.id.domainView)\n    TextView domainView;\n    @Bind(R.id.iconView)\n    ImageView iconView;\n\n    @Override\n    public void onRender(int position, Article data) {\n        nameView.setText(data.getTitle());\n        briefView.setText(data.getBrief());\n        domainView.setText(data.getDomain());\n        Glide.with(getContext()).load(data.getImageUrl()).centerCrop().placeholder(R.color.placeholder).into(iconView);\n        iconView.setVisibility(TextUtils.isEmpty(data.getImageUrl()) ? View.GONE : View.VISIBLE);\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/viewtype/BaseViewType.java",
    "content": "/*\n * Copyright (C) 2016 Baidu, Inc. All Rights Reserved.\n */\npackage com.github.mzule.androidweekly.ui.viewtype;\n\nimport com.github.mzule.easyadapter.ViewType;\nimport com.github.mzule.layoutannotation.LayoutBinder;\n\nimport butterknife.ButterKnife;\n\n/**\n * Created by CaoDongping on 8/29/16.\n */\n\npublic abstract class BaseViewType<T> extends ViewType<T> {\n    @Override\n    public void onCreate() {\n        setContentView(LayoutBinder.inflate(getContext(), this));\n        ButterKnife.bind(this, getView());\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/viewtype/SearchHistoryViewType.java",
    "content": "package com.github.mzule.androidweekly.ui.viewtype;\n\nimport android.widget.TextView;\n\nimport com.github.mzule.androidweekly.R;\nimport com.github.mzule.layoutannotation.Layout;\n\nimport butterknife.Bind;\n\n/**\n * Created by CaoDongping on 4/5/16.\n */\n@Layout(R.layout.item_search_history)\npublic class SearchHistoryViewType extends BaseViewType<String> {\n    @Bind(R.id.textView)\n    TextView textView;\n\n    @Override\n    public void onRender(int position, String data) {\n        textView.setText(data);\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/viewtype/SectionViewType.java",
    "content": "package com.github.mzule.androidweekly.ui.viewtype;\n\nimport android.widget.TextView;\n\nimport com.github.mzule.androidweekly.R;\nimport com.github.mzule.layoutannotation.Layout;\n\nimport butterknife.Bind;\n\n/**\n * Created by CaoDongping on 3/24/16.\n */\n@Layout(R.layout.item_section)\npublic class SectionViewType extends BaseViewType<String> {\n    @Bind(R.id.sectionName)\n    TextView sectionName;\n\n    @Override\n    public void onRender(int position, String data) {\n        sectionName.setText(data);\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/ui/viewtype/SlideIssueViewType.java",
    "content": "package com.github.mzule.androidweekly.ui.viewtype;\n\nimport android.view.View;\nimport android.widget.TextView;\n\nimport com.github.mzule.androidweekly.R;\nimport com.github.mzule.androidweekly.entity.Issue;\nimport com.github.mzule.layoutannotation.Layout;\n\nimport butterknife.Bind;\n\n/**\n * Created by CaoDongping on 3/25/16.\n */\n@Layout(R.layout.item_slide_issue)\npublic class SlideIssueViewType extends BaseViewType<Issue> {\n    @Bind(R.id.nameView)\n    TextView nameView;\n    @Bind(R.id.dateView)\n    TextView dateView;\n    @Bind(R.id.rootLayout)\n    View rootLayout;\n\n    @Override\n    public void onRender(int position, Issue data) {\n        nameView.setText(data.getName());\n        nameView.setSelected(data.isActive());\n        dateView.setText(data.getDate());\n        dateView.setSelected(data.isActive());\n        int color = getContext().getResources().getColor(data.isActive() ? R.color.colorPrimary : R.color.transparent);\n        rootLayout.setBackgroundColor(color);\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/util/DateUtil.java",
    "content": "package com.github.mzule.androidweekly.util;\n\nimport android.annotation.SuppressLint;\n\nimport java.text.DateFormat;\nimport java.text.SimpleDateFormat;\n\n/**\n * Created by CaoDongping on 3/28/16.\n */\npublic class DateUtil {\n    @SuppressLint(\"SimpleDateFormat\")\n    private static final DateFormat format = new SimpleDateFormat(\"yyyy-MM-dd\");\n\n    public static String format(long time) {\n        return format.format(time);\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/util/DensityUtil.java",
    "content": "package com.github.mzule.androidweekly.util;\n\n\nimport com.github.mzule.androidweekly.App;\n\n/**\n * Created by CaoDongping on 11/4/15.\n */\npublic class DensityUtil {\n    public static int dp2px(float dp) {\n        float density = App.getInstance().getResources().getDisplayMetrics().density;\n        return (int) (dp * density + 0.5f);\n    }\n\n    public static float px2dp(float px) {\n        float density = App.getInstance().getResources().getDisplayMetrics().density;\n        return px / density;\n    }\n\n    public static int screenWidth() {\n        return App.getInstance().getResources().getDisplayMetrics().widthPixels;\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/util/DictParser.java",
    "content": "package com.github.mzule.androidweekly.util;\n\nimport android.util.Xml;\n\nimport com.github.mzule.androidweekly.entity.Dict;\n\nimport org.xmlpull.v1.XmlPullParser;\nimport org.xmlpull.v1.XmlPullParserException;\n\nimport java.io.IOException;\nimport java.net.URL;\n\n/**\n * Created by CaoDongping on 3/31/16.\n */\npublic class DictParser {\n    private Dict dict;\n    private String url;\n\n    public DictParser(String url) {\n        this.url = url;\n    }\n\n    public Dict parse() throws IOException, XmlPullParserException {\n        XmlPullParser parser = Xml.newPullParser();\n        parser.setInput(new URL(url).openStream(), null);\n        parser.nextTag();\n        dict = new Dict();\n        readDict(parser);\n        return dict;\n    }\n\n    private void readDict(XmlPullParser parser) throws IOException, XmlPullParserException {\n        parser.require(XmlPullParser.START_TAG, null, \"dict\");\n        while (parser.next() != XmlPullParser.END_TAG) {\n            if (parser.getEventType() != XmlPullParser.START_TAG) {\n                continue;\n            }\n            String name = parser.getName();\n            switch (name) {\n                case \"key\":\n                    dict.setKey(readText(parser));\n                    break;\n                case \"ps\":\n                    dict.addPs(readText(parser));\n                    break;\n                case \"pron\":\n                    dict.addPron(readText(parser));\n                    break;\n                case \"pos\":\n                    dict.addPos(readText(parser));\n                    break;\n                case \"acceptation\":\n                    dict.addAcceptation(readText(parser));\n                    break;\n                case \"fy\":\n                    dict.setFy(readText(parser));\n                    break;\n                case \"sent\":\n                    parseSent(parser);\n                    break;\n\n            }\n        }\n    }\n\n    private void parseSent(XmlPullParser parser) throws IOException, XmlPullParserException {\n        Dict.Sent sent = new Dict.Sent();\n        parser.require(XmlPullParser.START_TAG, null, \"sent\");\n        while (parser.next() != XmlPullParser.END_TAG) {\n            if (parser.getEventType() != XmlPullParser.START_TAG) {\n                continue;\n            }\n            String name = parser.getName();\n            switch (name) {\n                case \"orig\":\n                    sent.setOrig(readText(parser));\n                    break;\n                case \"trans\":\n                    sent.setTrans(readText(parser));\n                    break;\n            }\n        }\n        dict.addSent(sent);\n    }\n\n\n    private String readText(XmlPullParser parser) throws IOException, XmlPullParserException {\n        String result = null;\n        if (parser.next() == XmlPullParser.TEXT) {\n            result = parser.getText();\n            parser.nextTag();\n        }\n        return result == null ? null : result.trim();\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/util/IOUtil.java",
    "content": "package com.github.mzule.androidweekly.util;\n\nimport java.io.BufferedReader;\nimport java.io.Closeable;\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\n/**\n * Created by mzule on 4/5/16.\n */\npublic class IOUtil {\n    public static void close(Closeable... closeables) {\n        if (closeables == null) {\n            return;\n        }\n        for (Closeable closeable : closeables) {\n            if (closeable != null) {\n                try {\n                    closeable.close();\n                } catch (IOException e) {\n                    e.printStackTrace();\n                }\n            }\n        }\n    }\n\n    public static void close(AutoCloseable... closeables) {\n        if (closeables == null) {\n            return;\n        }\n        for (AutoCloseable closeable : closeables) {\n            if (closeable != null) {\n                try {\n                    closeable.close();\n                } catch (Exception e) {\n                    e.printStackTrace();\n                }\n            }\n        }\n    }\n\n    public static String read(File file) throws IOException {\n        StringBuilder sb = new StringBuilder();\n        BufferedReader br = null;\n        try {\n            br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));\n            String line;\n            while ((line = br.readLine()) != null) {\n                sb.append(line);\n            }\n        } finally {\n            close(br);\n        }\n        return sb.toString();\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/util/JsonUtil.java",
    "content": "package com.github.mzule.androidweekly.util;\n\nimport android.support.annotation.WorkerThread;\n\nimport com.google.gson.Gson;\n\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.lang.reflect.Type;\nimport java.net.URL;\n\n/**\n * Created by CaoDongping on 3/26/16.\n */\npublic class JsonUtil {\n    private static final Gson gson = new Gson();\n\n    public static String toJson(Object obj) {\n        try {\n            return gson.toJson(obj);\n        } catch (Throwable e) {\n            return \"\";\n        }\n    }\n\n    public static <T> T fromJson(String json, Class<T> cls) {\n        try {\n            return gson.fromJson(json, cls);\n        } catch (Throwable e) {\n            return null;\n        }\n    }\n\n    public static <T> T fromJson(String json, Type type) {\n        try {\n            return gson.fromJson(json, type);\n        } catch (Throwable e) {\n            return null;\n        }\n    }\n\n    @WorkerThread\n    public static <T> T fromJson(URL url, Class<T> cls) {\n        try {\n            return gson.fromJson(new BufferedReader(new InputStreamReader(url.openConnection().getInputStream())), cls);\n        } catch (Throwable e) {\n            return null;\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/util/Keyboard.java",
    "content": "package com.github.mzule.androidweekly.util;\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.view.View;\nimport android.view.inputmethod.InputMethodManager;\n\n/**\n * Created by CaoDongping on 12/21/15.\n */\npublic class Keyboard {\n    public static void show(Context context) {\n        InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);\n        imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);\n    }\n\n    public static void hide(Activity activity) {\n        View view = activity.getCurrentFocus();\n        if (view != null) {\n            InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);\n            imm.hideSoftInputFromWindow(view.getWindowToken(), 0);\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/util/MD5.java",
    "content": "package com.github.mzule.androidweekly.util;\n\nimport java.security.MessageDigest;\nimport java.security.NoSuchAlgorithmException;\n\n/**\n * Created by CaoDongping on 1/4/16.\n */\npublic class MD5 {\n\n    public static String encode(final String s) {\n        final String MD5 = \"MD5\";\n        try {\n            // Create MD5 Hash\n            MessageDigest digest = MessageDigest.getInstance(MD5);\n            digest.update(s.getBytes());\n            byte messageDigest[] = digest.digest();\n            // Create Hex String\n            StringBuilder hexString = new StringBuilder();\n            for (byte aMessageDigest : messageDigest) {\n                String h = Integer.toHexString(0xFF & aMessageDigest);\n                while (h.length() < 2) {\n                    h = \"0\" + h;\n                }\n                hexString.append(h);\n            }\n            return hexString.toString();\n\n        } catch (NoSuchAlgorithmException e) {\n            e.printStackTrace();\n        }\n        return \"\";\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/util/StemUtil.java",
    "content": "package com.github.mzule.androidweekly.util;\n\nimport org.tartarus.snowball.ext.EnglishStem;\n\n/**\n * Created by CaoDongping on 4/2/16.\n */\npublic class StemUtil {\n    public static String stem(String input) {\n        String[] words = input.replaceAll(\"[^a-zA-Z ]\", \" \").toLowerCase().split(\"\\\\s+\");\n        StringBuilder sb = new StringBuilder();\n        EnglishStem stem = new EnglishStem();\n        for (String w : words) {\n            stem.setCurrent(w);\n            stem.stem();\n            sb.append(stem.getCurrent()).append(\" \");\n        }\n        return sb.toString();\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/util/ThreadUtil.java",
    "content": "package com.github.mzule.androidweekly.util;\n\n/**\n * Created by CaoDongping on 1/12/16.\n */\npublic class ThreadUtil {\n    public static void sleepUntilNextDraw(long startTime) {\n        int cost = (int) (System.currentTimeMillis() - startTime);\n        if (cost < 16) {\n            try {\n                Thread.sleep(16 - cost);\n            } catch (InterruptedException e) {\n                e.printStackTrace();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/github/mzule/androidweekly/util/Tinter.java",
    "content": "package com.github.mzule.androidweekly.util;\n\nimport android.annotation.TargetApi;\nimport android.app.Activity;\nimport android.os.Build;\nimport android.view.Window;\nimport android.view.WindowManager;\n\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\n\n/**\n * <p/>\n * 设置Activity的信号栏为透明风格的工具类\n * <p/>\n * Created by CaoDongping on 9/17/15.\n */\npublic class Tinter {\n\n    /**\n     * 如果当前系统版本支持Tint,则开启,否则,不作任何事情.\n     *\n     * @param activity\n     */\n    public static void enableIfSupport(Activity activity) {\n        if (isSupport()) {\n            tint(activity, true);\n        }\n    }\n\n    /**\n     * 当前系统版本是否支持Tint\n     *\n     * @return\n     */\n    public static boolean isSupport() {\n        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;\n    }\n\n    @TargetApi(19)\n    private static void tint(Activity activity, boolean on) {\n        Window win = activity.getWindow();\n        WindowManager.LayoutParams winParams = win.getAttributes();\n        final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;\n        if (on) {\n            winParams.flags |= bits;\n        } else {\n            winParams.flags &= ~bits;\n        }\n        win.setAttributes(winParams);\n\n        Class<? extends Window> clazz = win.getClass();\n        try {\n            Class<?> layoutParams = Class.forName(\"android.view.MiuiWindowManager$LayoutParams\");\n            Field field = layoutParams.getField(\"EXTRA_FLAG_STATUS_BAR_DARK_MODE\");\n            int darkModeFlag = field.getInt(layoutParams);\n            Method extraFlagField = clazz.getMethod(\"setExtraFlags\", int.class, int.class);\n            extraFlagField.invoke(win, darkModeFlag, darkModeFlag);\n        } catch (Throwable e) {\n        }\n\n    }\n}\n"
  },
  {
    "path": "app/src/main/res/anim/slide_in_left.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<set xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <translate\n        android:duration=\"@android:integer/config_mediumAnimTime\"\n        android:fromXDelta=\"-100%p\"\n        android:toXDelta=\"0\" />\n</set>\n"
  },
  {
    "path": "app/src/main/res/anim/slide_in_right.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<set xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <translate\n        android:duration=\"@android:integer/config_mediumAnimTime\"\n        android:fromXDelta=\"100%p\"\n        android:toXDelta=\"0\" />\n</set>\n"
  },
  {
    "path": "app/src/main/res/anim/slide_out_left.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<set xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <translate\n        android:duration=\"@android:integer/config_mediumAnimTime\"\n        android:fromXDelta=\"0\"\n        android:toXDelta=\"-100%p\" />\n</set>\n"
  },
  {
    "path": "app/src/main/res/anim/slide_out_right.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<set xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <translate\n        android:duration=\"@android:integer/config_mediumAnimTime\"\n        android:fromXDelta=\"0\"\n        android:toXDelta=\"100%p\" />\n</set>\n"
  },
  {
    "path": "app/src/main/res/color/text_color_slide_date.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:color=\"@color/textColorLightGray\" android:state_pressed=\"false\" android:state_selected=\"false\" />\n    <item android:color=\"@color/white\" />\n</selector>"
  },
  {
    "path": "app/src/main/res/color/text_color_slide_issue.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:color=\"@color/colorPrimary\" android:state_pressed=\"false\" android:state_selected=\"false\" />\n    <item android:color=\"@color/white\" />\n</selector>"
  },
  {
    "path": "app/src/main/res/drawable/bg_button.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:drawable=\"@drawable/bg_button_s\" android:state_pressed=\"true\" />\n    <item android:drawable=\"@drawable/bg_button_n\" />\n</selector>"
  },
  {
    "path": "app/src/main/res/drawable/bg_button_n.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <solid android:color=\"@color/transparent\" />\n</shape>"
  },
  {
    "path": "app/src/main/res/drawable/bg_button_s.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <solid android:color=\"#f0f0f0\" />\n</shape>"
  },
  {
    "path": "app/src/main/res/drawable/bg_dialog.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:shape=\"rectangle\">\n    <solid android:color=\"@color/white\" />\n    <corners android:radius=\"3dp\" />\n</shape>"
  },
  {
    "path": "app/src/main/res/drawable/ic_slide_menu.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:drawable=\"@drawable/ic_slide_menu_n\" android:state_pressed=\"false\" android:state_selected=\"false\" />\n    <item android:drawable=\"@drawable/ic_slide_menu_s\" />\n</selector>"
  },
  {
    "path": "app/src/main/res/layout/activity_about.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\">\n\n    <com.github.mzule.androidweekly.ui.view.NaviBar\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        app:nb_left_text=\"ABOUT\"\n        app:nb_right_text=\"ME\" />\n\n    <TextView\n        android:id=\"@+id/textView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:background=\"@color/transparent\"\n        android:lineSpacingMultiplier=\"1.6\"\n        android:padding=\"@dimen/space\"\n        android:text=\"host at github\"\n        android:textColor=\"@color/textColorGray\"\n        android:textColorLink=\"@color/colorPrimary\"\n        android:textSize=\"@dimen/text_size_medium\" />\n</LinearLayout>"
  },
  {
    "path": "app/src/main/res/layout/activity_article.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<android.support.v4.widget.DrawerLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:id=\"@+id/drawerLayout\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\">\n\n    <RelativeLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\">\n\n        <com.github.mzule.androidweekly.ui.view.ProgressView\n            android:id=\"@+id/progressView\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:layout_centerInParent=\"true\"/>\n        <ScrollView\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            android:overScrollMode=\"never\">\n\n            <LinearLayout\n                android:layout_width=\"match_parent\"\n                android:layout_height=\"match_parent\"\n                android:orientation=\"vertical\">\n\n                <com.github.mzule.androidweekly.ui.view.TintStatusBar\n                    android:layout_width=\"match_parent\"\n                    android:layout_height=\"wrap_content\" />\n\n                <WebView\n                    android:id=\"@+id/webView\"\n                    android:layout_width=\"match_parent\"\n                    android:layout_height=\"wrap_content\"\n                    android:overScrollMode=\"never\" />\n            </LinearLayout>\n        </ScrollView>\n\n        <com.github.mzule.androidweekly.ui.view.TintStatusBar\n            android:id=\"@+id/tintBar\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:background=\"@color/slideBg\" />\n\n        <View\n            style=\"@style/HorizontalLine\"\n            android:layout_below=\"@+id/tintBar\" />\n    </RelativeLayout>\n\n    <LinearLayout\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"match_parent\"\n        android:layout_gravity=\"start\"\n        android:background=\"@color/slideBg\"\n        android:gravity=\"center_vertical\"\n        android:orientation=\"vertical\">\n\n        <View style=\"@style/HorizontalLine\" />\n\n        <com.github.mzule.androidweekly.ui.view.IconButton\n            android:id=\"@+id/favoriteButton\"\n            style=\"@style/BigControl\"\n            app:materialIcon=\"star\" />\n\n        <View style=\"@style/HorizontalLine\" />\n\n        <com.github.mzule.androidweekly.ui.view.IconButton\n            android:id=\"@+id/increaseButton\"\n            style=\"@style/BigControl\"\n            app:materialIcon=\"plus\" />\n\n        <View style=\"@style/HorizontalLine\" />\n\n        <com.github.mzule.androidweekly.ui.view.IconButton\n            android:id=\"@+id/decreaseButton\"\n            style=\"@style/BigControl\"\n            app:materialIcon=\"minus\" />\n\n        <View style=\"@style/HorizontalLine\" />\n\n        <com.github.mzule.androidweekly.ui.view.IconButton\n            android:id=\"@+id/translateButton\"\n            style=\"@style/BigControl\"\n            app:materialIcon=\"google_translate\" />\n\n        <View style=\"@style/HorizontalLine\" />\n\n        <com.github.mzule.androidweekly.ui.view.IconButton\n            android:id=\"@+id/copyUrlButton\"\n            style=\"@style/BigControl\"\n            app:materialIcon=\"content_copy\" />\n\n        <View style=\"@style/HorizontalLine\" />\n\n        <com.github.mzule.androidweekly.ui.view.IconButton\n            android:id=\"@+id/shareButton\"\n            style=\"@style/BigControl\"\n            app:materialIcon=\"share\" />\n\n        <View style=\"@style/HorizontalLine\" />\n\n    </LinearLayout>\n</android.support.v4.widget.DrawerLayout>"
  },
  {
    "path": "app/src/main/res/layout/activity_favorite.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<android.support.v4.widget.DrawerLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:id=\"@+id/drawerLayout\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\">\n\n    <LinearLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:orientation=\"vertical\">\n\n        <com.github.mzule.androidweekly.ui.view.NaviBar\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            app:nb_left_text=\"ANDROID\"\n            app:nb_right_text=\"FAVORITE\" />\n\n        <com.github.mzule.androidweekly.ui.view.PinnedSectionListView\n            android:id=\"@+id/listView\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            android:divider=\"@null\"\n            android:overScrollMode=\"never\" />\n    </LinearLayout>\n\n    <LinearLayout\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"match_parent\"\n        android:layout_gravity=\"start\"\n        android:background=\"@color/slideBg\"\n        android:gravity=\"center_vertical\"\n        android:orientation=\"vertical\">\n\n        <View style=\"@style/HorizontalLine\" />\n\n        <com.github.mzule.androidweekly.ui.view.IconButton\n            android:id=\"@+id/importButton\"\n            style=\"@style/BigControl\"\n            app:materialIcon=\"import_icon\" />\n\n        <View style=\"@style/HorizontalLine\" />\n\n        <com.github.mzule.androidweekly.ui.view.IconButton\n            android:id=\"@+id/exportButton\"\n            style=\"@style/BigControl\"\n            app:materialIcon=\"export\" />\n\n        <View style=\"@style/HorizontalLine\" />\n    </LinearLayout>\n</android.support.v4.widget.DrawerLayout>"
  },
  {
    "path": "app/src/main/res/layout/activity_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<android.support.v4.widget.DrawerLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:id=\"@+id/drawerLayout\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\">\n\n    <RelativeLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\">\n\n        <com.github.mzule.androidweekly.ui.view.TintStatusBar\n            android:id=\"@+id/tintBar\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:background=\"@color/white\" />\n\n        <LinearLayout\n            android:id=\"@+id/brandView\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"@dimen/action_bar_height\"\n            android:layout_below=\"@id/tintBar\"\n            android:background=\"@color/white\"\n            android:gravity=\"center\">\n\n            <TextView\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:text=\"ANDROID\"\n                android:textColor=\"@color/colorPrimary\"\n                android:textSize=\"@dimen/text_size_large\"\n                android:textStyle=\"bold\" />\n\n            <TextView\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:layout_marginLeft=\"@dimen/small_space\"\n                android:text=\"WEEKLY\"\n                android:textColor=\"@color/colorAccent\"\n                android:textSize=\"@dimen/text_size_large\"\n                android:textStyle=\"bold\" />\n        </LinearLayout>\n\n        <com.github.mzule.androidweekly.ui.view.IconButton\n            android:id=\"@+id/slideMenuButton\"\n            style=\"@style/SmallControl\"\n            android:layout_below=\"@id/tintBar\"\n            app:materialIcon=\"menu\" />\n\n        <View\n            android:id=\"@+id/lineView\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"1px\"\n            android:layout_below=\"@id/brandView\"\n            android:background=\"@color/lineColor\" />\n\n        <com.github.mzule.androidweekly.ui.view.PinnedSectionListView\n            android:id=\"@+id/listView\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            android:layout_below=\"@id/lineView\"\n            android:divider=\"@null\"\n            android:overScrollMode=\"never\" />\n\n        <com.github.mzule.androidweekly.ui.view.ProgressView\n            android:id=\"@+id/progressView\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:layout_centerInParent=\"true\" />\n    </RelativeLayout>\n\n    <LinearLayout\n        android:id=\"@+id/slideView\"\n        android:layout_width=\"280dp\"\n        android:layout_height=\"match_parent\"\n        android:layout_gravity=\"start\"\n        android:background=\"@color/slideBg\"\n        android:orientation=\"vertical\">\n\n        <com.github.mzule.androidweekly.ui.view.TintStatusBar\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\" />\n\n        <View\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"1px\"\n            android:background=\"@color/lineColor\" />\n\n        <ListView\n            android:id=\"@+id/slideListView\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"0dp\"\n            android:layout_weight=\"1\"\n            android:divider=\"@null\"\n            android:overScrollMode=\"never\"\n            android:scrollbars=\"none\" />\n\n        <View\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"1px\"\n            android:background=\"@color/lineColor\" />\n\n        <LinearLayout\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:clickable=\"true\">\n\n            <com.github.mzule.androidweekly.ui.view.IconButton\n                android:id=\"@+id/favoriteButton\"\n                style=\"@style/NormalControl\"\n                app:materialIcon=\"star\" />\n\n            <com.github.mzule.androidweekly.ui.view.IconButton\n                android:id=\"@+id/searchButton\"\n                style=\"@style/NormalControl\"\n                app:materialIcon=\"magnify\" />\n\n            <com.github.mzule.androidweekly.ui.view.IconButton\n                android:id=\"@+id/aboutButton\"\n                style=\"@style/NormalControl\"\n                app:materialIcon=\"information\" />\n        </LinearLayout>\n    </LinearLayout>\n</android.support.v4.widget.DrawerLayout>\n"
  },
  {
    "path": "app/src/main/res/layout/activity_search.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\">\n\n    <com.github.mzule.androidweekly.ui.view.TintStatusBar\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\" />\n\n    <LinearLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:orientation=\"horizontal\">\n\n        <com.github.mzule.androidweekly.ui.view.IconButton\n            style=\"@style/SmallControl\"\n            android:onClick=\"back\"\n            app:materialIcon=\"arrow_left\" />\n\n        <EditText\n            android:id=\"@+id/queryInput\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"@dimen/action_bar_height\"\n            android:background=\"@color/transparent\"\n            android:hint=\"Search local cache here.\"\n            android:imeOptions=\"actionSearch\"\n            android:inputType=\"text\"\n            android:maxLines=\"1\"\n            android:textColor=\"@color/textColorGray\"\n            android:textColorHint=\"@color/textColorHint\"\n            android:textSize=\"@dimen/text_size_medium\">\n\n            <requestFocus />\n        </EditText>\n    </LinearLayout>\n\n    <View style=\"@style/HorizontalLine\" />\n\n    <ListView\n        android:id=\"@+id/listView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:divider=\"@null\"\n        android:overScrollMode=\"never\" />\n</LinearLayout>"
  },
  {
    "path": "app/src/main/res/layout/activity_search_result.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\">\n\n    <com.github.mzule.androidweekly.ui.view.NaviBar\n        android:id=\"@+id/naviBar\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        app:nb_right_text=\"RESULT\" />\n\n    <ListView\n        android:id=\"@+id/listView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:divider=\"@null\"\n        android:overScrollMode=\"never\" />\n</LinearLayout>"
  },
  {
    "path": "app/src/main/res/layout/item_article.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\">\n\n    <RelativeLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:padding=\"@dimen/space\">\n\n        <TextView\n            android:id=\"@+id/nameView\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"全系BMW 3系闪耀登场\"\n            android:textColor=\"@color/colorAccent\"\n            android:textSize=\"@dimen/text_size_medium\" />\n\n        <ImageView\n            android:id=\"@+id/iconView\"\n            android:layout_width=\"75dp\"\n            android:layout_height=\"75dp\"\n            android:layout_below=\"@id/nameView\"\n            android:layout_marginRight=\"@dimen/space\"\n            android:layout_marginTop=\"@dimen/space\" />\n\n        <TextView\n            android:id=\"@+id/briefView\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_below=\"@id/nameView\"\n            android:layout_marginBottom=\"@dimen/space\"\n            android:layout_marginTop=\"@dimen/space\"\n            android:layout_toRightOf=\"@id/iconView\"\n            android:text=\"新的里程\"\n            android:textColor=\"@color/textColorGray\"\n            android:textSize=\"@dimen/text_size_small\" />\n\n        <TextView\n            android:id=\"@+id/domainView\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_below=\"@id/briefView\"\n            android:layout_toRightOf=\"@id/iconView\"\n            android:text=\"medium.com\"\n            android:textColor=\"@color/textColorLightGray\"\n            android:textSize=\"@dimen/text_size_small\" />\n    </RelativeLayout>\n\n    <View\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"1px\"\n        android:layout_alignParentBottom=\"true\"\n        android:background=\"@color/lineColor\" />\n</RelativeLayout>"
  },
  {
    "path": "app/src/main/res/layout/item_search_history.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\">\n\n    <TextView\n        android:id=\"@+id/textView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:padding=\"@dimen/space\"\n        android:text=\"You are best.\"\n        android:textColor=\"@color/textColorGray\"\n        android:textSize=\"@dimen/text_size_medium\" />\n\n    <View style=\"@style/HorizontalLine\" />\n</LinearLayout>"
  },
  {
    "path": "app/src/main/res/layout/item_section.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:background=\"#f8f8f8\">\n\n    <TextView\n        android:id=\"@+id/sectionName\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:paddingBottom=\"@dimen/half_space\"\n        android:paddingLeft=\"@dimen/space\"\n        android:paddingTop=\"@dimen/half_space\"\n        android:text=\"Sponsored\"\n        android:textSize=\"@dimen/text_size_tiny\" />\n\n    <View\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"1px\"\n        android:layout_alignBottom=\"@id/sectionName\"\n        android:background=\"@color/lineColor\" />\n\n</RelativeLayout>"
  },
  {
    "path": "app/src/main/res/layout/item_slide_issue.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:id=\"@+id/rootLayout\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\">\n\n    <TextView\n        android:id=\"@+id/dateView\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"match_parent\"\n        android:layout_alignBottom=\"@+id/nameView\"\n        android:gravity=\"center\"\n        android:padding=\"@dimen/space\"\n        android:text=\"2013-11-12\"\n        android:textColor=\"@color/text_color_slide_date\"\n        android:textSize=\"@dimen/text_size_tiny\" />\n\n    <TextView\n        android:id=\"@+id/nameView\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_toRightOf=\"@id/dateView\"\n        android:padding=\"@dimen/space\"\n        android:text=\"Issue-128\"\n        android:textColor=\"@color/text_color_slide_issue\"\n        android:textSize=\"@dimen/text_size_medium\" />\n\n    <View\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"1px\"\n        android:layout_below=\"@id/nameView\"\n        android:background=\"@color/lineColor\" />\n</RelativeLayout>"
  },
  {
    "path": "app/src/main/res/layout/view_navi_bar.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\">\n\n    <com.github.mzule.androidweekly.ui.view.TintStatusBar\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:background=\"@color/white\" />\n\n    <RelativeLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\">\n\n        <LinearLayout\n            android:id=\"@+id/brandView\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"@dimen/action_bar_height\"\n            android:background=\"@color/white\"\n            android:gravity=\"center\">\n\n            <TextView\n                android:id=\"@+id/leftTextView\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:text=\"ANDROID\"\n                android:textColor=\"@color/colorPrimary\"\n                android:textSize=\"@dimen/text_size_large\"\n                android:textStyle=\"bold\" />\n\n            <TextView\n                android:id=\"@+id/rightTextView\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"wrap_content\"\n                android:layout_marginLeft=\"@dimen/small_space\"\n                android:text=\"FAVORITE\"\n                android:textColor=\"@color/colorAccent\"\n                android:textSize=\"@dimen/text_size_large\"\n                android:textStyle=\"bold\" />\n        </LinearLayout>\n\n        <com.github.mzule.androidweekly.ui.view.IconButton\n            android:id=\"@+id/backButton\"\n            style=\"@style/SmallControl\"\n            app:materialIcon=\"arrow_left\" />\n    </RelativeLayout>\n\n    <View style=\"@style/HorizontalLine\" />\n</LinearLayout>"
  },
  {
    "path": "app/src/main/res/layout/view_translate.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\">\n\n    <View\n        android:id=\"@+id/maskView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:background=\"@color/mask\" />\n\n    <RelativeLayout\n        android:id=\"@+id/mainView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_marginLeft=\"@dimen/space\"\n        android:layout_marginRight=\"@dimen/space\"\n        android:background=\"@color/white\"\n        android:clickable=\"true\"\n        android:orientation=\"vertical\">\n\n        <com.github.mzule.androidweekly.ui.view.TintStatusBar\n            android:id=\"@+id/tintBar\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\" />\n\n        <EditText\n            android:id=\"@+id/queryInput\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_below=\"@id/tintBar\"\n            android:background=\"@color/transparent\"\n            android:gravity=\"left|top\"\n            android:hint=\"Input query text here...\"\n            android:imeActionLabel=\"翻译\"\n            android:maxHeight=\"100dp\"\n            android:padding=\"@dimen/space\"\n            android:textColor=\"@color/textColorGray\"\n            android:textColorHint=\"@color/textColorHint\"\n            android:textSize=\"@dimen/text_size_small\" />\n\n        <View\n            style=\"@style/HorizontalLine\"\n            android:layout_alignBottom=\"@+id/queryInput\" />\n\n        <EditText\n            android:id=\"@+id/resultView\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:layout_below=\"@id/queryInput\"\n            android:background=\"@color/transparent\"\n            android:editable=\"false\"\n            android:focusable=\"false\"\n            android:hint=\"Result will display here...\"\n            android:padding=\"@dimen/space\"\n            android:textColor=\"@color/textColorGray\"\n            android:textColorHint=\"@color/textColorHint\"\n            android:textSize=\"@dimen/text_size_small\" />\n\n        <View\n            style=\"@style/HorizontalLine\"\n            android:layout_alignBottom=\"@+id/resultView\" />\n\n        <LinearLayout\n            android:id=\"@+id/buttonPanel\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"@dimen/action_bar_height\"\n            android:layout_below=\"@+id/resultView\">\n\n            <TextView\n                android:id=\"@+id/clearButton\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"match_parent\"\n                android:layout_weight=\"1\"\n                android:background=\"@drawable/bg_button\"\n                android:gravity=\"center\"\n                android:text=\"Clear\"\n                android:textColor=\"@color/colorPrimary\"\n                android:textSize=\"@dimen/text_size_small\" />\n\n            <View style=\"@style/VerticalLine\" />\n\n            <TextView\n                android:id=\"@+id/translateButton\"\n                android:layout_width=\"0dp\"\n                android:layout_height=\"match_parent\"\n                android:layout_weight=\"1\"\n                android:background=\"@drawable/bg_button\"\n                android:gravity=\"center\"\n                android:text=\"Translate\"\n                android:textColor=\"@color/colorPrimary\"\n                android:textSize=\"@dimen/text_size_small\" />\n        </LinearLayout>\n    </RelativeLayout>\n</RelativeLayout>"
  },
  {
    "path": "app/src/main/res/values/attrs.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <declare-styleable name=\"NaviBar\">\n        <attr name=\"nb_left_text\" format=\"string\" />\n        <attr name=\"nb_right_text\" format=\"string\" />\n    </declare-styleable>\n</resources>"
  },
  {
    "path": "app/src/main/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"colorPrimary\">#36bce8</color>\n    <color name=\"colorPrimaryDark\">#303F9F</color>\n    <color name=\"colorAccent\">#464646</color>\n    <color name=\"placeholder\">#e1e1e1</color>\n    <color name=\"lineColor\">#d9d9d9</color>\n    <color name=\"transparent\">#00000000</color>\n    <color name=\"bg\">#fcfcfc</color>\n    <color name=\"white\">#ffffff</color>\n    <color name=\"slideBg\">#ddffffff</color>\n    <color name=\"textColorGray\">#666666</color>\n    <color name=\"textColorLightGray\">#999999</color>\n    <color name=\"textColorHint\">#CCCCCC</color>\n    <color name=\"mask\">#22000000</color>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/dimens.xml",
    "content": "<resources>\n    <dimen name=\"text_size_tiny\">10sp</dimen>\n    <dimen name=\"text_size_small\">12sp</dimen>\n    <dimen name=\"text_size_medium\">14sp</dimen>\n    <dimen name=\"text_size_large\">16sp</dimen>\n    <dimen name=\"space\">12dp</dimen>\n    <dimen name=\"half_space\">6dp</dimen>\n    <dimen name=\"small_space\">4dp</dimen>\n    <dimen name=\"action_bar_height\">40dp</dimen>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/ids.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <item name=\"popup_view_id\" type=\"id\" />\n</resources>"
  },
  {
    "path": "app/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">Weekly</string>\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/styles.xml",
    "content": "<resources>\n\n    <!-- Base application theme. -->\n    <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar\">\n        <!-- Customize your theme here. -->\n        <item name=\"colorPrimary\">@color/colorPrimary</item>\n        <item name=\"colorPrimaryDark\">@color/colorPrimaryDark</item>\n        <item name=\"colorAccent\">@color/colorAccent</item>\n        <item name=\"android:windowBackground\">@color/bg</item>\n    </style>\n\n    <style name=\"Dialog\" parent=\"@android:style/Theme.Dialog\">\n        <item name=\"android:windowFrame\">@null</item>\n        <item name=\"android:windowIsFloating\">true</item>\n        <item name=\"android:windowIsTranslucent\">false</item>\n        <item name=\"android:windowNoTitle\">true</item>\n        <item name=\"android:background\">@color/transparent</item>\n        <item name=\"android:windowBackground\">@color/transparent</item>\n        <item name=\"android:backgroundDimEnabled\">true</item>\n    </style>\n\n    <style name=\"BigControl\">\n        <item name=\"android:layout_width\">55dp</item>\n        <item name=\"android:layout_height\">55dp</item>\n        <item name=\"android:scaleType\">center</item>\n        <item name=\"materialIconColor\">@color/colorPrimary</item>\n        <item name=\"materialIconSize\">22dp</item>\n        <item name=\"android:background\">@drawable/bg_button</item>\n    </style>\n\n    <style name=\"NormalControl\">\n        <item name=\"android:layout_width\">48dp</item>\n        <item name=\"android:layout_height\">48dp</item>\n        <item name=\"android:scaleType\">center</item>\n        <item name=\"materialIconColor\">@color/colorPrimary</item>\n        <item name=\"materialIconSize\">22dp</item>\n        <item name=\"android:background\">@drawable/bg_button</item>\n    </style>\n\n    <style name=\"SmallControl\">\n        <item name=\"android:layout_width\">40dp</item>\n        <item name=\"android:layout_height\">40dp</item>\n        <item name=\"android:scaleType\">center</item>\n        <item name=\"materialIconColor\">@color/colorPrimary</item>\n        <item name=\"materialIconSize\">22dp</item>\n        <item name=\"android:background\">@drawable/bg_button</item>\n    </style>\n\n    <style name=\"HorizontalLine\">\n        <item name=\"android:layout_width\">match_parent</item>\n        <item name=\"android:layout_height\">1px</item>\n        <item name=\"android:background\">@color/lineColor</item>\n    </style>\n\n    <style name=\"VerticalLine\">\n        <item name=\"android:layout_width\">1px</item>\n        <item name=\"android:layout_height\">match_parent</item>\n        <item name=\"android:background\">@color/lineColor</item>\n    </style>\n\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values-w820dp/dimens.xml",
    "content": "<resources>\n    <!-- Example customization of dimensions originally defined in res/values/dimens.xml\n         (such as screen margins) for screens with more than 820dp of available width. This\n         would include 7\" and 10\" devices in landscape (~960dp and ~1280dp respectively). -->\n    <dimen name=\"activity_horizontal_margin\">64dp</dimen>\n</resources>\n"
  },
  {
    "path": "app/src/test/java/com/github/mzule/androidweekly/ExampleUnitTest.java",
    "content": "package com.github.mzule.androidweekly;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * To work on unit tests, switch the Test Artifact in the Build Variants view.\n */\npublic class ExampleUnitTest {\n    @Test\n    public void addition_isCorrect() throws Exception {\n        assertEquals(4, 2 + 2);\n    }\n}"
  },
  {
    "path": "build.gradle",
    "content": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n    repositories {\n        jcenter()\n    }\n    dependencies {\n        classpath 'com.android.tools.build:gradle:2.1.0'\n        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'\n    }\n}\n\nallprojects {\n    repositories {\n        jcenter()\n    }\n}\n\ntask clean(type: Delete) {\n    delete rootProject.buildDir\n}\n"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "#Sat Apr 09 16:59:39 CST 2016\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-2.10-all.zip\n"
  },
  {
    "path": "gradle.properties",
    "content": "## Project-wide Gradle settings.\n#\n# For more details on how to configure your build environment visit\n# http://www.gradle.org/docs/current/userguide/build_environment.html\n#\n# Specifies the JVM arguments used for the daemon process.\n# The setting is particularly useful for tweaking memory settings.\n# Default value: -Xmx10248m -XX:MaxPermSize=256m\n# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8\n#\n# When configured, Gradle will run in incubating parallel mode.\n# This option should only be used with decoupled projects. More details, visit\n# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects\n# org.gradle.parallel=true\n#Thu May 12 10:00:05 CST 2016"
  },
  {
    "path": "gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\nesac\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto init\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto init\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:init\n@rem Get command-line arguments, handling Windowz variants\n\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\n\n:win9xME_args\n@rem Slurp the command line arguments.\nset CMD_LINE_ARGS=\nset _SKIP=2\n\n:win9xME_args_slurp\nif \"x%~1\" == \"x\" goto execute\n\nset CMD_LINE_ARGS=%*\ngoto execute\n\n:4NT_args\n@rem Get arguments from the 4NT Shell from JP Software\nset CMD_LINE_ARGS=%$\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "settings.gradle",
    "content": "include ':app', ':snowball'\n"
  },
  {
    "path": "snowball/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "snowball/build.gradle",
    "content": "apply plugin: 'java'\n\nsourceCompatibility = 1.7\ntargetCompatibility = 1.7\n\ndependencies {\n    compile fileTree(dir: 'libs', include: ['*.jar'])\n}"
  },
  {
    "path": "snowball/src/main/java/org/tartarus/snowball/Among.java",
    "content": "package org.tartarus.snowball;\n\nimport java.lang.reflect.Method;\n\npublic class Among {\n    public final int s_size; /* search string */\n    public final char[] s; /* search string */\n    public final int substring_i; /* index to longest matching substring */\n    public final int result; /* result of the lookup */\n    public final Method method; /* method to use if substring matches */\n    public final SnowballProgram methodobject; /* object to invoke method on */\n\n    public Among(String s, int substring_i, int result,\n                 String methodname, SnowballProgram methodobject) {\n        this.s_size = s.length();\n        this.s = s.toCharArray();\n        this.substring_i = substring_i;\n        this.result = result;\n        this.methodobject = methodobject;\n        if (methodname.length() == 0) {\n            this.method = null;\n        } else {\n            try {\n                this.method = methodobject.getClass().\n                        getDeclaredMethod(methodname, new Class[0]);\n            } catch (NoSuchMethodException e) {\n                throw new RuntimeException(e);\n            }\n        }\n    }\n};\n"
  },
  {
    "path": "snowball/src/main/java/org/tartarus/snowball/SnowballProgram.java",
    "content": "\npackage org.tartarus.snowball;\n\nimport java.lang.reflect.InvocationTargetException;\n\npublic class SnowballProgram {\n    // current string\n    protected StringBuffer current;\n    protected int cursor;\n    protected int limit;\n    protected int limit_backward;\n    protected int bra;\n    protected int ket;\n\n    protected SnowballProgram() {\n        current = new StringBuffer();\n        setCurrent(\"\");\n    }\n\n    /**\n     * Get the current string.\n     */\n    public String getCurrent() {\n        String result = current.toString();\n        // Make a new StringBuffer.  If we reuse the old one, and a user of\n        // the library keeps a reference to the buffer returned (for example,\n        // by converting it to a String in a way which doesn't force a copy),\n        // the buffer size will not decrease, and we will risk wasting a large\n        // amount of memory.\n        // Thanks to Wolfram Esser for spotting this problem.\n        current = new StringBuffer();\n        return result;\n    }\n\n    /**\n     * Set the current string.\n     */\n    public void setCurrent(String value) {\n        current.replace(0, current.length(), value);\n        cursor = 0;\n        limit = current.length();\n        limit_backward = 0;\n        bra = cursor;\n        ket = limit;\n    }\n\n    protected void copy_from(SnowballProgram other) {\n        current = other.current;\n        cursor = other.cursor;\n        limit = other.limit;\n        limit_backward = other.limit_backward;\n        bra = other.bra;\n        ket = other.ket;\n    }\n\n    protected boolean in_grouping(char[] s, int min, int max) {\n        if (cursor >= limit) return false;\n        char ch = current.charAt(cursor);\n        if (ch > max || ch < min) return false;\n        ch -= min;\n        if ((s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) return false;\n        cursor++;\n        return true;\n    }\n\n    protected boolean in_grouping_b(char[] s, int min, int max) {\n        if (cursor <= limit_backward) return false;\n        char ch = current.charAt(cursor - 1);\n        if (ch > max || ch < min) return false;\n        ch -= min;\n        if ((s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) return false;\n        cursor--;\n        return true;\n    }\n\n    protected boolean out_grouping(char[] s, int min, int max) {\n        if (cursor >= limit) return false;\n        char ch = current.charAt(cursor);\n        if (ch > max || ch < min) {\n            cursor++;\n            return true;\n        }\n        ch -= min;\n        if ((s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) {\n            cursor++;\n            return true;\n        }\n        return false;\n    }\n\n    protected boolean out_grouping_b(char[] s, int min, int max) {\n        if (cursor <= limit_backward) return false;\n        char ch = current.charAt(cursor - 1);\n        if (ch > max || ch < min) {\n            cursor--;\n            return true;\n        }\n        ch -= min;\n        if ((s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) {\n            cursor--;\n            return true;\n        }\n        return false;\n    }\n\n    protected boolean in_range(int min, int max) {\n        if (cursor >= limit) return false;\n        char ch = current.charAt(cursor);\n        if (ch > max || ch < min) return false;\n        cursor++;\n        return true;\n    }\n\n    protected boolean in_range_b(int min, int max) {\n        if (cursor <= limit_backward) return false;\n        char ch = current.charAt(cursor - 1);\n        if (ch > max || ch < min) return false;\n        cursor--;\n        return true;\n    }\n\n    protected boolean out_range(int min, int max) {\n        if (cursor >= limit) return false;\n        char ch = current.charAt(cursor);\n        if (!(ch > max || ch < min)) return false;\n        cursor++;\n        return true;\n    }\n\n    protected boolean out_range_b(int min, int max) {\n        if (cursor <= limit_backward) return false;\n        char ch = current.charAt(cursor - 1);\n        if (!(ch > max || ch < min)) return false;\n        cursor--;\n        return true;\n    }\n\n    protected boolean eq_s(int s_size, String s) {\n        if (limit - cursor < s_size) return false;\n        int i;\n        for (i = 0; i != s_size; i++) {\n            if (current.charAt(cursor + i) != s.charAt(i)) return false;\n        }\n        cursor += s_size;\n        return true;\n    }\n\n    protected boolean eq_s_b(int s_size, String s) {\n        if (cursor - limit_backward < s_size) return false;\n        int i;\n        for (i = 0; i != s_size; i++) {\n            if (current.charAt(cursor - s_size + i) != s.charAt(i)) return false;\n        }\n        cursor -= s_size;\n        return true;\n    }\n\n    protected boolean eq_v(CharSequence s) {\n        return eq_s(s.length(), s.toString());\n    }\n\n    protected boolean eq_v_b(CharSequence s) {\n        return eq_s_b(s.length(), s.toString());\n    }\n\n    protected int find_among(Among v[], int v_size) {\n        int i = 0;\n        int j = v_size;\n\n        int c = cursor;\n        int l = limit;\n\n        int common_i = 0;\n        int common_j = 0;\n\n        boolean first_key_inspected = false;\n\n        while (true) {\n            int k = i + ((j - i) >> 1);\n            int diff = 0;\n            int common = common_i < common_j ? common_i : common_j; // smaller\n            Among w = v[k];\n            int i2;\n            for (i2 = common; i2 < w.s_size; i2++) {\n                if (c + common == l) {\n                    diff = -1;\n                    break;\n                }\n                diff = current.charAt(c + common) - w.s[i2];\n                if (diff != 0) break;\n                common++;\n            }\n            if (diff < 0) {\n                j = k;\n                common_j = common;\n            } else {\n                i = k;\n                common_i = common;\n            }\n            if (j - i <= 1) {\n                if (i > 0) break; // v->s has been inspected\n                if (j == i) break; // only one item in v\n\n                // - but now we need to go round once more to get\n                // v->s inspected. This looks messy, but is actually\n                // the optimal approach.\n\n                if (first_key_inspected) break;\n                first_key_inspected = true;\n            }\n        }\n        while (true) {\n            Among w = v[i];\n            if (common_i >= w.s_size) {\n                cursor = c + w.s_size;\n                if (w.method == null) return w.result;\n                boolean res;\n                try {\n                    Object resobj = w.method.invoke(w.methodobject,\n                            new Object[0]);\n                    res = resobj.toString().equals(\"true\");\n                } catch (InvocationTargetException e) {\n                    res = false;\n                    // FIXME - debug message\n                } catch (IllegalAccessException e) {\n                    res = false;\n                    // FIXME - debug message\n                }\n                cursor = c + w.s_size;\n                if (res) return w.result;\n            }\n            i = w.substring_i;\n            if (i < 0) return 0;\n        }\n    }\n\n    // find_among_b is for backwards processing. Same comments apply\n    protected int find_among_b(Among v[], int v_size) {\n        int i = 0;\n        int j = v_size;\n\n        int c = cursor;\n        int lb = limit_backward;\n\n        int common_i = 0;\n        int common_j = 0;\n\n        boolean first_key_inspected = false;\n\n        while (true) {\n            int k = i + ((j - i) >> 1);\n            int diff = 0;\n            int common = common_i < common_j ? common_i : common_j;\n            Among w = v[k];\n            int i2;\n            for (i2 = w.s_size - 1 - common; i2 >= 0; i2--) {\n                if (c - common == lb) {\n                    diff = -1;\n                    break;\n                }\n                diff = current.charAt(c - 1 - common) - w.s[i2];\n                if (diff != 0) break;\n                common++;\n            }\n            if (diff < 0) {\n                j = k;\n                common_j = common;\n            } else {\n                i = k;\n                common_i = common;\n            }\n            if (j - i <= 1) {\n                if (i > 0) break;\n                if (j == i) break;\n                if (first_key_inspected) break;\n                first_key_inspected = true;\n            }\n        }\n        while (true) {\n            Among w = v[i];\n            if (common_i >= w.s_size) {\n                cursor = c - w.s_size;\n                if (w.method == null) return w.result;\n\n                boolean res;\n                try {\n                    Object resobj = w.method.invoke(w.methodobject,\n                            new Object[0]);\n                    res = resobj.toString().equals(\"true\");\n                } catch (InvocationTargetException e) {\n                    res = false;\n                    // FIXME - debug message\n                } catch (IllegalAccessException e) {\n                    res = false;\n                    // FIXME - debug message\n                }\n                cursor = c - w.s_size;\n                if (res) return w.result;\n            }\n            i = w.substring_i;\n            if (i < 0) return 0;\n        }\n    }\n\n    /* to replace chars between c_bra and c_ket in current by the\n     * chars in s.\n     */\n    protected int replace_s(int c_bra, int c_ket, String s) {\n        int adjustment = s.length() - (c_ket - c_bra);\n        current.replace(c_bra, c_ket, s);\n        limit += adjustment;\n        if (cursor >= c_ket) cursor += adjustment;\n        else if (cursor > c_bra) cursor = c_bra;\n        return adjustment;\n    }\n\n    protected void slice_check() {\n        if (bra < 0 ||\n                bra > ket ||\n                ket > limit ||\n                limit > current.length())   // this line could be removed\n        {\n            System.err.println(\"faulty slice operation\");\n            // FIXME: report error somehow.\n    /*\n\t    fprintf(stderr, \"faulty slice operation:\\n\");\n\t    debug(z, -1, 0);\n\t    exit(1);\n\t    */\n        }\n    }\n\n    protected void slice_from(String s) {\n        slice_check();\n        replace_s(bra, ket, s);\n    }\n\n    protected void slice_from(CharSequence s) {\n        slice_from(s.toString());\n    }\n\n    protected void slice_del() {\n        slice_from(\"\");\n    }\n\n    protected void insert(int c_bra, int c_ket, String s) {\n        int adjustment = replace_s(c_bra, c_ket, s);\n        if (c_bra <= bra) bra += adjustment;\n        if (c_bra <= ket) ket += adjustment;\n    }\n\n    protected void insert(int c_bra, int c_ket, CharSequence s) {\n        insert(c_bra, c_ket, s.toString());\n    }\n\n    /* Copy the slice into the supplied StringBuffer */\n    protected StringBuffer slice_to(StringBuffer s) {\n        slice_check();\n        int len = ket - bra;\n        s.replace(0, s.length(), current.substring(bra, ket));\n        return s;\n    }\n\n    /* Copy the slice into the supplied StringBuilder */\n    protected StringBuilder slice_to(StringBuilder s) {\n        slice_check();\n        int len = ket - bra;\n        s.replace(0, s.length(), current.substring(bra, ket));\n        return s;\n    }\n\n    protected StringBuffer assign_to(StringBuffer s) {\n        s.replace(0, s.length(), current.substring(0, limit));\n        return s;\n    }\n\n    protected StringBuilder assign_to(StringBuilder s) {\n        s.replace(0, s.length(), current.substring(0, limit));\n        return s;\n    }\n\n/*\nextern void debug(struct SN_env * z, int number, int line_count)\n{   int i;\n    int limit = SIZE(z->p);\n    //if (number >= 0) printf(\"%3d (line %4d): '\", number, line_count);\n    if (number >= 0) printf(\"%3d (line %4d): [%d]'\", number, line_count,limit);\n    for (i = 0; i <= limit; i++)\n    {   if (z->lb == i) printf(\"{\");\n        if (z->bra == i) printf(\"[\");\n        if (z->c == i) printf(\"|\");\n        if (z->ket == i) printf(\"]\");\n        if (z->l == i) printf(\"}\");\n        if (i < limit)\n        {   int ch = z->p[i];\n            if (ch == 0) ch = '#';\n            printf(\"%c\", ch);\n        }\n    }\n    printf(\"'\\n\");\n}\n*/\n\n};\n"
  },
  {
    "path": "snowball/src/main/java/org/tartarus/snowball/SnowballStemmer.java",
    "content": "\npackage org.tartarus.snowball;\n\npublic abstract class SnowballStemmer extends SnowballProgram {\n    public abstract boolean stem();\n};\n"
  },
  {
    "path": "snowball/src/main/java/org/tartarus/snowball/TestApp.java",
    "content": "\npackage org.tartarus.snowball;\n\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.FileInputStream;\nimport java.io.FileOutputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.OutputStreamWriter;\nimport java.io.Reader;\nimport java.io.Writer;\n\npublic class TestApp {\n    private static void usage() {\n        System.err.println(\"Usage: TestApp <algorithm> <input file> [-o <output file>]\");\n    }\n\n    public static void main(String[] args) throws Throwable {\n        if (args.length < 2) {\n            usage();\n            return;\n        }\n\n        Class stemClass = Class.forName(\"org.tartarus.snowball.ext.\" +\n                args[0] + \"Stemmer\");\n        SnowballStemmer stemmer = (SnowballStemmer) stemClass.newInstance();\n\n        Reader reader;\n        reader = new InputStreamReader(new FileInputStream(args[1]));\n        reader = new BufferedReader(reader);\n\n        StringBuffer input = new StringBuffer();\n\n        OutputStream outstream;\n\n        if (args.length > 2) {\n            if (args.length >= 4 && args[2].equals(\"-o\")) {\n                outstream = new FileOutputStream(args[3]);\n            } else {\n                usage();\n                return;\n            }\n        } else {\n            outstream = System.out;\n        }\n        Writer output = new OutputStreamWriter(outstream);\n        output = new BufferedWriter(output);\n\n        int repeat = 1;\n        if (args.length > 4) {\n            repeat = Integer.parseInt(args[4]);\n        }\n\n        Object[] emptyArgs = new Object[0];\n        int character;\n        while ((character = reader.read()) != -1) {\n            char ch = (char) character;\n            if (Character.isWhitespace((char) ch)) {\n                if (input.length() > 0) {\n                    stemmer.setCurrent(input.toString());\n                    for (int i = repeat; i != 0; i--) {\n                        stemmer.stem();\n                    }\n                    output.write(stemmer.getCurrent());\n                    output.write('\\n');\n                    input.delete(0, input.length());\n                }\n            } else {\n                input.append(Character.toLowerCase(ch));\n            }\n        }\n        output.flush();\n    }\n}\n"
  },
  {
    "path": "snowball/src/main/java/org/tartarus/snowball/ext/EnglishStem.java",
    "content": "// This file was generated automatically by the Snowball to Java compiler\n\npackage org.tartarus.snowball.ext;\n\nimport org.tartarus.snowball.Among;\n\n/**\n * This class was automatically generated by a Snowball to Java compiler\n * It implements the stemming algorithm defined by a snowball script.\n */\n\npublic class EnglishStem extends org.tartarus.snowball.SnowballStemmer {\n\n    private static final long serialVersionUID = 1L;\n\n    private final static EnglishStem methodObject = new EnglishStem();\n\n    private final static Among a_0[] = {\n            new Among(\"arsen\", -1, -1, \"\", methodObject),\n            new Among(\"commun\", -1, -1, \"\", methodObject),\n            new Among(\"gener\", -1, -1, \"\", methodObject)\n    };\n\n    private final static Among a_1[] = {\n            new Among(\"'\", -1, 1, \"\", methodObject),\n            new Among(\"'s'\", 0, 1, \"\", methodObject),\n            new Among(\"'s\", -1, 1, \"\", methodObject)\n    };\n\n    private final static Among a_2[] = {\n            new Among(\"ied\", -1, 2, \"\", methodObject),\n            new Among(\"s\", -1, 3, \"\", methodObject),\n            new Among(\"ies\", 1, 2, \"\", methodObject),\n            new Among(\"sses\", 1, 1, \"\", methodObject),\n            new Among(\"ss\", 1, -1, \"\", methodObject),\n            new Among(\"us\", 1, -1, \"\", methodObject)\n    };\n\n    private final static Among a_3[] = {\n            new Among(\"\", -1, 3, \"\", methodObject),\n            new Among(\"bb\", 0, 2, \"\", methodObject),\n            new Among(\"dd\", 0, 2, \"\", methodObject),\n            new Among(\"ff\", 0, 2, \"\", methodObject),\n            new Among(\"gg\", 0, 2, \"\", methodObject),\n            new Among(\"bl\", 0, 1, \"\", methodObject),\n            new Among(\"mm\", 0, 2, \"\", methodObject),\n            new Among(\"nn\", 0, 2, \"\", methodObject),\n            new Among(\"pp\", 0, 2, \"\", methodObject),\n            new Among(\"rr\", 0, 2, \"\", methodObject),\n            new Among(\"at\", 0, 1, \"\", methodObject),\n            new Among(\"tt\", 0, 2, \"\", methodObject),\n            new Among(\"iz\", 0, 1, \"\", methodObject)\n    };\n\n    private final static Among a_4[] = {\n            new Among(\"ed\", -1, 2, \"\", methodObject),\n            new Among(\"eed\", 0, 1, \"\", methodObject),\n            new Among(\"ing\", -1, 2, \"\", methodObject),\n            new Among(\"edly\", -1, 2, \"\", methodObject),\n            new Among(\"eedly\", 3, 1, \"\", methodObject),\n            new Among(\"ingly\", -1, 2, \"\", methodObject)\n    };\n\n    private final static Among a_5[] = {\n            new Among(\"anci\", -1, 3, \"\", methodObject),\n            new Among(\"enci\", -1, 2, \"\", methodObject),\n            new Among(\"ogi\", -1, 13, \"\", methodObject),\n            new Among(\"li\", -1, 16, \"\", methodObject),\n            new Among(\"bli\", 3, 12, \"\", methodObject),\n            new Among(\"abli\", 4, 4, \"\", methodObject),\n            new Among(\"alli\", 3, 8, \"\", methodObject),\n            new Among(\"fulli\", 3, 14, \"\", methodObject),\n            new Among(\"lessli\", 3, 15, \"\", methodObject),\n            new Among(\"ousli\", 3, 10, \"\", methodObject),\n            new Among(\"entli\", 3, 5, \"\", methodObject),\n            new Among(\"aliti\", -1, 8, \"\", methodObject),\n            new Among(\"biliti\", -1, 12, \"\", methodObject),\n            new Among(\"iviti\", -1, 11, \"\", methodObject),\n            new Among(\"tional\", -1, 1, \"\", methodObject),\n            new Among(\"ational\", 14, 7, \"\", methodObject),\n            new Among(\"alism\", -1, 8, \"\", methodObject),\n            new Among(\"ation\", -1, 7, \"\", methodObject),\n            new Among(\"ization\", 17, 6, \"\", methodObject),\n            new Among(\"izer\", -1, 6, \"\", methodObject),\n            new Among(\"ator\", -1, 7, \"\", methodObject),\n            new Among(\"iveness\", -1, 11, \"\", methodObject),\n            new Among(\"fulness\", -1, 9, \"\", methodObject),\n            new Among(\"ousness\", -1, 10, \"\", methodObject)\n    };\n\n    private final static Among a_6[] = {\n            new Among(\"icate\", -1, 4, \"\", methodObject),\n            new Among(\"ative\", -1, 6, \"\", methodObject),\n            new Among(\"alize\", -1, 3, \"\", methodObject),\n            new Among(\"iciti\", -1, 4, \"\", methodObject),\n            new Among(\"ical\", -1, 4, \"\", methodObject),\n            new Among(\"tional\", -1, 1, \"\", methodObject),\n            new Among(\"ational\", 5, 2, \"\", methodObject),\n            new Among(\"ful\", -1, 5, \"\", methodObject),\n            new Among(\"ness\", -1, 5, \"\", methodObject)\n    };\n\n    private final static Among a_7[] = {\n            new Among(\"ic\", -1, 1, \"\", methodObject),\n            new Among(\"ance\", -1, 1, \"\", methodObject),\n            new Among(\"ence\", -1, 1, \"\", methodObject),\n            new Among(\"able\", -1, 1, \"\", methodObject),\n            new Among(\"ible\", -1, 1, \"\", methodObject),\n            new Among(\"ate\", -1, 1, \"\", methodObject),\n            new Among(\"ive\", -1, 1, \"\", methodObject),\n            new Among(\"ize\", -1, 1, \"\", methodObject),\n            new Among(\"iti\", -1, 1, \"\", methodObject),\n            new Among(\"al\", -1, 1, \"\", methodObject),\n            new Among(\"ism\", -1, 1, \"\", methodObject),\n            new Among(\"ion\", -1, 2, \"\", methodObject),\n            new Among(\"er\", -1, 1, \"\", methodObject),\n            new Among(\"ous\", -1, 1, \"\", methodObject),\n            new Among(\"ant\", -1, 1, \"\", methodObject),\n            new Among(\"ent\", -1, 1, \"\", methodObject),\n            new Among(\"ment\", 15, 1, \"\", methodObject),\n            new Among(\"ement\", 16, 1, \"\", methodObject)\n    };\n\n    private final static Among a_8[] = {\n            new Among(\"e\", -1, 1, \"\", methodObject),\n            new Among(\"l\", -1, 2, \"\", methodObject)\n    };\n\n    private final static Among a_9[] = {\n            new Among(\"succeed\", -1, -1, \"\", methodObject),\n            new Among(\"proceed\", -1, -1, \"\", methodObject),\n            new Among(\"exceed\", -1, -1, \"\", methodObject),\n            new Among(\"canning\", -1, -1, \"\", methodObject),\n            new Among(\"inning\", -1, -1, \"\", methodObject),\n            new Among(\"earring\", -1, -1, \"\", methodObject),\n            new Among(\"herring\", -1, -1, \"\", methodObject),\n            new Among(\"outing\", -1, -1, \"\", methodObject)\n    };\n\n    private final static Among a_10[] = {\n            new Among(\"andes\", -1, -1, \"\", methodObject),\n            new Among(\"atlas\", -1, -1, \"\", methodObject),\n            new Among(\"bias\", -1, -1, \"\", methodObject),\n            new Among(\"cosmos\", -1, -1, \"\", methodObject),\n            new Among(\"dying\", -1, 3, \"\", methodObject),\n            new Among(\"early\", -1, 9, \"\", methodObject),\n            new Among(\"gently\", -1, 7, \"\", methodObject),\n            new Among(\"howe\", -1, -1, \"\", methodObject),\n            new Among(\"idly\", -1, 6, \"\", methodObject),\n            new Among(\"lying\", -1, 4, \"\", methodObject),\n            new Among(\"news\", -1, -1, \"\", methodObject),\n            new Among(\"only\", -1, 10, \"\", methodObject),\n            new Among(\"singly\", -1, 11, \"\", methodObject),\n            new Among(\"skies\", -1, 2, \"\", methodObject),\n            new Among(\"skis\", -1, 1, \"\", methodObject),\n            new Among(\"sky\", -1, -1, \"\", methodObject),\n            new Among(\"tying\", -1, 5, \"\", methodObject),\n            new Among(\"ugly\", -1, 8, \"\", methodObject)\n    };\n\n    private static final char g_v[] = {17, 65, 16, 1};\n\n    private static final char g_v_WXY[] = {1, 17, 65, 208, 1};\n\n    private static final char g_valid_LI[] = {55, 141, 2};\n\n    private boolean B_Y_found;\n    private int I_p2;\n    private int I_p1;\n\n    private void copy_from(EnglishStem other) {\n        B_Y_found = other.B_Y_found;\n        I_p2 = other.I_p2;\n        I_p1 = other.I_p1;\n        super.copy_from(other);\n    }\n\n    private boolean r_prelude() {\n        int v_1;\n        int v_2;\n        int v_3;\n        int v_4;\n        int v_5;\n        // (, line 25\n        // unset Y_found, line 26\n        B_Y_found = false;\n        // do, line 27\n        v_1 = cursor;\n        lab0:\n        do {\n            // (, line 27\n            // [, line 27\n            bra = cursor;\n            // literal, line 27\n            if (!(eq_s(1, \"'\"))) {\n                break lab0;\n            }\n            // ], line 27\n            ket = cursor;\n            // delete, line 27\n            slice_del();\n        } while (false);\n        cursor = v_1;\n        // do, line 28\n        v_2 = cursor;\n        lab1:\n        do {\n            // (, line 28\n            // [, line 28\n            bra = cursor;\n            // literal, line 28\n            if (!(eq_s(1, \"y\"))) {\n                break lab1;\n            }\n            // ], line 28\n            ket = cursor;\n            // <-, line 28\n            slice_from(\"Y\");\n            // set Y_found, line 28\n            B_Y_found = true;\n        } while (false);\n        cursor = v_2;\n        // do, line 29\n        v_3 = cursor;\n        lab2:\n        do {\n            // repeat, line 29\n            replab3:\n            while (true) {\n                v_4 = cursor;\n                lab4:\n                do {\n                    // (, line 29\n                    // goto, line 29\n                    golab5:\n                    while (true) {\n                        v_5 = cursor;\n                        lab6:\n                        do {\n                            // (, line 29\n                            if (!(in_grouping(g_v, 97, 121))) {\n                                break lab6;\n                            }\n                            // [, line 29\n                            bra = cursor;\n                            // literal, line 29\n                            if (!(eq_s(1, \"y\"))) {\n                                break lab6;\n                            }\n                            // ], line 29\n                            ket = cursor;\n                            cursor = v_5;\n                            break golab5;\n                        } while (false);\n                        cursor = v_5;\n                        if (cursor >= limit) {\n                            break lab4;\n                        }\n                        cursor++;\n                    }\n                    // <-, line 29\n                    slice_from(\"Y\");\n                    // set Y_found, line 29\n                    B_Y_found = true;\n                    continue replab3;\n                } while (false);\n                cursor = v_4;\n                break replab3;\n            }\n        } while (false);\n        cursor = v_3;\n        return true;\n    }\n\n    private boolean r_mark_regions() {\n        int v_1;\n        int v_2;\n        // (, line 32\n        I_p1 = limit;\n        I_p2 = limit;\n        // do, line 35\n        v_1 = cursor;\n        lab0:\n        do {\n            // (, line 35\n            // or, line 41\n            lab1:\n            do {\n                v_2 = cursor;\n                lab2:\n                do {\n                    // among, line 36\n                    if (find_among(a_0, 3) == 0) {\n                        break lab2;\n                    }\n                    break lab1;\n                } while (false);\n                cursor = v_2;\n                // (, line 41\n                // gopast, line 41\n                golab3:\n                while (true) {\n                    lab4:\n                    do {\n                        if (!(in_grouping(g_v, 97, 121))) {\n                            break lab4;\n                        }\n                        break golab3;\n                    } while (false);\n                    if (cursor >= limit) {\n                        break lab0;\n                    }\n                    cursor++;\n                }\n                // gopast, line 41\n                golab5:\n                while (true) {\n                    lab6:\n                    do {\n                        if (!(out_grouping(g_v, 97, 121))) {\n                            break lab6;\n                        }\n                        break golab5;\n                    } while (false);\n                    if (cursor >= limit) {\n                        break lab0;\n                    }\n                    cursor++;\n                }\n            } while (false);\n            // setmark p1, line 42\n            I_p1 = cursor;\n            // gopast, line 43\n            golab7:\n            while (true) {\n                lab8:\n                do {\n                    if (!(in_grouping(g_v, 97, 121))) {\n                        break lab8;\n                    }\n                    break golab7;\n                } while (false);\n                if (cursor >= limit) {\n                    break lab0;\n                }\n                cursor++;\n            }\n            // gopast, line 43\n            golab9:\n            while (true) {\n                lab10:\n                do {\n                    if (!(out_grouping(g_v, 97, 121))) {\n                        break lab10;\n                    }\n                    break golab9;\n                } while (false);\n                if (cursor >= limit) {\n                    break lab0;\n                }\n                cursor++;\n            }\n            // setmark p2, line 43\n            I_p2 = cursor;\n        } while (false);\n        cursor = v_1;\n        return true;\n    }\n\n    private boolean r_shortv() {\n        int v_1;\n        // (, line 49\n        // or, line 51\n        lab0:\n        do {\n            v_1 = limit - cursor;\n            lab1:\n            do {\n                // (, line 50\n                if (!(out_grouping_b(g_v_WXY, 89, 121))) {\n                    break lab1;\n                }\n                if (!(in_grouping_b(g_v, 97, 121))) {\n                    break lab1;\n                }\n                if (!(out_grouping_b(g_v, 97, 121))) {\n                    break lab1;\n                }\n                break lab0;\n            } while (false);\n            cursor = limit - v_1;\n            // (, line 52\n            if (!(out_grouping_b(g_v, 97, 121))) {\n                return false;\n            }\n            if (!(in_grouping_b(g_v, 97, 121))) {\n                return false;\n            }\n            // atlimit, line 52\n            if (cursor > limit_backward) {\n                return false;\n            }\n        } while (false);\n        return true;\n    }\n\n    private boolean r_R1() {\n        if (!(I_p1 <= cursor)) {\n            return false;\n        }\n        return true;\n    }\n\n    private boolean r_R2() {\n        if (!(I_p2 <= cursor)) {\n            return false;\n        }\n        return true;\n    }\n\n    private boolean r_Step_1a() {\n        int among_var;\n        int v_1;\n        int v_2;\n        // (, line 58\n        // try, line 59\n        v_1 = limit - cursor;\n        lab0:\n        do {\n            // (, line 59\n            // [, line 60\n            ket = cursor;\n            // substring, line 60\n            among_var = find_among_b(a_1, 3);\n            if (among_var == 0) {\n                cursor = limit - v_1;\n                break lab0;\n            }\n            // ], line 60\n            bra = cursor;\n            switch (among_var) {\n                case 0:\n                    cursor = limit - v_1;\n                    break lab0;\n                case 1:\n                    // (, line 62\n                    // delete, line 62\n                    slice_del();\n                    break;\n            }\n        } while (false);\n        // [, line 65\n        ket = cursor;\n        // substring, line 65\n        among_var = find_among_b(a_2, 6);\n        if (among_var == 0) {\n            return false;\n        }\n        // ], line 65\n        bra = cursor;\n        switch (among_var) {\n            case 0:\n                return false;\n            case 1:\n                // (, line 66\n                // <-, line 66\n                slice_from(\"ss\");\n                break;\n            case 2:\n                // (, line 68\n                // or, line 68\n                lab1:\n                do {\n                    v_2 = limit - cursor;\n                    lab2:\n                    do {\n                        // (, line 68\n                        // hop, line 68\n                        {\n                            int c = cursor - 2;\n                            if (limit_backward > c || c > limit) {\n                                break lab2;\n                            }\n                            cursor = c;\n                        }\n                        // <-, line 68\n                        slice_from(\"i\");\n                        break lab1;\n                    } while (false);\n                    cursor = limit - v_2;\n                    // <-, line 68\n                    slice_from(\"ie\");\n                } while (false);\n                break;\n            case 3:\n                // (, line 69\n                // next, line 69\n                if (cursor <= limit_backward) {\n                    return false;\n                }\n                cursor--;\n                // gopast, line 69\n                golab3:\n                while (true) {\n                    lab4:\n                    do {\n                        if (!(in_grouping_b(g_v, 97, 121))) {\n                            break lab4;\n                        }\n                        break golab3;\n                    } while (false);\n                    if (cursor <= limit_backward) {\n                        return false;\n                    }\n                    cursor--;\n                }\n                // delete, line 69\n                slice_del();\n                break;\n        }\n        return true;\n    }\n\n    private boolean r_Step_1b() {\n        int among_var;\n        int v_1;\n        int v_3;\n        int v_4;\n        // (, line 74\n        // [, line 75\n        ket = cursor;\n        // substring, line 75\n        among_var = find_among_b(a_4, 6);\n        if (among_var == 0) {\n            return false;\n        }\n        // ], line 75\n        bra = cursor;\n        switch (among_var) {\n            case 0:\n                return false;\n            case 1:\n                // (, line 77\n                // call R1, line 77\n                if (!r_R1()) {\n                    return false;\n                }\n                // <-, line 77\n                slice_from(\"ee\");\n                break;\n            case 2:\n                // (, line 79\n                // test, line 80\n                v_1 = limit - cursor;\n                // gopast, line 80\n                golab0:\n                while (true) {\n                    lab1:\n                    do {\n                        if (!(in_grouping_b(g_v, 97, 121))) {\n                            break lab1;\n                        }\n                        break golab0;\n                    } while (false);\n                    if (cursor <= limit_backward) {\n                        return false;\n                    }\n                    cursor--;\n                }\n                cursor = limit - v_1;\n                // delete, line 80\n                slice_del();\n                // test, line 81\n                v_3 = limit - cursor;\n                // substring, line 81\n                among_var = find_among_b(a_3, 13);\n                if (among_var == 0) {\n                    return false;\n                }\n                cursor = limit - v_3;\n                switch (among_var) {\n                    case 0:\n                        return false;\n                    case 1:\n                        // (, line 83\n                        // <+, line 83\n                    {\n                        int c = cursor;\n                        insert(cursor, cursor, \"e\");\n                        cursor = c;\n                    }\n                    break;\n                    case 2:\n                        // (, line 86\n                        // [, line 86\n                        ket = cursor;\n                        // next, line 86\n                        if (cursor <= limit_backward) {\n                            return false;\n                        }\n                        cursor--;\n                        // ], line 86\n                        bra = cursor;\n                        // delete, line 86\n                        slice_del();\n                        break;\n                    case 3:\n                        // (, line 87\n                        // atmark, line 87\n                        if (cursor != I_p1) {\n                            return false;\n                        }\n                        // test, line 87\n                        v_4 = limit - cursor;\n                        // call shortv, line 87\n                        if (!r_shortv()) {\n                            return false;\n                        }\n                        cursor = limit - v_4;\n                        // <+, line 87\n                    {\n                        int c = cursor;\n                        insert(cursor, cursor, \"e\");\n                        cursor = c;\n                    }\n                    break;\n                }\n                break;\n        }\n        return true;\n    }\n\n    private boolean r_Step_1c() {\n        int v_1;\n        int v_2;\n        // (, line 93\n        // [, line 94\n        ket = cursor;\n        // or, line 94\n        lab0:\n        do {\n            v_1 = limit - cursor;\n            lab1:\n            do {\n                // literal, line 94\n                if (!(eq_s_b(1, \"y\"))) {\n                    break lab1;\n                }\n                break lab0;\n            } while (false);\n            cursor = limit - v_1;\n            // literal, line 94\n            if (!(eq_s_b(1, \"Y\"))) {\n                return false;\n            }\n        } while (false);\n        // ], line 94\n        bra = cursor;\n        if (!(out_grouping_b(g_v, 97, 121))) {\n            return false;\n        }\n        // not, line 95\n        {\n            v_2 = limit - cursor;\n            lab2:\n            do {\n                // atlimit, line 95\n                if (cursor > limit_backward) {\n                    break lab2;\n                }\n                return false;\n            } while (false);\n            cursor = limit - v_2;\n        }\n        // <-, line 96\n        slice_from(\"i\");\n        return true;\n    }\n\n    private boolean r_Step_2() {\n        int among_var;\n        // (, line 99\n        // [, line 100\n        ket = cursor;\n        // substring, line 100\n        among_var = find_among_b(a_5, 24);\n        if (among_var == 0) {\n            return false;\n        }\n        // ], line 100\n        bra = cursor;\n        // call R1, line 100\n        if (!r_R1()) {\n            return false;\n        }\n        switch (among_var) {\n            case 0:\n                return false;\n            case 1:\n                // (, line 101\n                // <-, line 101\n                slice_from(\"tion\");\n                break;\n            case 2:\n                // (, line 102\n                // <-, line 102\n                slice_from(\"ence\");\n                break;\n            case 3:\n                // (, line 103\n                // <-, line 103\n                slice_from(\"ance\");\n                break;\n            case 4:\n                // (, line 104\n                // <-, line 104\n                slice_from(\"able\");\n                break;\n            case 5:\n                // (, line 105\n                // <-, line 105\n                slice_from(\"ent\");\n                break;\n            case 6:\n                // (, line 107\n                // <-, line 107\n                slice_from(\"ize\");\n                break;\n            case 7:\n                // (, line 109\n                // <-, line 109\n                slice_from(\"ate\");\n                break;\n            case 8:\n                // (, line 111\n                // <-, line 111\n                slice_from(\"al\");\n                break;\n            case 9:\n                // (, line 112\n                // <-, line 112\n                slice_from(\"ful\");\n                break;\n            case 10:\n                // (, line 114\n                // <-, line 114\n                slice_from(\"ous\");\n                break;\n            case 11:\n                // (, line 116\n                // <-, line 116\n                slice_from(\"ive\");\n                break;\n            case 12:\n                // (, line 118\n                // <-, line 118\n                slice_from(\"ble\");\n                break;\n            case 13:\n                // (, line 119\n                // literal, line 119\n                if (!(eq_s_b(1, \"l\"))) {\n                    return false;\n                }\n                // <-, line 119\n                slice_from(\"og\");\n                break;\n            case 14:\n                // (, line 120\n                // <-, line 120\n                slice_from(\"ful\");\n                break;\n            case 15:\n                // (, line 121\n                // <-, line 121\n                slice_from(\"less\");\n                break;\n            case 16:\n                // (, line 122\n                if (!(in_grouping_b(g_valid_LI, 99, 116))) {\n                    return false;\n                }\n                // delete, line 122\n                slice_del();\n                break;\n        }\n        return true;\n    }\n\n    private boolean r_Step_3() {\n        int among_var;\n        // (, line 126\n        // [, line 127\n        ket = cursor;\n        // substring, line 127\n        among_var = find_among_b(a_6, 9);\n        if (among_var == 0) {\n            return false;\n        }\n        // ], line 127\n        bra = cursor;\n        // call R1, line 127\n        if (!r_R1()) {\n            return false;\n        }\n        switch (among_var) {\n            case 0:\n                return false;\n            case 1:\n                // (, line 128\n                // <-, line 128\n                slice_from(\"tion\");\n                break;\n            case 2:\n                // (, line 129\n                // <-, line 129\n                slice_from(\"ate\");\n                break;\n            case 3:\n                // (, line 130\n                // <-, line 130\n                slice_from(\"al\");\n                break;\n            case 4:\n                // (, line 132\n                // <-, line 132\n                slice_from(\"ic\");\n                break;\n            case 5:\n                // (, line 134\n                // delete, line 134\n                slice_del();\n                break;\n            case 6:\n                // (, line 136\n                // call R2, line 136\n                if (!r_R2()) {\n                    return false;\n                }\n                // delete, line 136\n                slice_del();\n                break;\n        }\n        return true;\n    }\n\n    private boolean r_Step_4() {\n        int among_var;\n        int v_1;\n        // (, line 140\n        // [, line 141\n        ket = cursor;\n        // substring, line 141\n        among_var = find_among_b(a_7, 18);\n        if (among_var == 0) {\n            return false;\n        }\n        // ], line 141\n        bra = cursor;\n        // call R2, line 141\n        if (!r_R2()) {\n            return false;\n        }\n        switch (among_var) {\n            case 0:\n                return false;\n            case 1:\n                // (, line 144\n                // delete, line 144\n                slice_del();\n                break;\n            case 2:\n                // (, line 145\n                // or, line 145\n                lab0:\n                do {\n                    v_1 = limit - cursor;\n                    lab1:\n                    do {\n                        // literal, line 145\n                        if (!(eq_s_b(1, \"s\"))) {\n                            break lab1;\n                        }\n                        break lab0;\n                    } while (false);\n                    cursor = limit - v_1;\n                    // literal, line 145\n                    if (!(eq_s_b(1, \"t\"))) {\n                        return false;\n                    }\n                } while (false);\n                // delete, line 145\n                slice_del();\n                break;\n        }\n        return true;\n    }\n\n    private boolean r_Step_5() {\n        int among_var;\n        int v_1;\n        int v_2;\n        // (, line 149\n        // [, line 150\n        ket = cursor;\n        // substring, line 150\n        among_var = find_among_b(a_8, 2);\n        if (among_var == 0) {\n            return false;\n        }\n        // ], line 150\n        bra = cursor;\n        switch (among_var) {\n            case 0:\n                return false;\n            case 1:\n                // (, line 151\n                // or, line 151\n                lab0:\n                do {\n                    v_1 = limit - cursor;\n                    lab1:\n                    do {\n                        // call R2, line 151\n                        if (!r_R2()) {\n                            break lab1;\n                        }\n                        break lab0;\n                    } while (false);\n                    cursor = limit - v_1;\n                    // (, line 151\n                    // call R1, line 151\n                    if (!r_R1()) {\n                        return false;\n                    }\n                    // not, line 151\n                    {\n                        v_2 = limit - cursor;\n                        lab2:\n                        do {\n                            // call shortv, line 151\n                            if (!r_shortv()) {\n                                break lab2;\n                            }\n                            return false;\n                        } while (false);\n                        cursor = limit - v_2;\n                    }\n                } while (false);\n                // delete, line 151\n                slice_del();\n                break;\n            case 2:\n                // (, line 152\n                // call R2, line 152\n                if (!r_R2()) {\n                    return false;\n                }\n                // literal, line 152\n                if (!(eq_s_b(1, \"l\"))) {\n                    return false;\n                }\n                // delete, line 152\n                slice_del();\n                break;\n        }\n        return true;\n    }\n\n    private boolean r_exception2() {\n        // (, line 156\n        // [, line 158\n        ket = cursor;\n        // substring, line 158\n        if (find_among_b(a_9, 8) == 0) {\n            return false;\n        }\n        // ], line 158\n        bra = cursor;\n        // atlimit, line 158\n        if (cursor > limit_backward) {\n            return false;\n        }\n        return true;\n    }\n\n    private boolean r_exception1() {\n        int among_var;\n        // (, line 168\n        // [, line 170\n        bra = cursor;\n        // substring, line 170\n        among_var = find_among(a_10, 18);\n        if (among_var == 0) {\n            return false;\n        }\n        // ], line 170\n        ket = cursor;\n        // atlimit, line 170\n        if (cursor < limit) {\n            return false;\n        }\n        switch (among_var) {\n            case 0:\n                return false;\n            case 1:\n                // (, line 174\n                // <-, line 174\n                slice_from(\"ski\");\n                break;\n            case 2:\n                // (, line 175\n                // <-, line 175\n                slice_from(\"sky\");\n                break;\n            case 3:\n                // (, line 176\n                // <-, line 176\n                slice_from(\"die\");\n                break;\n            case 4:\n                // (, line 177\n                // <-, line 177\n                slice_from(\"lie\");\n                break;\n            case 5:\n                // (, line 178\n                // <-, line 178\n                slice_from(\"tie\");\n                break;\n            case 6:\n                // (, line 182\n                // <-, line 182\n                slice_from(\"idl\");\n                break;\n            case 7:\n                // (, line 183\n                // <-, line 183\n                slice_from(\"gentl\");\n                break;\n            case 8:\n                // (, line 184\n                // <-, line 184\n                slice_from(\"ugli\");\n                break;\n            case 9:\n                // (, line 185\n                // <-, line 185\n                slice_from(\"earli\");\n                break;\n            case 10:\n                // (, line 186\n                // <-, line 186\n                slice_from(\"onli\");\n                break;\n            case 11:\n                // (, line 187\n                // <-, line 187\n                slice_from(\"singl\");\n                break;\n        }\n        return true;\n    }\n\n    private boolean r_postlude() {\n        int v_1;\n        int v_2;\n        // (, line 203\n        // Boolean test Y_found, line 203\n        if (!(B_Y_found)) {\n            return false;\n        }\n        // repeat, line 203\n        replab0:\n        while (true) {\n            v_1 = cursor;\n            lab1:\n            do {\n                // (, line 203\n                // goto, line 203\n                golab2:\n                while (true) {\n                    v_2 = cursor;\n                    lab3:\n                    do {\n                        // (, line 203\n                        // [, line 203\n                        bra = cursor;\n                        // literal, line 203\n                        if (!(eq_s(1, \"Y\"))) {\n                            break lab3;\n                        }\n                        // ], line 203\n                        ket = cursor;\n                        cursor = v_2;\n                        break golab2;\n                    } while (false);\n                    cursor = v_2;\n                    if (cursor >= limit) {\n                        break lab1;\n                    }\n                    cursor++;\n                }\n                // <-, line 203\n                slice_from(\"y\");\n                continue replab0;\n            } while (false);\n            cursor = v_1;\n            break replab0;\n        }\n        return true;\n    }\n\n    public boolean stem() {\n        int v_1;\n        int v_2;\n        int v_3;\n        int v_4;\n        int v_5;\n        int v_6;\n        int v_7;\n        int v_8;\n        int v_9;\n        int v_10;\n        int v_11;\n        int v_12;\n        int v_13;\n        // (, line 205\n        // or, line 207\n        lab0:\n        do {\n            v_1 = cursor;\n            lab1:\n            do {\n                // call exception1, line 207\n                if (!r_exception1()) {\n                    break lab1;\n                }\n                break lab0;\n            } while (false);\n            cursor = v_1;\n            lab2:\n            do {\n                // not, line 208\n                {\n                    v_2 = cursor;\n                    lab3:\n                    do {\n                        // hop, line 208\n                        {\n                            int c = cursor + 3;\n                            if (0 > c || c > limit) {\n                                break lab3;\n                            }\n                            cursor = c;\n                        }\n                        break lab2;\n                    } while (false);\n                    cursor = v_2;\n                }\n                break lab0;\n            } while (false);\n            cursor = v_1;\n            // (, line 208\n            // do, line 209\n            v_3 = cursor;\n            lab4:\n            do {\n                // call prelude, line 209\n                if (!r_prelude()) {\n                    break lab4;\n                }\n            } while (false);\n            cursor = v_3;\n            // do, line 210\n            v_4 = cursor;\n            lab5:\n            do {\n                // call mark_regions, line 210\n                if (!r_mark_regions()) {\n                    break lab5;\n                }\n            } while (false);\n            cursor = v_4;\n            // backwards, line 211\n            limit_backward = cursor;\n            cursor = limit;\n            // (, line 211\n            // do, line 213\n            v_5 = limit - cursor;\n            lab6:\n            do {\n                // call Step_1a, line 213\n                if (!r_Step_1a()) {\n                    break lab6;\n                }\n            } while (false);\n            cursor = limit - v_5;\n            // or, line 215\n            lab7:\n            do {\n                v_6 = limit - cursor;\n                lab8:\n                do {\n                    // call exception2, line 215\n                    if (!r_exception2()) {\n                        break lab8;\n                    }\n                    break lab7;\n                } while (false);\n                cursor = limit - v_6;\n                // (, line 215\n                // do, line 217\n                v_7 = limit - cursor;\n                lab9:\n                do {\n                    // call Step_1b, line 217\n                    if (!r_Step_1b()) {\n                        break lab9;\n                    }\n                } while (false);\n                cursor = limit - v_7;\n                // do, line 218\n                v_8 = limit - cursor;\n                lab10:\n                do {\n                    // call Step_1c, line 218\n                    if (!r_Step_1c()) {\n                        break lab10;\n                    }\n                } while (false);\n                cursor = limit - v_8;\n                // do, line 220\n                v_9 = limit - cursor;\n                lab11:\n                do {\n                    // call Step_2, line 220\n                    if (!r_Step_2()) {\n                        break lab11;\n                    }\n                } while (false);\n                cursor = limit - v_9;\n                // do, line 221\n                v_10 = limit - cursor;\n                lab12:\n                do {\n                    // call Step_3, line 221\n                    if (!r_Step_3()) {\n                        break lab12;\n                    }\n                } while (false);\n                cursor = limit - v_10;\n                // do, line 222\n                v_11 = limit - cursor;\n                lab13:\n                do {\n                    // call Step_4, line 222\n                    if (!r_Step_4()) {\n                        break lab13;\n                    }\n                } while (false);\n                cursor = limit - v_11;\n                // do, line 224\n                v_12 = limit - cursor;\n                lab14:\n                do {\n                    // call Step_5, line 224\n                    if (!r_Step_5()) {\n                        break lab14;\n                    }\n                } while (false);\n                cursor = limit - v_12;\n            } while (false);\n            cursor = limit_backward;                        // do, line 227\n            v_13 = cursor;\n            lab15:\n            do {\n                // call postlude, line 227\n                if (!r_postlude()) {\n                    break lab15;\n                }\n            } while (false);\n            cursor = v_13;\n        } while (false);\n        return true;\n    }\n\n    public boolean equals(Object o) {\n        return o instanceof EnglishStem;\n    }\n\n    public int hashCode() {\n        return EnglishStem.class.getName().hashCode();\n    }\n\n\n}\n\n"
  }
]