├── .github └── FUNDING.yml ├── .gitignore ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── mehdi │ │ └── sakout │ │ └── aboutpage │ │ └── sample │ │ └── MainActivity.java │ └── res │ ├── drawable-nodpi │ ├── about_icon_copy_right.xml │ └── dummy_image.png │ ├── layout │ └── activity_main.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-night │ └── colors.xml │ ├── values-notnight │ └── colors.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── mehdi │ │ └── sakout │ │ └── aboutpage │ │ ├── AboutPage.java │ │ ├── AboutPageUtils.java │ │ └── Element.java │ └── res │ ├── drawable │ ├── about_icon_email.xml │ ├── about_icon_facebook.xml │ ├── about_icon_github.xml │ ├── about_icon_google_play.xml │ ├── about_icon_instagram.xml │ ├── about_icon_link.xml │ ├── about_icon_twitter.xml │ └── about_icon_youtube.xml │ ├── layout │ ├── about_page.xml │ └── about_page_separator.xml │ ├── values-ar │ └── strings.xml │ ├── values-az │ └── strings.xml │ ├── values-bg │ └── strings.xml │ ├── values-ca │ └── strings.xml │ ├── values-cs │ └── strings.xml │ ├── values-de │ └── strings.xml │ ├── values-el │ └── strings.xml │ ├── values-es │ └── strings.xml │ ├── values-fa │ └── strings.xml │ ├── values-fr │ └── strings.xml │ ├── values-hi │ └── strings.xml │ ├── values-hr │ └── strings.xml │ ├── values-hu │ └── strings.xml │ ├── values-id │ └── strings.xml │ ├── values-it │ └── strings.xml │ ├── values-iw-rIL │ └── strings.xml │ ├── values-ja │ └── strings.xml │ ├── values-ka │ └── strings.xml │ ├── values-ko │ └── strings.xml │ ├── values-night │ └── styles.xml │ ├── values-nl │ └── strings.xml │ ├── values-no-rNB │ └── strings.xml │ ├── values-no-rNN │ └── strings.xml │ ├── values-pl │ └── strings.xml │ ├── values-pt-rBR │ └── strings.xml │ ├── values-ro │ └── strings.xml │ ├── values-ru │ └── strings.xml │ ├── values-se │ └── strings.xml │ ├── values-sl │ └── strings.xml │ ├── values-sr │ └── strings.xml │ ├── values-tr │ └── strings.xml │ ├── values-uk │ └── strings.xml │ ├── values-uz │ └── strings.xml │ ├── values-zh-rCN │ └── strings.xml │ ├── values-zh-rTW │ └── strings.xml │ └── values │ ├── attrs.xml │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── resources └── cover.png ├── scripts ├── publish-module.gradle └── publish-root.gradle └── settings.gradle /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | ko_fi: medyoo 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #built application files 2 | *.apk 3 | *.ap_ 4 | !resources/fancybuttons_samples.apk 5 | 6 | # files for the dex VM 7 | *.dex 8 | 9 | # Java class files 10 | *.class 11 | 12 | # generated files 13 | bin/ 14 | gen/ 15 | 16 | # Local configuration file (sdk path, etc) 17 | local.properties 18 | 19 | # Windows thumbnail db 20 | Thumbs.db 21 | 22 | # OSX files 23 | .DS_Store 24 | 25 | # Eclipse project files 26 | .classpath 27 | .project 28 | 29 | # Android Studio 30 | .idea 31 | .gradle 32 | build/ 33 | 34 | project.properties 35 | out 36 | *.iml -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android About Page 2 | Create an awesome About Page for your Android App in 2 minutes 3 | 4 | Android About Page Cover 5 | 6 | This library allows to generate beautiful About Pages with less effort, it's fully customizable and supports opening specific intent 7 | 8 | ```java 9 | View aboutPage = new AboutPage(this) 10 | .isRTL(false) 11 | .setCustomFont(String) // or Typeface 12 | .setImage(R.drawable.dummy_image) 13 | .addItem(versionElement) 14 | .addItem(adsElement) 15 | .addGroup("Connect with us") 16 | .addEmail("elmehdi.sakout@gmail.com") 17 | .addWebsite("https://mehdisakout.com/") 18 | .addFacebook("the.medy") 19 | .addTwitter("medyo80") 20 | .addYoutube("UCdPQtdWIsg7_pi4mrRu46vA") 21 | .addPlayStore("com.ideashower.readitlater.pro") 22 | .addGitHub("medyo") 23 | .addInstagram("medyo80") 24 | .create(); 25 | ``` 26 | 27 | ## Setup 28 | Available on Jcenter, Maven and JitPack 29 | 30 | ```groovy 31 | implementation 'io.github.medyo:android-about-page:2.0.0' 32 | ``` 33 | 34 | 35 | ## Usage 36 | ### 1. Add Description 37 | 38 | ```java 39 | setDescription(String) 40 | ``` 41 | 42 | ### 2. Add Image 43 | ```java 44 | setImage(Int) 45 | ``` 46 | 47 | ### 3. Add predefined Social network 48 | The library has already some predefined social networks like : 49 | 50 | * Facebook 51 | * Twitter 52 | * Instagram 53 | * Youtube 54 | * PlayStore 55 | 56 | ```java 57 | addFacebook(String PageID) 58 | addTwitter(String AccountID) 59 | addYoutube(String AccountID) 60 | addPlayStore(String PackageName) 61 | addInstagram(String AccountID) 62 | addGitHub(String AccountID) 63 | ``` 64 | 65 | ### 4. Add Custom Element 66 | For example `app version` : 67 | 68 | ```java 69 | Element versionElement = new Element(); 70 | versionElement.setTitle("Version 6.2"); 71 | addItem(versionElement) 72 | ``` 73 | 74 | ### 5. Available attributes for Element Class 75 | 76 | 77 | | Function | Description | 78 | | ------------- |:-------------:| 79 | | setTitle(String) | Set title of the element| 80 | | setIconTint(Int) | Set color of the element| 81 | | setSkipTint(Boolean) | Skip tinting the icon (useful when using non vector drawables)| 82 | | setIconDrawable(Int) | Set icon of the element| 83 | | setValue(String) | Set Element value like Facebook ID| 84 | | setIntent(Intent) | Set an intent to be called on `onClickListener` | 85 | | setGravity(Gravity) | Set a Gravity for the element | 86 | | setOnClickListener(View.OnClickListener) | If `intent` isn't suitable for you need, implement your custom behaviour by overriding the click listener| 87 | 88 | ### 6. How to use the library in a fragment 89 | ```java 90 | @Override 91 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 92 | return new AboutPage(getContext()) 93 | .isRTL(false) 94 | .setDescription(getString(R.string.app_description)) 95 | .addGroup(getString(R.string.contact_group)) 96 | .addEmail("us@example.com", "Email") 97 | .addGroup(getString(R.string.application_information_group)) 98 | .addItem(new VersionElement()) 99 | .create(); 100 | } 101 | ``` 102 | snippet by [nrhoffmann](https://github.com/nrhoffmann) 103 | 104 | ### 7. Styling 105 | 106 | The library supports day-night modes. The dependents may use the following 107 | styling attributes to create a dedicated style for `AboutPage`. If the 108 | dependents choose not to specify an explicit style, the library falls back to 109 | sensible defaults. 110 | 111 | First, declare an `AboutPage` style in your `styles.xml`. 112 | 113 | ```xml 114 | 115 | 125 | 126 | 129 | 130 | ``` 131 | 132 | To apply this style globally, assign its reference to `aboutStyle` attribute in 133 | your app theme. 134 | 135 | ```xml 136 | 139 | ``` 140 | 141 | Or explicitly pass the style resource to the `AboutPage` constructor to apply it 142 | on selective `AboutPage` instances. 143 | 144 | ```java 145 | AboutPage aboutPage = new AboutPage(context, R.style.Widget_AboutPage); 146 | ``` 147 | 148 | ### 8. Force Night/Day mode 149 | 150 | We recommend that the dependents use 151 | [`AppCompatDelegate.setDefaultNightMode()`](https://developer.android.com/reference/androidx/appcompat/app/AppCompatDelegate#setDefaultNightMode(int)) 152 | to force enable/disable the night mode across their apps. If the dependents are 153 | unable to use the recommended approach, they can use the `AboutPage(Context, 154 | boolean)` constructor to specify the desired mode. The dependents must note that 155 | by using this constructor, the `AboutPage` will use its default styles, ignoring 156 | any explicitly specified style. 157 | 158 | ```java 159 | AboutPage aboutPage = AboutPage(context, true); // force enable dark mode. 160 | AboutPage aboutPage = AboutPage(context, false); // force enable bright mode. 161 | ``` 162 | 163 | ## Sample Project 164 | [medyo/android-about-page/app/](https://github.com/medyo/android-about-page/tree/master/app) 165 | 166 | ## Translations 167 | The library does supports the following languages : 168 | 169 | * Arabic (by [zecharyah](https://github.com/zecharyah)) 170 | * Catalan (by [unxavi](https://github.com/unxavi)) 171 | * Croatian (by [skmlcd](https://github.com/skmlcd)) 172 | * Czech (by [semanticer](https://github.com/semanticer)) 173 | * Dutch (by [artaex](https://github.com/artaex)) 174 | * English (by [medyo](https://github.com/medyo)) 175 | * French (by [medyo](https://github.com/medyo)) 176 | * Georgian (by [tatocaster](https://github.com/tatocaster)) 177 | * German (by [vanniktech](https://github.com/vanniktech) && [nikothegreek](https://github.com/nikothegreek)) 178 | * Greek (by [jvoyatz](https://github.com/jvoyatz)) 179 | * Hungarian (by [jbarat](https://github.com/jbarat)) 180 | * Indian (by [kartikarora](https://github.com/kartikarora)) 181 | * Indonesian (by [hyuwah](https://github.com/hyuwah)) 182 | * Italian (by [greenaddress](https://github.com/greenaddress)) 183 | * Japanese (by [chibatching](https://github.com/chibatching)) 184 | * Korean (by [Alfex4936](https://github.com/Alfex4936)) 185 | * Persian (by [mortezasun](https://github.com/mortezasun)) 186 | * Polish (by [karmil32](https://github.com/karmil32)) 187 | * Portuguese Brazil (by [rbaprado](https://github.com/rbaprado)) 188 | * Romanian (by [Vally79](https://github.com/Vally79)) 189 | * Russian (by [NumezmaT](https://github.com/NumezmaT)) 190 | * Serbian (by [ljmocic](https://github.com/ljmocic)) 191 | * Simplified Chinese (by [whiskeyfei](https://github.com/whiskeyfei)) 192 | * Slovenian (by [skmlcd](https://github.com/skmlcd)) 193 | * Spanish (by [danramirez](https://github.com/danramirez)) 194 | * Swedish (by [Krillsson](https://github.com/Krillsson)) 195 | * Traditional Chinese (by [ppcrong](https://github.com/ppcrong)) 196 | * Turkish (by [tekseker](https://github.com/tekseker)) 197 | * Ukrainian (by [NumezmaT](https://github.com/NumezmaT)) 198 | * Uzbek (by [gladuz](https://github.com/gladuz)) 199 | * Norwegian Nynorsk (by [boxhock](https://github.com/boxhock)) 200 | * Norwegian Bokmål (by [boxhock](https://github.com/boxhock)) 201 | * Azerbaijani (by [Chingiz](https://github.com/Chingiz)) 202 | * Hebrew (by [evyatar100](https://github.com/evyatar100)) 203 | * Bulgarian (by [kstoyanov5](https://github.com/kstoyanov5)) 204 | 205 | Please make a Pull request to add a new language. 206 | 207 | ## ProGuard 208 | Nothing to include 209 | 210 | ## License 211 | 212 | ~~~ 213 | The MIT License (MIT) 214 | Copyright (c) 2016 Mehdi Sakout 215 | 216 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 217 | 218 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 219 | 220 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 221 | ~~~ 222 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 30 5 | 6 | defaultConfig { 7 | applicationId "mehdi.sakout.aboutpage.sample" 8 | minSdkVersion 15 9 | targetSdkVersion 30 10 | versionCode 16 11 | versionName "1.4.0" 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 fileTree(dir: 'libs', include: ['*.jar']) 23 | testImplementation 'junit:junit:4.12' 24 | implementation 'androidx.appcompat:appcompat:1.3.0' 25 | 26 | implementation project(':library') 27 | } 28 | -------------------------------------------------------------------------------- /app/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 /home/medyo/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 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/java/mehdi/sakout/aboutpage/sample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package mehdi.sakout.aboutpage.sample; 2 | 3 | import android.os.Bundle; 4 | import android.view.Gravity; 5 | import android.view.View; 6 | import android.widget.Toast; 7 | import androidx.appcompat.app.AppCompatActivity; 8 | import java.util.Calendar; 9 | import mehdi.sakout.aboutpage.AboutPage; 10 | import mehdi.sakout.aboutpage.Element; 11 | 12 | public class MainActivity extends AppCompatActivity { 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | 18 | Element adsElement = new Element(); 19 | adsElement.setTitle("Advertise with us"); 20 | 21 | View aboutPage = new AboutPage(this) 22 | .isRTL(false) 23 | .setImage(R.drawable.dummy_image) 24 | .addItem(new Element().setTitle("Version 6.2")) 25 | .addItem(adsElement) 26 | .addGroup("Connect with us") 27 | .addEmail("elmehdi.sakout@gmail.com") 28 | .addWebsite("https://mehdisakout.com/") 29 | .addFacebook("the.medy") 30 | .addTwitter("medyo80") 31 | .addYoutube("UCdPQtdWIsg7_pi4mrRu46vA") 32 | .addPlayStore("com.ideashower.readitlater.pro") 33 | .addInstagram("medyo80") 34 | .addGitHub("medyo") 35 | .addItem(getCopyRightsElement()) 36 | .create(); 37 | 38 | setContentView(aboutPage); 39 | } 40 | 41 | 42 | Element getCopyRightsElement() { 43 | Element copyRightsElement = new Element(); 44 | final String copyrights = String.format(getString(R.string.copy_right), Calendar.getInstance().get(Calendar.YEAR)); 45 | copyRightsElement.setTitle(copyrights); 46 | copyRightsElement.setIconDrawable(R.drawable.about_icon_copy_right); 47 | copyRightsElement.setAutoApplyIconTint(true); 48 | copyRightsElement.setIconTint(mehdi.sakout.aboutpage.R.color.about_item_icon_color); 49 | copyRightsElement.setIconNightTint(android.R.color.white); 50 | copyRightsElement.setGravity(Gravity.CENTER); 51 | copyRightsElement.setOnClickListener(new View.OnClickListener() { 52 | @Override 53 | public void onClick(View v) { 54 | Toast.makeText(MainActivity.this, copyrights, Toast.LENGTH_SHORT).show(); 55 | } 56 | }); 57 | return copyRightsElement; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/about_icon_copy_right.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/dummy_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/medyo/android-about-page/1fd208ca287d152cd1bec7733949df9914615ecb/app/src/main/res/drawable-nodpi/dummy_image.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/medyo/android-about-page/1fd208ca287d152cd1bec7733949df9914615ecb/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/medyo/android-about-page/1fd208ca287d152cd1bec7733949df9914615ecb/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/medyo/android-about-page/1fd208ca287d152cd1bec7733949df9914615ecb/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/medyo/android-about-page/1fd208ca287d152cd1bec7733949df9914615ecb/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-night/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #263238 4 | #212121 5 | #50bcb6 6 | #50bcb6 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values-notnight/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ef4056 4 | #ac2435 5 | #50bcb6 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ef4056 4 | #ac2435 5 | #50bcb6 6 | #ef4056 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Android About Page 3 | Copyrights © %1$d 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 15 | 16 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | google() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:4.1.3' 10 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6' 11 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' 12 | } 13 | } 14 | 15 | plugins { 16 | id("io.github.gradle-nexus.publish-plugin") version "1.1.0" 17 | } 18 | 19 | apply from: "${rootDir}/scripts/publish-root.gradle" 20 | 21 | allprojects { 22 | repositories { 23 | jcenter() 24 | google() 25 | maven { 26 | url 'https://dl.bintray.com/medyo/maven/' 27 | } 28 | } 29 | } 30 | 31 | task clean(type: Delete) { 32 | delete rootProject.buildDir 33 | } 34 | 35 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 10 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 11 | # When configured, Gradle will run in incubating parallel mode. 12 | # This option should only be used with decoupled projects. More details, visit 13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 14 | # org.gradle.parallel=true 15 | android.enableJetifier=true 16 | android.useAndroidX=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/medyo/android-about-page/1fd208ca287d152cd1bec7733949df9914615ecb/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun May 23 12:53:44 WEST 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 30 5 | 6 | defaultConfig { 7 | minSdkVersion 15 8 | targetSdkVersion 30 9 | versionCode 22 10 | versionName "2.0.0" 11 | vectorDrawables.useSupportLibrary = true 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | 20 | resourcePrefix 'about_' 21 | } 22 | 23 | dependencies { 24 | implementation fileTree(dir: 'libs', include: ['*.jar']) 25 | testImplementation 'junit:junit:4.12' 26 | implementation 'androidx.appcompat:appcompat:1.3.0' 27 | } 28 | 29 | ext { 30 | PUBLISH_GROUP_ID = 'io.github.medyo' 31 | PUBLISH_VERSION = '2.0.0' 32 | PUBLISH_ARTIFACT_ID = 'android-about-page' 33 | PUBLISH_DESCRIPTION = 'Create an Awesome About Page for your Android App in 2 minutes' 34 | PUBLISH_URL = 'https://github.com/medyo/android-about-page' 35 | PUBLISH_LICENSE_NAME = 'MIT' 36 | PUBLISH_LICENSE_URL = 'http://opensource.org/licenses/MIT' 37 | PUBLISH_DEVELOPER_ID = 'medyo' 38 | PUBLISH_DEVELOPER_NAME = 'Mehdi Sakout' 39 | PUBLISH_DEVELOPER_EMAIL = 'elmehdi.sakout@gmail.com' 40 | PUBLISH_SCM_CONNECTION = 41 | 'scm:git:github.com/medyo/android-about-page.git' 42 | PUBLISH_SCM_DEVELOPER_CONNECTION = 43 | 'scm:git:ssh://github.com/medyo/android-about-page.git' 44 | PUBLISH_SCM_URL = 45 | 'https://github.com/medyo/android-about-page/tree/master' 46 | } 47 | 48 | apply from: "${rootProject.projectDir}/scripts/publish-module.gradle" 49 | -------------------------------------------------------------------------------- /library/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 /home/medyo/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 | -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /library/src/main/java/mehdi/sakout/aboutpage/AboutPage.java: -------------------------------------------------------------------------------- 1 | package mehdi.sakout.aboutpage; 2 | 3 | import android.app.Fragment; 4 | import android.content.ActivityNotFoundException; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | import android.content.pm.PackageManager; 8 | import android.graphics.Typeface; 9 | import android.graphics.drawable.Drawable; 10 | import android.net.Uri; 11 | import android.os.Build; 12 | import android.os.Bundle; 13 | import android.text.TextUtils; 14 | import android.util.Log; 15 | import android.view.Gravity; 16 | import android.view.LayoutInflater; 17 | import android.view.View; 18 | import android.view.ViewGroup; 19 | import android.widget.ImageView; 20 | import android.widget.LinearLayout; 21 | import android.widget.TextView; 22 | 23 | import androidx.annotation.DrawableRes; 24 | import androidx.annotation.StyleRes; 25 | import androidx.appcompat.view.ContextThemeWrapper; 26 | import androidx.core.content.ContextCompat; 27 | import androidx.core.graphics.drawable.DrawableCompat; 28 | import androidx.core.widget.TextViewCompat; 29 | import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat; 30 | 31 | /** 32 | * The main class of this library with many predefined methods to add Elements for common items in 33 | * an About page. This class creates a {@link android.view.View} that can be passed as the root view 34 | * in {@link Fragment#onCreateView(LayoutInflater, ViewGroup, Bundle)} or passed to the {@link android.app.Activity#setContentView(View)} 35 | * in an activity's {@link android.app.Activity#onCreate(Bundle)} (Bundle)} method 36 | *

37 | * To create a custom item in the about page, pass an instance of {@link mehdi.sakout.aboutpage.Element} 38 | * to the {@link AboutPage#addItem(Element)} method. 39 | * 40 | * @see Element 41 | */ 42 | public class AboutPage { 43 | private static final String LOG_TAG = AboutPage.class.getSimpleName(); 44 | 45 | private final Context mContext; 46 | private final LayoutInflater mInflater; 47 | private final View mView; 48 | private CharSequence mDescription; 49 | private int mImage = 0; 50 | private boolean mIsRTL = false; 51 | private Typeface mCustomFont; 52 | 53 | /** 54 | * The AboutPage requires a context to perform it's functions. Give it a context associated to an 55 | * Activity or a Fragment. To avoid memory leaks, don't pass a 56 | * {@link android.content.Context#getApplicationContext() Context.getApplicationContext()} here. 57 | * 58 | * @param context 59 | */ 60 | public AboutPage(Context context) { 61 | this(context, AboutPageUtils.resolveResIdAttr(context, R.attr.aboutStyle, R.style.about_About)); 62 | } 63 | 64 | public AboutPage(Context context, boolean forceEnableDarkMode) { 65 | this(context, forceEnableDarkMode ? R.style.about_AboutBase_Dark : R.style.about_AboutBase_Light); 66 | } 67 | 68 | public AboutPage(Context context, @StyleRes int style) { 69 | this.mContext = new ContextThemeWrapper(context, style); 70 | this.mInflater = LayoutInflater.from(this.mContext); 71 | this.mView = mInflater.inflate(R.layout.about_page, null); 72 | } 73 | 74 | /** 75 | * Provide a valid path to a font here to use another font for the text inside this AboutPage 76 | * 77 | * @param path 78 | * @return this AboutPage instance for builder pattern support 79 | */ 80 | public AboutPage setCustomFont(String path) { 81 | //TODO: check if file exists 82 | mCustomFont = Typeface.createFromAsset(mContext.getAssets(), path); 83 | return this; 84 | } 85 | 86 | /** 87 | * Provide a typeface to use as custom font 88 | * 89 | * @param typeface 90 | * @return this AboutPage instance for builder pattern support 91 | */ 92 | public AboutPage setCustomFont(Typeface typeface) { 93 | mCustomFont = typeface; 94 | return this; 95 | } 96 | 97 | /** 98 | * Convenience method for {@link AboutPage#addEmail(java.lang.String, java.lang.String)} but with 99 | * a predefined title string 100 | * 101 | * @param email the email address to send to 102 | * @return this AboutPage instance for builder pattern support 103 | */ 104 | public AboutPage addEmail(String email) { 105 | return addEmail(email, mContext.getString(R.string.about_contact_us)); 106 | } 107 | 108 | /** 109 | * Add a predefined Element that opens the users default email client with a new email to the 110 | * email address passed as parameter 111 | * 112 | * @param email the email address to send to 113 | * @param title the title string to display on this item 114 | * @return this AboutPage instance for builder pattern support 115 | */ 116 | public AboutPage addEmail(String email, String title) { 117 | Element emailElement = new Element(); 118 | emailElement.setTitle(title); 119 | emailElement.setIconDrawable(R.drawable.about_icon_email); 120 | 121 | Intent intent = new Intent(Intent.ACTION_SENDTO); 122 | intent.setData(Uri.parse("mailto:")); 123 | intent.putExtra(Intent.EXTRA_EMAIL, new String[]{email}); 124 | emailElement.setIntent(intent); 125 | 126 | addItem(emailElement); 127 | return this; 128 | } 129 | 130 | /** 131 | * Convenience method for {@link AboutPage#addFacebook(java.lang.String, java.lang.String)} but with 132 | * a predefined title string 133 | * 134 | * @param id the facebook id to display 135 | * @return this AboutPage instance for builder pattern support 136 | */ 137 | public AboutPage addFacebook(String id) { 138 | return addFacebook(id, mContext.getString(R.string.about_facebook)); 139 | } 140 | 141 | /** 142 | * Add a predefined Element that the opens Facebook app with a deep link to the specified user id 143 | * If the Facebook application is not installed this will open a web page instead. 144 | * 145 | * @param id the id of the Facebook user to display in the Facebook app 146 | * @param title the title to display on this item 147 | * @return this AboutPage instance for builder pattern support 148 | */ 149 | public AboutPage addFacebook(String id, String title) { 150 | Element facebookElement = new Element(); 151 | facebookElement.setTitle(title); 152 | facebookElement.setIconDrawable(R.drawable.about_icon_facebook); 153 | facebookElement.setIconTint(R.color.about_facebook_color); 154 | facebookElement.setValue(id); 155 | 156 | Intent intent = new Intent(); 157 | intent.setAction(Intent.ACTION_VIEW); 158 | intent.addCategory(Intent.CATEGORY_BROWSABLE); 159 | 160 | if (AboutPageUtils.isAppInstalled(mContext, "com.facebook.katana")) { 161 | intent.setPackage("com.facebook.katana"); 162 | int versionCode = 0; 163 | try { 164 | versionCode = mContext.getPackageManager().getPackageInfo("com.facebook.katana", 0).versionCode; 165 | } catch (PackageManager.NameNotFoundException e) { 166 | e.printStackTrace(); 167 | } 168 | 169 | if (versionCode >= 3002850) { 170 | Uri uri = Uri.parse("fb://facewebmodal/f?href=" + "http://m.facebook.com/" + id); 171 | intent.setData(uri); 172 | } else { 173 | Uri uri = Uri.parse("fb://page/" + id); 174 | intent.setData(uri); 175 | } 176 | } else { 177 | intent.setData(Uri.parse("http://m.facebook.com/" + id)); 178 | } 179 | 180 | facebookElement.setIntent(intent); 181 | 182 | addItem(facebookElement); 183 | return this; 184 | } 185 | 186 | /** 187 | * Convenience method for {@link AboutPage#addTwitter(String, String)} but with 188 | * a predefined title string 189 | * 190 | * @param id the Twitter id to display 191 | * @return this AboutPage instance for builder pattern support 192 | */ 193 | public AboutPage addTwitter(String id) { 194 | return addTwitter(id, mContext.getString(R.string.about_twitter)); 195 | } 196 | 197 | 198 | /** 199 | * Add a predefined Element that the opens the Twitter app with a deep link to the specified user id 200 | * If the Twitter application is not installed this will open a web page instead. 201 | * 202 | * @param id the id of the Twitter user to display in the Twitter app 203 | * @param title the title to display on this item 204 | * @return this AboutPage instance for builder pattern support 205 | */ 206 | public AboutPage addTwitter(String id, String title) { 207 | Element twitterElement = new Element(); 208 | twitterElement.setTitle(title); 209 | twitterElement.setIconDrawable(R.drawable.about_icon_twitter); 210 | twitterElement.setIconTint(R.color.about_twitter_color); 211 | twitterElement.setValue(id); 212 | 213 | Intent intent = new Intent(); 214 | intent.setAction(Intent.ACTION_VIEW); 215 | intent.addCategory(Intent.CATEGORY_BROWSABLE); 216 | 217 | if (AboutPageUtils.isAppInstalled(mContext, "com.twitter.android")) { 218 | intent.setPackage("com.twitter.android"); 219 | intent.setData(Uri.parse(String.format("twitter://user?screen_name=%s", id))); 220 | } else { 221 | intent.setData(Uri.parse(String.format("http://twitter.com/intent/user?screen_name=%s", id))); 222 | } 223 | 224 | twitterElement.setIntent(intent); 225 | addItem(twitterElement); 226 | return this; 227 | } 228 | 229 | /** 230 | * Convenience method for {@link AboutPage#addPlayStore(String, String)} but with 231 | * a predefined title string 232 | * 233 | * @param id the package id of the app to display 234 | * @return this AboutPage instance for builder pattern support 235 | */ 236 | public AboutPage addPlayStore(String id) { 237 | return addPlayStore(id, mContext.getString(R.string.about_play_store)); 238 | } 239 | 240 | /** 241 | * Add a predefined Element that the opens the PlayStore app with a deep link to the 242 | * specified app application id. 243 | * 244 | * @param id the package id of the app to display 245 | * @param title the title to display on this item 246 | * @return this AboutPage instance for builder pattern support 247 | */ 248 | public AboutPage addPlayStore(String id, String title) { 249 | Element playStoreElement = new Element(); 250 | playStoreElement.setTitle(title); 251 | playStoreElement.setIconDrawable(R.drawable.about_icon_google_play); 252 | playStoreElement.setIconTint(R.color.about_play_store_color); 253 | playStoreElement.setValue(id); 254 | 255 | Uri uri = Uri.parse("https://play.google.com/store/apps/details?id=" + id); 256 | Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri); 257 | playStoreElement.setIntent(goToMarket); 258 | 259 | addItem(playStoreElement); 260 | return this; 261 | } 262 | 263 | /** 264 | * Convenience method for {@link AboutPage#addYoutube(String, String)} but with 265 | * a predefined title string 266 | * 267 | * @param id the id of the channel to deep link to 268 | * @return this AboutPage instance for builder pattern support 269 | */ 270 | public AboutPage addYoutube(String id) { 271 | return addYoutube(id, mContext.getString(R.string.about_youtube)); 272 | } 273 | 274 | /** 275 | * Add a predefined Element that the opens the Youtube app with a deep link to the 276 | * specified channel id. 277 | *

278 | * If the Youtube app is not installed this will open the Youtube web page instead. 279 | * 280 | * @param id the id of the channel to deep link to 281 | * @param title the title to display on this item 282 | * @return this AboutPage instance for builder pattern support 283 | */ 284 | public AboutPage addYoutube(String id, String title) { 285 | Element youtubeElement = new Element(); 286 | youtubeElement.setTitle(title); 287 | youtubeElement.setIconDrawable(R.drawable.about_icon_youtube); 288 | youtubeElement.setIconTint(R.color.about_youtube_color); 289 | youtubeElement.setValue(id); 290 | 291 | Intent intent = new Intent(); 292 | intent.setAction(Intent.ACTION_VIEW); 293 | intent.setData(Uri.parse(String.format("http://youtube.com/channel/%s", id))); 294 | 295 | if (AboutPageUtils.isAppInstalled(mContext, "com.google.android.youtube")) { 296 | intent.setPackage("com.google.android.youtube"); 297 | } 298 | 299 | youtubeElement.setIntent(intent); 300 | addItem(youtubeElement); 301 | 302 | return this; 303 | } 304 | 305 | /** 306 | * Convenience method for {@link AboutPage#addInstagram(String, String)} (String, String)} but with 307 | * a predefined title string 308 | * 309 | * @param id the id of the instagram user to deep link to 310 | * @return this AboutPage instance for builder pattern support 311 | */ 312 | public AboutPage addInstagram(String id) { 313 | return addInstagram(id, mContext.getString(R.string.about_instagram)); 314 | } 315 | 316 | /** 317 | * Add a predefined Element that the opens the Instagram app with a deep link to the 318 | * specified user id. 319 | *

320 | * If the Instagram app is not installed this will open the Intagram web page instead. 321 | * 322 | * @param id the user id to deep link to 323 | * @param title the title to display on this item 324 | * @return this AboutPage instance for builder pattern support 325 | */ 326 | public AboutPage addInstagram(String id, String title) { 327 | Element instagramElement = new Element(); 328 | instagramElement.setTitle(title); 329 | instagramElement.setIconDrawable(R.drawable.about_icon_instagram); 330 | instagramElement.setIconTint(R.color.about_instagram_color); 331 | instagramElement.setValue(id); 332 | 333 | Intent intent = new Intent(); 334 | intent.setAction(Intent.ACTION_VIEW); 335 | intent.setData(Uri.parse("http://instagram.com/_u/" + id)); 336 | 337 | if (AboutPageUtils.isAppInstalled(mContext, "com.instagram.android")) { 338 | intent.setPackage("com.instagram.android"); 339 | } 340 | 341 | instagramElement.setIntent(intent); 342 | addItem(instagramElement); 343 | 344 | return this; 345 | } 346 | 347 | /** 348 | * Convenience method for {@link AboutPage#addGitHub(String, String)} but with 349 | * a predefined title string 350 | * 351 | * @param id the id of the GitHub user to display 352 | * @return this AboutPage instance for builder pattern support 353 | */ 354 | public AboutPage addGitHub(String id) { 355 | return addGitHub(id, mContext.getString(R.string.about_github)); 356 | } 357 | 358 | /** 359 | * Add a predefined Element that the opens the a browser and displays the specified GitHub 360 | * users profile page. 361 | * 362 | * @param id the GitHub user to link to 363 | * @param title the title to display on this item 364 | * @return this AboutPage instance for builder pattern support 365 | */ 366 | public AboutPage addGitHub(String id, String title) { 367 | Element gitHubElement = new Element(); 368 | gitHubElement.setTitle(title); 369 | gitHubElement.setIconDrawable(R.drawable.about_icon_github); 370 | gitHubElement.setIconTint(R.color.about_github_color); 371 | gitHubElement.setValue(id); 372 | 373 | Intent intent = new Intent(); 374 | intent.setAction(Intent.ACTION_VIEW); 375 | intent.addCategory(Intent.CATEGORY_BROWSABLE); 376 | intent.setData(Uri.parse(String.format("https://github.com/%s", id))); 377 | 378 | gitHubElement.setIntent(intent); 379 | addItem(gitHubElement); 380 | 381 | return this; 382 | } 383 | 384 | /** 385 | * Convenience method for {@link AboutPage#addWebsite(String, String)} but with 386 | * a predefined title string 387 | * 388 | * @param url the URL to open in a browser 389 | * @return this AboutPage instance for builder pattern support 390 | */ 391 | public AboutPage addWebsite(String url) { 392 | return addWebsite(url, mContext.getString(R.string.about_website)); 393 | } 394 | 395 | /** 396 | * Add a predefined Element that the opens a browser and loads the specified URL 397 | * 398 | * @param url the URL to open in a browser 399 | * @param title the title to display on this item 400 | * @return this AboutPage instance for builder pattern support 401 | */ 402 | public AboutPage addWebsite(String url, String title) { 403 | if (!url.startsWith("http://") && !url.startsWith("https://")) { 404 | url = "http://" + url; 405 | } 406 | Element websiteElement = new Element(); 407 | websiteElement.setTitle(title); 408 | websiteElement.setIconDrawable(R.drawable.about_icon_link); 409 | websiteElement.setValue(url); 410 | 411 | Uri uri = Uri.parse(url); 412 | Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri); 413 | 414 | websiteElement.setIntent(browserIntent); 415 | addItem(websiteElement); 416 | 417 | return this; 418 | } 419 | 420 | /** 421 | * Add a custom {@link Element} to this AboutPage 422 | * 423 | * @param element 424 | * @return this AboutPage instance for builder pattern support 425 | * @see Element 426 | */ 427 | public AboutPage addItem(Element element) { 428 | LinearLayout wrapper = mView.findViewById(R.id.about_providers); 429 | wrapper.addView(createItem(element)); 430 | wrapper.addView(getSeparator(), new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mContext.getResources().getDimensionPixelSize(R.dimen.about_separator_height))); 431 | return this; 432 | } 433 | 434 | /** 435 | * Set the header image to display in this AboutPage 436 | * 437 | * @param resource the resource id of the image to display 438 | * @return this AboutPage instance for builder pattern support 439 | */ 440 | public AboutPage setImage(@DrawableRes int resource) { 441 | this.mImage = resource; 442 | return this; 443 | } 444 | 445 | /** 446 | * Add a new group that will display a header in this AboutPage 447 | *

448 | * A header will be displayed in the order it was added. For e.g: 449 | *

450 | * 451 | * new AboutPage(this) 452 | * .addItem(firstItem) 453 | * .addGroup("Header") 454 | * .addItem(secondItem) 455 | * .create(); 456 | * 457 | *

458 | * Will display the following 459 | * [First item] 460 | * [Header] 461 | * [Second item] 462 | * 463 | * @param name the title for this group 464 | * @return this AboutPage instance for builder pattern support 465 | */ 466 | public AboutPage addGroup(String name) { 467 | 468 | TextView textView = new TextView(mContext); 469 | textView.setText(name); 470 | TextViewCompat.setTextAppearance(textView, AboutPageUtils.resolveResIdAttr(mContext, R.attr.aboutGroupTextAppearance, R.style.about_groupTextAppearance)); 471 | LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); 472 | 473 | if (mCustomFont != null) { 474 | textView.setTypeface(mCustomFont); 475 | } 476 | 477 | int padding = mContext.getResources().getDimensionPixelSize(R.dimen.about_group_text_padding); 478 | textView.setPadding(padding, padding, padding, padding); 479 | 480 | 481 | if (mIsRTL) { 482 | textView.setGravity(Gravity.END | Gravity.CENTER_VERTICAL); 483 | textParams.gravity = Gravity.END | Gravity.CENTER_VERTICAL; 484 | } else { 485 | textView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL); 486 | textParams.gravity = Gravity.START | Gravity.CENTER_VERTICAL; 487 | } 488 | textView.setLayoutParams(textParams); 489 | 490 | ((LinearLayout) mView.findViewById(R.id.about_providers)).addView(textView); 491 | return this; 492 | } 493 | 494 | /** 495 | * Turn on the RTL mode. 496 | * 497 | * @param value 498 | * @return this AboutPage instance for builder pattern support 499 | */ 500 | public AboutPage isRTL(boolean value) { 501 | this.mIsRTL = value; 502 | return this; 503 | } 504 | 505 | public AboutPage setDescription(CharSequence description) { 506 | this.mDescription = description; 507 | return this; 508 | } 509 | 510 | /** 511 | * Create and inflate this AboutPage. After this method is called the AboutPage 512 | * cannot be customized any more. 513 | * 514 | * @return the inflated {@link View} of this AboutPage 515 | */ 516 | public View create() { 517 | TextView description = mView.findViewById(R.id.description); 518 | ImageView image = mView.findViewById(R.id.image); 519 | 520 | if (mImage > 0) { 521 | image.setImageResource(mImage); 522 | } 523 | 524 | if (!TextUtils.isEmpty(mDescription)) { 525 | description.setText(mDescription); 526 | } 527 | 528 | if (mCustomFont != null) { 529 | description.setTypeface(mCustomFont); 530 | } 531 | 532 | return mView; 533 | } 534 | 535 | private View createItem(final Element element) { 536 | LinearLayout wrapper = new LinearLayout(mContext); 537 | wrapper.setOrientation(LinearLayout.HORIZONTAL); 538 | wrapper.setClickable(true); 539 | 540 | if (element.getOnClickListener() != null) { 541 | wrapper.setOnClickListener(element.getOnClickListener()); 542 | } else if (element.getIntent() != null) { 543 | wrapper.setOnClickListener(new View.OnClickListener() { 544 | @Override 545 | public void onClick(View view) { 546 | try { 547 | mContext.startActivity(element.getIntent()); 548 | } catch (ActivityNotFoundException e) { 549 | Log.e(LOG_TAG, "failed to launch intent for '" + element.getTitle() + "' element", e); 550 | } 551 | } 552 | }); 553 | 554 | } 555 | 556 | wrapper.setBackgroundResource(AboutPageUtils.resolveResIdAttr(mContext, R.attr.selectableItemBackground, android.R.color.transparent)); 557 | 558 | int padding = mContext.getResources().getDimensionPixelSize(R.dimen.about_text_padding); 559 | wrapper.setPadding(padding, padding, padding, padding); 560 | LinearLayout.LayoutParams wrapperParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); 561 | wrapper.setLayoutParams(wrapperParams); 562 | 563 | 564 | TextView textView = new TextView(mContext); 565 | TextViewCompat.setTextAppearance(textView, AboutPageUtils.resolveResIdAttr(mContext, R.attr.aboutElementTextAppearance, R.style.about_elementTextAppearance)); 566 | LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); 567 | textView.setLayoutParams(textParams); 568 | if (mCustomFont != null) { 569 | textView.setTypeface(mCustomFont); 570 | } 571 | 572 | ImageView iconView = null; 573 | 574 | if (element.getIconDrawable() != null) { 575 | iconView = new ImageView(mContext); 576 | int size = mContext.getResources().getDimensionPixelSize(R.dimen.about_icon_size); 577 | LinearLayout.LayoutParams iconParams = new LinearLayout.LayoutParams(size, size); 578 | iconView.setLayoutParams(iconParams); 579 | int iconPadding = mContext.getResources().getDimensionPixelSize(R.dimen.about_icon_padding); 580 | iconView.setPadding(iconPadding, 0, iconPadding, 0); 581 | 582 | if (Build.VERSION.SDK_INT < 21) { 583 | Drawable drawable = VectorDrawableCompat.create(iconView.getResources(), element.getIconDrawable(), iconView.getContext().getTheme()); 584 | iconView.setImageDrawable(drawable); 585 | } else { 586 | iconView.setImageResource(element.getIconDrawable()); 587 | } 588 | 589 | Drawable wrappedDrawable = DrawableCompat.wrap(iconView.getDrawable()); 590 | wrappedDrawable = wrappedDrawable.mutate(); 591 | 592 | final boolean isNightModeEnabled = AboutPageUtils.isNightModeEnabled(mContext); 593 | final int iconColor = AboutPageUtils.resolveColorAttr(mContext, R.attr.aboutElementIconTint); 594 | if (!element.getSkipTint()) { 595 | if (element.getAutoApplyIconTint()) { 596 | if (isNightModeEnabled) { 597 | if (element.getIconNightTint() != null) { 598 | DrawableCompat.setTint(wrappedDrawable, ContextCompat.getColor(mContext, element.getIconNightTint())); 599 | } else { 600 | DrawableCompat.setTint(wrappedDrawable, iconColor); 601 | } 602 | } else { 603 | if (element.getIconTint() != null) { 604 | DrawableCompat.setTint(wrappedDrawable, ContextCompat.getColor(mContext, element.getIconTint())); 605 | } else { 606 | DrawableCompat.setTint(wrappedDrawable, iconColor); 607 | } 608 | } 609 | 610 | } else if (element.getIconTint() != null) { 611 | DrawableCompat.setTint(wrappedDrawable, ContextCompat.getColor(mContext, element.getIconTint())); 612 | } else if (isNightModeEnabled) { 613 | DrawableCompat.setTint(wrappedDrawable, iconColor); 614 | } 615 | 616 | } 617 | 618 | } else { 619 | int iconPadding = mContext.getResources().getDimensionPixelSize(R.dimen.about_icon_padding); 620 | textView.setPadding(iconPadding, iconPadding, iconPadding, iconPadding); 621 | } 622 | 623 | textView.setText(element.getTitle()); 624 | 625 | 626 | if (mIsRTL) { 627 | 628 | final int gravity = element.getGravity() != null ? element.getGravity() : Gravity.END; 629 | 630 | wrapper.setGravity(gravity | Gravity.CENTER_VERTICAL); 631 | //noinspection ResourceType 632 | textParams.gravity = gravity | Gravity.CENTER_VERTICAL; 633 | wrapper.addView(textView); 634 | if (element.getIconDrawable() != null) { 635 | wrapper.addView(iconView); 636 | } 637 | 638 | } else { 639 | final int gravity = element.getGravity() != null ? element.getGravity() : Gravity.START; 640 | wrapper.setGravity(gravity | Gravity.CENTER_VERTICAL); 641 | //noinspection ResourceType 642 | textParams.gravity = gravity | Gravity.CENTER_VERTICAL; 643 | if (element.getIconDrawable() != null) { 644 | wrapper.addView(iconView); 645 | } 646 | wrapper.addView(textView); 647 | } 648 | 649 | return wrapper; 650 | } 651 | 652 | private View getSeparator() { 653 | return mInflater.inflate(R.layout.about_page_separator, null); 654 | } 655 | } 656 | -------------------------------------------------------------------------------- /library/src/main/java/mehdi/sakout/aboutpage/AboutPageUtils.java: -------------------------------------------------------------------------------- 1 | package mehdi.sakout.aboutpage; 2 | 3 | import android.content.Context; 4 | import android.content.pm.PackageInfo; 5 | import android.content.pm.PackageManager; 6 | import android.content.res.Configuration; 7 | import android.content.res.Resources; 8 | import android.util.TypedValue; 9 | 10 | import androidx.annotation.AttrRes; 11 | import androidx.annotation.ColorInt; 12 | import androidx.annotation.NonNull; 13 | import androidx.core.content.ContextCompat; 14 | 15 | import java.util.List; 16 | 17 | class AboutPageUtils { 18 | 19 | static Boolean isAppInstalled(Context context, String appName) { 20 | PackageManager pm = context.getPackageManager(); 21 | boolean installed = false; 22 | List packages = pm.getInstalledPackages(0); 23 | 24 | for (PackageInfo packageInfo : packages) { 25 | if (packageInfo.packageName.equals(appName)) { 26 | installed = true; 27 | break; 28 | } 29 | } 30 | 31 | return installed; 32 | } 33 | 34 | @ColorInt 35 | static int resolveColorAttr(@NonNull Context context, @AttrRes int attr) { 36 | final TypedValue outValue = resolveAttr(context, attr); 37 | if (outValue.type >= TypedValue.TYPE_FIRST_COLOR_INT && outValue.type <= TypedValue.TYPE_LAST_COLOR_INT) { 38 | return outValue.data; 39 | } 40 | 41 | return ContextCompat.getColor(context, outValue.resourceId); 42 | } 43 | 44 | static int resolveResIdAttr(@NonNull Context context, @AttrRes int attr, int defaultValue) { 45 | try { 46 | return resolveAttr(context, attr).resourceId; 47 | } catch (Resources.NotFoundException e) { 48 | return defaultValue; 49 | } 50 | } 51 | 52 | @NonNull 53 | private static TypedValue resolveAttr(@NonNull Context context, @AttrRes int attr) { 54 | final TypedValue outValue = new TypedValue(); 55 | if (!context.getTheme().resolveAttribute(attr, outValue, true)) { 56 | throw new Resources.NotFoundException("'" + context.getResources().getResourceName(attr) + "' is not set."); 57 | } 58 | 59 | if (outValue.type == TypedValue.TYPE_ATTRIBUTE) { 60 | return resolveAttr(context, outValue.data); 61 | } 62 | 63 | return outValue; 64 | } 65 | 66 | static boolean isNightModeEnabled(@NonNull Context context) { 67 | final int nightMode = context.getResources().getConfiguration().uiMode; 68 | return (nightMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /library/src/main/java/mehdi/sakout/aboutpage/Element.java: -------------------------------------------------------------------------------- 1 | package mehdi.sakout.aboutpage; 2 | 3 | import android.content.Intent; 4 | import androidx.annotation.ColorRes; 5 | import androidx.annotation.DrawableRes; 6 | import androidx.annotation.Nullable; 7 | import androidx.appcompat.app.AppCompatDelegate; 8 | import android.view.View; 9 | 10 | /** 11 | * Element class represents an about item in the about page. 12 | * Use {@link AboutPage#addItem(mehdi.sakout.aboutpage.Element)} to add your 13 | * custom items to the AboutPage. This class can be constructed in a builder pattern type fashion. 14 | */ 15 | public class Element { 16 | 17 | private String title; 18 | private Integer iconDrawable; 19 | private Integer colorDay; 20 | private Integer colorNight; 21 | private String value; 22 | private Intent intent; 23 | private Integer gravity; 24 | private Boolean autoIconColor = false; 25 | private Boolean skipTint = false; 26 | 27 | private View.OnClickListener onClickListener; 28 | 29 | public Element() { 30 | 31 | } 32 | 33 | public Element(String title, Integer iconDrawable) { 34 | this.title = title; 35 | this.iconDrawable = iconDrawable; 36 | } 37 | 38 | /** 39 | * Get the onClickListener for this Element 40 | * 41 | * @return 42 | * @see android.view.View.OnClickListener 43 | */ 44 | public View.OnClickListener getOnClickListener() { 45 | return onClickListener; 46 | } 47 | 48 | /** 49 | * Set the onClickListener for this Element. It will be invoked when this particular element 50 | * is clicked on the AboutPage. This method has higher priority than 51 | * {@link Element#setIntent(android.content.Intent)} when both methods are used 52 | * 53 | * @param onClickListener 54 | * @return this Element instance for builder pattern support 55 | * @see android.view.View.OnClickListener 56 | */ 57 | public Element setOnClickListener(View.OnClickListener onClickListener) { 58 | this.onClickListener = onClickListener; 59 | return this; 60 | } 61 | 62 | /** 63 | * Get the gravity of the content of this Element 64 | * 65 | * @return See {@link android.view.Gravity} 66 | */ 67 | public Integer getGravity() { 68 | return gravity; 69 | } 70 | 71 | /** 72 | * Set the Gravity of the content for this Element 73 | * 74 | * @param gravity See {@link android.view.Gravity} 75 | * @return this Element instance for builder pattern support 76 | */ 77 | public Element setGravity(Integer gravity) { 78 | this.gravity = gravity; 79 | return this; 80 | } 81 | 82 | /** 83 | * @return the title for this Element 84 | */ 85 | @Nullable 86 | public String getTitle() { 87 | return title; 88 | } 89 | 90 | /** 91 | * Set the title for this Element 92 | * 93 | * @param title the string value to set 94 | * @return this Element instance for builder pattern support 95 | */ 96 | public Element setTitle(String title) { 97 | this.title = title; 98 | return this; 99 | } 100 | 101 | /** 102 | * Get the icon drawable for this Element that appears to the left of the title or to the 103 | * right of the title in RTL layout mode. 104 | * 105 | * @return the icon drawable resource of this Element 106 | */ 107 | @DrawableRes 108 | @Nullable 109 | public Integer getIconDrawable() { 110 | return iconDrawable; 111 | } 112 | 113 | /** 114 | * Set the icon drawable for this Element that appears to the left of the title or to the 115 | * right of the title in RTL layout mode. 116 | * 117 | * @param iconDrawable the icon drawable resource to set 118 | * @return this Element instance for builder pattern support 119 | */ 120 | public Element setIconDrawable(@DrawableRes Integer iconDrawable) { 121 | this.iconDrawable = iconDrawable; 122 | return this; 123 | } 124 | 125 | /** 126 | * @return the color resource identifier for this Elements icon 127 | */ 128 | @ColorRes 129 | @Nullable 130 | public Integer getIconTint() { 131 | return colorDay; 132 | } 133 | 134 | /** 135 | * Set the color resource identifier for this Elements icon 136 | * 137 | * @param color the color resource identifier to use for this Element 138 | * @return this Element instance for builder pattern support 139 | */ 140 | public Element setIconTint(@ColorRes Integer color) { 141 | this.colorDay = color; 142 | return this; 143 | } 144 | 145 | /** 146 | * Get the color resource identifier for this Elements icon when in night mode 147 | * 148 | * @return 149 | * @see AppCompatDelegate#setDefaultNightMode(int) 150 | */ 151 | @ColorRes 152 | public Integer getIconNightTint() { 153 | return colorNight; 154 | } 155 | 156 | /** 157 | * Set the icon tint to be used for this Elements icon when in night mode. If no color 158 | * is specified the accent color of the current theme will be used in night mode. 159 | * 160 | * @param colorNight 161 | * @return 162 | */ 163 | public Element setIconNightTint(@ColorRes Integer colorNight) { 164 | this.colorNight = colorNight; 165 | return this; 166 | } 167 | 168 | public String getValue() { 169 | return value; 170 | } 171 | 172 | public Element setValue(String value) { 173 | this.value = value; 174 | return this; 175 | } 176 | 177 | /** 178 | * Get the intent to be used for when this Element 179 | * 180 | * @return 181 | * @see Element#setIntent(android.content.Intent) 182 | */ 183 | public Intent getIntent() { 184 | return intent; 185 | } 186 | 187 | /** 188 | * Set the intent to pass to the 189 | * {@link android.content.Context#startActivity(android.content.Intent)} method when this item 190 | * is clicked. This method has lower priority than 191 | * {@link mehdi.sakout.aboutpage.Element#setOnClickListener(android.view.View.OnClickListener)} 192 | * when both are used. 193 | * 194 | * @param intent the intent to be used 195 | * @return this Element instance for builder pattern support 196 | * @see android.content.Intent 197 | */ 198 | public Element setIntent(Intent intent) { 199 | this.intent = intent; 200 | return this; 201 | } 202 | 203 | /** 204 | * @return the AutoIcon 205 | */ 206 | public Boolean getAutoApplyIconTint() { 207 | return autoIconColor; 208 | } 209 | 210 | /** 211 | * Automatically apply tint to this Elements icon. 212 | * 213 | * @param autoIconColor 214 | * @return this Element instance for builder pattern support 215 | */ 216 | public Element setAutoApplyIconTint(Boolean autoIconColor) { 217 | this.autoIconColor = autoIconColor; 218 | return this; 219 | } 220 | 221 | /** 222 | * Skip Applying a custom tint usefull when the provided drawable isn't a vectorDrawable 223 | * @param skipTint 224 | */ 225 | public void setSkipTint(Boolean skipTint) { 226 | this.skipTint = skipTint; 227 | } 228 | 229 | public Boolean getSkipTint() { 230 | return skipTint; 231 | } 232 | } 233 | -------------------------------------------------------------------------------- /library/src/main/res/drawable/about_icon_email.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /library/src/main/res/drawable/about_icon_facebook.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /library/src/main/res/drawable/about_icon_github.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | -------------------------------------------------------------------------------- /library/src/main/res/drawable/about_icon_google_play.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /library/src/main/res/drawable/about_icon_instagram.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /library/src/main/res/drawable/about_icon_link.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /library/src/main/res/drawable/about_icon_twitter.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /library/src/main/res/drawable/about_icon_youtube.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /library/src/main/res/layout/about_page.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | 15 | 16 | 19 | 20 | 24 | 25 | 26 | 29 | 30 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /library/src/main/res/layout/about_page_separator.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /library/src/main/res/values-ar/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ﺇﺗﺼﻞ ﺑﻨﺎ 3 | ﺗﺎﺑﻌﻨﺎ ﻋﻠﻰ اﻹﻧﺴﺘﻐﺮاﻡ 4 | ﺗﺎﺑﻌﻨﺎ ﻋﻠﻰ اﻟﻔﻴﺲ ﺑﻮﻙ 5 | ﻗﻴِّﻢ اﻟتطبيق ﻋﻠﻰ اﻟﺒﻼﻱ ﺳﺘﻮﺭ 6 | ﺗﺎﺑﻌﻨﺎ ﻋﻠﻰ اﻟﻴﻮﺗﻮﺏ 7 | ﺗﺎﺑﻌﻨﺎ ﻋﻠﻰ اﻟﺘﻮﻳﺘﺮ 8 | ﺇﺳﺘﻨﺴﺦ اﻟﻤﺸﺮﻭﻉ 9 | ﺯﺭ ﻣﻮﻗﻌﻨﺎ 10 | -------------------------------------------------------------------------------- /library/src/main/res/values-az/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Əlaqə 3 | Bizi Instagram-dan izlə 4 | Bizi Facebook-da bəyən 5 | Bizi Play Store-da qiymətləndirin 6 | Bizi YouTube-dan izləyin 7 | Bizi Twitter-dən izləyin 8 | Bizi Github-dan bəyən 9 | Saytımıza baş çəkin 10 | 11 | -------------------------------------------------------------------------------- /library/src/main/res/values-bg/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Свържете се с нас 4 | Последвайте ни в Instagram 5 | Харесайте ни във Facebook 6 | Оценете ни в Play Store 7 | Гледайте ни в Youtube 8 | Последвайте ни в Twitter 9 | Разклонете в GitHub 10 | Посетете нашият уебсайт 11 | -------------------------------------------------------------------------------- /library/src/main/res/values-ca/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Contacte 4 | Segueix-nos a Instagram 5 | Segueix-nos a Facebook 6 | Puntua\'ns a Play Store 7 | Mira els nostres vídeos a Youtube 8 | Segueix-nos a Twitter 9 | Fes una còpia a GitHub 10 | Visita la nostra pàgina web 11 | -------------------------------------------------------------------------------- /library/src/main/res/values-cs/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Napište nám 3 | Sledujte nás na Instagramu 4 | Lajkněte nás na Facebooku 5 | Ohodnoťte nás v Obchodě Play 6 | Sledujte nás na Youtube 7 | Sledujte nás na Twitteru 8 | Forkni nás na GitHubu 9 | Navštivte naše webové stránky 10 | -------------------------------------------------------------------------------- /library/src/main/res/values-de/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Kontaktieren Sie uns 3 | Folgen Sie uns auf Instagram 4 | Liken Sie uns auf Facebook 5 | Bewerten Sie uns im Play Store 6 | Unsere Videos auf Youtube 7 | Folgen Sie uns auf Twitter 8 | Forken Sie uns auf GitHub 9 | Besuchen Sie unsere Webseite 10 | 11 | -------------------------------------------------------------------------------- /library/src/main/res/values-el/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Επικοινωνήστε μαζί μας 4 | Ακολουθήστε μας στο Instagram 5 | Κάντε like στην σελίδα μας στο Facebook 6 | Αξιολογήστε μας στο Play Store 7 | Παρακολουθήστε μας στο YouTube 8 | Ακολουθήστε μας στο Twitter 9 | Καντε μας fork στο Github 10 | Επισκεφθείτε την ιστοσελίδα μας 11 | -------------------------------------------------------------------------------- /library/src/main/res/values-es/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Contáctenos 4 | Síganos en Instagram 5 | Síganos en Facebook 6 | Puntúanos en Play Store 7 | Mire nuestros vídeos en Youtube 8 | Síganos en Twitter 9 | Haga una copia en GitHub 10 | Visite nuestro sitio web 11 | -------------------------------------------------------------------------------- /library/src/main/res/values-fa/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | تماس با ما 4 | ما را دراینستاگرام دنبال کنید 5 | ما را در فیسبوک دنبال کنید 6 | به ما در گوگل پلی امتیاز بدید 7 | آخرین ویدیو های ما در یوتیوب 8 | ما را در توییتر دنبال کنید 9 | ما را در گیتهاب دنبال کنید 10 | وبسایت ما 11 | 12 | -------------------------------------------------------------------------------- /library/src/main/res/values-fr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Contactez-nous 4 | Suivez-nous sur Instagram 5 | Likez notre page sur Facebook 6 | Évaluez-nous sur Play Store 7 | Regardez nos vidéos sur Youtube 8 | Suivez-nous sur Twitter 9 | Forkez notre projet sur GitHub 10 | Visitez notre site 11 | 12 | -------------------------------------------------------------------------------- /library/src/main/res/values-hi/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | संपर्क करें 4 | Instagram पर फॉलो करें 5 | Facebook पर लाइक करे 6 | Play Store पर रेटिंग दें 7 | YouTube पर हमें देखें 8 | Twitter पर फॉलो करे 9 | GitHub पर फोर्क करें 10 | वेबसाइट देखें 11 | 12 | -------------------------------------------------------------------------------- /library/src/main/res/values-hr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kontaktirajte nas 4 | Pratite nas na Instagramu 5 | Lajkajte nas na Facebooku 6 | Ocijenite nas u Trgovini Play 7 | Gledajte nas na YouTubu 8 | Pratite nas na Twitteru 9 | Forkajte nas na GitHubu 10 | Posjetite našu web stranicu 11 | -------------------------------------------------------------------------------- /library/src/main/res/values-hu/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Fork-olj minket GitHub-on 4 | Írj nekünk 5 | Kövess minket Instagram-on 6 | Lájkolj minket Facebook-on 7 | Értékelj minket a Play Store-ban 8 | Kövess minket Twitter-en 9 | Látogasd meg weboldalunkat 10 | Nézz minket Youtube-on 11 | -------------------------------------------------------------------------------- /library/src/main/res/values-id/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hubungi kami 5 | Ikuti kami di Instagram 6 | "Like" kami di Facebook 7 | Beri kami nilai di Play Store 8 | Tonton video kami di Youtube 9 | Ikuti kami di Twitter 10 | "Fork" proyek ini di GitHub 11 | Kunjungi website kami 12 | 13 | -------------------------------------------------------------------------------- /library/src/main/res/values-it/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Contattaci 3 | Seguici su Instagram 4 | Metti mi piace su Facebook 5 | Valutaci sul Play Store 6 | Iscriviti al canale Youtube 7 | Seguici su Twitter 8 | Contribuisci su GitHub 9 | Visita il nostro sito 10 | 11 | -------------------------------------------------------------------------------- /library/src/main/res/values-iw-rIL/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | עמוק הפייסבוק שלנו 4 | הגיטהב שלנו 5 | עקוב אחרינו באינסטגרם 6 | דרג אותנו בפליי סטור 7 | עקוב אחרינו בטוויטר 8 | עמוד הבית שלנו 9 | ערוץ היוטיוב שלנו 10 | צור קשר 11 | -------------------------------------------------------------------------------- /library/src/main/res/values-ja/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | お問い合わせ 3 | Instagramでフォローする 4 | Facebookでいいねを付ける 5 | Play Storeで評価する 6 | Youtubeで視聴する 7 | Twitterでフォローする 8 | GitHubでフォークする 9 | ウェブサイトを訪問する 10 | 11 | -------------------------------------------------------------------------------- /library/src/main/res/values-ka/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | დაგვიკავშირდით 3 | გამოგვყევით Instagram-ზე 4 | მოგვიწონეთ Facebook-ზე 5 | შეგვაფასეთ Play Store-ზე 6 | გვიყურეთ Youtube-ზე 7 | გამოგვყევით Twitter-ზე 8 | გვიპოვეთ GitHub-ზე 9 | ეწვიეთ ვებ-გვერდს 10 | 11 | -------------------------------------------------------------------------------- /library/src/main/res/values-ko/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 개발자에게 연락하기 3 | 인스타그램 팔로우하기 4 | 페이스북 좋아요하기 5 | 플레이 스토어 평점주기 6 | Youtube 동영상 보기 7 | 트위터 팔로우하기 8 | GitHub 소스보기 9 | 홈페이지 방문하기 10 | -------------------------------------------------------------------------------- /library/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 23 | 24 | 27 | 28 | 35 | 36 | 43 | 44 | 51 | 52 | 57 | 58 | 61 | 62 | 70 | 71 | 75 | 76 | 79 | 80 | 84 | 85 | 88 | -------------------------------------------------------------------------------- /resources/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/medyo/android-about-page/1fd208ca287d152cd1bec7733949df9914615ecb/resources/cover.png -------------------------------------------------------------------------------- /scripts/publish-module.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'maven-publish' 2 | apply plugin: 'signing' 3 | 4 | task androidSourcesJar(type: Jar) { 5 | archiveClassifier.set('sources') 6 | if (project.plugins.findPlugin("com.android.library")) { 7 | from android.sourceSets.main.java.srcDirs 8 | } else { 9 | from sourceSets.main.java.srcDirs 10 | } 11 | } 12 | 13 | artifacts { 14 | archives androidSourcesJar 15 | } 16 | 17 | group = PUBLISH_GROUP_ID 18 | version = PUBLISH_VERSION 19 | 20 | afterEvaluate { 21 | publishing { 22 | publications { 23 | release(MavenPublication) { 24 | // The coordinates of the library, being set from variables that 25 | // we'll set up later 26 | groupId PUBLISH_GROUP_ID 27 | artifactId PUBLISH_ARTIFACT_ID 28 | version PUBLISH_VERSION 29 | 30 | // Two artifacts, the `aar` (or `jar`) and the sources 31 | if (project.plugins.findPlugin("com.android.library")) { 32 | from components.release 33 | } else { 34 | artifact("$buildDir/libs/${project.getName()}-${version}.jar") 35 | } 36 | 37 | artifact androidSourcesJar 38 | 39 | // Mostly self-explanatory metadata 40 | pom { 41 | name = PUBLISH_ARTIFACT_ID 42 | description = PUBLISH_DESCRIPTION 43 | url = PUBLISH_URL 44 | licenses { 45 | license { 46 | name = PUBLISH_LICENSE_NAME 47 | url = PUBLISH_LICENSE_URL 48 | } 49 | } 50 | developers { 51 | developer { 52 | id = PUBLISH_DEVELOPER_ID 53 | name = PUBLISH_DEVELOPER_NAME 54 | email = PUBLISH_DEVELOPER_EMAIL 55 | } 56 | } 57 | 58 | // Version control info - if you're using GitHub, follow the 59 | // format as seen here 60 | scm { 61 | connection = PUBLISH_SCM_CONNECTION 62 | developerConnection = PUBLISH_SCM_DEVELOPER_CONNECTION 63 | url = PUBLISH_SCM_URL 64 | } 65 | } 66 | } 67 | } 68 | } 69 | } 70 | 71 | ext["signing.keyId"] = rootProject.ext["signing.keyId"] 72 | ext["signing.password"] = rootProject.ext["signing.password"] 73 | ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"] 74 | 75 | signing { 76 | sign publishing.publications 77 | } -------------------------------------------------------------------------------- /scripts/publish-root.gradle: -------------------------------------------------------------------------------- 1 | // Create variables with empty default values 2 | ext["signing.keyId"] = '' 3 | ext["signing.password"] = '' 4 | ext["signing.secretKeyRingFile"] = '' 5 | ext["ossrhUsername"] = '' 6 | ext["ossrhPassword"] = '' 7 | ext["sonatypeStagingProfileId"] = '' 8 | 9 | File secretPropsFile = project.rootProject.file('local.properties') 10 | if (secretPropsFile.exists()) { 11 | // Read local.properties file first if it exists 12 | Properties p = new Properties() 13 | new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) } 14 | p.each { name, value -> ext[name] = value } 15 | } else { 16 | // Use system environment variables 17 | ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME') 18 | ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD') 19 | ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') 20 | ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') 21 | ext["signing.password"] = System.getenv('SIGNING_PASSWORD') 22 | ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE') 23 | } 24 | 25 | // Set up Sonatype repository 26 | nexusPublishing { 27 | repositories { 28 | sonatype { 29 | stagingProfileId = sonatypeStagingProfileId 30 | username = ossrhUsername 31 | password = ossrhPassword 32 | nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) 33 | snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':library' 2 | --------------------------------------------------------------------------------