public void fillView(Resolver resolver) { TextView textView1 = (TextView) findViewById(R.id.textview1); textView1.setText(resolver.getPrettyName()); ImageView imageView1 = (ImageView) findViewById(R.id.imageview1); imageView1.clearColorFilter(); if (!(resolver instanceof ScriptResolver) || ((ScriptResolver) resolver).getScriptAccount().getMetaData().manifest.iconBackground != null) { resolver.loadIconBackground(imageView1, !resolver.isEnabled()); } else { if (resolver.isEnabled()) { imageView1.setBackgroundColor( TomahawkApp.getContext().getResources().getColor(android.R.color.black)); } else { imageView1.setBackgroundColor( TomahawkApp.getContext().getResources().getColor(R.color.fallback_resolver_bg)); } } ImageView imageView2 = (ImageView) findViewById(R.id.imageview2); if (!(resolver instanceof ScriptResolver) || ((ScriptResolver) resolver).getScriptAccount().getMetaData().manifest.iconWhite != null) { resolver.loadIconWhite(imageView2); } else { resolver.loadIcon(imageView2, !resolver.isEnabled()); } View connectImageViewContainer = findViewById(R.id.connect_imageview); if (resolver.isEnabled()) { connectImageViewContainer.setVisibility(View.VISIBLE); } else { connectImageViewContainer.setVisibility(View.GONE); } }
public void fillView( Query query, String numerationString, boolean showAsPlaying, View.OnClickListener swipeMenuButton1Listener, boolean showAsQueued) { TextView trackNameTextView = (TextView) findViewById(R.id.track_textview); trackNameTextView.setText(query.getPrettyName()); setTextViewEnabled(trackNameTextView, query.isPlayable(), false); ImageView resolverImageView = (ImageView) ensureInflation(R.id.resolver_imageview_stub, R.id.resolver_imageview); TextView numerationTextView = (TextView) findViewById(R.id.numeration_textview); if (showAsQueued) { if (numerationTextView != null) { numerationTextView.setVisibility(View.GONE); } if (resolverImageView != null) { resolverImageView.setVisibility(View.VISIBLE); TomahawkUtils.loadDrawableIntoImageView( TomahawkApp.getContext(), resolverImageView, R.drawable.ic_action_queue_red); } } else if (showAsPlaying) { if (numerationTextView != null) { numerationTextView.setVisibility(View.GONE); } if (resolverImageView != null) { resolverImageView.setVisibility(View.VISIBLE); if (query.getPreferredTrackResult() != null) { Resolver resolver = query.getPreferredTrackResult().getResolvedBy(); resolver.loadIcon(resolverImageView, false); } } } else if (numerationString != null) { if (resolverImageView != null) { resolverImageView.setVisibility(View.GONE); } if (numerationTextView != null) { numerationTextView.setVisibility(View.VISIBLE); numerationTextView.setText(numerationString); setTextViewEnabled(numerationTextView, query.isPlayable(), false); } } if (mLayoutId == R.layout.list_item_numeration_track_artist || mLayoutId == R.layout.list_item_track_artist) { TextView artistNameTextView = (TextView) findViewById(R.id.artist_textview); artistNameTextView.setText(query.getArtist().getPrettyName()); setTextViewEnabled(artistNameTextView, query.isPlayable(), false); } if (mLayoutId == R.layout.list_item_numeration_track_duration) { TextView durationTextView = (TextView) findViewById(R.id.duration_textview); if (query.getPreferredTrack().getDuration() > 0) { durationTextView.setText( TomahawkUtils.durationToString((query.getPreferredTrack().getDuration()))); } else { durationTextView.setText(PlaybackPanel.COMPLETION_STRING_DEFAULT); } setTextViewEnabled(durationTextView, query.isPlayable(), false); } ImageView swipeMenuButton; if (showAsQueued) { swipeMenuButton = (ImageView) ensureInflation(R.id.swipe_menu_button_dequeue_stub, R.id.swipe_menu_button_dequeue); swipeMenuButton.setVisibility(View.VISIBLE); swipeMenuButton.setImageResource(R.drawable.ic_player_exit_light); TomahawkUtils.setTint(swipeMenuButton.getDrawable(), R.color.tomahawk_red); ImageView swipeMenuButtonEnqueue = (ImageView) findViewById(R.id.swipe_menu_button_enqueue); if (swipeMenuButtonEnqueue != null) { swipeMenuButtonEnqueue.setVisibility(View.GONE); } } else { swipeMenuButton = (ImageView) ensureInflation(R.id.swipe_menu_button_enqueue_stub, R.id.swipe_menu_button_enqueue); swipeMenuButton.setVisibility(View.VISIBLE); ImageView swipeMenuButtonDequeue = (ImageView) findViewById(R.id.swipe_menu_button_dequeue); if (swipeMenuButtonDequeue != null) { swipeMenuButtonDequeue.setVisibility(View.GONE); } } swipeMenuButton.setOnClickListener(swipeMenuButton1Listener); }