// Path: app/src/test/java/android/util/Log.java
// public class Log {
// 	public static int d(String tag, String msg) {
// 		System.out.println("D " + tag + ": " + msg);
// 		return 0;
// 	}
// 
// 	public static int i(String tag, String msg) {
// 		System.out.println("I " + tag + ": " + msg);
// 		return 0;
// 	}
// 
// 	public static int w(String tag, String msg) {
// 		System.out.println("W " + tag + ": " + msg);
// 		return 0;
// 	}
// 
// 	public static int e(String tag, String msg) {
// 		System.out.println("E " + tag + ": " + msg);
// 		return 0;
// 	}
// }


import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.Toast;
import org.json.JSONArray;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.time.ZoneId;
import java.util.AbstractList;
import java.util.Collection;
import java.util.LinkedList;
		ret.progressHandler = progressHandler;

		if (ret.progressHandler == null) {
			// TODO: Test this uncommon codepath to ensure noop handlers are noop and not crashop.
			// (Can't test this now because it looks like reminders are kinda broken... :< )
			ret.progressHandler = new Handler();
		}

		Db.DbSchedule ds = ctx.getDb().getSchedule(url);
		if (ds != null) {
			String tz = ds.getTimezone();
			if (tz != null && !tz.isEmpty()) {
				ret.setInTZ(ZoneId.of(tz));
			}
		}

		Fetcher f = null;

		try {
			f = ctx.fetch(url, source);
			f.setProgressHandler(ret.progressHandler);
			Log.d("Fetcher", "source=" + f.getSource());
			if (f.getSource() == Fetcher.Source.CACHE) {
				ret.progressHandler.sendEmptyMessage(ScheduleViewActivity.LoadProgress.FROM_CACHE);
			}
			ret.loadSchedule(f.getReader(), url);
		} catch (LoadException | IOException e) {
			if (f != null)
				f.cancel();

// Path: app/src/test/java/android/util/Log.java
// public class Log {
// 	public static int d(String tag, String msg) {
// 		System.out.println("D " + tag + ": " + msg);
// 		return 0;
// 	}
// 
// 	public static int i(String tag, String msg) {
// 		System.out.println("I " + tag + ": " + msg);
// 		return 0;
// 	}
// 
// 	public static int w(String tag, String msg) {
// 		System.out.println("W " + tag + ": " + msg);
// 		return 0;
// 	}
// 
// 	public static int e(String tag, String msg) {
// 		System.out.println("E " + tag + ": " + msg);
// 		return 0;
// 	}
// }


// Path: app/src/main/java/net/gaast/giggity/ScheduleUI.java
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.Toast;
import org.json.JSONArray;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.time.ZoneId;
import java.util.AbstractList;
import java.util.Collection;
import java.util.LinkedList;

		ret.progressHandler = progressHandler;

		if (ret.progressHandler == null) {
			// TODO: Test this uncommon codepath to ensure noop handlers are noop and not crashop.
			// (Can't test this now because it looks like reminders are kinda broken... :< )
			ret.progressHandler = new Handler();
		}

		Db.DbSchedule ds = ctx.getDb().getSchedule(url);
		if (ds != null) {
			String tz = ds.getTimezone();
			if (tz != null && !tz.isEmpty()) {
				ret.setInTZ(ZoneId.of(tz));
			}
		}

		Fetcher f = null;

		try {
			f = ctx.fetch(url, source);
			f.setProgressHandler(ret.progressHandler);
			Log.d("Fetcher", "source=" + f.getSource());
			if (f.getSource() == Fetcher.Source.CACHE) {
				ret.progressHandler.sendEmptyMessage(ScheduleViewActivity.LoadProgress.FROM_CACHE);
			}
			ret.loadSchedule(f.getReader(), url);
		} catch (LoadException | IOException e) {
			if (f != null)
				f.cancel();

			Log.e("Schedule.loadSchedule", "Exception while downloading schedule: " + e);