Giter VIP home page Giter VIP logo

Comments (12)

f2prateek avatar f2prateek commented on May 25, 2024

not sure I quite understand the issue here. Could you clarify with an example?

from dart.

stephanenicolas avatar stephanenicolas commented on May 25, 2024

If a fragment declares an InjectExtra annotation field, there is no way
that Henson can detected it when building the DSL of the activity(ies) that
will contain the fragment.

The the DSL doens't allow to fill the value of the field.

2015-07-24 16:44 GMT-07:00 Prateek Srivastava [email protected]:

not sure I quite understand the issue here. Could you clarify with an
example?


Reply to this email directly or view it on GitHub
#58 (comment).

from dart.

f2prateek avatar f2prateek commented on May 25, 2024

That makes more sense, but what does the @ForFragmentsOnly annotation do?

from dart.

stephanenicolas avatar stephanenicolas commented on May 25, 2024

Just tell maintainers : I don't use this extra entry directly, but my
fragments do, don't erase me.
But then the DSL will allow to fill the extra for the fragments.

I actually think it would enforce a more complicated way of doing things
than Android allows to, but that would be better structured and reduce
intent mess.

2015-07-24 16:48 GMT-07:00 Prateek Srivastava [email protected]:

That makes more sense, but what does the @ForFragmentsOnly annotation do?


Reply to this email directly or view it on GitHub
#58 (comment).

from dart.

stephanenicolas avatar stephanenicolas commented on May 25, 2024

WDYT of this for RC 2 ? @f2prateek

from dart.

stephanenicolas avatar stephanenicolas commented on May 25, 2024

In the case of fragments or pojos (i.e. non activities) using @InjectExtra, they should not have their own intent builders and should not appear in the goto list of Henson.

from dart.

stephanenicolas avatar stephanenicolas commented on May 25, 2024

We can combine this with #84 and #67 .

For instance, let's take an Activity A that uses a class M as model and contains 2 fragments F0 F1.
We could use :

@HensonNavigable( model = M.class, fragments = F0.class, F1.class } )
class A {
}

Then Henson would allow :

  Henson.with( context )
               .gotoA()
               .<dslProvidedByM>
               .fragmentF0()
               .<dslProvidedByF0>

There are still a couple of issues to address :

  • redundancy between the @InjectExtras of Fragments and activity / model
  • Fragments using a model too
  • using multiple fragments to build an Intent of A.

from dart.

dlemures avatar dlemures commented on May 25, 2024

+1

from dart.

vjames19 avatar vjames19 commented on May 25, 2024

I would like to see this added to Henson.

from dart.

stephanenicolas avatar stephanenicolas commented on May 25, 2024

I would propose :

Henson.with( context )
               .gotoA()
               .<dslProvidedByA>
               .forFragmentF0()
               .<dslProvidedByF0>
               .endFragmentF0

Those would be treated as optional when defining the activity intent.
They would appear in a state after all required extras for A are set.
closing them would go back to this state in the state machine.

from dart.

stephanenicolas avatar stephanenicolas commented on May 25, 2024

This is also too complicated and is on the way to release of DART 2.

Moreover, Henson already helps and a simple (and clean actually) workaround is
image

We add a sample.

from dart.

talenguyen avatar talenguyen commented on May 25, 2024

Henson support Intent builder. But, for Fragment we need Bundle instead. So, I think it need to improve for Fragment. I tested in version 2.0.2 and saw that builder for Fragment look so weird.

public CategoryListFragment$$IntentBuilder(Context context) {
    intent = new Intent(context, CategoryListFragment.class); // Intent for fragment?
  }

  public CategoryListFragment$$IntentBuilder.AllSet parentId(String parentId) {
    bundler.put("parentId", parentId);
    return new CategoryListFragment$$IntentBuilder.AllSet();
  }

  public class AllSet {
    public Intent build() {
      intent.putExtras(bundler.get());
      return intent;
    }
  }

from dart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.