1183 Reload header images on refresh

This commit is contained in:
Martin Fietz 2017-06-05 10:55:45 +02:00
parent 19acd8d88c
commit 36eae974a1
1 changed files with 19 additions and 12 deletions

View File

@ -110,6 +110,8 @@ public class ItemlistFragment extends ListFragment {
private TextView txtvTitle; private TextView txtvTitle;
private IconTextView txtvFailure; private IconTextView txtvFailure;
private ImageView imgvBackground;
private ImageView imgvCover;
private TextView txtvInformation; private TextView txtvInformation;
@ -471,6 +473,7 @@ public class ItemlistFragment extends ListFragment {
Log.e(TAG, "Unable to refresh header view"); Log.e(TAG, "Unable to refresh header view");
return; return;
} }
loadFeedImage();
if(feed.hasLastUpdateFailed()) { if(feed.hasLastUpdateFailed()) {
txtvFailure.setVisibility(View.VISIBLE); txtvFailure.setVisibility(View.VISIBLE);
} else { } else {
@ -508,8 +511,8 @@ public class ItemlistFragment extends ListFragment {
txtvTitle = (TextView) header.findViewById(R.id.txtvTitle); txtvTitle = (TextView) header.findViewById(R.id.txtvTitle);
TextView txtvAuthor = (TextView) header.findViewById(R.id.txtvAuthor); TextView txtvAuthor = (TextView) header.findViewById(R.id.txtvAuthor);
ImageView imgvBackground = (ImageView) header.findViewById(R.id.imgvBackground); imgvBackground = (ImageView) header.findViewById(R.id.imgvBackground);
ImageView imgvCover = (ImageView) header.findViewById(R.id.imgvCover); imgvCover = (ImageView) header.findViewById(R.id.imgvCover);
ImageButton butShowInfo = (ImageButton) header.findViewById(R.id.butShowInfo); ImageButton butShowInfo = (ImageButton) header.findViewById(R.id.butShowInfo);
txtvInformation = (TextView) header.findViewById(R.id.txtvInformation); txtvInformation = (TextView) header.findViewById(R.id.txtvInformation);
txtvFailure = (IconTextView) header.findViewById(R.id.txtvFailure); txtvFailure = (IconTextView) header.findViewById(R.id.txtvFailure);
@ -521,6 +524,20 @@ public class ItemlistFragment extends ListFragment {
// https://github.com/bumptech/glide/issues/529 // https://github.com/bumptech/glide/issues/529
imgvBackground.setColorFilter(new LightingColorFilter(0xff828282, 0x000000)); imgvBackground.setColorFilter(new LightingColorFilter(0xff828282, 0x000000));
loadFeedImage();
butShowInfo.setOnClickListener(v -> {
if (viewsCreated && itemsLoaded) {
Intent startIntent = new Intent(getActivity(), FeedInfoActivity.class);
startIntent.putExtra(FeedInfoActivity.EXTRA_FEED_ID,
feed.getId());
startActivity(startIntent);
}
});
headerCreated = true;
}
private void loadFeedImage() {
Glide.with(getActivity()) Glide.with(getActivity())
.load(feed.getImageLocation()) .load(feed.getImageLocation())
.placeholder(R.color.image_readability_tint) .placeholder(R.color.image_readability_tint)
@ -538,16 +555,6 @@ public class ItemlistFragment extends ListFragment {
.fitCenter() .fitCenter()
.dontAnimate() .dontAnimate()
.into(imgvCover); .into(imgvCover);
butShowInfo.setOnClickListener(v -> {
if (viewsCreated && itemsLoaded) {
Intent startIntent = new Intent(getActivity(), FeedInfoActivity.class);
startIntent.putExtra(FeedInfoActivity.EXTRA_FEED_ID,
feed.getId());
startActivity(startIntent);
}
});
headerCreated = true;
} }