These are chat archives for Arasthel/SwissKnife

16th
Jul 2015
Mario Garcia
@mariogarcia
Jul 16 2015 12:32
I would like to add a new annotation @ContentView which basically saves the code from OnCreate setContentView(R....)
Jorge Martin Espinosa
@Arasthel
Jul 16 2015 12:33
For Activities and Fragments?
Mario Garcia
@mariogarcia
Jul 16 2015 12:34
Yes but I have a question about this, this annotation adds the OnCreate method with the setContentView() call and the SwissKnife.inject(this) invocation.
The Swissknife.inject(this) is only created if there is a @InjectView annotation present on the activity
Jorge Martin Espinosa
@Arasthel
Jul 16 2015 12:34
Or any event listener
Mario Garcia
@mariogarcia
Jul 16 2015 12:35
Yeap, the idea would be to check if there is any Swissknife annotation present. Does this sound ok ?
Jorge Martin Espinosa
@Arasthel
Jul 16 2015 12:36
You don't really have to do that
If I'm not mistaken
SwissKnife.inject(this) checks on runtime if there is an injectViews methods
If it's not there, it won't do a thing
Mario Garcia
@mariogarcia
Jul 16 2015 12:38
Ok that makes my life a lot easier :smile:
But now I remember that @Extra needs Swissknife.loadExtras(this), Am I right ?
Jorge Martin Espinosa
@Arasthel
Jul 16 2015 12:38
Yes, I had this issue some time ago and thought about checking every field and method, but that was an overkill
So I did it this way
Not so clean or good for performance
But a lot easier
Yes, that could be a problem
Also, you could want to do some stuff at activity's onCreate
That's why I didn't really like this annotation
You have onPostCreate, sure...
Maybe @ContentView could just check if there is an onCreate method and add those 2 calls right after super.onCreate(...), but I don't think that will be of much help
Mario Garcia
@mariogarcia
Jul 16 2015 12:42
Actually that could be a good solution :thumbsup:
Well sometimes you only have to create the OnCreate method just for adding the setCOntentView() that sometimes really piss me off :P
I also have to ASTs for getting rid of the menu option initialization
Jorge Martin Espinosa
@Arasthel
Jul 16 2015 12:43
:+1:
I also hate that one
Mario Garcia
@mariogarcia
Jul 16 2015 12:43
I'm creating a branch
BTW I have noticed you are using android-spock. Did you check robospock ? I'm investigating now test options and I would like to know your opinion on this
Jorge Martin Espinosa
@Arasthel
Jul 16 2015 12:47
I wanted to use RoboSpock but it doesn't seem to be compatible with Groovy 2.4
So instead I used @pieces029 's Android-Spock
It's working fine so faer
At least for testing SK
I justed fixed a couple of bugs on @Parcelable this morning thanks to that
Mario Garcia
@mariogarcia
Jul 16 2015 12:50
Nice to hear that. Are you going to merge it with master any time soon ?
Jorge Martin Espinosa
@Arasthel
Jul 16 2015 12:51
As soon as I'm finished testing it, which could be from a couple of days to the infinite and more
Android's Parcel could be one of the most untestable classes I've ever seen
Mario Garcia
@mariogarcia
Jul 16 2015 12:52
ok perfect
Alex Isaienko
@s0nerik
Jul 16 2015 13:59
@Arasthel RoboSpock actually works with Groovy 2.4, I'm using it in my fork of SwissKnife. It just have a dependency on Groovy 2.3.x that we can exclude.
Jorge Martin Espinosa
@Arasthel
Jul 16 2015 14:00
I see! Thanks for the info. I'll have to keep an eye on it and see which one fits me better Android-Spock or RoboSpock
Alex Isaienko
@s0nerik
Jul 16 2015 14:02
Well, as far as I remember, RoboSpock is suitable for unit testing and Android-Spock is only suitable for instrumentation testing. Instrumentation testing is slower, so RoboSpock should be a better choice.