Skip to content

Commit d0c16f8

Browse files
committed
Merge branch 'develop'
2 parents b6ee962 + 012ab68 commit d0c16f8

File tree

90 files changed

+2842
-2877
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+2842
-2877
lines changed

.scripts/gen-bintray-descriptor.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
eval "cat << EOF
4+
$(<bintray-format.json)
5+
EOF
6+
" > bintray.json

.travis.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,17 @@ android:
99
- extra-google-m2repository
1010
- extra-android-m2repository
1111
jdk:
12-
- oraclejdk8
12+
- oraclejdk8
13+
before_deploy:
14+
- if ! [ -e bintray.json ]; then
15+
chmod +x .scripts/gen-bintray-descriptor.sh;
16+
./.scripts/gen-bintray-descriptor.sh;
17+
fi
18+
deploy:
19+
- provider: bintray
20+
skip_cleanup: true
21+
file: "bintray.json"
22+
user: "18jafenn90"
23+
key: $BINTRAY_KEY
24+
on:
25+
all_branches: true

README.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
Attribouter
22
[![](https://jitpack.io/v/me.jfenn/Attribouter.svg)](https://jitpack.io/#me.jfenn/Attribouter)
3-
[![Build Status](https://travis-ci.com/fennifith/Attribouter.svg)](https://travis-ci.com/fennifith/Attribouter)
4-
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/91f0d7f732be4668aa428d5c634a531d)](https://www.codacy.com/app/fennifith/Attribouter?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=fennifith/Attribouter&amp;utm_campaign=Badge_Grade)
5-
[![Discord](https://img.shields.io/discord/514625116706177035.svg?logo=discord&colorB=7289da)](https://discord.gg/amDKN6A)
3+
[![Build Status](https://github.com/fennifith/Attribouter/workflows/Gradle%20Build/badge.svg)](https://github.com/fennifith/Alarmio/actions)
4+
[![Discord](https://img.shields.io/discord/514625116706177035.svg?logo=discord&colorB=7289da)](https://discord.jfenn.me/)
65
[![Liberapay](https://img.shields.io/badge/liberapay-donate-yellow.svg?logo=liberapay)](https://liberapay.com/fennifith/donate)
76
=====
87

98
Attribouter is a lightweight "about screen" for Android apps, built to allow developers to easily give credit to a project's contributors and open source libraries, while matching the style of their app and saving the largest amount of time and effort possible. It is meant to use GitHub's [REST API](https://developer.github.com/v3/) to fetch and display information about open source projects and contributors, but it allows you to define some or all of its data in its configuration file in your app as well.
109

1110
### Screenshots
1211

13-
This is just sample data. It is not real. Though Jahir is lazy, so that part is (joking).
14-
1512
| Contributors | Contributor | Licenses | License |
1613
|--------------|-------------|----------|---------|
1714
| ![img](https://jfenn.me/images/screenshots/Attribouter-Main.png) | ![img](https://jfenn.me/images/screenshots/Attribouter-Contributor.png) | ![img](https://jfenn.me/images/screenshots/Attribouter-Licenses.png) | ![img](https://jfenn.me/images/screenshots/Attribouter-License.png) |
@@ -36,42 +33,42 @@ allprojects {
3633
To add the dependency, copy this line into your app module's build.gradle file.
3734

3835
```gradle
39-
implementation 'me.jfenn:Attribouter:0.1.5'
36+
implementation 'me.jfenn:Attribouter:0.1.6'
4037
```
4138

42-
##### Support Libraries
43-
44-
The Android support libraries have been refactored from `android.support.*` to `androidx.*` as detailed [here](https://developer.android.com/topic/libraries/support-library/androidx-overview). As such, Attribouter only uses the new dependencies. If your project still uses the older support libraries for some reason, you may either compile your own version of Attribouter or use the last version to use the old support libraries, `0.1.2`.
45-
4639
### Starting an Activity
4740
This is pretty simple.
4841

49-
``` java
42+
``` kotlin
5043
Attribouter.from(context).show();
5144
```
5245

5346
### Creating a Fragment
5447
This is also pretty simple.
5548

56-
``` java
57-
Fragment fragment = Attribouter.from(context).toFragment();
49+
``` kotlin
50+
val fragment = Attribouter.from(context).toFragment();
5851
```
5952

6053
## Things to Note
6154

6255
### Request Limits
6356

64-
This library does not use an auth key for the GitHub API by default. It does cache data for up to 10 days to avoid crossing GitHub's [rate limits](https://developer.github.com/v3/rate_limit/), but if your project has more than a few contributors and libraries *or* you want it to have access to a private repository, you will need to provide an auth token by calling `.withGitHubToken(token)` on your instance of `Attribouter`.
57+
This library does not use an auth key for the GitHub API by default. It does cache data to avoid crossing GitHub's [rate limits](https://developer.github.com/v3/rate_limit/), but if your project has more than a few contributors and libraries *or* you want it to have access to a private repository, you will need to provide an auth token by calling `.withGitHubToken(token)` on your instance of `Attribouter`.
58+
59+
_Be careful not to include this token with your source code._ There are other methods of providing your token at build-time, such as using a [BuildConfig field](https://developer.android.com/studio/build/gradle-tips#share-custom-fields-and-resource-values-with-your-app-code) with an environment variable, that can prevent this from being an issue. These tokens aren't especially dangerous without any scopes/permissions, but GitHub will automatically deactivate them if they show up in any commits/files on their services, which could cause problems for Attribouter.
6560

6661
### Configuration
6762

6863
By default, Attribouter will use the configuration file at [res/xml/attribouter.xml](./attribouter/src/main/res/xml/attribouter.xml). You can either name your configuration file "attribouter.xml" to override the resource, or name it differently and call `.withFile(R.xml.[name])` on your instance of `Attribouter` instead.
6964

7065
The configuration file consists of a single root element, `<about>`, with many child elements that can be placed any amount of times in any order, the same as views in a layout file. These elements, called "wedges" in this library for no apparent reason, are created by Attribouter and added to the page in the order and heirarchy that they are defined in. To create your configuration file, you can either use the [file from the sample project](./app/src/main/res/xml/about.xml) as a template or use [the documentation](https://jfenn.me/projects/attribouter/wiki) to write your own.
7166

72-
### Proguard
67+
### Proguard / Minification
68+
69+
For those using the R8 compiler, Attribouter's [proguard rules](./attribouter/consumer-rules.pro) should be conveniently bundled with the library already - otherwise, you will need to add them to your app's `proguard-rules.pro` file yourself to prevent running into any issues with `minifyEnabled` and the like.
7370

74-
This library uses GSON, which does not behave nicely with proguard as it uses reflection to instantiate classes and initialize variables based on their names. It is recommended to use the [example configuration](https://github.com/google/gson/blob/master/examples/android-proguard-example/proguard.cfg) in GSON's repo to prevent these issues.
71+
Unfortunately, Attribouter still doesn't behave well with `shrinkResources`, as the compiler cannot detect references from Attribouter's config file and will exclude them from compilation. There is a [workaround](https://developer.android.com/studio/build/shrink-code#shrink-resources) to this, however - create a `<resources>` tag somewhere in your project, and specify `tools:keep="@{resource}"` for all of the strings and drawables referenced by your config file. For all of Attribouter's own resources, this has already been done - if you are not referencing any resources in your configuration, then there shouldn't be an issue.
7572

7673
## Used in
7774

app/build.gradle

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,35 @@ android {
55

66
defaultConfig {
77
applicationId "me.jfenn.attriboutersample"
8-
minSdkVersion 15
8+
minSdkVersion 16
99
targetSdkVersion 28
1010
versionCode 1
1111
versionName "1.0"
1212

1313
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
14+
}
1415

16+
compileOptions {
17+
sourceCompatibility JavaVersion.VERSION_1_8
18+
targetCompatibility JavaVersion.VERSION_1_8
1519
}
1620

1721
buildTypes {
18-
release {
19-
minifyEnabled false
20-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21-
}
22+
debug {
23+
minifyEnabled false
24+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
25+
}
26+
release {
27+
minifyEnabled false
28+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
29+
}
2230
}
2331
}
2432

2533
dependencies {
2634
implementation fileTree(dir: 'libs', include: ['*.jar'])
27-
implementation 'androidx.appcompat:appcompat:1.0.1'
28-
implementation 'com.google.android.material:material:1.0.0'
35+
implementation "androidx.appcompat:appcompat:$deps.android.appcompat"
36+
implementation "com.google.android.material:material:$deps.google.material"
2937

3038
implementation project(':attribouter')
3139
}

app/proguard-rules.pro

Lines changed: 97 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,97 @@
1-
# Add project specific ProGuard rules here.
2-
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
4-
#
5-
# For more details, see
6-
# http://developer.android.com/guide/developing/tools/proguard.html
7-
8-
# If your project uses WebView with JS, uncomment the following
9-
# and specify the fully qualified class name to the JavaScript interface
10-
# class:
11-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12-
# public *;
13-
#}
14-
15-
# Uncomment this to preserve the line number information for
16-
# debugging stack traces.
17-
#-keepattributes SourceFile,LineNumberTable
18-
19-
# If you keep the line number information, uncomment this to
20-
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile
1+
##---------------Begin: Attribouter-specific configuration --------
2+
3+
# For xml-specified drawable resources
4+
-keep class me.jfenn.attribouter.R$*
5+
-keepclassmembers class me.jfenn.attribouter.R$* {
6+
public static <fields>;
7+
}
8+
9+
# For wedge construction (from xml parser)
10+
-keep class * extends me.jfenn.attribouter.wedges.Wedge
11+
12+
# For data/gson classes
13+
-keepclassmembers class me.jfenn.attribouter.provider.net.*.data.** {
14+
!transient <fields>;
15+
}
16+
17+
##---------------End: Attribouter-specific configuration ----------
18+
19+
##---------------Begin: proguard configuration for Retrofit -------
20+
21+
# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
22+
# EnclosingMethod is required to use InnerClasses.
23+
-keepattributes Signature, InnerClasses, EnclosingMethod
24+
25+
# Retrofit does reflection on method and parameter annotations.
26+
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
27+
28+
# Retain service method parameters when optimizing.
29+
-keepclassmembers,allowshrinking,allowobfuscation interface * {
30+
@retrofit2.http.* <methods>;
31+
}
32+
33+
# Ignore annotation used for build tooling.
34+
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
35+
36+
# Ignore JSR 305 annotations for embedding nullability information.
37+
-dontwarn javax.annotation.**
38+
39+
# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
40+
-dontwarn kotlin.Unit
41+
42+
# Top-level functions that can only be used by Kotlin.
43+
-dontwarn retrofit2.KotlinExtensions
44+
-dontwarn retrofit2.KotlinExtensions$*
45+
46+
# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy
47+
# and replaces all potential values with null. Explicitly keeping the interfaces prevents this.
48+
-if interface * { @retrofit2.http.* <methods>; }
49+
-keep,allowobfuscation interface <1>
50+
51+
##---------------End: proguard configuration for Retrofit ---------
52+
53+
##---------------Begin: proguard configuration for OkHttp ---------
54+
55+
# JSR 305 annotations are for embedding nullability information.
56+
-dontwarn javax.annotation.**
57+
58+
# A resource is loaded with a relative path so the package of this class must be preserved.
59+
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
60+
61+
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
62+
-dontwarn org.codehaus.mojo.animal_sniffer.*
63+
64+
# OkHttp platform used only on JVM and when Conscrypt dependency is available.
65+
-dontwarn okhttp3.internal.platform.ConscryptPlatform
66+
67+
##---------------End: proguard configuration for OkHttp -----------
68+
69+
##---------------Begin: proguard configuration for Gson ----------
70+
71+
# Gson uses generic type information stored in a class file when working with fields. Proguard
72+
# removes such information by default, so configure it to keep all of it.
73+
-keepattributes Signature
74+
75+
# For using GSON @Expose annotation
76+
-keepattributes *Annotation*
77+
78+
# Gson specific classes
79+
-dontwarn sun.misc.**
80+
#-keep class com.google.gson.stream.** { *; }
81+
82+
# Application classes that will be serialized/deserialized over Gson
83+
-keep class com.google.gson.examples.android.model.** { <fields>; }
84+
85+
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
86+
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
87+
-keep class * implements com.google.gson.TypeAdapter
88+
-keep class * implements com.google.gson.TypeAdapterFactory
89+
-keep class * implements com.google.gson.JsonSerializer
90+
-keep class * implements com.google.gson.JsonDeserializer
91+
92+
# Prevent R8 from leaving Data object members always null
93+
-keepclassmembers,allowobfuscation class * {
94+
@com.google.gson.annotations.SerializedName <fields>;
95+
}
96+
97+
##---------------End: proguard configuration for Gson ----------

0 commit comments

Comments
 (0)