10 |
--------------------------------------------------------------------------------
/libAjProfiler/src/main/aspectj/com/archinamon/profiler/annotation/ProfileClass.java:
--------------------------------------------------------------------------------
1 | package com.archinamon.profiler.annotation;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.Target;
5 |
6 | import static java.lang.annotation.ElementType.TYPE;
7 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
8 |
9 | /**
10 | * Created by archinamon on 15/01/16.
11 | */
12 | @Retention(RUNTIME)
13 | @Target(TYPE)
14 | public @interface ProfileClass {}
15 |
--------------------------------------------------------------------------------
/libAjProfiler/src/main/aspectj/com/archinamon/profiler/annotation/ProfileDynamic.java:
--------------------------------------------------------------------------------
1 | package com.archinamon.profiler.annotation;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.Target;
5 |
6 | import static java.lang.annotation.ElementType.TYPE;
7 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
8 |
9 | /**
10 | * Created by archinamon on 15/01/16.
11 | */
12 | @Retention(RUNTIME)
13 | @Target(TYPE)
14 | public @interface ProfileDynamic {}
15 |
--------------------------------------------------------------------------------
/libAjProfiler/src/main/aspectj/com/archinamon/profiler/annotation/ProfileField.java:
--------------------------------------------------------------------------------
1 | package com.archinamon.profiler.annotation;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.Target;
5 |
6 | import static java.lang.annotation.ElementType.FIELD;
7 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
8 |
9 | /**
10 | * Created by archinamon on 15/01/16.
11 | */
12 | @Target(FIELD)
13 | @Retention(RUNTIME)
14 | public @interface ProfileField {}
15 |
--------------------------------------------------------------------------------
/libAjProfiler/src/main/aspectj/com/archinamon/profiler/annotation/ProfileStatic.java:
--------------------------------------------------------------------------------
1 | package com.archinamon.profiler.annotation;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.Target;
5 |
6 | import static java.lang.annotation.ElementType.TYPE;
7 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
8 |
9 | /**
10 | * Created by archinamon on 15/01/16.
11 | */
12 | @Retention(RUNTIME)
13 | @Target(TYPE)
14 | public @interface ProfileStatic {}
15 |
--------------------------------------------------------------------------------
/libAjProfiler/src/main/aspectj/com/archinamon/profiler/annotation/ProfileInstance.java:
--------------------------------------------------------------------------------
1 | package com.archinamon.profiler.annotation;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.Target;
5 |
6 | import static java.lang.annotation.ElementType.TYPE;
7 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
8 |
9 | /**
10 | * Created by archinamon on 15/01/16.
11 | */
12 | @Retention(RUNTIME)
13 | @Target(TYPE)
14 | public @interface ProfileInstance {}
15 |
--------------------------------------------------------------------------------
/libExample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 26
5 | buildToolsVersion "26.0.2"
6 |
7 | defaultConfig {
8 | minSdkVersion 14
9 | targetSdkVersion 26
10 | versionCode 1
11 | versionName "1.0"
12 |
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/res/values-ru/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AspectJExample
3 |
4 | Привет, мир!
5 | Рабочий язык —
6 | Настройки
7 | Кнопка 1
8 | Кнопка 2
9 | Кнопка 3
10 | Что-то нажали!
11 |
12 |
--------------------------------------------------------------------------------
/libAjProfiler/src/main/aspectj/com/archinamon/profiler/annotation/ProfileCall.java:
--------------------------------------------------------------------------------
1 | package com.archinamon.profiler.annotation;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.Target;
5 |
6 | import static java.lang.annotation.ElementType.CONSTRUCTOR;
7 | import static java.lang.annotation.ElementType.METHOD;
8 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
9 |
10 | /**
11 | * Created by archinamon on 15/01/16.
12 | */
13 | @Retention(RUNTIME)
14 | @Target({CONSTRUCTOR, METHOD})
15 | public @interface ProfileCall {}
16 |
--------------------------------------------------------------------------------
/libAjProfiler/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.archinamon.aspectj-provides'
3 |
4 | android {
5 | compileSdkVersion 26
6 | buildToolsVersion "26.0.2"
7 |
8 |
9 | defaultConfig {
10 | minSdkVersion 14
11 | targetSdkVersion 26
12 | versionCode 1
13 | versionName "1.0"
14 |
15 | }
16 |
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/libAjProfiler/src/main/aspectj/com/archinamon/profiler/annotation/ProfileExecution.java:
--------------------------------------------------------------------------------
1 | package com.archinamon.profiler.annotation;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.Target;
5 |
6 | import static java.lang.annotation.ElementType.CONSTRUCTOR;
7 | import static java.lang.annotation.ElementType.METHOD;
8 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
9 |
10 | /**
11 | * Created by archinamon on 15/01/16.
12 | */
13 | @Retention(RUNTIME)
14 | @Target({CONSTRUCTOR, METHOD})
15 | public @interface ProfileExecution {}
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: android
2 | jdk: oraclejdk8
3 | sudo: false
4 |
5 | env:
6 | matrix:
7 | - ANDROID_TARGET=android-26 ANDROID_ABI=armeabi-v7a
8 | global:
9 | - ADB_INSTALL_TIMEOUT=5
10 |
11 | android:
12 | components:
13 | - platform-tools
14 | - tools
15 | - build-tools-26.0.2
16 | - android-26
17 | - extra-android-m2repository
18 | - extra-android-support
19 |
20 | before_cache:
21 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
22 | cache:
23 | directories:
24 | - $HOME/.gradle
25 |
26 | addons:
27 | artifacts:
28 | paths:
29 | - $(git ls-files -o | grep build/outputs/apk | tr "\n" ":")
30 |
31 | script: ./gradlew :app:assembleDebug
32 |
--------------------------------------------------------------------------------
/libAjProfiler/src/main/aspectj/com/archinamon/profiler/annotation/ProfileErrors.java:
--------------------------------------------------------------------------------
1 | package com.archinamon.profiler.annotation;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.Target;
5 |
6 | import static java.lang.annotation.ElementType.CONSTRUCTOR;
7 | import static java.lang.annotation.ElementType.METHOD;
8 | import static java.lang.annotation.ElementType.TYPE;
9 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
10 |
11 | /**
12 | * Created by archinamon on 15/01/16.
13 | */
14 | @Retention(RUNTIME)
15 | @Target({CONSTRUCTOR, METHOD, TYPE})
16 | public @interface ProfileErrors {
17 |
18 | Class extends Throwable>[] value() default Throwable.class;
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/aspectj/com/archinamon/xpoint/LibDecorator.aj:
--------------------------------------------------------------------------------
1 | package com.archinamon.xpoint;
2 |
3 | import android.app.Activity;
4 | import android.widget.Toast;
5 | import com.archinamon.example.MainActivity;
6 | import com.archinamon.example.lib.LibExample;
7 |
8 | /**
9 | * Created by archinamon on 08/10/17.
10 | */
11 | privileged aspect LibDecorator {
12 |
13 | /* Library section */
14 |
15 | pointcut toastInjectLib(MainActivity activity): this(activity) && execution(* Activity.onStart(..));
16 |
17 | after(MainActivity activity) returning: toastInjectLib(activity) {
18 | final String msg = new LibExample().hello();
19 | Toast.makeText(activity, msg, Toast.LENGTH_LONG).show();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/libExample/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 /Users/archinamon/Library/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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://travis-ci.org/Archinamon/AndroidAspectJExample)
2 |
3 | # AspectJExampleAndroid
4 | demo project releasing aspectJ environment
5 |
6 | Supports demostration
7 | ------
8 | * Tests coverage by AspectJ code
9 | * Working with Dagger2, AndroidAnnotations
10 | * Kotlin coverage by AspectJ code (Groovy/Scala also possible, but excluded for simplicity)
11 | * Aj plugin extension parameters
12 |
13 | Useful links that helps better understands the AspectJ language and some common tips, examples:
14 | * Quick reference manual
15 | * Aspects code examples
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/archinamon/example/dagger/MyAppScopeModule.java:
--------------------------------------------------------------------------------
1 | package com.archinamon.example.dagger;
2 |
3 | import android.content.Context;
4 | import com.archinamon.example.BuildConfig;
5 | import com.archinamon.example.MyApplication;
6 | import com.squareup.picasso.Picasso;
7 | import dagger.Module;
8 | import dagger.Provides;
9 |
10 | /**
11 | * Here it provides the dependencies those are used in the whole scope of your MyApp
12 | */
13 | @Module
14 | public class MyAppScopeModule {
15 |
16 | @Provides
17 | Picasso providesPicasso(@ForApplication Context context) {
18 | Picasso picasso = Picasso.with(context);
19 |
20 | // some app-wide common settings
21 | picasso.setDebugging(BuildConfig.DEBUG);
22 |
23 | return picasso;
24 | }
25 | }
--------------------------------------------------------------------------------
/libAjProfiler/proguard-rules.pro:
--------------------------------------------------------------------------------
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
22 |
--------------------------------------------------------------------------------
/app/src/test/java/com/archinamon/test/ExperimentalTest.java:
--------------------------------------------------------------------------------
1 | package com.archinamon.test;
2 |
3 | import com.archinamon.example.profiler.ProfileCall;
4 | import org.junit.Test;
5 |
6 | import static junit.framework.Assert.assertEquals;
7 |
8 | /**
9 | * TODO: Add destription
10 | *
11 | * @author archinamon on 29/04/16.
12 | */
13 | public class ExperimentalTest {
14 |
15 | @Test
16 | public void testAspectJ() {
17 | final String e = "exec";
18 | assertEquals(e, "exec");
19 |
20 | final int a = 123;
21 | assertEquals(a, 123);
22 |
23 | final String c = "call";
24 | assertEquals(c, "call");
25 |
26 | final String mutated = getImmutable();
27 | assertEquals(mutated, "mutable");
28 | }
29 |
30 | @ProfileCall
31 | String getImmutable() {
32 | return "immutable";
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/libAjProfiler/src/main/aspectj/com/archinamon/profiler/core/ProfilerImpl.aj:
--------------------------------------------------------------------------------
1 | package com.archinamon.profiler.core;
2 |
3 | /**
4 | * Created by Archinamon on 10/18/15.
5 | */
6 | aspect ProfilerImpl extends Profiler {
7 |
8 | private pointcut strict(): within(com.archinamon.**) && !within(*.profiler.**);
9 |
10 | pointcut innerExecution(): strict() && execution(!public !static * *(..));
11 | pointcut constructorCall(): strict() && call(*.new(..));
12 | pointcut publicExecution(): strict() && execution(public !static * *(..));
13 | pointcut staticsOnly(): strict() && execution(static * *(..));
14 |
15 | private pointcut catchAny(): innerExecution() || constructorCall() || publicExecution() || staticsOnly();
16 |
17 | before(): catchAny() {
18 | writeEnterTime(thisJoinPointStaticPart);
19 | }
20 |
21 | after(): catchAny() {
22 | writeExitTime(thisJoinPointStaticPart);
23 | }
24 | }
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/archinamon/example/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.archinamon.example;
2 |
3 | import android.content.Intent;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.rule.ActivityTestRule;
6 | import android.support.test.runner.AndroidJUnit4;
7 | import com.archinamon.kotlin.InfoActivity;
8 | import org.junit.Rule;
9 | import org.junit.Test;
10 | import org.junit.runner.RunWith;
11 |
12 | /**
13 | * Testing Fundamentals
14 | */
15 | @RunWith(AndroidJUnit4.class)
16 | public class ApplicationTest {
17 |
18 | @Rule
19 | public ActivityTestRule infoActivityRule = new ActivityTestRule<>(InfoActivity.class, false, true);
20 |
21 | @Test
22 | public void emptyTest() {
23 | infoActivityRule.launchActivity(new Intent(InstrumentationRegistry.getContext(), InfoActivity.class));
24 | }
25 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/archinamon/example/dagger/AndroidAppModule.java:
--------------------------------------------------------------------------------
1 | package com.archinamon.example.dagger;
2 |
3 | import android.content.Context;
4 | import android.location.LocationManager;
5 | import javax.inject.Singleton;
6 | import dagger.Module;
7 | import dagger.Provides;
8 |
9 | @Module
10 | public class AndroidAppModule {
11 |
12 | public static Context sApplicationContext = null;
13 |
14 | /**
15 | * Allow the application context to be injected but require that it be annotated with
16 | * {@link com.archinamon.example.dagger.ForApplication @Annotation} to explicitly differentiate it from an activity context.
17 | */
18 | @Provides
19 | @Singleton
20 | @ForApplication
21 | Context provideApplicationContext() {
22 | return sApplicationContext;
23 | }
24 |
25 | @Provides @Singleton
26 | LocationManager provideLocationManager() {
27 | return (LocationManager) sApplicationContext.getSystemService(Context.LOCATION_SERVICE);
28 | }
29 | }
--------------------------------------------------------------------------------
/AspectJExampleAndroid.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/aspectj/com/archinamon/xpoint/EventRepeater.aj:
--------------------------------------------------------------------------------
1 | package com.archinamon.xpoint;
2 |
3 | import android.app.NotificationManager;
4 | import android.content.Context;
5 | import android.support.v7.app.NotificationCompat;
6 | import android.view.View;
7 | import android.widget.TextView;
8 | import com.archinamon.example.MainActivity;
9 | import com.archinamon.example.R;
10 |
11 | /**
12 | * Created by Archinamon on 10/6/15.
13 | */
14 | aspect EventRepeater {
15 |
16 | private static int sMagic = 3;
17 |
18 | pointcut event(): execution(* MainActivity.on*Clicked(View));
19 |
20 | after() returning: event() {
21 | final Context ctx = (Context) thisJoinPoint.getTarget();
22 | final TextView argument = (TextView) thisJoinPoint.getArgs()[0];
23 |
24 | NotificationManager nm = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
25 | nm.notify(sMagic++ << 1,
26 | new NotificationCompat.Builder(ctx)
27 | .setSmallIcon(R.mipmap.ic_launcher)
28 | .setContentTitle("Something happend!")
29 | .setContentText(argument.getText() + " clicked!")
30 | .build()
31 | );
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/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 /Users/Archinamon/Anoda/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 | -adaptclassstrings
19 | -keepattributes InnerClasses, EnclosingMethod, Signature, *Annotation*
20 | -optimizationpasses 5
21 | -dontusemixedcaseclassnames
22 | -dontskipnonpubliclibraryclasses
23 | -dontpreverify
24 | -verbose
25 | -printseeds
26 | -allowaccessmodification
27 |
28 | #Escape lambda erasures
29 | -keep class *$Lambda* { ; }
30 | -keepclassmembernames public class * {
31 | *** lambda*(...);
32 | }
33 |
34 | #Preserve aspects
35 | -keepnames @org.aspectj.lang.annotation.Aspect class * {
36 | ajc* ;
37 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
25 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AspectJExample
3 |
4 | Hello world!
5 | I\'m running
6 | Settings
7 | Button 1
8 | Button 2
9 | Button 3
10 | Click action from Java!
11 | Click action from AspectJ!
12 | Click action from Kotlin!
13 | InfoActivity
14 |
15 | This is a demo project that have been compiled with AspectJ Gradle plugin.
16 | \nIt allows to write code with AspectJ language in special .aj files and in java-annotation style.
17 | \nFull support of Android product flavors and custom variable build types.
18 | \nAlso supports Kotlin, Groovy, Scala and any other languages that compiles into java bytecode.
19 | \n
20 | \nActual version: com.archinamon:android-gradle-aspectj:3.0.3.
21 | \nIt was completely re-written with brand new Transform API!
22 | \n
23 | \nCurrent demo project uses Java, Kotlin and AspectJ together.
24 | \nAlso Retrolambda, Dagger2 and AndroidAnnotations are in use to grant full compatibility of this plugin with all useful and needed tools! :)
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/kotlin/com/archinamon/kotlin/InfoActivity.kt:
--------------------------------------------------------------------------------
1 | package com.archinamon.kotlin
2 |
3 | import android.content.Intent
4 | import android.net.Uri
5 | import android.os.Bundle
6 | import android.support.v7.app.AppCompatActivity
7 | import android.support.v7.widget.Toolbar
8 | import android.view.MenuItem
9 | import com.archinamon.example.R
10 | import com.archinamon.profiler.annotation.ProfileDynamic
11 | import com.archinamon.profiler.annotation.ProfileInstance
12 |
13 | @ProfileDynamic
14 | @ProfileInstance
15 | class InfoActivity : AppCompatActivity() {
16 |
17 | override fun onCreate(savedInstanceState: Bundle?) {
18 | super.onCreate(savedInstanceState)
19 | setContentView(R.layout.activity_info)
20 | val toolbar = findViewById(R.id.toolbar) as Toolbar
21 | setSupportActionBar(toolbar)
22 |
23 | val fab = findViewById(R.id.fab)
24 | fab?.setOnClickListener {
25 | val uri = "mailto:archinamon@gmail.com" +
26 | "?subject=" + Uri.encode("Example project feedback")
27 | val intent = Intent(Intent.ACTION_SENDTO).setData(Uri.parse(uri))
28 | startActivity(Intent.createChooser(intent, "Send email feedback"))
29 | }
30 | supportActionBar!!.setDisplayHomeAsUpEnabled(true)
31 | }
32 |
33 | override fun onOptionsItemSelected(item: MenuItem): Boolean {
34 | when (item.itemId) {
35 | android.R.id.home -> onBackPressed()
36 | }
37 |
38 | return true
39 | }
40 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/archinamon/example/MyApplication.java:
--------------------------------------------------------------------------------
1 | package com.archinamon.example;
2 |
3 | import android.app.Application;
4 | import android.content.SharedPreferences;
5 | import com.archinamon.example.dagger.AndroidAppModule;
6 | import com.archinamon.example.dagger.DaggerTestComponent;
7 | import com.archinamon.example.dagger.MyAppScopeModule;
8 | import com.archinamon.example.dagger.TestComponent;
9 |
10 | import static com.archinamon.example.BuildConfig.APPLICATION_ID;
11 |
12 | /**
13 | * Created by Archinamon on 10/5/15.
14 | */
15 | public class MyApplication extends Application {
16 |
17 | public static final String LANG_KEY = "k_lang";
18 |
19 | private SharedPreferences mPreferences;
20 | private TestComponent mTestComponent;
21 |
22 | @Override
23 | public void onCreate() {
24 | super.onCreate();
25 |
26 | mPreferences = getSharedPreferences(APPLICATION_ID, MODE_PRIVATE);
27 |
28 | mTestComponent = DaggerTestComponent.builder()
29 | .androidAppModule(new AndroidAppModule())
30 | .myAppScopeModule(new MyAppScopeModule())
31 | .build();
32 | AndroidAppModule sharedAppModule = new AndroidAppModule();
33 | }
34 |
35 | public SharedPreferences getPreferences() {
36 | return mPreferences;
37 | }
38 |
39 | protected TestComponent getTestCpmponent() {
40 | return mTestComponent;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/libAjProfiler/src/main/aspectj/com/archinamon/profiler/core/Profiler.aj:
--------------------------------------------------------------------------------
1 | package com.archinamon.profiler.core;
2 |
3 | import org.aspectj.lang.JoinPoint;
4 | import java.util.Map;
5 | import java.util.concurrent.ConcurrentHashMap;
6 |
7 | import static java.lang.System.out;
8 |
9 | /**
10 | * Created by Archinamon on 10/18/15.
11 | */
12 | abstract aspect Profiler issingleton() {
13 |
14 | abstract pointcut innerExecution();
15 | abstract pointcut constructorCall();
16 | abstract pointcut publicExecution();
17 | abstract pointcut staticsOnly();
18 |
19 | protected static final Map sTimeData = new ConcurrentHashMap<>();
20 |
21 | protected void writeEnterTime(JoinPoint.StaticPart jp) {
22 | sTimeData.put(getIdx(jp), System.currentTimeMillis());
23 | }
24 |
25 | protected void writeExitTime(JoinPoint.StaticPart jp) {
26 | String idx = getIdx(jp);
27 | if (!sTimeData.containsKey(idx)) return;
28 |
29 | Long finishTime = System.currentTimeMillis();
30 | Long startTime = sTimeData.remove(getIdx(jp));
31 |
32 | Long timing = finishTime - startTime;
33 | printFormattedTime(getIdx(jp) + " takes " + timing + "ms to proceed");
34 | }
35 |
36 | private void printFormattedTime(final String data) {
37 | out.println(data);
38 | }
39 |
40 | private String getIdx(JoinPoint.StaticPart jp) {
41 | String className = jp.getSignature().getDeclaringTypeName();
42 | String methodName = jp.getSignature().getName();
43 |
44 | return className + ":" + methodName;
45 | }
46 | }
--------------------------------------------------------------------------------
/app/src/main/aspectj/com/archinamon/xpoint/JvmLangDecorator.aj:
--------------------------------------------------------------------------------
1 | package com.archinamon.xpoint;
2 |
3 | import android.content.Context;
4 | import com.archinamon.example.BuildConfig;
5 | import com.archinamon.example.MainActivity;
6 | import com.archinamon.example.R;
7 | import com.archinamon.kotlin.InfoActivity;
8 | import com.archinamon.kotlin.ToastHelperKt;
9 | import com.archinamon.kotlin.TextInfo;
10 |
11 | /**
12 | * Created by archinamon on 19/02/16.
13 | */
14 | privileged aspect JvmLangDecorator {
15 |
16 | /* Kotlin section */
17 |
18 | private boolean InfoActivity.inject = BuildConfig.DEBUG;
19 |
20 | pointcut kotlinImplicitInjector(InfoActivity activity): this(activity) && within(InfoActivity) && call(!private * *(..));
21 | pointcut toastInjectKt(Context ctx): this(ctx) && within(MainActivity) && call(private void toastFromKotlin());
22 |
23 | after(InfoActivity activity) returning: kotlinImplicitInjector(activity) {
24 | if (activity.inject) {
25 | final String target = thisJoinPoint.toString();
26 | System.out.println(String.format("Aspected kotlin JP{%s} was successfully executed!", target));
27 | }
28 | }
29 |
30 | void around(Context ctx): toastInjectKt(ctx) {
31 | ToastHelperKt.sendToast(ctx, new TextInfo(ctx.getString(R.string.something_happend_kotlin)));
32 | }
33 |
34 | /**
35 | * Around-advice introspects within anonymous pointcut
36 | */
37 | void around(Context ctx): this(ctx) && execution(private void MainActivity.toastFromAspectJ()) {
38 | ToastHelperKt.sendToast(ctx, new TextInfo(ctx.getString(R.string.something_happend_aspectj)));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
18 |
25 |
26 |
33 |
34 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/app/src/main/java/com/archinamon/example/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.archinamon.example;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.Menu;
8 | import android.view.MenuItem;
9 | import android.view.View;
10 | import android.widget.TextView;
11 | import android.widget.Toast;
12 | import com.archinamon.kotlin.InfoActivity;
13 | import org.androidannotations.annotations.EActivity;
14 |
15 | import java.util.Locale;
16 |
17 | @EActivity
18 | @SuppressLint("Registered")
19 | public class MainActivity extends AppCompatActivity {
20 |
21 | private TextView mHelloField;
22 | private boolean once = true;
23 |
24 | @Override
25 | protected void onCreate(Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 | setContentView(R.layout.activity_main);
28 | mHelloField = (TextView) findViewById(R.id.hello_world);
29 | }
30 |
31 | @Override
32 | protected void onStart() {
33 | super.onStart();
34 |
35 | final MyApplication app = (MyApplication) getApplication();
36 | final String lang = app.getPreferences()
37 | .getString(MyApplication.LANG_KEY,
38 | Locale.getDefault().getDisplayLanguage());
39 |
40 | if (once && mHelloField != null) {
41 | mHelloField.append("\n");
42 | mHelloField.append(getString(R.string.running));
43 | mHelloField.append(" ");
44 | mHelloField.append(lang);
45 | mHelloField.append("!");
46 |
47 | once = false;
48 | }
49 | }
50 |
51 | @Override
52 | public boolean onCreateOptionsMenu(Menu menu) {
53 | // Inflate the menu; this adds items to the action bar if it is present.
54 | getMenuInflater().inflate(R.menu.menu_main, menu);
55 | return true;
56 | }
57 |
58 | @Override
59 | public boolean onOptionsItemSelected(MenuItem item) {
60 | // Handle action bar item clicks here. The action bar will
61 | // automatically handle clicks on the Home/Up button, so long
62 | // as you specify a parent activity in AndroidManifest.xml.
63 | int id = item.getItemId();
64 |
65 | //noinspection SimplifiableIfStatement
66 | if (id == R.id.action_settings) {
67 | return true;
68 | }
69 |
70 | return super.onOptionsItemSelected(item);
71 | }
72 |
73 | public void onFirstButtonClicked(View view) {
74 | toastFromJava();
75 | }
76 |
77 | public void onSecondButtonClicked(View view) {
78 | toastFromAspectJ();
79 | }
80 |
81 | public void onThirdButtonClicked(View view) {
82 | startActivity(new Intent(this, InfoActivity.class));
83 | toastFromKotlin();
84 | }
85 |
86 | private void toastFromJava() {
87 | String msg = getString(R.string.something_happend_java);
88 | Toast.makeText(this, msg, Toast.LENGTH_LONG).show();
89 | }
90 |
91 | private void toastFromAspectJ() {}
92 | private void toastFromKotlin() {}
93 | }
94 |
--------------------------------------------------------------------------------
/app/src/main/aspectj/com/archinamon/xpoint/LocaleMonitor.aj:
--------------------------------------------------------------------------------
1 | package com.archinamon.xpoint;
2 |
3 | import android.app.AlarmManager;
4 | import android.app.Application;
5 | import android.app.PendingIntent;
6 | import android.content.Context;
7 | import android.content.Intent;
8 | import android.content.SharedPreferences;
9 | import android.support.annotation.NonNull;
10 | import android.support.v7.app.AppCompatActivity;
11 | import com.archinamon.example.MyApplication;
12 | import java.util.Locale;
13 |
14 | import static android.content.Context.MODE_PRIVATE;
15 | import static com.archinamon.example.BuildConfig.APPLICATION_ID;
16 |
17 | /**
18 | * Created by Archinamon on 10/6/15.
19 | */
20 | aspect LocaleMonitor {
21 |
22 | /* inter-type declaration
23 | injecting instance-field and getter/setter methods into MyApplication class */
24 |
25 | private static Application MyApplication.sInstance;
26 |
27 | // method declared as package-local
28 | // only aspect classes within package .xpoint will have access to these methods
29 | static void MyApplication.setInstance(@NonNull Application inst) {
30 | sInstance = inst;
31 | }
32 |
33 | static Application MyApplication.getInstance() {
34 | return sInstance;
35 | }
36 |
37 | /* end of inter-type declaration */
38 |
39 | private static final String LANG_RAW_KEY = "aj_lang_val";
40 |
41 | pointcut saveLocale(): execution(* MyApplication.onCreate());
42 | pointcut checkLocale(AppCompatActivity activity): this(activity) && execution(* AppCompatActivity+.onCreate(..));
43 |
44 | after(): saveLocale() {
45 | final MyApplication app = (MyApplication) thisJoinPoint.getThis();
46 | MyApplication.setInstance(app);
47 | saveCurrentLocale();
48 | }
49 |
50 | after(AppCompatActivity activity): checkLocale(activity) {
51 | if (isLocaleChanged()) {
52 | saveCurrentLocale();
53 | restartApplication(activity);
54 | }
55 | }
56 |
57 | private void saveCurrentLocale() {
58 | getPreferences().edit()
59 | .putString(LANG_RAW_KEY, Locale.getDefault().toString())
60 | .putString(MyApplication.LANG_KEY, Locale.getDefault().getDisplayLanguage())
61 | .apply();
62 | }
63 |
64 | private void restartApplication(AppCompatActivity context) {
65 | Intent i = new Intent(context, context.getClass());
66 | PendingIntent launch = PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_ONE_SHOT);
67 |
68 | AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
69 | am.set(AlarmManager.RTC, System.currentTimeMillis() + 1000, launch);
70 |
71 | context.finish();
72 | }
73 |
74 | private boolean isLocaleChanged() {
75 | final String savedLocale = getPreferences().getString(LANG_RAW_KEY, "");
76 | final String currentLocale = Locale.getDefault().toString();
77 |
78 | return !currentLocale.equalsIgnoreCase(savedLocale);
79 | }
80 |
81 | private SharedPreferences getPreferences() {
82 | return MyApplication.getInstance()
83 | .getSharedPreferences(APPLICATION_ID, MODE_PRIVATE);
84 | }
85 | }
--------------------------------------------------------------------------------
/libAjProfiler/src/main/aspectj/com/archinamon/profiler/core/AnnotationProfilerImpl.aj:
--------------------------------------------------------------------------------
1 | package com.archinamon.profiler.core;
2 |
3 | import com.archinamon.profiler.annotation.ProfileCall;
4 | import com.archinamon.profiler.annotation.ProfileClass;
5 | import com.archinamon.profiler.annotation.ProfileDynamic;
6 | import com.archinamon.profiler.annotation.ProfileErrors;
7 | import com.archinamon.profiler.annotation.ProfileExecution;
8 | import com.archinamon.profiler.annotation.ProfileField;
9 | import com.archinamon.profiler.annotation.ProfileInstance;
10 | import com.archinamon.profiler.annotation.ProfileStatic;
11 |
12 | /**
13 | * Created by archinamon on 13/02/16.
14 | */
15 | public aspect AnnotationProfilerImpl extends AnnotationProfiler {
16 |
17 | /* PROFILE ANNOTATED METHOD CALL */
18 |
19 | before(ProfileCall pc): AnnotationProfiler.profileTargetCall(pc) {
20 | writeEnterTime(thisJoinPointStaticPart);
21 | }
22 |
23 | after(ProfileCall pc): AnnotationProfiler.profileTargetCall(pc) {
24 | writeExitTime(thisJoinPointStaticPart);
25 | }
26 |
27 | /* PROFILE ANNOTATED METHOD'S BODY EXECUTION */
28 |
29 | before(ProfileExecution pe): AnnotationProfiler.profileTargetExecution(pe) {
30 | writeEnterTime(thisJoinPointStaticPart);
31 | }
32 |
33 | after(ProfileExecution pe): AnnotationProfiler.profileTargetExecution(pe) {
34 | writeExitTime(thisJoinPointStaticPart);
35 | }
36 |
37 | /* PROFILE ANNOTATED CLASS' STATIC METHODS EXECUTION */
38 |
39 | before(ProfileClass pc): AnnotationProfiler.profileTargetClass(pc) {
40 | writeEnterTime(thisJoinPointStaticPart);
41 | }
42 |
43 | after(ProfileClass pc): AnnotationProfiler.profileTargetClass(pc) {
44 | writeExitTime(thisJoinPointStaticPart);
45 | }
46 |
47 | /* PROFILE ANNOTATED CLASS' INSTANCE METHODS EXECUTION */
48 |
49 | before(ProfileInstance pi): AnnotationProfiler.profileTargetInstance(pi) {
50 | writeEnterTime(thisJoinPointStaticPart);
51 | }
52 |
53 | after(ProfileInstance pi): AnnotationProfiler.profileTargetInstance(pi) {
54 | writeExitTime(thisJoinPointStaticPart);
55 | }
56 |
57 | /* PROFILE ANNOTATED CLASS' CONSTRUCTORS, SUPER-CALLS AND DYNAMIC BLOCKS */
58 |
59 | before(ProfileDynamic dp): AnnotationProfiler.profileTargetDynamic(dp) {
60 | writeEnterTime(thisJoinPointStaticPart);
61 | }
62 |
63 | after(ProfileDynamic dp): AnnotationProfiler.profileTargetDynamic(dp) {
64 | writeExitTime(thisJoinPointStaticPart);
65 | }
66 |
67 | /* PROFILE ANNOTATED CLASS' STATIC BLOCKS */
68 |
69 | before(ProfileStatic ps): AnnotationProfiler.profileTargetStatic(ps) {
70 | writeEnterTime(thisJoinPointStaticPart);
71 | }
72 |
73 | after(ProfileStatic ps): AnnotationProfiler.profileTargetStatic(ps) {
74 | writeExitTime(thisJoinPointStaticPart);
75 | }
76 |
77 | /* PROFILE ANNOTATED CLASS' FIELDS
78 | SUCH CLASS SHOULD BE ANNOTATED AS @ProfileClass or @ProfileInstance
79 | THAT DEPENDS ON WHAT KIND OF FIELD YOU WANNA PROFILE */
80 |
81 | before(ProfileField pf): AnnotationProfiler.profileTargetField(pf) {
82 | writeEnterTime(thisJoinPointStaticPart);
83 | }
84 |
85 | after(ProfileField pf): AnnotationProfiler.profileTargetField(pf) {
86 | writeExitTime(thisJoinPointStaticPart);
87 | }
88 |
89 | /* PROFILE ANNOTATED CLASS' OR SEPARATELY MARKED METHODS WITH ERROR HANDLER */
90 |
91 | Object around(ProfileErrors pe): AnnotationProfiler.profileTargetErrors(pe) {
92 | try {
93 | writeEnterTime(thisJoinPointStaticPart);
94 | Object o = proceed(pe);
95 | writeExitTime(thisJoinPointStaticPart);
96 |
97 | return o;
98 | } catch (Throwable all) {
99 | if (checkErrorClausing(all, pe))
100 | writeException(thisJoinPointStaticPart, all);
101 | removeEnterTime(thisJoinPointStaticPart);
102 |
103 | return null;
104 | }
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.1.51'
3 |
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | //Kotlin
9 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
10 | //APT
11 | classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
12 | }
13 | }
14 |
15 | apply plugin: 'com.android.application'
16 | apply plugin: 'com.neenbedankt.android-apt'
17 | apply plugin: 'kotlin-android'
18 | apply plugin: 'kotlin-android-extensions'
19 | apply plugin: 'me.tatarka.retrolambda'
20 | apply plugin: 'com.archinamon.aspectj'
21 |
22 | aspectj {
23 | debugInfo !isTCBuild()
24 | includeAspectsFromJar 'libinstantparcelable', 'libAjProfiler'
25 | }
26 |
27 | retrolambda {
28 | defaultMethods true
29 | }
30 |
31 | apt {
32 | arguments {
33 | resourcePackageName android.defaultConfig.applicationId
34 | androidManifestFile variant.outputs[0]?.processResources?.manifestFile
35 | }
36 | }
37 |
38 | def rootApplicationId = rootProject.ext.applicationId
39 |
40 | android {
41 | compileSdkVersion 26
42 | buildToolsVersion '26.0.2'
43 |
44 | defaultConfig {
45 | applicationId rootApplicationId
46 | minSdkVersion 15
47 | targetSdkVersion 26
48 | versionCode 1
49 | versionName "1.0"
50 |
51 | multiDexEnabled true
52 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
53 |
54 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
55 | }
56 | buildTypes {
57 | debug {
58 | minifyEnabled false
59 | }
60 | release {
61 | minifyEnabled false
62 | }
63 | }
64 |
65 | productFlavors {
66 | dev {
67 | multiDexEnabled false
68 | applicationId "${rootApplicationId}.dev"
69 | versionName "1.7.2_(PRJT-2165)"
70 | minSdkVersion 21
71 | project.archivesBaseName = "myProject_$versionCode-$versionName"
72 | buildConfigField "boolean", "DEEP_LOG", "true"
73 | buildConfigField "boolean", "METRICS", "false"
74 | }
75 |
76 | prod {
77 | buildConfigField "boolean", "DEEP_LOG", "false"
78 | buildConfigField "boolean", "METRICS", "true"
79 | }
80 |
81 | regress {
82 | applicationId "${rootApplicationId}.regress"
83 | buildConfigField "boolean", "DEEP_LOG", "true"
84 | buildConfigField "boolean", "METRICS", "true"
85 | }
86 | }
87 |
88 | compileOptions {
89 | sourceCompatibility JavaVersion.VERSION_1_8
90 | targetCompatibility JavaVersion.VERSION_1_8
91 | }
92 |
93 | sourceSets {
94 | main.java.srcDirs += 'src/main/kotlin'
95 | }
96 | }
97 |
98 | repositories {
99 | jcenter()
100 | mavenCentral()
101 | }
102 |
103 | def AAVersion = '3.3' as String
104 | dependencies {
105 | compile project(':libExample')
106 | compile project(':libAjProfiler')
107 | compile 'com.github.Archinamon:InstantParcelable:1.0.0'
108 |
109 | compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
110 |
111 | apt "org.androidannotations:androidannotations:$AAVersion"
112 | compile "org.androidannotations:androidannotations-api:$AAVersion"
113 |
114 | compile 'com.annimon:stream:1.1.4'
115 |
116 | compile 'org.jetbrains.kotlin:kotlin-stdlib:1.1.51'
117 | compile 'com.google.dagger:dagger:2.11'
118 | compile 'com.squareup.picasso:picasso:2.5.2'
119 | compile 'com.android.support:design:25.3.1'
120 |
121 | testCompile 'junit:junit:4.12'
122 | androidTestCompile 'junit:junit:4.12'
123 | androidTestCompile('com.android.support.test:runner:0.5') { exclude module: 'support-annotations' }
124 | androidTestCompile('com.android.support.test:rules:0.5') { exclude module: 'support-annotations' }
125 |
126 | apt 'com.google.dagger:dagger-compiler:2.11'
127 | provided 'org.glassfish:javax.annotation:10.0-b28'
128 | }
129 |
130 | def isTCBuild() {
131 | return project.properties.containsKey('teamcity')
132 | }
133 |
--------------------------------------------------------------------------------
/libAjProfiler/src/main/aspectj/com/archinamon/profiler/core/AnnotationProfiler.aj:
--------------------------------------------------------------------------------
1 | package com.archinamon.profiler.core;
2 |
3 | import com.archinamon.profiler.annotation.ProfileCall;
4 | import com.archinamon.profiler.annotation.ProfileClass;
5 | import com.archinamon.profiler.annotation.ProfileDynamic;
6 | import com.archinamon.profiler.annotation.ProfileErrors;
7 | import com.archinamon.profiler.annotation.ProfileExecution;
8 | import com.archinamon.profiler.annotation.ProfileField;
9 | import com.archinamon.profiler.annotation.ProfileInstance;
10 | import com.archinamon.profiler.annotation.ProfileStatic;
11 | import org.aspectj.lang.JoinPoint;
12 | import java.util.Arrays;
13 | import java.util.Map;
14 | import java.util.concurrent.ConcurrentHashMap;
15 |
16 | import static java.lang.System.out;
17 |
18 | /**
19 | * Created by archinamon on 13/02/16.
20 | */
21 | abstract aspect AnnotationProfiler {
22 |
23 | // this line declares execution order according to advice execution rules
24 | // this aspect should run over all others
25 | declare precedence: AnnotationProfiler+, *;
26 |
27 | // collect joinpoints only if defined annotations on object type is set
28 | private pointcut fieldOwner(): (within(@ProfileInstance *) || within(@ProfileClass *));
29 |
30 | // warn if profiled field breaks encapsulation
31 | private pointcut setFieldWarn(): @annotation(ProfileField) && set(!public * *) && !withincode(* set*(..));
32 | declare warning: fieldOwner() && setFieldWarn()
33 | : "[AOP:Warning!] => writing field outside the setter";
34 |
35 | private pointcut getFieldWarn(): @annotation(ProfileField) && get(!public * *) && !withincode(* get*(..));
36 | declare warning: fieldOwner() && getFieldWarn()
37 | : "[AOP:Warning!] => reading field outside the getter";
38 |
39 | protected final pointcut profileTargetCall(ProfileCall pc): call(* *(..)) && @annotation(pc);
40 | protected final pointcut profileTargetExecution(ProfileExecution pe): execution(* *(..)) && @annotation(pe);
41 |
42 | protected final pointcut profileTargetErrors(ProfileErrors pe): @annotation(pe) && (execution(* *(..)) || execution(* *(..) throws *));
43 |
44 | protected final pointcut profileTargetClass(ProfileClass pc): @within(pc) && execution(static * *(..));
45 | protected final pointcut profileTargetInstance(ProfileInstance pi): @within(pi) && execution(!static * *(..));
46 |
47 | protected final pointcut profileTargetDynamic(ProfileDynamic pd): @within(pd) && (preinitialization(*.new(..)) || initialization(*.new(..)));
48 | protected final pointcut profileTargetStatic(ProfileStatic ps): @within(ps) && staticinitialization(*);
49 | protected final pointcut profileTargetField(ProfileField pf): fieldOwner() && (set(* *) || get(* *)) && @annotation(pf);
50 |
51 | protected static boolean checkErrorClausing(Throwable throwable, ProfileErrors pe) {
52 | return Arrays.asList(pe.value()).contains(throwable.getClass());
53 | }
54 |
55 | protected static final Map sTimeData = new ConcurrentHashMap<>();
56 |
57 | protected void writeEnterTime(JoinPoint.StaticPart jp) {
58 | sTimeData.put(getIdx(jp), System.currentTimeMillis());
59 | }
60 |
61 | protected void removeEnterTime(JoinPoint.StaticPart jp) {
62 | final String idx = getIdx(jp);
63 | if (sTimeData.containsKey(idx)) sTimeData.remove(idx);
64 | }
65 |
66 | protected void writeExitTime(JoinPoint.StaticPart jp) {
67 | final String idx = getIdx(jp);
68 | if (!sTimeData.containsKey(idx)) return;
69 |
70 | Long finishTime = System.currentTimeMillis();
71 | Long startTime = sTimeData.remove(idx);
72 |
73 | Long timing = finishTime - startTime;
74 | print(idx + " takes " + timing + "ms to proceed");
75 | }
76 |
77 | protected void writeException(JoinPoint.StaticPart jp, Throwable th) {
78 | final String idx = getIdx(jp);
79 | if (!sTimeData.containsKey(idx)) return;
80 |
81 | Long finishTime = System.currentTimeMillis();
82 | Long startTime = sTimeData.remove(idx);
83 | Long timing = finishTime - startTime;
84 |
85 | print(idx + " throwed unhandled exception: " + th.getMessage());
86 | print(idx + " takes " + timing + " before throwing exception");
87 | print("below goes a stacktrace");
88 | th.printStackTrace();
89 | }
90 |
91 | private void print(final String data) {
92 | out.println(data);
93 | }
94 |
95 | private String getIdx(JoinPoint.StaticPart jp) {
96 | String className = jp.getSignature().getDeclaringTypeName();
97 | String methodName = jp.getSignature().getName();
98 |
99 | return className + ":" + methodName;
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/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 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | {description}
294 | Copyright (C) {year} {fullname}
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | {signature of Ty Coon}, 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
341 |
--------------------------------------------------------------------------------
/app/app.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | generateDevDebugSources
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
38 |