Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #28 from MatthiasRobbers/mr/incremental_annotation…
Browse files Browse the repository at this point in the history
…_processing

Support incremental annotation processing and more
  • Loading branch information
MatthiasRobbers committed Jul 21, 2020
2 parents a3f99c9 + 2918a7d commit b74c395
Show file tree
Hide file tree
Showing 28 changed files with 265 additions and 264 deletions.
41 changes: 41 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,41 @@
Change Log
==========

Version 1.1.0 *(2020-07-21)*
-----------------------------
* New: Support for incremental annotation processing
* Switch from Support annotations library to `androidx.annotation`
* Java 8 is now required
* Minimum SDK increased from `9` to `14` (app shortcuts are still not available before `25`)
* Update: Android Gradle plugin to `3.6.4`
* Some small changes to bring everything to 2020


Version 1.0.2 *(2017-09-24)*
-----------------------------
* Fix: Annotated methods are called before `onCreate()` (#13)
* Update: Support annotations library to `26.0.2`. This requires the new Google Maven Repository:

```groovy
google()
```
or
```groovy
maven {
url "https://maven.google.com"
}
```


Version 1.0.1 *(2017-03-04)*
-----------------------------

* Fix: `Shortbread.create(context)` can now also be called if there are no `@Shortcut` annotations in the code, which before produced a crash. Previously created shortcuts are now removed.
* Fix: Internal `NullPointerException` when an activity containing method shortcuts is not launched via a method shortcut
* Add Javadoc for the public API


Version 10.2.0 *(2017-02-11)*
-----------------------------

Initial release
39 changes: 26 additions & 13 deletions README.md
@@ -1,8 +1,8 @@
Shortbread
==========

Android library that generates [app shortcuts][1] for activities and methods annotated with `@Shortcut`.
No need to touch the manifest, create XML files or use the shortcut manager. Just annotate the code that
Android library that generates [app shortcuts][1] for activities and methods annotated with `@Shortcut`.
No need to touch the manifest, create XML files or use the shortcut manager. Just annotate the code that
you want the shortcut to call.

![Sample](sample.png)
Expand All @@ -14,10 +14,10 @@ The four shortcuts above are produced by the following code:
public class MoviesActivity extends Activity {

// ...

@Shortcut(id = "add_movie", icon = R.drawable.ic_shortcut_add, shortLabel = "Add movie")
public void addMovie() {
// code to add movie, could show an AddMovieDialogFragment for example
// code to add movie, could show an AddMovieDialogFragment for example
}
}
```
Expand All @@ -27,16 +27,16 @@ public class MoviesActivity extends Activity {
public class BooksActivity extends Activity {

// ...

@Shortcut(id = "favorite_books", icon = R.drawable.ic_shortcut_favorite, shortLabel = "Favorite books")
public void showFavoriteBooks() {
// code to display favorite books, could show a FavoriteBooksFragment for example
// code to display favorite books, could show a FavoriteBooksFragment for example
}
}
```

To display the shortcuts, call `Shortbread.create(Context context)` as early as possible in the app, for
example in `onCreate` of a custom `Application`.
To display the shortcuts, call `Shortbread.create(Context context)` as early as possible in the app, for
example in `onCreate` of a custom `Application`.

```java
public class App extends Application {
Expand All @@ -51,11 +51,11 @@ public class App extends Application {
```

Shortcuts can be customized with attributes, just like using the framework API.

```java
@Shortcut(
id = "books",
icon = R.drawable.ic_shortcut_books,
id = "books",
icon = R.drawable.ic_shortcut_books,
shortLabel = "Books",
shortLabelRes = R.string.shortcut_books_short_label,
longLabel = "List of books",
Expand All @@ -73,10 +73,23 @@ public class BooksActivity extends Activity { /*...*/ }
Download
--------

### Java

```groovy
dependencies {
compile 'com.github.matthiasrobbers:shortbread:1.0.2'
annotationProcessor 'com.github.matthiasrobbers:shortbread-compiler:1.0.2'
implementation 'com.github.matthiasrobbers:shortbread:1.1.0'
annotationProcessor 'com.github.matthiasrobbers:shortbread-compiler:1.1.0'
}
```

### Kotlin

```groovy
apply plugin: 'kotlin-kapt'
dependencies {
implementation 'com.github.matthiasrobbers:shortbread:1.1.0'
kapt 'com.github.matthiasrobbers:shortbread-compiler:1.1.0'
}
```

Expand Down
45 changes: 0 additions & 45 deletions bintray.gradle

This file was deleted.

36 changes: 14 additions & 22 deletions build.gradle
@@ -1,37 +1,29 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.android.tools.build:gradle:3.6.4'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.12.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
}
}

allprojects {
subprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
google()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

ext {
compileSdkVersion = 26
buildToolsVersion = '26.0.1'
minSdkVersion = 9
targetSdkVersion = 26
sourceCompatibilityVersion = '1.7'
targetCompatibilityVersion = '1.7'
supportLibraryVersion = '26.0.2'

githubUrl = 'https://github.com/matthiasrobbers/shortbread'
gitUrl = 'https://github.com/matthiasrobbers/shortbread.git'
libraryVersion = '1.0.2'
compileSdkVersion = 29
buildToolsVersion = '29.0.3'
minSdkVersion = 14
sourceCompatibilityVersion = JavaVersion.VERSION_1_8
targetCompatibilityVersion = JavaVersion.VERSION_1_8
androidxAnnotationVersion = '1.1.0'
autoServiceVersion = '1.0-rc7'
incapVersion = '0.3'
}
29 changes: 16 additions & 13 deletions gradle.properties
@@ -1,17 +1,20 @@
# Project-wide Gradle settings.
org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
GROUP=com.github.matthiasrobbers
VERSION_NAME=1.1.0

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
POM_URL=https://github.com/matthiasrobbers/shortbread
POM_SCM_URL=https://github.com/matthiasrobbers/shortbread
POM_SCM_CONNECTION=scm:git:git://github.com/matthiasrobbers/shortbread.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/matthiasrobbers/shortbread.git

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo

POM_DEVELOPER_ID=matthiasrobbers
POM_DEVELOPER_NAME=Matthias Robbers
POM_DEVELOPER_URL=https://github.com/matthiasrobbers/

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
RELEASE_SIGNING_ENABLED=false
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Wed Mar 15 15:30:47 GMT 2017
#Tue Jun 30 22:07:02 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
37 changes: 0 additions & 37 deletions install.gradle

This file was deleted.

12 changes: 12 additions & 0 deletions publish.gradle
@@ -0,0 +1,12 @@
apply plugin: "com.vanniktech.maven.publish"

mavenPublish {
targets {
uploadArchives {
releaseRepositoryUrl = "https://api.bintray.com/content/matthiasrobbers/maven/" +
"${project.findProperty("POM_ARTIFACT_ID")}/${project.findProperty("VERSION_NAME")}/"
repositoryUsername = System.getenv("BINTRAY_USER")
repositoryPassword = System.getenv("BINTRAY_KEY")
}
}
}
15 changes: 10 additions & 5 deletions sample/build.gradle
@@ -1,17 +1,22 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion project.compileSdkVersion
buildToolsVersion project.buildToolsVersion

defaultConfig {
applicationId "com.example.shortbread"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
minSdkVersion project.minSdkVersion
targetSdkVersion 29
versionCode 1
versionName "1.0"
}

compileOptions {
sourceCompatibility = sourceCompatibilityVersion
targetCompatibility = targetCompatibilityVersion
}

buildTypes {
debug {
minifyEnabled false
Expand All @@ -20,6 +25,6 @@ android {
}

dependencies {
compile project(':shortbread')
implementation project(':shortbread')
annotationProcessor project(':shortbread-compiler')
}
3 changes: 1 addition & 2 deletions sample/src/main/AndroidManifest.xml
Expand Up @@ -7,8 +7,7 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/android:Theme.Material.Light.DarkActionBar">
android:supportsRtl="true">

<activity
android:name="com.example.shortbread.MainActivity">
Expand Down

0 comments on commit b74c395

Please sign in to comment.