// Path: fanfictionReader/src/main/java/com/spicymango/fanfictionreader/provider/SqlConstants.java
// public interface SqlConstants {
// 
// 	// Columns of the table
// 	String KEY_STORY_ID = BaseColumns._ID;
// 	String KEY_TITLE = "title";
// 	String KEY_AUTHOR = "author";
// 	String KEY_AUTHOR_ID = "authorId";
// 	String KEY_RATING = "rating";
// 	String KEY_GENRE = "genre";
// 	String KEY_LANGUAGE = "languague";
// 	String KEY_CATEGORY = "category";
// 	String KEY_CHAPTER = "chapter";
// 	String KEY_LENGTH = "lenght";
// 	String KEY_FAVORITES = "favorites";
// 	String KEY_FOLLOWERS = "follows";
// 	String KEY_UPDATED = "updated";
// 	String KEY_PUBLISHED = "published";
// 	String KEY_SUMMARY = "summary";
// 	String KEY_LAST = "lastChapter";
// 	String KEY_COMPLETE = "completed";
// 	String KEY_OFFSET = "characterOffset";
// 	String KEY_CHARACTERS = "characters";
// 	String KEY_REVIEWS = "reviews";
// 	String KEY_ADDED = "added";
// 	String KEY_LAST_READ = "lastRead";
// 
// 	// Full text search columns
// 	String FTS_TABLE = "full_text_search";
// 	String KEY_FTS_ID = "rowid";
// 	String KEY_FTS_TITLE = "fts_" + KEY_TITLE;
// 	String KEY_FTS_AUTHOR = "fts_" + KEY_AUTHOR;
// 	String KEY_FTS_CATEGORY = "fts_" + KEY_CATEGORY;
// 	String KEY_FTS_SUMMARY = "fts_" + KEY_SUMMARY;
// 	String KEY_FTS_CHARACTERS = "fts_" + KEY_CHARACTERS;
// }
// 
// Path: fanfictionReader/src/main/java/com/spicymango/fanfictionreader/util/Result.java
// public enum Result{
// 	NO_CHANGE,
// 	ERROR_CONNECTION,
// 	ERROR_SD,
// 	ERROR_PARSE,
// 	ERROR_LOGIN,
// 	ERROR_CLOUDFLARE_CAPTCHA,
// 	LOADING,
// 	LOADING_HIDE_PROGRESS,
// 	SUCCESS
// }


import java.io.FileNotFoundException;
import java.io.IOException;
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import androidx.loader.content.AsyncTaskLoader;
import com.spicymango.fanfictionreader.provider.SqlConstants;
import com.spicymango.fanfictionreader.util.Result;
			// See if it has already been downloaded
			if (mDataFromWebView == null){
				// Download the data if it hasn't been downloaded
				mResult = Result.ERROR_CLOUDFLARE_CAPTCHA;
				return null;
			} else if (mDataFromWebView.equalsIgnoreCase("404")){
				// Connection failure
				mResult = Result.ERROR_CONNECTION;
				mDataFromWebView = null;
				return null;
			} else{
				html = parseHTML(mDataFromWebView, mData);
				mDataFromWebView = null;
			}
		}

		mData.setStoryText(html);
		mData.setCurrentPage(mCurrentPage);
		
		//Do not reset scroll to zero if opening a saved story
		if (mFirstScroll) {
			mScrollTo = true;
			mFirstScroll = false;
		}else if(mDataHasChanged) {
			mScrollTo = true;
			mScrollOffset = 0;
		}
		
		mDataHasChanged = false;
		
// Path: fanfictionReader/src/main/java/com/spicymango/fanfictionreader/provider/SqlConstants.java
// public interface SqlConstants {
// 
// 	// Columns of the table
// 	String KEY_STORY_ID = BaseColumns._ID;
// 	String KEY_TITLE = "title";
// 	String KEY_AUTHOR = "author";
// 	String KEY_AUTHOR_ID = "authorId";
// 	String KEY_RATING = "rating";
// 	String KEY_GENRE = "genre";
// 	String KEY_LANGUAGE = "languague";
// 	String KEY_CATEGORY = "category";
// 	String KEY_CHAPTER = "chapter";
// 	String KEY_LENGTH = "lenght";
// 	String KEY_FAVORITES = "favorites";
// 	String KEY_FOLLOWERS = "follows";
// 	String KEY_UPDATED = "updated";
// 	String KEY_PUBLISHED = "published";
// 	String KEY_SUMMARY = "summary";
// 	String KEY_LAST = "lastChapter";
// 	String KEY_COMPLETE = "completed";
// 	String KEY_OFFSET = "characterOffset";
// 	String KEY_CHARACTERS = "characters";
// 	String KEY_REVIEWS = "reviews";
// 	String KEY_ADDED = "added";
// 	String KEY_LAST_READ = "lastRead";
// 
// 	// Full text search columns
// 	String FTS_TABLE = "full_text_search";
// 	String KEY_FTS_ID = "rowid";
// 	String KEY_FTS_TITLE = "fts_" + KEY_TITLE;
// 	String KEY_FTS_AUTHOR = "fts_" + KEY_AUTHOR;
// 	String KEY_FTS_CATEGORY = "fts_" + KEY_CATEGORY;
// 	String KEY_FTS_SUMMARY = "fts_" + KEY_SUMMARY;
// 	String KEY_FTS_CHARACTERS = "fts_" + KEY_CHARACTERS;
// }
// 
// Path: fanfictionReader/src/main/java/com/spicymango/fanfictionreader/util/Result.java
// public enum Result{
// 	NO_CHANGE,
// 	ERROR_CONNECTION,
// 	ERROR_SD,
// 	ERROR_PARSE,
// 	ERROR_LOGIN,
// 	ERROR_CLOUDFLARE_CAPTCHA,
// 	LOADING,
// 	LOADING_HIDE_PROGRESS,
// 	SUCCESS
// }


// Path: fanfictionReader/src/main/java/com/spicymango/fanfictionreader/activity/reader/StoryLoader.java
import java.io.FileNotFoundException;
import java.io.IOException;
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import androidx.loader.content.AsyncTaskLoader;
import com.spicymango.fanfictionreader.provider.SqlConstants;
import com.spicymango.fanfictionreader.util.Result;

			// See if it has already been downloaded
			if (mDataFromWebView == null){
				// Download the data if it hasn't been downloaded
				mResult = Result.ERROR_CLOUDFLARE_CAPTCHA;
				return null;
			} else if (mDataFromWebView.equalsIgnoreCase("404")){
				// Connection failure
				mResult = Result.ERROR_CONNECTION;
				mDataFromWebView = null;
				return null;
			} else{
				html = parseHTML(mDataFromWebView, mData);
				mDataFromWebView = null;
			}
		}

		mData.setStoryText(html);
		mData.setCurrentPage(mCurrentPage);
		
		//Do not reset scroll to zero if opening a saved story
		if (mFirstScroll) {
			mScrollTo = true;
			mFirstScroll = false;
		}else if(mDataHasChanged) {
			mScrollTo = true;
			mScrollOffset = 0;
		}
		
		mDataHasChanged = false;
		
		mResult = Result.SUCCESS;