Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Add a setType method to org.androidannotations.api.builder.IntentBuilder class #1694

Closed

Description

@federicoiosue

When using IntentBuilder to start another activity I'm adding some extras to the intent itself by I'm lacking the ability to add a type to it.
The reason of this is that on my receiving activity I have a mimetype based filter.

Activity

  1. WonderCsabo commented on Feb 9, 2016

    @WonderCsabo
    Member

    Well, you can get the built Intent object from the builder, and manipulate it directly:

    Intent intent = MyActivity_.intent(this).get();
    intent.setType("something");
    
    startActivity(intent);

    Obviously, we cannot replicate every method of Intent in IntentBuilder.

  2. federicoiosue commented on Feb 10, 2016

    @federicoiosue
    ContributorAuthor

    I'm getting your point.
    I was thinking about that because I really like the IntentBuilder elegance and I'd really prefer to write

    AttachmentsActivity_
        .intent(getActivity())
        .action(Intent.ACTION_SEND)
        .extra(Intent.EXTRA_STREAM, uris.get(0))
        .type("image/jpg")
        .start();

    instead the the bloated regular version

    Intent sendIntent = new Intent(getActivity(), AttachmentsActivity_.class);
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_STREAM, uris.get(0));
    sendIntent.setType("image/jpg");
    startActivity(sendIntent);
  3. WonderCsabo commented on Feb 16, 2016

    @WonderCsabo
    Member

    OK, it does not hurt to adding type(), category() and data() methods to IntentBuilder. Wanna contribute?

  4. federicoiosue commented on Feb 17, 2016

    @federicoiosue
    ContributorAuthor

    Here you have my pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions