Bugfix / Refactoring

This commit is contained in:
David Luhmer 2016-03-29 18:04:43 +02:00
parent db751ecc64
commit bbbcdfdb4a
7 changed files with 11 additions and 39 deletions

View file

@ -60,7 +60,7 @@ public class ScreenshotTest {
private NewsReaderListActivity activity; private NewsReaderListActivity activity;
private NewsReaderListFragment nrlf; private NewsReaderListFragment nrlf;
private NewsReaderDetailFragment nrdf; private NewsReaderDetailFragment nrdf;
private int itemPos = 5; private int itemPos = 0;
@Before @Before
public void setup() { public void setup() {

View file

@ -73,23 +73,23 @@ public class GetImageThreaded implements ImageLoadingListener
@Override @Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) { public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
NotifyDownloadFinished(); NotifyDownloadFinished(null);
Log.d(TAG, "Failed to load file: " + imageUri); Log.d(TAG, "Failed to load file: " + imageUri);
} }
@Override @Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
NotifyDownloadFinished(); NotifyDownloadFinished(loadedImage);
} }
@Override @Override
public void onLoadingCancelled(String imageUri, View view) { public void onLoadingCancelled(String imageUri, View view) {
NotifyDownloadFinished(); NotifyDownloadFinished(null);
Log.d(TAG, "Cancelled: " + imageUri); Log.d(TAG, "Cancelled: " + imageUri);
} }
private void NotifyDownloadFinished() { private void NotifyDownloadFinished(Bitmap bitmap) {
if(imageDownloadFinished != null) if(imageDownloadFinished != null)
imageDownloadFinished.DownloadFinished(ThreadId); imageDownloadFinished.DownloadFinished(ThreadId, bitmap);
} }
} }

View file

@ -73,18 +73,11 @@ public class FavIconHandler {
return; return;
} }
GetImageThreaded giAsync = new GetImageThreaded(feed.getFaviconUrl(), favIconDownloadFinished, feed.getId()); new GetImageThreaded(feed.getFaviconUrl(), favIconDownloadFinished, feed.getId()).start();
giAsync.start();
} }
ImageDownloadFinished favIconDownloadFinished = new ImageDownloadFinished() { ImageDownloadFinished favIconDownloadFinished = new ImageDownloadFinished() {
@Override
public void DownloadFinished(long AsynkTaskId) {
DownloadFinished(AsynkTaskId, null);
}
@Override @Override
public void DownloadFinished(long AsynkTaskId, Bitmap bitmap) { public void DownloadFinished(long AsynkTaskId, Bitmap bitmap) {
if(bitmap != null) { if(bitmap != null) {

View file

@ -25,6 +25,5 @@ package de.luhmer.owncloudnewsreader.helper;
import android.graphics.Bitmap; import android.graphics.Bitmap;
public interface ImageDownloadFinished { public interface ImageDownloadFinished {
void DownloadFinished(long AsynkTaskId);
void DownloadFinished(long AsynkTaskId, Bitmap bitmap); void DownloadFinished(long AsynkTaskId, Bitmap bitmap);
} }

View file

@ -89,21 +89,6 @@ public class InsertIntoDatabase {
break; break;
} }
/*
if(feeds.get(i).getLink().equals(oldFeed.getLink()))
{
if(!feeds.get(i).getFeedTitle().equals(oldFeed.getFeedTitle()))
{
oldFeed.setFeedTitle(feeds.get(i).getFeedTitle());
}
//Set the avg color after sync again.
oldFeed.setAvgColour(oldFeeds.get(i).getAvgColour());
dbConn.updateFeed(oldFeed);
found = true;
break;
}
*/
} }
if(!found) if(!found)
{ {

View file

@ -191,12 +191,12 @@ public class DownloadImagesService extends IntentService {
ImageDownloadFinished imgDownloadFinished = new ImageDownloadFinished() { ImageDownloadFinished imgDownloadFinished = new ImageDownloadFinished() {
@Override @Override
public void DownloadFinished(long ThreadId) { public void DownloadFinished(long AsynkTaskId, Bitmap bitmap) {
int count = maxCount - linksToImages.size(); int count = maxCount - linksToImages.size();
if(maxCount == count) { if(maxCount == count) {
notificationManager.cancel(NOTIFICATION_ID); notificationManager.cancel(NOTIFICATION_ID);
//RemoveOldImages(); //RemoveOldImages();
} else { } else {
mNotificationDownloadImages mNotificationDownloadImages
@ -207,11 +207,6 @@ public class DownloadImagesService extends IntentService {
StartNextDownloadInQueue(); StartNextDownloadInQueue();
} }
}
@Override
public void DownloadFinished(long AsynkTaskId, Bitmap bitmap) {
DownloadFinished(AsynkTaskId);
} }
}; };
} }

View file

@ -7,7 +7,7 @@ app_package_name 'de.luhmer.owncloudnewsreader'
app_apk_path 'News-Android-App/build/outputs/apk/News-Android-App-debug-unaligned.apk' app_apk_path 'News-Android-App/build/outputs/apk/News-Android-App-debug-unaligned.apk'
tests_apk_path 'News-Android-App/build/outputs/apk/News-Android-App-debug-androidTest-unaligned.apk' tests_apk_path 'News-Android-App/build/outputs/apk/News-Android-App-debug-androidTest-unaligned.apk'
locales ['en-US', 'fr-FR', 'it-IT'] locales ['en-US', 'de-DE', 'fr-FR', 'it-IT']
# clear all previously generated screenshots in your local output directory before creating new ones # clear all previously generated screenshots in your local output directory before creating new ones
clear_previous_screenshots true clear_previous_screenshots true