Moved "show info" into itemlist header

This commit is contained in:
daniel oeh 2014-05-12 19:15:37 +02:00
parent 155774557c
commit bb9683b86a
4 changed files with 53 additions and 28 deletions

View File

@ -15,6 +15,27 @@
android:layout_alignParentTop="true"
android:layout_margin="4dp"/>
<ImageButton
android:layout_width="48dp"
android:layout_height="48dp"
android:id="@+id/butShowInfo"
android:contentDescription="@string/show_info_label"
android:src="?attr/action_about"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:background="?attr/borderless_button"/>
<ImageButton
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginRight="8dp"
android:id="@+id/butVisitWebsite"
android:contentDescription="@string/visit_website_label"
android:src="?attr/location_web_site"
android:layout_toLeftOf="@id/butShowInfo"
android:layout_alignParentBottom="true"
android:background="?attr/borderless_button"/>
<TextView
android:id="@+id/txtvTitle"
android:layout_width="0dp"
@ -30,24 +51,15 @@
<TextView
android:id="@+id/txtvAuthor"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:layout_below="@id/txtvTitle"
android:layout_toRightOf="@id/imgvCover"
android:layout_toLeftOf="@id/butShowInfo"
android:lines="1"
android:ellipsize="end"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_small"/>
<TextView
android:id="@+id/txtvLink"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:ellipsize="end"
android:layout_below="@id/txtvAuthor"
android:layout_toRightOf="@id/imgvCover"
android:textSize="@dimen/text_size_small"/>
</RelativeLayout>

View File

@ -15,13 +15,6 @@
custom:showAsAction="collapseActionView"
android:title="@string/mark_all_read_label">
</item>
<item
android:id="@+id/show_info_item"
android:menuCategory="container"
android:icon="?attr/action_about"
custom:showAsAction="collapseActionView"
android:title="@string/show_info_label">
</item>
<item
android:id="@+id/support_item"
android:menuCategory="container"

View File

@ -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() {

View File

@ -60,12 +60,6 @@ public class FeedMenuHandler {
public static boolean onOptionsItemClicked(Context context, MenuItem item,
Feed selectedFeed) throws DownloadRequestException {
switch (item.getItemId()) {
case R.id.show_info_item:
Intent startIntent = new Intent(context, FeedInfoActivity.class);
startIntent.putExtra(FeedInfoActivity.EXTRA_FEED_ID,
selectedFeed.getId());
context.startActivity(startIntent);
break;
case R.id.refresh_item:
DBTasks.refreshFeed(context, selectedFeed);
break;