use of de.danoeh.antennapod.activity.MainActivity in project AntennaPod by AntennaPod.
the class FeedItemlistFragment method setupHeaderView.
private void setupHeaderView() {
if (feed == null || headerCreated) {
return;
}
// https://github.com/bumptech/glide/issues/529
imgvBackground.setColorFilter(new LightingColorFilter(0xff666666, 0x000000));
butShowInfo.setVisibility(View.VISIBLE);
butShowInfo.setOnClickListener(v -> showFeedInfo());
imgvCover.setOnClickListener(v -> showFeedInfo());
butShowSettings.setVisibility(View.VISIBLE);
butShowSettings.setOnClickListener(v -> {
if (feed != null) {
FeedSettingsFragment fragment = FeedSettingsFragment.newInstance(feed);
((MainActivity) getActivity()).loadChildFragment(fragment, TransitionEffect.SLIDE);
}
});
txtvFailure.setOnClickListener(v -> {
Intent intent = new Intent(getContext(), MainActivity.class);
intent.putExtra(MainActivity.EXTRA_FRAGMENT_TAG, DownloadsFragment.TAG);
Bundle args = new Bundle();
args.putInt(DownloadsFragment.ARG_SELECTED_TAB, DownloadsFragment.POS_LOG);
intent.putExtra(MainActivity.EXTRA_FRAGMENT_ARGS, args);
startActivity(intent);
});
headerCreated = true;
}
use of de.danoeh.antennapod.activity.MainActivity in project AntennaPod by AntennaPod.
the class FeedItemlistFragment method onMenuItemClick.
@Override
public boolean onMenuItemClick(MenuItem item) {
if (feed == null) {
((MainActivity) getActivity()).showSnackbarAbovePlayer(R.string.please_wait_for_data, Toast.LENGTH_LONG);
return true;
}
boolean feedMenuHandled = FeedMenuHandler.onOptionsItemClicked(getActivity(), item, feed);
if (feedMenuHandled) {
return true;
}
final int itemId = item.getItemId();
if (itemId == R.id.rename_item) {
new RenameItemDialog(getActivity(), feed).show();
return true;
} else if (itemId == R.id.remove_feed) {
((MainActivity) getActivity()).loadFragment(EpisodesFragment.TAG, null);
RemoveFeedDialog.show(getContext(), feed);
return true;
} else if (itemId == R.id.action_search) {
((MainActivity) getActivity()).loadChildFragment(SearchFragment.newInstance(feed.getId(), feed.getTitle()));
return true;
}
return false;
}
use of de.danoeh.antennapod.activity.MainActivity in project AntennaPod by AntennaPod.
the class ItunesAdapter method getView.
@NonNull
@Override
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
// Current podcast
PodcastSearchResult podcast = data.get(position);
// ViewHolder
PodcastViewHolder viewHolder;
// Resulting view
View view;
// Handle view holder stuff
if (convertView == null) {
view = ((MainActivity) context).getLayoutInflater().inflate(R.layout.itunes_podcast_listitem, parent, false);
viewHolder = new PodcastViewHolder(view);
view.setTag(viewHolder);
} else {
view = convertView;
viewHolder = (PodcastViewHolder) view.getTag();
}
// Set the title
viewHolder.titleView.setText(podcast.title);
if (podcast.author != null && !podcast.author.trim().isEmpty()) {
viewHolder.authorView.setText(podcast.author);
viewHolder.authorView.setVisibility(View.VISIBLE);
} else if (podcast.feedUrl != null && !podcast.feedUrl.contains("itunes.apple.com")) {
viewHolder.authorView.setText(podcast.feedUrl);
viewHolder.authorView.setVisibility(View.VISIBLE);
} else {
viewHolder.authorView.setVisibility(View.GONE);
}
// Update the empty imageView with the image from the feed
Glide.with(context).load(podcast.imageUrl).apply(new RequestOptions().placeholder(R.color.light_gray).diskCacheStrategy(DiskCacheStrategy.NONE).transforms(new FitCenter(), new RoundedCorners((int) (4 * context.getResources().getDisplayMetrics().density))).dontAnimate()).into(viewHolder.coverView);
// Feed the grid view
return view;
}
use of de.danoeh.antennapod.activity.MainActivity in project AntennaPod by AntennaPod.
the class CoverTarget method onLoadFailed.
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
String fallbackUri = fallback.get();
TextView txtvPlaceholder = placeholder.get();
ImageView imgvCover = cover.get();
if (fallbackUri != null && txtvPlaceholder != null && imgvCover != null) {
MainActivity activity = mainActivity.get();
Glide.with(activity).load(fallbackUri).diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY).fitCenter().dontAnimate().into(new CoverTarget(null, txtvPlaceholder, imgvCover, activity));
}
}
use of de.danoeh.antennapod.activity.MainActivity in project AntennaPod by AntennaPod.
the class SearchFragment method onListItemClick.
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
SearchResult result = (SearchResult) l.getAdapter().getItem(position);
FeedComponent comp = result.getComponent();
if (comp.getClass() == Feed.class) {
((MainActivity) getActivity()).loadFeedFragmentById(comp.getId(), null);
} else {
if (comp.getClass() == FeedItem.class) {
FeedItem item = (FeedItem) comp;
((MainActivity) getActivity()).loadChildFragment(ItemFragment.newInstance(item.getId()));
}
}
}
Aggregations