Search in sources :

Example 1 with AudientItemDecoration

use of com.xinshang.audient.widget.AudientItemDecoration in project Audient by komamj.

the class TopListFragment method onViewCreated.

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

        @Override
        public void onRefresh() {
            if (mPresenter != null) {
                mPresenter.loadTopList();
            }
        }
    });
    mSwipeRefreshLayout.setColorSchemeResources(R.color.colorAccent, R.color.colorPrimaryDark, R.color.colorPrimary);
    mAdapter = new TopListAdapter(mContext);
    mRecyclerView.setHasFixedSize(true);
    LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecyclerView.setLayoutManager(layoutManager);
    mRecyclerView.addItemDecoration(new AudientItemDecoration(mContext));
    mRecyclerView.setAdapter(mAdapter);
    mIsPrepared = true;
}
Also used : AudientItemDecoration(com.xinshang.audient.widget.AudientItemDecoration) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout)

Example 2 with AudientItemDecoration

use of com.xinshang.audient.widget.AudientItemDecoration in project Audient by komamj.

the class PlaylistFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    setLoadingIndicator(true);
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

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

        @Override
        public void onFavoriteMenuClick(Audient audient) {
            Intent intent = new Intent(mContext, MyFavoritesActivity.class);
            intent.putExtra(Constants.KEY_AUDIENT, audient);
            mContext.startActivity(intent);
        }
    });
    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) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout)

Example 3 with AudientItemDecoration

use of com.xinshang.audient.widget.AudientItemDecoration in project Audient by komamj.

the class MyFavoritesFragment 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.loadMyFavorites();
            }
        }
    });
    mSwipeRefreshLayout.setColorSchemeResources(R.color.colorAccent, R.color.colorPrimaryDark, R.color.colorPrimary);
    setLoadingIndicator(true);
    mAdapter = new MyFavoritesAdapter(mContext);
    mAdapter.setListener(new MyFavoritesAdapter.EventListener() {

        @Override
        public void onItemClick(Favorite favorite) {
            if (mPresenter != null) {
                mPresenter.addToFavorite(favorite.favoritesId, mAudient);
            }
        }
    });
    LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecyclerView.addItemDecoration(new AudientItemDecoration(mContext));
    mRecyclerView.setLayoutManager(layoutManager);
    mRecyclerView.setAdapter(mAdapter);
    if (mPresenter != null) {
        mPresenter.loadMyFavorites();
    }
}
Also used : Favorite(com.xinshang.audient.model.entities.Favorite) AudientItemDecoration(com.xinshang.audient.widget.AudientItemDecoration) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout)

Example 4 with AudientItemDecoration

use of com.xinshang.audient.widget.AudientItemDecoration in project Audient by komamj.

the class FavoriteDetailFragment 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.loadData(mFavorite.favoritesId);
            }
        }
    });
    mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimaryDark, R.color.colorPrimary, R.color.colorAccent);
    setLoadingIndicator(true);
    mAdapter = new FavoritesSongAdapter(mContext);
    mAdapter.setEventListener(new FavoritesSongAdapter.EventListener() {

        @Override
        public void onDeleteEventChanged(Favorite.FavoritesSong favoritesSong) {
            if (mPresenter != null) {
                mPresenter.deleteFavoriteSong(favoritesSong);
            }
        }

        @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.loadData(mFavorite.favoritesId);
    }
}
Also used : Favorite(com.xinshang.audient.model.entities.Favorite) AudientItemDecoration(com.xinshang.audient.widget.AudientItemDecoration) Audient(com.xinshang.audient.model.entities.Audient) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout)

Example 5 with AudientItemDecoration

use of com.xinshang.audient.widget.AudientItemDecoration in project Audient by komamj.

the class CommentFragment 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.loadComments(mAudient);
            }
        }
    });
    mSwipeRefreshLayout.setColorSchemeResources(R.color.colorAccent, R.color.colorPrimaryDark, R.color.colorPrimary);
    setLoadingIncator(true);
    mAdapter = new CommentAdapter(mContext);
    mAdapter.setListener(new CommentAdapter.EventListener() {

        @Override
        public void onThumbUpClick(Comment comment) {
            if (mPresenter != null) {
                mPresenter.thumbUpComment(comment);
            }
        }
    });
    mRecyclerView.setHasFixedSize(true);
    LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecyclerView.setLayoutManager(layoutManager);
    mRecyclerView.addItemDecoration(new AudientItemDecoration(mContext));
    mRecyclerView.setAdapter(mAdapter);
    // load data
    if (mPresenter != null) {
        mPresenter.loadComments(mAudient);
    }
}
Also used : Comment(com.xinshang.audient.model.entities.Comment) AudientItemDecoration(com.xinshang.audient.widget.AudientItemDecoration) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)9 AudientItemDecoration (com.xinshang.audient.widget.AudientItemDecoration)9 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)6 Audient (com.xinshang.audient.model.entities.Audient)5 Intent (android.content.Intent)4 MyFavoritesActivity (com.xinshang.audient.favorite.MyFavoritesActivity)4 AudientAdapter (com.xinshang.audient.base.AudientAdapter)3 Favorite (com.xinshang.audient.model.entities.Favorite)3 Comment (com.xinshang.audient.model.entities.Comment)1 Store (com.xinshang.audient.model.entities.Store)1