GreenRobot AndroidAnnotations parent

An AndroidAnnotations plugin to support GreenRobot

License

License

GroupId

GroupId

com.tmtron
ArtifactId

ArtifactId

green-annotations-parent
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

pom
Description

Description

GreenRobot AndroidAnnotations parent
An AndroidAnnotations plugin to support GreenRobot
Project URL

Project URL

https://github.com/tmtron/green-annotations
Project Organization

Project Organization

TMTron
Source Code Management

Source Code Management

https://github.com/tmtron/green-annotations

Download green-annotations-parent

How to add to project

<!-- https://jarcasting.com/artifacts/com.tmtron/green-annotations-parent/ -->
<dependency>
    <groupId>com.tmtron</groupId>
    <artifactId>green-annotations-parent</artifactId>
    <version>1.0.2</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.tmtron/green-annotations-parent/
implementation 'com.tmtron:green-annotations-parent:1.0.2'
// https://jarcasting.com/artifacts/com.tmtron/green-annotations-parent/
implementation ("com.tmtron:green-annotations-parent:1.0.2")
'com.tmtron:green-annotations-parent:pom:1.0.2'
<dependency org="com.tmtron" name="green-annotations-parent" rev="1.0.2">
  <artifact name="green-annotations-parent" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.tmtron', module='green-annotations-parent', version='1.0.2')
)
libraryDependencies += "com.tmtron" % "green-annotations-parent" % "1.0.2"
[com.tmtron/green-annotations-parent "1.0.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • green-annotations
  • green-annotations-api
  • green-annotations-test

Green Annotations

An Android Annotations plugin to support the Greenrobot Eventbus.
It can inject the default EventBus and automatically handle the registration/unregistration.

Build Status Maven Central Android Arsenal Javadocs license Join the chat at https://gitter.im/green-annotations/Lobby

Usage in your Android Studio project:

In the build.gradle file of the module project:

    dependencies {
        // Android Annotations for Greenrobot
        apt 'com.tmtron:green-annotations:1.0.2'
        compile 'com.tmtron:green-annotations-api:1.0.2'
    }

Note: Green-Annotations version 1.0.2 requires Android-Annotations version 4.4.0

Details

Before

Shows the Activity without using AndroidAnnotations or GreenAnnotations:

    public class ActivityBefore extends Activity {
    
        EventBus eventBus;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            eventBus = EventBus.getDefault();
        }
    
        @Override
        public void onStart() {
            super.onStart();
            eventBus.register(this);
        }
    
        @Override
        public void onStop() {
            eventBus.unregister(this);
            super.onStop();
        }
    
        public void fireEvent(String message) {
            eventBus.post(new MessageEvent(message));
        }
    
        @Subscribe(threadMode = ThreadMode.MAIN)
        public void onMessageEvent(MessageEvent event) {
            Toast.makeText(getApplicationContext(), event.message, Toast.LENGTH_SHORT).show();
        }
    
    }

After

Shows the same Activity with AndroidAnnotations and GreenAnnotations:

    @EActivity
    public class ActivityAfter extends Activity {
    
        @EventBusGreenRobot
        EventBus eventBus;
    
        public void fireEvent(String message) {
            eventBus.post(new MessageEvent(message));
        }
    
        @Subscribe(threadMode = ThreadMode.MAIN)
        public void onMessageEvent(MessageEvent event) {
            Toast.makeText(getApplicationContext(), event.message, Toast.LENGTH_SHORT).show();
        }
    
    }

Note: green-annotations-test is a tiny test-project: a sample android app with only one single activity to show how to use green-annotations (and the gradle-setup).

License

This plugin is under the Apache 2.0 license. Copyright 2016, Martin Trummer

Versions

Version
1.0.2
1.0.1
1.0.0