public void onTrackChanged(ICurrentlyPlaying newSong) { final SongAdapter adapter = mSongAdapter; if (adapter != null) { final int currentPos = mCurrentPosition; final int newPos = newSong.getPlaylistPosition(); // clear previous song's icon OneLabelItemView view = adapter.getViewAtPosition(currentPos); if (currentPos >= 0 && view != null) { view.setCover( BitmapFactory.decodeResource(mActivity.getResources(), R.drawable.icon_song_light)); Log.i(TAG, "Resetting previous icon at position " + currentPos + " (" + view.title + ")"); } else { Log.i(TAG, "NOT resetting previous icon at position " + currentPos); } // set new song's play icon view = adapter.getViewAtPosition(newPos); mCurrentPosition = newPos; if (view != null) { view.setCover(BitmapFactory.decodeResource(mActivity.getResources(), R.drawable.icon_play)); } else { mList.setSelection(newPos); } } }
public View getView(int position, View convertView, ViewGroup parent) { final OneLabelItemView view; if (convertView == null) { view = new OneLabelItemView( mActivity, mVideoManager, parent.getWidth(), mFallbackBitmap, mList.getSelector(), true); } else { view = (OneLabelItemView) convertView; } final Actor actor = this.getItem(position); view.reset(); view.position = position; view.title = actor.name; if (mLoadCovers) { if (mVideoManager.coverLoaded(actor, mThumbSize)) { view.setCover(mVideoManager.getCoverSync(actor, mThumbSize)); } else { view.setCover(null); view.getResponse().load(actor, !mPostScrollLoader.isListIdle()); } } return view; }
public View getView(int position, View convertView, ViewGroup parent) { final OneLabelItemView view; if (convertView == null) { view = new OneLabelItemView( mActivity, parent.getWidth(), mFallbackBitmap, mList.getSelector(), true); } else { view = (OneLabelItemView) convertView; mItemPositions.remove(view.position); } final PlaylistItem item = this.getItem(position); view.reset(); view.position = position; view.title = item.filename; if (position == mCurrentPosition) { view.setCover(sPlayingBitmap); } else { view.setCover(mFallbackBitmap); } mItemPositions.put(view.position, view); return view; }