Skip to content

Commit fa9d9a0

Browse files
committed
Version 1.2.0: Added @parcelable annotation and some DSL methods
2 parents 65a5ada + 2a20920 commit fa9d9a0

Some content is hidden

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

48 files changed

+1975
-709
lines changed

.gitignore

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,60 @@
1-
.gradle
2-
/local.properties
3-
/.idea
4-
.DS_Store
5-
/build
1+
# Created by .gitignore support plugin (hsz.mobi)
2+
### JetBrains template
3+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
4+
5+
*.iml
6+
7+
## Directory-based project format:
8+
.idea/
9+
build/
10+
.directory
11+
# if you remove the above rule, at least ignore the following:
12+
13+
# User-specific stuff:
14+
# .idea/workspace.xml
15+
# .idea/tasks.xml
16+
# .idea/dictionaries
17+
18+
local.properties
19+
20+
# Sensitive or high-churn files:
21+
# .idea/dataSources.ids
22+
# .idea/dataSources.xml
23+
# .idea/sqlDataSources.xml
24+
# .idea/dynamic.xml
25+
# .idea/uiDesigner.xml
26+
27+
# Gradle:
28+
# .idea/gradle.xml
29+
# .idea/libraries
30+
31+
.gradle/
32+
33+
# Mongo Explorer plugin:
34+
# .idea/mongoSettings.xml
35+
36+
## File-based project format:
37+
*.ipr
38+
*.iws
39+
40+
## Plugin-specific files:
41+
42+
# IntelliJ
43+
out/
44+
45+
# mpeltonen/sbt-idea plugin
46+
.idea_modules/
47+
48+
# JIRA plugin
49+
atlassian-ide-plugin.xml
50+
51+
# Crashlytics plugin (for Android Studio and IntelliJ)
52+
com_crashlytics_export_strings.xml
53+
crashlytics.properties
54+
crashlytics-build.properties
55+
56+
maven_push.gradle
57+
local.properties
58+
59+
*/gradlew
60+

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog:
22

33
### Versions:
4+
* **1.2.0** - Added @Parcelable annotation and DSL methods.
45
* **1.1.4** - Fixed another minor bug with primitives.
56
* **1.1.3** - Fixed minor bug where methods with primitive parameters weren't found on method search.
67
* **1.1.2** - Fixed BIG bug when SwissKnife couldn't find the method.

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ With **SwissKnife** you can:
1111
* Inject views dynamically on *any Object* as long a you have a View to find them. No more ``findViewById`` and **you don't have to extend any classes**.
1212
* Add callback methods to several actions using ``@OnClick``, ``@OnItemClick``, etc.
1313
* Execute methods in the UI Thread or a background one using ``@OnUIThread`` and ``@OnBackground``.
14-
* Make your variables persistent across state changes **without messing with** `onSaveInstanceState`
14+
* Make your variables persistent across state changes **without messing with** `onSaveInstanceState`.
15+
* Make anything Parcelable with the @Parcelable annotation - which can be used with @SaveInstance to automatize the data persistance.
1516

1617
You can see an example here:
1718

@@ -84,7 +85,7 @@ Once your project App Module is configured to use Groovy you can add this librar
8485
```groovy
8586
dependencies {
8687
...
87-
compile 'com.arasthel:swissknife:1.1.4'
88+
compile 'com.arasthel:swissknife:1.2.0'
8889
...
8990
}
9091
```

SwissKnife.iml

Lines changed: 0 additions & 19 deletions
This file was deleted.

SwissKnife/.gitignore

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,51 @@
1-
/build
1+
# Created by .gitignore support plugin (hsz.mobi)
2+
### JetBrains template
3+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
4+
5+
*.iml
6+
7+
## Directory-based project format:
8+
.idea/
9+
build/
10+
# if you remove the above rule, at least ignore the following:
11+
12+
# User-specific stuff:
13+
# .idea/workspace.xml
14+
# .idea/tasks.xml
15+
# .idea/dictionaries
16+
17+
# Sensitive or high-churn files:
18+
# .idea/dataSources.ids
19+
# .idea/dataSources.xml
20+
# .idea/sqlDataSources.xml
21+
# .idea/dynamic.xml
22+
# .idea/uiDesigner.xml
23+
24+
# Gradle:
25+
# .idea/gradle.xml
26+
# .idea/libraries
27+
28+
# Mongo Explorer plugin:
29+
# .idea/mongoSettings.xml
30+
31+
## File-based project format:
32+
*.ipr
33+
*.iws
34+
35+
## Plugin-specific files:
36+
37+
# IntelliJ
38+
out/
39+
40+
# mpeltonen/sbt-idea plugin
41+
.idea_modules/
42+
43+
# JIRA plugin
44+
atlassian-ide-plugin.xml
45+
46+
# Crashlytics plugin (for Android Studio and IntelliJ)
47+
com_crashlytics_export_strings.xml
48+
crashlytics.properties
49+
crashlytics-build.properties
50+
51+

SwissKnife/SwissKnife.iml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@
3232
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
3333
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
3434
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
35+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
3536
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
3637
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
3738
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
3839
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
3940
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
41+
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/test/debug" type="java-test-resource" />
4042
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
4143
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
4244
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
@@ -60,6 +62,7 @@
6062
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/groovy" isTestSource="true" />
6163
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
6264
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
65+
<excludeFolder url="file://$MODULE_DIR$/build/docs" />
6366
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
6467
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
6568
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
@@ -84,11 +87,12 @@
8487
<excludeFolder url="file://$MODULE_DIR$/build/poms" />
8588
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
8689
</content>
87-
<orderEntry type="jdk" jdkName="Android API 21 Platform (1)" jdkType="Android SDK" />
90+
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
8891
<orderEntry type="sourceFolder" forTests="false" />
89-
<orderEntry type="library" exported="" name="support-annotations-21.0.0" level="project" />
90-
<orderEntry type="library" exported="" name="support-v4-21.0.0" level="project" />
91-
<orderEntry type="library" exported="" name="groovy-2.4.0-beta-3-grooid" level="project" />
92+
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
93+
<orderEntry type="library" exported="" name="groovy-json-2.4.0-rc-2" level="project" />
94+
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
95+
<orderEntry type="library" exported="" name="groovy-2.4.0-rc-2-grooid" level="project" />
9296
</component>
9397
</module>
9498

SwissKnife/build.gradle

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,26 @@ apply plugin: 'me.champeau.gradle.groovy-android'
33

44
android {
55
compileSdkVersion 21
6-
buildToolsVersion "20.0.0"
7-
6+
buildToolsVersion "21.1.2"
87
defaultConfig {
9-
applicationId "com.arasthel.swissknife"
108
minSdkVersion 8
119
targetSdkVersion 21
1210
versionCode 1
13-
versionName "1.1.3"
11+
versionName "1.2.0"
12+
}
13+
14+
packagingOptions {
15+
exclude 'META-INF/ASL2.0'
16+
exclude 'META-INF/LICENSE'
17+
exclude 'META-INF/license.txt'
18+
exclude 'META-INF/NOTICE'
19+
exclude 'META-INF/notice.txt'
1420
}
21+
1522
buildTypes {
1623
release {
17-
runProguard false
18-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24+
minifyEnabled false
25+
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1926
}
2027
}
2128
}
@@ -28,11 +35,17 @@ repositories {
2835
jcenter()
2936
}
3037

38+
39+
3140
dependencies {
3241
compile fileTree(dir: 'libs', include: ['*.jar'])
33-
compile 'org.codehaus.groovy:groovy:2.4.0-beta-3:grooid'
34-
compile 'com.android.support:support-v4:21.0.0'
42+
compile 'org.codehaus.groovy:groovy:2.4.0-rc-2:grooid'
43+
compile 'com.android.support:support-v4:21.0.3'
44+
compile('org.codehaus.groovy:groovy-json:2.4.0-rc-2') {
45+
transitive = false
46+
}
3547
}
3648

3749
// Script to upload plugin to Maven
3850
apply from: '../maven_push.gradle'
51+

SwissKnife/gradlew.bat

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.arasthel.swissknife.annotations;
2+
3+
import org.codehaus.groovy.transform.GroovyASTTransformationClass
4+
5+
import java.lang.annotation.ElementType
6+
import java.lang.annotation.Retention
7+
import java.lang.annotation.RetentionPolicy
8+
import java.lang.annotation.Target
9+
10+
/**
11+
* Transforming entity to Parcelable
12+
*
13+
* @author Jorge Martín Espinosa
14+
*/
15+
@Retention(RetentionPolicy.SOURCE)
16+
@Target(ElementType.TYPE)
17+
@GroovyASTTransformationClass("com.arasthel.swissknife.annotations.ParcelableTransformation")
18+
@interface Parcelable {
19+
/**
20+
* Entity properties that should be excluded from Parcelable
21+
* @return
22+
*/
23+
Class exclude() default Closure
24+
}

0 commit comments

Comments
 (0)