// Path: app/src/main/java/com/antest1/kcanotify/KcaApiData.java
// public static JsonObject kcQuestInfoData = new JsonObject();
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String DB_KEY_EXPCRNT = "key_expcrnt";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String DB_KEY_EXPTDAY = "key_exptday";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String DB_KEY_EXPTIME = "key_exptime";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String DB_KEY_QUESTNCHK = "key_questnchk";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String DB_KEY_SHIPIFNO = "key_shipinfo";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String ERROR_TYPE_DB = "D";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String ERROR_TYPE_VPN = "V";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final int KCANOTIFY_QTDB_VERSION = 3;
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static Calendar getJapanCalendarInstance() {
//     Calendar c = Calendar.getInstance(TimeZone.getTimeZone("Asia/Tokyo"), Locale.JAPAN);
//     c.setFirstDayOfWeek(Calendar.MONDAY);
//     return c;
// }
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static SimpleDateFormat getJapanSimpleDataFormat(String format) {
//     SimpleDateFormat dateFormat = new SimpleDateFormat(format, Locale.US);
//     dateFormat.setTimeZone(TimeZone.getTimeZone("Asia/Tokyo"));
//     return dateFormat;
// }
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static String getStringFromException(Exception ex) {
//     StringWriter errors = new StringWriter();
//     ex.printStackTrace(new PrintWriter(errors));
//     return errors.toString().replaceAll("\n", " / ").replaceAll("\t", "");
// }


import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteStatement;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonPrimitive;
import com.google.gson.stream.JsonReader;
import org.json.JSONObject;
import java.io.StringReader;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
import static android.R.attr.timeZone;
import static android.R.attr.value;
import static android.icu.lang.UCharacter.GraphemeClusterBreak.L;
import static com.antest1.kcanotify.KcaApiData.kcQuestInfoData;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_EXPCRNT;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_EXPTDAY;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_EXPTIME;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_QUESTNCHK;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_SHIPIFNO;
import static com.antest1.kcanotify.KcaConstants.ERROR_TYPE_DB;
import static com.antest1.kcanotify.KcaConstants.ERROR_TYPE_VPN;
import static com.antest1.kcanotify.KcaConstants.KCANOTIFY_QTDB_VERSION;
import static com.antest1.kcanotify.KcaUtils.getJapanCalendarInstance;
import static com.antest1.kcanotify.KcaUtils.getJapanSimpleDataFormat;
import static com.antest1.kcanotify.KcaUtils.getStringFromException;
        SQLiteDatabase db = this.getWritableDatabase();
        db.delete(questlist_table_name, "KEY=?", new String[]{String.valueOf(key)});
        qt.removeQuestTrack(key, false);
    }

    public String getCurrentQuestCode() {
        List<String> all_code = new ArrayList<>();
        JsonArray api_list = getCurrentQuestList();
        for (int i = 0; i < api_list.size(); i++) {
            JsonObject api_list_item = api_list.get(i).getAsJsonObject();
            String api_no = api_list_item.get("api_no").getAsString();
        }
        JsonArray tracked_quest = qt.getQuestTrackerData();
        for (int i = 0; i < tracked_quest.size(); i++) {
            JsonObject item = tracked_quest.get(i).getAsJsonObject();
            String id = item.get("id").getAsString();
            boolean active = item.get("active").getAsBoolean();
            JsonArray cond = item.getAsJsonArray("cond");
        }
        return KcaUtils.joinStr(all_code, "");
    }

    public void initExpScore() {
        Date currentTime = getJapanCalendarInstance().getTime();
        SimpleDateFormat df = getJapanSimpleDataFormat("yy-MM-dd-HH");
        String time = df.format(currentTime);

        String prevTime = getValue(DB_KEY_EXPTIME);
        if (prevTime == null) {
            putValue(DB_KEY_EXPTIME, time);
// Path: app/src/main/java/com/antest1/kcanotify/KcaApiData.java
// public static JsonObject kcQuestInfoData = new JsonObject();
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String DB_KEY_EXPCRNT = "key_expcrnt";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String DB_KEY_EXPTDAY = "key_exptday";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String DB_KEY_EXPTIME = "key_exptime";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String DB_KEY_QUESTNCHK = "key_questnchk";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String DB_KEY_SHIPIFNO = "key_shipinfo";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String ERROR_TYPE_DB = "D";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String ERROR_TYPE_VPN = "V";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final int KCANOTIFY_QTDB_VERSION = 3;
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static Calendar getJapanCalendarInstance() {
//     Calendar c = Calendar.getInstance(TimeZone.getTimeZone("Asia/Tokyo"), Locale.JAPAN);
//     c.setFirstDayOfWeek(Calendar.MONDAY);
//     return c;
// }
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static SimpleDateFormat getJapanSimpleDataFormat(String format) {
//     SimpleDateFormat dateFormat = new SimpleDateFormat(format, Locale.US);
//     dateFormat.setTimeZone(TimeZone.getTimeZone("Asia/Tokyo"));
//     return dateFormat;
// }
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static String getStringFromException(Exception ex) {
//     StringWriter errors = new StringWriter();
//     ex.printStackTrace(new PrintWriter(errors));
//     return errors.toString().replaceAll("\n", " / ").replaceAll("\t", "");
// }


// Path: app/src/main/java/com/antest1/kcanotify/KcaDBHelper.java
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteStatement;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonPrimitive;
import com.google.gson.stream.JsonReader;
import org.json.JSONObject;
import java.io.StringReader;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
import static android.R.attr.timeZone;
import static android.R.attr.value;
import static android.icu.lang.UCharacter.GraphemeClusterBreak.L;
import static com.antest1.kcanotify.KcaApiData.kcQuestInfoData;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_EXPCRNT;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_EXPTDAY;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_EXPTIME;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_QUESTNCHK;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_SHIPIFNO;
import static com.antest1.kcanotify.KcaConstants.ERROR_TYPE_DB;
import static com.antest1.kcanotify.KcaConstants.ERROR_TYPE_VPN;
import static com.antest1.kcanotify.KcaConstants.KCANOTIFY_QTDB_VERSION;
import static com.antest1.kcanotify.KcaUtils.getJapanCalendarInstance;
import static com.antest1.kcanotify.KcaUtils.getJapanSimpleDataFormat;
import static com.antest1.kcanotify.KcaUtils.getStringFromException;

        SQLiteDatabase db = this.getWritableDatabase();
        db.delete(questlist_table_name, "KEY=?", new String[]{String.valueOf(key)});
        qt.removeQuestTrack(key, false);
    }

    public String getCurrentQuestCode() {
        List<String> all_code = new ArrayList<>();
        JsonArray api_list = getCurrentQuestList();
        for (int i = 0; i < api_list.size(); i++) {
            JsonObject api_list_item = api_list.get(i).getAsJsonObject();
            String api_no = api_list_item.get("api_no").getAsString();
        }
        JsonArray tracked_quest = qt.getQuestTrackerData();
        for (int i = 0; i < tracked_quest.size(); i++) {
            JsonObject item = tracked_quest.get(i).getAsJsonObject();
            String id = item.get("id").getAsString();
            boolean active = item.get("active").getAsBoolean();
            JsonArray cond = item.getAsJsonArray("cond");
        }
        return KcaUtils.joinStr(all_code, "");
    }

    public void initExpScore() {
        Date currentTime = getJapanCalendarInstance().getTime();
        SimpleDateFormat df = getJapanSimpleDataFormat("yy-MM-dd-HH");
        String time = df.format(currentTime);

        String prevTime = getValue(DB_KEY_EXPTIME);
        if (prevTime == null) {
            putValue(DB_KEY_EXPTIME, time);
            putValue(DB_KEY_EXPCRNT, "0");