List of usage examples for android.widget PopupMenu setOnDismissListener
public void setOnDismissListener(OnDismissListener listener)
From source file:org.alfresco.mobile.android.application.fragments.site.browser.SiteAdapter.java
@Override protected void updateTopText(TwoLinesViewHolder vh, Site item) { super.updateTopText(vh, item); if (mode == ListingModeFragment.MODE_IMPORT || mode == ListingModeFragment.MODE_PICK) { UIUtils.setBackground(vh.choose, null); return;/*from ww w . ja va 2 s. c o m*/ } vh.choose.setImageResource(R.drawable.ic_more_options); vh.choose.setBackgroundResource(R.drawable.alfrescohololight_list_selector_holo_light); int d_16 = DisplayUtils.getPixels(getContext(), R.dimen.d_16); vh.choose.setPadding(d_16, d_16, d_16, d_16); vh.choose.setVisibility(View.VISIBLE); AccessibilityUtils.addContentDescription(vh.choose, String.format(getContext().getString(R.string.more_options_site), item.getTitle())); vh.choose.setTag(R.id.site_action, item); vh.choose.setOnClickListener(new OnClickListener() { @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @Override public void onClick(View v) { Site item = (Site) v.getTag(R.id.site_action); selectedOptionItems.add(item); PopupMenu popup = new PopupMenu(getContext(), v); getMenu(popup.getMenu(), item); popup.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(PopupMenu menu) { selectedOptionItems.clear(); } }); popup.setOnMenuItemClickListener(SiteAdapter.this); popup.show(); } }); }
From source file:org.alfresco.mobile.android.application.fragments.fileexplorer.LibraryCursorAdapter.java
@Override protected void updateIcon(TwoLinesViewHolder vh, Cursor cursor) { String data = cursor.getString(cursor.getColumnIndex(MediaStore.Files.FileColumns.DATA)); File f = new File(data); switch (mediaTypeId) { case MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE: vh.icon.setImageResource(R.drawable.mime_img); renditionManager.getPicasso().load(f).resize(150, 150).centerCrop().placeholder(R.drawable.mime_256_img) .error(R.drawable.mime_256_img).into(vh.icon); break;//from www.ja v a 2 s . c o m case MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO: vh.icon.setImageResource(R.drawable.mime_video); break; case MediaStore.Files.FileColumns.MEDIA_TYPE_AUDIO: vh.icon.setImageResource(R.drawable.mime_audio); break; default: Uri uri = Uri.parse(cursor.getString(cursor.getColumnIndex(MediaStore.Files.FileColumns.DATA))); vh.icon.setImageResource(MimeTypeManager.getInstance(context).getIcon(uri.getLastPathSegment())); break; } if (mode == FileExplorerFragment.MODE_LISTING && fragmentRef.get().getActivity() instanceof MainActivity) { vh.choose.setImageResource(R.drawable.ic_more_options); vh.choose.setBackgroundResource(R.drawable.alfrescohololight_list_selector_holo_light); int d_16 = DisplayUtils.getPixels(context, R.dimen.d_16); vh.choose.setPadding(d_16, d_16, d_16, d_16); vh.choose.setVisibility(View.VISIBLE); vh.choose.setTag(R.id.node_action, f); vh.choose.setOnClickListener(new OnClickListener() { @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @Override public void onClick(View v) { File item = (File) v.getTag(R.id.node_action); selectedOptionItems.add(item); PopupMenu popup = new PopupMenu(context, v); getMenu(popup.getMenu(), item); popup.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(PopupMenu menu) { selectedOptionItems.clear(); } }); popup.setOnMenuItemClickListener(LibraryCursorAdapter.this); popup.show(); } }); } else { UIUtils.setBackground(vh.choose, null); vh.choose.setVisibility(View.GONE); } }
From source file:org.alfresco.mobile.android.application.fragments.fileexplorer.FileExplorerAdapter.java
@Override protected void updateIcon(TwoLinesProgressViewHolder vh, File item) { if (item.isFile()) { Drawable drawable = getContext().getResources() .getDrawable(MimeTypeManager.getInstance(getContext()).getIcon(item.getName())); renditionManager.getPicasso().load(item).placeholder(drawable).error(drawable).into(vh.icon); AccessibilityUtils.addContentDescription(vh.icon, R.string.mime_document); } else if (item.isDirectory()) { vh.icon.setImageDrawable(getContext().getResources().getDrawable(R.drawable.mime_folder)); AccessibilityUtils.addContentDescription(vh.icon, R.string.mime_folder); }/* w w w. j ava 2s. c om*/ if (mode == FileExplorerFragment.MODE_LISTING && fragmentRef.get().getActivity() instanceof MainActivity && ((downloadPath != null && item.getPath().startsWith(downloadPath)) || (item.isFile()))) { vh.choose.setImageResource(R.drawable.ic_more_options); vh.choose.setBackgroundResource(R.drawable.alfrescohololight_list_selector_holo_light); int d_16 = DisplayUtils.getPixels(getContext(), R.dimen.d_16); vh.choose.setPadding(d_16, d_16, d_16, d_16); vh.choose.setVisibility(View.VISIBLE); AccessibilityUtils.addContentDescription(vh.choose, String.format(getContext().getString(R.string.more_options_file), item.getName())); vh.choose.setTag(R.id.node_action, item); vh.choose.setOnClickListener(new OnClickListener() { @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @Override public void onClick(View v) { File item = (File) v.getTag(R.id.node_action); selectedOptionItems.add(item); PopupMenu popup = new PopupMenu(getContext(), v); getMenu(popup.getMenu(), item); popup.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(PopupMenu menu) { selectedOptionItems.clear(); } }); popup.setOnMenuItemClickListener(FileExplorerAdapter.this); popup.show(); } }); } else { UIUtils.setBackground(vh.choose, null); vh.choose.setVisibility(View.GONE); } }
From source file:org.alfresco.mobile.android.application.fragments.sync.SyncCursorAdapter.java
protected void updateBottomText(TwoLinesProgressViewHolder vh, final Cursor cursor) { int status = cursor.getInt(SyncContentSchema.COLUMN_STATUS_ID); String nodeId = cursor.getString(SyncContentSchema.COLUMN_NODE_ID_ID); long favoriteId = cursor.getLong(SyncContentSchema.COLUMN_ID_ID); boolean syncRoot = cursor.getInt(SyncContentSchema.COLUMN_IS_SYNC_ROOT_ID) > 0; if (syncRoot) { vh.favoriteIcon.setVisibility(View.VISIBLE); vh.favoriteIcon.setImageResource(R.drawable.ic_sync_light); } else {/*ww w. ja v a 2s . c o m*/ vh.favoriteIcon.setVisibility(View.GONE); } vh.progress.setVisibility(View.GONE); switch (status) { case SyncContentStatus.STATUS_PENDING: displayStatut(vh, R.drawable.sync_status_pending); break; case SyncContentStatus.STATUS_RUNNING: displayStatut(vh, R.drawable.sync_status_loading); vh.progress.setVisibility(View.VISIBLE); vh.favoriteIcon.setVisibility(View.GONE); long totalSize = cursor.getLong(SyncContentSchema.COLUMN_TOTAL_SIZE_BYTES_ID); if (totalSize == -1) { vh.progress.setIndeterminate(true); } else { long progress = cursor.getLong(SyncContentSchema.COLUMN_BYTES_DOWNLOADED_SO_FAR_ID); float value = (((float) progress / ((float) totalSize)) * 100); int percentage = Math.round(value); vh.progress.setIndeterminate(false); vh.progress.setMax(100); vh.progress.setProgress(percentage); } break; case SyncContentStatus.STATUS_HIDDEN: vh.favoriteIcon.setVisibility(View.GONE); vh.iconRight.setVisibility(View.GONE); break; case SyncContentStatus.STATUS_PAUSED: displayStatut(vh, R.drawable.sync_status_pending); break; case SyncContentStatus.STATUS_MODIFIED: displayStatut(vh, R.drawable.sync_status_pending); break; case SyncContentStatus.STATUS_SUCCESSFUL: displayStatut(vh, R.drawable.sync_status_success); break; case SyncContentStatus.STATUS_FAILED: displayStatut(vh, R.drawable.sync_status_failed); break; case SyncContentStatus.STATUS_CANCEL: displayStatut(vh, R.drawable.sync_status_failed); break; case SyncContentStatus.STATUS_REQUEST_USER: displayStatut(vh, R.drawable.sync_status_failed); break; default: break; } if (selectedItems != null && selectedItems.contains(nodeId)) { UIUtils.setBackground(((View) vh.icon.getParent()), context.getResources().getDrawable(R.drawable.list_longpressed_holo)); } else { UIUtils.setBackground(((View) vh.icon.getParent()), null); } if (SyncContentStatus.STATUS_RUNNING != status) { vh.bottomText.setVisibility(View.VISIBLE); vh.bottomText.setText(createContentBottomText(context, cursor)); AccessibilityUtils.addContentDescription(vh.bottomText, createContentDescriptionBottomText(context, cursor)); } else { vh.bottomText.setVisibility(View.GONE); } if (mode == SyncFragment.MODE_LISTING && fragmentRef.get().getActivity() instanceof MainActivity) { if (status != SyncContentStatus.STATUS_REQUEST_USER) { UIUtils.setBackground(vh.choose, null); return; } vh.choose.setImageResource(R.drawable.ic_more_options); vh.choose.setBackgroundResource(R.drawable.alfrescohololight_list_selector_holo_light); int d_16 = DisplayUtils.getPixels(context, R.dimen.d_16); vh.choose.setPadding(d_16, d_16, d_16, d_16); vh.choose.setVisibility(View.VISIBLE); vh.choose.setTag(R.id.node_action, nodeId); vh.choose.setTag(R.id.favorite_id, favoriteId); vh.choose.setTag(R.id.operation_status, status); vh.choose.setTag(R.id.is_synced, syncRoot); AccessibilityUtils.addContentDescription(vh.choose, String.format(context.getString(R.string.more_options_favorite), cursor.getString(SyncContentSchema.COLUMN_TITLE_ID))); vh.choose.setOnClickListener(new OnClickListener() { @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @Override public void onClick(View v) { String item = (String) v.getTag(R.id.node_action); Integer statut = (Integer) v.getTag(R.id.operation_status); long favoriteId = (Long) v.getTag(R.id.favorite_id); boolean rootSynced = (Boolean) v.getTag(R.id.is_synced); selectedOptionItems.add(item); selectedOptionItemId.add(favoriteId); PopupMenu popup = new PopupMenu(context, v); getMenu(popup.getMenu(), statut, rootSynced); popup.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(PopupMenu menu) { selectedOptionItems.clear(); } }); popup.setOnMenuItemClickListener(SyncCursorAdapter.this); popup.show(); } }); } else { UIUtils.setBackground(vh.choose, null); } }
From source file:org.alfresco.mobile.android.application.fragments.node.browser.ProgressNodeAdapter.java
@Override protected void updateIcon(TwoLinesProgressViewHolder vh, Node item) { if (item instanceof NodePlaceHolder) { UIUtils.setBackground(vh.icon, null); vh.icon.setImageResource(MimeTypeManager.getInstance(getActivity()).getIcon(item.getName())); vh.choose.setVisibility(View.GONE); return;/*from w w w . j a va 2s . c o m*/ } else { super.updateIcon(vh, item); } if ((selectedItems != null && selectedItems.contains(item)) || (selectedMapItems != null && selectedMapItems.containsKey(item.getIdentifier()))) { if (getFragment() != null && getFragment() instanceof DocumentFolderBrowserFragment && ((DocumentFolderBrowserFragment) getFragment()).hasActionMode()) { vh.choose.setVisibility(View.VISIBLE); vh.choose.setImageResource(R.drawable.ic_done_single_white); int d_16 = DisplayUtils.getPixels(getContext(), R.dimen.d_16); vh.choose.setPadding(d_16, d_16, d_16, d_16); UIUtils.setBackground(vh.choose, null); vh.choose.setOnClickListener(null); } } else if (item.isFolder()) { vh.icon.setImageDrawable(getActivity().getResources().getDrawable(R.drawable.mime_256_folder)); if (mode == ListingModeFragment.MODE_IMPORT) { return; } if (mode == ListingModeFragment.MODE_PICK) { return; } vh.choose.setImageResource(R.drawable.ic_more_options); vh.choose.setBackgroundResource(R.drawable.alfrescohololight_list_selector_holo_light); int d_16 = DisplayUtils.getPixels(getContext(), R.dimen.d_16); vh.choose.setPadding(d_16, d_16, d_16, d_16); vh.choose.setVisibility(View.VISIBLE); AccessibilityUtils.addContentDescription(vh.choose, String.format(getActivity().getString(R.string.more_options_folder), item.getName())); vh.choose.setTag(R.id.node_action, item); vh.choose.setOnClickListener(new OnClickListener() { @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @Override public void onClick(View v) { Node item = (Node) v.getTag(R.id.node_action); if (item == null) { return; } selectedOptionItems.add(item); PopupMenu popup = new PopupMenu(getActivity(), v); getMenu(popup.getMenu(), item); popup.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(PopupMenu menu) { selectedOptionItems.clear(); } }); popup.setOnMenuItemClickListener(ProgressNodeAdapter.this); popup.show(); } }); } else { UIUtils.setBackground(vh.choose, null); vh.choose.setPadding(0, 0, 0, 0); vh.choose.setVisibility(View.GONE); } }
From source file:com.custom.music.MusicBrowserActivity.java
/** * M: Create fake menu./*from w w w .java2 s .c om*/ */ private void createFakeMenu() { if (mHasMenukey) { Log.w(TAG, "<createFakeMenu> Quit when there has Menu Key", Log.APP); return; } if (mOrientaiton == Configuration.ORIENTATION_LANDSCAPE) { mOverflowMenuButtonId = R.id.overflow_menu; mOverflowMenuButton = findViewById(R.id.overflow_menu); } else { mOverflowMenuButtonId = R.id.overflow_menu_nowplaying; mOverflowMenuButton = findViewById(R.id.overflow_menu_nowplaying); View parent = (View) mOverflowMenuButton.getParent(); if (parent != null) { parent.setVisibility(View.VISIBLE); } } mOverflowMenuButton.setVisibility(View.VISIBLE); mOverflowMenuButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Log.i(TAG, "<createFakeMenu> onClick()", Log.APP); if (v.getId() == mOverflowMenuButtonId) { final PopupMenu popupMenu = new PopupMenu(MusicBrowserActivity.this, mOverflowMenuButton); mPopupMenu = popupMenu; final Menu menu = popupMenu.getMenu(); onCreateOptionsMenu(menu); popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { return onOptionsItemSelected(item); } }); popupMenu.setOnDismissListener(new OnDismissListener() { public void onDismiss(PopupMenu menu) { mPopupMenuShowing = false; Log.i(TAG, "<createFakeMenu> onDismiss() called", Log.APP); return; } }); onPrepareOptionsMenu(menu); mPopupMenuShowing = true; if (popupMenu != null) { Log.i(TAG, "<createFakeMenu> popupMenu.show()", Log.APP); popupMenu.show(); } } } }); }
From source file:com.android.gallery3d.filtershow.FilterShowActivity.java
public void onShowMenu(PopupMenu menu) { mCurrentMenu = menu; menu.setOnDismissListener(this); }
From source file:com.android.music.MusicBrowserActivity.java
/** * M: Create fake menu.// ww w . jav a 2 s . c o m */ private void createFakeMenu() { if (mPermissionReqProcessed == true) { if (mHasMenukey) { MusicLogUtils.d(TAG, "createFakeMenu Quit when there has Menu Key"); return; } if (mOrientaiton == Configuration.ORIENTATION_LANDSCAPE) { mOverflowMenuButtonId = R.id.overflow_menu; mOverflowMenuButton = findViewById(R.id.overflow_menu); } else { mOverflowMenuButtonId = R.id.overflow_menu_nowplaying; mOverflowMenuButton = findViewById(R.id.overflow_menu_nowplaying); View parent = (View) mOverflowMenuButton.getParent(); if (parent != null) { parent.setVisibility(View.VISIBLE); } } mOverflowMenuButton.setVisibility(View.VISIBLE); mOverflowMenuButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { MusicLogUtils.d(TAG, "createFakeMenu:onClick()"); if (v.getId() == mOverflowMenuButtonId) { final PopupMenu popupMenu = new PopupMenu(MusicBrowserActivity.this, mOverflowMenuButton); mPopupMenu = popupMenu; final Menu menu = popupMenu.getMenu(); onCreateOptionsMenu(menu); popupMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { return onOptionsItemSelected(item); } }); popupMenu.setOnDismissListener(new OnDismissListener() { public void onDismiss(PopupMenu menu) { mPopupMenuShowing = false; MusicLogUtils.d(TAG, "createFakeMenu:onDismiss() called"); return; } }); onPrepareOptionsMenu(menu); mPopupMenuShowing = true; if (popupMenu != null) { MusicLogUtils.d(TAG, "createFakeMenu:popupMenu.show()"); popupMenu.show(); } } } }); } }
From source file:tk.eatheat.omnisnitch.ui.SwitchLayout.java
private void handleLongPress(final TaskDescription ad, View view) { final PopupMenu popup = new PopupMenu(mContext, view); mPopup = popup;/*from w w w. ja va 2 s .c o m*/ popup.getMenuInflater().inflate(R.menu.recent_popup_menu, popup.getMenu()); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { if (item.getItemId() == R.id.recent_remove_item) { mRecentsManager.killTask(ad); } else if (item.getItemId() == R.id.recent_inspect_item) { startApplicationDetailsActivity(ad.getPackageName()); } else { return false; } return true; } }); popup.setOnDismissListener(new PopupMenu.OnDismissListener() { public void onDismiss(PopupMenu menu) { mPopup = null; } }); popup.show(); }
From source file:fr.shywim.antoinedaniel.ui.fragment.VideoDetailsFragment.java
private void bindSound(View view, Cursor cursor) { AppState appState = AppState.getInstance(); final View card = view; final View downloadFrame = view.findViewById(R.id.sound_download_frame); final TextView tv = (TextView) view.findViewById(R.id.grid_text); final SquareImageView siv = (SquareImageView) view.findViewById(R.id.grid_image); final ImageView star = (ImageView) view.findViewById(R.id.ic_sound_fav); final ImageView menu = (ImageView) view.findViewById(R.id.ic_sound_menu); final String soundName = cursor .getString(cursor.getColumnIndex(ProviderContract.SoundEntry.COLUMN_SOUND_NAME)); String imgId = cursor.getString(cursor.getColumnIndex(ProviderContract.SoundEntry.COLUMN_IMAGE_NAME)); final String description = cursor.getString(cursor.getColumnIndex(ProviderContract.SoundEntry.COLUMN_DESC)); final boolean favorite = appState.favSounds.contains(soundName) || cursor.getInt(cursor.getColumnIndex(ProviderContract.SoundEntry.COLUMN_FAVORITE)) == 1; final boolean widget = appState.widgetSounds.contains(soundName) || cursor.getInt(cursor.getColumnIndex(ProviderContract.SoundEntry.COLUMN_WIDGET)) == 1; final boolean downloaded = cursor .getInt(cursor.getColumnIndex(ProviderContract.SoundEntry.COLUMN_DOWNLOADED)) != 0; new Handler().post(new Runnable() { @Override/*from w w w . j a v a 2s.c o m*/ public void run() { ContentValues cv = new ContentValues(); File sndFile = new File(mContext.getExternalFilesDir(null) + "/snd/" + soundName + ".ogg"); if (downloaded && !sndFile.exists()) { cv.put(ProviderContract.SoundEntry.COLUMN_DOWNLOADED, 0); mContext.getContentResolver().update( Uri.withAppendedPath(ProviderConstants.SOUND_DOWNLOAD_NOTIFY_URI, soundName), cv, null, null); } } }); final View.OnClickListener playSound = new View.OnClickListener() { @Override public void onClick(View v) { String category = mContext.getString(R.string.ana_cat_sound); String action = mContext.getString(R.string.ana_act_play); Bundle extras = new Bundle(); extras.putString(SoundFragment.SOUND_TO_PLAY, soundName); extras.putBoolean(SoundFragment.LOOP, SoundUtils.isLoopingSet()); Intent intent = new Intent(mContext, SoundService.class); intent.putExtras(extras); mContext.startService(intent); AnalyticsUtils.sendEvent(category, action, soundName); } }; final View.OnClickListener downloadSound = new View.OnClickListener() { @Override public void onClick(View v) { card.setOnClickListener(null); RotateAnimation animation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setInterpolator(new BounceInterpolator()); animation.setFillAfter(true); animation.setFillEnabled(true); animation.setDuration(1000); animation.setRepeatCount(Animation.INFINITE); animation.setRepeatMode(Animation.RESTART); downloadFrame.findViewById(R.id.sound_download_icon).startAnimation(animation); DownloadService.startActionDownloadSound(mContext, soundName, new SoundUtils.DownloadResultReceiver(new Handler(), downloadFrame, playSound, this)); } }; if (downloaded) { downloadFrame.setVisibility(View.GONE); downloadFrame.findViewById(R.id.sound_download_icon).clearAnimation(); card.setOnClickListener(playSound); } else { downloadFrame.setAlpha(1); downloadFrame.findViewById(R.id.sound_download_icon).setScaleX(1); downloadFrame.findViewById(R.id.sound_download_icon).setScaleY(1); downloadFrame.setVisibility(View.VISIBLE); card.setOnClickListener(downloadSound); } menu.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final ImageView menuIc = (ImageView) v; PopupMenu popup = new PopupMenu(mContext, menuIc); Menu menu = popup.getMenu(); popup.getMenuInflater().inflate(R.menu.sound_menu, menu); if (favorite) menu.findItem(R.id.action_sound_fav).setTitle("Retirer des favoris"); if (widget) menu.findItem(R.id.action_sound_wid).setTitle("Retirer du widget"); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case R.id.action_sound_fav: SoundUtils.addRemoveFavorite(mContext, soundName); return true; case R.id.action_sound_wid: SoundUtils.addRemoveWidget(mContext, soundName); return true; /*case R.id.action_sound_add: return true;*/ case R.id.action_sound_ring: SoundUtils.addRingtone(mContext, soundName, description); return true; case R.id.action_sound_share: AnalyticsUtils.sendEvent(mContext.getString(R.string.ana_cat_soundcontext), mContext.getString(R.string.ana_act_weblink), soundName); ClipboardManager clipboard = (ClipboardManager) mContext .getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("BAD link", "http://bad.shywim.fr/" + soundName); clipboard.setPrimaryClip(clip); Toast.makeText(mContext, R.string.toast_link_copied, Toast.LENGTH_LONG).show(); return true; case R.id.action_sound_delete: SoundUtils.delete(mContext, soundName); return true; default: return false; } } }); popup.setOnDismissListener(new PopupMenu.OnDismissListener() { @Override public void onDismiss(PopupMenu menu) { menuIc.setColorFilter(mContext.getResources().getColor(R.color.text_caption_dark)); } }); menuIc.setColorFilter(mContext.getResources().getColor(R.color.black)); popup.show(); } }); tv.setText(description); siv.setTag(imgId); if (appState.favSounds.contains(soundName)) { star.setVisibility(View.VISIBLE); } else if (favorite) { star.setVisibility(View.VISIBLE); appState.favSounds.add(soundName); } else { star.setVisibility(View.INVISIBLE); } File file = new File(mContext.getExternalFilesDir(null) + "/img/" + imgId + ".jpg"); Picasso.with(mContext).load(file).placeholder(R.drawable.noimg).fit().into(siv); }