Arello-Mobile / Moxy

Moxy is MVP library for Android

Home Page:https://github.com/Arello-Mobile/Moxy/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Проблема в сгенерированном коде TestListView$$State

dfazullin opened this issue · comments

Решил обновить проект.
Перешел на Androidx и с com.github.moxy на com.arello-mobile
Проблему со всеми импортами решил, но появилась ошибка кодогенерации moxy (то есть при com.github.moxy - такого не было)

Мой gradle

dependencies {
   ...
    // Moxy
    implementation "com.arello-mobile:moxy:$moxyVersion" //moxyVersion = '1.5.5'
    implementation 'tech.schoolhelper:moxy-x-androidx:1.7.0'
    kapt "com.arello-mobile:moxy-compiler:$moxyVersion"
   ...
}

Fragment

class TestListFragment: BaseListFragment<String, TestListView, TestListPresenter, StringPaginationAdapter>(), TestListView {

    @InjectPresenter
    lateinit var presenter: TestListPresenter

    @ProvidePresenter
    fun providePresenter(): TestListPresenter = TestListPresenter()

    override fun initPresenter() = presenter

    override fun initAdapter() = StringPaginationAdapter()
}

Родительский Fragment

abstract class BaseListFragment<
        ITEM: Any,
        VIEW: BaseListView<ITEM>,
        PRESENTER: BaseListPresenter<ITEM, VIEW>,
        A: BasePaginationAdapter<ITEM>
    > : BaseFragment(), BaseListView<ITEM>, PaginationRecyclerView.OnLoadMore {

    val listPresenter: PRESENTER by lazy { initPresenter() }

    abstract fun initPresenter(): PRESENTER

    val adapter: A by lazy { initAdapter() }

    open val emptyListLayoutRes = R.layout.layout_base_empty_list
    private var emptyLayout: View? = null
    override val layoutRes = R.layout.layout_base_list

    abstract fun initAdapter(): A

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
        val layout = super.onCreateView(inflater, container, savedInstanceState)
        layout.findViewById<FrameLayout>(R.id.flListContent)?.run {
            instanceEmptyList(inflater, container?.findViewById(R.id.flListContent))?.let {
                emptyLayout = it
                this@run.addView(emptyLayout)
                hideEmptyList()
            }
        }
        return layout
    }

    private fun instanceEmptyList(inflater: LayoutInflater, container: ViewGroup?): View? {
        return if (emptyListLayoutRes != -1) { inflater.inflate(emptyListLayoutRes, container, false) }
        else { null }
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        initRecyclerView(rvList)
        initRefresher()
        super.onViewCreated(view, savedInstanceState)
    }

    open fun initRecyclerView(recyclerView: PaginationRecyclerView) {
        recyclerView.adapter = adapter
        recyclerView.withPagination = this@BaseListFragment.withPagination
        recyclerView.listener = this
    }

    override fun updateList(list: List<ITEM>) {
        rlRefresher?.isRefreshing = false
        adapter.update(list)
    }

    open fun getRefresherLayout(): SwipeRefreshLayout? = rlRefresh

    open fun getRecyclerView(): PaginationRecyclerView = prvList
}

View

interface TestListView : BaseListView<String>

Родительский View

@StateStrategyType(AddToEndSingleStrategy::class)
interface BaseListView <I>: BaseView {
    ...
    fun updateList(list: List<I>)
    ...
}

Сгенерированный код TestListView$$State (Ругается на "List<? extends I>", Не знает "I")

public class TestListView$$State extends MvpViewState<TestListView> implements TestListView {

        ......

	@Override
	public void updateList(List<? extends I> list) {
		UpdateListCommand updateListCommand = new UpdateListCommand(list);
		mViewCommands.beforeApply(updateListCommand);

		if (mViews == null || mViews.isEmpty()) {
			return;
		}

		for (TestListView view : mViews) {
			view.updateList(list);
		}

		mViewCommands.afterApply(updateListCommand);
	}

	public class UpdateListCommand extends ViewCommand<TestListView> {
		public final List<? extends I> list;

		UpdateListCommand(List<? extends I> list) {
			super("updateList", AddToEndSingleStrategy.class);

			this.list = list;
		}

		@Override
		public void apply(TestListView mvpView) {
			mvpView.updateList(list);
		}
	}

        ......

}