// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String DB_KEY_DECKPORT = "key_deckport";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final int KCANOTIFY_DB_VERSION = 5;
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String PREF_KCA_SEEK_CN = "kca_seek_cn";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final int SEEK_PURE = 0;
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static Context getContextWithLocale(Context ac, Context bc) {
//     Locale locale;
//     String[] pref_locale = getStringPreferences(ac, PREF_KCA_LANGUAGE).split("-");
//     if (pref_locale[0].toLowerCase().equals("default") || pref_locale.length < 2) {
//         locale = Locale.getDefault();
//     } else {
//         locale = new Locale(pref_locale[0], pref_locale[1]);
//     }
//     Configuration configuration = new Configuration(ac.getResources().getConfiguration());
//     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
//         configuration.setLocale(locale);
//         return bc.createConfigurationContext(configuration);
//     } else {
//         configuration.locale = locale;
//         DisplayMetrics metrics = new DisplayMetrics();
//         bc.getResources().updateConfiguration(configuration, bc.getResources().getDisplayMetrics());
//         return bc;
//     }
// }
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static String getStringPreferences(Context ctx, String key) {
//     SharedPreferences pref = ctx.getSharedPreferences("pref", Context.MODE_PRIVATE);
//     try {
//         return String.valueOf(pref.getInt(key, 0));
//     } catch (Exception e) {
//         // Nothing to do
//     }
//     return pref.getString(key, "");
// }
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static int getWindowLayoutType() {
//     int windowLayoutType = -1;
//     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//         windowLayoutType = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
//     } else {
//         windowLayoutType = WindowManager.LayoutParams.TYPE_PHONE;
//     }
//     return windowLayoutType;
// }


import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.os.Build;
import android.os.IBinder;
import android.provider.Settings;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.content.ContextCompat;
import android.util.Log;
import android.view.Display;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import java.util.Calendar;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_DECKPORT;
import static com.antest1.kcanotify.KcaConstants.KCANOTIFY_DB_VERSION;
import static com.antest1.kcanotify.KcaConstants.PREF_KCA_SEEK_CN;
import static com.antest1.kcanotify.KcaConstants.SEEK_PURE;
import static com.antest1.kcanotify.KcaUtils.getContextWithLocale;
import static com.antest1.kcanotify.KcaUtils.getStringPreferences;
import static com.antest1.kcanotify.KcaUtils.getWindowLayoutType;
                        double seekValue_4 = deckInfoCalc.getSeekValue(portdeckdata, target_str, 4, KcaBattle.getEscapeFlag());

                        int[] tp = deckInfoCalc.getTPValue(portdeckdata, target_str, KcaBattle.getEscapeFlag());
                        fchk_info.setText(KcaUtils.format(getStringWithLocale(R.string.fleetcheckview_content_seeklos),
                                seekValue_0, seekValue_1, seekValue_2, seekValue_3, seekValue_4, tp[0], tp[1]));
                        break;
                    case FCHK_FUNC_AIRBATTLE:
                        int[] airPowerRange = deckInfoCalc.getAirPowerRange(portdeckdata, target, KcaBattle.getEscapeFlag());
                        JsonObject contact = deckInfoCalc.getContactProb(portdeckdata, target_str, KcaBattle.getEscapeFlag());
                        double start_rate_1 = contact.getAsJsonArray("stage1").get(0).getAsDouble() * 100;
                        double select_rate_1 = contact.getAsJsonArray("stage2").get(0).getAsDouble() * 100;
                        double start_rate_2 = contact.getAsJsonArray("stage1").get(1).getAsDouble() * 100;
                        double select_rate_2 = contact.getAsJsonArray("stage2").get(1).getAsDouble() * 100;
                        fchk_info.setText(KcaUtils.format(getStringWithLocale(R.string.fleetcheckview_content_airbattle),
                                airPowerRange[0], airPowerRange[1], start_rate_1, select_rate_1, start_rate_2, select_rate_2));
                        break;
                    case FCHK_FUNC_FUELBULL:
                        fchk_info.setText("fuel_bull");
                        break;
                    default:
                        fchk_info.setText("");
                        break;
                }
            } else {
                fchk_info.setText("data not loaded");
            }
        }
    }

    private int getSeekCn() {
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String DB_KEY_DECKPORT = "key_deckport";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final int KCANOTIFY_DB_VERSION = 5;
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String PREF_KCA_SEEK_CN = "kca_seek_cn";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final int SEEK_PURE = 0;
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static Context getContextWithLocale(Context ac, Context bc) {
//     Locale locale;
//     String[] pref_locale = getStringPreferences(ac, PREF_KCA_LANGUAGE).split("-");
//     if (pref_locale[0].toLowerCase().equals("default") || pref_locale.length < 2) {
//         locale = Locale.getDefault();
//     } else {
//         locale = new Locale(pref_locale[0], pref_locale[1]);
//     }
//     Configuration configuration = new Configuration(ac.getResources().getConfiguration());
//     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
//         configuration.setLocale(locale);
//         return bc.createConfigurationContext(configuration);
//     } else {
//         configuration.locale = locale;
//         DisplayMetrics metrics = new DisplayMetrics();
//         bc.getResources().updateConfiguration(configuration, bc.getResources().getDisplayMetrics());
//         return bc;
//     }
// }
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static String getStringPreferences(Context ctx, String key) {
//     SharedPreferences pref = ctx.getSharedPreferences("pref", Context.MODE_PRIVATE);
//     try {
//         return String.valueOf(pref.getInt(key, 0));
//     } catch (Exception e) {
//         // Nothing to do
//     }
//     return pref.getString(key, "");
// }
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static int getWindowLayoutType() {
//     int windowLayoutType = -1;
//     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//         windowLayoutType = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
//     } else {
//         windowLayoutType = WindowManager.LayoutParams.TYPE_PHONE;
//     }
//     return windowLayoutType;
// }


// Path: app/src/main/java/com/antest1/kcanotify/KcaFleetCheckPopupService.java
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.os.Build;
import android.os.IBinder;
import android.provider.Settings;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.content.ContextCompat;
import android.util.Log;
import android.view.Display;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import java.util.Calendar;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_DECKPORT;
import static com.antest1.kcanotify.KcaConstants.KCANOTIFY_DB_VERSION;
import static com.antest1.kcanotify.KcaConstants.PREF_KCA_SEEK_CN;
import static com.antest1.kcanotify.KcaConstants.SEEK_PURE;
import static com.antest1.kcanotify.KcaUtils.getContextWithLocale;
import static com.antest1.kcanotify.KcaUtils.getStringPreferences;
import static com.antest1.kcanotify.KcaUtils.getWindowLayoutType;

                        double seekValue_4 = deckInfoCalc.getSeekValue(portdeckdata, target_str, 4, KcaBattle.getEscapeFlag());

                        int[] tp = deckInfoCalc.getTPValue(portdeckdata, target_str, KcaBattle.getEscapeFlag());
                        fchk_info.setText(KcaUtils.format(getStringWithLocale(R.string.fleetcheckview_content_seeklos),
                                seekValue_0, seekValue_1, seekValue_2, seekValue_3, seekValue_4, tp[0], tp[1]));
                        break;
                    case FCHK_FUNC_AIRBATTLE:
                        int[] airPowerRange = deckInfoCalc.getAirPowerRange(portdeckdata, target, KcaBattle.getEscapeFlag());
                        JsonObject contact = deckInfoCalc.getContactProb(portdeckdata, target_str, KcaBattle.getEscapeFlag());
                        double start_rate_1 = contact.getAsJsonArray("stage1").get(0).getAsDouble() * 100;
                        double select_rate_1 = contact.getAsJsonArray("stage2").get(0).getAsDouble() * 100;
                        double start_rate_2 = contact.getAsJsonArray("stage1").get(1).getAsDouble() * 100;
                        double select_rate_2 = contact.getAsJsonArray("stage2").get(1).getAsDouble() * 100;
                        fchk_info.setText(KcaUtils.format(getStringWithLocale(R.string.fleetcheckview_content_airbattle),
                                airPowerRange[0], airPowerRange[1], start_rate_1, select_rate_1, start_rate_2, select_rate_2));
                        break;
                    case FCHK_FUNC_FUELBULL:
                        fchk_info.setText("fuel_bull");
                        break;
                    default:
                        fchk_info.setText("");
                        break;
                }
            } else {
                fchk_info.setText("data not loaded");
            }
        }
    }

    private int getSeekCn() {
        return Integer.valueOf(getStringPreferences(getApplicationContext(), PREF_KCA_SEEK_CN));