Search in sources :

Example 11 with Audient

use of com.xinshang.audient.model.entities.Audient in project Audient by komamj.

the class ToplistDetailFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    LogUtils.i(TAG, "onViewCreated");
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            if (mPresenter != null) {
                mPresenter.subscribe();
            }
        }
    });
    mSwipeRefreshLayout.setColorSchemeResources(R.color.colorAccent, R.color.colorPrimaryDark, R.color.colorPrimary);
    mSwipeRefreshLayout.setRefreshing(true);
    mAdapter = new AudientAdapter(mContext);
    mAdapter.setEventListener(new AudientAdapter.EventListener() {

        @Override
        public void onFavoriteMenuClick(Audient audient) {
            Intent intent = new Intent(mContext, MyFavoritesActivity.class);
            intent.putExtra(Constants.KEY_AUDIENT, audient);
            mContext.startActivity(intent);
        }

        @Override
        public void onPlaylistChanged(Audient audient) {
            PaymentDialogFragment.show(getChildFragmentManager(), audient);
        }
    });
    mRecyclerView.setHasFixedSize(true);
    LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecyclerView.setLayoutManager(layoutManager);
    mRecyclerView.addItemDecoration(new AudientItemDecoration(mContext));
    mRecyclerView.setAdapter(mAdapter);
    if (mPresenter != null) {
        mPresenter.subscribe();
    }
}
Also used : MyFavoritesActivity(com.xinshang.audient.favorite.MyFavoritesActivity) AudientItemDecoration(com.xinshang.audient.widget.AudientItemDecoration) Intent(android.content.Intent) Audient(com.xinshang.audient.model.entities.Audient) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) AudientAdapter(com.xinshang.audient.base.AudientAdapter)

Example 12 with Audient

use of com.xinshang.audient.model.entities.Audient in project Audient by komamj.

the class ToplistDetailPresenter method loadToplistDetail.

@Override
public void loadToplistDetail(int topId, String showTime, int page, int pageCount) {
    mDisposables.clear();
    Disposable disposable = mRepository.getToplistDetail(topId, showTime, page, pageCount).map(new Function<ToplistDetailResult, List<Audient>>() {

        @Override
        public List<Audient> apply(ToplistDetailResult toplistDetailResult) throws Exception {
            return toplistDetailResult.dataBean.audients;
        }
    }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribeWith(new DisposableSubscriber<List<Audient>>() {

        @Override
        public void onNext(List<Audient> audients) {
            if (mView.isActive()) {
                mView.showToplistDetail(audients);
            }
        }

        @Override
        public void onError(Throwable t) {
            LogUtils.e(TAG, "getToplistDetail error :" + t.toString());
        }

        @Override
        public void onComplete() {
        }
    });
    mDisposables.add(disposable);
}
Also used : CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Disposable(io.reactivex.disposables.Disposable) ToplistDetailResult(com.xinshang.audient.model.entities.ToplistDetailResult) Function(io.reactivex.functions.Function) List(java.util.List) Audient(com.xinshang.audient.model.entities.Audient)

Example 13 with Audient

use of com.xinshang.audient.model.entities.Audient in project Audient by komamj.

the class SearchFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    LogUtils.i(TAG, "onViewCreated");
    showProgressBar(false);
    mAdapter = new AudientAdapter(mContext);
    mAdapter.setEventListener(new AudientAdapter.EventListener() {

        @Override
        public void onFavoriteMenuClick(Audient audient) {
            Intent intent = new Intent(mContext, MyFavoritesActivity.class);
            intent.putExtra(Constants.KEY_AUDIENT, audient);
            mContext.startActivity(intent);
        }

        @Override
        public void onPlaylistChanged(Audient audient) {
            PaymentDialogFragment.show(getChildFragmentManager(), audient);
        }
    });
    mRecyclerView.setHasFixedSize(true);
    LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecyclerView.setLayoutManager(layoutManager);
    mRecyclerView.addItemDecoration(new AudientItemDecoration(mContext));
    mRecyclerView.setAdapter(mAdapter);
}
Also used : MyFavoritesActivity(com.xinshang.audient.favorite.MyFavoritesActivity) AudientItemDecoration(com.xinshang.audient.widget.AudientItemDecoration) Intent(android.content.Intent) Audient(com.xinshang.audient.model.entities.Audient) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) AudientAdapter(com.xinshang.audient.base.AudientAdapter)

Aggregations

Audient (com.xinshang.audient.model.entities.Audient)13 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)5 AudientItemDecoration (com.xinshang.audient.widget.AudientItemDecoration)5 CompositeDisposable (io.reactivex.disposables.CompositeDisposable)5 Disposable (io.reactivex.disposables.Disposable)5 Intent (android.content.Intent)4 MyFavoritesActivity (com.xinshang.audient.favorite.MyFavoritesActivity)4 Function (io.reactivex.functions.Function)4 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)3 AudientAdapter (com.xinshang.audient.base.AudientAdapter)3 List (java.util.List)3 Favorite (com.xinshang.audient.model.entities.Favorite)2 AudientApplication (com.xinshang.audient.AudientApplication)1 Lyric (com.xinshang.audient.model.entities.Lyric)1 LyricResult (com.xinshang.audient.model.entities.LyricResult)1 NowPlayingResponse (com.xinshang.audient.model.entities.NowPlayingResponse)1 SearchResult (com.xinshang.audient.model.entities.SearchResult)1 SongDetailResult (com.xinshang.audient.model.entities.SongDetailResult)1 ToplistDetailResult (com.xinshang.audient.model.entities.ToplistDetailResult)1 Publisher (org.reactivestreams.Publisher)1