Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intents are not type safe #5866

Open
tobiasKaminsky opened this issue Apr 14, 2020 · 2 comments
Open

Intents are not type safe #5866

tobiasKaminsky opened this issue Apr 14, 2020 · 2 comments

Comments

@tobiasKaminsky
Copy link
Member

As we had this recently: #5857

To prevent this, my idea is to have a static "launch" function in ever needed activity, that handles creating the intent correctly.
In this case it could be:

public static function launch/createIntent(File file, Account account) {
Intent i = new Intent(fileActivity, ConflictsResolveActivity.class);
i.putExtra(ConflictsResolveActivity.EXTRA_FILE, file);
i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, account);

return i;
}

What do you think? @ezaquarii @AndyScherzinger

@ezaquarii
Copy link
Collaborator

@tobiasKaminsky Yes, this is analogous to Fragment.newInstance() approach and works well.

@AndyScherzinger
Copy link
Member

Yes, sound good to me too 👍

ezaquarii added a commit that referenced this issue Jun 13, 2020
This change addresses #6277 bug in more comprehensible way.
All calls to Context.startActivity(...) starthing
ContactsPreferenceActivity are replaced with type-safe
calls to static ContactsPreferenceActivity.startActivity*
sets of APIs.

No client code should be calling `Intent(..., ContactsPreferenceActivity.class)`
constructor anymore.

See #5866 for discussion about the pattern used in this PR.

Signed-off-by: Chris Narkiewicz <hello@ezaquarii.com>
ezaquarii added a commit that referenced this issue Jun 13, 2020
This change addresses #6277 bug in more comprehensible way.
All calls to Context.startActivity(...) starthing
ContactsPreferenceActivity are replaced with type-safe
calls to static ContactsPreferenceActivity.startActivity*
sets of APIs.

No client code should be calling `Intent(..., ContactsPreferenceActivity.class)`
constructor anymore.

See #5866 for discussion about the pattern used in this PR.

Signed-off-by: Chris Narkiewicz <hello@ezaquarii.com>
ezaquarii added a commit that referenced this issue Jun 13, 2020
This change addresses #6277 bug in more comprehensible way.
All calls to Context.startActivity(...) starthing
ContactsPreferenceActivity are replaced with type-safe
calls to static ContactsPreferenceActivity.startActivity*
sets of APIs.

No client code should be calling `Intent(..., ContactsPreferenceActivity.class)`
constructor anymore.

See #5866 for discussion about the pattern used in this PR.

Signed-off-by: Chris Narkiewicz <hello@ezaquarii.com>
ezaquarii added a commit that referenced this issue Jun 13, 2020
This change addresses #6277 bug in more comprehensible way.
All calls to Context.startActivity(...) starthing
ContactsPreferenceActivity are replaced with type-safe
calls to static ContactsPreferenceActivity.startActivity*
sets of APIs.

No client code should be calling `Intent(..., ContactsPreferenceActivity.class)`
constructor anymore.

See #5866 for discussion about the pattern used in this PR.

Signed-off-by: Chris Narkiewicz <hello@ezaquarii.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants