// Path: app/src/main/java/com/antest1/kcanotify/KcaApiData.java
// public static final int[] T3LIST_IMPROVABLE = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 23, 24, 30, 31, 34, 36, 37, 38, 42, 43, 44, 46};
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String PREF_AKASHI_FILTERLIST = "akashi_filterlist";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String PREF_KCA_LANGUAGE = "kca_language";
// 
// 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 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 String joinStr(List<String> list, String delim) {
//     String resultStr = "";
//     if (list.size() > 0) {
//         int i;
//         for (i = 0; i < list.size() - 1; i++) {
//             resultStr = resultStr.concat(list.get(i));
//             resultStr = resultStr.concat(delim);
//         }
//         resultStr = resultStr.concat(list.get(i));
//     }
//     return resultStr;
// }
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static void setPreferences(Context ctx, String key, Object value) {
//     SharedPreferences pref = ctx.getSharedPreferences("pref", Context.MODE_PRIVATE);
//     SharedPreferences.Editor editor = pref.edit();
//     if (value instanceof String) {
//         editor.putString(key, (String) value);
//     } else if (value instanceof Boolean) {
//         editor.putBoolean(key, (Boolean) value);
//     } else if (value instanceof Integer) {
//         editor.putString(key, String.valueOf(value));
//     } else {
//         editor.putString(key, value.toString());
//     }
//     editor.commit();
// }


import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import static com.antest1.kcanotify.KcaApiData.T3LIST_IMPROVABLE;
import static com.antest1.kcanotify.KcaConstants.PREF_AKASHI_FILTERLIST;
import static com.antest1.kcanotify.KcaConstants.PREF_KCA_LANGUAGE;
import static com.antest1.kcanotify.KcaUtils.getId;
import static com.antest1.kcanotify.KcaUtils.getStringPreferences;
import static com.antest1.kcanotify.KcaUtils.joinStr;
import static com.antest1.kcanotify.KcaUtils.setPreferences;
    private String addFiltered(String data, int id) {
        return data.concat(String.valueOf(id)).concat("|");
    }

    private String deleteFiltered(String data, int id) {
        return data.replace(KcaUtils.format("|%d|",id), "|");
    }

    private void setEquipButton() {
        String filter = getStringPreferences(getApplicationContext(), PREF_AKASHI_FILTERLIST);
        for(int type: T3LIST_IMPROVABLE) {
            int btnId = getId("akashi_filter_equip_btn_".concat(String.valueOf(type)), R.id.class);
            ImageView btnView = (ImageView) findViewById(btnId);
            if(checkFiltered(filter, type)) {
                btnView.setBackground(ContextCompat.getDrawable(this, R.drawable.imagebtn_off));
            } else {
                btnView.setBackground(ContextCompat.getDrawable(this, R.drawable.imagebtn_on));
            }
        }
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            Log.e("KCA", "lang: " + newConfig.getLocales().get(0).getLanguage() + " " + newConfig.getLocales().get(0).getCountry());
            KcaApplication.defaultLocale = newConfig.getLocales().get(0);
        } else {
            Log.e("KCA", "lang: " + newConfig.locale.getLanguage() + " " + newConfig.locale.getCountry());
            KcaApplication.defaultLocale = newConfig.locale;
        }
// Path: app/src/main/java/com/antest1/kcanotify/KcaApiData.java
// public static final int[] T3LIST_IMPROVABLE = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 23, 24, 30, 31, 34, 36, 37, 38, 42, 43, 44, 46};
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String PREF_AKASHI_FILTERLIST = "akashi_filterlist";
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaConstants.java
// public static final String PREF_KCA_LANGUAGE = "kca_language";
// 
// 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 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 String joinStr(List<String> list, String delim) {
//     String resultStr = "";
//     if (list.size() > 0) {
//         int i;
//         for (i = 0; i < list.size() - 1; i++) {
//             resultStr = resultStr.concat(list.get(i));
//             resultStr = resultStr.concat(delim);
//         }
//         resultStr = resultStr.concat(list.get(i));
//     }
//     return resultStr;
// }
// 
// Path: app/src/main/java/com/antest1/kcanotify/KcaUtils.java
// public static void setPreferences(Context ctx, String key, Object value) {
//     SharedPreferences pref = ctx.getSharedPreferences("pref", Context.MODE_PRIVATE);
//     SharedPreferences.Editor editor = pref.edit();
//     if (value instanceof String) {
//         editor.putString(key, (String) value);
//     } else if (value instanceof Boolean) {
//         editor.putBoolean(key, (Boolean) value);
//     } else if (value instanceof Integer) {
//         editor.putString(key, String.valueOf(value));
//     } else {
//         editor.putString(key, value.toString());
//     }
//     editor.commit();
// }


// Path: app/src/main/java/com/antest1/kcanotify/AkashiFilterActivity.java
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import static com.antest1.kcanotify.KcaApiData.T3LIST_IMPROVABLE;
import static com.antest1.kcanotify.KcaConstants.PREF_AKASHI_FILTERLIST;
import static com.antest1.kcanotify.KcaConstants.PREF_KCA_LANGUAGE;
import static com.antest1.kcanotify.KcaUtils.getId;
import static com.antest1.kcanotify.KcaUtils.getStringPreferences;
import static com.antest1.kcanotify.KcaUtils.joinStr;
import static com.antest1.kcanotify.KcaUtils.setPreferences;

    private String addFiltered(String data, int id) {
        return data.concat(String.valueOf(id)).concat("|");
    }

    private String deleteFiltered(String data, int id) {
        return data.replace(KcaUtils.format("|%d|",id), "|");
    }

    private void setEquipButton() {
        String filter = getStringPreferences(getApplicationContext(), PREF_AKASHI_FILTERLIST);
        for(int type: T3LIST_IMPROVABLE) {
            int btnId = getId("akashi_filter_equip_btn_".concat(String.valueOf(type)), R.id.class);
            ImageView btnView = (ImageView) findViewById(btnId);
            if(checkFiltered(filter, type)) {
                btnView.setBackground(ContextCompat.getDrawable(this, R.drawable.imagebtn_off));
            } else {
                btnView.setBackground(ContextCompat.getDrawable(this, R.drawable.imagebtn_on));
            }
        }
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            Log.e("KCA", "lang: " + newConfig.getLocales().get(0).getLanguage() + " " + newConfig.getLocales().get(0).getCountry());
            KcaApplication.defaultLocale = newConfig.getLocales().get(0);
        } else {
            Log.e("KCA", "lang: " + newConfig.locale.getLanguage() + " " + newConfig.locale.getCountry());
            KcaApplication.defaultLocale = newConfig.locale;
        }
        if(getStringPreferences(getApplicationContext(), PREF_KCA_LANGUAGE).startsWith("default")) {