Search in sources :

Example 6 with Audient

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

the class MyFavoritesActivity method onPermissonGranted.

@Override
protected void onPermissonGranted() {
    mToolbar.setTitle(R.string.add_to_favorites);
    setSupportActionBar(mToolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
    Audient audient = getIntent().getParcelableExtra(Constants.KEY_AUDIENT);
    MyFavoritesFragment fragment = (MyFavoritesFragment) getSupportFragmentManager().findFragmentById(R.id.content_main);
    if (fragment == null) {
        fragment = MyFavoritesFragment.newInstance(audient);
        getSupportFragmentManager().beginTransaction().add(R.id.content_main, fragment).commit();
    }
    // inject presenter
    DaggerMyFavoritesPresenterComponent.builder().audientRepositoryComponent(((AudientApplication) getApplication()).getRepositoryComponent()).myFavoritesPresenterModule(new MyFavoritesPresenterModule(fragment)).build().inject(this);
}
Also used : Audient(com.xinshang.audient.model.entities.Audient) AudientApplication(com.xinshang.audient.AudientApplication)

Example 7 with Audient

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

the class FavoritesSongAdapter method buildAudient.

private static final Audient buildAudient(Favorite.FavoritesSong favoritesSong) {
    Audient audient = new Audient();
    audient.albumId = favoritesSong.albumId;
    audient.albumName = favoritesSong.albumName;
    audient.artistId = favoritesSong.artistId;
    audient.artistName = favoritesSong.artistName;
    audient.mediaId = favoritesSong.mediaId;
    audient.mediaName = favoritesSong.mediaName;
    audient.duration = favoritesSong.mediaInterval;
    return audient;
}
Also used : Audient(com.xinshang.audient.model.entities.Audient)

Example 8 with Audient

use of com.xinshang.audient.model.entities.Audient 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 9 with Audient

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

the class AuditionPresenter method loadAudient.

@Override
public void loadAudient(String id) {
    Disposable disposable = mRepository.getSongDetailResult(id).map(new Function<SongDetailResult, Audient>() {

        @Override
        public Audient apply(SongDetailResult songDetailResult) throws Exception {
            return songDetailResult.audient;
        }
    }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribeWith(new DisposableSubscriber<Audient>() {

        @Override
        public void onNext(Audient audient) {
            mView.showAudient(audient);
        }

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

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

Example 10 with Audient

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

the class AudientAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(AudientViewHolder holder, int position) {
    Audient audient = mData.get(position);
    mGlideRequest.load(audient).into(holder.mAlbum);
    holder.mName.setText(audient.mediaName);
    holder.mArtistName.setText(audient.artistName);
}
Also used : Audient(com.xinshang.audient.model.entities.Audient)

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