Search in sources :

Example 1 with TestsDataModelImpl

use of com.github.vase4kin.teamcityapp.tests.data.TestsDataModelImpl in project TeamCityApp by vase4kin.

the class TestsPresenterImpl method initViews.

/**
 * {@inheritDoc}
 */
@Override
protected void initViews() {
    super.initViews();
    mView.setListener(this);
    mView.setOnLoadMoreListener(new MugenCallbacks() {

        @Override
        public void onLoadMore() {
            mIsLoadMoreLoading = true;
            mView.addLoadMore();
            mDataManager.loadMore(new OnLoadingListener<List<TestOccurrences.TestOccurrence>>() {

                @Override
                public void onSuccess(List<TestOccurrences.TestOccurrence> data) {
                    mView.removeLoadMore();
                    mView.addMoreBuilds(new TestsDataModelImpl(data));
                    mIsLoadMoreLoading = false;
                }

                @Override
                public void onFail(String errorMessage) {
                    mView.removeLoadMore();
                    mView.showRetryLoadMoreSnackBar();
                    mIsLoadMoreLoading = false;
                }
            });
        }

        @Override
        public boolean isLoading() {
            return mIsLoadMoreLoading;
        }

        @Override
        public boolean hasLoadedAllItems() {
            return !mDataManager.canLoadMore();
        }
    });
    mView.replaceSkeletonViewContent();
}
Also used : TestsDataModelImpl(com.github.vase4kin.teamcityapp.tests.data.TestsDataModelImpl) MugenCallbacks(com.mugen.MugenCallbacks) TestOccurrences(com.github.vase4kin.teamcityapp.tests.api.TestOccurrences) List(java.util.List) OnLoadingListener(com.github.vase4kin.teamcityapp.account.create.data.OnLoadingListener)

Example 2 with TestsDataModelImpl

use of com.github.vase4kin.teamcityapp.tests.data.TestsDataModelImpl in project TeamCityApp by vase4kin.

the class TestsPresenterImpl method onOptionsItemSelected.

/**
 * {@inheritDoc}
 */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    mView.showRefreshAnimation();
    mView.hideErrorView();
    mView.hideEmpty();
    mView.showData(new TestsDataModelImpl(Collections.<TestOccurrences.TestOccurrence>emptyList()));
    return mView.onOptionsItemSelected(item);
}
Also used : TestsDataModelImpl(com.github.vase4kin.teamcityapp.tests.data.TestsDataModelImpl)

Aggregations

TestsDataModelImpl (com.github.vase4kin.teamcityapp.tests.data.TestsDataModelImpl)2 OnLoadingListener (com.github.vase4kin.teamcityapp.account.create.data.OnLoadingListener)1 TestOccurrences (com.github.vase4kin.teamcityapp.tests.api.TestOccurrences)1 MugenCallbacks (com.mugen.MugenCallbacks)1 List (java.util.List)1