// Path: app/src/main/java/com/antest1/kcanotify/KcaApiData.java
// public static void loadTranslationData(Context context) {
//     loadTranslationData(context, false);
// }
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String DB_KEY_BATTLEINFO = "key_battleinfo";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String DB_KEY_LATESTDEV = "key_latestdev";
// 
// 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 KCA_MSG_BATTLE_INFO = "com.antest1.kcanotify.KcaService.KCA_MSG_BATTLE_INFO";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String KCA_MSG_BATTLE_VIEW_REFRESH = "com.antest1.kcanotify.KcaService.KCA_MSG_BATTLE_VIEW_REFRESH";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static int getId(String resourceName, Class<?> c) {
//     try {
//         Field idField = c.getDeclaredField(resourceName);
//         return idField.getInt(idField);
//     } catch (Exception e) {
//         throw new RuntimeException("No resource ID found for: "
//                 + resourceName + " / " + c, e);
//     }
// }
// 
// 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.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
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.localbroadcastmanager.content.LocalBroadcastManager;
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.ImageView;
import android.widget.TextView;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import static com.antest1.kcanotify.KcaApiData.loadTranslationData;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_BATTLEINFO;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_LATESTDEV;
import static com.antest1.kcanotify.KcaConstants.KCANOTIFY_DB_VERSION;
import static com.antest1.kcanotify.KcaConstants.KCA_MSG_BATTLE_INFO;
import static com.antest1.kcanotify.KcaConstants.KCA_MSG_BATTLE_VIEW_REFRESH;
import static com.antest1.kcanotify.KcaUtils.getId;
import static com.antest1.kcanotify.KcaUtils.getWindowLayoutType;
            JsonObject data = null;
            if(intent.getAction() != null && intent.getAction().equals(DEV_DATA_ACTION)) {
                data = new JsonParser().parse(intent.getExtras().getString("data")).getAsJsonObject();
            } else {
                data = dbHelper.getJsonObjectValue(DB_KEY_LATESTDEV);
            }
            if (data != null) {
                ed_time.setText(data.get("time").getAsString());
                ed_ship.setText(KcaApiData.getShipTranslation(data.get("flagship").getAsString(), false));
                if (data.has("items")) {
                    JsonArray arr = data.getAsJsonArray("items");
                    for (int i = 0; i < arr.size(); i++) {
                        setItemLayout(i+1, arr.get(i).getAsJsonObject());
                    }
                } else {
                    setSingleItemLayout(data.getAsJsonObject());
                }
            }
        }
        return super.onStartCommand(intent, flags, startId);
    }

    private void setSingleItemLayout(JsonObject data) {
        setItemLayout(1, data);
        mView.findViewById(R.id.ed_item2).setVisibility(View.GONE);
        mView.findViewById(R.id.ed_item3).setVisibility(View.GONE);
    }

    private void setItemLayout(int index, JsonObject data) {
        int typeres = 0;
// Path: app/src/main/java/com/antest1/kcanotify/KcaApiData.java
// public static void loadTranslationData(Context context) {
//     loadTranslationData(context, false);
// }
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String DB_KEY_BATTLEINFO = "key_battleinfo";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String DB_KEY_LATESTDEV = "key_latestdev";
// 
// 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 KCA_MSG_BATTLE_INFO = "com.antest1.kcanotify.KcaService.KCA_MSG_BATTLE_INFO";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String KCA_MSG_BATTLE_VIEW_REFRESH = "com.antest1.kcanotify.KcaService.KCA_MSG_BATTLE_VIEW_REFRESH";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static int getId(String resourceName, Class<?> c) {
//     try {
//         Field idField = c.getDeclaredField(resourceName);
//         return idField.getInt(idField);
//     } catch (Exception e) {
//         throw new RuntimeException("No resource ID found for: "
//                 + resourceName + " / " + c, e);
//     }
// }
// 
// 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/KcaDevelopPopupService.java
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
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.localbroadcastmanager.content.LocalBroadcastManager;
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.ImageView;
import android.widget.TextView;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import static com.antest1.kcanotify.KcaApiData.loadTranslationData;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_BATTLEINFO;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_LATESTDEV;
import static com.antest1.kcanotify.KcaConstants.KCANOTIFY_DB_VERSION;
import static com.antest1.kcanotify.KcaConstants.KCA_MSG_BATTLE_INFO;
import static com.antest1.kcanotify.KcaConstants.KCA_MSG_BATTLE_VIEW_REFRESH;
import static com.antest1.kcanotify.KcaUtils.getId;
import static com.antest1.kcanotify.KcaUtils.getWindowLayoutType;

            JsonObject data = null;
            if(intent.getAction() != null && intent.getAction().equals(DEV_DATA_ACTION)) {
                data = new JsonParser().parse(intent.getExtras().getString("data")).getAsJsonObject();
            } else {
                data = dbHelper.getJsonObjectValue(DB_KEY_LATESTDEV);
            }
            if (data != null) {
                ed_time.setText(data.get("time").getAsString());
                ed_ship.setText(KcaApiData.getShipTranslation(data.get("flagship").getAsString(), false));
                if (data.has("items")) {
                    JsonArray arr = data.getAsJsonArray("items");
                    for (int i = 0; i < arr.size(); i++) {
                        setItemLayout(i+1, arr.get(i).getAsJsonObject());
                    }
                } else {
                    setSingleItemLayout(data.getAsJsonObject());
                }
            }
        }
        return super.onStartCommand(intent, flags, startId);
    }

    private void setSingleItemLayout(JsonObject data) {
        setItemLayout(1, data);
        mView.findViewById(R.id.ed_item2).setVisibility(View.GONE);
        mView.findViewById(R.id.ed_item3).setVisibility(View.GONE);
    }

    private void setItemLayout(int index, JsonObject data) {
        int typeres = 0;
        ImageView ed_icon = mView.findViewById(getId("ed_icon" + index, R.id.class));