diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2014-05-12 19:15:37 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2014-05-12 19:15:37 +0200 |
commit | bb9683b86a29cece5bec4f7af357290ada70548b (patch) | |
tree | 676250d6385d5871d6c80a73f7880a0f85657811 /src/de/danoeh/antennapod/fragment | |
parent | 155774557cd170cd88941c3daee0f3949c4e26b8 (diff) | |
download | AntennaPod-bb9683b86a29cece5bec4f7af357290ada70548b.zip |
Moved "show info" into itemlist header
Diffstat (limited to 'src/de/danoeh/antennapod/fragment')
-rw-r--r-- | src/de/danoeh/antennapod/fragment/ItemlistFragment.java | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/de/danoeh/antennapod/fragment/ItemlistFragment.java b/src/de/danoeh/antennapod/fragment/ItemlistFragment.java index 4956b6884..47e82f9ef 100644 --- a/src/de/danoeh/antennapod/fragment/ItemlistFragment.java +++ b/src/de/danoeh/antennapod/fragment/ItemlistFragment.java @@ -3,6 +3,8 @@ package de.danoeh.antennapod.fragment; import android.annotation.SuppressLint; import android.content.Context; import android.content.DialogInterface; +import android.content.Intent; +import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; @@ -12,11 +14,13 @@ import android.support.v7.widget.SearchView; import android.text.util.Linkify; import android.util.Log; import android.view.*; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; +import de.danoeh.antennapod.activity.FeedInfoActivity; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.adapter.DefaultActionButtonCallback; import de.danoeh.antennapod.adapter.InternalFeedItemlistAdapter; @@ -191,7 +195,7 @@ public class ItemlistFragment extends ListFragment { @Override protected void onPostExecute(Void result) { super.onPostExecute(result); - ((MainActivity)getActivity()).loadNavFragment(MainActivity.POS_NEW, null); + ((MainActivity) getActivity()).loadNavFragment(MainActivity.POS_NEW, null); } }; ConfirmationDialog conDialog = new ConfirmationDialog(getActivity(), @@ -326,15 +330,37 @@ public class ItemlistFragment extends ListFragment { TextView txtvTitle = (TextView) header.findViewById(R.id.txtvTitle); TextView txtvAuthor = (TextView) header.findViewById(R.id.txtvAuthor); - TextView txtvLink = (TextView) header.findViewById(R.id.txtvLink); ImageView imgvCover = (ImageView) header.findViewById(R.id.imgvCover); + ImageButton butShowInfo = (ImageButton) header.findViewById(R.id.butShowInfo); + ImageButton butVisitWebsite = (ImageButton) header.findViewById(R.id.butVisitWebsite); txtvTitle.setText(feed.getTitle()); txtvAuthor.setText(feed.getAuthor()); - txtvLink.setText(feed.getLink()); - Linkify.addLinks(txtvLink, Linkify.WEB_URLS); ImageLoader.getInstance().loadThumbnailBitmap(feed.getImage(), imgvCover, (int) getResources().getDimension(R.dimen.thumbnail_length_onlinefeedview)); + if (feed.getLink() == null) { + butVisitWebsite.setVisibility(View.INVISIBLE); + } else { + butVisitWebsite.setVisibility(View.VISIBLE); + butVisitWebsite.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Uri uri = Uri.parse(feed.getLink()); + startActivity(new Intent(Intent.ACTION_VIEW, uri)); + } + }); + } + butShowInfo.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (viewsCreated && itemsLoaded) { + Intent startIntent = new Intent(getActivity(), FeedInfoActivity.class); + startIntent.putExtra(FeedInfoActivity.EXTRA_FEED_ID, + feed.getId()); + startActivity(startIntent); + } + } + }); } private InternalFeedItemlistAdapter.ItemAccess itemAccess = new InternalFeedItemlistAdapter.ItemAccess() { |