Search in sources :

Example 6 with Favorite

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

the class MineFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    LogUtils.i(TAG, "onViewCreated");
    mDynamicAdapter = new AudientAdapter(mContext);
    mDynamicAdapter.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);
        }
    });
    mFavoriteAdapter = new FavoriteAdapter(mContext);
    mFavoriteAdapter.setListener(new FavoriteAdapter.EventListner() {

        @Override
        public void onModifyEventChange(Favorite favorite) {
            EditNameDialogFragment.show(getChildFragmentManager(), favorite);
        }

        @Override
        public void onDeleteEventChange(Favorite favorite) {
            if (mPresenter != null) {
                mPresenter.deleteMyFavorite(favorite);
            }
        }
    });
    LinearLayoutManager layoutManagerFavorite = new LinearLayoutManager(mContext);
    layoutManagerFavorite.setOrientation(LinearLayoutManager.HORIZONTAL);
    mRecyclerViewFavorite.setLayoutManager(layoutManagerFavorite);
    mRecyclerViewFavorite.setAdapter(mFavoriteAdapter);
    LinearLayoutManager layoutManagerUser = new LinearLayoutManager(mContext);
    layoutManagerUser.setOrientation(LinearLayoutManager.VERTICAL);
    mRecyclerViewUser.setLayoutManager(layoutManagerUser);
    mRecyclerViewUser.addItemDecoration(new AudientItemDecoration(mContext));
    mRecyclerViewUser.setAdapter(mDynamicAdapter);
    mIsPrepared = true;
}
Also used : Favorite(com.xinshang.audient.model.entities.Favorite) 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)

Example 7 with Favorite

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

the class FavoriteDetailActivity method onPermissonGranted.

@Override
protected void onPermissonGranted() {
    Favorite favorite = getIntent().getParcelableExtra(Constants.KEY_FAVORITE);
    mToolbar.setTitle(favorite.favoriteName);
    setSupportActionBar(mToolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_back);
    }
    GlideApp.with(this).asBitmap().transition(new BitmapTransitionOptions()).placeholder(R.drawable.ic_album).load(favorite.coverImageUrl).into(mAlbum);
    mFab.setImageResource(R.drawable.ic_unfavorite);
    FavoriteDetailFragment fragment = (FavoriteDetailFragment) getSupportFragmentManager().findFragmentById(R.id.content_main);
    if (fragment == null) {
        fragment = FavoriteDetailFragment.newInstance(favorite);
        getSupportFragmentManager().beginTransaction().add(R.id.content_main, fragment).commit();
    }
    DaggerFavoriteDetailComponent.builder().audientRepositoryComponent(((AudientApplication) getApplication()).getRepositoryComponent()).favoriteDetailPresenterModule(new FavoriteDetailPresenterModule(fragment)).build().inject(this);
}
Also used : Favorite(com.xinshang.audient.model.entities.Favorite) BitmapTransitionOptions(com.bumptech.glide.load.resource.bitmap.BitmapTransitionOptions) AudientApplication(com.xinshang.audient.AudientApplication)

Aggregations

Favorite (com.xinshang.audient.model.entities.Favorite)7 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 FavoritesResult (com.xinshang.audient.model.entities.FavoritesResult)2 AudientItemDecoration (com.xinshang.audient.widget.AudientItemDecoration)2 CompositeDisposable (io.reactivex.disposables.CompositeDisposable)2 Disposable (io.reactivex.disposables.Disposable)2 List (java.util.List)2 Intent (android.content.Intent)1 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)1 BitmapTransitionOptions (com.bumptech.glide.load.resource.bitmap.BitmapTransitionOptions)1 AudientApplication (com.xinshang.audient.AudientApplication)1 AudientAdapter (com.xinshang.audient.base.AudientAdapter)1 MyFavoritesActivity (com.xinshang.audient.favorite.MyFavoritesActivity)1 Audient (com.xinshang.audient.model.entities.Audient)1 Consumer (io.reactivex.functions.Consumer)1 Function (io.reactivex.functions.Function)1