add some additional tag checking for headline images so they wouldn't reload all the time
This commit is contained in:
parent
22694af2f7
commit
ebe9738163
@ -1181,70 +1181,15 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//Log.d(TAG, "IMG: " + article.flavorImageUri + " STREAM: " + article.flavorStreamUri);
|
Log.d(TAG, "IMG: " + article.flavorImageUri + " STREAM: " + article.flavorStreamUri);
|
||||||
|
|
||||||
holder.flavorImageLoadingBar.setVisibility(View.VISIBLE);
|
|
||||||
holder.flavorImageLoadingBar.setIndeterminate(true);
|
|
||||||
|
|
||||||
/*if ("video".equals(article.flavorImage.tagName().toLowerCase()) && article.flavorStreamUri != null) {
|
|
||||||
final MediaPlayer mediaPlayer = new MediaPlayer();
|
|
||||||
|
|
||||||
holder.flavorVideoView.setVisibility(View.VISIBLE);
|
|
||||||
|
|
||||||
repositionFlavorVideo(holder.flavorVideoView, holder);
|
|
||||||
|
|
||||||
try {
|
|
||||||
mediaPlayer.setDataSource(article.flavorStreamUri);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
final View bar = holder.flavorImageLoadingBar;
|
|
||||||
SurfaceHolder sh = holder.flavorVideoView.getHolder();
|
|
||||||
|
|
||||||
sh.addCallback(new SurfaceHolder.Callback() {
|
|
||||||
@Override
|
|
||||||
public void surfaceCreated(SurfaceHolder holder) {
|
|
||||||
mediaPlayer.setDisplay(holder);
|
|
||||||
try {
|
|
||||||
mediaPlayer.prepareAsync();
|
|
||||||
} catch (IllegalStateException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
|
|
||||||
@Override
|
|
||||||
public void onPrepared(MediaPlayer mp) {
|
|
||||||
|
|
||||||
bar.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
//resizeSurface();
|
|
||||||
mp.setLooping(true);
|
|
||||||
mp.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void surfaceDestroyed(SurfaceHolder holder) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else { */
|
|
||||||
|
|
||||||
holder.flavorImageView.setVisibility(View.VISIBLE);
|
holder.flavorImageView.setVisibility(View.VISIBLE);
|
||||||
holder.flavorImageView.setImageDrawable(null);
|
|
||||||
|
|
||||||
final GlideDrawableImageViewTarget glideImage = new GlideDrawableImageViewTarget(holder.flavorImageView);
|
Log.d(TAG, "TAG:" + holder.flavorImageOverflow.getTag());
|
||||||
|
|
||||||
|
if (!article.flavorImageUri.equals(holder.flavorImageOverflow.getTag())) {
|
||||||
|
holder.flavorImageLoadingBar.setVisibility(View.VISIBLE);
|
||||||
|
holder.flavorImageLoadingBar.setIndeterminate(true);
|
||||||
|
|
||||||
Glide.with(HeadlinesFragment.this)
|
Glide.with(HeadlinesFragment.this)
|
||||||
.load(article.flavorImageUri)
|
.load(article.flavorImageUri)
|
||||||
@ -1266,12 +1211,11 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
holder.flavorImageLoadingBar.setVisibility(View.GONE);
|
holder.flavorImageLoadingBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
holder.flavorImageOverflow.setVisibility(View.VISIBLE);
|
|
||||||
|
|
||||||
if (resource.getIntrinsicWidth() > FLAVOR_IMG_MIN_SIZE && resource.getIntrinsicHeight() > FLAVOR_IMG_MIN_SIZE) {
|
if (resource.getIntrinsicWidth() > FLAVOR_IMG_MIN_SIZE && resource.getIntrinsicHeight() > FLAVOR_IMG_MIN_SIZE) {
|
||||||
|
|
||||||
holder.flavorImageView.setVisibility(View.VISIBLE);
|
//holder.flavorImageView.setVisibility(View.VISIBLE);
|
||||||
holder.flavorImageOverflow.setVisibility(View.VISIBLE);
|
holder.flavorImageOverflow.setVisibility(View.VISIBLE);
|
||||||
|
holder.flavorImageOverflow.setTag(article.flavorImageUri);
|
||||||
|
|
||||||
boolean forceDown = article.flavorImage != null && "video".equals(article.flavorImage.tagName().toLowerCase());
|
boolean forceDown = article.flavorImage != null && "video".equals(article.flavorImage.tagName().toLowerCase());
|
||||||
|
|
||||||
@ -1280,11 +1224,29 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
holder.flavorImageOverflow.setVisibility(View.GONE);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.into(glideImage);
|
.into(holder.flavorImageView);
|
||||||
|
} else {
|
||||||
|
holder.flavorImageOverflow.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
adjustVideoKindView(holder, article);
|
||||||
|
|
||||||
|
if (holder.flavorImageEmbedded) {
|
||||||
|
TypedValue tv = new TypedValue();
|
||||||
|
|
||||||
|
if (m_activity.getTheme().resolveAttribute(R.attr.headlineHeaderBackground, tv, true)) {
|
||||||
|
holder.headlineHeader.setBackgroundColor(tv.data);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
holder.headlineHeader.setBackgroundDrawable(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_prefs.getBoolean("inline_video_player", false) && article.flavorImage != null &&
|
if (m_prefs.getBoolean("inline_video_player", false) && article.flavorImage != null &&
|
||||||
|
@ -38,9 +38,11 @@
|
|||||||
android:layout_alignParentTop="false"
|
android:layout_alignParentTop="false"
|
||||||
android:layout_alignParentRight="false"
|
android:layout_alignParentRight="false"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:max="100"
|
android:max="100"
|
||||||
android:indeterminate="false" />
|
android:indeterminate="false"
|
||||||
|
android:layout_toRightOf="@+id/flavor_video"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/flavor_image"
|
android:id="@+id/flavor_image"
|
||||||
@ -53,7 +55,6 @@
|
|||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:cropToPadding="true"
|
android:cropToPadding="true"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:src="@drawable/drawer_header"
|
|
||||||
android:visibility="visible" />
|
android:visibility="visible" />
|
||||||
|
|
||||||
<SurfaceView
|
<SurfaceView
|
||||||
|
@ -39,9 +39,11 @@
|
|||||||
android:layout_alignParentTop="false"
|
android:layout_alignParentTop="false"
|
||||||
android:layout_alignParentRight="false"
|
android:layout_alignParentRight="false"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:max="100"
|
android:max="100"
|
||||||
android:indeterminate="false" />
|
android:indeterminate="false"
|
||||||
|
android:layout_toRightOf="@+id/flavor_video"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/flavor_image"
|
android:id="@+id/flavor_image"
|
||||||
@ -54,7 +56,6 @@
|
|||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:cropToPadding="true"
|
android:cropToPadding="true"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:src="@drawable/drawer_header"
|
|
||||||
android:visibility="visible" />
|
android:visibility="visible" />
|
||||||
|
|
||||||
<SurfaceView
|
<SurfaceView
|
||||||
|
Loading…
Reference in New Issue
Block a user