private void setContextMenuItems(Menu menu, MediaWrapper mediaWrapper) { long lastTime = mediaWrapper.getTime(); if (lastTime > 0) menu.findItem(R.id.video_list_play_from_start).setVisible(true); boolean hasInfo = false; final Media media = new Media(VLCInstance.get(), mediaWrapper.getUri()); media.parse(); media.release(); if (media.getMeta(Media.Meta.Title) != null) hasInfo = true; menu.findItem(R.id.video_list_info).setVisible(hasInfo); menu.findItem(R.id.video_list_delete) .setVisible( !AndroidUtil.isLolliPopOrLater() || mediaWrapper .getLocation() .startsWith("file://" + AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY)); }
private static String getMetaId(Media media, int id, boolean trim) { String meta = media.getMeta(id); return meta != null ? trim ? meta.trim() : meta : null; }