// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String DB_KEY_APIMAPINFO = "key_apimapinfo";
// 
// 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 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 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.TextView;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_APIMAPINFO;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_BATTLEINFO;
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.getWindowLayoutType;
                                    if (eventitem.has("api_gauge_type")) {
                                        gauge_type = eventitem.get("api_gauge_type").getAsInt();
                                    }
                                    if (eventitem.has("api_gauge_num")) {
                                        gauge_num = eventitem.get("api_gauge_num").getAsInt();
                                    }
                                    int now_maphp = eventitem.get("api_now_maphp").getAsInt();
                                    int max_maphp = eventitem.get("api_max_maphp").getAsInt();
                                    eventhp_list.add(getMapHpStr(gauge_type, gauge_num, id, now_maphp, max_maphp));
                                }
                            } else if (item.has("api_defeat_count")) {
                                int gauge_type = item.get("api_gauge_type").getAsInt();
                                int gauge_num = item.get("api_gauge_num").getAsInt();
                                int defeat_count = item.get("api_defeat_count").getAsInt();
                                int total_count = item.get("api_required_defeat_count").getAsInt();
                                maphp_list.add(getMapHpStr(gauge_type, gauge_num, id, total_count - defeat_count, total_count));
                            }
                        }
                        for (String item : eventhp_list) {
                            content = content.concat(item).concat("\n");
                        }
                        for (String item : maphp_list) {
                            content = content.concat(item).concat("\n");
                        }
                        hp_info.setText(content.trim());
                    } else {
                        hp_info.setText("data not loaded");
                    }
                } catch (Exception e) {
                    hp_info.setText("error while processing");
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String DB_KEY_APIMAPINFO = "key_apimapinfo";
// 
// 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 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 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/KcaMapHpPopupService.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.TextView;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_APIMAPINFO;
import static com.antest1.kcanotify.KcaConstants.DB_KEY_BATTLEINFO;
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.getWindowLayoutType;

                                    if (eventitem.has("api_gauge_type")) {
                                        gauge_type = eventitem.get("api_gauge_type").getAsInt();
                                    }
                                    if (eventitem.has("api_gauge_num")) {
                                        gauge_num = eventitem.get("api_gauge_num").getAsInt();
                                    }
                                    int now_maphp = eventitem.get("api_now_maphp").getAsInt();
                                    int max_maphp = eventitem.get("api_max_maphp").getAsInt();
                                    eventhp_list.add(getMapHpStr(gauge_type, gauge_num, id, now_maphp, max_maphp));
                                }
                            } else if (item.has("api_defeat_count")) {
                                int gauge_type = item.get("api_gauge_type").getAsInt();
                                int gauge_num = item.get("api_gauge_num").getAsInt();
                                int defeat_count = item.get("api_defeat_count").getAsInt();
                                int total_count = item.get("api_required_defeat_count").getAsInt();
                                maphp_list.add(getMapHpStr(gauge_type, gauge_num, id, total_count - defeat_count, total_count));
                            }
                        }
                        for (String item : eventhp_list) {
                            content = content.concat(item).concat("\n");
                        }
                        for (String item : maphp_list) {
                            content = content.concat(item).concat("\n");
                        }
                        hp_info.setText(content.trim());
                    } else {
                        hp_info.setText("data not loaded");
                    }
                } catch (Exception e) {
                    hp_info.setText("error while processing");
                    dbHelper.putValue(DB_KEY_APIMAPINFO, (new JsonArray()).toString());