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 NewsReaderListFragment nrlf;
private NewsReaderDetailFragment nrdf;
private int itemPos = 5;
private int itemPos = 0;
@Before
public void setup() {

View file

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

View file

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

View file

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

View file

@ -89,21 +89,6 @@ public class InsertIntoDatabase {
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)
{

View file

@ -192,7 +192,7 @@ public class DownloadImagesService extends IntentService {
ImageDownloadFinished imgDownloadFinished = new ImageDownloadFinished() {
@Override
public void DownloadFinished(long ThreadId) {
public void DownloadFinished(long AsynkTaskId, Bitmap bitmap) {
int count = maxCount - linksToImages.size();
if(maxCount == count) {
@ -208,10 +208,5 @@ public class DownloadImagesService extends IntentService {
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'
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_previous_screenshots true