Fragments and so on

923 views
Skip to first unread message

Manfred Moser

unread,
Mar 5, 2011, 12:35:05 AM3/5/11
to robo...@googlegroups.com
Hi all!

With the new Fragments API and so on I am wondering how we should be adding support for these to RoboGuice. Should we just use the static library as a dependency and then create RoboFragment and so on?

manfred

Ildar Karimov

unread,
Mar 5, 2011, 5:30:29 PM3/5/11
to robo...@googlegroups.com
Library is distributed under APL 2.0 license so I hope that someone
will push it to the maven repo and make it possible to add dependency
easily.

2011/3/5 Manfred Moser <mos...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups
> "roboguice" group.
> To post to this group, send email to robo...@googlegroups.com.
> To unsubscribe from this group, send email to
> roboguice+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/roboguice?hl=en.
>

Adam Tybor

unread,
Mar 5, 2011, 7:53:08 PM3/5/11
to robo...@googlegroups.com
So do I still need 2 apks if using fragments, 1 for honeycomb and 1 for non-honeycomb with the linked library?  I was hoping the blog post would talk about creating a single apk for use on all platforms.  Another question is how will roboguice handle 3.0+ and 2.3+ apis?

Ildar Karimov

unread,
Mar 6, 2011, 6:42:25 AM3/6/11
to robo...@googlegroups.com
As far as I understand you can use single APK for both 1.6+ and 3.0
platforms (though for 3.0 there will be little overhead in size)

2011/3/6 Adam Tybor <adam....@gmail.com>:

Manfred Moser

unread,
Mar 6, 2011, 9:50:06 PM3/6/11
to robo...@googlegroups.com
Yes, that was my understanding too. However if you are below 3.0 you have to use the static library which has a different package (android.support.V4) for e.g. the Fragment class. So if we extend that to make a RoboFragment for example it will always use that even if you do a 3.0 only app? 

Will have to think about this all a bit.. the maps extension already provides a bit of a problem like that. Do we have to break up Roboguice into core and e.g. maps, compatibility and honeycomb additional libraries.. that would solve it but be more pain..

I might play with that idea a bit next week.

this week - andevcon

manfred

Donn Felker

unread,
Mar 7, 2011, 10:23:00 AM3/7/11
to robo...@googlegroups.com
Just a quick thought ... we could do the same as the Android market. We could inspect the uses-sdk element of the Manifest, and if the android:minSdkVersion is less than 11 (3.0 Honeycomb) then we throw an exception in the RoboFragment upon app initialization with a very friendly exception error message. 

I'm not 100% sure if this is possible, but its just something we could possibly do. 

Thoughts? 

Donn Felker
Author of Android Tablet Dev for Dummies (Summer 2011)
Author of Android App Dev for Dummies  & Intro to Android Development (tekpub.com)
Microsoft ASPInsider, MCTS, MCP, CSM, ITIL
http://blog.donnfelker.com
http://twitter.com/donnfelker

Michael Ludwig

unread,
Apr 10, 2011, 1:47:00 PM4/10/11
to roboguice
I would love to use RoboGuice for my application. I am using the
compatibility pack for fragments and FragmentActivity (modified
compatibility pack which works with MapActivity)
Is there any progress on this and will it work in future with
FragmentActivity?

Michael

On 7 Mrz., 17:23, Donn Felker <d...@donnfelker.com> wrote:
> Just a quick thought ... we could do the same as the Android market. We
> could inspect the *uses-sdk* element of the Manifest, and if the
> android:minSdkVersion is less than 11 (3.0 Honeycomb) then we throw an
> exception in the RoboFragment upon app initialization with a very friendly
> exception error message.
>
> I'm not 100% sure if this is possible, but its just something we could
> possibly do.
>
> Thoughts?
>
> Donn Felker
> Author of Android Tablet Dev for Dummies (Summer 2011)
> Author of Android App Dev for Dummies  & Intro to Android Development (
> tekpub.com)
> Microsoft ASPInsider, MCTS, MCP, CSM, ITILhttp://blog.donnfelker.comhttp://twitter.com/donnfelker
>
>
>
>
>
>
>
> On Sun, Mar 6, 2011 at 8:50 PM, Manfred Moser <mosa...@gmail.com> wrote:
> > Yes, that was my understanding too. However if you are below 3.0 you have
> > to use the static library which has a different package (android.support.V4)
> > for e.g. the Fragment class. So if we extend that to make a RoboFragment for
> > example it will always use that even if you do a 3.0 only app?
>
> > Will have to think about this all a bit.. the maps extension already
> > provides a bit of a problem like that. Do we have to break up Roboguice into
> > core and e.g. maps, compatibility and honeycomb additional libraries.. that
> > would solve it but be more pain..
>
> > I might play with that idea a bit next week.
>
> > this week - andevcon
>
> > manfred
>
> > On Sun, Mar 6, 2011 at 3:42 AM, Ildar Karimov <ildar.kari...@gmail.com>wrote:
>
> >> As far as I understand you can use single APK for both 1.6+ and 3.0
> >> platforms (though for 3.0 there will be little overhead in size)
>
> >> 2011/3/6 Adam Tybor <adam.ty...@gmail.com>:

Weston Weems

unread,
Apr 12, 2011, 12:39:20 PM4/12/11
to roboguice
I dont know if anyone is currently working on this... but I've just
started playing with roboguice (vast experience with IOC containers
and DI frameworks..). I am in the process of building quite an
involved honeycomb application building heavily on the fragment apis.

Currently have library projects that are consumable from either my
honeycomb projects or 2.2 android apps just fine.

Anyway, if nobody is working on this, I'd be happy to take a crack at
it... seems to me (like someone stated above), you could pretty easily
create a RoboFragment, and build some support to consume/manipulate
the FragmentManager and be done with it.

I'm bored re-defining my ui elements and setting them elsewhere, and
to me... helping out here to save myself a ton of code elsewhere would
be worth while.


Let me know

Weston

On Apr 10, 10:47 am, Michael Ludwig

Michael Burton

unread,
Apr 13, 2011, 11:12:29 AM4/13/11
to robo...@googlegroups.com
I think macarse was interested in pursuing this, too. https://groups.google.com/d/topic/roboguice/UA3c1HysnNk/discussion

Manfred Moser

unread,
Apr 13, 2011, 8:00:42 PM4/13/11
to robo...@googlegroups.com
Weston

I would be great if you could put your work into a mercurial branch that is available for us all. We could then collaborate on this going forward. 

I am probably going to start on tablet support for my roboguice based app shortly and will definitely use the compatibily library and start with support for it in roboguice.. 

manfred

Michael Ludwig

unread,
Apr 21, 2011, 8:33:34 AM4/21/11
to roboguice
I hacked a little bit. But i am not to deep in the RoboGuice
internals, so i don't know if it is right in the way RoboGuice works.
But it worked for my project. Sorry for only pasting it on pastebin.

RoboFragmentActivity: http://pastebin.com/2hzf4BRZ

RoboFragment: http://pastebin.com/6YEKETiG

The main hack is scope.injectFragmentViews(view) -> http://pastebin.com/HTBHnd2S
http://pastebin.com/7sTCM6Lz

I think this is really worse, but i made it wokring for me. The
problem is that the findViewByID works not on the activity, but on the
view. This is also for CustomViews the problem. Maybe there is a
generic solution possible

I don't know if it helps someone, but i wanted it to share. Also
someone could tell me if i brake something really worse.

Michael
Reply all
Reply to author
Forward
0 new messages