add another possible check for duplicate async loaded images in headlines

This commit is contained in:
Andrew Dolgov 2015-08-17 14:30:14 +03:00
parent d0a7ca271d
commit c28adf42b3
5 changed files with 21 additions and 13 deletions

View File

@ -12,10 +12,12 @@
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugTestSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
<task>generateDebugTestSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
@ -24,7 +26,7 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss"
android:versionCode="369"
android:versionName="1.142" >
android:versionCode="370"
android:versionName="1.143" >
<uses-sdk
android:minSdkVersion="15"

View File

@ -851,7 +851,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
public View getView(final int position, View convertView, ViewGroup parent) {
View v = convertView;
@ -1164,6 +1164,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
holder.flavorImageView.setTag("LOADING:" + posterUri);
ImageAware imageAware = new ImageViewAware(holder.flavorImageView, false);
final int loadingPosition = position;
m_imageLoader.displayImage(posterUri, imageAware, displayImageOptions, new ImageLoadingListener() {
@Override
@ -1180,7 +1181,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap bitmap) {
if (("LOADING:" + imageUri).equals(view.getTag()) && bitmap != null) {
if (loadingPosition == position && ("LOADING:" + imageUri).equals(view.getTag()) && bitmap != null) {
holder.flavorImageLoadingBar.setVisibility(View.GONE);
holder.flavorImageView.setTag(posterUri);
@ -1274,6 +1275,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
if (!thumbUri.equals(holder.flavorImageView.getTag())) {
holder.flavorImageView.setTag("LOADING:" + thumbUri);
final int loadingPosition = position;
ImageAware imageAware = new ImageViewAware(holder.flavorImageView, false);
m_imageLoader.displayImage(thumbUri, imageAware, displayImageOptions, new ImageLoadingListener() {
@ -1291,7 +1293,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap bitmap) {
if (("LOADING:" + imageUri).equals(view.getTag()) && bitmap != null) {
if (loadingPosition == position && ("LOADING:" + imageUri).equals(view.getTag()) && bitmap != null) {
holder.flavorImageLoadingBar.setVisibility(View.GONE);
holder.flavorImageView.setTag(thumbUri);
holder.flavorImageView.setVisibility(View.VISIBLE);
@ -1394,6 +1396,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
if (!imgSrc.equals(holder.flavorImageView.getTag())) {
holder.flavorImageView.setTag("LOADING:" + imgSrc);
final int loadingPosition = position;
ImageAware imageAware = new ImageViewAware(holder.flavorImageView, false);
final String finalImgSrc = imgSrc;
@ -1410,7 +1414,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
public void onLoadingComplete(String imageUri,
View view, Bitmap bitmap) {
if (("LOADING:" + imageUri).equals(view.getTag()) && bitmap != null) {
if (loadingPosition == position && ("LOADING:" + imageUri).equals(view.getTag()) && bitmap != null) {
holder.flavorImageLoadingBar.setVisibility(View.GONE);
holder.flavorImageView.setTag(finalImgSrc);

View File

@ -12,10 +12,12 @@
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugTestSources" />
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
<task>generateDebugTestSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
@ -25,7 +27,7 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />

View File

@ -8,7 +8,7 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="true">
<output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output />