Full Code of Bakumon/UGank for AI

master 79b6191d5c7f cached
133 files
387.5 KB
104.7k tokens
708 symbols
1 requests
Download .txt
Showing preview only (444K chars total). Download the full file or copy to clipboard to get everything.
Repository: Bakumon/UGank
Branch: master
Commit: 79b6191d5c7f
Files: 133
Total size: 387.5 KB

Directory structure:
gitextract_vqa0jwoy/

├── .gitignore
├── LICENSE
├── README.md
├── _config.yml
├── app/
│   ├── .gitignore
│   ├── build.gradle
│   ├── proguard-rules.pro
│   ├── src/
│   │   ├── androidTest/
│   │   │   └── java/
│   │   │       └── me/
│   │   │           └── bakumon/
│   │   │               └── ugank/
│   │   │                   └── ExampleInstrumentedTest.java
│   │   ├── main/
│   │   │   ├── AndroidManifest.xml
│   │   │   ├── assets/
│   │   │   │   └── litepal.xml
│   │   │   ├── java/
│   │   │   │   └── me/
│   │   │   │       └── bakumon/
│   │   │   │           └── ugank/
│   │   │   │               ├── App.java
│   │   │   │               ├── ConfigManage.java
│   │   │   │               ├── GlobalConfig.java
│   │   │   │               ├── ThemeManage.java
│   │   │   │               ├── base/
│   │   │   │               │   ├── BaseDialog.java
│   │   │   │               │   ├── BasePresenter.java
│   │   │   │               │   ├── BaseView.java
│   │   │   │               │   ├── SwipeBackBaseActivity.java
│   │   │   │               │   └── adapter/
│   │   │   │               │       ├── CommonAdapter4RecyclerView.java
│   │   │   │               │       ├── CommonHolder4RecyclerView.java
│   │   │   │               │       ├── CommonViewPagerAdapter.java
│   │   │   │               │       └── ListenerWithPosition.java
│   │   │   │               ├── entity/
│   │   │   │               │   ├── CategoryResult.java
│   │   │   │               │   ├── Favorite.java
│   │   │   │               │   ├── History.java
│   │   │   │               │   └── SearchResult.java
│   │   │   │               ├── module/
│   │   │   │               │   ├── bigimg/
│   │   │   │               │   │   ├── BigimgActivity.java
│   │   │   │               │   │   ├── BigimgContract.java
│   │   │   │               │   │   └── BigimgPresenter.java
│   │   │   │               │   ├── category/
│   │   │   │               │   │   ├── CategoryContract.java
│   │   │   │               │   │   ├── CategoryFragment.java
│   │   │   │               │   │   ├── CategoryListAdapter.java
│   │   │   │               │   │   └── CategoryPresenter.java
│   │   │   │               │   ├── favorite/
│   │   │   │               │   │   ├── FavoriteActivity.java
│   │   │   │               │   │   ├── FavoriteContract.java
│   │   │   │               │   │   ├── FavoriteListAdapter.java
│   │   │   │               │   │   └── FavoritePresenter.java
│   │   │   │               │   ├── home/
│   │   │   │               │   │   ├── HomeActivity.java
│   │   │   │               │   │   ├── HomeContract.java
│   │   │   │               │   │   └── HomePresenter.java
│   │   │   │               │   ├── launcher/
│   │   │   │               │   │   ├── LauncherActivity.java
│   │   │   │               │   │   ├── LauncherContract.java
│   │   │   │               │   │   └── LauncherPresenter.java
│   │   │   │               │   ├── search/
│   │   │   │               │   │   ├── HistoryListAdapter.java
│   │   │   │               │   │   ├── SearchActivity.java
│   │   │   │               │   │   ├── SearchContract.java
│   │   │   │               │   │   ├── SearchListAdapter.java
│   │   │   │               │   │   └── SearchPresenter.java
│   │   │   │               │   ├── setting/
│   │   │   │               │   │   ├── SettingActivity.java
│   │   │   │               │   │   ├── SettingContract.java
│   │   │   │               │   │   └── SettingPresenter.java
│   │   │   │               │   └── webview/
│   │   │   │               │       ├── WebViewActivity.java
│   │   │   │               │       ├── WebViewContract.java
│   │   │   │               │       └── WebViewPresenter.java
│   │   │   │               ├── network/
│   │   │   │               │   ├── NetWork.java
│   │   │   │               │   └── api/
│   │   │   │               │       └── GankApi.java
│   │   │   │               ├── utills/
│   │   │   │               │   ├── AlipayZeroSdk.java
│   │   │   │               │   ├── AndroidUtil.java
│   │   │   │               │   ├── DataCleanManager.java
│   │   │   │               │   ├── DateUtil.java
│   │   │   │               │   ├── DisplayUtils.java
│   │   │   │               │   ├── EmojiFilter.java
│   │   │   │               │   ├── ImageUtil.java
│   │   │   │               │   ├── KeyboardUtils.java
│   │   │   │               │   ├── MDTintUtil.java
│   │   │   │               │   ├── PackageUtil.java
│   │   │   │               │   └── StatusBarUtil.java
│   │   │   │               └── widget/
│   │   │   │                   ├── AboutDialog.java
│   │   │   │                   ├── ObservableWebView.java
│   │   │   │                   ├── PinchImageView.java
│   │   │   │                   ├── RecycleViewDivider.java
│   │   │   │                   ├── SquareLoading.java
│   │   │   │                   └── recyclerviewwithfooter/
│   │   │   │                       ├── DefaultEmptyItem.java
│   │   │   │                       ├── DefaultFootItem.java
│   │   │   │                       ├── EmptyItem.java
│   │   │   │                       ├── FootItem.java
│   │   │   │                       ├── OnLoadMoreListener.java
│   │   │   │                       ├── RecyclerViewUtils.java
│   │   │   │                       └── RecyclerViewWithFooter.java
│   │   │   └── res/
│   │   │       ├── color/
│   │   │       │   ├── select_press_color_gray.xml
│   │   │       │   └── select_press_color_white.xml
│   │   │       ├── drawable/
│   │   │       │   ├── ic_beauty.xml
│   │   │       │   ├── ic_collection.xml
│   │   │       │   ├── ic_collection_shortcut.xml
│   │   │       │   ├── ic_edit_clear.xml
│   │   │       │   ├── ic_favorite.xml
│   │   │       │   ├── ic_item_author.xml
│   │   │       │   ├── ic_item_label.xml
│   │   │       │   ├── ic_item_time.xml
│   │   │       │   ├── ic_loading.xml
│   │   │       │   ├── ic_right.xml
│   │   │       │   ├── ic_search_gank.xml
│   │   │       │   ├── ic_search_shortcut.xml
│   │   │       │   ├── ic_setting.xml
│   │   │       │   ├── ic_unfavorite.xml
│   │   │       │   ├── ic_webview_finish.xml
│   │   │       │   ├── progressbar.xml
│   │   │       │   ├── selector_history_item.xml
│   │   │       │   ├── shape_corners_gray.xml
│   │   │       │   ├── shape_corners_stroke_gray.xml
│   │   │       │   └── shape_corners_white.xml
│   │   │       ├── layout/
│   │   │       │   ├── activity_bigimg.xml
│   │   │       │   ├── activity_favorite.xml
│   │   │       │   ├── activity_home.xml
│   │   │       │   ├── activity_launcher.xml
│   │   │       │   ├── activity_search.xml
│   │   │       │   ├── activity_setting.xml
│   │   │       │   ├── activity_web_view.xml
│   │   │       │   ├── dialog_about.xml
│   │   │       │   ├── fragment.xml
│   │   │       │   ├── item.xml
│   │   │       │   ├── item_favorite.xml
│   │   │       │   ├── item_history.xml
│   │   │       │   ├── item_search.xml
│   │   │       │   ├── rv_with_footer_empty_layout.xml
│   │   │       │   └── rv_with_footer_loading.xml
│   │   │       ├── menu/
│   │   │       │   └── menu_webview.xml
│   │   │       ├── values/
│   │   │       │   ├── attrs_square_loading.xml
│   │   │       │   ├── colors.xml
│   │   │       │   ├── dimens.xml
│   │   │       │   ├── strings.xml
│   │   │       │   └── styles.xml
│   │   │       ├── values-v19/
│   │   │       │   └── styles.xml
│   │   │       └── xml/
│   │   │           └── shortcuts.xml
│   │   └── test/
│   │       └── java/
│   │           └── me/
│   │               └── bakumon/
│   │                   └── ugank/
│   │                       └── ExampleUnitTest.java
│   └── ugank.jks
├── build.gradle
├── gradle/
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
└── settings.gradle

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
*.iml
.gradle
/local.properties
.DS_Store
/build
/captures
.externalNativeBuild
/.idea/
keystore.properties

================================================
FILE: LICENSE
================================================
                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.

  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Use with the GNU Affero General Public License.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    {one line to give the program's name and a brief idea of what it does.}
    Copyright (C) {year}  {name of author}

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

    {project}  Copyright (C) {year}  {fullname}
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.

  The GNU General Public License does not permit incorporating your program
into proprietary programs.  If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.  But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.


================================================
FILE: README.md
================================================
# 「有干货」- 体验别具一格的 Gank.io 安卓客户端


![「有干货」启动图标](https://github.com/Bakumon/UGank/raw/master/art/ic_launcher.png)

## 下载

去酷安下载:

<a href='http://www.coolapk.com/apk/me.bakumon.ugank'><img alt='去酷安下载' src='https://ws4.sinaimg.cn/large/006tNc79ly1fsphx16ybdj30go06st8q.jpg' height="60"/>
</a>

## 介绍

「有干货」是一款注重体验的 [Gank.io](http://gank.io) 第三方安卓客户端,首页即可随机查看妹子,还能浏览各种类型(App、Android、iOS、前端、瞎推荐、拓展资源等)的干货数据,搜索界面提供妹子福利查看大图功能。App 整体秉承简洁风格。

## 架构

采用 MVP 架构。

参考:[android-architecture#todo-mvp-rxjava](https://github.com/googlesamples/android-architecture/tree/todo-mvp-rxjava)

## 截图

![ugank.jpg](https://github.com/Bakumon/UGank/raw/master/art/ugank.jpg)


## API
 [代码家](https://github.com/daimajia)  [干货集中营](http://gank.io/) 提供 API

## License

[GNU General Public License, version 3](https://github.com/Bakumon/UGank/blob/master/LICENSE)

================================================
FILE: _config.yml
================================================
theme: jekyll-theme-cayman
show_downloads: true

================================================
FILE: app/.gitignore
================================================
/build


================================================
FILE: app/build.gradle
================================================
apply plugin: 'com.android.application'

// 加载 keystore.properties 文件
def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
    compileSdkVersion ANDROID_BUILD_SDK_VERSION as int
    buildToolsVersion ANDROID_BUILD_TOOLS_VERSION
    defaultConfig {
        applicationId "me.bakumon.ugank"
        minSdkVersion ANDROID_BUILD_MIN_SDK_VERSION as int
        targetSdkVersion ANDROID_BUILD_TARGET_SDK_VERSION as int
        versionCode VERSION_CODE as int
        versionName VERSION_NAME
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    signingConfigs {
        release {
            storeFile file("ugank.jks")
            storePassword keystoreProperties['KEYSTORE_PASSWORD']
            keyAlias keystoreProperties['KEY_ALIAS']
            keyPassword keystoreProperties['KEY_PASSWORD']
        }
    }
    buildTypes {
        release {
            //  混淆
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            // Zipalign优化
            zipAlignEnabled true
            // 移除无用的resource文件
            shrinkResources true
            // 签名
            signingConfig signingConfigs.release
        }
        applicationVariants.all { variant ->
            variant.outputs.each { output ->
                def outputFile = output.outputFile
                if (outputFile != null && outputFile.name.endsWith('.apk')) {
                    // 输出apk名称为ugank_release_1.0.1_2.apk
                    def fileName = "ugank_release_${defaultConfig.versionName}_${defaultConfig.versionCode}.apk"
                    output.outputFile = new File(outputFile.parent, fileName)
                }
            }
        }
    }
}
apply plugin: 'com.neenbedankt.android-apt'
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile('com.github.Andy671:Dachshund-Tab-Layout:v0.3.0') {
        exclude group: 'com.android.support'
    }
    compile 'com.android.support:appcompat-v7:25.1.1'
    compile 'com.android.support:support-v4:25.1.1'
    compile 'com.android.support:design:25.1.1'
    compile 'io.reactivex:rxandroid:1.1.0'
    compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0'
    compile 'com.squareup.retrofit2:retrofit:2.0.0'
    compile 'com.squareup.retrofit2:converter-gson:2.0.0'
    compile 'com.jakewharton:butterknife:8.4.0'
    compile 'com.github.florent37:picassopalette:2.0.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.afollestad.material-dialogs:commons:0.9.3.0'
    compile 'cn.bingoogolapple:bga-swipebacklayout:1.0.7@aar'
    compile 'org.litepal.android:core:1.5.0'
    compile 'com.github.GrenderG:Toasty:1.1.3'
    testCompile 'junit:junit:4.12'
    testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
    apt 'com.jakewharton:butterknife-compiler:8.4.0'
    debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
    releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
    compile 'com.luolc:emoji-rain:0.1.1'
    compile 'com.google.android:flexbox:0.3.0-alpha3'
}


================================================
FILE: app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\android\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}
#############################################
#
# 对于一些基本指令的添加
#
#############################################
# 代码混淆压缩比,在0~7之间,默认为5,一般不做修改
-optimizationpasses 5

# 混合时不使用大小写混合,混合后的类名为小写
-dontusemixedcaseclassnames

# 指定不去忽略非公共库的类
-dontskipnonpubliclibraryclasses

# 这句话能够使我们的项目混淆后产生映射文件
# 包含有类名->混淆后类名的映射关系
-verbose

# 指定不去忽略非公共库的类成员
-dontskipnonpubliclibraryclassmembers

# 不做预校验,preverify是proguard的四个步骤之一,Android不需要preverify,去掉这一步能够加快混淆速度。
-dontpreverify

# 保留Annotation不混淆
-keepattributes *Annotation*,InnerClasses

# 避免混淆泛型
-keepattributes Signature

# 抛出异常时保留代码行号
-keepattributes SourceFile,LineNumberTable

# 指定混淆是采用的算法,后面的参数是一个过滤器
# 这个过滤器是谷歌推荐的算法,一般不做更改
-optimizations !code/simplification/cast,!field/*,!class/merging/*


#############################################
#
# Android开发中一些需要保留的公共部分
#
#############################################

# 保留我们使用的四大组件,自定义的Application等等这些类不被混淆
# 因为这些子类都有可能被外部调用
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Appliction
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class * extends android.view.View
-keep public class com.android.vending.licensing.ILicensingService


# 保留support下的所有类及其内部类
-keep class android.support.** {*;}

# 保留继承的
-keep public class * extends android.support.v4.**
-keep public class * extends android.support.v7.**
-keep public class * extends android.support.annotation.**

# 保留R下面的资源
-keep class **.R$* {*;}

# 保留本地native方法不被混淆
-keepclasseswithmembernames class * {
    native <methods>;
}

# 保留在Activity中的方法参数是view的方法,
# 这样以来我们在layout中写的onClick就不会被影响
-keepclassmembers class * extends android.app.Activity{
    public void *(android.view.View);
}

# 保留枚举类不被混淆
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

# 保留我们自定义控件(继承自View)不被混淆
-keep public class * extends android.view.View{
    *** get*();
    void set*(***);
    public <init>(android.content.Context);
    public <init>(android.content.Context, android.util.AttributeSet);
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

# 保留Parcelable序列化类不被混淆
-keep class * implements android.os.Parcelable {
    public static final android.os.Parcelable$Creator *;
}

# 保留Serializable序列化的类不被混淆
-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    !static !transient <fields>;
    !private <fields>;
    !private <methods>;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

# 对于带有回调函数的onXXEvent、**On*Listener的,不能被混淆
-keepclassmembers class * {
    void *(**On*Event);
    void *(**On*Listener);
}

# webView处理,项目中没有使用到webView忽略即可
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
    public *;
}
-keepclassmembers class * extends android.webkit.webViewClient {
    public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap);
    public boolean *(android.webkit.WebView, java.lang.String);
}
-keepclassmembers class * extends android.webkit.webViewClient {
    public void *(android.webkit.webView, jav.lang.String);
}

# 移除Log类打印各个等级日志的代码,打正式包的时候可以做为禁log使用,这里可以作为禁止log打印的功能使用
# 记得proguard-android.txt中一定不要加-dontoptimize才起作用
# 另外的一种实现方案是通过BuildConfig.DEBUG的变量来控制
#-assumenosideeffects class android.util.Log {
#    public static int v(...);
#    public static int i(...);
#    public static int w(...);
#    public static int d(...);
#    public static int e(...);
#}

#############################################
#
# 项目中特殊处理部分
#
#############################################

#-----------处理反射类---------------



#-----------处理js交互---------------



#-----------处理实体类---------------
# 在开发的时候我们可以将所有的实体类放在一个包内,这样我们写一次混淆就行了。
#-keep public class com.ljd.example.entity.** {
#    public void set*(***);
#    public *** get*();
#    public *** is*();
#}


#-----------处理第三方依赖库---------

# AndroidEventBus
-keep class org.simple.** { *; }
-keep interface org.simple.** { *; }
-keepclassmembers class * {
    @org.simple.eventbus.Subscriber <methods>;
}


# 百度地图(jar包换成自己的版本,记得签名要匹配)
#-libraryjars libs/baidumapapi_v2_1_3.jar
#-keep class com.baidu.** {*;}
#-keep class vi.com.** {*;}
#-keep class com.sinovoice.** {*;}
#-keep class pvi.com.** {*;}
#-dontwarn com.baidu.**
#-dontwarn vi.com.**
#-dontwarn pvi.com.**


# Bugly
#-dontwarn com.tencent.bugly.**
#-keep class com.tencent.bugly.** {*;}


# ButterKnife
-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewBinder { *; }
-keepclasseswithmembernames class * {
    @butterknife.* <fields>;
}
-keepclasseswithmembernames class * {
    @butterknife.* <methods>;
}


# EventBus
-keepattributes *Annotation*
-keepclassmembers class ** {
    @org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }


# Facebook
#-keep class com.facebook.** {*;}
#-keep interface com.facebook.** {*;}
#-keep enum com.facebook.** {*;}


# FastJson
#-dontwarn com.alibaba.fastjson.**
#-keep class com.alibaba.fastjson.** { *; }
#-keepattributes Signature
#-keepattributes *Annotation*


# Fresco
#-keep class com.facebook.fresco.** {*;}
#-keep interface com.facebook.fresco.** {*;}
#-keep enum com.facebook.fresco.** {*;}


# 高德相关依赖
# 集合包:3D地图3.3.2 导航1.8.0 定位2.5.0
#-dontwarn com.amap.api.**
#-dontwarn com.autonavi.**
#-keep class com.amap.api.**{*;}
#-keep class com.autonavi.**{*;}
# 地图服务
#-dontwarn com.amap.api.services.**
#-keep class com.map.api.services.** {*;}
# 3D地图
#-dontwarn com.amap.api.mapcore.**
#-dontwarn com.amap.api.maps.**
#-dontwarn com.autonavi.amap.mapcore.**
#-keep class com.amap.api.mapcore.**{*;}
#-keep class com.amap.api.maps.**{*;}
#-keep class com.autonavi.amap.mapcore.**{*;}
# 定位
#-dontwarn com.amap.api.location.**
#-dontwarn com.aps.**
#-keep class com.amap.api.location.**{*;}
#-keep class com.aps.**{*;}
# 导航
#-dontwarn com.amap.api.navi.**
#-dontwarn com.autonavi.**
#-keep class com.amap.api.navi.** {*;}
#-keep class com.autonavi.** {*;}


# Glide
#-keep public class * implements com.bumptech.glide.module.GlideModule
#-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
#  **[] $VALUES;
#  public *;
#}


### greenDAO 2
#-keepclassmembers class * extends de.greenrobot.dao.AbstractDao {
#public static java.lang.String TABLENAME;
#}
#-keep class **$Properties


### greenDAO 3
#-keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {
#public static java.lang.String TABLENAME;
#}
#-keep class **$Properties

# If you do not use SQLCipher:
#-dontwarn org.greenrobot.greendao.database.**
# If you do not use RxJava:
#-dontwarn rx.**


# Gson
#-keepattributes Signature-keepattributes *Annotation*
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.** { *; }
# 使用Gson时需要配置Gson的解析对象及变量都不混淆。不然Gson会找不到变量。
# 将下面替换成自己的实体类
-keep class me.bakumon.ugank.entity.** { *; }


# Jackson
#-dontwarn org.codehaus.jackson.**
#-dontwarn com.fasterxml.jackson.databind.**
#-keep class org.codehaus.jackson.** { *;}
#-keep class com.fasterxml.jackson.** { *; }


# 极光推送
#-dontoptimize
#-dontpreverify
#-dontwarn cn.jpush.**
#-keep class cn.jpush.** { *; }


# OkHttp
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-dontwarn com.squareup.okhttp.**


# OkHttp3
-dontwarn com.squareup.okhttp3.**
-keep class com.squareup.okhttp3.** { *;}
-dontwarn okio.**


# Okio
-dontwarn com.squareup.**
-dontwarn okio.**
-keep public class org.codehaus.* { *; }
-keep public class java.nio.* { *; }


# OrmLite
#-keepattributes *DatabaseField*
#-keepattributes *DatabaseTable*
#-keepattributes *SerializedName*
#-keep class com.j256.**
#-keepclassmembers class com.j256.** { *; }
#-keep enum com.j256.**
#-keepclassmembers enum com.j256.** { *; }
#-keep interface com.j256.**
#-keepclassmembers interface com.j256.** { *; }


# Realm
#-keep class io.realm.annotations.RealmModule
#-keep @io.realm.annotations.RealmModule class *
#-keep class io.realm.internal.Keep
#-keep @io.realm.internal.Keep class * { *; }
#-dontwarn javax.**
#-dontwarn io.realm.**


# Retrofit
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions


# Retrolambda
-dontwarn java.lang.invoke.*


# RxJava RxAndroid
-dontwarn sun.misc.**
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
    long producerIndex;
    long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
    rx.internal.util.atomic.LinkedQueueNode producerNode;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
    rx.internal.util.atomic.LinkedQueueNode consumerNode;
}


# Universal-Image-Loader-v1.9.5
#-libraryjars libs/universal-image-loader-1.9.5-SNAPSHOT-with-sources.jar
#-dontwarn com.nostra13.universalimageloader.**
#-keep class com.nostra13.universalimageloader.** { *; }


# 微信支付
#-dontwarn com.tencent.mm.**
#-dontwarn com.tencent.wxop.stat.**
#-keep class com.tencent.mm.** {*;}
#-keep class com.tencent.wxop.stat.**{*;}


# 信鸽
#-keep public class * extends android.app.Service
#-keep public class * extends android.content.BroadcastReceiver
#-keep class com.tencent.android.tpush.**  {* ;}
#-keep class com.tencent.mid.**  {* ;}
#-keepattributes *Annotation*


# 新浪微博
#-keep class com.sina.weibo.sdk.* { *; }
#-keep class android.support.v4.* { *; }
#-keep class com.tencent.* { *; }
#-keep class com.baidu.* { *; }
#-keep class lombok.ast.ecj.* { *; }
#-dontwarn android.support.v4.**
#-dontwarn com.tencent.**s
#-dontwarn com.baidu.**


# 讯飞语音
#-dontwarn com.iflytek.**
#-keep class com.iflytek.** {*;}


# xUtils3.0
#-keepattributes Signature,Annotation
#-keep public class org.xutils.** {
#public protected *;
#}
#-keep public interface org.xutils.** {
#public protected *;
#}
#-keepclassmembers class * extends org.xutils.** {
#public protected *;
#}
#-keepclassmembers @org.xutils.db.annotation.* class * {*;}
#-keepclassmembers @org.xutils.http.annotation. class * {*;}
#-keepclassmembers class * {
#@org.xutils.view.annotation.Event ;
#}


# 银联
#-dontwarn com.unionpay.**
#-keep class com.unionpay.** { *; }


# 友盟统计分析
#-keepclassmembers class * { public <init>(org.json.JSONObject); }
#-keepclassmembers enum com.umeng.analytics.** {
#    public static **[] values();
#    public static ** valueOf(java.lang.String);
#}


# 友盟自动更新
#-keepclassmembers class * { public <init>(org.json.JSONObject); }
#-keep public class cn.irains.parking.cloud.pub.R$*{ public static final int *; }
#-keep public class * extends com.umeng.**
#-keep class com.umeng.** { *; }


# 支付宝钱包
#-dontwarn com.alipay.**
#-dontwarn HttpUtils.HttpFetcher
#-dontwarn com.ta.utdid2.**
#-dontwarn com.ut.device.**
#-keep class com.alipay.android.app.IAlixPay{*;}
#-keep class com.alipay.android.app.IAlixPay$Stub{*;}
#-keep class com.alipay.android.app.IRemoteServiceCallback{*;}
#-keep class com.alipay.android.app.IRemoteServiceCallback$Stub{*;}
#-keep class com.alipay.sdk.app.PayTask{ public *;}
#-keep class com.alipay.sdk.app.AuthTask{ public *;}
#-keep class com.alipay.mobilesecuritysdk.*
#-keep class com.ut.*

#litepalang
-keep class org.litepal.** {*;}
-keep class * extends org.litepal.crud.DataSupport {*;}

================================================
FILE: app/src/androidTest/java/me/bakumon/ugank/ExampleInstrumentedTest.java
================================================
package me.bakumon.ugank;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
 * Instrumentation test, which will execute on an Android device.
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
    @Test
    public void useAppContext() throws Exception {
        // Context of the app under test.
        Context appContext = InstrumentationRegistry.getTargetContext();

        assertEquals("me.bakumon.gank", appContext.getPackageName());
    }
}


================================================
FILE: app/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="me.bakumon.ugank">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:name=".App"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <!-- 启动页 -->
        <activity
            android:name=".module.launcher.LauncherActivity"
            android:theme="@style/AppTheme.Launcher">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data
                android:name="android.app.shortcuts"
                android:resource="@xml/shortcuts"/>
        </activity>
        <!-- 主页 -->
        <activity android:name=".module.home.HomeActivity" />
        <!-- WebView -->
        <activity
            android:name=".module.webview.WebViewActivity"
            android:theme="@style/AppTheme.Transparent" />
        <!-- 设置  -->
        <activity
            android:name=".module.setting.SettingActivity"
            android:theme="@style/AppTheme.Transparent" />
        <!-- 搜索  -->
        <activity
            android:name=".module.search.SearchActivity"
            android:theme="@style/AppTheme.Transparent"
            android:windowSoftInputMode="stateVisible" />
        <!-- 查看妹子 -->
        <activity
            android:name=".module.bigimg.BigimgActivity"
            android:theme="@style/AppTheme.Transparent" />
        <!-- 收藏 -->
        <activity
            android:name=".module.favorite.FavoriteActivity"
            android:theme="@style/AppTheme.Transparent" />
    </application>

</manifest>

================================================
FILE: app/src/main/assets/litepal.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<litepal>
    <!--
        Define the database name of your application.
        By default each database name should be end with .db.
        If you didn't name your database end with .db,
        LitePal would plus the suffix automatically for you.
        For example:
        <dbname value="demo" />
    -->
    <dbname value="ugank_database"/>

    <!--
        Define the version of your database. Each time you want
        to upgrade your database, the version tag would helps.
        Modify the models you defined in the mapping tag, and just
        make the version value plus one, the upgrade of database
        will be processed automatically without concern.
            For example:
        <version value="1" />
    -->
    <version value="1"/>

    <!--
        Define your models in the list with mapping tag, LitePal will
        create tables for each mapping class. The supported fields
        defined in models will be mapped into columns.
        For example:
        <list>
            <mapping class="com.test.model.Reader" />
            <mapping class="com.test.model.Magazine" />
        </list>
    -->
    <list>
        <mapping class="me.bakumon.ugank.entity.History"/>
        <mapping class="me.bakumon.ugank.entity.Favorite" />
    </list>

    <!--
        Define where the .db file should be. "internal" means the .db file
        will be stored in the database folder of internal storage which no
        one can access. "external" means the .db file will be stored in the
        path to the directory on the primary external storage device where
        the application can place persistent files it owns which everyone
        can access. "internal" will act as default.
        For example:
        <storage value="external" />
    -->

</litepal>

================================================
FILE: app/src/main/java/me/bakumon/ugank/App.java
================================================
package me.bakumon.ugank;

import android.app.Application;

import com.squareup.leakcanary.LeakCanary;

import org.litepal.LitePal;

import cn.bingoogolapple.swipebacklayout.BGASwipeBackManager;

//import com.squareup.leakcanary.LeakCanary;

/**
 * App
 * Created by bakumon on 2016/12/8 17:18.
 */
public class App extends Application {
    private static App INSTANCE;

    public static App getInstance() {
        return INSTANCE;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        // 初始化 LeakCanary
        if (LeakCanary.isInAnalyzerProcess(this)) {
            // This process is dedicated to LeakCanary for heap analysis.
            // You should not init your app in this process.
            return;
        }
        LeakCanary.install(this);
        BGASwipeBackManager.getInstance().init(this);
        INSTANCE = this;
        // 初始化主题色
        ThemeManage.INSTANCE.initColorPrimary(getResources().getColor(R.color.colorPrimary));
        ConfigManage.INSTANCE.initConfig(this);
        LitePal.initialize(this);
    }


}


================================================
FILE: app/src/main/java/me/bakumon/ugank/ConfigManage.java
================================================
package me.bakumon.ugank;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * ConfigManage
 * Created by bakumon on 2016/12/22 15:44.
 */
public enum ConfigManage {
    INSTANCE;

    private final String spName = "app_config";
    private final String key_isListShowImg = "isListShowImg";
    private final String key_thumbnailQuality = "thumbnailQuality";
    private final String key_banner_url = "keyBannerUrl";
    private final String key_launcher_img_show = "keyLauncherImgShow";
    private final String key_launcher_img_probability_show = "keyLauncherImgProbabilityShow";

    private boolean isListShowImg;
    private int thumbnailQuality;
    private String bannerURL;
    private boolean isShowLauncherImg;
    private boolean isProbabilityShowLauncherImg;

    public void initConfig(Context context) {
        SharedPreferences sharedPreferences = context.getSharedPreferences(spName, Context.MODE_PRIVATE);
        // 列表是否显示图片
        isListShowImg = sharedPreferences.getBoolean(key_isListShowImg, true);
        // 缩略图质量 0:原图 1:默认 2:省流
        thumbnailQuality = sharedPreferences.getInt(key_thumbnailQuality, 1);
        // Banner URL 用于加载页显示
        bannerURL = sharedPreferences.getString(key_banner_url, "");
        // 启动页是否显示妹子图
        isShowLauncherImg = sharedPreferences.getBoolean(key_launcher_img_show, true);
        // 启动页是否概率出现
        isProbabilityShowLauncherImg = sharedPreferences.getBoolean(key_launcher_img_probability_show, false);
    }

    public boolean isListShowImg() {
        return isListShowImg;
    }

    public void setListShowImg(boolean listShowImg) {
        SharedPreferences sharedPreferences = App.getInstance().getSharedPreferences(spName, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putBoolean(key_isListShowImg, listShowImg);
        if (editor.commit()) {
            isListShowImg = listShowImg;
        }
    }

    public int getThumbnailQuality() {
        return thumbnailQuality;
    }

    public void setThumbnailQuality(int thumbnailQuality) {
        SharedPreferences sharedPreferences = App.getInstance().getSharedPreferences(spName, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putInt(key_thumbnailQuality, thumbnailQuality);
        if (editor.commit()) {
            this.thumbnailQuality = thumbnailQuality;
        }
    }

    public String getBannerURL() {
        return bannerURL;
    }

    public void setBannerURL(String bannerURL) {
        SharedPreferences sharedPreferences = App.getInstance().getSharedPreferences(spName, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putString(key_banner_url, bannerURL);
        if (editor.commit()) {
            this.bannerURL = bannerURL;
        }
    }

    public boolean isShowLauncherImg() {
        return isShowLauncherImg;
    }

    public void setShowLauncherImg(boolean showLauncherImg) {
        SharedPreferences sharedPreferences = App.getInstance().getSharedPreferences(spName, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putBoolean(key_launcher_img_show, showLauncherImg);
        if (editor.commit()) {
            isShowLauncherImg = showLauncherImg;
        }
    }

    public boolean isProbabilityShowLauncherImg() {
        return isProbabilityShowLauncherImg;
    }

    public void setProbabilityShowLauncherImg(boolean probabilityShowLauncherImg) {
        SharedPreferences sharedPreferences = App.getInstance().getSharedPreferences(spName, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putBoolean(key_launcher_img_probability_show, probabilityShowLauncherImg);
        if (editor.commit()) {
            isProbabilityShowLauncherImg = probabilityShowLauncherImg;
        }
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/GlobalConfig.java
================================================
package me.bakumon.ugank;

/**
 * 全局配置
 * Created by bakumon on 2016/12/9 14:57.
 */
public class GlobalConfig {
    public final static int PAGE_SIZE_CATEGORY = 10;
    public final static int PAGE_SIZE_FAVORITE = 10;

    public final static String CATEGORY_NAME_APP = "App";
    public final static String CATEGORY_NAME_ANDROID = "Android";
    public final static String CATEGORY_NAME_IOS = "iOS";
    public final static String CATEGORY_NAME_FRONT_END = "前端";
    public final static String CATEGORY_NAME_RECOMMEND = "瞎推荐";
    public final static String CATEGORY_NAME_RESOURCE = "拓展资源";

    public final static String PICASSO_TAG_THUMBNAILS_CATEGORY_LIST_ITEM = "Thumbnails_categoryList_item";
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/ThemeManage.java
================================================
package me.bakumon.ugank;

/**
 * ThemeManage
 * 主题色管理类
 * Created by bakumon on 2016/12/22 15:03.
 */
public enum ThemeManage {
    INSTANCE;

    private int colorPrimary;

    public void initColorPrimary(int colorPrimary) {
        setColorPrimary(colorPrimary);
    }

    public int getColorPrimary() {
        return colorPrimary;
    }

    public void setColorPrimary(int colorPrimary) {
        this.colorPrimary = colorPrimary;
    }


}


================================================
FILE: app/src/main/java/me/bakumon/ugank/base/BaseDialog.java
================================================
package me.bakumon.ugank.base;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;

import butterknife.ButterKnife;
import me.bakumon.ugank.R;

/**
 * BaseDialog
 * Created by bakumon on 2015/12/28.
 */
public abstract class BaseDialog extends Dialog {
    Context mContext;

    public BaseDialog(Context context, int layoutId) {
        this(context, layoutId, R.style.MyDialog);
    }

    public BaseDialog(Context context, int layoutId, int styleId) {
        super(context, styleId);
        this.mContext = context;
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(layoutId, null);
        this.setContentView(view);
        ButterKnife.bind(this);
    }

}


================================================
FILE: app/src/main/java/me/bakumon/ugank/base/BasePresenter.java
================================================
package me.bakumon.ugank.base;

/**
 * BasePresenter
 * Created by bakumon on 2016/12/6.
 */
public interface BasePresenter {

    void subscribe();

    void unsubscribe();
}

================================================
FILE: app/src/main/java/me/bakumon/ugank/base/BaseView.java
================================================
package me.bakumon.ugank.base;

/**
 * BaseView
 * Created by bakumon on 2016/12/6.
 */
public interface BaseView {


}


================================================
FILE: app/src/main/java/me/bakumon/ugank/base/SwipeBackBaseActivity.java
================================================
package me.bakumon.ugank.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import cn.bingoogolapple.swipebacklayout.BGASwipeBackHelper;
import me.bakumon.ugank.R;

/**
 * 滑动返回 Base 类
 * https://github.com/bingoogolapple/BGASwipeBackLayout-Android
 * Created by bakumon on 17-3-5.
 */

public abstract class SwipeBackBaseActivity extends AppCompatActivity implements BGASwipeBackHelper.Delegate {
    protected BGASwipeBackHelper mSwipeBackHelper;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        // 「必须在 Application 的 onCreate 方法中执行 BGASwipeBackManager.getInstance().init(this) 来初始化滑动返回」
        // 在 super.onCreate(savedInstanceState) 之前调用该方法
        initSwipeBackFinish();
        super.onCreate(savedInstanceState);
    }

    /**
     * 初始化滑动返回。在 super.onCreate(savedInstanceState) 之前调用该方法
     */
    private void initSwipeBackFinish() {
        mSwipeBackHelper = new BGASwipeBackHelper(this, this);

        // 「必须在 Application 的 onCreate 方法中执行 BGASwipeBackManager.getInstance().init(this) 来初始化滑动返回」
        // 下面几项可以不配置,这里只是为了讲述接口用法。

        // 设置滑动返回是否可用。默认值为 true
        mSwipeBackHelper.setSwipeBackEnable(true);
        // 设置是否仅仅跟踪左侧边缘的滑动返回。默认值为 true
        mSwipeBackHelper.setIsOnlyTrackingLeftEdge(true);
        // 设置是否是微信滑动返回样式。默认值为 true
        // 选用微信滑动返回样式会有两个问题:
        // 1.正在滑动时按下返回键 view 显示异常
        // 2. 界面有明显的抖动
        mSwipeBackHelper.setIsWeChatStyle(false);
        // 设置阴影资源 id。默认值为 R.drawable.bga_sbl_shadow
        mSwipeBackHelper.setShadowResId(R.drawable.bga_sbl_shadow);
        // 设置是否显示滑动返回的阴影效果。默认值为 true
        mSwipeBackHelper.setIsNeedShowShadow(true);
        // 设置阴影区域的透明度是否根据滑动的距离渐变。默认值为 true
        mSwipeBackHelper.setIsShadowAlphaGradient(true);
    }

    /**
     * 是否支持滑动返回。这里在父类中默认返回 true 来支持滑动返回,如果某个界面不想支持滑动返回则重写该方法返回 false 即可
     *
     * @return
     */
    @Override
    public boolean isSupportSwipeBack() {
        return true;
    }

    /**
     * 正在滑动返回
     *
     * @param slideOffset 从 0 到 1
     */
    @Override
    public void onSwipeBackLayoutSlide(float slideOffset) {
    }

    /**
     * 没达到滑动返回的阈值,取消滑动返回动作,回到默认状态
     */
    @Override
    public void onSwipeBackLayoutCancel() {
    }

    /**
     * 滑动返回执行完毕,销毁当前 Activity
     */
    @Override
    public void onSwipeBackLayoutExecuted() {
        mSwipeBackHelper.swipeBackward();
    }

}

================================================
FILE: app/src/main/java/me/bakumon/ugank/base/adapter/CommonAdapter4RecyclerView.java
================================================
package me.bakumon.ugank.base.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;

/**
 * BaseView
 * Created by bakumon on 2016/12/6.
 */
public abstract class CommonAdapter4RecyclerView<T> extends RecyclerView.Adapter {
    public Context mContext;
    public List<T> mData;
    private int layoutId;
    private View mView;

    public CommonAdapter4RecyclerView(Context context, List<T> data, int layoutId) {
        this.mContext = context;
        this.mData = data == null ? (List<T>) new ArrayList<>() : data;
        this.layoutId = layoutId;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        LayoutInflater inflater = (LayoutInflater) mContext.getSystemService
                (Context.LAYOUT_INFLATER_SERVICE);
        mView = inflater.inflate(layoutId, parent, false);
        return new CommonHolder4RecyclerView(mView);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        CommonHolder4RecyclerView commonHolder = (CommonHolder4RecyclerView) holder;
        commonHolder.position = position;
        convert(commonHolder, mData.get(position));
    }

    @Override
    public int getItemCount() {
        return (mData != null) ? mData.size() : 0;
    }

    public abstract void convert(CommonHolder4RecyclerView holder, T t);

}


================================================
FILE: app/src/main/java/me/bakumon/ugank/base/adapter/CommonHolder4RecyclerView.java
================================================
package me.bakumon.ugank.base.adapter;

import android.support.annotation.IdRes;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.SparseArray;
import android.view.View;
import android.widget.TextView;

/**
 * BaseView
 * Created by bakumon on 2016/12/6.
 */
public class CommonHolder4RecyclerView extends RecyclerView.ViewHolder {

    public View mConvertView;
    public int position;
    private SparseArray<View> mViews;

    public CommonHolder4RecyclerView(View itemView) {
        super(itemView);
        this.mConvertView = itemView;
        this.mViews = new SparseArray<>();
    }


    /**
     * 得到item上的控件
     *
     * @param viewId 控件的id
     * @return 对应的控件
     */
    public <T extends View> T getView(@IdRes int viewId) {
        View view = mViews.get(viewId);
        if (view == null) {
            view = mConvertView.findViewById(viewId);
            mViews.put(viewId, view);
        }

        return (T) view;

    }

    public CommonHolder4RecyclerView setTextViewText(@IdRes int textViewId, String text) {
        TextView tv = getView(textViewId);
        if (!TextUtils.isEmpty(text)) {
            tv.setText(text);
        } else {
            tv.setText(" ");
        }
        return this;
    }

    public CommonHolder4RecyclerView setOnClickListener(ListenerWithPosition.OnClickWithPositionListener clickListener, @IdRes int... viewIds) {
        ListenerWithPosition listener = new ListenerWithPosition(position, this);
        listener.setOnClickListener(clickListener);
        for (int id : viewIds) {
            View v = getView(id);
            v.setOnClickListener(listener);
        }
        return this;
    }

}


================================================
FILE: app/src/main/java/me/bakumon/ugank/base/adapter/CommonViewPagerAdapter.java
================================================
package me.bakumon.ugank.base.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * BaseView
 * Created by bakumon on 2016/12/6.
 */
public class CommonViewPagerAdapter extends FragmentPagerAdapter {
    private String[] title;
    private List<Fragment> mFragments = new ArrayList<>();

    public CommonViewPagerAdapter(FragmentManager fm, String[] titles) {
        super(fm);
        title = titles;
    }

    public void addFragment(Fragment fragment) {
        mFragments.add(fragment);
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return title[position];
    }

}


================================================
FILE: app/src/main/java/me/bakumon/ugank/base/adapter/ListenerWithPosition.java
================================================
package me.bakumon.ugank.base.adapter;

import android.view.View;

/**
 * ListenerWithPosition
 * Created by bakumon on 2016/12/6.
 */
public class ListenerWithPosition implements View.OnClickListener {

    private int mPosition;
    private Object mHolder;
    private OnClickWithPositionListener mOnClickListener;

    public ListenerWithPosition(int position, Object holder) {
        this.mPosition = position;
        this.mHolder = holder;
    }

    @Override
    public void onClick(View v) {
        if (mOnClickListener != null)
            mOnClickListener.onClick(v, mPosition, mHolder);
    }

    public interface OnClickWithPositionListener<T> {
        void onClick(View v, int position, T holder);
    }

    public void setOnClickListener(OnClickWithPositionListener mOnClickListener) {
        this.mOnClickListener = mOnClickListener;
    }

}


================================================
FILE: app/src/main/java/me/bakumon/ugank/entity/CategoryResult.java
================================================
package me.bakumon.ugank.entity;

import java.util.List;

/**
 * CategoryResult
 * Created by bakumon on 2016/12/8.
 */
public class CategoryResult {

    public boolean error;
    public List<ResultsBean> results;

    public static class ResultsBean {

        public String _id;
        public String createdAt;
        public String desc;
        public String publishedAt;
        public String source;
        public String type;
        public String url;
        public boolean used;
        public String who;
        public List<String> images;
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/entity/Favorite.java
================================================
package me.bakumon.ugank.entity;

import org.litepal.crud.DataSupport;

import java.io.Serializable;

/**
 * Favorite
 * Created by bakumon on 17-3-22.
 */

public class Favorite extends DataSupport implements Serializable{
    private String title;
    private String type;
    private String author;
    private String data;
    private String url;
    private String gankID;
    private long createtime;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getGankID() {
        return gankID;
    }

    public void setGankID(String gankID) {
        this.gankID = gankID;
    }

    public long getCreatetime() {
        return createtime;
    }

    public void setCreatetime(long createtime) {
        this.createtime = createtime;
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/entity/History.java
================================================
package me.bakumon.ugank.entity;

import org.litepal.crud.DataSupport;

/**
 * History
 * Created by bakumon on 2017/2/18
 */
public class History extends DataSupport {
    private long createTimeMill;
    private String content;

    public long getCreateTimeMill() {
        return createTimeMill;
    }

    public void setCreateTimeMill(long createTimeMill) {
        this.createTimeMill = createTimeMill;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/entity/SearchResult.java
================================================
package me.bakumon.ugank.entity;

import java.util.List;

/**
 * SearchResult
 * Created by bakumon on 2016/12/19 17:00.
 */
public class SearchResult {

    public int count;
    public boolean error;
    public List<ResultsBean> results;

    public static class ResultsBean {

        public String desc;
        public String ganhuo_id;
        public String publishedAt;
        public String readability;
        public String type;
        public String url;
        public String who;
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/bigimg/BigimgActivity.java
================================================
package me.bakumon.ugank.module.bigimg;

import android.content.pm.ActivityInfo;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.TextView;

import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;

import butterknife.BindView;
import butterknife.ButterKnife;
import me.bakumon.ugank.R;
import me.bakumon.ugank.base.SwipeBackBaseActivity;
import me.bakumon.ugank.utills.DisplayUtils;
import me.bakumon.ugank.utills.StatusBarUtil;
import me.bakumon.ugank.widget.PinchImageView;
import me.bakumon.ugank.widget.SquareLoading;

public class BigimgActivity extends SwipeBackBaseActivity implements BigimgContract.View {

    public static final String MEIZI_URL = "me.bakumon.gank.module.img.BigimgActivity.meizi_url";
    public static final String MEIZI_TITLE = "me.bakumon.gank.module.img.BigimgActivity.meizi_title";

    @BindView(R.id.tv_title_big_img)
    TextView tvTitleBigImg;
    @BindView(R.id.toolbar_big_img)
    Toolbar toolbarBigImg;
    @BindView(R.id.appbar_big_img)
    AppBarLayout appbarBigImg;
    @BindView(R.id.img_big)
    PinchImageView imgBig;
    @BindView(R.id.sl_big_img_loading)
    SquareLoading mSquareLoading;

    private BigimgContract.Presenter mBigimgPresenter = new BigimgPresenter(this);

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.activity_bigimg);
        ButterKnife.bind(this);
        StatusBarUtil.immersive(this);
        StatusBarUtil.setPaddingSmart(this, toolbarBigImg);
        setSupportActionBar(toolbarBigImg);
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayShowTitleEnabled(false);
        }
        toolbarBigImg.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        mBigimgPresenter.subscribe();

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mBigimgPresenter.unsubscribe();
    }

    @Override
    public void setMeiziTitle(String title) {
        tvTitleBigImg.setText(title);
    }

    @Override
    public void loadMeizuImg(String url) {
        Picasso.with(this)
                .load(url)
                .into(imgBig, new Callback() {
                    @Override
                    public void onSuccess() {
                        // 这里可能会有内存泄露
                        hideLoading();
                    }

                    @Override
                    public void onError() {

                    }
                });
    }

    @Override
    public void setToolbarBackgroundColor(int color) {
        appbarBigImg.setBackgroundColor(color);
    }

    @Override
    public void setLoadingColor(int color) {
        mSquareLoading.setSquareColor(color);
    }

    @Override
    public void showLoading() {
        mSquareLoading.setVisibility(View.VISIBLE);
    }

    @Override
    public String getMeiziImg() {
        Bundle bundle = getIntent().getExtras();
        return bundle.getString(BigimgActivity.MEIZI_URL);
    }

    @Override
    public String getMeiziTitle() {
        Bundle bundle = getIntent().getExtras();
        return bundle.getString(BigimgActivity.MEIZI_TITLE);
    }

    public void hideLoading() {
        mSquareLoading.setVisibility(View.GONE);
        /*
        * 由于 mSquareLoading 持有 Activity Context 引用,在 Picasso 的 Callback 匿名内部类中使用可能会
        * 发生内存泄露
        *
        * 因为 mSquareLoading 不在使用,所有直接置空,否则选择静态内部类和弱引用的方式避免内存泄露
        * */
        mSquareLoading = null;
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/bigimg/BigimgContract.java
================================================
package me.bakumon.ugank.module.bigimg;

import me.bakumon.ugank.base.BasePresenter;
import me.bakumon.ugank.base.BaseView;

/**
 * BigimgContract
 * Created by bakumon on 16-12-20.
 */

public interface BigimgContract {

    interface View extends BaseView {

        void setMeiziTitle(String title);

        void loadMeizuImg(String url);

        void setToolbarBackgroundColor(int color);

        void setLoadingColor(int color);

        void showLoading();

        String getMeiziImg();

        String getMeiziTitle();

    }

    interface Presenter extends BasePresenter {

    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/bigimg/BigimgPresenter.java
================================================
package me.bakumon.ugank.module.bigimg;

import android.support.annotation.NonNull;

import me.bakumon.ugank.ThemeManage;

/**
 * BigimgPresenter
 * Created by bakumon on 16-12-20.
 */

public class BigimgPresenter implements BigimgContract.Presenter {

    private BigimgContract.View mBigimgView;

    public BigimgPresenter(@NonNull BigimgContract.View bigimgView) {
        mBigimgView = bigimgView;

    }

    @Override
    public void subscribe() {
        mBigimgView.setToolbarBackgroundColor(ThemeManage.INSTANCE.getColorPrimary());
        mBigimgView.setLoadingColor(ThemeManage.INSTANCE.getColorPrimary());
        loadMeiziImg(mBigimgView.getMeiziImg());
        setMeiziTitle(mBigimgView.getMeiziTitle());
    }

    @Override
    public void unsubscribe() {
    }

    private void loadMeiziImg(String url) {
        if (url == null) {
            return;
        }
        mBigimgView.showLoading();
        mBigimgView.loadMeizuImg(url);
    }

    private void setMeiziTitle(String title) {
        if (title == null) {
            return;
        }
        mBigimgView.setMeiziTitle("妹子:" + title);
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/category/CategoryContract.java
================================================
package me.bakumon.ugank.module.category;

import me.bakumon.ugank.base.BasePresenter;
import me.bakumon.ugank.base.BaseView;
import me.bakumon.ugank.entity.CategoryResult;

/**
 * CategoryContract
 * Created by bakumon on 2016/12/8.
 */
public interface CategoryContract {

    interface View extends BaseView {

        void setCategoryItems(CategoryResult categoryResult);

        void addCategoryItems(CategoryResult categoryResult);

        void getCategoryItemsFail(String failMessage);

        String getCategoryName();

        void showSwipeLoading();

        void hideSwipeLoading();

        void setLoading();
    }

    interface Presenter extends BasePresenter {

        void getCategoryItems(boolean isRefresh);
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/category/CategoryFragment.java
================================================
package me.bakumon.ugank.module.category;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.squareup.picasso.Picasso;

import butterknife.BindView;
import butterknife.ButterKnife;
import es.dmoral.toasty.Toasty;
import me.bakumon.ugank.GlobalConfig;
import me.bakumon.ugank.R;
import me.bakumon.ugank.entity.CategoryResult;
import me.bakumon.ugank.module.home.HomeActivity;
import me.bakumon.ugank.widget.RecycleViewDivider;
import me.bakumon.ugank.widget.recyclerviewwithfooter.OnLoadMoreListener;
import me.bakumon.ugank.widget.recyclerviewwithfooter.RecyclerViewWithFooter;

import static android.widget.AbsListView.OnScrollListener.SCROLL_STATE_IDLE;

/**
 * CategoryFragment
 * Created by bakumon on 2016/12/8.
 */
public class CategoryFragment extends Fragment implements CategoryContract.View, SwipeRefreshLayout.OnRefreshListener, OnLoadMoreListener {

    public static final String CATEGORY_NAME = "me.bakumon.ugank.module.category.CATEGORY_NAME";

    @BindView(R.id.recycler_view)
    RecyclerViewWithFooter mRecyclerView;
    @BindView(R.id.swipe_refresh_layout)
    SwipeRefreshLayout mSwipeRefreshLayout;

    private CategoryListAdapter mCategoryListAdapter;
    private CategoryContract.Presenter mPresenter = new CategoryPresenter(this);

    private String mCategoryName;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle bundle = getArguments();
        mCategoryName = bundle.getString(CATEGORY_NAME);
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == Activity.RESULT_OK && requestCode == HomeActivity.SETTING_REQUEST_CODE) {
            mCategoryListAdapter.notifyDataSetChanged();
        }
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.fragment, container, false);
        ButterKnife.bind(this, view);

        mSwipeRefreshLayout.setColorSchemeResources(
                R.color.colorSwipeRefresh1,
                R.color.colorSwipeRefresh2,
                R.color.colorSwipeRefresh3,
                R.color.colorSwipeRefresh4,
                R.color.colorSwipeRefresh5,
                R.color.colorSwipeRefresh6);
        mSwipeRefreshLayout.setOnRefreshListener(this);

        mCategoryListAdapter = new CategoryListAdapter(getContext());

        mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
        mRecyclerView.addItemDecoration(new RecycleViewDivider(getActivity(), LinearLayoutManager.HORIZONTAL));
        mRecyclerView.setAdapter(mCategoryListAdapter);
        mRecyclerView.setOnLoadMoreListener(this);
        mRecyclerView.setEmpty();
        mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
                final Picasso picasso = Picasso.with(CategoryFragment.this.getContext());

                if (newState == SCROLL_STATE_IDLE) {
                    picasso.resumeTag(GlobalConfig.PICASSO_TAG_THUMBNAILS_CATEGORY_LIST_ITEM);
                } else {
                    picasso.pauseTag(GlobalConfig.PICASSO_TAG_THUMBNAILS_CATEGORY_LIST_ITEM);
                }
            }
        });
        return view;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        mPresenter.subscribe();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        Picasso.with(CategoryFragment.this.getContext()).cancelTag(GlobalConfig.PICASSO_TAG_THUMBNAILS_CATEGORY_LIST_ITEM);
        mPresenter.unsubscribe();
    }

    public static CategoryFragment newInstance(String mCategoryName) {
        CategoryFragment categoryFragment = new CategoryFragment();

        Bundle bundle = new Bundle();
        bundle.putString(CATEGORY_NAME, mCategoryName);

        categoryFragment.setArguments(bundle);
        return categoryFragment;
    }

    @Override
    public String getCategoryName() {
        return this.mCategoryName;
    }

    @Override
    public void showSwipeLoading() {
        mSwipeRefreshLayout.setRefreshing(true);
    }

    @Override
    public void hideSwipeLoading() {
        mSwipeRefreshLayout.setRefreshing(false);
    }

    @Override
    public void onRefresh() {
        mPresenter.getCategoryItems(true);
    }

    @Override
    public void onLoadMore() {
        mPresenter.getCategoryItems(false);
    }

    @Override
    public void setLoading() {
        mRecyclerView.setLoading();
    }

    @Override
    public void getCategoryItemsFail(String failMessage) {
        if (getUserVisibleHint()) {
            Toasty.error(this.getContext(), failMessage).show();
        }
    }

    @Override
    public void setCategoryItems(CategoryResult categoryResult) {
        mCategoryListAdapter.mData = categoryResult.results;
        mCategoryListAdapter.notifyDataSetChanged();
    }

    @Override
    public void addCategoryItems(CategoryResult categoryResult) {
        int start = mCategoryListAdapter.getItemCount();
        mCategoryListAdapter.mData.addAll(categoryResult.results);
        mCategoryListAdapter.notifyItemRangeInserted(start, categoryResult.results.size());
    }

}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/category/CategoryListAdapter.java
================================================
package me.bakumon.ugank.module.category;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.support.v7.widget.AppCompatImageView;
import android.view.View;

import com.squareup.picasso.Picasso;

import es.dmoral.toasty.Toasty;
import me.bakumon.ugank.ConfigManage;
import me.bakumon.ugank.GlobalConfig;
import me.bakumon.ugank.R;
import me.bakumon.ugank.base.adapter.CommonAdapter4RecyclerView;
import me.bakumon.ugank.base.adapter.CommonHolder4RecyclerView;
import me.bakumon.ugank.base.adapter.ListenerWithPosition;
import me.bakumon.ugank.entity.CategoryResult;
import me.bakumon.ugank.entity.Favorite;
import me.bakumon.ugank.module.webview.WebViewActivity;
import me.bakumon.ugank.utills.DateUtil;

/**
 * CategoryListAdapter
 * Created by bakumon on 2016/10/13.
 */

public class CategoryListAdapter extends CommonAdapter4RecyclerView<CategoryResult.ResultsBean> implements ListenerWithPosition.OnClickWithPositionListener<CommonHolder4RecyclerView> {

    public CategoryListAdapter(Context context) {
        super(context, null, R.layout.item);
    }

    @Override
    public void convert(CommonHolder4RecyclerView holder, CategoryResult.ResultsBean androidResult) {
        if (androidResult != null) {
            AppCompatImageView imageView = holder.getView(R.id.iv_item_img);
            if (ConfigManage.INSTANCE.isListShowImg()) { // 列表显示图片
                imageView.setVisibility(View.VISIBLE);
                String quality = "";
                if (androidResult.images != null && androidResult.images.size() > 0) {
                    switch (ConfigManage.INSTANCE.getThumbnailQuality()) {
                        case 0: // 原图
                            quality = "?imageView2/0/w/400";
                            break;
                        case 1: // 默认
                            quality = "?imageView2/0/w/280";
                            break;
                        case 2: // 省流
                            quality = "?imageView2/0/w/190";
                            break;
                    }
                    imageView.setVisibility(View.VISIBLE);
//                    Picasso.with(mContext).setIndicatorsEnabled(true);//显示指示器
                    Picasso.with(mContext)
                            .load(androidResult.images.get(0) + quality)
                            .placeholder(R.mipmap.image_default)
                            .tag(GlobalConfig.PICASSO_TAG_THUMBNAILS_CATEGORY_LIST_ITEM)
                            .centerCrop()
                            .fit()
                            .config(Bitmap.Config.RGB_565)
                            .into(imageView);
                } else { // 图片 URL 不存在
                    imageView.setVisibility(View.GONE);
                }
            } else { // 列表不显示图片
                imageView.setVisibility(View.GONE);
            }
            holder.setTextViewText(R.id.tv_item_title, androidResult.desc == null ? "unknown" : androidResult.desc);
            holder.setTextViewText(R.id.tv_item_publisher, androidResult.who == null ? "unknown" : androidResult.who);
            holder.setTextViewText(R.id.tv_item_time, DateUtil.dateFormat(androidResult.publishedAt));
            holder.setOnClickListener(this, R.id.ll_item);
        }
    }

    @Override
    public void onClick(View v, int position, CommonHolder4RecyclerView holder) {
        if (mData == null || mData.get(position) == null) {
            Toasty.error(mContext, "数据异常").show();
            return;
        }
        Intent intent = new Intent(mContext, WebViewActivity.class);
        intent.putExtra(WebViewActivity.GANK_TITLE, mData.get(position).desc);
        intent.putExtra(WebViewActivity.GANK_URL, mData.get(position).url);
        Favorite favorite = new Favorite();
        favorite.setAuthor(mData.get(position).who);
        favorite.setData(mData.get(position).publishedAt);
        favorite.setTitle(mData.get(position).desc);
        favorite.setType(mData.get(position).type);
        favorite.setUrl(mData.get(position).url);
        favorite.setGankID(mData.get(position)._id);
        intent.putExtra(WebViewActivity.FAVORITE_DATA, favorite);
        mContext.startActivity(intent);
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/category/CategoryPresenter.java
================================================
package me.bakumon.ugank.module.category;

import android.support.annotation.NonNull;

import me.bakumon.ugank.GlobalConfig;
import me.bakumon.ugank.entity.CategoryResult;
import me.bakumon.ugank.network.NetWork;
import rx.Observer;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import rx.subscriptions.CompositeSubscription;

/**
 * CategoryPresenter
 * Created by bakumon on 2016/12/8 16:42.
 */
public class CategoryPresenter implements CategoryContract.Presenter {

    private CategoryContract.View mCategoryView;

    private int mPage = 1;

    @NonNull
    private CompositeSubscription mSubscriptions;

    public CategoryPresenter(CategoryContract.View androidView) {
        mCategoryView = androidView;
        mSubscriptions = new CompositeSubscription();
    }

    @Override
    public void subscribe() {
        getCategoryItems(true);
    }

    @Override
    public void unsubscribe() {
        mSubscriptions.clear();
    }

    @Override
    public void getCategoryItems(final boolean isRefresh) {
        if (isRefresh) {
            mCategoryView.showSwipeLoading();
            mPage = 1;
        } else {
            mPage += 1;
        }
        Subscription subscription = NetWork.getGankApi()
                .getCategoryDate(mCategoryView.getCategoryName(), GlobalConfig.PAGE_SIZE_CATEGORY, mPage)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<CategoryResult>() {
                    @Override
                    public void onCompleted() {
                    }

                    @Override
                    public void onError(Throwable e) {
                        mCategoryView.hideSwipeLoading();
                        mCategoryView.getCategoryItemsFail(mCategoryView.getCategoryName() + " 列表数据获取失败。");
                    }

                    @Override
                    public void onNext(CategoryResult androidResult) {
                        if (isRefresh) {
                            mCategoryView.setCategoryItems(androidResult);
                            mCategoryView.hideSwipeLoading();
                            mCategoryView.setLoading();
                        } else {
                            mCategoryView.addCategoryItems(androidResult);
                        }
                    }
                });
        mSubscriptions.add(subscription);
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/favorite/FavoriteActivity.java
================================================
package me.bakumon.ugank.module.favorite;

import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.Toolbar;
import android.view.View;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import es.dmoral.toasty.Toasty;
import me.bakumon.ugank.R;
import me.bakumon.ugank.base.SwipeBackBaseActivity;
import me.bakumon.ugank.entity.Favorite;
import me.bakumon.ugank.utills.DisplayUtils;
import me.bakumon.ugank.utills.StatusBarUtil;
import me.bakumon.ugank.widget.RecycleViewDivider;
import me.bakumon.ugank.widget.recyclerviewwithfooter.OnLoadMoreListener;
import me.bakumon.ugank.widget.recyclerviewwithfooter.RecyclerViewWithFooter;

public class FavoriteActivity extends SwipeBackBaseActivity implements FavoriteContract.View, OnLoadMoreListener {

    @BindView(R.id.toolbar_favorite)
    Toolbar mToolbarFavorite;
    @BindView(R.id.appbar_favorite)
    AppBarLayout mAppbarFavorite;
    @BindView(R.id.recycler_view_favorite)
    RecyclerViewWithFooter mRecyclerView;

    public static final int REQUEST_CODE_FAVORITE = 101;
    public static final String FAVORITE_POSITION = "me.bakumon.ugank.module.favorite.FavoriteActivity.favorite_position";

    private FavoriteContract.Presenter mPresenter = new FavoritePresenter(this);
    private FavoriteListAdapter mAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.activity_favorite);
        ButterKnife.bind(this);
        StatusBarUtil.immersive(this);
        StatusBarUtil.setPaddingSmart(this, mToolbarFavorite);
        setSupportActionBar(mToolbarFavorite);
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }
        initView();
        mPresenter.subscribe();
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == RESULT_OK && requestCode == REQUEST_CODE_FAVORITE) {
            int position = data.getIntExtra(FAVORITE_POSITION, -1);
            if (position != -1) {
                mAdapter.notifyItemRemoved(position);
                mAdapter.mData.remove(position);
            }
        }
        super.onActivityResult(requestCode, resultCode, data);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mPresenter.unsubscribe();
    }

    private void initView() {
        mToolbarFavorite.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });


        mAdapter = new FavoriteListAdapter(this);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        mRecyclerView.addItemDecoration(new RecycleViewDivider(this, LinearLayoutManager.HORIZONTAL));
        mRecyclerView.setAdapter(mAdapter);
        mRecyclerView.setOnLoadMoreListener(this);
        mRecyclerView.setEmpty();
    }

    @Override
    public void setToolbarBackgroundColor(int color) {
        mAppbarFavorite.setBackgroundColor(color);
    }

    @Override
    public void addFavoriteItems(List<Favorite> favorites) {
        int start = mAdapter.getItemCount();
        mAdapter.mData.addAll(favorites);
        mAdapter.notifyItemRangeInserted(start, favorites.size());
    }

    @Override
    public void setFavoriteItems(List<Favorite> favorites) {
        mAdapter.mData = favorites;
        mAdapter.notifyDataSetChanged();
    }

    @Override
    public void setLoading() {
        mRecyclerView.setLoading();
    }

    @Override
    public void setEmpty() {
        mRecyclerView.setEmpty();
        Toasty.info(this, "暂无收藏").show();
    }

    @Override
    public void setLoadMoreIsLastPage() {
        mRecyclerView.setEnd("没有更多数据了");
    }

    @Override
    public void onLoadMore() {
        mPresenter.getFavoriteItems(false);
    }

}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/favorite/FavoriteContract.java
================================================
package me.bakumon.ugank.module.favorite;

import java.util.List;

import me.bakumon.ugank.base.BasePresenter;
import me.bakumon.ugank.base.BaseView;
import me.bakumon.ugank.entity.Favorite;

/**
 * FavoriteContract
 * Created by bakumon on 17-3-22.
 */

public class FavoriteContract {
    interface View extends BaseView {

        void setToolbarBackgroundColor(int color);

        void addFavoriteItems(List<Favorite> favorites);

        void setFavoriteItems(List<Favorite> favorites);

        void setLoading();

        void setEmpty();

        void setLoadMoreIsLastPage();
    }

    interface Presenter extends BasePresenter {

        void getFavoriteItems(boolean isRefresh);
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/favorite/FavoriteListAdapter.java
================================================
package me.bakumon.ugank.module.favorite;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.View;

import es.dmoral.toasty.Toasty;
import me.bakumon.ugank.R;
import me.bakumon.ugank.base.adapter.CommonAdapter4RecyclerView;
import me.bakumon.ugank.base.adapter.CommonHolder4RecyclerView;
import me.bakumon.ugank.base.adapter.ListenerWithPosition;
import me.bakumon.ugank.entity.Favorite;
import me.bakumon.ugank.module.webview.WebViewActivity;
import me.bakumon.ugank.utills.DateUtil;

/**
 * FavoriteListAdapter
 * Created by bakumon on 2016/12/20.
 */

public class FavoriteListAdapter extends CommonAdapter4RecyclerView<Favorite> implements ListenerWithPosition.OnClickWithPositionListener<CommonHolder4RecyclerView> {

    public FavoriteListAdapter(Context context) {
        super(context, null, R.layout.item_favorite);
    }

    @Override
    public void convert(CommonHolder4RecyclerView holder, Favorite favorite) {
        if (favorite != null) {
            holder.setTextViewText(R.id.tv_item_title_favorite, favorite.getTitle() == null ? "unknown" : favorite.getTitle());
            holder.setTextViewText(R.id.tv_item_type_favorite, favorite.getType() == null ? "unknown" : favorite.getType());
            holder.setTextViewText(R.id.tv_item_publisher_favorite, favorite.getAuthor() == null ? "unknown" : favorite.getAuthor());
            holder.setTextViewText(R.id.tv_item_time_favorite, DateUtil.dateFormat(favorite.getData()));
            holder.setOnClickListener(this, R.id.ll_item_favorite);
        }
    }

    @Override
    public void onClick(View v, int position, CommonHolder4RecyclerView holder) {
        // 通过 notifyRemoveItem 方法移除 item 后,不能使用这个 position
        position = holder.getAdapterPosition();
        if (mData == null || mData.get(position) == null) {
            Toasty.error(mContext, "数据异常").show();
            return;
        }
        Intent intent = new Intent();
        intent.setClass(mContext, WebViewActivity.class);
        intent.putExtra(WebViewActivity.GANK_TITLE, mData.get(position).getTitle());
        intent.putExtra(WebViewActivity.GANK_URL, mData.get(position).getUrl());
        intent.putExtra(WebViewActivity.FAVORITE_POSITION, position);
        intent.putExtra(WebViewActivity.FAVORITE_DATA, mData.get(position));
        ((Activity) mContext).startActivityForResult(intent, FavoriteActivity.REQUEST_CODE_FAVORITE);
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/favorite/FavoritePresenter.java
================================================
package me.bakumon.ugank.module.favorite;

import org.litepal.crud.DataSupport;

import java.util.List;

import me.bakumon.ugank.GlobalConfig;
import me.bakumon.ugank.ThemeManage;
import me.bakumon.ugank.entity.Favorite;

/**
 * FavoritePresenter
 * Created by bakumon on 17-3-22.
 */

public class FavoritePresenter implements FavoriteContract.Presenter {

    private FavoriteContract.View mView;

    private int mPage = 0;

    public FavoritePresenter(FavoriteContract.View view) {
        mView = view;
    }

    @Override
    public void subscribe() {
        mView.setToolbarBackgroundColor(ThemeManage.INSTANCE.getColorPrimary());
        getFavoriteItems(true);
    }

    @Override
    public void unsubscribe() {

    }

    @Override
    public void getFavoriteItems(boolean isRefresh) {
        if (isRefresh) {
            mPage = 0;
        } else {
            mPage += 1;
        }
        List<Favorite> favoriteList = DataSupport
                .limit(GlobalConfig.PAGE_SIZE_FAVORITE)
                .offset(GlobalConfig.PAGE_SIZE_FAVORITE * mPage)
                .order("createTime desc")
                .find(Favorite.class);
        if (isRefresh) {
            mView.setFavoriteItems(favoriteList);
            mView.setLoading();
            if (favoriteList == null || favoriteList.size() < 1) {
                mView.setEmpty();
                return;
            }
        } else {
            mView.addFavoriteItems(favoriteList);
        }
        boolean isLastPage = favoriteList.size() < GlobalConfig.PAGE_SIZE_FAVORITE;
        if (isLastPage) {
            mView.setLoadMoreIsLastPage();
        }
    }


}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/home/HomeActivity.java
================================================
package me.bakumon.ugank.module.home;

import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.graphics.Palette;
import android.support.v7.widget.AppCompatImageView;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.View;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;

import com.github.florent37.picassopalette.PicassoPalette;
import com.kekstudio.dachshundtablayout.DachshundTabLayout;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import es.dmoral.toasty.Toasty;
import me.bakumon.ugank.GlobalConfig;
import me.bakumon.ugank.R;
import me.bakumon.ugank.base.adapter.CommonViewPagerAdapter;
import me.bakumon.ugank.module.bigimg.BigimgActivity;
import me.bakumon.ugank.module.category.CategoryFragment;
import me.bakumon.ugank.module.favorite.FavoriteActivity;
import me.bakumon.ugank.module.search.SearchActivity;
import me.bakumon.ugank.module.setting.SettingActivity;
import me.bakumon.ugank.utills.DisplayUtils;
import me.bakumon.ugank.utills.MDTintUtil;
import me.bakumon.ugank.utills.StatusBarUtil;

/**
 * HomeActivity
 * Created by bakumon on 2016/12/8 16:42.
 */
public class HomeActivity extends AppCompatActivity implements HomeContract.View {

    @BindView(R.id.fab_home_random)
    FloatingActionButton mFloatingActionButton;
    @BindView(R.id.appbar)
    AppBarLayout mAppBarLayout;
    @BindView(R.id.iv_home_banner)
    ImageView mIvHomeBanner;
    @BindView(R.id.tab_home_category)
    DachshundTabLayout mDachshundTabLayout;
    @BindView(R.id.vp_home_category)
    ViewPager mVpCategory;
    @BindView(R.id.collapsing_toolbar)
    CollapsingToolbarLayout mCollapsingToolbar;
    @BindView(R.id.tl_home_toolbar)
    Toolbar mToolbar;
    @BindView(R.id.iv_home_setting)
    AppCompatImageView mIvSetting;

    private HomeContract.Presenter mHomePresenter = new HomePresenter(this);
    public final static int SETTING_REQUEST_CODE = 101;

    private CategoryFragment appFragment;
    private CategoryFragment androidFragment;
    private CategoryFragment iOSFragment;
    private CategoryFragment frontFragment;
    private CategoryFragment referenceFragment;
    private CategoryFragment resFragment;

    private String mImgUrl;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.activity_home);
        ButterKnife.bind(this);
        initView();
        mHomePresenter.subscribe();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mHomePresenter.unsubscribe();
    }

    private void initView() {
        StatusBarUtil.immersive(this);
        StatusBarUtil.setPaddingSmart(this, mIvHomeBanner);
        StatusBarUtil.setPaddingSmart(this, mToolbar);

        setFabDynamicState();

        String[] titles = {
                GlobalConfig.CATEGORY_NAME_APP,
                GlobalConfig.CATEGORY_NAME_ANDROID,
                GlobalConfig.CATEGORY_NAME_IOS,
                GlobalConfig.CATEGORY_NAME_FRONT_END,
                GlobalConfig.CATEGORY_NAME_RECOMMEND,
                GlobalConfig.CATEGORY_NAME_RESOURCE};
        CommonViewPagerAdapter infoPagerAdapter = new CommonViewPagerAdapter(getSupportFragmentManager(), titles);

        // App
        appFragment = CategoryFragment.newInstance(titles[0]);
        // Android
        androidFragment = CategoryFragment.newInstance(titles[1]);
        // iOS
        iOSFragment = CategoryFragment.newInstance(titles[2]);
        // 前端
        frontFragment = CategoryFragment.newInstance(titles[3]);
        // 瞎推荐
        referenceFragment = CategoryFragment.newInstance(titles[4]);
        // 拓展资源s
        resFragment = CategoryFragment.newInstance(titles[5]);

        infoPagerAdapter.addFragment(appFragment);
        infoPagerAdapter.addFragment(androidFragment);
        infoPagerAdapter.addFragment(iOSFragment);
        infoPagerAdapter.addFragment(frontFragment);
        infoPagerAdapter.addFragment(referenceFragment);
        infoPagerAdapter.addFragment(resFragment);

        mVpCategory.setAdapter(infoPagerAdapter);
        mDachshundTabLayout.setupWithViewPager(mVpCategory);
        mVpCategory.setCurrentItem(1);
    }

    /**
     * CollapsingToolbarLayout 折叠状态
     */
    private CollapsingToolbarLayoutState state;

    private enum CollapsingToolbarLayoutState {
        /**
         * 完全展开
         */
        EXPANDED,
        /**
         * 折叠
         */
        COLLAPSED,
        /**
         * 中间状态
         */
        INTERNEDIATE
    }

    /**
     * 根据 CollapsingToolbarLayout 的折叠状态,设置 FloatingActionButton 的隐藏和显示
     */
    private void setFabDynamicState() {
        mAppBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
            @Override
            public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {

                if (verticalOffset == 0) {
                    if (state != CollapsingToolbarLayoutState.EXPANDED) {
                        // 修改状态标记为展开
                        state = CollapsingToolbarLayoutState.EXPANDED;
                    }
                } else if (Math.abs(verticalOffset) >= appBarLayout.getTotalScrollRange()) {
                    if (state != CollapsingToolbarLayoutState.COLLAPSED) {
                        mFloatingActionButton.hide();
                        // 修改状态标记为折叠
                        state = CollapsingToolbarLayoutState.COLLAPSED;
                        CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) mAppBarLayout.getLayoutParams();
                        layoutParams.height = DisplayUtils.dp2px(240, HomeActivity.this);
                        mAppBarLayout.setLayoutParams(layoutParams);
                    }
                } else {
                    if (state != CollapsingToolbarLayoutState.INTERNEDIATE) {
                        if (state == CollapsingToolbarLayoutState.COLLAPSED) {
                            mFloatingActionButton.show();
                        }
                        // 修改状态标记为中间
                        state = CollapsingToolbarLayoutState.INTERNEDIATE;
                    }
                }
            }
        });
    }

    @OnClick(R.id.ll_home_search)
    public void search(View view) {
        startActivity(new Intent(HomeActivity.this, SearchActivity.class));
    }

    @Override
    public void showBannerFail(String failMessage) {
        Toasty.error(this, failMessage).show();
    }

    @Override
    public void setBanner(String imgUrl) {
        mImgUrl = imgUrl;
        Picasso.with(this).load(imgUrl)
                .into(mIvHomeBanner,
                        PicassoPalette.with(imgUrl, mIvHomeBanner)
                                .intoCallBack(new PicassoPalette.CallBack() {
                                    @Override
                                    public void onPaletteLoaded(Palette palette) {
                                        mHomePresenter.setThemeColor(palette);
                                    }
                                }));
    }

    @Override
    public void cacheImg(final String imgUrl) {
        // 预加载 提前缓存好的欢迎图
        Picasso.with(this).load(imgUrl).fetch(new Callback() {
            @Override
            public void onSuccess() {
                mHomePresenter.saveCacheImgUrl(imgUrl);
            }

            @Override
            public void onError() {

            }
        });
    }

    @Override
    public void setAppBarLayoutColor(int appBarLayoutColor) {
        mCollapsingToolbar.setContentScrimColor(appBarLayoutColor);
        mAppBarLayout.setBackgroundColor(appBarLayoutColor);
    }

    @Override
    public void setFabButtonColor(int color) {
        MDTintUtil.setTint(mFloatingActionButton, color);
    }

    private ObjectAnimator mAnimator;

    @Override
    public void startBannerLoadingAnim() {
        mFloatingActionButton.setImageResource(R.drawable.ic_loading);
        mAnimator = ObjectAnimator.ofFloat(mFloatingActionButton, "rotation", 0, 360);
        mAnimator.setRepeatCount(ValueAnimator.INFINITE);
        mAnimator.setDuration(800);
        mAnimator.setInterpolator(new LinearInterpolator());
        mAnimator.start();
    }

    @Override
    public void stopBannerLoadingAnim() {
        mFloatingActionButton.setImageResource(R.drawable.ic_beauty);
        mAnimator.cancel();
        mFloatingActionButton.setRotation(0);
    }

    @Override
    public void enableFabButton() {
        mFloatingActionButton.setEnabled(true);
    }

    @Override
    public void disEnableFabButton() {
        mFloatingActionButton.setEnabled(false);
    }

    @OnClick(R.id.fab_home_random)
    public void random(View view) {
        mHomePresenter.getRandomBanner();
    }

    @OnClick(R.id.iv_home_collection)
    public void collection() {
        startActivity(new Intent(HomeActivity.this, FavoriteActivity.class));
    }

    @OnClick(R.id.iv_home_setting)
    public void goSetting() {
        startActivityForResult(new Intent(HomeActivity.this, SettingActivity.class), SETTING_REQUEST_CODE);
    }

    @OnClick(R.id.iv_home_banner)
    public void goBigImg() {
        if (TextUtils.isEmpty(mImgUrl)) {
            return;
        }
        Intent intent = new Intent();
        intent.setClass(this, BigimgActivity.class);
        intent.putExtra(BigimgActivity.MEIZI_TITLE, "");
        intent.putExtra(BigimgActivity.MEIZI_URL, mImgUrl);
        startActivity(intent);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        switch (mVpCategory.getCurrentItem()) {
            case 0:
                appFragment.onActivityResult(requestCode, resultCode, data);
                break;
            case 1:
                androidFragment.onActivityResult(requestCode, resultCode, data);
                break;
            case 2:
                iOSFragment.onActivityResult(requestCode, resultCode, data);
                break;
            case 3:
                frontFragment.onActivityResult(requestCode, resultCode, data);
                break;
            case 4:
                referenceFragment.onActivityResult(requestCode, resultCode, data);
                break;
            case 5:
                resFragment.onActivityResult(requestCode, resultCode, data);
                break;
            default:
                break;
        }
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/home/HomeContract.java
================================================
package me.bakumon.ugank.module.home;

import android.support.annotation.Nullable;
import android.support.v7.graphics.Palette;

import me.bakumon.ugank.base.BasePresenter;
import me.bakumon.ugank.base.BaseView;

/**
 * HomeContract
 * Created by bakumon on 2016/12/6 10:48.
 */
public interface HomeContract {
    interface View extends BaseView {

        void showBannerFail(String failMessage);

        void setBanner(String imgUrl);

        void cacheImg(String imgUrl);

        void startBannerLoadingAnim();

        void stopBannerLoadingAnim();

        void enableFabButton();

        void disEnableFabButton();

        void setAppBarLayoutColor(int appBarLayoutColor);

        void setFabButtonColor(int color);

    }

    interface Presenter extends BasePresenter {

        void getRandomBanner();

        void setThemeColor(@Nullable Palette palette);

        void getBanner(final boolean isRandom);

        void saveCacheImgUrl(String url);

    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/home/HomePresenter.java
================================================
package me.bakumon.ugank.module.home;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.graphics.Palette;

import me.bakumon.ugank.App;
import me.bakumon.ugank.ConfigManage;
import me.bakumon.ugank.R;
import me.bakumon.ugank.ThemeManage;
import me.bakumon.ugank.entity.CategoryResult;
import me.bakumon.ugank.network.NetWork;
import rx.Observable;
import rx.Observer;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import rx.subscriptions.CompositeSubscription;

/**
 * HomePresenter
 * Created by bakumon on 2016/12/6 11:07.
 */
public class HomePresenter implements HomeContract.Presenter {

    private HomeContract.View mHomeView;

    @NonNull
    private CompositeSubscription mSubscriptions;

    public HomePresenter(HomeContract.View homeView) {
        mHomeView = homeView;
        mSubscriptions = new CompositeSubscription();
    }

    @Override
    public void subscribe() {
        getBanner(false);
        cacheRandomImg();
    }

    @Override
    public void unsubscribe() {
        mSubscriptions.clear();
    }


    @Override
    public void getRandomBanner() {
        getBanner(true);
    }

    @Override
    public void setThemeColor(@Nullable Palette palette) {
        if (palette != null) {
            int colorPrimary = App.getInstance().getResources().getColor(R.color.colorPrimary);
            // 把从调色板上获取的主题色保存在内存中
            ThemeManage.INSTANCE.setColorPrimary(palette.getDarkVibrantColor(colorPrimary));
            // 设置 AppBarLayout 的背景色
            mHomeView.setAppBarLayoutColor(ThemeManage.INSTANCE.getColorPrimary());
            // 设置 FabButton 的背景色
            mHomeView.setFabButtonColor(ThemeManage.INSTANCE.getColorPrimary());
            // 停止 FabButton 加载中动画
            mHomeView.enableFabButton();
            mHomeView.stopBannerLoadingAnim();
        }
    }

    private void cacheRandomImg() {
        if (!ConfigManage.INSTANCE.isShowLauncherImg()) { // 不显示欢迎妹子,也就不需要预加载了
            return;
        }
        if (ConfigManage.INSTANCE.isProbabilityShowLauncherImg()) { // 概率出现欢迎妹子
            if (Math.random() < 0.75) {
                ConfigManage.INSTANCE.setBannerURL("");
                return;
            }
        }
        Observable<CategoryResult> observable;
        observable = NetWork.getGankApi().getRandomBeauties(1);
        Subscription subscription = observable
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<CategoryResult>() {
                    @Override
                    public void onCompleted() {
                    }

                    @Override
                    public void onError(Throwable e) {
                    }

                    @Override
                    public void onNext(CategoryResult meiziResult) {
                        if (meiziResult != null && meiziResult.results != null && meiziResult.results.size() > 0 && meiziResult.results.get(0).url != null) {
                            mHomeView.cacheImg(meiziResult.results.get(0).url);
                        }
                    }
                });
        mSubscriptions.add(subscription);
    }

    @Override
    public void saveCacheImgUrl(String url) {
        ConfigManage.INSTANCE.setBannerURL(url);
    }

    /**
     * 或单张 Banner
     *
     * @param isRandom true:随机  false:获取最新
     */
    @Override
    public void getBanner(final boolean isRandom) {
        mHomeView.startBannerLoadingAnim();
        mHomeView.disEnableFabButton();
        Observable<CategoryResult> observable;
        if (isRandom) {
            observable = NetWork.getGankApi().getRandomBeauties(1);
        } else {
            observable = NetWork.getGankApi().getCategoryDate("福利", 1, 1);
        }
        Subscription subscription = observable
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<CategoryResult>() {
                    @Override
                    public void onCompleted() {
                    }

                    @Override
                    public void onError(Throwable e) {
                        mHomeView.showBannerFail("Banner 图加载失败。");
                        mHomeView.enableFabButton();
                        mHomeView.stopBannerLoadingAnim();
                    }

                    @Override
                    public void onNext(CategoryResult meiziResult) {
                        if (meiziResult != null && meiziResult.results != null && meiziResult.results.size() > 0 && meiziResult.results.get(0).url != null) {
                            mHomeView.setBanner(meiziResult.results.get(0).url);
                        } else {
                            mHomeView.showBannerFail("Banner 图加载失败。");
                        }
                    }
                });
        mSubscriptions.add(subscription);
    }

}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/launcher/LauncherActivity.java
================================================
package me.bakumon.ugank.module.launcher;

import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.AppCompatImageView;
import android.text.TextUtils;

import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import me.bakumon.ugank.R;
import me.bakumon.ugank.module.bigimg.BigimgActivity;
import me.bakumon.ugank.module.home.HomeActivity;

/**
 * LauncherActivity
 * Created by bakumon on 2016/12/8.
 */
public class LauncherActivity extends AppCompatActivity implements LauncherContract.View {

    @BindView(R.id.img_launcher_welcome)
    AppCompatImageView mImageView;

    // 记录该 Activity 是否在前台显示
    private boolean isResume;
    private String mUrl;

    private LauncherContract.Presenter mLauncherPresenter = new LauncherPresenter(this);

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.activity_launcher);
        ButterKnife.bind(this);
        mLauncherPresenter.subscribe();
    }

    @Override
    public void loadImg(String url) {
        mUrl = url;
        try {
            Picasso.with(this)
                    .load(url)
                    .into(mImageView, new Callback() {
                        @Override
                        public void onSuccess() {
                            Handler handler = new Handler();
                            handler.postDelayed(new Runnable() {
                                @Override
                                public void run() {
                                    if (!isResume) {
                                        finish();
                                        return;
                                    }
                                    goHomeActivity();
                                }
                            }, 1200);
                        }

                        @Override
                        public void onError() {
                            goHomeActivity();
                        }
                    });
        } catch (Exception e) {
            goHomeActivity();
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        isResume = true;
    }

    @Override
    protected void onPause() {
        super.onPause();
        isResume = false;
    }

    @Override
    public void goHomeActivity() {
        Intent intent = new Intent(LauncherActivity.this, HomeActivity.class);
        startActivity(intent);
        // Activity 切换淡入淡出动画
        overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
        finish();
    }

    @OnClick(R.id.img_launcher_welcome)
    public void goBigImg(){
        if (TextUtils.isEmpty(mUrl)) {
            return;
        }
        goHomeActivity();
        Intent intent = new Intent();
        intent.setClass(this, BigimgActivity.class);
        intent.putExtra(BigimgActivity.MEIZI_TITLE, "");
        intent.putExtra(BigimgActivity.MEIZI_URL, mUrl);
        startActivity(intent);
    }

    @Override
    public void onBackPressed() {
        // 禁掉返回键
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mLauncherPresenter.unsubscribe();
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/launcher/LauncherContract.java
================================================
package me.bakumon.ugank.module.launcher;

import me.bakumon.ugank.base.BasePresenter;
import me.bakumon.ugank.base.BaseView;

/**
 * LauncherContract
 * Created by bakumon on 17-3-21.
 */

public class LauncherContract {

    interface View extends BaseView {

        void goHomeActivity();

        void loadImg(String url);
    }

    interface Presenter extends BasePresenter {

    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/launcher/LauncherPresenter.java
================================================
package me.bakumon.ugank.module.launcher;

import android.text.TextUtils;

import me.bakumon.ugank.ConfigManage;

/**
 * LauncherPresenter
 * Created by bakumon on 17-3-21.
 */

public class LauncherPresenter implements LauncherContract.Presenter {

    private LauncherContract.View mLauncherView;

    public LauncherPresenter(LauncherContract.View view) {
        mLauncherView = view;
    }

    @Override
    public void subscribe() {
        if (!ConfigManage.INSTANCE.isShowLauncherImg()) {
            mLauncherView.goHomeActivity();
            return;
        }
        String imgCacheUrl = ConfigManage.INSTANCE.getBannerURL();
        if (!TextUtils.isEmpty(imgCacheUrl)) {
            mLauncherView.loadImg(imgCacheUrl);
        } else {
            mLauncherView.goHomeActivity();
        }
    }

    @Override
    public void unsubscribe() {

    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/search/HistoryListAdapter.java
================================================
package me.bakumon.ugank.module.search;

import android.content.Context;
import android.view.View;

import me.bakumon.ugank.R;
import me.bakumon.ugank.base.adapter.CommonAdapter4RecyclerView;
import me.bakumon.ugank.base.adapter.CommonHolder4RecyclerView;
import me.bakumon.ugank.base.adapter.ListenerWithPosition;
import me.bakumon.ugank.entity.History;

/**
 * HistoryListAdapter
 * Created by bakumon on 2017/2/18.
 */

public class HistoryListAdapter extends CommonAdapter4RecyclerView<History> implements ListenerWithPosition.OnClickWithPositionListener<CommonHolder4RecyclerView> {

    public HistoryListAdapter(Context context) {
        super(context, null, R.layout.item_history);
    }

    @Override
    public void convert(CommonHolder4RecyclerView holder, History history) {
        if (history != null) {
            holder.setTextViewText(R.id.tv_item_content_history, history.getContent() == null ? "unknown" : history.getContent());
            holder.setOnClickListener(this, R.id.tv_item_content_history);
        }
    }

    @Override
    public void onClick(View v, int position, CommonHolder4RecyclerView holder) {
        if (mData.get(position) == null) {
            return;
        }
        if (mOnItemClickListener != null) {
            mOnItemClickListener.OnItemClick(mData.get(position));
        }
    }

    private OnItemClickListener mOnItemClickListener;

    public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
        mOnItemClickListener = onItemClickListener;
    }

    public interface OnItemClickListener {
        void OnItemClick(History history);
    }

}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/search/SearchActivity.java
================================================
package me.bakumon.ugank.module.search;

import android.content.pm.ActivityInfo;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.AppCompatEditText;
import android.support.v7.widget.AppCompatImageView;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.google.android.flexbox.FlexboxLayoutManager;
import com.luolc.emojirain.EmojiRainLayout;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import es.dmoral.toasty.Toasty;
import me.bakumon.ugank.R;
import me.bakumon.ugank.base.SwipeBackBaseActivity;
import me.bakumon.ugank.entity.History;
import me.bakumon.ugank.entity.SearchResult;
import me.bakumon.ugank.utills.DisplayUtils;
import me.bakumon.ugank.utills.KeyboardUtils;
import me.bakumon.ugank.utills.MDTintUtil;
import me.bakumon.ugank.utills.StatusBarUtil;
import me.bakumon.ugank.widget.RecycleViewDivider;
import me.bakumon.ugank.widget.recyclerviewwithfooter.OnLoadMoreListener;
import me.bakumon.ugank.widget.recyclerviewwithfooter.RecyclerViewWithFooter;

public class SearchActivity extends SwipeBackBaseActivity implements SearchContract.View, TextWatcher, TextView.OnEditorActionListener, OnLoadMoreListener, HistoryListAdapter.OnItemClickListener {

    @BindView(R.id.toolbar_search)
    Toolbar mToolbarSearch;
    @BindView(R.id.ed_search)
    AppCompatEditText mEdSearch;
    @BindView(R.id.iv_edit_clear)
    AppCompatImageView mIvEditClear;
    @BindView(R.id.iv_search)
    AppCompatImageView mIvSearch;
    @BindView(R.id.appbar_search)
    AppBarLayout mAppbarSearch;
    @BindView(R.id.recycler_view_search)
    RecyclerViewWithFooter mRecyclerViewSearch;
    @BindView(R.id.swipe_refresh_layout_search)
    SwipeRefreshLayout mSwipeRefreshLayoutSearch;
    @BindView(R.id.ll_search_history)
    LinearLayout mLlHistory;
    @BindView(R.id.recycler_search_history)
    RecyclerView mRecyclerViewHistory;
    @BindView(R.id.emoji_rainLayout)
    EmojiRainLayout mEmojiRainLayout;

    private SearchContract.Presenter mSearchPresenter = new SearchPresenter(this);

    private SearchListAdapter mSearchListAdapter;
    private HistoryListAdapter mHistoryListAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.activity_search);
        ButterKnife.bind(this);
        initView();
        mSearchPresenter.subscribe();
        mSearchPresenter.queryHistory();
    }

    private void initView() {

        StatusBarUtil.immersive(this);
        StatusBarUtil.setPaddingSmart(this, mToolbarSearch);
        setSupportActionBar(mToolbarSearch);
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }
        mToolbarSearch.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });

        mEdSearch.addTextChangedListener(this);
        mEdSearch.setOnEditorActionListener(this);

        mSwipeRefreshLayoutSearch.setColorSchemeResources(
                R.color.colorSwipeRefresh1,
                R.color.colorSwipeRefresh2,
                R.color.colorSwipeRefresh3,
                R.color.colorSwipeRefresh4,
                R.color.colorSwipeRefresh5,
                R.color.colorSwipeRefresh6);
        mSwipeRefreshLayoutSearch.setRefreshing(false);
        mSwipeRefreshLayoutSearch.setEnabled(false);

        mSearchListAdapter = new SearchListAdapter(this);
        mRecyclerViewSearch.setLayoutManager(new LinearLayoutManager(this));
        mRecyclerViewSearch.addItemDecoration(new RecycleViewDivider(this, LinearLayoutManager.HORIZONTAL));
        mRecyclerViewSearch.setAdapter(mSearchListAdapter);
        mRecyclerViewSearch.setOnLoadMoreListener(this);
        mRecyclerViewSearch.setEmpty();

        mHistoryListAdapter = new HistoryListAdapter(this);

        mHistoryListAdapter.setOnItemClickListener(this);
        mHistoryListAdapter.mData = null;
        mRecyclerViewHistory.setLayoutManager(new FlexboxLayoutManager());
        mRecyclerViewHistory.setAdapter(mHistoryListAdapter);

        mEmojiRainLayout.addEmoji(R.mipmap.emoji1);
        mEmojiRainLayout.addEmoji(R.mipmap.emoji2);
        mEmojiRainLayout.addEmoji(R.mipmap.emoji3);
        mEmojiRainLayout.addEmoji(R.mipmap.emoji4);
        mEmojiRainLayout.addEmoji(R.mipmap.emoji5);
        mEmojiRainLayout.addEmoji(R.mipmap.emoji6);

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mSearchPresenter.unsubscribe();
    }

    @Override
    public void setToolbarBackgroundColor(int color) {
        mAppbarSearch.setBackgroundColor(color);
    }

    @Override
    public void setEditTextCursorColor(int cursorColor) {
        MDTintUtil.setCursorTint(mEdSearch, cursorColor);
    }

    @Override
    public void showEditClear() {
        mIvEditClear.setVisibility(View.VISIBLE);
    }

    @Override
    public void hideEditClear() {
        mIvEditClear.setVisibility(View.GONE);
    }

    @Override
    public void showSearchFail(String failMsg) {
        Toasty.error(this, failMsg).show();
    }

    @Override
    public void setSearchItems(SearchResult searchResult) {
        mSearchListAdapter.mData = searchResult.results;
        mSearchListAdapter.notifyDataSetChanged();
        mSwipeRefreshLayoutSearch.setRefreshing(false);
    }

    @Override
    public void addSearchItems(SearchResult searchResult) {
        int start = mSearchListAdapter.getItemCount();
        mSearchListAdapter.mData.addAll(searchResult.results);
        mSearchListAdapter.notifyItemRangeInserted(start, searchResult.results.size());
    }

    @Override
    public void showSwipLoading() {
        mSwipeRefreshLayoutSearch.setRefreshing(true);
    }

    @Override
    public void hideSwipLoading() {
        mSwipeRefreshLayoutSearch.setRefreshing(false);
    }

    @Override
    public void showTip(String msg) {
        Toasty.warning(this, msg).show();
    }

    @Override
    public void setLoadMoreIsLastPage() {
        mRecyclerViewSearch.setEnd("没有更多数据了");
    }

    @Override
    public void setEmpty() {
        mRecyclerViewSearch.setEmpty();
    }

    @Override
    public void setLoading() {
        mRecyclerViewSearch.setLoading();
    }

    @Override
    public void showSearchResult() {
        mLlHistory.setVisibility(View.GONE);
        mSwipeRefreshLayoutSearch.setVisibility(View.VISIBLE);
    }

    @Override
    public void showSearchHistory() {
        mLlHistory.setVisibility(View.VISIBLE);
        mSwipeRefreshLayoutSearch.setVisibility(View.GONE);
    }

    @Override
    public void setHistory(List<History> history) {
        mHistoryListAdapter.mData = history;
        mHistoryListAdapter.notifyDataSetChanged();
    }

    @Override
    public void startEmojiRain() {
        mEmojiRainLayout.startDropping();
    }

    @Override
    public void stopEmojiRain() {
        mEmojiRainLayout.stopDropping();
    }

    @Override
    public void onLoadMore() {
        mSearchPresenter.search(mEdSearch.getText().toString().trim(), true);
    }

    @OnClick(R.id.iv_edit_clear)
    public void editClear() {
        mRecyclerViewSearch.setEmpty();
        mEdSearch.setText("");
        KeyboardUtils.showSoftInput(this, mEdSearch);
        hideSwipLoading();
        showSearchHistory();
        mSearchPresenter.unsubscribe();
        mSearchPresenter.queryHistory();
    }

    @OnClick(R.id.iv_search)
    public void search() {
        KeyboardUtils.hideSoftInput(this);
        mSearchPresenter.search(mEdSearch.getText().toString().trim(), false);
    }

    @OnClick(R.id.tv_search_clean)
    public void cleanHistory() {
        mSearchPresenter.deleteAllHistory();
    }

    @Override
    public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

    }

    @Override
    public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

    }

    @Override
    public void afterTextChanged(Editable editable) {
        if (editable.length() > 0) {
            showEditClear();
        } else {
            hideEditClear();
            hideSwipLoading();
            mSearchPresenter.unsubscribe();
            mRecyclerViewSearch.setEmpty();
            mSearchListAdapter.mData = null;
            mSearchListAdapter.notifyDataSetChanged();
            showSearchHistory();
            mSearchPresenter.queryHistory();
        }
    }

    @Override
    public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
        if (actionId == EditorInfo.IME_ACTION_SEARCH) {
            search();
        }
        return false;
    }

    @Override
    public void OnItemClick(History history) {
        if (history == null || history.getContent() == null) {
            return;
        }
        KeyboardUtils.hideSoftInput(this);
        mEdSearch.setText(history.getContent());
        mEdSearch.setSelection(mEdSearch.getText().toString().length());
        mSearchPresenter.search(history.getContent(), false);
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/search/SearchContract.java
================================================
package me.bakumon.ugank.module.search;

import java.util.List;

import me.bakumon.ugank.base.BasePresenter;
import me.bakumon.ugank.base.BaseView;
import me.bakumon.ugank.entity.History;
import me.bakumon.ugank.entity.SearchResult;

/**
 * SearchContract
 * Created by bakumon on 2016/12/19 14:20.
 */
public interface SearchContract {
    interface View extends BaseView {

        void setToolbarBackgroundColor(int color);

        void setEditTextCursorColor(int cursorColor);

        void showEditClear();

        void hideEditClear();

        void showSearchFail(String failMsg);

        void setSearchItems(SearchResult searchResult);

        void addSearchItems(SearchResult searchResult);

        void showSwipLoading();

        void hideSwipLoading();

        void showTip(String msg);

        void setLoadMoreIsLastPage();

        void setEmpty();

        void setLoading();

        void showSearchResult();

        void showSearchHistory();

        void setHistory(List<History> history);

        void startEmojiRain();

        void stopEmojiRain();
    }

    interface Presenter extends BasePresenter {

        void search(String searchText, boolean isLoadMore);

        void queryHistory();

        void deleteAllHistory();
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/search/SearchListAdapter.java
================================================
package me.bakumon.ugank.module.search;

import android.content.Context;
import android.content.Intent;
import android.view.View;

import es.dmoral.toasty.Toasty;
import me.bakumon.ugank.R;
import me.bakumon.ugank.base.adapter.CommonAdapter4RecyclerView;
import me.bakumon.ugank.base.adapter.CommonHolder4RecyclerView;
import me.bakumon.ugank.base.adapter.ListenerWithPosition;
import me.bakumon.ugank.entity.Favorite;
import me.bakumon.ugank.entity.SearchResult;
import me.bakumon.ugank.module.bigimg.BigimgActivity;
import me.bakumon.ugank.module.webview.WebViewActivity;
import me.bakumon.ugank.utills.DateUtil;

/**
 * SearchListAdapter
 * Created by bakumon on 2016/12/20.
 */

public class SearchListAdapter extends CommonAdapter4RecyclerView<SearchResult.ResultsBean> implements ListenerWithPosition.OnClickWithPositionListener<CommonHolder4RecyclerView> {

    public SearchListAdapter(Context context) {
        super(context, null, R.layout.item_search);
    }

    @Override
    public void convert(CommonHolder4RecyclerView holder, SearchResult.ResultsBean searchResult) {
        if (searchResult != null) {
            holder.setTextViewText(R.id.tv_item_title_search, searchResult.desc == null ? "unknown" : searchResult.desc);
            holder.setTextViewText(R.id.tv_item_type_search, searchResult.type == null ? "unknown" : searchResult.type);
            holder.setTextViewText(R.id.tv_item_publisher_search, searchResult.who == null ? "unknown" : searchResult.who);
            holder.setTextViewText(R.id.tv_item_time_search, DateUtil.dateFormat(searchResult.publishedAt));
            holder.setOnClickListener(this, R.id.ll_item_search);
        }
    }

    @Override
    public void onClick(View v, int position, CommonHolder4RecyclerView holder) {
        if (mData == null || mData.get(position) == null) {
            Toasty.error(mContext, "数据异常").show();
            return;
        }
        Intent intent = new Intent();
        if ("福利".equals(mData.get(position).type)) {
            intent.setClass(mContext, BigimgActivity.class);
            intent.putExtra(BigimgActivity.MEIZI_TITLE, mData.get(position).desc);
            intent.putExtra(BigimgActivity.MEIZI_URL, mData.get(position).url);
        } else {
            intent.setClass(mContext, WebViewActivity.class);
            intent.putExtra(WebViewActivity.GANK_TITLE, mData.get(position).desc);
            intent.putExtra(WebViewActivity.GANK_URL, mData.get(position).url);
            Favorite favorite = new Favorite();
            favorite.setAuthor(mData.get(position).who);
            favorite.setData(mData.get(position).publishedAt);
            favorite.setTitle(mData.get(position).desc);
            favorite.setType(mData.get(position).type);
            favorite.setUrl(mData.get(position).url);
            favorite.setGankID(mData.get(position).ganhuo_id);
            intent.putExtra(WebViewActivity.FAVORITE_DATA, favorite);
        }
        mContext.startActivity(intent);
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/search/SearchPresenter.java
================================================
package me.bakumon.ugank.module.search;

import android.graphics.Color;
import android.text.TextUtils;

import org.litepal.crud.DataSupport;

import java.util.List;

import me.bakumon.ugank.GlobalConfig;
import me.bakumon.ugank.ThemeManage;
import me.bakumon.ugank.entity.History;
import me.bakumon.ugank.entity.SearchResult;
import me.bakumon.ugank.network.NetWork;
import me.bakumon.ugank.utills.EmojiFilter;
import rx.Observer;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import rx.subscriptions.CompositeSubscription;

/**
 * SearchPresenter
 * Created by bakumon on 2016/12/19 14:21.
 */
public class SearchPresenter implements SearchContract.Presenter {

    private SearchContract.View mView;

    private CompositeSubscription mSubscriptions;
    private int mPage = 1;

    public SearchPresenter(SearchContract.View view) {
        mView = view;
    }

    @Override
    public void subscribe() {
        mSubscriptions = new CompositeSubscription();
        mView.setToolbarBackgroundColor(ThemeManage.INSTANCE.getColorPrimary());
        mView.setEditTextCursorColor(Color.WHITE);
        mView.hideEditClear();
    }

    @Override
    public void unsubscribe() {
        mSubscriptions.clear();
    }

    @Override
    public void search(final String searchText, final boolean isLoadMore) {
        String searchTextNoEmoji = EmojiFilter.filterEmoji(searchText);
        if (TextUtils.isEmpty(searchTextNoEmoji)) {
            mView.startEmojiRain();
            return;
        }
        if (TextUtils.isEmpty(searchText)) {
            mView.showTip("搜索内容不能为空。");
            return;
        }
        mView.showSearchResult();
        saveOneHistory(searchText);
        if (!isLoadMore) {
            mView.showSwipLoading();
            mPage = 1;
        } else {
            mPage += 1;
        }
        Subscription subscription = NetWork.getGankApi()
                .getSearchResult(searchText, GlobalConfig.PAGE_SIZE_CATEGORY, mPage)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<SearchResult>() {
                    @Override
                    public void onCompleted() {
                    }

                    @Override
                    public void onError(Throwable e) {
                        mView.showSearchFail("搜索出错了。");
                        mView.hideSwipLoading();
                    }

                    @Override
                    public void onNext(SearchResult searchResult) {
                        if (!isLoadMore) {
                            if (searchResult == null || searchResult.count == 0) {
                                mView.showTip("没有搜索到结果");
                                mView.hideSwipLoading();
                                mView.showSearchHistory();
                                mView.setEmpty();
                                return;
                            }
                            mView.setSearchItems(searchResult);
                            mView.showSearchResult();
                            mView.setLoading();
                        } else {
                            mView.addSearchItems(searchResult);
                            mView.showSearchResult();
                        }
                        boolean isLastPage = searchResult.count < GlobalConfig.PAGE_SIZE_CATEGORY;
                        if (isLastPage) {
                            mView.setLoadMoreIsLastPage();
                        }

                    }


                });
        mSubscriptions.add(subscription);
    }

    @Override
    public void queryHistory() {
        // 展示查询所有,需要截取、去重和排序
        List<History> historyList = DataSupport.order("createTimeMill desc").limit(10).find(History.class);
        // 将查询结果转为list对象
        if (historyList == null || historyList.size() < 1) {
            mView.showSearchResult();
        } else {
            mView.setHistory(historyList);
        }
    }

    private void saveOneHistory(String historyContent) {
        if (TextUtils.isEmpty(historyContent)) {
            return;
        }
        // 不知道 LitePal 支不支持去重
        // 先这样写吧,新增之前查询是否有相同数据,有就更新 CreateTimeMill ,没有就直接新增
        List<History> historyList = DataSupport.where("content = ?", historyContent).find(History.class);
        if (historyList == null || historyList.size() < 1) { // 不存在
            History history = new History();
            history.setCreateTimeMill(System.currentTimeMillis());
            history.setContent(historyContent);
            history.save();
        } else {
            // 更新
            History updateNews = new History();
            updateNews.setCreateTimeMill(System.currentTimeMillis());
            updateNews.updateAll("content = ?", historyContent);
        }

    }

    @Override
    public void deleteAllHistory() {
        DataSupport.deleteAll(History.class);
        mView.showSearchResult();
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/setting/SettingActivity.java
================================================
package me.bakumon.ugank.module.setting;

import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.v7.widget.AppCompatTextView;
import android.support.v7.widget.SwitchCompat;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.afollestad.materialdialogs.MaterialDialog;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import es.dmoral.toasty.Toasty;
import me.bakumon.ugank.R;
import me.bakumon.ugank.base.SwipeBackBaseActivity;
import me.bakumon.ugank.utills.AlipayZeroSdk;
import me.bakumon.ugank.utills.DisplayUtils;
import me.bakumon.ugank.utills.MDTintUtil;
import me.bakumon.ugank.utills.StatusBarUtil;
import me.bakumon.ugank.widget.AboutDialog;

public class SettingActivity extends SwipeBackBaseActivity implements SettingContract.View, CompoundButton.OnCheckedChangeListener {

    @BindView(R.id.toolbar_setting)
    Toolbar mToolbarSetting;
    @BindView(R.id.switch_setting)
    SwitchCompat mSwitchSetting;
    @BindView(R.id.appbar_setting)
    AppBarLayout mAppbarSetting;
    @BindView(R.id.tv_setting_version_name)
    AppCompatTextView mTvSettingVersionName;
    @BindView(R.id.ll_setting_image_quality)
    LinearLayout mLlImageQuality;
    @BindView(R.id.tv_setting_image_quality_title)
    TextView mTvImageQualityTitle;
    @BindView(R.id.tv_setting_image_quality_content)
    TextView mTvImageQualityContent;
    @BindView(R.id.tv_setting_image_quality_tip)
    TextView mTvImageQualityTip;
    @BindView(R.id.tv_setting_clean_cache)
    TextView mTvCleanCache;
    @BindView(R.id.switch_setting_show_launcher_img)
    SwitchCompat mSwitchSettingShowLauncherImg;
    @BindView(R.id.switch_setting_always_show_launcher_img)
    SwitchCompat mSwitchSettingAlwaysShowLauncherImg;
    @BindView(R.id.ll_is_always_show_launcher_img)
    LinearLayout mLlAlwaysShowLauncherImg;
    @BindView(R.id.tv_is_always_show_launcher_img_title)
    AppCompatTextView mTvAlwaysShowLauncherImgTitle;
    @BindView(R.id.tv_is_always_show_launcher_img_content)
    AppCompatTextView mTvAlwaysShowLauncherImgContent;
    @BindView(R.id.tv_is_show_launcher_img_content)
    AppCompatTextView mTvShowLauncherImgContent;

    private SettingPresenter mSettingPresenter = new SettingPresenter(this);

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.activity_setting);
        ButterKnife.bind(this);
        StatusBarUtil.immersive(this);
        StatusBarUtil.setPaddingSmart(this, mAppbarSetting);
        setSupportActionBar(mToolbarSetting);
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }
        mToolbarSetting.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                onBackPressed();
            }
        });
        mSwitchSetting.setOnCheckedChangeListener(this);
        mSwitchSettingShowLauncherImg.setOnCheckedChangeListener(this);
        mSwitchSettingAlwaysShowLauncherImg.setOnCheckedChangeListener(this);
        mSettingPresenter.subscribe();
    }

    @Override
    public void onBackPressed() {
        if (mSettingPresenter.isThumbnailSettingChanged()) { // 显示缩略图设置项改变
            setResult(RESULT_OK);
        }
        super.onBackPressed();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mSettingPresenter.unsubscribe();
    }

    @OnClick(R.id.ll_is_show_list_img)
    public void changSwitchState(View view) {
        mSwitchSetting.setChecked(!mSwitchSetting.isChecked());
    }

    @OnClick(R.id.ll_is_show_launcher_img)
    public void isShowLauncherImg() {
        mSwitchSettingShowLauncherImg.setChecked(!mSwitchSettingShowLauncherImg.isChecked());
    }

    @OnClick(R.id.ll_is_always_show_launcher_img)
    public void isAlwaysShowLauncherImg() {
        mSwitchSettingAlwaysShowLauncherImg.setChecked(!mSwitchSettingAlwaysShowLauncherImg.isChecked());
    }

    @Override
    public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
        switch (compoundButton.getId()) {
            case R.id.switch_setting:
                mSettingPresenter.saveIsListShowImg(isChecked);
                break;
            case R.id.switch_setting_show_launcher_img:
                mSettingPresenter.saveIsLauncherShowImg(isChecked);
                break;
            case R.id.switch_setting_always_show_launcher_img:
                mSettingPresenter.saveIsLauncherAlwaysShowImg(isChecked);
                break;
        }

    }

    @Override
    public void setToolbarBackgroundColor(int color) {
        mAppbarSetting.setBackgroundColor(color);
    }

    @Override
    public void changeSwitchState(boolean isChecked) {
        mSwitchSetting.setChecked(isChecked);
    }

    @Override
    public void changeIsShowLauncherImgSwitchState(boolean isChecked) {
        mSwitchSettingShowLauncherImg.setChecked(isChecked);
    }

    @Override
    public void changeIsAlwaysShowLauncherImgSwitchState(boolean isChecked) {
        mSwitchSettingAlwaysShowLauncherImg.setChecked(isChecked);
    }

    @Override
    public void setSwitchCompatsColor(int color) {
        MDTintUtil.setTint(mSwitchSetting, color);
        MDTintUtil.setTint(mSwitchSettingShowLauncherImg, color);
        MDTintUtil.setTint(mSwitchSettingAlwaysShowLauncherImg, color);
    }

    @Override
    public void setAppVersionNameInTv(String versionName) {
        mTvSettingVersionName.setText("版本: " + versionName);
    }

    @Override
    public void setImageQualityChooseUnEnable() {
        mLlImageQuality.setClickable(false);
        mTvImageQualityTitle.setTextColor(getResources().getColor(R.color.colorTextUnEnable));
        mTvImageQualityContent.setTextColor(getResources().getColor(R.color.colorTextUnEnable));
        mTvImageQualityTip.setTextColor(getResources().getColor(R.color.colorTextUnEnable));
    }

    @Override
    public void setImageQualityChooseEnable() {
        mLlImageQuality.setClickable(true);
        mTvImageQualityTitle.setTextColor(getResources().getColor(R.color.colorTextEnable));
        mTvImageQualityContent.setTextColor(getResources().getColor(R.color.colorTextEnableGary));
        mTvImageQualityTip.setTextColor(getResources().getColor(R.color.colorTextEnableGary));
    }

    @Override
    public void setLauncherImgProbabilityUnEnable() {
        mLlAlwaysShowLauncherImg.setClickable(false);
        mSwitchSettingAlwaysShowLauncherImg.setClickable(false);
        mTvAlwaysShowLauncherImgTitle.setTextColor(getResources().getColor(R.color.colorTextUnEnable));
        mTvAlwaysShowLauncherImgContent.setTextColor(getResources().getColor(R.color.colorTextUnEnable));
    }

    @Override
    public void setLauncherImgProbabilityEnable() {
        mLlAlwaysShowLauncherImg.setClickable(true);
        mSwitchSettingAlwaysShowLauncherImg.setClickable(true);
        mTvAlwaysShowLauncherImgTitle.setTextColor(getResources().getColor(R.color.colorTextEnable));
        mTvAlwaysShowLauncherImgContent.setTextColor(getResources().getColor(R.color.colorTextEnableGary));
    }

    @Override
    public void setThumbnailQualityInfo(int quality) {
        String thumbnailQuality = "";
        switch (quality) {
            case 0:
                thumbnailQuality = "原图";
                break;
            case 1:
                thumbnailQuality = "默认";
                break;
            case 2:
                thumbnailQuality = "省流";
                break;
        }
        mTvImageQualityContent.setText(thumbnailQuality);
    }

    @Override
    public void showCacheSize(String cache) {
        mTvCleanCache.setText(cache);
    }

    @Override
    public void showSuccessTip(String msg) {
        Toasty.success(this, msg).show();
    }

    @Override
    public void showFailTip(String msg) {
        Toasty.error(this, msg).show();
    }

    @Override
    public void setShowLauncherTip(String tip) {
        mTvShowLauncherImgContent.setText(tip);
    }

    @Override
    public void setAlwaysShowLauncherTip(String tip) {
        mTvAlwaysShowLauncherImgContent.setText(tip);
    }

    @OnClick(R.id.ll_setting_image_quality)
    public void chooseThumbnailQuality() {
        new MaterialDialog.Builder(this)
                .title("缩略图质量")
                .items("原图", "默认", "省流")
                .widgetColor(mSettingPresenter.getColorPrimary())
                .alwaysCallSingleChoiceCallback()
                .itemsCallbackSingleChoice(mSettingPresenter.getThumbnailQuality(), new MaterialDialog.ListCallbackSingleChoice() {
                    @Override
                    public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
                        mSettingPresenter.setThumbnailQuality(which);
                        dialog.dismiss();
                        return true;
                    }
                })
                .positiveText("取消")
                .positiveColor(mSettingPresenter.getColorPrimary())
                .show();
    }

    @OnClick(R.id.ll_setting_about)
    public void about() {
        new AboutDialog(this, mSettingPresenter.getColorPrimary()).show();
    }

    @OnClick(R.id.ll_setting_clean_cache)
    public void cleanCache() {
        mSettingPresenter.cleanCache();
    }

    @OnClick(R.id.ll_setting_issues)
    public void issues() {
        Uri uri = Uri.parse("https://github.com/Bakumon/UGank/issues");
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        startActivity(intent);
    }

    @OnClick(R.id.ll_setting_pay)
    public void pay() {
        // https://fama.alipay.com/qrcode/qrcodelist.htm?qrCodeType=P  二维码地址
        // http://cli.im/deqr/ 解析二维码
        // aex01251c8foqaprudcp503
        if (AlipayZeroSdk.hasInstalledAlipayClient(this)) {
            AlipayZeroSdk.startAlipayClient(this, "aex01251c8foqaprudcp503");
        } else {
            Toasty.info(this, "谢谢,您没有安装支付宝客户端").show();
        }
    }
}



================================================
FILE: app/src/main/java/me/bakumon/ugank/module/setting/SettingContract.java
================================================
package me.bakumon.ugank.module.setting;

import me.bakumon.ugank.base.BasePresenter;
import me.bakumon.ugank.base.BaseView;

/**
 * SettingContract
 * Created by bakumon on 2016/12/15 17:05.
 */
public interface SettingContract {

    interface View extends BaseView {

        void setToolbarBackgroundColor(int color);

        void changeSwitchState(boolean isChecked);

        void changeIsShowLauncherImgSwitchState(boolean isChecked);

        void changeIsAlwaysShowLauncherImgSwitchState(boolean isChecked);

        void setSwitchCompatsColor(int color);

        void setAppVersionNameInTv(String versionName);

        void setImageQualityChooseUnEnable();

        void setImageQualityChooseEnable();

        void setLauncherImgProbabilityUnEnable();

        void setLauncherImgProbabilityEnable();

        void setThumbnailQualityInfo(int quality);

        void showCacheSize(String cache);

        void showSuccessTip(String msg);

        void showFailTip(String msg);

        void setShowLauncherTip(String tip);

        void setAlwaysShowLauncherTip(String tip);

    }

    interface Presenter extends BasePresenter {

        boolean isThumbnailSettingChanged();

        void saveIsListShowImg(boolean isListShowImg);

        void saveIsLauncherShowImg(boolean isLauncherShowImg);

        void saveIsLauncherAlwaysShowImg(boolean isLauncherAlwaysShowImg);

        int getColorPrimary();

        int getThumbnailQuality();

        void setThumbnailQuality(int quality);

        void cleanCache();
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/setting/SettingPresenter.java
================================================
package me.bakumon.ugank.module.setting;

import me.bakumon.ugank.App;
import me.bakumon.ugank.ConfigManage;
import me.bakumon.ugank.ThemeManage;
import me.bakumon.ugank.utills.DataCleanManager;
import me.bakumon.ugank.utills.PackageUtil;
import rx.subscriptions.CompositeSubscription;

/**
 * SettingPresenter
 * Created by bakumon on 2016/12/15 17:08.
 */
public class SettingPresenter implements SettingContract.Presenter {

    private SettingContract.View mView;

    private CompositeSubscription mSubscriptions;

    private boolean mSwitchSettingInitState;

    private int mTvImageQualityContentInitState;

    public SettingPresenter(SettingContract.View view) {
        mView = view;
    }

    @Override
    public void subscribe() {
        mSubscriptions = new CompositeSubscription();
        // 设置 View 界面的主题色
        mView.setSwitchCompatsColor(ThemeManage.INSTANCE.getColorPrimary());
        mView.setToolbarBackgroundColor(ThemeManage.INSTANCE.getColorPrimary());
        // 初始化开关显示状态
        mView.changeSwitchState(ConfigManage.INSTANCE.isListShowImg());
        mView.changeIsShowLauncherImgSwitchState(ConfigManage.INSTANCE.isShowLauncherImg());
        mView.changeIsAlwaysShowLauncherImgSwitchState(ConfigManage.INSTANCE.isProbabilityShowLauncherImg());

        setImageQualityChooseIsEnable(ConfigManage.INSTANCE.isListShowImg());
        setIsLauncherAlwaysShowImgEnable(ConfigManage.INSTANCE.isShowLauncherImg());

        mView.setAppVersionNameInTv(PackageUtil.getVersionName(App.getInstance()));
        setThumbnailQuality(ConfigManage.INSTANCE.getThumbnailQuality());
        mView.showCacheSize(DataCleanManager.getTotalCacheSize());

        mSwitchSettingInitState = ConfigManage.INSTANCE.isListShowImg();
        mTvImageQualityContentInitState = ConfigManage.INSTANCE.getThumbnailQuality();
    }

    @Override
    public boolean isThumbnailSettingChanged() {
        return mSwitchSettingInitState != ConfigManage.INSTANCE.isListShowImg()
                || mTvImageQualityContentInitState > ConfigManage.INSTANCE.getThumbnailQuality();
    }

    @Override
    public void unsubscribe() {
        mSubscriptions.clear();
    }

    @Override
    public void saveIsListShowImg(boolean isListShowImg) {
        ConfigManage.INSTANCE.setListShowImg(isListShowImg);
        setImageQualityChooseIsEnable(isListShowImg);
    }

    @Override
    public void saveIsLauncherShowImg(boolean isLauncherShowImg) {
        ConfigManage.INSTANCE.setShowLauncherImg(isLauncherShowImg);
        setIsLauncherAlwaysShowImgEnable(isLauncherShowImg);
        if (isLauncherShowImg) {
            mView.setShowLauncherTip("没有妹子太寂寞");
        } else {
            mView.setShowLauncherTip("基佬怎么会需要妹子");
        }
    }

    @Override
    public void saveIsLauncherAlwaysShowImg(boolean isLauncherAlwaysShowImg) {
        ConfigManage.INSTANCE.setProbabilityShowLauncherImg(isLauncherAlwaysShowImg);
        if (isLauncherAlwaysShowImg) {
            mView.setAlwaysShowLauncherTip("偶尔来个惊喜就行");
        } else {
            mView.setAlwaysShowLauncherTip("我每次都要幸临,没毛病");
        }
    }

    private void setIsLauncherAlwaysShowImgEnable(boolean isEnable) {
        if (isEnable) {
            mView.setLauncherImgProbabilityEnable();
        } else {
            mView.setLauncherImgProbabilityUnEnable();
        }
    }

    private void setImageQualityChooseIsEnable(boolean isEnable) {
        if (isEnable) {
            mView.setImageQualityChooseEnable();
        } else {
            mView.setImageQualityChooseUnEnable();
        }
    }

    @Override
    public int getColorPrimary() {
        return ThemeManage.INSTANCE.getColorPrimary();
    }

    @Override
    public int getThumbnailQuality() {
        return ConfigManage.INSTANCE.getThumbnailQuality();
    }

    @Override
    public void setThumbnailQuality(int quality) {
        ConfigManage.INSTANCE.setThumbnailQuality(quality);
        mView.setThumbnailQualityInfo(quality);
    }

    @Override
    public void cleanCache() {
        if (DataCleanManager.clearAllCache()) {
            ConfigManage.INSTANCE.setBannerURL("");
            mView.showSuccessTip("缓存清理成功!");
        } else {
            mView.showFailTip("缓存清理失败!");
        }

        try {
            mView.showCacheSize(DataCleanManager.getTotalCacheSize());
        } catch (Exception e) {
            e.printStackTrace();

        }
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/webview/WebViewActivity.java
================================================
package me.bakumon.ugank.module.webview;

import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import es.dmoral.toasty.Toasty;
import me.bakumon.ugank.R;
import me.bakumon.ugank.base.SwipeBackBaseActivity;
import me.bakumon.ugank.entity.Favorite;
import me.bakumon.ugank.module.favorite.FavoriteActivity;
import me.bakumon.ugank.utills.AndroidUtil;
import me.bakumon.ugank.utills.MDTintUtil;
import me.bakumon.ugank.utills.StatusBarUtil;
import me.bakumon.ugank.widget.ObservableWebView;

public class WebViewActivity extends SwipeBackBaseActivity implements WebViewContract.View {

    public static final String GANK_URL = "me.bakumon.gank.module.webview.WebViewActivity.gank_url";
    public static final String GANK_TITLE = "me.bakumon.gank.module.webview.WebViewActivity.gank_title";
    public static final String FAVORITE_DATA = "me.bakumon.gank.module.webview.WebViewActivity.favorite_data";
    public static final String FAVORITE_POSITION = "me.bakumon.gank.module.webview.WebViewActivity.favorite_position";

    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.tv_title)
    TextView mTvTitle;
    @BindView(R.id.web_view)
    ObservableWebView mWebView;
    @BindView(R.id.progressbar_webview)
    ProgressBar mProgressbar;
    @BindView(R.id.appbar)
    AppBarLayout mAppbar;
    @BindView(R.id.fab_web_favorite)
    FloatingActionButton mFloatingActionButton;

    private WebViewContract.Presenter mWebViewPresenter = new WebViewPresenter(this);
    private boolean isForResult; // 是否回传结果

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.activity_web_view);
        ButterKnife.bind(this);
        StatusBarUtil.immersive(this);
        StatusBarUtil.setPaddingSmart(this, mToolbar);
        setSupportActionBar(mToolbar);
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayShowTitleEnabled(false);
        }
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        initWebView();
        mWebViewPresenter.subscribe();
    }

    public void initWebView() {
        WebSettings settings = mWebView.getSettings();
        settings.setLoadWithOverviewMode(true);
        settings.setJavaScriptEnabled(true);
        settings.setAppCacheEnabled(true);
        settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
        settings.setSupportZoom(true);

        mWebView.setWebChromeClient(new MyWebChrome());
        mWebView.setWebViewClient(new MyWebClient());
        mWebView.setOnScrollChangedCallback(new ObservableWebView.OnScrollChangedCallback() {
            @Override
            public void onScroll(int dx, int dy) {
                if (dy > 0) {
                    mFloatingActionButton.hide();
                } else {
                    mFloatingActionButton.show();
                }
            }
        });
    }

    @Override
    public void setToolbarBackgroundColor(int color) {
        mAppbar.setBackgroundColor(color);
    }

    @Override
    public String getLoadUrl() {
        return getIntent().getStringExtra(WebViewActivity.GANK_URL);
    }

    @Override
    public String getGankTitle() {
        return getIntent().getStringExtra(WebViewActivity.GANK_TITLE);
    }

    @Override
    public Favorite getFavoriteData() {
        return (Favorite) getIntent().getSerializableExtra(WebViewActivity.FAVORITE_DATA);
    }

    @Override
    public void setFavoriteState(boolean isFavorite) {
        if (isFavorite) {
            mFloatingActionButton.setImageResource(R.drawable.ic_favorite);
        } else {
            mFloatingActionButton.setImageResource(R.drawable.ic_unfavorite);
        }
        isForResult = !isFavorite;
    }

    @Override
    public void finish() {
        if (isForResult) {
            Intent intent = new Intent();
            intent.putExtra(FavoriteActivity.FAVORITE_POSITION, getIntent().getIntExtra(WebViewActivity.FAVORITE_POSITION, -1));
            setResult(RESULT_OK, intent);
        }
        super.finish();
    }

    @Override
    public void hideFavoriteFab() {
        mFloatingActionButton.setVisibility(View.GONE);
        mWebView.setOnScrollChangedCallback(null);
    }

    @Override
    public void showTip(String tip) {
        Toasty.error(this, tip).show();
    }

    @Override
    public void setFabButtonColor(int color) {
        MDTintUtil.setTint(mFloatingActionButton, color);
    }

    private class MyWebChrome extends WebChromeClient {
        @Override
        public void onProgressChanged(WebView view, int newProgress) {
            mProgressbar.setVisibility(View.VISIBLE);
            mProgressbar.setProgress(newProgress);
        }
    }

    private class MyWebClient extends WebViewClient {
        @Override
        public void onPageFinished(WebView view, String url) {
            mProgressbar.setVisibility(View.GONE);
        }
    }

    @Override
    public void setGankTitle(String title) {
        mTvTitle.setText(title);
    }

    @Override
    public void loadGankURL(String url) {
        mWebView.loadUrl(url);
    }

    @OnClick(R.id.fab_web_favorite)
    public void favorite() {
        mWebViewPresenter.favoriteGank();
    }

    @Override
    public void onBackPressed() {
        if (mWebView.canGoBack()) {
            mWebView.goBack();
        } else {
            finish();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_webview, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.menu_share:
                AndroidUtil.share(this, mWebViewPresenter.getGankUrl());
                break;
            case R.id.menu_copy_link:
                if (AndroidUtil.copyText(this, mWebViewPresenter.getGankUrl())) {
                    Toasty.success(this, "链接复制成功").show();
                }
                break;
            case R.id.menu_open_with:
                AndroidUtil.openWithBrowser(this, mWebViewPresenter.getGankUrl());
                break;
        }
        return super.onOptionsItemSelected(item);
    }

}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/webview/WebViewContract.java
================================================
package me.bakumon.ugank.module.webview;

import me.bakumon.ugank.base.BasePresenter;
import me.bakumon.ugank.base.BaseView;
import me.bakumon.ugank.entity.Favorite;

/**
 * WebViewContract
 * Created by bakumon on 16-12-10.
 */

public interface WebViewContract {

    interface View extends BaseView {

        void setGankTitle(String title);

        void loadGankURL(String url);

        void setToolbarBackgroundColor(int color);

        String getLoadUrl();

        String getGankTitle();

        void setFabButtonColor(int color);

        Favorite getFavoriteData();

        void setFavoriteState(boolean isFavorite);

        void hideFavoriteFab();

        void showTip(String tip);

    }

    interface Presenter extends BasePresenter {

        String getGankUrl();

        void favoriteGank();
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/module/webview/WebViewPresenter.java
================================================
package me.bakumon.ugank.module.webview;

import org.litepal.crud.DataSupport;

import java.util.List;

import me.bakumon.ugank.ThemeManage;
import me.bakumon.ugank.entity.Favorite;

/**
 * WebViewPresenter
 * Created by bakumon on 16-12-10.
 */

public class WebViewPresenter implements WebViewContract.Presenter {

    private WebViewContract.View mWebViewView;

    private String mGankUrl;
    private boolean mIsFavorite;
    private Favorite mFavoriteData;

    public WebViewPresenter(WebViewContract.View webViewView) {
        mWebViewView = webViewView;
    }

    @Override
    public void subscribe() {
        mWebViewView.setToolbarBackgroundColor(ThemeManage.INSTANCE.getColorPrimary());
        mWebViewView.setGankTitle(mWebViewView.getGankTitle());
        // 设置 FabButton 的背景色
        mWebViewView.setFabButtonColor(ThemeManage.INSTANCE.getColorPrimary());
        mFavoriteData = mWebViewView.getFavoriteData();
        findHasFavoriteGank();
        loadDate();
    }

    private void loadDate() {
        mGankUrl = mWebViewView.getLoadUrl();
        mWebViewView.loadGankURL(mGankUrl);
    }

    @Override
    public void unsubscribe() {
    }

    @Override
    public String getGankUrl() {
        return mGankUrl;
    }

    @Override
    public void favoriteGank() {
        if (mIsFavorite) { // 已经收藏
            unFavorite();
        } else { // 未收藏
            favorite();
        }
    }

    private void unFavorite() {
        int cows = DataSupport.deleteAll(Favorite.class, "gankID = ?", mFavoriteData.getGankID());
        // 不调用这句保存 在保存会失败,并且返回的是true
        // https://github.com/LitePalFramework/LitePal/issues/77
        mFavoriteData.clearSavedState();
        mIsFavorite = cows < 1;
        mWebViewView.setFavoriteState(mIsFavorite);
        if (mIsFavorite) {
            mWebViewView.showTip("取消收藏失败,请重试");
        }
    }

    private void favorite() {
        mFavoriteData.setCreatetime(System.currentTimeMillis());
        mIsFavorite = mFavoriteData.save();
        mWebViewView.setFavoriteState(mIsFavorite);
        if (!mIsFavorite) {
            mWebViewView.showTip("收藏失败,请重试");
        }
    }

    private void findHasFavoriteGank() {
        if (mFavoriteData == null) {
            // 隐藏收藏 fab
            mWebViewView.hideFavoriteFab();
            return;
        }
        List<Favorite> favorites = DataSupport.where("gankID = ?", mFavoriteData.getGankID()).find(Favorite.class);
        mIsFavorite = favorites.size() > 0;
        mWebViewView.setFavoriteState(mIsFavorite);
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/network/NetWork.java
================================================
package me.bakumon.ugank.network;

import me.bakumon.ugank.network.api.GankApi;
import okhttp3.OkHttpClient;
import retrofit2.CallAdapter;
import retrofit2.Converter;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * 网络层
 * Created by bakumon on 16-12-1.
 */

public class NetWork {
    private static GankApi gankApi;
    private static OkHttpClient okHttpClient = new OkHttpClient();
    private static Converter.Factory gsonConverterFactory = GsonConverterFactory.create();
    private static CallAdapter.Factory rxJavaCallAdapterFactory = RxJavaCallAdapterFactory.create();

    public static GankApi getGankApi() {
        if (gankApi == null) {
            Retrofit retrofit = new Retrofit.Builder()
                    .client(okHttpClient)
                    .baseUrl("http://gank.io/api/")
                    .addConverterFactory(gsonConverterFactory)
                    .addCallAdapterFactory(rxJavaCallAdapterFactory)
                    .build();
            gankApi = retrofit.create(GankApi.class);
        }
        return gankApi;
    }

}


================================================
FILE: app/src/main/java/me/bakumon/ugank/network/api/GankApi.java
================================================
package me.bakumon.ugank.network.api;

import me.bakumon.ugank.entity.CategoryResult;
import me.bakumon.ugank.entity.SearchResult;
import retrofit2.http.GET;
import retrofit2.http.Path;
import rx.Observable;

/**
 * gank.io 接口
 * Created by bakumon on 16-12-1.
 */

public interface GankApi {

    @GET("data/{category}/{number}/{page}")
    Observable<CategoryResult> getCategoryDate(@Path("category") String category, @Path("number") int number, @Path("page") int page);

    @GET("random/data/福利/{number}")
    Observable<CategoryResult> getRandomBeauties(@Path("number") int number);

    @GET("search/query/{key}/category/all/count/{count}/page/{page}")
    Observable<SearchResult> getSearchResult(@Path("key") String key, @Path("count") int count, @Path("page") int page);

}


================================================
FILE: app/src/main/java/me/bakumon/ugank/utills/AlipayZeroSdk.java
================================================
package me.bakumon.ugank.utills;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.service.quicksettings.TileService;

import java.net.URISyntaxException;

public class AlipayZeroSdk {

	// 支付宝包名
	private static final String ALIPAY_PACKAGE_NAME = "com.eg.android.AlipayGphone";

	// 旧版支付宝二维码通用 Intent Scheme Url 格式
	private static final String INTENT_URL_FORMAT = "intent://platformapi/startapp?saId=10000007&" +
			"clientVersion=3.7.0.0718&qrcode=https%3A%2F%2Fqr.alipay.com%2F{urlCode}%3F_s" +
			"%3Dweb-other&_t=1472443966571#Intent;" +
			"scheme=alipayqr;package=com.eg.android.AlipayGphone;end";

	/**
	 * 打开转账窗口
	 * 旧版支付宝二维码方法,需要使用 https://fama.alipay.com/qrcode/index.htm 网站生成的二维码
	 * 这个方法最好,但在 2016 年 8 月发现新用户可能无法使用
	 *
	 * @param activity Parent Activity
	 * @param urlCode 手动解析二维码获得地址中的参数,例如 https://qr.alipay.com/aehvyvf4taua18zo6e 最后那段
	 * @return 是否成功调用
	 */
	public static boolean startAlipayClient(Activity activity, String urlCode) {
		return startIntentUrl(activity, INTENT_URL_FORMAT.replace("{urlCode}", urlCode));
	}

	/**
	 * 打开 Intent Scheme Url
	 *
	 * @param activity Parent Activity
	 * @param intentFullUrl Intent 跳转地址
	 * @return 是否成功调用
	 */
	public static boolean startIntentUrl(Activity activity, String intentFullUrl) {
		try {
			Intent intent = Intent.parseUri(
					intentFullUrl,
					Intent.URI_INTENT_SCHEME
			);
			activity.startActivity(intent);
			return true;
		} catch (URISyntaxException e) {
			e.printStackTrace();
			return false;
		} catch (ActivityNotFoundException e) {
			e.printStackTrace();
			return false;
		}
	}

	/**
	 * 判断支付宝客户端是否已安装,建议调用转账前检查
	 * @param context Context
	 * @return 支付宝客户端是否已安装
	 */
	public static boolean hasInstalledAlipayClient(Context context) {
		PackageManager pm = context.getPackageManager();
		try {
			PackageInfo info = pm.getPackageInfo(ALIPAY_PACKAGE_NAME, 0);
			return info != null;
		} catch (PackageManager.NameNotFoundException e) {
			e.printStackTrace();
			return false;
		}
	}

	/**
	 * 获取支付宝客户端版本名称,作用不大
	 * @param context Context
	 * @return 版本名称
	 */
	public static String getAlipayClientVersion(Context context) {
		PackageManager pm = context.getPackageManager();
		try {
			PackageInfo info = pm.getPackageInfo(ALIPAY_PACKAGE_NAME, 0);
			return info.versionName;
		} catch (PackageManager.NameNotFoundException e) {
			e.printStackTrace();
			return null;
		}
	}

	/**
	 * 打开支付宝扫一扫界面
	 * @param context Context
	 * @return 是否成功打开 Activity
	 */
	public static boolean openAlipayScan(Context context) {
		try {
			Uri uri = Uri.parse("alipayqr://platformapi/startapp?saId=10000007");
			Intent intent = new Intent(Intent.ACTION_VIEW, uri);
			if (context instanceof TileService) {
				if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
					((TileService) context).startActivityAndCollapse(intent);
				}
			} else {
				context.startActivity(intent);
			}
			return true;
		} catch (Exception e) {
			return false;
		}
	}

	/**
	 * 打开支付宝付款码
	 * @param context Context
	 * @return 是否成功打开 Activity
	 */
	public static boolean openAlipayBarcode(Context context) {
		try {
			Uri uri = Uri.parse("alipayqr://platformapi/startapp?saId=20000056");
			Intent intent = new Intent(Intent.ACTION_VIEW, uri);
			if (context instanceof TileService) {
				if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
					((TileService) context).startActivityAndCollapse(intent);
				}
			} else {
				context.startActivity(intent);
			}
			return true;
		} catch (Exception e) {
			return false;
		}
	}

}


================================================
FILE: app/src/main/java/me/bakumon/ugank/utills/AndroidUtil.java
================================================
package me.bakumon.ugank.utills;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;

/**
 * AndroidUtil
 * Created by bakumon on 2016/12/12 11:00.
 */
public class AndroidUtil {
    /**
     * 使用系统发送分享数据
     *
     * @param context 上下文
     * @param text    要分享的文本
     */
    public static void share(Context context, String text) {
        Intent sendIntent = new Intent();
        sendIntent.setAction(Intent.ACTION_SEND);
        sendIntent.putExtra(Intent.EXTRA_TEXT, text);
        sendIntent.setType("text/plain");
        context.startActivity(Intent.createChooser(sendIntent, "分享到"));
    }

    /**
     * 使用浏览器打开
     *
     * @param context 上下文
     * @param uriStr  链接地址
     */
    public static void openWithBrowser(Context context, String uriStr) {
        Uri uri = Uri.parse(uriStr);
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        context.startActivity(intent);
    }

    /**
     * 复制文字到剪切板
     * @param context 上下文
     * @param copyText 要复制的文本
     */
    public static boolean copyText(Context context, String copyText) {
        ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
        ClipData data = ClipData.newRawUri("gankUrl", Uri.parse(copyText));
        cmb.setPrimaryClip(data);
        return true;
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/utills/DataCleanManager.java
================================================
package me.bakumon.ugank.utills;

import android.os.Environment;

import java.io.File;
import java.math.BigDecimal;

import me.bakumon.ugank.App;

/**
 * 清理缓存
 * Created by bakumon on 17-3-6.
 */

public class DataCleanManager {
    public static String getTotalCacheSize() {
        long cacheSize;
        try {
            cacheSize = getFolderSize(App.getInstance().getCacheDir());
            if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
                cacheSize += getFolderSize(App.getInstance().getExternalCacheDir());
            }
        } catch (Exception e) {
            cacheSize = 0;
        }
        return getFormatSize(cacheSize);
    }

    // 获取文件
    //Context.getExternalFilesDir() --> SDCard/Android/data/你的应用的包名/files/ 目录,一般放一些长时间保存的数据
    //Context.getExternalCacheDir() --> SDCard/Android/data/你的应用包名/cache/目录,一般存放临时缓存数据
    public static long getFolderSize(File file) throws Exception {
        long size = 0;
        try {
            File[] fileList = file.listFiles();
            for (int i = 0; i < fileList.length; i++) {
                // 如果下面还有文件
                if (fileList[i].isDirectory()) {
                    size = size + getFolderSize(fileList[i]);
                } else {
                    size = size + fileList[i].length();
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return size;
    }

    public static boolean clearAllCache() {
        if (!deleteDir(App.getInstance().getCacheDir())) {
            return false;
        }

        if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
            if (!deleteDir(App.getInstance().getExternalCacheDir())) {
                return false;
            }
        }

        return true;
    }

    private static boolean deleteDir(File dir) {
        if (dir == null) {
            return false;
        }
        if (dir != null && dir.isDirectory()) {
            String[] children = dir.list();
            for (int i = 0; i < children.length; i++) {
                boolean success = deleteDir(new File(dir, children[i]));
                if (!success) {
                    return false;
                }
            }
        }
        return dir.delete();
    }

    /**
     * 格式化单位
     *
     * @param size
     * @return
     */
    public static String getFormatSize(double size) {
        double kiloByte = size / 1024;
        if (kiloByte < 1) {
//            return size + "Byte";
            return "0K";
        }

        double megaByte = kiloByte / 1024;
        if (megaByte < 1) {
            BigDecimal result1 = new BigDecimal(Double.toString(kiloByte));
            return result1.setScale(2, BigDecimal.ROUND_HALF_UP)
                    .toPlainString() + "KB";
        }

        double gigaByte = megaByte / 1024;
        if (gigaByte < 1) {
            BigDecimal result2 = new BigDecimal(Double.toString(megaByte));
            return result2.setScale(2, BigDecimal.ROUND_HALF_UP)
                    .toPlainString() + "MB";
        }

        double teraBytes = gigaByte / 1024;
        if (teraBytes < 1) {
            BigDecimal result3 = new BigDecimal(Double.toString(gigaByte));
            return result3.setScale(2, BigDecimal.ROUND_HALF_UP)
                    .toPlainString() + "GB";
        }
        BigDecimal result4 = new BigDecimal(teraBytes);
        return result4.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString()
                + "TB";
    }

    /**
     * 清除本应用内部缓存(/data/data/com.xxx.xxx/cache) * * @param context
     */
    public static void cleanInternalCache() {
        deleteFilesByDirectory(App.getInstance().getCacheDir());
    }

    /**
     * 清除本应用所有数据库(/data/data/com.xxx.xxx/databases) * * @param context
     */
    public static void cleanDatabases() {
        deleteFilesByDirectory(new File("/data/data/"
                + App.getInstance().getPackageName() + "/databases"));
    }

    /**
     * * 清除本应用SharedPreference(/data/data/com.xxx.xxx/shared_prefs) * * @param
     * context
     */
    public static void cleanSharedPreference() {
        deleteFilesByDirectory(new File("/data/data/"
                + App.getInstance().getPackageName() + "/shared_prefs"));
    }

    /**
     * 按名字清除本应用数据库 * * @param context * @param dbName
     */
    public static void cleanDatabaseByName(String dbName) {
        App.getInstance().deleteDatabase(dbName);
    }

    /**
     * 清除/data/data/com.xxx.xxx/files下的内容 * * @param context
     */
    public static void cleanFiles() {
        deleteFilesByDirectory(App.getInstance().getFilesDir());
    }

    /**
     * * 清除外部cache下的内容(/mnt/sdcard/android/data/com.xxx.xxx/cache) * * @param
     * context
     */
    public static void cleanExternalCache() {
        if (Environment.getExternalStorageState().equals(
                Environment.MEDIA_MOUNTED)) {
            deleteFilesByDirectory(App.getInstance().getExternalCacheDir());
        }
    }

    /**
     * 清除自定义路径下的文件,使用需小心,请不要误删。而且只支持目录下的文件删除 * * @param filePath
     */
    public static void cleanCustomCache(String filePath) {
        deleteFilesByDirectory(new File(filePath));
    }

    /**
     * 清除本应用所有的数据 * * @param context * @param filepath
     */
    public static void cleanApplicationData(String... filepath) {
        cleanInternalCache();
        cleanExternalCache();
        cleanDatabases();
        cleanSharedPreference();
        cleanFiles();
        for (String filePath : filepath) {
            cleanCustomCache(filePath);
        }
    }

    /**
     * 删除方法 这里只会删除某个文件夹下的文件,如果传入的directory是个文件,将不做处理 * * @param directory
     */
    private static void deleteFilesByDirectory(File directory) {
        if (directory != null && directory.exists() && directory.isDirectory()) {
            for (File item : directory.listFiles()) {
                item.delete();
            }
        }
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/utills/DateUtil.java
================================================
package me.bakumon.ugank.utills;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 日期工具类
 * Created by bakumon on 2016/12/8 17:18.
 */
public class DateUtil {
    public static String dateFormat(String timestamp) {
        if (timestamp == null) {
            return "unknown";
        }
        SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS");
        SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd");

        try {
            Date date = inputFormat.parse(timestamp);
            return outputFormat.format(date);
        } catch (ParseException e) {
            return "unknown";
        }
    }
}



================================================
FILE: app/src/main/java/me/bakumon/ugank/utills/DisplayUtils.java
================================================
package me.bakumon.ugank.utills;

import android.content.Context;
import android.util.DisplayMetrics;
import android.view.WindowManager;

/**
 * DisplayUtils
 * Created by bakumon on 2016/12/14.
 */
public class DisplayUtils {
    private static DisplayMetrics getMetrics(Context context) {
        DisplayMetrics metrics = new DisplayMetrics();

        WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        wm.getDefaultDisplay().getMetrics(metrics);
        return metrics;
    }

    /**
     * dp 转 px
     */
    public static int dp2px(float dp, Context context) {
        DisplayMetrics metrics = getMetrics(context);
        return (int) (dp * (metrics.densityDpi / 160f));
    }

    /**
     * pxe 转 dp
     */
    public static float px2dp(float px, Context context) {
        DisplayMetrics metrics = getMetrics(context);
        return px / (metrics.densityDpi / 160f);
    }

    /**
     * 获取屏幕宽度 px
     */
    public static int getScreenWidth(Context context) {
        DisplayMetrics dm = getMetrics(context);
        return dm.widthPixels;
    }

    /**
     * 获取屏幕高度 px
     */
    public static int getScreenHeight(Context context) {
        DisplayMetrics dm = getMetrics(context);
        return dm.heightPixels;
    }

    /**
     * 获取状态栏高度
     */
    public static int getStatusBarHeight(Context context) {
        int result = 38;
        int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
        if (resourceId > 0) {
            result = context.getResources().getDimensionPixelSize(resourceId);
        }
        return result;
    }
}


================================================
FILE: app/src/main/java/me/bakumon/ugank/utills/EmojiFilter.java
================================================
package me.bakumon.ugank.utills;

/**
 * Created by mafei on 2017/3/24 12:27.
 *
 * @author mafei
 * @version 1.0.0
 * @class EmojiFilter
 * @describe
 */
public class EmojiFilter {
    /**
     * 是否包含表情
     *
     * @param codePoint
     * @return 如果不包含 返回false,包含 则返回true
     * @author 杨振威 2015-3-26 下午2:41:08
     */

    private static boolean isEmojiCharacter(char codePoint) {
        return !((codePoint == 0x0) || (codePoint == 0x9) || (codePoint == 0xA)
                || (codePoint == 0xD)
                || ((codePoint >= 0x20) && (codePoint <= 0xD7FF))
                || ((codePoint >= 0xE000) && (codePoint <= 0xFFFD)) || ((codePoint >= 0x10000) && (codePoint <= 0x10FFFF)));
    }

    /**
     * 过滤emoji 或者 其他非文字类型的字符
     *
     * @param source
     * @return
     * @author 杨振威 2015-3-26 下午2:42:11
     */
    public static String filterEmoji(String source) {

        StringBuilder buf = null;

        int len = source.length();

        for (int i = 0; i < len; i++) {
            char codePoint = source.charAt(i);

            if (!isEmojiCharacter(codePoint)) {// 如果不包含 则将字符append
                if (buf == null) {
                    buf = new StringBuilder(source.length());
                }

                buf.append(codePoint);
            } else {
            }
        }

        if (buf == null) {
            return "";// 如果没有找到 emoji表情,则返回源字符串
        } else {
            if (buf.length() == len) {// 这里的意义在于尽可能少的toString,因为会重新生成字符串
                buf = null;
                return source;
            } else {
                return buf.toString();
            }
        }

    }
}

================================================
FILE: app/src/main/java/me/bakumon/ugank/utills/ImageUtil.java
================================================
package me.bakumon.ugank.utills;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Environment;
import android.provider.MediaStore;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * ImageUtil
 * Created by bakumon on 2016/12/26 15:59.
 */
public class ImageUtil {
    public static boolean saveImageToGallery(Context context, Bitmap bmp) {
        // 首先保存图片
        File appDir = Environment.getExternalStorageDirectory();
        if (!appDir.exists()) {
            if (!appDir.mkdir()) {
                return false;
            }
        }
        String fileName = System.cur
Download .txt
gitextract_vqa0jwoy/

├── .gitignore
├── LICENSE
├── README.md
├── _config.yml
├── app/
│   ├── .gitignore
│   ├── build.gradle
│   ├── proguard-rules.pro
│   ├── src/
│   │   ├── androidTest/
│   │   │   └── java/
│   │   │       └── me/
│   │   │           └── bakumon/
│   │   │               └── ugank/
│   │   │                   └── ExampleInstrumentedTest.java
│   │   ├── main/
│   │   │   ├── AndroidManifest.xml
│   │   │   ├── assets/
│   │   │   │   └── litepal.xml
│   │   │   ├── java/
│   │   │   │   └── me/
│   │   │   │       └── bakumon/
│   │   │   │           └── ugank/
│   │   │   │               ├── App.java
│   │   │   │               ├── ConfigManage.java
│   │   │   │               ├── GlobalConfig.java
│   │   │   │               ├── ThemeManage.java
│   │   │   │               ├── base/
│   │   │   │               │   ├── BaseDialog.java
│   │   │   │               │   ├── BasePresenter.java
│   │   │   │               │   ├── BaseView.java
│   │   │   │               │   ├── SwipeBackBaseActivity.java
│   │   │   │               │   └── adapter/
│   │   │   │               │       ├── CommonAdapter4RecyclerView.java
│   │   │   │               │       ├── CommonHolder4RecyclerView.java
│   │   │   │               │       ├── CommonViewPagerAdapter.java
│   │   │   │               │       └── ListenerWithPosition.java
│   │   │   │               ├── entity/
│   │   │   │               │   ├── CategoryResult.java
│   │   │   │               │   ├── Favorite.java
│   │   │   │               │   ├── History.java
│   │   │   │               │   └── SearchResult.java
│   │   │   │               ├── module/
│   │   │   │               │   ├── bigimg/
│   │   │   │               │   │   ├── BigimgActivity.java
│   │   │   │               │   │   ├── BigimgContract.java
│   │   │   │               │   │   └── BigimgPresenter.java
│   │   │   │               │   ├── category/
│   │   │   │               │   │   ├── CategoryContract.java
│   │   │   │               │   │   ├── CategoryFragment.java
│   │   │   │               │   │   ├── CategoryListAdapter.java
│   │   │   │               │   │   └── CategoryPresenter.java
│   │   │   │               │   ├── favorite/
│   │   │   │               │   │   ├── FavoriteActivity.java
│   │   │   │               │   │   ├── FavoriteContract.java
│   │   │   │               │   │   ├── FavoriteListAdapter.java
│   │   │   │               │   │   └── FavoritePresenter.java
│   │   │   │               │   ├── home/
│   │   │   │               │   │   ├── HomeActivity.java
│   │   │   │               │   │   ├── HomeContract.java
│   │   │   │               │   │   └── HomePresenter.java
│   │   │   │               │   ├── launcher/
│   │   │   │               │   │   ├── LauncherActivity.java
│   │   │   │               │   │   ├── LauncherContract.java
│   │   │   │               │   │   └── LauncherPresenter.java
│   │   │   │               │   ├── search/
│   │   │   │               │   │   ├── HistoryListAdapter.java
│   │   │   │               │   │   ├── SearchActivity.java
│   │   │   │               │   │   ├── SearchContract.java
│   │   │   │               │   │   ├── SearchListAdapter.java
│   │   │   │               │   │   └── SearchPresenter.java
│   │   │   │               │   ├── setting/
│   │   │   │               │   │   ├── SettingActivity.java
│   │   │   │               │   │   ├── SettingContract.java
│   │   │   │               │   │   └── SettingPresenter.java
│   │   │   │               │   └── webview/
│   │   │   │               │       ├── WebViewActivity.java
│   │   │   │               │       ├── WebViewContract.java
│   │   │   │               │       └── WebViewPresenter.java
│   │   │   │               ├── network/
│   │   │   │               │   ├── NetWork.java
│   │   │   │               │   └── api/
│   │   │   │               │       └── GankApi.java
│   │   │   │               ├── utills/
│   │   │   │               │   ├── AlipayZeroSdk.java
│   │   │   │               │   ├── AndroidUtil.java
│   │   │   │               │   ├── DataCleanManager.java
│   │   │   │               │   ├── DateUtil.java
│   │   │   │               │   ├── DisplayUtils.java
│   │   │   │               │   ├── EmojiFilter.java
│   │   │   │               │   ├── ImageUtil.java
│   │   │   │               │   ├── KeyboardUtils.java
│   │   │   │               │   ├── MDTintUtil.java
│   │   │   │               │   ├── PackageUtil.java
│   │   │   │               │   └── StatusBarUtil.java
│   │   │   │               └── widget/
│   │   │   │                   ├── AboutDialog.java
│   │   │   │                   ├── ObservableWebView.java
│   │   │   │                   ├── PinchImageView.java
│   │   │   │                   ├── RecycleViewDivider.java
│   │   │   │                   ├── SquareLoading.java
│   │   │   │                   └── recyclerviewwithfooter/
│   │   │   │                       ├── DefaultEmptyItem.java
│   │   │   │                       ├── DefaultFootItem.java
│   │   │   │                       ├── EmptyItem.java
│   │   │   │                       ├── FootItem.java
│   │   │   │                       ├── OnLoadMoreListener.java
│   │   │   │                       ├── RecyclerViewUtils.java
│   │   │   │                       └── RecyclerViewWithFooter.java
│   │   │   └── res/
│   │   │       ├── color/
│   │   │       │   ├── select_press_color_gray.xml
│   │   │       │   └── select_press_color_white.xml
│   │   │       ├── drawable/
│   │   │       │   ├── ic_beauty.xml
│   │   │       │   ├── ic_collection.xml
│   │   │       │   ├── ic_collection_shortcut.xml
│   │   │       │   ├── ic_edit_clear.xml
│   │   │       │   ├── ic_favorite.xml
│   │   │       │   ├── ic_item_author.xml
│   │   │       │   ├── ic_item_label.xml
│   │   │       │   ├── ic_item_time.xml
│   │   │       │   ├── ic_loading.xml
│   │   │       │   ├── ic_right.xml
│   │   │       │   ├── ic_search_gank.xml
│   │   │       │   ├── ic_search_shortcut.xml
│   │   │       │   ├── ic_setting.xml
│   │   │       │   ├── ic_unfavorite.xml
│   │   │       │   ├── ic_webview_finish.xml
│   │   │       │   ├── progressbar.xml
│   │   │       │   ├── selector_history_item.xml
│   │   │       │   ├── shape_corners_gray.xml
│   │   │       │   ├── shape_corners_stroke_gray.xml
│   │   │       │   └── shape_corners_white.xml
│   │   │       ├── layout/
│   │   │       │   ├── activity_bigimg.xml
│   │   │       │   ├── activity_favorite.xml
│   │   │       │   ├── activity_home.xml
│   │   │       │   ├── activity_launcher.xml
│   │   │       │   ├── activity_search.xml
│   │   │       │   ├── activity_setting.xml
│   │   │       │   ├── activity_web_view.xml
│   │   │       │   ├── dialog_about.xml
│   │   │       │   ├── fragment.xml
│   │   │       │   ├── item.xml
│   │   │       │   ├── item_favorite.xml
│   │   │       │   ├── item_history.xml
│   │   │       │   ├── item_search.xml
│   │   │       │   ├── rv_with_footer_empty_layout.xml
│   │   │       │   └── rv_with_footer_loading.xml
│   │   │       ├── menu/
│   │   │       │   └── menu_webview.xml
│   │   │       ├── values/
│   │   │       │   ├── attrs_square_loading.xml
│   │   │       │   ├── colors.xml
│   │   │       │   ├── dimens.xml
│   │   │       │   ├── strings.xml
│   │   │       │   └── styles.xml
│   │   │       ├── values-v19/
│   │   │       │   └── styles.xml
│   │   │       └── xml/
│   │   │           └── shortcuts.xml
│   │   └── test/
│   │       └── java/
│   │           └── me/
│   │               └── bakumon/
│   │                   └── ugank/
│   │                       └── ExampleUnitTest.java
│   └── ugank.jks
├── build.gradle
├── gradle/
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
Download .txt
SYMBOL INDEX (708 symbols across 71 files)

FILE: app/src/androidTest/java/me/bakumon/ugank/ExampleInstrumentedTest.java
  class ExampleInstrumentedTest (line 17) | @RunWith(AndroidJUnit4.class)
    method useAppContext (line 19) | @Test

FILE: app/src/main/java/me/bakumon/ugank/App.java
  class App (line 17) | public class App extends Application {
    method getInstance (line 20) | public static App getInstance() {
    method onCreate (line 24) | @Override

FILE: app/src/main/java/me/bakumon/ugank/ConfigManage.java
  type ConfigManage (line 10) | public enum ConfigManage {
    method initConfig (line 26) | public void initConfig(Context context) {
    method isListShowImg (line 40) | public boolean isListShowImg() {
    method setListShowImg (line 44) | public void setListShowImg(boolean listShowImg) {
    method getThumbnailQuality (line 53) | public int getThumbnailQuality() {
    method setThumbnailQuality (line 57) | public void setThumbnailQuality(int thumbnailQuality) {
    method getBannerURL (line 66) | public String getBannerURL() {
    method setBannerURL (line 70) | public void setBannerURL(String bannerURL) {
    method isShowLauncherImg (line 79) | public boolean isShowLauncherImg() {
    method setShowLauncherImg (line 83) | public void setShowLauncherImg(boolean showLauncherImg) {
    method isProbabilityShowLauncherImg (line 92) | public boolean isProbabilityShowLauncherImg() {
    method setProbabilityShowLauncherImg (line 96) | public void setProbabilityShowLauncherImg(boolean probabilityShowLaunc...

FILE: app/src/main/java/me/bakumon/ugank/GlobalConfig.java
  class GlobalConfig (line 7) | public class GlobalConfig {

FILE: app/src/main/java/me/bakumon/ugank/ThemeManage.java
  type ThemeManage (line 8) | public enum ThemeManage {
    method initColorPrimary (line 13) | public void initColorPrimary(int colorPrimary) {
    method getColorPrimary (line 17) | public int getColorPrimary() {
    method setColorPrimary (line 21) | public void setColorPrimary(int colorPrimary) {

FILE: app/src/main/java/me/bakumon/ugank/base/BaseDialog.java
  class BaseDialog (line 15) | public abstract class BaseDialog extends Dialog {
    method BaseDialog (line 18) | public BaseDialog(Context context, int layoutId) {
    method BaseDialog (line 22) | public BaseDialog(Context context, int layoutId, int styleId) {

FILE: app/src/main/java/me/bakumon/ugank/base/BasePresenter.java
  type BasePresenter (line 7) | public interface BasePresenter {
    method subscribe (line 9) | void subscribe();
    method unsubscribe (line 11) | void unsubscribe();

FILE: app/src/main/java/me/bakumon/ugank/base/BaseView.java
  type BaseView (line 7) | public interface BaseView {

FILE: app/src/main/java/me/bakumon/ugank/base/SwipeBackBaseActivity.java
  class SwipeBackBaseActivity (line 16) | public abstract class SwipeBackBaseActivity extends AppCompatActivity im...
    method onCreate (line 19) | @Override
    method initSwipeBackFinish (line 30) | private void initSwipeBackFinish() {
    method isSupportSwipeBack (line 58) | @Override
    method onSwipeBackLayoutSlide (line 68) | @Override
    method onSwipeBackLayoutCancel (line 75) | @Override
    method onSwipeBackLayoutExecuted (line 82) | @Override

FILE: app/src/main/java/me/bakumon/ugank/base/adapter/CommonAdapter4RecyclerView.java
  class CommonAdapter4RecyclerView (line 16) | public abstract class CommonAdapter4RecyclerView<T> extends RecyclerView...
    method CommonAdapter4RecyclerView (line 22) | public CommonAdapter4RecyclerView(Context context, List<T> data, int l...
    method onCreateViewHolder (line 28) | @Override
    method onBindViewHolder (line 36) | @Override
    method getItemCount (line 43) | @Override
    method convert (line 48) | public abstract void convert(CommonHolder4RecyclerView holder, T t);

FILE: app/src/main/java/me/bakumon/ugank/base/adapter/CommonHolder4RecyclerView.java
  class CommonHolder4RecyclerView (line 14) | public class CommonHolder4RecyclerView extends RecyclerView.ViewHolder {
    method CommonHolder4RecyclerView (line 20) | public CommonHolder4RecyclerView(View itemView) {
    method getView (line 33) | public <T extends View> T getView(@IdRes int viewId) {
    method setTextViewText (line 44) | public CommonHolder4RecyclerView setTextViewText(@IdRes int textViewId...
    method setOnClickListener (line 54) | public CommonHolder4RecyclerView setOnClickListener(ListenerWithPositi...

FILE: app/src/main/java/me/bakumon/ugank/base/adapter/CommonViewPagerAdapter.java
  class CommonViewPagerAdapter (line 14) | public class CommonViewPagerAdapter extends FragmentPagerAdapter {
    method CommonViewPagerAdapter (line 18) | public CommonViewPagerAdapter(FragmentManager fm, String[] titles) {
    method addFragment (line 23) | public void addFragment(Fragment fragment) {
    method getItem (line 27) | @Override
    method getCount (line 32) | @Override
    method getPageTitle (line 37) | @Override

FILE: app/src/main/java/me/bakumon/ugank/base/adapter/ListenerWithPosition.java
  class ListenerWithPosition (line 9) | public class ListenerWithPosition implements View.OnClickListener {
    method ListenerWithPosition (line 15) | public ListenerWithPosition(int position, Object holder) {
    method onClick (line 20) | @Override
    type OnClickWithPositionListener (line 26) | public interface OnClickWithPositionListener<T> {
      method onClick (line 27) | void onClick(View v, int position, T holder);
    method setOnClickListener (line 30) | public void setOnClickListener(OnClickWithPositionListener mOnClickLis...

FILE: app/src/main/java/me/bakumon/ugank/entity/CategoryResult.java
  class CategoryResult (line 9) | public class CategoryResult {
    class ResultsBean (line 14) | public static class ResultsBean {

FILE: app/src/main/java/me/bakumon/ugank/entity/Favorite.java
  class Favorite (line 12) | public class Favorite extends DataSupport implements Serializable{
    method getTitle (line 21) | public String getTitle() {
    method setTitle (line 25) | public void setTitle(String title) {
    method getType (line 29) | public String getType() {
    method setType (line 33) | public void setType(String type) {
    method getAuthor (line 37) | public String getAuthor() {
    method setAuthor (line 41) | public void setAuthor(String author) {
    method getData (line 45) | public String getData() {
    method setData (line 49) | public void setData(String data) {
    method getUrl (line 53) | public String getUrl() {
    method setUrl (line 57) | public void setUrl(String url) {
    method getGankID (line 61) | public String getGankID() {
    method setGankID (line 65) | public void setGankID(String gankID) {
    method getCreatetime (line 69) | public long getCreatetime() {
    method setCreatetime (line 73) | public void setCreatetime(long createtime) {

FILE: app/src/main/java/me/bakumon/ugank/entity/History.java
  class History (line 9) | public class History extends DataSupport {
    method getCreateTimeMill (line 13) | public long getCreateTimeMill() {
    method setCreateTimeMill (line 17) | public void setCreateTimeMill(long createTimeMill) {
    method getContent (line 21) | public String getContent() {
    method setContent (line 25) | public void setContent(String content) {

FILE: app/src/main/java/me/bakumon/ugank/entity/SearchResult.java
  class SearchResult (line 9) | public class SearchResult {
    class ResultsBean (line 15) | public static class ResultsBean {

FILE: app/src/main/java/me/bakumon/ugank/module/bigimg/BigimgActivity.java
  class BigimgActivity (line 23) | public class BigimgActivity extends SwipeBackBaseActivity implements Big...
    method onCreate (line 41) | @Override
    method onDestroy (line 63) | @Override
    method setMeiziTitle (line 69) | @Override
    method loadMeizuImg (line 74) | @Override
    method setToolbarBackgroundColor (line 92) | @Override
    method setLoadingColor (line 97) | @Override
    method showLoading (line 102) | @Override
    method getMeiziImg (line 107) | @Override
    method getMeiziTitle (line 113) | @Override
    method hideLoading (line 119) | public void hideLoading() {

FILE: app/src/main/java/me/bakumon/ugank/module/bigimg/BigimgContract.java
  type BigimgContract (line 11) | public interface BigimgContract {
    type View (line 13) | interface View extends BaseView {
      method setMeiziTitle (line 15) | void setMeiziTitle(String title);
      method loadMeizuImg (line 17) | void loadMeizuImg(String url);
      method setToolbarBackgroundColor (line 19) | void setToolbarBackgroundColor(int color);
      method setLoadingColor (line 21) | void setLoadingColor(int color);
      method showLoading (line 23) | void showLoading();
      method getMeiziImg (line 25) | String getMeiziImg();
      method getMeiziTitle (line 27) | String getMeiziTitle();
    type Presenter (line 31) | interface Presenter extends BasePresenter {

FILE: app/src/main/java/me/bakumon/ugank/module/bigimg/BigimgPresenter.java
  class BigimgPresenter (line 12) | public class BigimgPresenter implements BigimgContract.Presenter {
    method BigimgPresenter (line 16) | public BigimgPresenter(@NonNull BigimgContract.View bigimgView) {
    method subscribe (line 21) | @Override
    method unsubscribe (line 29) | @Override
    method loadMeiziImg (line 33) | private void loadMeiziImg(String url) {
    method setMeiziTitle (line 41) | private void setMeiziTitle(String title) {

FILE: app/src/main/java/me/bakumon/ugank/module/category/CategoryContract.java
  type CategoryContract (line 11) | public interface CategoryContract {
    type View (line 13) | interface View extends BaseView {
      method setCategoryItems (line 15) | void setCategoryItems(CategoryResult categoryResult);
      method addCategoryItems (line 17) | void addCategoryItems(CategoryResult categoryResult);
      method getCategoryItemsFail (line 19) | void getCategoryItemsFail(String failMessage);
      method getCategoryName (line 21) | String getCategoryName();
      method showSwipeLoading (line 23) | void showSwipeLoading();
      method hideSwipeLoading (line 25) | void hideSwipeLoading();
      method setLoading (line 27) | void setLoading();
    type Presenter (line 30) | interface Presenter extends BasePresenter {
      method getCategoryItems (line 32) | void getCategoryItems(boolean isRefresh);

FILE: app/src/main/java/me/bakumon/ugank/module/category/CategoryFragment.java
  class CategoryFragment (line 34) | public class CategoryFragment extends Fragment implements CategoryContra...
    method onCreate (line 48) | @Override
    method onActivityResult (line 55) | @Override
    method onCreateView (line 62) | @Nullable
    method onViewCreated (line 100) | @Override
    method onDestroy (line 106) | @Override
    method newInstance (line 113) | public static CategoryFragment newInstance(String mCategoryName) {
    method getCategoryName (line 123) | @Override
    method showSwipeLoading (line 128) | @Override
    method hideSwipeLoading (line 133) | @Override
    method onRefresh (line 138) | @Override
    method onLoadMore (line 143) | @Override
    method setLoading (line 148) | @Override
    method getCategoryItemsFail (line 153) | @Override
    method setCategoryItems (line 160) | @Override
    method addCategoryItems (line 166) | @Override

FILE: app/src/main/java/me/bakumon/ugank/module/category/CategoryListAdapter.java
  class CategoryListAdapter (line 28) | public class CategoryListAdapter extends CommonAdapter4RecyclerView<Cate...
    method CategoryListAdapter (line 30) | public CategoryListAdapter(Context context) {
    method convert (line 34) | @Override
    method onClick (line 76) | @Override

FILE: app/src/main/java/me/bakumon/ugank/module/category/CategoryPresenter.java
  class CategoryPresenter (line 18) | public class CategoryPresenter implements CategoryContract.Presenter {
    method CategoryPresenter (line 27) | public CategoryPresenter(CategoryContract.View androidView) {
    method subscribe (line 32) | @Override
    method unsubscribe (line 37) | @Override
    method getCategoryItems (line 42) | @Override

FILE: app/src/main/java/me/bakumon/ugank/module/favorite/FavoriteActivity.java
  class FavoriteActivity (line 27) | public class FavoriteActivity extends SwipeBackBaseActivity implements F...
    method onCreate (line 42) | @Override
    method onActivityResult (line 58) | @Override
    method onDestroy (line 70) | @Override
    method initView (line 76) | private void initView() {
    method setToolbarBackgroundColor (line 93) | @Override
    method addFavoriteItems (line 98) | @Override
    method setFavoriteItems (line 105) | @Override
    method setLoading (line 111) | @Override
    method setEmpty (line 116) | @Override
    method setLoadMoreIsLastPage (line 122) | @Override
    method onLoadMore (line 127) | @Override

FILE: app/src/main/java/me/bakumon/ugank/module/favorite/FavoriteContract.java
  class FavoriteContract (line 14) | public class FavoriteContract {
    type View (line 15) | interface View extends BaseView {
      method setToolbarBackgroundColor (line 17) | void setToolbarBackgroundColor(int color);
      method addFavoriteItems (line 19) | void addFavoriteItems(List<Favorite> favorites);
      method setFavoriteItems (line 21) | void setFavoriteItems(List<Favorite> favorites);
      method setLoading (line 23) | void setLoading();
      method setEmpty (line 25) | void setEmpty();
      method setLoadMoreIsLastPage (line 27) | void setLoadMoreIsLastPage();
    type Presenter (line 30) | interface Presenter extends BasePresenter {
      method getFavoriteItems (line 32) | void getFavoriteItems(boolean isRefresh);

FILE: app/src/main/java/me/bakumon/ugank/module/favorite/FavoriteListAdapter.java
  class FavoriteListAdapter (line 22) | public class FavoriteListAdapter extends CommonAdapter4RecyclerView<Favo...
    method FavoriteListAdapter (line 24) | public FavoriteListAdapter(Context context) {
    method convert (line 28) | @Override
    method onClick (line 39) | @Override

FILE: app/src/main/java/me/bakumon/ugank/module/favorite/FavoritePresenter.java
  class FavoritePresenter (line 16) | public class FavoritePresenter implements FavoriteContract.Presenter {
    method FavoritePresenter (line 22) | public FavoritePresenter(FavoriteContract.View view) {
    method subscribe (line 26) | @Override
    method unsubscribe (line 32) | @Override
    method getFavoriteItems (line 37) | @Override

FILE: app/src/main/java/me/bakumon/ugank/module/home/HomeActivity.java
  class HomeActivity (line 47) | public class HomeActivity extends AppCompatActivity implements HomeContr...
    method onCreate (line 78) | @Override
    method onDestroy (line 88) | @Override
    method initView (line 94) | private void initView() {
    type CollapsingToolbarLayoutState (line 140) | private enum CollapsingToolbarLayoutState {
    method setFabDynamicState (line 158) | private void setFabDynamicState() {
    method search (line 190) | @OnClick(R.id.ll_home_search)
    method showBannerFail (line 195) | @Override
    method setBanner (line 200) | @Override
    method cacheImg (line 214) | @Override
    method setAppBarLayoutColor (line 230) | @Override
    method setFabButtonColor (line 236) | @Override
    method startBannerLoadingAnim (line 243) | @Override
    method stopBannerLoadingAnim (line 253) | @Override
    method enableFabButton (line 260) | @Override
    method disEnableFabButton (line 265) | @Override
    method random (line 270) | @OnClick(R.id.fab_home_random)
    method collection (line 275) | @OnClick(R.id.iv_home_collection)
    method goSetting (line 280) | @OnClick(R.id.iv_home_setting)
    method goBigImg (line 285) | @OnClick(R.id.iv_home_banner)
    method onActivityResult (line 297) | @Override

FILE: app/src/main/java/me/bakumon/ugank/module/home/HomeContract.java
  type HomeContract (line 13) | public interface HomeContract {
    type View (line 14) | interface View extends BaseView {
      method showBannerFail (line 16) | void showBannerFail(String failMessage);
      method setBanner (line 18) | void setBanner(String imgUrl);
      method cacheImg (line 20) | void cacheImg(String imgUrl);
      method startBannerLoadingAnim (line 22) | void startBannerLoadingAnim();
      method stopBannerLoadingAnim (line 24) | void stopBannerLoadingAnim();
      method enableFabButton (line 26) | void enableFabButton();
      method disEnableFabButton (line 28) | void disEnableFabButton();
      method setAppBarLayoutColor (line 30) | void setAppBarLayoutColor(int appBarLayoutColor);
      method setFabButtonColor (line 32) | void setFabButtonColor(int color);
    type Presenter (line 36) | interface Presenter extends BasePresenter {
      method getRandomBanner (line 38) | void getRandomBanner();
      method setThemeColor (line 40) | void setThemeColor(@Nullable Palette palette);
      method getBanner (line 42) | void getBanner(final boolean isRandom);
      method saveCacheImgUrl (line 44) | void saveCacheImgUrl(String url);

FILE: app/src/main/java/me/bakumon/ugank/module/home/HomePresenter.java
  class HomePresenter (line 24) | public class HomePresenter implements HomeContract.Presenter {
    method HomePresenter (line 31) | public HomePresenter(HomeContract.View homeView) {
    method subscribe (line 36) | @Override
    method unsubscribe (line 42) | @Override
    method getRandomBanner (line 48) | @Override
    method setThemeColor (line 53) | @Override
    method cacheRandomImg (line 69) | private void cacheRandomImg() {
    method saveCacheImgUrl (line 103) | @Override
    method getBanner (line 113) | @Override

FILE: app/src/main/java/me/bakumon/ugank/module/launcher/LauncherActivity.java
  class LauncherActivity (line 25) | public class LauncherActivity extends AppCompatActivity implements Launc...
    method onCreate (line 36) | @Override
    method loadImg (line 45) | @Override
    method onResume (line 77) | @Override
    method onPause (line 83) | @Override
    method goHomeActivity (line 89) | @Override
    method goBigImg (line 98) | @OnClick(R.id.img_launcher_welcome)
    method onBackPressed (line 111) | @Override
    method onDestroy (line 116) | @Override

FILE: app/src/main/java/me/bakumon/ugank/module/launcher/LauncherContract.java
  class LauncherContract (line 11) | public class LauncherContract {
    type View (line 13) | interface View extends BaseView {
      method goHomeActivity (line 15) | void goHomeActivity();
      method loadImg (line 17) | void loadImg(String url);
    type Presenter (line 20) | interface Presenter extends BasePresenter {

FILE: app/src/main/java/me/bakumon/ugank/module/launcher/LauncherPresenter.java
  class LauncherPresenter (line 12) | public class LauncherPresenter implements LauncherContract.Presenter {
    method LauncherPresenter (line 16) | public LauncherPresenter(LauncherContract.View view) {
    method subscribe (line 20) | @Override
    method unsubscribe (line 34) | @Override

FILE: app/src/main/java/me/bakumon/ugank/module/search/HistoryListAdapter.java
  class HistoryListAdapter (line 17) | public class HistoryListAdapter extends CommonAdapter4RecyclerView<Histo...
    method HistoryListAdapter (line 19) | public HistoryListAdapter(Context context) {
    method convert (line 23) | @Override
    method onClick (line 31) | @Override
    method setOnItemClickListener (line 43) | public void setOnItemClickListener(OnItemClickListener onItemClickList...
    type OnItemClickListener (line 47) | public interface OnItemClickListener {
      method OnItemClick (line 48) | void OnItemClick(History history);

FILE: app/src/main/java/me/bakumon/ugank/module/search/SearchActivity.java
  class SearchActivity (line 42) | public class SearchActivity extends SwipeBackBaseActivity implements Sea...
    method onCreate (line 70) | @Override
    method initView (line 81) | private void initView() {
    method onDestroy (line 132) | @Override
    method setToolbarBackgroundColor (line 138) | @Override
    method setEditTextCursorColor (line 143) | @Override
    method showEditClear (line 148) | @Override
    method hideEditClear (line 153) | @Override
    method showSearchFail (line 158) | @Override
    method setSearchItems (line 163) | @Override
    method addSearchItems (line 170) | @Override
    method showSwipLoading (line 177) | @Override
    method hideSwipLoading (line 182) | @Override
    method showTip (line 187) | @Override
    method setLoadMoreIsLastPage (line 192) | @Override
    method setEmpty (line 197) | @Override
    method setLoading (line 202) | @Override
    method showSearchResult (line 207) | @Override
    method showSearchHistory (line 213) | @Override
    method setHistory (line 219) | @Override
    method startEmojiRain (line 225) | @Override
    method stopEmojiRain (line 230) | @Override
    method onLoadMore (line 235) | @Override
    method editClear (line 240) | @OnClick(R.id.iv_edit_clear)
    method search (line 251) | @OnClick(R.id.iv_search)
    method cleanHistory (line 257) | @OnClick(R.id.tv_search_clean)
    method beforeTextChanged (line 262) | @Override
    method onTextChanged (line 267) | @Override
    method afterTextChanged (line 272) | @Override
    method onEditorAction (line 288) | @Override
    method OnItemClick (line 296) | @Override

FILE: app/src/main/java/me/bakumon/ugank/module/search/SearchContract.java
  type SearchContract (line 14) | public interface SearchContract {
    type View (line 15) | interface View extends BaseView {
      method setToolbarBackgroundColor (line 17) | void setToolbarBackgroundColor(int color);
      method setEditTextCursorColor (line 19) | void setEditTextCursorColor(int cursorColor);
      method showEditClear (line 21) | void showEditClear();
      method hideEditClear (line 23) | void hideEditClear();
      method showSearchFail (line 25) | void showSearchFail(String failMsg);
      method setSearchItems (line 27) | void setSearchItems(SearchResult searchResult);
      method addSearchItems (line 29) | void addSearchItems(SearchResult searchResult);
      method showSwipLoading (line 31) | void showSwipLoading();
      method hideSwipLoading (line 33) | void hideSwipLoading();
      method showTip (line 35) | void showTip(String msg);
      method setLoadMoreIsLastPage (line 37) | void setLoadMoreIsLastPage();
      method setEmpty (line 39) | void setEmpty();
      method setLoading (line 41) | void setLoading();
      method showSearchResult (line 43) | void showSearchResult();
      method showSearchHistory (line 45) | void showSearchHistory();
      method setHistory (line 47) | void setHistory(List<History> history);
      method startEmojiRain (line 49) | void startEmojiRain();
      method stopEmojiRain (line 51) | void stopEmojiRain();
    type Presenter (line 54) | interface Presenter extends BasePresenter {
      method search (line 56) | void search(String searchText, boolean isLoadMore);
      method queryHistory (line 58) | void queryHistory();
      method deleteAllHistory (line 60) | void deleteAllHistory();

FILE: app/src/main/java/me/bakumon/ugank/module/search/SearchListAdapter.java
  class SearchListAdapter (line 23) | public class SearchListAdapter extends CommonAdapter4RecyclerView<Search...
    method SearchListAdapter (line 25) | public SearchListAdapter(Context context) {
    method convert (line 29) | @Override
    method onClick (line 40) | @Override

FILE: app/src/main/java/me/bakumon/ugank/module/search/SearchPresenter.java
  class SearchPresenter (line 26) | public class SearchPresenter implements SearchContract.Presenter {
    method SearchPresenter (line 33) | public SearchPresenter(SearchContract.View view) {
    method subscribe (line 37) | @Override
    method unsubscribe (line 45) | @Override
    method search (line 50) | @Override
    method queryHistory (line 113) | @Override
    method saveOneHistory (line 125) | private void saveOneHistory(String historyContent) {
    method deleteAllHistory (line 146) | @Override

FILE: app/src/main/java/me/bakumon/ugank/module/setting/SettingActivity.java
  class SettingActivity (line 31) | public class SettingActivity extends SwipeBackBaseActivity implements Se...
    method onCreate (line 66) | @Override
    method onBackPressed (line 90) | @Override
    method onDestroy (line 98) | @Override
    method changSwitchState (line 104) | @OnClick(R.id.ll_is_show_list_img)
    method isShowLauncherImg (line 109) | @OnClick(R.id.ll_is_show_launcher_img)
    method isAlwaysShowLauncherImg (line 114) | @OnClick(R.id.ll_is_always_show_launcher_img)
    method onCheckedChanged (line 119) | @Override
    method setToolbarBackgroundColor (line 135) | @Override
    method changeSwitchState (line 140) | @Override
    method changeIsShowLauncherImgSwitchState (line 145) | @Override
    method changeIsAlwaysShowLauncherImgSwitchState (line 150) | @Override
    method setSwitchCompatsColor (line 155) | @Override
    method setAppVersionNameInTv (line 162) | @Override
    method setImageQualityChooseUnEnable (line 167) | @Override
    method setImageQualityChooseEnable (line 175) | @Override
    method setLauncherImgProbabilityUnEnable (line 183) | @Override
    method setLauncherImgProbabilityEnable (line 191) | @Override
    method setThumbnailQualityInfo (line 199) | @Override
    method showCacheSize (line 216) | @Override
    method showSuccessTip (line 221) | @Override
    method showFailTip (line 226) | @Override
    method setShowLauncherTip (line 231) | @Override
    method setAlwaysShowLauncherTip (line 236) | @Override
    method chooseThumbnailQuality (line 241) | @OnClick(R.id.ll_setting_image_quality)
    method about (line 261) | @OnClick(R.id.ll_setting_about)
    method cleanCache (line 266) | @OnClick(R.id.ll_setting_clean_cache)
    method issues (line 271) | @OnClick(R.id.ll_setting_issues)
    method pay (line 278) | @OnClick(R.id.ll_setting_pay)

FILE: app/src/main/java/me/bakumon/ugank/module/setting/SettingContract.java
  type SettingContract (line 10) | public interface SettingContract {
    type View (line 12) | interface View extends BaseView {
      method setToolbarBackgroundColor (line 14) | void setToolbarBackgroundColor(int color);
      method changeSwitchState (line 16) | void changeSwitchState(boolean isChecked);
      method changeIsShowLauncherImgSwitchState (line 18) | void changeIsShowLauncherImgSwitchState(boolean isChecked);
      method changeIsAlwaysShowLauncherImgSwitchState (line 20) | void changeIsAlwaysShowLauncherImgSwitchState(boolean isChecked);
      method setSwitchCompatsColor (line 22) | void setSwitchCompatsColor(int color);
      method setAppVersionNameInTv (line 24) | void setAppVersionNameInTv(String versionName);
      method setImageQualityChooseUnEnable (line 26) | void setImageQualityChooseUnEnable();
      method setImageQualityChooseEnable (line 28) | void setImageQualityChooseEnable();
      method setLauncherImgProbabilityUnEnable (line 30) | void setLauncherImgProbabilityUnEnable();
      method setLauncherImgProbabilityEnable (line 32) | void setLauncherImgProbabilityEnable();
      method setThumbnailQualityInfo (line 34) | void setThumbnailQualityInfo(int quality);
      method showCacheSize (line 36) | void showCacheSize(String cache);
      method showSuccessTip (line 38) | void showSuccessTip(String msg);
      method showFailTip (line 40) | void showFailTip(String msg);
      method setShowLauncherTip (line 42) | void setShowLauncherTip(String tip);
      method setAlwaysShowLauncherTip (line 44) | void setAlwaysShowLauncherTip(String tip);
    type Presenter (line 48) | interface Presenter extends BasePresenter {
      method isThumbnailSettingChanged (line 50) | boolean isThumbnailSettingChanged();
      method saveIsListShowImg (line 52) | void saveIsListShowImg(boolean isListShowImg);
      method saveIsLauncherShowImg (line 54) | void saveIsLauncherShowImg(boolean isLauncherShowImg);
      method saveIsLauncherAlwaysShowImg (line 56) | void saveIsLauncherAlwaysShowImg(boolean isLauncherAlwaysShowImg);
      method getColorPrimary (line 58) | int getColorPrimary();
      method getThumbnailQuality (line 60) | int getThumbnailQuality();
      method setThumbnailQuality (line 62) | void setThumbnailQuality(int quality);
      method cleanCache (line 64) | void cleanCache();

FILE: app/src/main/java/me/bakumon/ugank/module/setting/SettingPresenter.java
  class SettingPresenter (line 14) | public class SettingPresenter implements SettingContract.Presenter {
    method SettingPresenter (line 24) | public SettingPresenter(SettingContract.View view) {
    method subscribe (line 28) | @Override
    method isThumbnailSettingChanged (line 50) | @Override
    method unsubscribe (line 56) | @Override
    method saveIsListShowImg (line 61) | @Override
    method saveIsLauncherShowImg (line 67) | @Override
    method saveIsLauncherAlwaysShowImg (line 78) | @Override
    method setIsLauncherAlwaysShowImgEnable (line 88) | private void setIsLauncherAlwaysShowImgEnable(boolean isEnable) {
    method setImageQualityChooseIsEnable (line 96) | private void setImageQualityChooseIsEnable(boolean isEnable) {
    method getColorPrimary (line 104) | @Override
    method getThumbnailQuality (line 109) | @Override
    method setThumbnailQuality (line 114) | @Override
    method cleanCache (line 120) | @Override

FILE: app/src/main/java/me/bakumon/ugank/module/webview/WebViewActivity.java
  class WebViewActivity (line 32) | public class WebViewActivity extends SwipeBackBaseActivity implements We...
    method onCreate (line 55) | @Override
    method initWebView (line 77) | public void initWebView() {
    method setToolbarBackgroundColor (line 99) | @Override
    method getLoadUrl (line 104) | @Override
    method getGankTitle (line 109) | @Override
    method getFavoriteData (line 114) | @Override
    method setFavoriteState (line 119) | @Override
    method finish (line 129) | @Override
    method hideFavoriteFab (line 139) | @Override
    method showTip (line 145) | @Override
    method setFabButtonColor (line 150) | @Override
    class MyWebChrome (line 155) | private class MyWebChrome extends WebChromeClient {
      method onProgressChanged (line 156) | @Override
    class MyWebClient (line 163) | private class MyWebClient extends WebViewClient {
      method onPageFinished (line 164) | @Override
    method setGankTitle (line 170) | @Override
    method loadGankURL (line 175) | @Override
    method favorite (line 180) | @OnClick(R.id.fab_web_favorite)
    method onBackPressed (line 185) | @Override
    method onCreateOptionsMenu (line 194) | @Override
    method onOptionsItemSelected (line 200) | @Override

FILE: app/src/main/java/me/bakumon/ugank/module/webview/WebViewContract.java
  type WebViewContract (line 12) | public interface WebViewContract {
    type View (line 14) | interface View extends BaseView {
      method setGankTitle (line 16) | void setGankTitle(String title);
      method loadGankURL (line 18) | void loadGankURL(String url);
      method setToolbarBackgroundColor (line 20) | void setToolbarBackgroundColor(int color);
      method getLoadUrl (line 22) | String getLoadUrl();
      method getGankTitle (line 24) | String getGankTitle();
      method setFabButtonColor (line 26) | void setFabButtonColor(int color);
      method getFavoriteData (line 28) | Favorite getFavoriteData();
      method setFavoriteState (line 30) | void setFavoriteState(boolean isFavorite);
      method hideFavoriteFab (line 32) | void hideFavoriteFab();
      method showTip (line 34) | void showTip(String tip);
    type Presenter (line 38) | interface Presenter extends BasePresenter {
      method getGankUrl (line 40) | String getGankUrl();
      method favoriteGank (line 42) | void favoriteGank();

FILE: app/src/main/java/me/bakumon/ugank/module/webview/WebViewPresenter.java
  class WebViewPresenter (line 15) | public class WebViewPresenter implements WebViewContract.Presenter {
    method WebViewPresenter (line 23) | public WebViewPresenter(WebViewContract.View webViewView) {
    method subscribe (line 27) | @Override
    method loadDate (line 38) | private void loadDate() {
    method unsubscribe (line 43) | @Override
    method getGankUrl (line 47) | @Override
    method favoriteGank (line 52) | @Override
    method unFavorite (line 61) | private void unFavorite() {
    method favorite (line 73) | private void favorite() {
    method findHasFavoriteGank (line 82) | private void findHasFavoriteGank() {

FILE: app/src/main/java/me/bakumon/ugank/network/NetWork.java
  class NetWork (line 16) | public class NetWork {
    method getGankApi (line 22) | public static GankApi getGankApi() {

FILE: app/src/main/java/me/bakumon/ugank/network/api/GankApi.java
  type GankApi (line 14) | public interface GankApi {
    method getCategoryDate (line 16) | @GET("data/{category}/{number}/{page}")
    method getRandomBeauties (line 19) | @GET("random/data/福利/{number}")
    method getSearchResult (line 22) | @GET("search/query/{key}/category/all/count/{count}/page/{page}")

FILE: app/src/main/java/me/bakumon/ugank/utills/AlipayZeroSdk.java
  class AlipayZeroSdk (line 15) | public class AlipayZeroSdk {
    method startAlipayClient (line 35) | public static boolean startAlipayClient(Activity activity, String urlC...
    method startIntentUrl (line 46) | public static boolean startIntentUrl(Activity activity, String intentF...
    method hasInstalledAlipayClient (line 68) | public static boolean hasInstalledAlipayClient(Context context) {
    method getAlipayClientVersion (line 84) | public static String getAlipayClientVersion(Context context) {
    method openAlipayScan (line 100) | public static boolean openAlipayScan(Context context) {
    method openAlipayBarcode (line 122) | public static boolean openAlipayBarcode(Context context) {

FILE: app/src/main/java/me/bakumon/ugank/utills/AndroidUtil.java
  class AndroidUtil (line 13) | public class AndroidUtil {
    method share (line 20) | public static void share(Context context, String text) {
    method openWithBrowser (line 34) | public static void openWithBrowser(Context context, String uriStr) {
    method copyText (line 45) | public static boolean copyText(Context context, String copyText) {

FILE: app/src/main/java/me/bakumon/ugank/utills/DataCleanManager.java
  class DataCleanManager (line 15) | public class DataCleanManager {
    method getTotalCacheSize (line 16) | public static String getTotalCacheSize() {
    method getFolderSize (line 32) | public static long getFolderSize(File file) throws Exception {
    method clearAllCache (line 50) | public static boolean clearAllCache() {
    method deleteDir (line 64) | private static boolean deleteDir(File dir) {
    method getFormatSize (line 86) | public static String getFormatSize(double size) {
    method cleanInternalCache (line 121) | public static void cleanInternalCache() {
    method cleanDatabases (line 128) | public static void cleanDatabases() {
    method cleanSharedPreference (line 137) | public static void cleanSharedPreference() {
    method cleanDatabaseByName (line 145) | public static void cleanDatabaseByName(String dbName) {
    method cleanFiles (line 152) | public static void cleanFiles() {
    method cleanExternalCache (line 160) | public static void cleanExternalCache() {
    method cleanCustomCache (line 170) | public static void cleanCustomCache(String filePath) {
    method cleanApplicationData (line 177) | public static void cleanApplicationData(String... filepath) {
    method deleteFilesByDirectory (line 191) | private static void deleteFilesByDirectory(File directory) {

FILE: app/src/main/java/me/bakumon/ugank/utills/DateUtil.java
  class DateUtil (line 11) | public class DateUtil {
    method dateFormat (line 12) | public static String dateFormat(String timestamp) {

FILE: app/src/main/java/me/bakumon/ugank/utills/DisplayUtils.java
  class DisplayUtils (line 11) | public class DisplayUtils {
    method getMetrics (line 12) | private static DisplayMetrics getMetrics(Context context) {
    method dp2px (line 23) | public static int dp2px(float dp, Context context) {
    method px2dp (line 31) | public static float px2dp(float px, Context context) {
    method getScreenWidth (line 39) | public static int getScreenWidth(Context context) {
    method getScreenHeight (line 47) | public static int getScreenHeight(Context context) {
    method getStatusBarHeight (line 55) | public static int getStatusBarHeight(Context context) {

FILE: app/src/main/java/me/bakumon/ugank/utills/EmojiFilter.java
  class EmojiFilter (line 11) | public class EmojiFilter {
    method isEmojiCharacter (line 20) | private static boolean isEmojiCharacter(char codePoint) {
    method filterEmoji (line 34) | public static String filterEmoji(String source) {

FILE: app/src/main/java/me/bakumon/ugank/utills/ImageUtil.java
  class ImageUtil (line 22) | public class ImageUtil {
    method saveImageToGallery (line 23) | public static boolean saveImageToGallery(Context context, Bitmap bmp) {
    method drawableToBitmap (line 62) | public static Bitmap drawableToBitmap(Drawable drawable) {

FILE: app/src/main/java/me/bakumon/ugank/utills/KeyboardUtils.java
  class KeyboardUtils (line 13) | public class KeyboardUtils {
    method hideSoftInput (line 19) | public static void hideSoftInput(Activity activity) {
    method showSoftInput (line 31) | public static void showSoftInput(Context context, EditText edit) {

FILE: app/src/main/java/me/bakumon/ugank/utills/MDTintUtil.java
  class MDTintUtil (line 20) | public class MDTintUtil {
    method setCursorTint (line 24) | public static void setCursorTint(@NonNull EditText editText, @ColorInt...
    method setTint (line 46) | public static void setTint(@NonNull FloatingActionButton floatingActio...
    method setTint (line 58) | public static void setTint(@NonNull SwitchCompat switchCompat, @ColorI...

FILE: app/src/main/java/me/bakumon/ugank/utills/PackageUtil.java
  class PackageUtil (line 10) | public class PackageUtil {
    method getVersionName (line 11) | public static String getVersionName(Context context) {

FILE: app/src/main/java/me/bakumon/ugank/utills/StatusBarUtil.java
  class StatusBarUtil (line 23) | @SuppressWarnings("unused")
    method immersive (line 29) | public static void immersive(Activity activity) {
    method immersive (line 33) | public static void immersive(Activity activity, int color, @FloatRange...
    method immersive (line 37) | public static void immersive(Activity activity, int color) {
    method immersive (line 41) | public static void immersive(Window window) {
    method immersive (line 45) | public static void immersive(Window window, int color) {
    method immersive (line 49) | public static void immersive(Window window, int color, @FloatRange(fro...
    method darkMode (line 72) | public static void darkMode(Activity activity, boolean dark) {
    method darkMode (line 83) | public static void darkMode(Activity activity) {
    method darkMode (line 87) | public static void darkMode(Activity activity, int color, @FloatRange(...
    method darkMode (line 92) | public static void darkMode(Window window, int color, @FloatRange(from...
    method darkModeForM (line 120) | private static void darkModeForM(Window window, boolean dark) {
    method darkModeForFlyme4 (line 138) | public static boolean darkModeForFlyme4(Window window, boolean dark) {
    method darkModeForMIUI6 (line 171) | public static boolean darkModeForMIUI6(Window window, boolean darkmode) {
    method isFlyme4Later (line 188) | public static boolean isFlyme4Later() {
    method isMIUI6Later (line 197) | public static boolean isMIUI6Later() {
    method setPadding (line 213) | public static void setPadding(Context context, View view) {
    method setPaddingSmart (line 220) | public static void setPaddingSmart(Context context, View view) {
    method setHeightAndPadding (line 232) | public static void setHeightAndPadding(Context context, View view) {
    method setMargin (line 241) | public static void setMargin(Context context, View view) {
    method setTranslucentView (line 253) | public static void setTranslucentView(ViewGroup container, int color, ...
    method mixtureColor (line 270) | public static int mixtureColor(int color, @FloatRange(from = 0.0, to =...
    method getStatusBarHeight (line 276) | public static int getStatusBarHeight(Context context) {

FILE: app/src/main/java/me/bakumon/ugank/widget/AboutDialog.java
  class AboutDialog (line 20) | public class AboutDialog extends BaseDialog {
    method AboutDialog (line 40) | public AboutDialog(Context context, int layoutId) {
    method AboutDialog (line 44) | public AboutDialog(Activity context) {
    method AboutDialog (line 48) | public AboutDialog(Activity context, int color) {
    method initView (line 55) | private void initView() {
    method setUnderline (line 69) | private void setUnderline(TextView textView) {
    method affirm (line 74) | @OnClick(R.id.tv_affirm)
    method thanks (line 79) | @OnClick(R.id.tv_thanks)
    method openAddress (line 84) | @OnClick(R.id.tv_open_address)
    method gankio (line 89) | @OnClick(R.id.tv_gankio)
    method github (line 94) | @OnClick(R.id.tv_author_github)
    method weibo (line 99) | @OnClick(R.id.tv_author_weibo)
    method viewIntent (line 104) | private void viewIntent(String url) {

FILE: app/src/main/java/me/bakumon/ugank/widget/ObservableWebView.java
  class ObservableWebView (line 8) | public class ObservableWebView extends WebView {
    method ObservableWebView (line 12) | public ObservableWebView(final Context context) {
    method ObservableWebView (line 16) | public ObservableWebView(final Context context, final AttributeSet att...
    method ObservableWebView (line 20) | public ObservableWebView(final Context context, final AttributeSet attrs,
    method onScrollChanged (line 25) | @Override
    method setOnScrollChangedCallback (line 35) | public void setOnScrollChangedCallback(
    type OnScrollChangedCallback (line 40) | public interface OnScrollChangedCallback {
      method onScroll (line 41) | void onScroll(int dx, int dy);

FILE: app/src/main/java/me/bakumon/ugank/widget/PinchImageView.java
  class PinchImageView (line 24) | public class PinchImageView extends ImageView  {
    method setOnClickListener (line 61) | @Override
    method setOnLongClickListener (line 67) | @Override
    method getOuterMatrix (line 132) | public Matrix getOuterMatrix(Matrix matrix) {
    method getInnerMatrix (line 150) | public Matrix getInnerMatrix(Matrix matrix) {
    method getCurrentImageMatrix (line 182) | public Matrix getCurrentImageMatrix(Matrix matrix) {
    method getImageBound (line 200) | public RectF getImageBound(RectF rectF) {
    method getMask (line 227) | public RectF getMask() {
    method getPinchMode (line 242) | public int getPinchMode() {
    method outerMatrixTo (line 260) | public void outerMatrixTo(Matrix endMatrix, long duration) {
    method zoomMaskTo (line 292) | public void zoomMaskTo(RectF mask, long duration) {
    method reset (line 321) | public void reset() {
    type OuterMatrixChangedListener (line 348) | public interface OuterMatrixChangedListener {
      method onOuterMatrixChanged (line 362) | void onOuterMatrixChanged(PinchImageView pinchImageView);
    method addOuterMatrixChangedListener (line 396) | public void addOuterMatrixChangedListener(OuterMatrixChangedListener l...
    method removeOuterMatrixChangedListener (line 425) | public void removeOuterMatrixChangedListener(OuterMatrixChangedListene...
    method dispatchOuterMatrixChanged (line 455) | private void dispatchOuterMatrixChanged() {
    method getMaxScale (line 497) | protected float getMaxScale() {
    method calculateNextScale (line 514) | protected float calculateNextScale(float innerScale, float outerScale) {
    method PinchImageView (line 526) | public PinchImageView(Context context) {
    method PinchImageView (line 531) | public PinchImageView(Context context, AttributeSet attrs) {
    method PinchImageView (line 536) | public PinchImageView(Context context, AttributeSet attrs, int defStyl...
    method initView (line 541) | private void initView() {
    method setScaleType (line 547) | @Override
    method onDraw (line 553) | @Override
    method isReady (line 582) | private boolean isReady() {
    class MaskAnimator (line 604) | private class MaskAnimator extends ValueAnimator implements ValueAnima...
      method MaskAnimator (line 628) | public MaskAnimator(RectF start, RectF end, long duration) {
      method onAnimationUpdate (line 644) | @Override
    method onFling (line 730) | public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX...
    method onLongPress (line 738) | public void onLongPress(MotionEvent e) {
    method onDoubleTap (line 745) | public boolean onDoubleTap(MotionEvent e) {
    method onSingleTapConfirmed (line 753) | public boolean onSingleTapConfirmed(MotionEvent e) {
    method onTouchEvent (line 762) | @Override
    method scrollBy (line 841) | private boolean scrollBy(float xDiff, float yDiff) {
    method saveScaleContext (line 914) | private void saveScaleContext(float x1, float y1, float x2, float y2) {
    method scale (line 939) | private void scale(PointF scaleCenter, float scaleBase, float distance...
    method doubleTap (line 971) | private void doubleTap(float x, float y) {
    method scaleEnd (line 1044) | private void scaleEnd() {
    method fling (line 1135) | private void fling(float vx, float vy) {
    method cancelAllAnimator (line 1150) | private void cancelAllAnimator() {
    class FlingAnimator (line 1167) | private class FlingAnimator extends ValueAnimator implements ValueAnim...
      method FlingAnimator (line 1182) | public FlingAnimator(float vectorX, float vectorY) {
      method onAnimationUpdate (line 1190) | @Override
    class ScaleAnimator (line 1209) | private class ScaleAnimator extends ValueAnimator implements ValueAnim...
      method ScaleAnimator (line 1234) | public ScaleAnimator(Matrix start, Matrix end) {
      method ScaleAnimator (line 1247) | public ScaleAnimator(Matrix start, Matrix end, long duration) {
      method onAnimationUpdate (line 1256) | @Override
    class ObjectsPool (line 1283) | private static abstract class ObjectsPool<T> {
      method ObjectsPool (line 1300) | public ObjectsPool(int size) {
      method take (line 1317) | public T take() {
      method given (line 1336) | public void given(T obj) {
      method newInstance (line 1348) | abstract protected T newInstance();
      method resetInstance (line 1358) | abstract protected T resetInstance(T obj);
    class MatrixPool (line 1364) | private static class MatrixPool extends ObjectsPool<Matrix> {
      method MatrixPool (line 1366) | public MatrixPool(int size) {
      method newInstance (line 1370) | @Override
      method resetInstance (line 1375) | @Override
    class RectFPool (line 1385) | private static class RectFPool extends ObjectsPool<RectF> {
      method RectFPool (line 1387) | public RectFPool(int size) {
      method newInstance (line 1391) | @Override
      method resetInstance (line 1396) | @Override
    class MathUtils (line 1409) | public static class MathUtils {
      method matrixTake (line 1419) | public static Matrix matrixTake() {
      method matrixTake (line 1426) | public static Matrix matrixTake(Matrix matrix) {
      method matrixGiven (line 1437) | public static void matrixGiven(Matrix matrix) {
      method rectFTake (line 1449) | public static RectF rectFTake() {
      method rectFTake (line 1456) | public static RectF rectFTake(float left, float top, float right, fl...
      method rectFTake (line 1465) | public static RectF rectFTake(RectF rectF) {
      method rectFGiven (line 1476) | public static void rectFGiven(RectF rectF) {
      method getDistance (line 1489) | public static float getDistance(float x1, float y1, float x2, float ...
      method getCenterPoint (line 1504) | public static float[] getCenterPoint(float x1, float y1, float x2, f...
      method getMatrixScale (line 1514) | public static float[] getMatrixScale(Matrix matrix) {
      method inverseMatrixPoint (line 1534) | public static float[] inverseMatrixPoint(float[] point, Matrix matri...
      method calculateRectTranslateMatrix (line 1560) | public static void calculateRectTranslateMatrix(RectF from, RectF to...
      method calculateScaledRectInContainer (line 1582) | public static void calculateScaledRectInContainer(RectF container, f...

FILE: app/src/main/java/me/bakumon/ugank/widget/RecycleViewDivider.java
  class RecycleViewDivider (line 16) | public class RecycleViewDivider extends RecyclerView.ItemDecoration {
    method RecycleViewDivider (line 28) | public RecycleViewDivider(Context context, int orientation) {
    method getItemOffsets (line 40) | @Override
    method onDraw (line 47) | @Override
    method drawHorizontal (line 58) | private void drawHorizontal(Canvas canvas, RecyclerView parent) {
    method drawVertical (line 75) | private void drawVertical(Canvas canvas, RecyclerView parent) {

FILE: app/src/main/java/me/bakumon/ugank/widget/SquareLoading.java
  class SquareLoading (line 24) | public class SquareLoading extends ViewGroup {
    method SquareLoading (line 54) | public SquareLoading(Context context) {
    method SquareLoading (line 59) | public SquareLoading(Context context, AttributeSet attrs) {
    method SquareLoading (line 64) | public SquareLoading(Context context, AttributeSet attrs, int defStyle...
    method onLayout (line 69) | @Override
    method init (line 73) | private void init(Context context, AttributeSet attrs) {
    method setSquareColor (line 102) | public void setSquareColor(int color) {
    method removeViewsIfNeeded (line 108) | private void removeViewsIfNeeded() {
    method initSquare (line 114) | private void initSquare(Context context) {
    method initAnim (line 126) | private void initAnim() {
    method onSizeChanged (line 187) | @Override
    method onMeasure (line 195) | @Override
    method childLayout (line 224) | private void childLayout() {
    method startRotateAnim (line 237) | private void startRotateAnim(final int index) {
    method startReverseAnim (line 243) | private void startReverseAnim(final int index) {
    method startRotateAnim (line 249) | private void startRotateAnim(final int index, int delayMillis) {
    method startReverseAnim (line 258) | private void startReverseAnim(final int index, int delayMillis) {
    method getNextAnimChild (line 267) | private int getNextAnimChild(boolean isStart, int i) {
    method onDetachedFromWindow (line 286) | @Override
    method cancelAnims (line 293) | private void cancelAnims(List<RotateAnimation> anims) {

FILE: app/src/main/java/me/bakumon/ugank/widget/recyclerviewwithfooter/DefaultEmptyItem.java
  class DefaultEmptyItem (line 18) | public class DefaultEmptyItem extends EmptyItem {
    method onCreateView (line 23) | @Override
    method onBindData (line 32) | @Override

FILE: app/src/main/java/me/bakumon/ugank/widget/recyclerviewwithfooter/DefaultFootItem.java
  class DefaultFootItem (line 17) | public class DefaultFootItem extends FootItem {
    method onCreateView (line 23) | @Override
    method onBindData (line 33) | @Override
    method showPullToLoad (line 53) | public void showPullToLoad(CharSequence message) {
    method showProgressBar (line 57) | public void showProgressBar(CharSequence load) {
    method showEnd (line 68) | public void showEnd(CharSequence end) {

FILE: app/src/main/java/me/bakumon/ugank/widget/recyclerviewwithfooter/EmptyItem.java
  class EmptyItem (line 11) | public abstract class EmptyItem {
    method onCreateView (line 16) | abstract View onCreateView(ViewGroup parent);
    method onBindData (line 18) | abstract void onBindData(View view);

FILE: app/src/main/java/me/bakumon/ugank/widget/recyclerviewwithfooter/FootItem.java
  class FootItem (line 11) | public abstract class FootItem {
    method onCreateView (line 17) | public abstract View onCreateView(ViewGroup parent);
    method onBindData (line 19) | public abstract void onBindData(View view, int state);

FILE: app/src/main/java/me/bakumon/ugank/widget/recyclerviewwithfooter/OnLoadMoreListener.java
  type OnLoadMoreListener (line 8) | public interface OnLoadMoreListener {
    method onLoadMore (line 9) | void onLoadMore();

FILE: app/src/main/java/me/bakumon/ugank/widget/recyclerviewwithfooter/RecyclerViewUtils.java
  class RecyclerViewUtils (line 14) | class RecyclerViewUtils {
    method setVerticalLinearLayout (line 18) | public static void setVerticalLinearLayout(RecyclerView rv) {
    method setGridLayout (line 32) | public static void setGridLayout(RecyclerView rv, int spanCount) {
    method setStaggeredGridLayoutManager (line 46) | public static void setStaggeredGridLayoutManager(RecyclerView rv, int ...

FILE: app/src/main/java/me/bakumon/ugank/widget/recyclerviewwithfooter/RecyclerViewWithFooter.java
  class RecyclerViewWithFooter (line 24) | public class RecyclerViewWithFooter extends RecyclerView {
    method onChanged (line 47) | @Override
    method reset (line 53) | private void reset() {
    method onItemRangeChanged (line 57) | @Override
    method onItemRangeChanged (line 64) | @Override
    method onItemRangeInserted (line 71) | @Override
    method onItemRangeRemoved (line 78) | @Override
    method onItemRangeMoved (line 84) | @Override
    method RecyclerViewWithFooter (line 91) | public RecyclerViewWithFooter(Context context) {
    method RecyclerViewWithFooter (line 96) | public RecyclerViewWithFooter(Context context, AttributeSet attrs) {
    method RecyclerViewWithFooter (line 101) | public RecyclerViewWithFooter(Context context, AttributeSet attrs, int...
    method init (line 106) | private void init() {
    method setVerticalLinearLayout (line 110) | public void setVerticalLinearLayout() {
    method setGridLayout (line 114) | public void setGridLayout(int span) {
    method setStaggeredGridLayoutManager (line 118) | public void setStaggeredGridLayoutManager(int spanCount) {
    method setOnLoadMoreListener (line 122) | public void setOnLoadMoreListener(OnLoadMoreListener onLoadMoreListene...
    method setAdapter (line 161) | @Override
    method applyLoadingText (line 181) | public RecyclerViewWithFooter applyLoadingText(CharSequence loadText) {
    method applyPullToLoadText (line 186) | public RecyclerViewWithFooter applyPullToLoadText(CharSequence pullToL...
    method applyEndText (line 191) | public RecyclerViewWithFooter applyEndText(CharSequence endText) {
    method applyEmptyText (line 196) | public RecyclerViewWithFooter applyEmptyText(CharSequence emptyText, @...
    method setFootItem (line 202) | public void setFootItem(FootItem footItem) {
    method setEmptyItem (line 217) | public void setEmptyItem(EmptyItem emptyItem) {
    method setLoading (line 232) | public void setLoading() {
    method setEnd (line 245) | public void setEnd(CharSequence end) {
    method setEnd (line 257) | public void setEnd() {
    method setEmpty (line 271) | public void setEmpty(CharSequence empty, @DrawableRes int resId) {
    method setEmpty (line 285) | public void setEmpty() {
    method isEmpty (line 297) | private boolean isEmpty() {
    method isLoadMoreEnable (line 302) | public boolean isLoadMoreEnable() {
    class OnLoadMoreListenerWrapper (line 311) | private class OnLoadMoreListenerWrapper implements OnLoadMoreListener {
      method OnLoadMoreListenerWrapper (line 315) | public OnLoadMoreListenerWrapper(OnLoadMoreListener onLoadMoreListen...
      method onLoadMore (line 319) | @Override
    class LoadMoreAdapter (line 328) | public class LoadMoreAdapter extends RecyclerView.Adapter<RecyclerView...
      method LoadMoreAdapter (line 335) | public LoadMoreAdapter(Adapter adapter) {
      method onCreateViewHolder (line 339) | @Override
      method registerAdapterDataObserver (line 349) | @Override
      method unregisterAdapterDataObserver (line 356) | @Override
      method onBindViewHolder (line 362) | @Override
      method isFootView (line 391) | private boolean isFootView(int position) {
      method getItemViewType (line 395) | @Override
      method getItemCount (line 408) | @Override
      class LoadMoreVH (line 420) | private class LoadMoreVH extends VH {
        method LoadMoreVH (line 424) | public LoadMoreVH() {
        method onBindViewHolder (line 429) | @Override
      class EmptyVH (line 441) | private class EmptyVH extends VH {
        method EmptyVH (line 443) | public EmptyVH() {
        method onBindViewHolder (line 447) | @Override
      class VH (line 454) | class VH extends RecyclerView.ViewHolder {
        method VH (line 456) | public VH(View itemView) {
        method onBindViewHolder (line 460) | public void onBindViewHolder() {

FILE: app/src/test/java/me/bakumon/ugank/ExampleUnitTest.java
  class ExampleUnitTest (line 12) | public class ExampleUnitTest {
    method addition_isCorrect (line 13) | @Test
Condensed preview — 133 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (438K chars).
[
  {
    "path": ".gitignore",
    "chars": 107,
    "preview": "*.iml\n.gradle\n/local.properties\n.DS_Store\n/build\n/captures\n.externalNativeBuild\n/.idea/\nkeystore.properties"
  },
  {
    "path": "LICENSE",
    "chars": 35141,
    "preview": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
  },
  {
    "path": "README.md",
    "chars": 834,
    "preview": "# 「有干货」- 体验别具一格的 Gank.io 安卓客户端\n\n\n![「有干货」启动图标](https://github.com/Bakumon/UGank/raw/master/art/ic_launcher.png)\n\n## 下载\n\n去"
  },
  {
    "path": "_config.yml",
    "chars": 47,
    "preview": "theme: jekyll-theme-cayman\nshow_downloads: true"
  },
  {
    "path": "app/.gitignore",
    "chars": 7,
    "preview": "/build\n"
  },
  {
    "path": "app/build.gradle",
    "chars": 3455,
    "preview": "apply plugin: 'com.android.application'\n\n// 加载 keystore.properties 文件\ndef keystorePropertiesFile = rootProject.file(\"key"
  },
  {
    "path": "app/proguard-rules.pro",
    "chars": 12291,
    "preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in D:"
  },
  {
    "path": "app/src/androidTest/java/me/bakumon/ugank/ExampleInstrumentedTest.java",
    "chars": 735,
    "preview": "package me.bakumon.ugank;\n\nimport android.content.Context;\nimport android.support.test.InstrumentationRegistry;\nimport a"
  },
  {
    "path": "app/src/main/AndroidManifest.xml",
    "chars": 1911,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package="
  },
  {
    "path": "app/src/main/assets/litepal.xml",
    "chars": 1831,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<litepal>\n    <!--\n        Define the database name of your application.\n        "
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/App.java",
    "chars": 1071,
    "preview": "package me.bakumon.ugank;\n\nimport android.app.Application;\n\nimport com.squareup.leakcanary.LeakCanary;\n\nimport org.litep"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/ConfigManage.java",
    "chars": 3974,
    "preview": "package me.bakumon.ugank;\n\nimport android.content.Context;\nimport android.content.SharedPreferences;\n\n/**\n * ConfigManag"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/GlobalConfig.java",
    "chars": 703,
    "preview": "package me.bakumon.ugank;\n\n/**\n * 全局配置\n * Created by bakumon on 2016/12/9 14:57.\n */\npublic class GlobalConfig {\n    pub"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/ThemeManage.java",
    "chars": 449,
    "preview": "package me.bakumon.ugank;\n\n/**\n * ThemeManage\n * 主题色管理类\n * Created by bakumon on 2016/12/22 15:03.\n */\npublic enum Theme"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/base/BaseDialog.java",
    "chars": 833,
    "preview": "package me.bakumon.ugank.base;\n\nimport android.app.Dialog;\nimport android.content.Context;\nimport android.view.LayoutInf"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/base/BasePresenter.java",
    "chars": 175,
    "preview": "package me.bakumon.ugank.base;\n\n/**\n * BasePresenter\n * Created by bakumon on 2016/12/6.\n */\npublic interface BasePresen"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/base/BaseView.java",
    "chars": 120,
    "preview": "package me.bakumon.ugank.base;\n\n/**\n * BaseView\n * Created by bakumon on 2016/12/6.\n */\npublic interface BaseView {\n\n\n}\n"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/base/SwipeBackBaseActivity.java",
    "chars": 2445,
    "preview": "package me.bakumon.ugank.base;\n\nimport android.os.Bundle;\nimport android.support.annotation.Nullable;\nimport android.sup"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/base/adapter/CommonAdapter4RecyclerView.java",
    "chars": 1551,
    "preview": "package me.bakumon.ugank.base.adapter;\n\nimport android.content.Context;\nimport android.support.v7.widget.RecyclerView;\ni"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/base/adapter/CommonHolder4RecyclerView.java",
    "chars": 1713,
    "preview": "package me.bakumon.ugank.base.adapter;\n\nimport android.support.annotation.IdRes;\nimport android.support.v7.widget.Recycl"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/base/adapter/CommonViewPagerAdapter.java",
    "chars": 953,
    "preview": "package me.bakumon.ugank.base.adapter;\n\nimport android.support.v4.app.Fragment;\nimport android.support.v4.app.FragmentMa"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/base/adapter/ListenerWithPosition.java",
    "chars": 865,
    "preview": "package me.bakumon.ugank.base.adapter;\n\nimport android.view.View;\n\n/**\n * ListenerWithPosition\n * Created by bakumon on "
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/entity/CategoryResult.java",
    "chars": 563,
    "preview": "package me.bakumon.ugank.entity;\n\nimport java.util.List;\n\n/**\n * CategoryResult\n * Created by bakumon on 2016/12/8.\n */\n"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/entity/Favorite.java",
    "chars": 1375,
    "preview": "package me.bakumon.ugank.entity;\n\nimport org.litepal.crud.DataSupport;\n\nimport java.io.Serializable;\n\n/**\n * Favorite\n *"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/entity/History.java",
    "chars": 566,
    "preview": "package me.bakumon.ugank.entity;\n\nimport org.litepal.crud.DataSupport;\n\n/**\n * History\n * Created by bakumon on 2017/2/1"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/entity/SearchResult.java",
    "chars": 501,
    "preview": "package me.bakumon.ugank.entity;\n\nimport java.util.List;\n\n/**\n * SearchResult\n * Created by bakumon on 2016/12/19 17:00."
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/bigimg/BigimgActivity.java",
    "chars": 3842,
    "preview": "package me.bakumon.ugank.module.bigimg;\n\nimport android.content.pm.ActivityInfo;\nimport android.os.Build;\nimport android"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/bigimg/BigimgContract.java",
    "chars": 595,
    "preview": "package me.bakumon.ugank.module.bigimg;\n\nimport me.bakumon.ugank.base.BasePresenter;\nimport me.bakumon.ugank.base.BaseVi"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/bigimg/BigimgPresenter.java",
    "chars": 1127,
    "preview": "package me.bakumon.ugank.module.bigimg;\n\nimport android.support.annotation.NonNull;\n\nimport me.bakumon.ugank.ThemeManage"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/category/CategoryContract.java",
    "chars": 740,
    "preview": "package me.bakumon.ugank.module.category;\n\nimport me.bakumon.ugank.base.BasePresenter;\nimport me.bakumon.ugank.base.Base"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/category/CategoryFragment.java",
    "chars": 5863,
    "preview": "package me.bakumon.ugank.module.category;\n\nimport android.app.Activity;\nimport android.content.Intent;\nimport android.os"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/category/CategoryListAdapter.java",
    "chars": 4253,
    "preview": "package me.bakumon.ugank.module.category;\n\nimport android.content.Context;\nimport android.content.Intent;\nimport android"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/category/CategoryPresenter.java",
    "chars": 2486,
    "preview": "package me.bakumon.ugank.module.category;\n\nimport android.support.annotation.NonNull;\n\nimport me.bakumon.ugank.GlobalCon"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/favorite/FavoriteActivity.java",
    "chars": 4294,
    "preview": "package me.bakumon.ugank.module.favorite;\n\nimport android.content.Intent;\nimport android.content.pm.ActivityInfo;\nimport"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/favorite/FavoriteContract.java",
    "chars": 700,
    "preview": "package me.bakumon.ugank.module.favorite;\n\nimport java.util.List;\n\nimport me.bakumon.ugank.base.BasePresenter;\nimport me"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/favorite/FavoriteListAdapter.java",
    "chars": 2461,
    "preview": "package me.bakumon.ugank.module.favorite;\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.c"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/favorite/FavoritePresenter.java",
    "chars": 1649,
    "preview": "package me.bakumon.ugank.module.favorite;\n\nimport org.litepal.crud.DataSupport;\n\nimport java.util.List;\n\nimport me.bakum"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/home/HomeActivity.java",
    "chars": 11199,
    "preview": "package me.bakumon.ugank.module.home;\n\nimport android.animation.ObjectAnimator;\nimport android.animation.ValueAnimator;\n"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/home/HomeContract.java",
    "chars": 974,
    "preview": "package me.bakumon.ugank.module.home;\n\nimport android.support.annotation.Nullable;\nimport android.support.v7.graphics.Pa"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/home/HomePresenter.java",
    "chars": 5046,
    "preview": "package me.bakumon.ugank.module.home;\n\nimport android.support.annotation.NonNull;\nimport android.support.annotation.Null"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/launcher/LauncherActivity.java",
    "chars": 3538,
    "preview": "package me.bakumon.ugank.module.launcher;\n\nimport android.content.Intent;\nimport android.content.pm.ActivityInfo;\nimport"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/launcher/LauncherContract.java",
    "chars": 392,
    "preview": "package me.bakumon.ugank.module.launcher;\n\nimport me.bakumon.ugank.base.BasePresenter;\nimport me.bakumon.ugank.base.Base"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/launcher/LauncherPresenter.java",
    "chars": 867,
    "preview": "package me.bakumon.ugank.module.launcher;\n\nimport android.text.TextUtils;\n\nimport me.bakumon.ugank.ConfigManage;\n\n/**\n *"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/search/HistoryListAdapter.java",
    "chars": 1631,
    "preview": "package me.bakumon.ugank.module.search;\n\nimport android.content.Context;\nimport android.view.View;\n\nimport me.bakumon.ug"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/search/SearchActivity.java",
    "chars": 9701,
    "preview": "package me.bakumon.ugank.module.search;\n\nimport android.content.pm.ActivityInfo;\nimport android.os.Build;\nimport android"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/search/SearchContract.java",
    "chars": 1267,
    "preview": "package me.bakumon.ugank.module.search;\n\nimport java.util.List;\n\nimport me.bakumon.ugank.base.BasePresenter;\nimport me.b"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/search/SearchListAdapter.java",
    "chars": 3000,
    "preview": "package me.bakumon.ugank.module.search;\n\nimport android.content.Context;\nimport android.content.Intent;\nimport android.v"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/search/SearchPresenter.java",
    "chars": 5028,
    "preview": "package me.bakumon.ugank.module.search;\n\nimport android.graphics.Color;\nimport android.text.TextUtils;\n\nimport org.litep"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/setting/SettingActivity.java",
    "chars": 10458,
    "preview": "package me.bakumon.ugank.module.setting;\n\nimport android.content.Intent;\nimport android.content.pm.ActivityInfo;\nimport "
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/setting/SettingContract.java",
    "chars": 1539,
    "preview": "package me.bakumon.ugank.module.setting;\n\nimport me.bakumon.ugank.base.BasePresenter;\nimport me.bakumon.ugank.base.BaseV"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/setting/SettingPresenter.java",
    "chars": 4412,
    "preview": "package me.bakumon.ugank.module.setting;\n\nimport me.bakumon.ugank.App;\nimport me.bakumon.ugank.ConfigManage;\nimport me.b"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/webview/WebViewActivity.java",
    "chars": 7044,
    "preview": "package me.bakumon.ugank.module.webview;\n\nimport android.content.Intent;\nimport android.content.pm.ActivityInfo;\nimport "
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/webview/WebViewContract.java",
    "chars": 824,
    "preview": "package me.bakumon.ugank.module.webview;\n\nimport me.bakumon.ugank.base.BasePresenter;\nimport me.bakumon.ugank.base.BaseV"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/module/webview/WebViewPresenter.java",
    "chars": 2550,
    "preview": "package me.bakumon.ugank.module.webview;\n\nimport org.litepal.crud.DataSupport;\n\nimport java.util.List;\n\nimport me.bakumo"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/network/NetWork.java",
    "chars": 1156,
    "preview": "package me.bakumon.ugank.network;\n\nimport me.bakumon.ugank.network.api.GankApi;\nimport okhttp3.OkHttpClient;\nimport retr"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/network/api/GankApi.java",
    "chars": 783,
    "preview": "package me.bakumon.ugank.network.api;\n\nimport me.bakumon.ugank.entity.CategoryResult;\nimport me.bakumon.ugank.entity.Sea"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/utills/AlipayZeroSdk.java",
    "chars": 3733,
    "preview": "package me.bakumon.ugank.utills;\n\nimport android.app.Activity;\nimport android.content.ActivityNotFoundException;\nimport "
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/utills/AndroidUtil.java",
    "chars": 1422,
    "preview": "package me.bakumon.ugank.utills;\n\nimport android.content.ClipData;\nimport android.content.ClipboardManager;\nimport andro"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/utills/DataCleanManager.java",
    "chars": 5950,
    "preview": "package me.bakumon.ugank.utills;\n\nimport android.os.Environment;\n\nimport java.io.File;\nimport java.math.BigDecimal;\n\nimp"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/utills/DateUtil.java",
    "chars": 704,
    "preview": "package me.bakumon.ugank.utills;\n\nimport java.text.ParseException;\nimport java.text.SimpleDateFormat;\nimport java.util.D"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/utills/DisplayUtils.java",
    "chars": 1654,
    "preview": "package me.bakumon.ugank.utills;\n\nimport android.content.Context;\nimport android.util.DisplayMetrics;\nimport android.vie"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/utills/EmojiFilter.java",
    "chars": 1626,
    "preview": "package me.bakumon.ugank.utills;\n\n/**\n * Created by mafei on 2017/3/24 12:27.\n *\n * @author mafei\n * @version 1.0.0\n * @"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/utills/ImageUtil.java",
    "chars": 2467,
    "preview": "package me.bakumon.ugank.utills;\n\nimport android.content.Context;\nimport android.content.Intent;\nimport android.graphics"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/utills/KeyboardUtils.java",
    "chars": 1123,
    "preview": "package me.bakumon.ugank.utills;\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.view.View;"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/utills/MDTintUtil.java",
    "chars": 3310,
    "preview": "package me.bakumon.ugank.utills;\n\nimport android.content.res.ColorStateList;\nimport android.graphics.Color;\nimport andro"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/utills/PackageUtil.java",
    "chars": 512,
    "preview": "package me.bakumon.ugank.utills;\n\nimport android.content.Context;\nimport android.content.pm.PackageManager;\n\n/**\n * Pack"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/utills/StatusBarUtil.java",
    "chars": 12078,
    "preview": "package me.bakumon.ugank.utills;\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.content.re"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/widget/AboutDialog.java",
    "chars": 2772,
    "preview": "package me.bakumon.ugank.widget;\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.content.In"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/widget/ObservableWebView.java",
    "chars": 1226,
    "preview": "package me.bakumon.ugank.widget;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.webki"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/widget/PinchImageView.java",
    "chars": 49749,
    "preview": "package me.bakumon.ugank.widget;\n\nimport android.animation.ValueAnimator;\nimport android.content.Context;\nimport android"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/widget/RecycleViewDivider.java",
    "chars": 3434,
    "preview": "package me.bakumon.ugank.widget;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport android."
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/widget/SquareLoading.java",
    "chars": 10323,
    "preview": "package me.bakumon.ugank.widget;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport android."
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/widget/recyclerviewwithfooter/DefaultEmptyItem.java",
    "chars": 1356,
    "preview": "package me.bakumon.ugank.widget.recyclerviewwithfooter;\n\nimport android.text.TextUtils;\nimport android.view.LayoutInflat"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/widget/recyclerviewwithfooter/DefaultFootItem.java",
    "chars": 2629,
    "preview": "package me.bakumon.ugank.widget.recyclerviewwithfooter;\n\nimport android.content.Context;\nimport android.text.TextUtils;\n"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/widget/recyclerviewwithfooter/EmptyItem.java",
    "chars": 361,
    "preview": "package me.bakumon.ugank.widget.recyclerviewwithfooter;\n\nimport android.view.View;\nimport android.view.ViewGroup;\n\n/**\n "
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/widget/recyclerviewwithfooter/FootItem.java",
    "chars": 435,
    "preview": "package me.bakumon.ugank.widget.recyclerviewwithfooter;\n\nimport android.view.View;\nimport android.view.ViewGroup;\n\n/**\n "
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/widget/recyclerviewwithfooter/OnLoadMoreListener.java",
    "chars": 169,
    "preview": "package me.bakumon.ugank.widget.recyclerviewwithfooter;\n\n/**\n * Load more interface\n *\n * @author cjj\n */\npublic interfa"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/widget/recyclerviewwithfooter/RecyclerViewUtils.java",
    "chars": 2414,
    "preview": "package me.bakumon.ugank.widget.recyclerviewwithfooter;\n\nimport android.support.v7.widget.GridLayoutManager;\nimport andr"
  },
  {
    "path": "app/src/main/java/me/bakumon/ugank/widget/recyclerviewwithfooter/RecyclerViewWithFooter.java",
    "chars": 14885,
    "preview": "package me.bakumon.ugank.widget.recyclerviewwithfooter;\n\n\nimport android.content.Context;\nimport android.support.annotat"
  },
  {
    "path": "app/src/main/res/color/select_press_color_gray.xml",
    "chars": 277,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item a"
  },
  {
    "path": "app/src/main/res/color/select_press_color_white.xml",
    "chars": 302,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item a"
  },
  {
    "path": "app/src/main/res/drawable/ic_beauty.xml",
    "chars": 4347,
    "preview": "<vector android:height=\"24dp\" android:viewportHeight=\"1024.0\"\n    android:viewportWidth=\"1024.0\" android:width=\"24dp\" xm"
  },
  {
    "path": "app/src/main/res/drawable/ic_collection.xml",
    "chars": 1208,
    "preview": "<vector android:height=\"24dp\"\n        android:viewportHeight=\"1024.0\"\n        android:viewportWidth=\"1024.0\"\n        and"
  },
  {
    "path": "app/src/main/res/drawable/ic_collection_shortcut.xml",
    "chars": 1475,
    "preview": "<vector android:height=\"24dp\"\n        android:viewportHeight=\"1024.0\"\n        android:viewportWidth=\"1024.0\"\n        and"
  },
  {
    "path": "app/src/main/res/drawable/ic_edit_clear.xml",
    "chars": 389,
    "preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:width=\"24dp\"\n        android:height=\""
  },
  {
    "path": "app/src/main/res/drawable/ic_favorite.xml",
    "chars": 467,
    "preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:width=\"24dp\"\n        android:height=\""
  },
  {
    "path": "app/src/main/res/drawable/ic_item_author.xml",
    "chars": 571,
    "preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:width=\"14dp\"\n        android:height=\""
  },
  {
    "path": "app/src/main/res/drawable/ic_item_label.xml",
    "chars": 457,
    "preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:width=\"13dp\"\n        android:height=\""
  },
  {
    "path": "app/src/main/res/drawable/ic_item_time.xml",
    "chars": 486,
    "preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:width=\"13dp\"\n        android:height=\""
  },
  {
    "path": "app/src/main/res/drawable/ic_loading.xml",
    "chars": 1095,
    "preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:width=\"24dp\"\n        android:height=\""
  },
  {
    "path": "app/src/main/res/drawable/ic_right.xml",
    "chars": 585,
    "preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:width=\"24dp\"\n    android:height=\"24dp\"\n  "
  },
  {
    "path": "app/src/main/res/drawable/ic_search_gank.xml",
    "chars": 538,
    "preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:width=\"24dp\"\n        android:height=\""
  },
  {
    "path": "app/src/main/res/drawable/ic_search_shortcut.xml",
    "chars": 5372,
    "preview": "<vector android:height=\"24dp\"\n        android:viewportHeight=\"1024.0\"\n        android:viewportWidth=\"1024.0\"\n        and"
  },
  {
    "path": "app/src/main/res/drawable/ic_setting.xml",
    "chars": 2078,
    "preview": "<vector android:height=\"24dp\" android:viewportHeight=\"1024.0\"\n    android:viewportWidth=\"1024.0\" android:width=\"24dp\" xm"
  },
  {
    "path": "app/src/main/res/drawable/ic_unfavorite.xml",
    "chars": 647,
    "preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:width=\"24dp\"\n        android:height=\""
  },
  {
    "path": "app/src/main/res/drawable/ic_webview_finish.xml",
    "chars": 391,
    "preview": "<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        android:width=\"24dp\"\n        android:height=\""
  },
  {
    "path": "app/src/main/res/drawable/progressbar.xml",
    "chars": 675,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <ite"
  },
  {
    "path": "app/src/main/res/drawable/selector_history_item.xml",
    "chars": 328,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <item "
  },
  {
    "path": "app/src/main/res/drawable/shape_corners_gray.xml",
    "chars": 190,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <solid an"
  },
  {
    "path": "app/src/main/res/drawable/shape_corners_stroke_gray.xml",
    "chars": 287,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <solid an"
  },
  {
    "path": "app/src/main/res/drawable/shape_corners_white.xml",
    "chars": 191,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <solid an"
  },
  {
    "path": "app/src/main/res/layout/activity_bigimg.xml",
    "chars": 2718,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<android.support.design.widget.CoordinatorLayout xmlns:android=\"http://schemas.an"
  },
  {
    "path": "app/src/main/res/layout/activity_favorite.xml",
    "chars": 1553,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmln"
  },
  {
    "path": "app/src/main/res/layout/activity_home.xml",
    "chars": 5873,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<android.support.design.widget.CoordinatorLayout xmlns:android=\"http://schemas.an"
  },
  {
    "path": "app/src/main/res/layout/activity_launcher.xml",
    "chars": 914,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<FrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n         "
  },
  {
    "path": "app/src/main/res/layout/activity_search.xml",
    "chars": 5641,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        "
  },
  {
    "path": "app/src/main/res/layout/activity_setting.xml",
    "chars": 18034,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        "
  },
  {
    "path": "app/src/main/res/layout/activity_web_view.xml",
    "chars": 3019,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<android.support.design.widget.CoordinatorLayout xmlns:android=\"http://schemas.an"
  },
  {
    "path": "app/src/main/res/layout/dialog_about.xml",
    "chars": 6840,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xm"
  },
  {
    "path": "app/src/main/res/layout/fragment.xml",
    "chars": 843,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmln"
  },
  {
    "path": "app/src/main/res/layout/item.xml",
    "chars": 3210,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmln"
  },
  {
    "path": "app/src/main/res/layout/item_favorite.xml",
    "chars": 3464,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmln"
  },
  {
    "path": "app/src/main/res/layout/item_history.xml",
    "chars": 618,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<android.support.v7.widget.AppCompatTextView\n    xmlns:android=\"http://schemas.an"
  },
  {
    "path": "app/src/main/res/layout/item_search.xml",
    "chars": 3454,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmln"
  },
  {
    "path": "app/src/main/res/layout/rv_with_footer_empty_layout.xml",
    "chars": 811,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<RelativeLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
  },
  {
    "path": "app/src/main/res/layout/rv_with_footer_loading.xml",
    "chars": 1431,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<RelativeLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
  },
  {
    "path": "app/src/main/res/menu/menu_webview.xml",
    "chars": 646,
    "preview": "<menu xmlns:android=\"http://schemas.android.com/apk/res/android\"\n      xmlns:app=\"http://schemas.android.com/apk/res-aut"
  },
  {
    "path": "app/src/main/res/values/attrs_square_loading.xml",
    "chars": 439,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <declare-styleable name=\"SquareLoading\">\n        <attr name=\"squa"
  },
  {
    "path": "app/src/main/res/values/colors.xml",
    "chars": 1329,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"colorPrimary\">#206080</color>\n    <color name=\"color"
  },
  {
    "path": "app/src/main/res/values/dimens.xml",
    "chars": 154,
    "preview": "<resources>\n    <dimen name=\"tab_text_size\">14sp</dimen>\n    <dimen name=\"fab_margin\">16dp</dimen>\n    <dimen name=\"line"
  },
  {
    "path": "app/src/main/res/values/strings.xml",
    "chars": 1586,
    "preview": "<resources>\n    <string name=\"app_name\">有干货</string>\n    <string name=\"home_search\">搜索干货(。◕∀◕。)</string>\n    <string nam"
  },
  {
    "path": "app/src/main/res/values/styles.xml",
    "chars": 2266,
    "preview": "<resources>\n\n    <!-- Base application theme. -->\n    <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">"
  },
  {
    "path": "app/src/main/res/values-v19/styles.xml",
    "chars": 614,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <!-- Base application theme. -->\n    <style name=\"AppTheme\" paren"
  },
  {
    "path": "app/src/main/res/xml/shortcuts.xml",
    "chars": 1452,
    "preview": "<shortcuts xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <!-- 从上往下的顺序  对应桌面上靠近和远离 App 启动图标的顺序 -->\n    "
  },
  {
    "path": "app/src/test/java/me/bakumon/ugank/ExampleUnitTest.java",
    "chars": 394,
    "preview": "package me.bakumon.ugank;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * Example local unit test, wh"
  },
  {
    "path": "build.gradle",
    "chars": 707,
    "preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n    r"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "chars": 233,
    "preview": "#Mon Dec 28 10:00:20 PST 2015\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_"
  },
  {
    "path": "gradle.properties",
    "chars": 904,
    "preview": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will o"
  },
  {
    "path": "gradlew",
    "chars": 4971,
    "preview": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start "
  },
  {
    "path": "gradlew.bat",
    "chars": 2314,
    "preview": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem "
  },
  {
    "path": "settings.gradle",
    "chars": 15,
    "preview": "include ':app'\n"
  }
]

// ... and 2 more files (download for full content)

About this extraction

This page contains the full source code of the Bakumon/UGank GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 133 files (387.5 KB), approximately 104.7k tokens, and a symbol index with 708 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!