├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── images ├── app_mosaic.png └── app_writer.png ├── library ├── .gitignore ├── build.gradle ├── gradle-mvn-push.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── drakeet │ │ └── about │ │ ├── AbsAboutActivity.java │ │ ├── Card.java │ │ ├── CardViewBinder.java │ │ ├── Category.java │ │ ├── CategoryViewBinder.java │ │ ├── ClickableViewHolder.java │ │ ├── Contributor.java │ │ ├── ContributorViewBinder.java │ │ ├── DividerItemDecoration.java │ │ ├── ImageLoader.java │ │ ├── License.java │ │ ├── LicenseViewBinder.java │ │ ├── Line.java │ │ ├── LineViewBinder.java │ │ ├── OnContributorClickedListener.java │ │ ├── OnRecommendationClickedListener.java │ │ ├── Recommendation.java │ │ ├── RecommendationViewBinder.java │ │ └── provided │ │ ├── GlideImageLoader.java │ │ └── PicassoImageLoader.java │ └── res │ ├── drawable-v21 │ └── about_page_card.xml │ ├── drawable │ └── about_page_card.xml │ ├── layout │ ├── about_page_dialog_market_chooser.xml │ ├── about_page_item_card.xml │ ├── about_page_item_category.xml │ ├── about_page_item_contributor.xml │ ├── about_page_item_license.xml │ ├── about_page_item_line.xml │ ├── about_page_item_recommendation.xml │ └── about_page_main_activity.xml │ ├── values-es │ └── strings.xml │ ├── values-hi │ └── strings.xml │ ├── values-ja │ └── strings.xml │ ├── values-night │ └── colors.xml │ ├── values-nl │ └── strings.xml │ ├── values-ru │ └── strings.xml │ ├── values-v27 │ └── colors.xml │ ├── values-zh-rCN │ └── strings.xml │ ├── values-zh-rHK │ └── strings.xml │ ├── values-zh-rTW │ └── strings.xml │ └── values │ ├── attrs.xml │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── sample ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── drakeet │ │ └── about │ │ └── sample │ │ └── AboutActivity.java │ └── res │ ├── drawable │ └── avatar_drakeet.png │ ├── layout │ └── activity_main.xml │ ├── menu │ └── menu_about.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ └── ic_launcher.png │ ├── values-night │ ├── bools.xml │ └── colors.xml │ ├── values-w820dp │ └── dimens.xml │ ├── values-zh │ └── strings.xml │ └── values │ ├── bools.xml │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.ap_ 3 | 4 | # files for the dex VM 5 | *.dex 6 | 7 | # Java class files 8 | *.class 9 | 10 | # generated files 11 | bin/ 12 | gen/ 13 | 14 | # Local configuration file (sdk path, etc) 15 | local.properties 16 | 17 | # Proguard folder generated by Eclipse 18 | proguard/ 19 | 20 | # Ignore gradle files 21 | .gradle/ 22 | build/ 23 | 24 | # Eclipse project files 25 | .classpath 26 | .project 27 | .settings/ 28 | 29 | # Intellij project files 30 | *.iml 31 | *.ipr 32 | *.iws 33 | .idea/ 34 | 35 | # Mac system files 36 | .DS_Store 37 | 38 | *.keystore 39 | 40 | drag_handle -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | jdk: oraclejdk8 3 | 4 | env: 5 | global: 6 | - ANDROID_TARGET=android-28 7 | - ANDROID_ABI=armeabi-v7a 8 | 9 | android: 10 | components: 11 | - tools 12 | - android-22 13 | - $ANDROID_TARGET 14 | - sys-img-armeabi-v7a-android-22 15 | - extra-android-m2repository 16 | - extra-android-support 17 | - extra 18 | licenses: 19 | - android-sdk-license-.+ 20 | 21 | before_install: 22 | - mkdir "$ANDROID_HOME/licenses" || true 23 | - echo "d56f5187479451eabf01fb78af6dfcb131a6481e" > "$ANDROID_HOME/licenses/android-sdk-license" 24 | 25 | before_script: 26 | - chmod +x gradlew 27 | - echo no | android create avd --force -n test -t android-22 --abi $ANDROID_ABI 28 | - emulator -avd test -no-window & 29 | - android-wait-for-emulator 30 | - adb shell input keyevent 82 & 31 | 32 | script: 33 | - ./gradlew clean connectedAndroidTest 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # about-page 2 | 3 | [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/drakeet/about-page/blob/master/LICENSE) 4 | ![maven-central](https://img.shields.io/maven-central/v/com.drakeet.about/about.svg) 5 | 6 | A nice about page based on [MultiType](https://github.com/drakeet/MultiType), material design and very easy to use. 7 | 8 | From the [PureWriter](https://play.google.com/store/apps/details?id=com.drakeet.purewriter) App: 9 | 10 | Get it on Google Play 11 | 12 | ### Getting started 13 | 14 | In your `build.gradle`: 15 | 16 | _This library has been rebuilt based on AndroidX. If you are still using the android support library, please use version `about:2.1.1` and `multitype:3.4.4`._ 17 | 18 | _In addition, since 2.3.0 we have migrated to build with MultiType 4.0.0. If you don't want to use MultiType 4.0.0, you can use the last stable version `multitype:3.5.0`(`me.drakeet.multitype:multitype:3.5.0`) & `about:2.2.0`(`me.drakeet.support:about:2.2.0`)._ 19 | 20 | ```groovy 21 | dependencies { 22 | implementation 'com.drakeet.about:about:2.5.2' 23 | implementation 'com.drakeet.multitype:multitype:4.3.0' 24 | 25 | // optional: for using the PicassoImageLoader 26 | // implementation 'com.squareup.picasso:picasso:2.71828' 27 | // optional: for using the GlideImageLoader 28 | // implementation 'com.github.bumptech.glide:glide:4.9.0' 29 | } 30 | ``` 31 | 32 | ### Usage 33 | 34 | ```java 35 | public class AboutActivity extends AbsAboutActivity { 36 | 37 | @Override 38 | protected void onCreateHeader(@NonNull ImageView icon, @NonNull TextView slogan, @NonNull TextView version) { 39 | icon.setImageResource(R.mipmap.ic_launcher); 40 | slogan.setText("About Page By drakeet"); 41 | version.setText("v" + BuildConfig.VERSION_NAME); 42 | } 43 | 44 | @Override 45 | protected void onItemsCreated(@NonNull List items) { 46 | items.add(new Category("介绍与帮助")); 47 | items.add(new Card(getString(R.string.card_content))); 48 | 49 | items.add(new Category("Developers")); 50 | items.add(new Contributor(R.drawable.avatar_drakeet, "drakeet", "Developer & designer", "http://weibo.com/drak11t")); 51 | items.add(new Contributor(R.drawable.avatar_drakeet, "黑猫酱", "Developer", "https://drakeet.me")); 52 | items.add(new Contributor(R.drawable.avatar_drakeet, "小艾大人", "Developer")); 53 | 54 | items.add(new Category("Open Source Licenses")); 55 | items.add(new License("MultiType", "drakeet", License.APACHE_2, "https://github.com/drakeet/MultiType")); 56 | items.add(new License("about-page", "drakeet", License.APACHE_2, "https://github.com/drakeet/about-page")); 57 | } 58 | } 59 | ``` 60 | 61 | ### Custom style/theme 62 | 63 | ```xml 64 | 75 | ``` 76 | 77 | ### Screenshots 78 | 79 | 80 | 81 | License 82 | ------- 83 | 84 | Copyright (c) 2016-present. Drakeet Xu 85 | 86 | Licensed under the Apache License, Version 2.0 (the "License"); 87 | you may not use this file except in compliance with the License. 88 | You may obtain a copy of the License at 89 | 90 | http://www.apache.org/licenses/LICENSE-2.0 91 | 92 | Unless required by applicable law or agreed to in writing, software 93 | distributed under the License is distributed on an "AS IS" BASIS, 94 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 95 | See the License for the specific language governing permissions and 96 | limitations under the License. 97 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | dependencies { 7 | classpath 'com.android.tools.build:gradle:3.5.4' 8 | } 9 | } 10 | 11 | subprojects { 12 | afterEvaluate { 13 | if (plugins.hasPlugin('com.android.library')) { 14 | // TODO replace with https://issuetracker.google.com/issues/72050365 once released. 15 | project.android.libraryVariants.all { 16 | it.generateBuildConfig.enabled = false 17 | } 18 | } 19 | } 20 | } 21 | 22 | allprojects { 23 | repositories { 24 | google() 25 | jcenter() 26 | } 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | android.enableJetifier=true 13 | android.useAndroidX=true 14 | org.gradle.jvmargs=-Xmx1536m 15 | 16 | # When configured, Gradle will run in incubating parallel mode. 17 | # This option should only be used with decoupled projects. More details, visit 18 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 19 | # org.gradle.parallel=true 20 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureWriter/about-page/4e756d21f7e789174f6d83a5bff95a761d20d7cf/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=$((i+1)) 158 | done 159 | case $i in 160 | (0) set -- ;; 161 | (1) set -- "$args0" ;; 162 | (2) set -- "$args0" "$args1" ;; 163 | (3) set -- "$args0" "$args1" "$args2" ;; 164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=$(save "$@") 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 185 | cd "$(dirname "$0")" 186 | fi 187 | 188 | exec "$JAVACMD" "$@" 189 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /images/app_mosaic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureWriter/about-page/4e756d21f7e789174f6d83a5bff95a761d20d7cf/images/app_mosaic.png -------------------------------------------------------------------------------- /images/app_writer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureWriter/about-page/4e756d21f7e789174f6d83a5bff95a761d20d7cf/images/app_writer.png -------------------------------------------------------------------------------- /library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply from: './gradle-mvn-push.gradle' 3 | apply plugin: 'jacoco' 4 | 5 | android { 6 | compileSdkVersion 30 7 | resourcePrefix "about_page" 8 | 9 | defaultConfig { 10 | minSdkVersion 14 11 | targetSdkVersion 30 12 | versionCode 84 13 | versionName "2.5.2" 14 | 15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 16 | } 17 | 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | consumerProguardFile 'proguard-rules.pro' 22 | } 23 | } 24 | } 25 | 26 | dependencies { 27 | androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0-beta02', { 28 | exclude group: 'com.android.support', module: 'support-annotations' 29 | }) 30 | implementation 'androidx.appcompat:appcompat:1.3.1' 31 | implementation 'androidx.recyclerview:recyclerview:1.2.1' 32 | implementation 'com.google.android.material:material:1.4.0' 33 | implementation 'com.drakeet.multitype:multitype:4.3.0' 34 | compileOnly 'com.squareup.picasso:picasso:2.71828' 35 | compileOnly 'com.github.bumptech.glide:glide:4.13.1' 36 | testImplementation 'junit:junit:4.12' 37 | } 38 | -------------------------------------------------------------------------------- /library/gradle-mvn-push.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Chris Banes 3 | * Copyright 2016 drakeet 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | apply plugin: 'maven' 19 | apply plugin: 'signing' 20 | 21 | def isReleaseBuild() { 22 | return VERSION_NAME.contains("SNAPSHOT") == false 23 | } 24 | 25 | def getReleaseRepositoryUrl() { 26 | return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL : 27 | "https://oss.sonatype.org/service/local/staging/deploy/maven2/" 28 | } 29 | 30 | def getSnapshotRepositoryUrl() { 31 | return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL : 32 | "https://oss.sonatype.org/content/repositories/snapshots/" 33 | } 34 | 35 | def getRepositoryUsername() { 36 | return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "" 37 | } 38 | 39 | def getRepositoryPassword() { 40 | return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "" 41 | } 42 | 43 | afterEvaluate { project -> 44 | uploadArchives { 45 | repositories { 46 | mavenDeployer { 47 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } 48 | 49 | pom.groupId = GROUP 50 | pom.artifactId = POM_ARTIFACT_ID 51 | pom.version = VERSION_NAME 52 | 53 | repository(url: getReleaseRepositoryUrl()) { 54 | authentication(userName: getRepositoryUsername(), 55 | password: getRepositoryPassword()) 56 | } 57 | snapshotRepository(url: getSnapshotRepositoryUrl()) { 58 | authentication(userName: getRepositoryUsername(), 59 | password: getRepositoryPassword()) 60 | } 61 | 62 | pom.project { 63 | name POM_NAME 64 | packaging POM_PACKAGING 65 | description POM_DESCRIPTION 66 | url POM_URL 67 | 68 | scm { 69 | url POM_SCM_URL 70 | connection POM_SCM_CONNECTION 71 | developerConnection POM_SCM_DEV_CONNECTION 72 | } 73 | 74 | licenses { 75 | license { 76 | name POM_LICENCE_NAME 77 | url POM_LICENCE_URL 78 | distribution POM_LICENCE_DIST 79 | } 80 | } 81 | 82 | developers { 83 | developer { 84 | id POM_DEVELOPER_ID 85 | name POM_DEVELOPER_NAME 86 | } 87 | } 88 | } 89 | } 90 | } 91 | } 92 | 93 | signing { 94 | required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } 95 | sign configurations.archives 96 | } 97 | 98 | android.libraryVariants.all { variant -> 99 | task("${variant.name}Javadoc", type: Javadoc) { 100 | description "Generates Javadoc for $variant.name." 101 | source = variant.javaCompile.source 102 | classpath = files(variant.javaCompile.classpath.files, 103 | project.android.getBootClasspath()) 104 | exclude '**/BuildConfig.java' 105 | exclude '**/R.java' 106 | } 107 | } 108 | 109 | task javadocJar(type: Jar, dependsOn: 'releaseJavadoc') { 110 | classifier = 'javadoc' 111 | from { 112 | releaseJavadoc.destinationDir 113 | } 114 | } 115 | 116 | task androidSourcesJar(type: Jar) { 117 | classifier = 'sources' 118 | from android.sourceSets.main.java.sourceFiles 119 | } 120 | 121 | artifacts { 122 | archives androidSourcesJar 123 | archives javadocJar 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /library/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2016 drakeet. https://github.com/drakeet 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # Project-wide Gradle settings. 18 | 19 | # IDE (e.g. Android Studio) users: 20 | # Settings specified in this file will override any Gradle settings 21 | # configured through the IDE. 22 | 23 | # For more details on how to configure your build environment visit 24 | # http://www.gradle.org/docs/current/userguide/build_environment.html 25 | 26 | # Specifies the JVM arguments used for the daemon process. 27 | # The setting is particularly useful for tweaking memory settings. 28 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 29 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 30 | 31 | # When configured, Gradle will run in incubating parallel mode. 32 | # This option should only be used with decoupled projects. More details, visit 33 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 34 | # org.gradle.parallel=true https://github.com/drakeet 35 | 36 | POM_NAME=about-page 37 | POM_ARTIFACT_ID=about 38 | POM_PACKAGING=aar 39 | 40 | VERSION_NAME=2.5.2 41 | VERSION_CODE=83 42 | GROUP=com.drakeet.about 43 | 44 | POM_DESCRIPTION=A nice and easy about page library. 45 | POM_URL=https://github.com/PureWriter/about-page 46 | POM_SCM_URL=https://github.com/PureWriter/about-page 47 | POM_SCM_CONNECTION=scm:git@github.com:PureWriter/about-page.git 48 | POM_SCM_DEV_CONNECTION=scm:git@github.com:PureWriter/about-page.git 49 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 50 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 51 | POM_LICENCE_DIST=repo 52 | POM_DEVELOPER_ID=drakeet 53 | POM_DEVELOPER_NAME=Drakeet Xu 54 | POM_DEVELOPER_URL=https://writer.drakeet.com 55 | -------------------------------------------------------------------------------- /library/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # for provided glide 2 | -keep public class * implements com.bumptech.glide.module.GlideModule 3 | -keep public class * extends com.bumptech.glide.module.AppGlideModule 4 | -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** { 5 | **[] $VALUES; 6 | public *; 7 | } 8 | -keep class com.drakeet.about.Recommendation 9 | -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/AbsAboutActivity.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about; 2 | 3 | import android.content.res.TypedArray; 4 | import android.graphics.drawable.Drawable; 5 | import android.os.Build; 6 | import android.os.Bundle; 7 | import android.view.MenuItem; 8 | import android.view.View; 9 | import android.view.Window; 10 | import android.widget.ImageView; 11 | import android.widget.LinearLayout; 12 | import android.widget.TextView; 13 | import androidx.annotation.ColorInt; 14 | import androidx.annotation.DrawableRes; 15 | import androidx.annotation.LayoutRes; 16 | import androidx.annotation.NonNull; 17 | import androidx.annotation.Nullable; 18 | import androidx.annotation.RequiresApi; 19 | import androidx.appcompat.app.ActionBar; 20 | import androidx.appcompat.app.AppCompatActivity; 21 | import androidx.appcompat.widget.Toolbar; 22 | import androidx.core.content.ContextCompat; 23 | import androidx.core.graphics.Insets; 24 | import androidx.core.view.OnApplyWindowInsetsListener; 25 | import androidx.core.view.ViewCompat; 26 | import androidx.core.view.WindowCompat; 27 | import androidx.core.view.WindowInsetsCompat; 28 | import androidx.recyclerview.widget.RecyclerView; 29 | import com.drakeet.multitype.MultiTypeAdapter; 30 | import com.google.android.material.appbar.AppBarLayout; 31 | import com.google.android.material.appbar.CollapsingToolbarLayout; 32 | import java.util.ArrayList; 33 | import java.util.List; 34 | 35 | /** 36 | * @author drakeet 37 | */ 38 | public abstract class AbsAboutActivity extends AppCompatActivity { 39 | 40 | private Toolbar toolbar; 41 | private CollapsingToolbarLayout collapsingToolbar; 42 | private LinearLayout headerContentLayout; 43 | 44 | private List items; 45 | private MultiTypeAdapter adapter; 46 | private TextView slogan, version; 47 | private RecyclerView recyclerView; 48 | private @Nullable ImageLoader imageLoader; 49 | private boolean initialized; 50 | private @Nullable OnRecommendationClickedListener onRecommendationClickedListener; 51 | private @Nullable OnContributorClickedListener onContributorClickedListener; 52 | 53 | protected abstract void onCreateHeader(@NonNull ImageView icon, @NonNull TextView slogan, @NonNull TextView version); 54 | protected abstract void onItemsCreated(@NonNull List items); 55 | 56 | protected void onTitleViewCreated(@NonNull CollapsingToolbarLayout collapsingToolbar) {} 57 | 58 | public void setImageLoader(@NonNull ImageLoader imageLoader) { 59 | this.imageLoader = imageLoader; 60 | if (initialized) { 61 | adapter.notifyDataSetChanged(); 62 | } 63 | } 64 | 65 | public @Nullable ImageLoader getImageLoader() { 66 | return imageLoader; 67 | } 68 | 69 | @LayoutRes 70 | protected int layoutRes() { 71 | return R.layout.about_page_main_activity; 72 | } 73 | 74 | @Override 75 | protected void onCreate(Bundle savedInstanceState) { 76 | super.onCreate(savedInstanceState); 77 | setContentView(layoutRes()); 78 | toolbar = findViewById(R.id.toolbar); 79 | ImageView icon = findViewById(R.id.icon); 80 | slogan = findViewById(R.id.slogan); 81 | version = findViewById(R.id.version); 82 | collapsingToolbar = findViewById(R.id.collapsing_toolbar); 83 | headerContentLayout = findViewById(R.id.header_content_layout); 84 | onTitleViewCreated(collapsingToolbar); 85 | onCreateHeader(icon, slogan, version); 86 | 87 | setSupportActionBar(toolbar); 88 | ActionBar actionBar = getSupportActionBar(); 89 | if (actionBar != null) { 90 | actionBar.setDisplayHomeAsUpEnabled(true); 91 | actionBar.setDisplayShowHomeEnabled(true); 92 | } 93 | onApplyPresetAttrs(); 94 | recyclerView = findViewById(R.id.list); 95 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 96 | applyEdgeToEdge(); 97 | } 98 | } 99 | 100 | private boolean givenInsetsToDecorView = false; 101 | 102 | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) 103 | private void applyEdgeToEdge() { 104 | Window window = getWindow(); 105 | int navigationBarColor = ContextCompat.getColor(this, R.color.about_page_navigationBarColor); 106 | window.setNavigationBarColor(navigationBarColor); 107 | 108 | final AppBarLayout appBarLayout = findViewById(R.id.header_layout); 109 | final View decorView = window.getDecorView(); 110 | final int originalRecyclerViewPaddingBottom =recyclerView.getPaddingBottom(); 111 | 112 | givenInsetsToDecorView = false; 113 | WindowCompat.setDecorFitsSystemWindows(window, false); 114 | ViewCompat.setOnApplyWindowInsetsListener(decorView, new OnApplyWindowInsetsListener() { 115 | @Override 116 | public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat windowInsets) { 117 | Insets navigationBarsInsets = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars()); 118 | boolean isGestureNavigation = navigationBarsInsets.bottom <= 24 * getResources().getDisplayMetrics().density; 119 | 120 | if (!isGestureNavigation) { 121 | ViewCompat.onApplyWindowInsets(decorView, windowInsets); 122 | givenInsetsToDecorView = true; 123 | } else if (givenInsetsToDecorView) { 124 | ViewCompat.onApplyWindowInsets( 125 | decorView, 126 | new WindowInsetsCompat.Builder() 127 | .setInsets( 128 | WindowInsetsCompat.Type.navigationBars(), 129 | Insets.of(navigationBarsInsets.left, navigationBarsInsets.top, navigationBarsInsets.right, 0) 130 | ) 131 | .build() 132 | ); 133 | } 134 | decorView.setPadding(windowInsets.getSystemWindowInsetLeft(), decorView.getPaddingTop(), windowInsets.getSystemWindowInsetRight(), decorView.getPaddingBottom()); 135 | appBarLayout.setPadding(appBarLayout.getPaddingLeft(), windowInsets.getSystemWindowInsetTop(), appBarLayout.getPaddingRight(), appBarLayout.getPaddingBottom()); 136 | recyclerView.setPadding(recyclerView.getPaddingLeft(), recyclerView.getPaddingTop(), recyclerView.getPaddingRight(), originalRecyclerViewPaddingBottom + navigationBarsInsets.bottom); 137 | return windowInsets; 138 | } 139 | }); 140 | } 141 | 142 | @Override @SuppressWarnings("deprecation") 143 | protected void onPostCreate(@Nullable Bundle savedInstanceState) { 144 | super.onPostCreate(savedInstanceState); 145 | adapter = new MultiTypeAdapter(); 146 | adapter.register(Category.class, new CategoryViewBinder()); 147 | adapter.register(Card.class, new CardViewBinder()); 148 | adapter.register(Line.class, new LineViewBinder()); 149 | adapter.register(Contributor.class, new ContributorViewBinder(this)); 150 | adapter.register(License.class, new LicenseViewBinder()); 151 | adapter.register(Recommendation.class, new RecommendationViewBinder(this)); 152 | items = new ArrayList<>(); 153 | onItemsCreated(items); 154 | adapter.setItems(items); 155 | adapter.setHasStableIds(true); 156 | recyclerView.addItemDecoration(new DividerItemDecoration(adapter)); 157 | recyclerView.setAdapter(adapter); 158 | initialized = true; 159 | } 160 | 161 | private void onApplyPresetAttrs() { 162 | final TypedArray a = obtainStyledAttributes(R.styleable.AbsAboutActivity); 163 | Drawable headerBackground = a.getDrawable(R.styleable.AbsAboutActivity_aboutPageHeaderBackground); 164 | if (headerBackground != null) { 165 | setHeaderBackground(headerBackground); 166 | } 167 | Drawable headerContentScrim = a.getDrawable(R.styleable.AbsAboutActivity_aboutPageHeaderContentScrim); 168 | if (headerContentScrim != null) { 169 | setHeaderContentScrim(headerContentScrim); 170 | } 171 | @ColorInt 172 | int headerTextColor = a.getColor(R.styleable.AbsAboutActivity_aboutPageHeaderTextColor, -1); 173 | if (headerTextColor != -1) { 174 | setHeaderTextColor(headerTextColor); 175 | } 176 | Drawable navigationIcon = a.getDrawable(R.styleable.AbsAboutActivity_aboutPageNavigationIcon); 177 | if (navigationIcon != null) { 178 | setNavigationIcon(navigationIcon); 179 | } 180 | a.recycle(); 181 | } 182 | 183 | /** 184 | * Use {@link #setHeaderBackground(int)} instead. 185 | * 186 | * @param resId The resource id of header background 187 | */ 188 | @Deprecated 189 | public void setHeaderBackgroundResource(@DrawableRes int resId) { 190 | setHeaderBackground(resId); 191 | } 192 | 193 | public void setHeaderBackground(@DrawableRes int resId) { 194 | setHeaderBackground(ContextCompat.getDrawable(this, resId)); 195 | } 196 | 197 | public void setHeaderBackground(@NonNull Drawable drawable) { 198 | ViewCompat.setBackground(headerContentLayout, drawable); 199 | } 200 | 201 | /** 202 | * Set the drawable to use for the content scrim from resources. Providing null will disable 203 | * the scrim functionality. 204 | * 205 | * @param drawable the drawable to display 206 | */ 207 | public void setHeaderContentScrim(@NonNull Drawable drawable) { 208 | collapsingToolbar.setContentScrim(drawable); 209 | } 210 | 211 | public void setHeaderContentScrim(@DrawableRes int resId) { 212 | setHeaderContentScrim(ContextCompat.getDrawable(this, resId)); 213 | } 214 | 215 | public void setHeaderTextColor(@ColorInt int color) { 216 | collapsingToolbar.setCollapsedTitleTextColor(color); 217 | slogan.setTextColor(color); 218 | version.setTextColor(color); 219 | } 220 | 221 | /** 222 | * Set the icon to use for the toolbar's navigation button. 223 | * 224 | * @param resId Resource ID of a drawable to set 225 | */ 226 | public void setNavigationIcon(@DrawableRes int resId) { 227 | toolbar.setNavigationIcon(resId); 228 | } 229 | 230 | public void setNavigationIcon(@NonNull Drawable drawable) { 231 | toolbar.setNavigationIcon(drawable); 232 | } 233 | 234 | @Override 235 | public boolean onOptionsItemSelected(MenuItem menuItem) { 236 | if (menuItem.getItemId() == android.R.id.home) { 237 | onBackPressed(); 238 | } 239 | return super.onOptionsItemSelected(menuItem); 240 | } 241 | 242 | @Override 243 | public void setTitle(@NonNull CharSequence title) { 244 | collapsingToolbar.setTitle(title); 245 | } 246 | 247 | public Toolbar getToolbar() { 248 | return toolbar; 249 | } 250 | 251 | public CollapsingToolbarLayout getCollapsingToolbar() { 252 | return collapsingToolbar; 253 | } 254 | 255 | public List getItems() { 256 | return items; 257 | } 258 | 259 | public MultiTypeAdapter getAdapter() { 260 | return adapter; 261 | } 262 | 263 | public TextView getSloganTextView() { 264 | return slogan; 265 | } 266 | 267 | public TextView getVersionTextView() { 268 | return version; 269 | } 270 | 271 | public void setOnRecommendationClickedListener(@Nullable OnRecommendationClickedListener listener) { 272 | this.onRecommendationClickedListener = listener; 273 | } 274 | 275 | public @Nullable OnRecommendationClickedListener getOnRecommendationClickedListener() { 276 | return onRecommendationClickedListener; 277 | } 278 | 279 | public void setOnContributorClickedListener(@Nullable OnContributorClickedListener listener) { 280 | this.onContributorClickedListener = listener; 281 | } 282 | 283 | public @Nullable OnContributorClickedListener getOnContributorClickedListener() { 284 | return onContributorClickedListener; 285 | } 286 | } 287 | -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/Card.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about; 2 | 3 | import android.annotation.SuppressLint; 4 | import androidx.annotation.NonNull; 5 | import androidx.annotation.RequiresApi; 6 | 7 | /** 8 | * @author drakeet 9 | */ 10 | public class Card { 11 | 12 | public @NonNull final CharSequence content; 13 | 14 | public final int lineSpacingExtra; 15 | 16 | @SuppressLint("NewApi") 17 | public Card(@NonNull CharSequence content) { 18 | this(content, 0); 19 | } 20 | 21 | @RequiresApi(16) 22 | public Card(@NonNull CharSequence content, int lineSpacingExtra) { 23 | this.content = content; 24 | this.lineSpacingExtra = lineSpacingExtra; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/CardViewBinder.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about; 2 | 3 | import android.os.Build; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.TextView; 8 | import androidx.annotation.NonNull; 9 | import androidx.recyclerview.widget.RecyclerView; 10 | import com.drakeet.multitype.ItemViewBinder; 11 | 12 | /** 13 | * @author drakeet 14 | */ 15 | @SuppressWarnings("WeakerAccess") 16 | public class CardViewBinder extends ItemViewBinder { 17 | 18 | @Override @NonNull 19 | public ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) { 20 | return new ViewHolder(inflater.inflate(R.layout.about_page_item_card, parent, false)); 21 | } 22 | 23 | @Override 24 | public void onBindViewHolder(@NonNull ViewHolder holder, @NonNull Card card) { 25 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { 26 | holder.content.setLineSpacing(card.lineSpacingExtra, holder.content.getLineSpacingMultiplier()); 27 | } 28 | holder.content.setText(card.content); 29 | } 30 | 31 | @Override 32 | public long getItemId(@NonNull Card item) { 33 | return item.hashCode(); 34 | } 35 | 36 | public static class ViewHolder extends RecyclerView.ViewHolder { 37 | 38 | public TextView content; 39 | 40 | public ViewHolder(View itemView) { 41 | super(itemView); 42 | content = itemView.findViewById(R.id.content); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/Category.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about; 2 | 3 | import android.graphics.drawable.Drawable; 4 | import android.view.View; 5 | import androidx.annotation.NonNull; 6 | import androidx.annotation.Nullable; 7 | 8 | /** 9 | * @author drakeet 10 | */ 11 | public class Category { 12 | 13 | public @NonNull final String title; 14 | public @Nullable final Drawable actionIcon; 15 | public @Nullable final String actionIconContentDescription; 16 | private @Nullable View.OnClickListener onActionClickListener; 17 | 18 | public Category(@NonNull String title) { 19 | this(title, null, null); 20 | } 21 | 22 | public Category(@NonNull String title, @Nullable Drawable actionIcon) { 23 | this(title, actionIcon, null); 24 | } 25 | 26 | public Category(@NonNull String title, @Nullable Drawable actionIcon, @Nullable String actionIconContentDescription) { 27 | this.title = title; 28 | this.actionIcon = actionIcon; 29 | this.actionIconContentDescription = actionIconContentDescription; 30 | } 31 | 32 | public void setOnActionClickListener(@Nullable View.OnClickListener onActionClickListener) { 33 | this.onActionClickListener = onActionClickListener; 34 | } 35 | 36 | @Nullable 37 | public View.OnClickListener getOnActionClickListener() { 38 | return onActionClickListener; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/CategoryViewBinder.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about; 2 | 3 | import android.view.LayoutInflater; 4 | import android.view.View; 5 | import android.view.ViewGroup; 6 | import android.widget.ImageButton; 7 | import android.widget.TextView; 8 | import androidx.annotation.NonNull; 9 | import androidx.recyclerview.widget.RecyclerView; 10 | import com.drakeet.multitype.ItemViewBinder; 11 | 12 | /** 13 | * @author drakeet 14 | */ 15 | @SuppressWarnings("WeakerAccess") 16 | public class CategoryViewBinder extends ItemViewBinder { 17 | 18 | @Override @NonNull 19 | public ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) { 20 | return new ViewHolder(inflater.inflate(R.layout.about_page_item_category, parent, false)); 21 | } 22 | 23 | @Override 24 | public void onBindViewHolder(@NonNull ViewHolder holder, @NonNull Category category) { 25 | holder.category.setText(category.title); 26 | holder.actionIcon.setImageDrawable(category.actionIcon); 27 | holder.actionIcon.setContentDescription(category.actionIconContentDescription); 28 | if (category.actionIcon != null) { 29 | holder.actionIcon.setVisibility(View.VISIBLE); 30 | } else { 31 | holder.actionIcon.setVisibility(View.GONE); 32 | } 33 | holder.actionIcon.setOnClickListener(category.getOnActionClickListener()); 34 | } 35 | 36 | @Override 37 | public long getItemId(@NonNull Category item) { 38 | return item.hashCode(); 39 | } 40 | 41 | public static class ViewHolder extends RecyclerView.ViewHolder { 42 | 43 | public TextView category; 44 | public ImageButton actionIcon; 45 | 46 | public ViewHolder(View itemView) { 47 | super(itemView); 48 | category = itemView.findViewById(R.id.category); 49 | actionIcon = itemView.findViewById(R.id.actionIcon); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/ClickableViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about; 2 | 3 | import android.content.ActivityNotFoundException; 4 | import android.content.Intent; 5 | import android.view.View; 6 | import androidx.annotation.Nullable; 7 | import androidx.recyclerview.widget.RecyclerView; 8 | 9 | import static android.net.Uri.parse; 10 | 11 | /** 12 | * @author drakeet 13 | */ 14 | public class ClickableViewHolder extends RecyclerView.ViewHolder { 15 | 16 | private @Nullable String url; 17 | 18 | public ClickableViewHolder(View itemView) { 19 | super(itemView); 20 | itemView.setOnClickListener(new View.OnClickListener() { 21 | @Override public void onClick(View v) { 22 | if (url != null) { 23 | Intent intent = new Intent(Intent.ACTION_VIEW); 24 | intent.setData(parse(url)); 25 | try { 26 | v.getContext().startActivity(intent); 27 | } catch (ActivityNotFoundException e) { 28 | e.printStackTrace(); 29 | } 30 | } 31 | } 32 | }); 33 | } 34 | 35 | public void setURL(@Nullable String url) { 36 | this.url = url; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/Contributor.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about; 2 | 3 | import androidx.annotation.DrawableRes; 4 | import androidx.annotation.NonNull; 5 | import androidx.annotation.Nullable; 6 | 7 | /** 8 | * @author drakeet 9 | */ 10 | public class Contributor { 11 | 12 | public @DrawableRes final int avatarResId; 13 | public @NonNull final String name; 14 | public @NonNull final String desc; 15 | public @Nullable String url; 16 | 17 | public Contributor(@DrawableRes int avatarResId, @NonNull String name, @NonNull String desc) { 18 | this(avatarResId, name, desc, null); 19 | } 20 | 21 | public Contributor( 22 | @DrawableRes int avatarResId, 23 | @NonNull String name, 24 | @NonNull String desc, 25 | @Nullable String url) { 26 | 27 | this.avatarResId = avatarResId; 28 | this.name = name; 29 | this.desc = desc; 30 | this.url = url; 31 | } 32 | } -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/ContributorViewBinder.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about; 2 | 3 | import android.content.ActivityNotFoundException; 4 | import android.content.Intent; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | import androidx.annotation.NonNull; 11 | import androidx.recyclerview.widget.RecyclerView; 12 | import com.drakeet.multitype.ItemViewBinder; 13 | 14 | import static android.net.Uri.parse; 15 | 16 | /** 17 | * @author drakeet 18 | */ 19 | @SuppressWarnings("WeakerAccess") 20 | public class ContributorViewBinder extends ItemViewBinder { 21 | 22 | private @NonNull final AbsAboutActivity activity; 23 | 24 | public ContributorViewBinder(@NonNull AbsAboutActivity activity) { 25 | this.activity = activity; 26 | } 27 | 28 | @Override @NonNull 29 | public ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) { 30 | return new ViewHolder(inflater.inflate(R.layout.about_page_item_contributor, parent, false), activity); 31 | } 32 | 33 | @Override 34 | public void onBindViewHolder(@NonNull ViewHolder holder, @NonNull Contributor contributor) { 35 | holder.avatar.setImageResource(contributor.avatarResId); 36 | holder.name.setText(contributor.name); 37 | holder.desc.setText(contributor.desc); 38 | holder.data = contributor; 39 | } 40 | 41 | @Override 42 | public long getItemId(@NonNull Contributor item) { 43 | return item.hashCode(); 44 | } 45 | 46 | public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { 47 | 48 | public ImageView avatar; 49 | public TextView name; 50 | public TextView desc; 51 | public Contributor data; 52 | protected @NonNull final AbsAboutActivity activity; 53 | 54 | public ViewHolder(View itemView, @NonNull AbsAboutActivity activity) { 55 | super(itemView); 56 | this.activity = activity; 57 | avatar = itemView.findViewById(R.id.avatar); 58 | name = itemView.findViewById(R.id.name); 59 | desc = itemView.findViewById(R.id.desc); 60 | itemView.setOnClickListener(this); 61 | } 62 | 63 | @Override 64 | public void onClick(View v) { 65 | OnContributorClickedListener listener = activity.getOnContributorClickedListener(); 66 | if (listener != null && listener.onContributorClicked(v, data)) { 67 | return; 68 | } 69 | if (data.url != null) { 70 | Intent intent = new Intent(Intent.ACTION_VIEW); 71 | intent.setData(parse(data.url)); 72 | try { 73 | v.getContext().startActivity(intent); 74 | } catch (ActivityNotFoundException e) { 75 | e.printStackTrace(); 76 | } 77 | } 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/DividerItemDecoration.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about; 2 | 3 | import android.graphics.Rect; 4 | import android.view.View; 5 | import androidx.annotation.NonNull; 6 | import androidx.recyclerview.widget.RecyclerView; 7 | import java.util.List; 8 | import com.drakeet.multitype.MultiTypeAdapter; 9 | 10 | /** 11 | * @author drakeet 12 | */ 13 | class DividerItemDecoration extends RecyclerView.ItemDecoration { 14 | 15 | private final @NonNull MultiTypeAdapter adapter; 16 | private final Class[] dividerClasses = { License.class, Recommendation.class }; 17 | 18 | /** 19 | * Creates a divider {@link RecyclerView.ItemDecoration} that can be used with a 20 | * {@link LinearLayoutManager}. 21 | * 22 | * @param adapter The MultiTypeAdapter 23 | */ 24 | DividerItemDecoration(@NonNull MultiTypeAdapter adapter) { 25 | this.adapter = adapter; 26 | } 27 | 28 | @Override 29 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { 30 | if (adapter.getItemCount() == 0) { 31 | outRect.set(0, 0, 0, 0); 32 | return; 33 | } 34 | List items = adapter.getItems(); 35 | int position = parent.getChildAdapterPosition(view); 36 | boolean should = false; 37 | for (int i = 0; !should && i < dividerClasses.length; i++) { 38 | should = position + 1 < items.size() 39 | && items.get(position).getClass().isAssignableFrom(dividerClasses[i]) 40 | && (items.get(position + 1).getClass().isAssignableFrom(dividerClasses[i])); 41 | } 42 | if (should) { 43 | outRect.set(0, 0, 0, 1); 44 | } else { 45 | outRect.set(0, 0, 0, 0); 46 | } 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/ImageLoader.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about; 2 | 3 | import androidx.annotation.NonNull; 4 | import android.widget.ImageView; 5 | 6 | /** 7 | * @author drakeet 8 | */ 9 | public interface ImageLoader { 10 | 11 | void load(@NonNull ImageView imageView, @NonNull String url); 12 | } 13 | -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/License.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about; 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | /** 6 | * @author drakeet 7 | */ 8 | public class License { 9 | 10 | public static final String MIT = "MIT License"; 11 | public static final String APACHE_2 = "Apache Software License 2.0"; 12 | public static final String GPL_V3 = "GNU general public license Version 3"; 13 | 14 | public String name; 15 | public String author; 16 | public String type; 17 | public String url; 18 | 19 | public License() {} 20 | 21 | public License(@NonNull String name, @NonNull String author, @NonNull String type, @NonNull String url) { 22 | this.name = name; 23 | this.author = author; 24 | this.type = type; 25 | this.url = url; 26 | } 27 | } -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/LicenseViewBinder.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.TextView; 8 | import androidx.annotation.NonNull; 9 | import com.drakeet.multitype.ItemViewBinder; 10 | 11 | /** 12 | * @author drakeet 13 | */ 14 | public class LicenseViewBinder extends ItemViewBinder { 15 | 16 | @Override @NonNull 17 | public ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) { 18 | return new ViewHolder(inflater.inflate(R.layout.about_page_item_license, parent, false)); 19 | } 20 | 21 | @Override @SuppressLint("SetTextI18n") 22 | public void onBindViewHolder(@NonNull ViewHolder holder, @NonNull License data) { 23 | holder.content.setText(data.name + " - " + data.author); 24 | holder.hint.setText(data.url + "\n" + data.type); 25 | holder.setURL(data.url); 26 | } 27 | 28 | @Override 29 | public long getItemId(@NonNull License item) { 30 | return item.hashCode(); 31 | } 32 | 33 | public static class ViewHolder extends ClickableViewHolder { 34 | 35 | public TextView content; 36 | public TextView hint; 37 | 38 | public ViewHolder(View itemView) { 39 | super(itemView); 40 | content = itemView.findViewById(R.id.content); 41 | hint = itemView.findViewById(R.id.hint); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/Line.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about; 2 | 3 | /** 4 | * @author drakeet 5 | * @deprecated You do not need to use Line now, 6 | * we use {@link DividerItemDecoration} to automatically generate Lines. 7 | */ 8 | @Deprecated 9 | public class Line {} 10 | -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/LineViewBinder.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about; 2 | 3 | import android.view.LayoutInflater; 4 | import android.view.View; 5 | import android.view.ViewGroup; 6 | import androidx.annotation.NonNull; 7 | import androidx.recyclerview.widget.RecyclerView; 8 | import com.drakeet.multitype.ItemViewBinder; 9 | 10 | /** 11 | * @author drakeet 12 | * @deprecated You do not need to use Line now, 13 | * we use {@link DividerItemDecoration} to automatically generate Lines. 14 | */ 15 | @Deprecated 16 | public class LineViewBinder extends ItemViewBinder { 17 | 18 | @NonNull @Override 19 | public ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) { 20 | return new ViewHolder(inflater.inflate(R.layout.about_page_item_line, parent, false)); 21 | } 22 | 23 | @Override 24 | public void onBindViewHolder(@NonNull ViewHolder holder, @NonNull Line data) {} 25 | 26 | @Override 27 | public long getItemId(@NonNull Line item) { 28 | return item.hashCode(); 29 | } 30 | 31 | public static class ViewHolder extends RecyclerView.ViewHolder { 32 | 33 | public ViewHolder(View itemView) { 34 | super(itemView); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/OnContributorClickedListener.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about; 2 | 3 | import androidx.annotation.CheckResult; 4 | import androidx.annotation.NonNull; 5 | import android.view.View; 6 | 7 | public interface OnContributorClickedListener { 8 | 9 | @CheckResult 10 | boolean onContributorClicked(@NonNull View itemView, @NonNull Contributor contributor); 11 | } 12 | -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/OnRecommendationClickedListener.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about; 2 | 3 | import androidx.annotation.CheckResult; 4 | import androidx.annotation.NonNull; 5 | import android.view.View; 6 | 7 | /** 8 | * @author drakeet 9 | */ 10 | public interface OnRecommendationClickedListener { 11 | 12 | @CheckResult 13 | boolean onRecommendationClicked(@NonNull View itemView, @NonNull Recommendation recommendation); 14 | } 15 | -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/Recommendation.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about; 2 | 3 | import androidx.annotation.Keep; 4 | import androidx.annotation.NonNull; 5 | 6 | /** 7 | * @author drakeet 8 | */ 9 | @Keep 10 | public class Recommendation { 11 | 12 | public int id; 13 | public String appName; 14 | public String iconUrl; 15 | public String packageName; 16 | public String description; 17 | public String downloadUrl; 18 | public String createdTime; 19 | public String updatedTime; 20 | public double downloadSize; 21 | public boolean openWithGooglePlay; 22 | 23 | public Recommendation() {} 24 | 25 | public Recommendation( 26 | int id, 27 | @NonNull String appName, 28 | @NonNull String iconUrl, 29 | @NonNull String packageName, 30 | @NonNull String description, 31 | @NonNull String downloadUrl, 32 | @NonNull String createdTime, 33 | @NonNull String updatedTime, 34 | double downloadSize, 35 | boolean openWithGooglePlay 36 | ) { 37 | this.id = id; 38 | this.appName = appName; 39 | this.iconUrl = iconUrl; 40 | this.packageName = packageName; 41 | this.description = description; 42 | this.downloadUrl = downloadUrl; 43 | this.createdTime = createdTime; 44 | this.updatedTime = updatedTime; 45 | this.downloadSize = downloadSize; 46 | this.openWithGooglePlay = openWithGooglePlay; 47 | } 48 | } -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/RecommendationViewBinder.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.content.ComponentName; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | import android.net.Uri; 8 | import android.util.Log; 9 | import android.view.LayoutInflater; 10 | import android.view.View; 11 | import android.view.ViewGroup; 12 | import android.widget.ImageView; 13 | import android.widget.TextView; 14 | import androidx.annotation.NonNull; 15 | import androidx.annotation.Nullable; 16 | import androidx.recyclerview.widget.RecyclerView; 17 | import com.drakeet.multitype.ItemViewBinder; 18 | import com.google.android.material.bottomsheet.BottomSheetDialog; 19 | 20 | /** 21 | * @author drakeet 22 | */ 23 | @SuppressWarnings("WeakerAccess") 24 | public class RecommendationViewBinder extends ItemViewBinder { 25 | 26 | private static final String TAG = "about-page"; 27 | 28 | private @NonNull final AbsAboutActivity activity; 29 | 30 | public RecommendationViewBinder(@NonNull AbsAboutActivity activity) { 31 | this.activity = activity; 32 | } 33 | 34 | @Override @NonNull 35 | public ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) { 36 | return new ViewHolder(inflater.inflate(R.layout.about_page_item_recommendation, parent, false), activity); 37 | } 38 | 39 | @Override 40 | public void onBindViewHolder(@NonNull ViewHolder holder, @NonNull Recommendation recommendation) { 41 | holder.setRecommendation(recommendation, activity.getImageLoader()); 42 | } 43 | 44 | @Override 45 | public long getItemId(@NonNull Recommendation item) { 46 | return item.hashCode(); 47 | } 48 | 49 | public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { 50 | 51 | public ImageView icon; 52 | public TextView name; 53 | public TextView packageName; 54 | public TextView sizeView; 55 | public TextView description; 56 | public Recommendation recommendation; 57 | private @Nullable BottomSheetDialog bottomSheet; 58 | protected @NonNull final AbsAboutActivity activity; 59 | 60 | public ViewHolder(View itemView, @NonNull AbsAboutActivity activity) { 61 | super(itemView); 62 | this.activity = activity; 63 | icon = itemView.findViewById(R.id.icon); 64 | name = itemView.findViewById(R.id.name); 65 | packageName = itemView.findViewById(R.id.packageName); 66 | sizeView = itemView.findViewById(R.id.size); 67 | description = itemView.findViewById(R.id.description); 68 | itemView.setOnClickListener(this); 69 | } 70 | 71 | @Override 72 | public void onClick(View v) { 73 | if (v.getId() == R.id.google_play && bottomSheet != null) { 74 | openWithMarket(v.getContext(), recommendation.packageName, recommendation.downloadUrl); 75 | bottomSheet.dismiss(); 76 | } else if (v.getId() == R.id.web && bottomSheet != null) { 77 | openWithWeb(v.getContext(), recommendation); 78 | bottomSheet.dismiss(); 79 | } else if (recommendation != null) { 80 | OnRecommendationClickedListener listener = activity.getOnRecommendationClickedListener(); 81 | if (listener != null && listener.onRecommendationClicked(v, recommendation)) { 82 | return; 83 | } 84 | if (recommendation.openWithGooglePlay) { 85 | bottomSheet = new BottomSheetDialog(v.getContext()); 86 | bottomSheet.setContentView(R.layout.about_page_dialog_market_chooser); 87 | bottomSheet.show(); 88 | // noinspection ConstantConditions 89 | bottomSheet.findViewById(R.id.web).setOnClickListener(this); 90 | // noinspection ConstantConditions 91 | bottomSheet.findViewById(R.id.google_play).setOnClickListener(this); 92 | } else { 93 | openWithWeb(v.getContext(), recommendation); 94 | } 95 | } 96 | } 97 | 98 | protected void setRecommendation(@NonNull Recommendation recommendation, @Nullable ImageLoader imageLoader) { 99 | this.recommendation = recommendation; 100 | if (imageLoader != null) { 101 | icon.setVisibility(View.VISIBLE); 102 | imageLoader.load(icon, recommendation.iconUrl); 103 | } else { 104 | icon.setVisibility(View.GONE); 105 | Log.e(TAG, "You should call AbsAboutActivity.setImageLoader() otherwise the icon will be gone."); 106 | } 107 | name.setText(recommendation.appName); 108 | packageName.setText(recommendation.packageName); 109 | description.setText(recommendation.description); 110 | @SuppressLint("SetTextI18n") 111 | String size = recommendation.downloadSize + "MB"; 112 | sizeView.setText(size); 113 | } 114 | 115 | protected void openWithWeb(@NonNull Context context, @NonNull Recommendation recommendation) { 116 | context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(recommendation.downloadUrl))); 117 | } 118 | 119 | private void openWithMarket(@NonNull Context context, @NonNull String targetPackage, @NonNull String defaultDownloadUrl) { 120 | try { 121 | Intent googlePlayIntent = context.getPackageManager().getLaunchIntentForPackage("com.android.vending"); 122 | ComponentName comp = new ComponentName("com.android.vending", "com.google.android.finsky.activities.LaunchUrlHandlerActivity"); 123 | // noinspection ConstantConditions 124 | googlePlayIntent.setComponent(comp); 125 | googlePlayIntent.setData(Uri.parse("market://details?id=" + targetPackage)); 126 | context.startActivity(googlePlayIntent); 127 | } catch (Throwable e) { 128 | context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(defaultDownloadUrl))); 129 | e.printStackTrace(); 130 | } 131 | } 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/provided/GlideImageLoader.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about.provided; 2 | 3 | import androidx.annotation.NonNull; 4 | import android.widget.ImageView; 5 | import com.bumptech.glide.Glide; 6 | import com.drakeet.about.ImageLoader; 7 | 8 | /** 9 | * @author drakeet 10 | */ 11 | public class GlideImageLoader implements ImageLoader { 12 | 13 | @Override 14 | public void load(@NonNull ImageView imageView, @NonNull String url) { 15 | Glide.with(imageView.getContext()).load(url).into(imageView); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /library/src/main/java/com/drakeet/about/provided/PicassoImageLoader.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about.provided; 2 | 3 | import androidx.annotation.NonNull; 4 | import android.widget.ImageView; 5 | import com.squareup.picasso.Picasso; 6 | import com.drakeet.about.ImageLoader; 7 | 8 | /** 9 | * @author drakeet 10 | */ 11 | public class PicassoImageLoader implements ImageLoader { 12 | 13 | @Override 14 | public void load(@NonNull ImageView imageView, @NonNull String url) { 15 | Picasso.get().load(url).into(imageView); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /library/src/main/res/drawable-v21/about_page_card.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /library/src/main/res/drawable/about_page_card.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /library/src/main/res/layout/about_page_dialog_market_chooser.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 16 | 17 | 23 | 24 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /library/src/main/res/layout/about_page_item_card.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /library/src/main/res/layout/about_page_item_category.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 17 | 18 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /library/src/main/res/layout/about_page_item_contributor.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 20 | 21 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /library/src/main/res/layout/about_page_item_license.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /library/src/main/res/layout/about_page_item_line.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | -------------------------------------------------------------------------------- /library/src/main/res/layout/about_page_item_recommendation.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 21 | 22 | 28 | 29 | 36 | 37 | 40 | 41 | 47 | 48 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /library/src/main/res/layout/about_page_main_activity.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 14 | 15 | 22 | 23 | 30 | 31 | 36 | 37 | 40 | 41 | 45 | 46 | 47 | 48 | 53 | 54 | 55 | 56 | 57 | 58 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /library/src/main/res/values-es/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Abrir con: 4 | Navegador web 5 | -------------------------------------------------------------------------------- /library/src/main/res/values-hi/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | के साथ खोलें: 4 | वेब ब्राउज़र 5 | -------------------------------------------------------------------------------- /library/src/main/res/values-ja/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ウェブブラウザ 5 | -------------------------------------------------------------------------------- /library/src/main/res/values-night/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #141414 5 | #abaaaa 6 | #deffffff 7 | @color/about_page_card_text_color 8 | #363636 9 | 10 | #282828 11 | #33000000 12 | @android:color/black 13 | @color/about_page_card_text_color 14 | @color/about_page_hint 15 | @color/about_page_card_text_color 16 | #80ffffff 17 | #5C000000 18 | 19 | -------------------------------------------------------------------------------- /library/src/main/res/values-nl/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Open met: 4 | Webbrowser 5 | -------------------------------------------------------------------------------- /library/src/main/res/values-ru/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Открыть с: 4 | Веб-браузер 5 | -------------------------------------------------------------------------------- /library/src/main/res/values-v27/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #E6FFFFFF 4 | 5 | -------------------------------------------------------------------------------- /library/src/main/res/values-zh-rCN/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 打开方式: 4 | 浏览器 5 | -------------------------------------------------------------------------------- /library/src/main/res/values-zh-rHK/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 打開方式: 4 | 瀏覽器 5 | -------------------------------------------------------------------------------- /library/src/main/res/values-zh-rTW/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 打開方式: 4 | 瀏覽器 5 | -------------------------------------------------------------------------------- /library/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | 12 | 13 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /library/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #f1f1f1 4 | #757575 5 | #de000000 6 | @android:color/black 7 | #44000000 8 | #ffffff 9 | #33000000 10 | #eae9e9 11 | @color/about_page_card_text_color 12 | @color/about_page_hint 13 | @color/about_page_card_text_color 14 | #757575 15 | #5C000000 16 | 17 | -------------------------------------------------------------------------------- /library/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 212dp 4 | 38dp 5 | 13sp 6 | 48dp 7 | 48dp 8 | 16dp 9 | 10 | -------------------------------------------------------------------------------- /library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Open with: 4 | Web Browser 5 | -------------------------------------------------------------------------------- /library/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | 14 | 15 | 21 | 22 | 26 | 27 | 36 | 37 | 44 | 45 | 56 | 57 | 61 | 62 | 72 | 73 | 83 | 84 | 90 | 91 | 96 | 97 | 102 | 103 | 108 | 109 | 115 | 116 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 30 5 | defaultConfig { 6 | applicationId "com.drakeet.about.sample" 7 | minSdkVersion 14 8 | targetSdkVersion 30 9 | versionCode 84 10 | versionName "2.5.2" 11 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | implementation 'androidx.appcompat:appcompat:1.3.1' 23 | testImplementation 'junit:junit:4.12' 24 | 25 | implementation project(':library') 26 | 27 | // for using the PicassoImageLoader 28 | implementation 'com.squareup.picasso:picasso:2.71828' 29 | implementation 'com.drakeet.multitype:multitype:4.3.0' 30 | implementation 'com.google.android.material:material:1.4.0' 31 | } 32 | -------------------------------------------------------------------------------- /sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Users\XiaoaiMaster\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /sample/src/main/java/com/drakeet/about/sample/AboutActivity.java: -------------------------------------------------------------------------------- 1 | package com.drakeet.about.sample; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.os.Bundle; 5 | import android.view.Menu; 6 | import android.view.MenuItem; 7 | import android.view.View; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | import android.widget.Toast; 11 | import androidx.annotation.NonNull; 12 | import androidx.appcompat.app.AppCompatDelegate; 13 | import com.drakeet.about.AbsAboutActivity; 14 | import com.drakeet.about.Card; 15 | import com.drakeet.about.Category; 16 | import com.drakeet.about.Contributor; 17 | import com.drakeet.about.License; 18 | import com.drakeet.about.OnContributorClickedListener; 19 | import com.drakeet.about.OnRecommendationClickedListener; 20 | import com.drakeet.about.Recommendation; 21 | import com.drakeet.about.provided.PicassoImageLoader; 22 | import java.util.List; 23 | 24 | import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO; 25 | import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES; 26 | 27 | /** 28 | * @author drakeet 29 | */ 30 | @SuppressLint("SetTextI18n") 31 | @SuppressWarnings("SpellCheckingInspection") 32 | public class AboutActivity extends AbsAboutActivity 33 | implements OnRecommendationClickedListener, OnContributorClickedListener { 34 | 35 | @Override 36 | protected void onCreate(Bundle savedInstanceState) { 37 | super.onCreate(savedInstanceState); 38 | setImageLoader(new PicassoImageLoader()); 39 | setOnRecommendationClickedListener(this); 40 | setOnContributorClickedListener(this); 41 | } 42 | 43 | @Override 44 | protected void onCreateHeader(@NonNull ImageView icon, @NonNull TextView slogan, @NonNull TextView version) { 45 | icon.setImageResource(R.mipmap.ic_launcher); 46 | slogan.setText("About Page By drakeet"); 47 | version.setText("v" + BuildConfig.VERSION_NAME); 48 | } 49 | 50 | @Override 51 | protected void onItemsCreated(@NonNull List items) { 52 | items.add(new Category("介绍与帮助")); 53 | items.add(new Card(getString(R.string.card_content))); 54 | 55 | items.add(new Category("Developers")); 56 | items.add(new Contributor(R.drawable.avatar_drakeet, "Drakeet", "Developer & designer", "http://weibo.com/drak11t")); 57 | items.add(new Contributor(R.drawable.avatar_drakeet, "黑猫酱", "Developer", "https://drakeet.me")); 58 | items.add(new Contributor(R.drawable.avatar_drakeet, "小艾大人", "Developer")); 59 | 60 | items.add(new Category("我独立开发的应用")); 61 | items.add(new Recommendation( 62 | 0, getString(R.string.pure_writer), 63 | "https://raw.githubusercontent.com/PureWriter/about-page/master/images/app_writer.png", 64 | "com.drakeet.purewriter", 65 | "快速的纯文本编辑器,我们希望写作能够回到原本的样子:纯粹、有安全感、随时、绝对不丢失内容、具备良好的写作体验。", 66 | "https://play.google.com/store/apps/details?id=com.drakeet.purewriter", 67 | "2017-10-09 16:46:57", 68 | "2017-10-09 16:46:57", 2.93, true) 69 | ); 70 | items.add(new Recommendation( 71 | 1, getString(R.string.pure_mosaic), 72 | "https://raw.githubusercontent.com/PureWriter/about-page/master/images/app_mosaic.png", 73 | "me.drakeet.puremosaic", 74 | "专注打码的轻应用,包含功能:传统马赛克、毛玻璃效果、选区和手指模式打码,更有创新型高亮打码和 LowPoly 风格马赛克。只为满足一个纯纯的打码需求,让打码也能成为一种赏心悦目。", 75 | "https://play.google.com/store/apps/details?id=me.drakeet.puremosaic", 76 | "2017-10-09 16:46:57", 77 | "2017-10-09 16:46:57", 2.64, true) 78 | ); 79 | 80 | items.add(new Category("Open Source Licenses")); 81 | items.add(new License("about-page", "drakeet", License.APACHE_2, "https://github.com/drakeet/about-page")); 82 | items.add(new License("MultiType", "drakeet", License.APACHE_2, "https://github.com/drakeet/MultiType")); 83 | } 84 | 85 | @Override 86 | public boolean onCreateOptionsMenu(Menu menu) { 87 | getMenuInflater().inflate(R.menu.menu_about, menu); 88 | MenuItem dayNight = menu.findItem(R.id.menu_night_mode); 89 | dayNight.setChecked(AppCompatDelegate.getDefaultNightMode() == MODE_NIGHT_YES); 90 | return super.onCreateOptionsMenu(menu); 91 | } 92 | 93 | @Override 94 | public boolean onOptionsItemSelected(MenuItem menuItem) { 95 | if (menuItem.getItemId() == R.id.menu_night_mode) { 96 | menuItem.setChecked(!menuItem.isChecked()); 97 | if (menuItem.isChecked()) { 98 | AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); 99 | } else { 100 | AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO); 101 | } 102 | getDelegate().applyDayNight(); 103 | } 104 | return true; 105 | } 106 | 107 | @Override 108 | public boolean onRecommendationClicked(@NonNull View itemView, @NonNull Recommendation recommendation) { 109 | Toast.makeText(this, "onRecommendationClicked: " + recommendation.appName, Toast.LENGTH_SHORT).show(); 110 | return false; 111 | } 112 | 113 | @Override 114 | public boolean onContributorClicked(@NonNull View itemView, @NonNull Contributor contributor) { 115 | if (contributor.name.equals("小艾大人")) { 116 | Toast.makeText(this, "onContributorClicked: " + contributor.name, Toast.LENGTH_SHORT).show(); 117 | return true; 118 | } 119 | return false; 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable/avatar_drakeet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureWriter/about-page/4e756d21f7e789174f6d83a5bff95a761d20d7cf/sample/src/main/res/drawable/avatar_drakeet.png -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /sample/src/main/res/menu/menu_about.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureWriter/about-page/4e756d21f7e789174f6d83a5bff95a761d20d7cf/sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureWriter/about-page/4e756d21f7e789174f6d83a5bff95a761d20d7cf/sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureWriter/about-page/4e756d21f7e789174f6d83a5bff95a761d20d7cf/sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureWriter/about-page/4e756d21f7e789174f6d83a5bff95a761d20d7cf/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureWriter/about-page/4e756d21f7e789174f6d83a5bff95a761d20d7cf/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/values-night/bools.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | false 4 | 5 | -------------------------------------------------------------------------------- /sample/src/main/res/values-night/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #282828 4 | #222222 5 | #ffffff 6 | -------------------------------------------------------------------------------- /sample/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /sample/src/main/res/values-zh/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 纯纯写作 4 | 纯纯打码 5 | -------------------------------------------------------------------------------- /sample/src/main/res/values/bools.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | true 4 | 5 | -------------------------------------------------------------------------------- /sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /sample/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | about-page 3 | 这是一个来自 Drakeet 独立开发的 纯纯打码 App 中的关于页面。\n\n纯纯打码 是一款专注打码的轻应用,包含功能:传统马赛克、毛玻璃效果、选区和手指模式打,更有创新型高亮打码和 LowPoly 风格马赛克。\n只为满足一个纯纯的打码需求,让打码也能成为一种赏心悦目。\n\n如今我将这个页面从这个精致的应用中抽离出来开源,和我一贯做的开源项目一样,仅仅是为了让更多人获得方便。它代码干净易读,布局清晰优雅,在尺寸方面花费了许多调整的时间。\n\n很高兴能够分享给大家!最后,为了展示在卡片中能够自动识别链接和支持链接,我粘贴了纯纯打码的下载地址,你可以尝试点击试试,谢谢:\n\nhttps://play.google.com/store/apps/details?id=me.drakeet.puremosaic 4 | 分享一款应用:「纯纯打码」,可能是最好用的打码软件,支持传统马赛克、毛玻璃,以及手指、选区打码,更有创意型高亮打码、LowPoly 风格,轻巧漂亮,打码也能够成为一种赏心悦目,推荐:http://t.cn/RbRjE4u 5 | Pure Writer 6 | Pure Mosaic 7 | 8 | -------------------------------------------------------------------------------- /sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':sample' 2 | include ':library' 3 | --------------------------------------------------------------------------------