// Path: WhatAndroid/src/main/java/what/whatandroid/WhatApplication.java
// public class WhatApplication extends Application {
// 
// 	//TODO: Developers put your local Gazelle install IP here instead of testing on the live site
// 	//I recommend setting up with Vagrant: https://github.com/dr4g0nnn/VagrantGazelle
// 	public static final String DEFAULT_SITE = "";
// 
// 	@Override
// 	public void onCreate() {
// 		super.onCreate();
// 
// 		initSoup(DEFAULT_SITE);
// 		if (SettingsActivity.lightThemeEnabled(getApplicationContext())) {
// 			AppCompatDelegate.setDefaultNightMode(
// 					AppCompatDelegate.MODE_NIGHT_NO);
// 		} else {
// 			AppCompatDelegate.setDefaultNightMode(
// 					AppCompatDelegate.MODE_NIGHT_YES);
// 		}
// 	}
// 
// 	/**
// 	 * Initialize MySoup so that we can start making API requests
// 	 */
// 	public void initSoup(String site) {
// 		MySoup.setSite(site, true);
// 		MySoup.setUserAgent("WhatAndroid Android");
// 	}
// 
// 	/**
// 	 * Main method for all image displaying operations
// 	 * Fail tracking is done here instead of wherever this method is called from.
// 	 */
// 
// 	public static void loadImage(Context context, final String url, final ImageView imageView, final ProgressBar spinner, final ImageLoadFailTracker failTracker, final Integer failImage) {
// 
// 		if (failTracker != null && failTracker.failed(url)) {
// 			if (spinner != null) spinner.setVisibility(View.GONE);
// 			if (failImage != null) {
// 				imageView.setImageResource(failImage);
// 			} else {
// 				imageView.setImageResource(R.drawable.no_artwork);
// 			}
// 		} else {
// 			if (spinner != null) spinner.setVisibility(View.VISIBLE);
// 			Glide.with(context)
// 					.load(url)
// 					.listener(new RequestListener<String, GlideDrawable>() {
// 						@Override
// 						public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
// 							if (spinner != null) {
// 								spinner.setVisibility(View.GONE);
// 							}
// 							if (failTracker != null) {
// 								failTracker.addFailed(url);
// 							}
// 							if (failImage != null) {
// 								imageView.setImageResource(failImage);
// 							} else {
// 								imageView.setImageResource(R.drawable.no_artwork);
// 							}
// 							return true;
// 						}
// 
// 						@Override
// 						public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
// 							if (spinner != null) {
// 								spinner.setVisibility(View.GONE);
// 							}
// //                            imageView.setImageDrawable(resource);
// 							return false;
// 						}
// 					})
// 					.into(imageView);
// 		}
// 
// 	}
// 
// }
// 
// Path: WhatAndroid/src/main/java/what/whatandroid/callbacks/ViewTorrentCallbacks.java
// public interface ViewTorrentCallbacks {
// 	/**
// 	 * Request to view a torrent group with some id
// 	 *
// 	 * @param id the id of the torrent group to view
// 	 */
// 	public void viewTorrentGroup(int id);
// 
// 	/**
// 	 * Request to view a torrent within some group
// 	 *
// 	 * @param group   torrent group id
// 	 * @param torrent torrent id to view
// 	 */
// 	public void viewTorrent(int group, int torrent);
// }


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;
import api.cli.Utils;
import api.notifications.Torrent;
import what.whatandroid.R;
import what.whatandroid.WhatApplication;
import what.whatandroid.callbacks.ViewTorrentCallbacks;
import what.whatandroid.imgloader.ImageLoadFailTracker;
import what.whatandroid.settings.SettingsActivity;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent){
		ViewHolder holder;
		if (convertView != null){
			holder = (ViewHolder)convertView.getTag();
		}
		else {
			convertView = inflater.inflate(R.layout.list_torrent_notification, parent, false);
			holder = new ViewHolder();
			holder.art = (ImageView)convertView.findViewById(R.id.art);
			holder.spinner = (ProgressBar)convertView.findViewById(R.id.loading_indicator);
			holder.artContainer = convertView.findViewById(R.id.art_container);
			holder.artist = (TextView)convertView.findViewById(R.id.artist_name);
			holder.title = (TextView)convertView.findViewById(R.id.album_name);
			holder.year = (TextView)convertView.findViewById(R.id.album_year);
			holder.tags = (TextView)convertView.findViewById(R.id.album_tags);
			holder.size = (TextView)convertView.findViewById(R.id.size);
			holder.snatches = (TextView)convertView.findViewById(R.id.snatches);
			holder.seeders = (TextView)convertView.findViewById(R.id.seeders);
			holder.leechers = (TextView)convertView.findViewById(R.id.leechers);
			convertView.setTag(holder);
		}
		Torrent t = getItem(position);
		String coverUrl = t.getWikiImage();
		if (!imagesEnabled) {
			holder.artContainer.setVisibility(View.GONE);
		} else {
			holder.artContainer.setVisibility(View.VISIBLE);
// Path: WhatAndroid/src/main/java/what/whatandroid/WhatApplication.java
// public class WhatApplication extends Application {
// 
// 	//TODO: Developers put your local Gazelle install IP here instead of testing on the live site
// 	//I recommend setting up with Vagrant: https://github.com/dr4g0nnn/VagrantGazelle
// 	public static final String DEFAULT_SITE = "";
// 
// 	@Override
// 	public void onCreate() {
// 		super.onCreate();
// 
// 		initSoup(DEFAULT_SITE);
// 		if (SettingsActivity.lightThemeEnabled(getApplicationContext())) {
// 			AppCompatDelegate.setDefaultNightMode(
// 					AppCompatDelegate.MODE_NIGHT_NO);
// 		} else {
// 			AppCompatDelegate.setDefaultNightMode(
// 					AppCompatDelegate.MODE_NIGHT_YES);
// 		}
// 	}
// 
// 	/**
// 	 * Initialize MySoup so that we can start making API requests
// 	 */
// 	public void initSoup(String site) {
// 		MySoup.setSite(site, true);
// 		MySoup.setUserAgent("WhatAndroid Android");
// 	}
// 
// 	/**
// 	 * Main method for all image displaying operations
// 	 * Fail tracking is done here instead of wherever this method is called from.
// 	 */
// 
// 	public static void loadImage(Context context, final String url, final ImageView imageView, final ProgressBar spinner, final ImageLoadFailTracker failTracker, final Integer failImage) {
// 
// 		if (failTracker != null && failTracker.failed(url)) {
// 			if (spinner != null) spinner.setVisibility(View.GONE);
// 			if (failImage != null) {
// 				imageView.setImageResource(failImage);
// 			} else {
// 				imageView.setImageResource(R.drawable.no_artwork);
// 			}
// 		} else {
// 			if (spinner != null) spinner.setVisibility(View.VISIBLE);
// 			Glide.with(context)
// 					.load(url)
// 					.listener(new RequestListener<String, GlideDrawable>() {
// 						@Override
// 						public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
// 							if (spinner != null) {
// 								spinner.setVisibility(View.GONE);
// 							}
// 							if (failTracker != null) {
// 								failTracker.addFailed(url);
// 							}
// 							if (failImage != null) {
// 								imageView.setImageResource(failImage);
// 							} else {
// 								imageView.setImageResource(R.drawable.no_artwork);
// 							}
// 							return true;
// 						}
// 
// 						@Override
// 						public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
// 							if (spinner != null) {
// 								spinner.setVisibility(View.GONE);
// 							}
// //                            imageView.setImageDrawable(resource);
// 							return false;
// 						}
// 					})
// 					.into(imageView);
// 		}
// 
// 	}
// 
// }
// 
// Path: WhatAndroid/src/main/java/what/whatandroid/callbacks/ViewTorrentCallbacks.java
// public interface ViewTorrentCallbacks {
// 	/**
// 	 * Request to view a torrent group with some id
// 	 *
// 	 * @param id the id of the torrent group to view
// 	 */
// 	public void viewTorrentGroup(int id);
// 
// 	/**
// 	 * Request to view a torrent within some group
// 	 *
// 	 * @param group   torrent group id
// 	 * @param torrent torrent id to view
// 	 */
// 	public void viewTorrent(int group, int torrent);
// }


// Path: WhatAndroid/src/main/java/what/whatandroid/notifications/NotificationsListAdapter.java
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;
import api.cli.Utils;
import api.notifications.Torrent;
import what.whatandroid.R;
import what.whatandroid.WhatApplication;
import what.whatandroid.callbacks.ViewTorrentCallbacks;
import what.whatandroid.imgloader.ImageLoadFailTracker;
import what.whatandroid.settings.SettingsActivity;

	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent){
		ViewHolder holder;
		if (convertView != null){
			holder = (ViewHolder)convertView.getTag();
		}
		else {
			convertView = inflater.inflate(R.layout.list_torrent_notification, parent, false);
			holder = new ViewHolder();
			holder.art = (ImageView)convertView.findViewById(R.id.art);
			holder.spinner = (ProgressBar)convertView.findViewById(R.id.loading_indicator);
			holder.artContainer = convertView.findViewById(R.id.art_container);
			holder.artist = (TextView)convertView.findViewById(R.id.artist_name);
			holder.title = (TextView)convertView.findViewById(R.id.album_name);
			holder.year = (TextView)convertView.findViewById(R.id.album_year);
			holder.tags = (TextView)convertView.findViewById(R.id.album_tags);
			holder.size = (TextView)convertView.findViewById(R.id.size);
			holder.snatches = (TextView)convertView.findViewById(R.id.snatches);
			holder.seeders = (TextView)convertView.findViewById(R.id.seeders);
			holder.leechers = (TextView)convertView.findViewById(R.id.leechers);
			convertView.setTag(holder);
		}
		Torrent t = getItem(position);
		String coverUrl = t.getWikiImage();
		if (!imagesEnabled) {
			holder.artContainer.setVisibility(View.GONE);
		} else {
			holder.artContainer.setVisibility(View.VISIBLE);
			WhatApplication.loadImage(inflater.getContext(), coverUrl, holder.art, holder.spinner, imageFailTracker, null);