Arello-Mobile / Arello-Mobile/Moxy

Параметризация презентера и интерфейса View

Open
#166 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
Java
Stars
1.6k
Forks
202
PR merge metrics
No merged PRs in 30d

Description

Здравствуйте!

Скорее всего моя проблема описана в этом тиките: https://github.com/Arello-Mobile/Moxy/issues/131, но ответа я там не нашел и решил создать отдельный тикет.

Столкнулся со следующей проблемой: при параметризации презентера и попытке заинжектить этот параметризованный презентер во фрагмент, сборка проекта падает с ошибкой:

Error:(14, 111) error: incompatible types: Class<GenericPresenter> cannot be converted to Class<? extends MvpPresenter<?>>

Интерфейс View:

public interface GenericView<T> extends MvpView {
}

Код параметризованного презентера:

public class GenericPresenter<T> extends MvpPresenter<GenericView<T>> {
}

Фрагмент, в котором я хочу заинжектить параметризованный презентер:

public class GenericFragment extends Fragment implements GenericView<Model> {

    @InjectPresenter
    GenericPresenter<Model> mPresenter;

    @ProvidePresenter
    GenericPresenter<Model> providePresenter() {
        return new GenericPresenter<>();
    }
}

Вопрос: корректно ли я пытаюсь заинжектить параметризованный презентер и можно ли вообще средствами Moxy получить то, что я хочу - инжект параметризованного презентера.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing issue #131 and reproducing the reported compilation error using the GenericView, GenericPresenter, and GenericFragment examples in this issue. Trace how parameterized presenters are validated during injection, then document whether this usage is supported and what the confirmed outcome is.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.