Closed johncarl81 closed 8 years ago
This looks great.. but Context doesn't have overridePendingTransition
.. I think you could do something like
new ActivtyFactory()
.setValue("value")
.overridePendingTransition(R.anim.slide_left, R.anim.slide_right)
.start(context);
where start()
does a check to see if the context is an Activity and if so, apply the transitions.
Ok, I changed the api to allow for sub-Contexts to be chained. If you inject the Activity
then you can use the overridePendingTransition
as a chained call. Here's the new api:
public abstract class ComponentFactory {
//...
public <T extends Context> T start(T context) {
context.startActivity(build(context));
return context;
}
}
really liking this change. we just need a method for startActivityForResult()
^ How's that?
Close! need to be able to pass request code and optional Bundle (right now passing flags
which doesn't make sense in this context.)
Probably should add start() signature that takes Bundle
also
Oh, duh.. done!
Awesome! Trying it out now.
We don't need the variants of these methods that take Bundle right now.. but we probably will when we start doing scene transitions and the like
Doh... I'm just going to build the Intent for this one.. forgot that in fragment land you need to call Fragment.startActivityForResult(Intent, int) to get delivery of activity result to fragment... so we would need a new method that takes Fragment to facilitate the fluid API
I'll look at that one in depth in a bit.. you could still build the intent using the CompeontFactory and use it in the Fragment.startActivityForResult(..) call.
Yes, that's what we did. works great.
:+1: Merge at will if you're happy with this functionality then.
190 #88
This includes both fragment and intent factory extensions.
Also includes the ability to chain context calls onto the start() method to leverage some "animation awesomeness":