<commit_before>package de.eightbitboy.hijacr.data;

import android.graphics.Bitmap;
import android.view.View;
import android.widget.ImageView;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener;
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
import com.orhanobut.logger.Logger;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import java.io.IOException;

import de.eightbitboy.hijacr.data.comic.SimpleComicData;
import de.eightbitboy.hijacr.events.ComicViewUpdateEvent;
import de.greenrobot.event.EventBus;

/**
 * Handles the comic viewing state and updates the comic view.
 */
public class ComicManager {
	private ImageView comicView;
	private SimpleComicData comicData;
	private int currentComicCount = 0;

	/**
	 * Creates a new ComicManager intended for starting a new comic.
	 *
	 * @param comicView
	 * @param comicData
	 */
	public ComicManager(ImageView comicView, SimpleComicData comicData) {
		this.comicView = comicView;
		this.comicData = comicData;
	}

	public void loadNextComic() {
		currentComicCount++;
		new ComicFetchTask(comicData.baseUrl, currentComicCount, comicData.imageQuery,
				this).execute();
	}

	public void loadPreviousComic() {
		currentComicCount--;
		new ComicFetchTask(comicData.baseUrl, currentComicCount, comicData.imageQuery,
				this).execute();
	}

	public void onGetImageSource(String source) {
		SimpleImageLoadingListener loadListener = new SimpleImageLoadingListener() {
			@Override
			public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
				EventBus.getDefault().post(new ComicViewUpdateEvent());
			}
		};

		ImageLoadingProgressListener progressListener = new ImageLoadingProgressListener() {
			@Override
			public void onProgressUpdate(String imageUri, View view, int current, int total) {

			}
		};

		ImageLoader.getInstance().displayImage(source, comicView, null, loadListener,
				progressListener);
	}
}<commit_msg>Cleanup<commit_after>package de.eightbitboy.hijacr.data;

import android.graphics.Bitmap;
import android.view.View;
import android.widget.ImageView;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener;
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
import com.orhanobut.logger.Logger;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import java.io.IOException;

import de.eightbitboy.hijacr.data.comic.SimpleComicData;
import de.eightbitboy.hijacr.events.ComicViewUpdateEvent;
import de.greenrobot.event.EventBus;

/**
 * Handles the comic viewing state and updates the comic view.
 */
public class ComicManager {
	private ImageView comicView;
	private SimpleComicData comicData;
	private int currentComicCount = 0;
	private SimpleImageLoadingListener loadListener;
	private ImageLoadingProgressListener progressListener;

	/**
	 * Creates a new ComicManager intended for starting a new comic.
	 *
	 * @param comicView
	 * @param comicData
	 */
	public ComicManager(ImageView comicView, SimpleComicData comicData) {
		this.comicView = comicView;
		this.comicData = comicData;
		setUpImageListeners();
	}

	private void setUpImageListeners() {
		loadListener = new SimpleImageLoadingListener() {
			@Override
			public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
				EventBus.getDefault().post(new ComicViewUpdateEvent());
			}
		};

		progressListener = new ImageLoadingProgressListener() {
			@Override
			public void onProgressUpdate(String imageUri, View view, int current, int total) {
				//TODO show progress somewhere
			}
		};
	}

	public void loadNextComic() {
		currentComicCount++;
		new ComicFetchTask(comicData.baseUrl, currentComicCount, comicData.imageQuery,
				this).execute();
	}

	public void loadPreviousComic() {
		currentComicCount--;
		new ComicFetchTask(comicData.baseUrl, currentComicCount, comicData.imageQuery,
				this).execute();
	}

	public void onGetImageSource(String source) {
		ImageLoader.getInstance().displayImage(source, comicView, null, loadListener,
				progressListener);
	}
}
{'fraction_non_alphanumeric': 0.0901561760530052, 'fraction_numerical': 0.003312825366777094, 'mean_word_length': 5.346846846846847, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5216083', 'n_tokens_mistral': 1369, 'n_tokens_neox': 1242, 'n_words': 274}