// Path: app/src/main/java/nich/work/aequorea/common/Constants.java
// public class Constants {
//     public static final String AUTHOR = "author";
//     public static final String TAG = "tag";
//     public static final String ARTICLE_ID = "article_id";
//     public static final String AUTHOR_ID = "author_id";
//     public static final String TAG_ID = "tag_id";
//     public static final String SEARCH_KEY = "search_key";
//     public static final String PHOTO = "photo";
//     public static final String ARG_URL = "arg_url";
//     
//     // Article Type
//     public static final String ARTICLE_TYPE_MAGAZINE = "magazine_article"; // 封面故事
//     public static final String ARTICLE_TYPE_MAGAZINE_V2 = "magazine"; // 封面故事
//     public static final String ARTICLE_TYPE_NORMAL = "normal_article"; // 一般文章
//     public static final String ARTICLE_TYPE_NORMAL_V2 = "normal"; // 一般文章
//     public static final String ARTICLE_TYPE_THEME = "theme"; // 专题
//     public static final String ARTICLE_TYPE_TOP_ARTICLE = "top_article"; // 头条故事
//     public static final String ARTICLE_TYPE_SUBJECT = "subject"; // 单行本
// 
// 
//     public static final int TYPE_MAGAZINE = 1;
//     public static final int TYPE_NORMAL = 2;
//     public static final int TYPE_THEME = 3;
//     public static final int TYPE_TOP_ARTICLE = 4;
//     public static final int TYPE_SUBJECT = 5;
//     
//     // Theme
//     public static final String THEME = "theme";
//     public static final String THEME_LIGHT = "theme_light";
//     public static final String THEME_DARK = "theme_dark";
//     
//     // Trigger
//     public static final int AUTO_LOAD_TRIGGER = 30;
//     
//     // Key of SharePreference
//     public static final String SP_LATEST_MAIN_PAGE = "sp_latest_main_page";
//     public static final String SP_HD_SCREENSHOT = "sp_hd_screenshot";
//     public static final String SP_ENABLE_SELECTION = "sp_enable_selection";
//     public static final String SP_OFFLINE_CACHE = "sp_offline_cache";
//     public static final String SP_DISABLE_RECOMMEND_ARTICLE = "sp_disable_recommend_article";
//     
//     // Cache dir
//     public static final String ARTICLE_CACHE = "article_cache";
//     public static final String ARTICLE_PIC_CACHE = "article_pic_cache";
// }
// 
// Path: app/src/main/java/nich/work/aequorea/common/utils/SPUtils.java
// public class SPUtils {
//     private static SharedPreferences mSp;
//     
//     private static SharedPreferences getSp() {
//         if (mSp == null) {
//             mSp = Aequorea.getApp().getSharedPreferences("Aequorea", Context.MODE_PRIVATE);
//         }
//         return mSp;
//     }
//     
//     public static void setString(String key, String value) {
//         getSp().edit().putString(key, value).apply();
//     }
//     
//     public static String getString(String key) {
//         return getSp().getString(key, "");
//     }
//     
//     public static String getString(String key, String defaultValue) {
//         return getSp().getString(key, defaultValue);
//     }
//     
//     public static void setInt(String key, int value) {
//         getSp().edit().putInt(key, value).apply();
//     }
//     
//     public static int getInt(String key) {
//         return getSp().getInt(key, 0);
//     }
//     
//     public static int getInt(String key, int defaultValue) {
//         return getSp().getInt(key, defaultValue);
//     }
//     
//     public static void setBoolean(String key, boolean value) {
//         getSp().edit().putBoolean(key, value).apply();
//     }
//     
//     public static boolean getBoolean(String key) {
//         return getSp().getBoolean(key, false);
//     }
// }


import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.annotation.AttrRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatCheckBox;
import nich.work.aequorea.R;
import nich.work.aequorea.common.Constants;
import nich.work.aequorea.common.utils.SPUtils;
    }
    
    public ACheckBox(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        
        View.inflate(context, R.layout.layout_custom_checkbox, this);
        init(context, attrs);
        setOnClickListener(this);
    }
    
    private void init(Context context, AttributeSet attrs) {
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ACheckBox);
        String title = typedArray.getString(R.styleable.ACheckBox_title);
        String summary = typedArray.getString(R.styleable.ACheckBox_summary);
        
        mCheckBox = findViewById(R.id.cb);
        mTitle = findViewById(R.id.tv_title);
        mSummary =findViewById(R.id.tv_summary);
    
        mTitle.setText(title);
        mSummary.setText(summary);
        
        typedArray.recycle();
    }
    
    @Override
    public void onClick(View view) {
        if (mKey != null) {
            boolean checked = !mCheckBox.isChecked();
            mCheckBox.setChecked(checked);
// Path: app/src/main/java/nich/work/aequorea/common/Constants.java
// public class Constants {
//     public static final String AUTHOR = "author";
//     public static final String TAG = "tag";
//     public static final String ARTICLE_ID = "article_id";
//     public static final String AUTHOR_ID = "author_id";
//     public static final String TAG_ID = "tag_id";
//     public static final String SEARCH_KEY = "search_key";
//     public static final String PHOTO = "photo";
//     public static final String ARG_URL = "arg_url";
//     
//     // Article Type
//     public static final String ARTICLE_TYPE_MAGAZINE = "magazine_article"; // 封面故事
//     public static final String ARTICLE_TYPE_MAGAZINE_V2 = "magazine"; // 封面故事
//     public static final String ARTICLE_TYPE_NORMAL = "normal_article"; // 一般文章
//     public static final String ARTICLE_TYPE_NORMAL_V2 = "normal"; // 一般文章
//     public static final String ARTICLE_TYPE_THEME = "theme"; // 专题
//     public static final String ARTICLE_TYPE_TOP_ARTICLE = "top_article"; // 头条故事
//     public static final String ARTICLE_TYPE_SUBJECT = "subject"; // 单行本
// 
// 
//     public static final int TYPE_MAGAZINE = 1;
//     public static final int TYPE_NORMAL = 2;
//     public static final int TYPE_THEME = 3;
//     public static final int TYPE_TOP_ARTICLE = 4;
//     public static final int TYPE_SUBJECT = 5;
//     
//     // Theme
//     public static final String THEME = "theme";
//     public static final String THEME_LIGHT = "theme_light";
//     public static final String THEME_DARK = "theme_dark";
//     
//     // Trigger
//     public static final int AUTO_LOAD_TRIGGER = 30;
//     
//     // Key of SharePreference
//     public static final String SP_LATEST_MAIN_PAGE = "sp_latest_main_page";
//     public static final String SP_HD_SCREENSHOT = "sp_hd_screenshot";
//     public static final String SP_ENABLE_SELECTION = "sp_enable_selection";
//     public static final String SP_OFFLINE_CACHE = "sp_offline_cache";
//     public static final String SP_DISABLE_RECOMMEND_ARTICLE = "sp_disable_recommend_article";
//     
//     // Cache dir
//     public static final String ARTICLE_CACHE = "article_cache";
//     public static final String ARTICLE_PIC_CACHE = "article_pic_cache";
// }
// 
// Path: app/src/main/java/nich/work/aequorea/common/utils/SPUtils.java
// public class SPUtils {
//     private static SharedPreferences mSp;
//     
//     private static SharedPreferences getSp() {
//         if (mSp == null) {
//             mSp = Aequorea.getApp().getSharedPreferences("Aequorea", Context.MODE_PRIVATE);
//         }
//         return mSp;
//     }
//     
//     public static void setString(String key, String value) {
//         getSp().edit().putString(key, value).apply();
//     }
//     
//     public static String getString(String key) {
//         return getSp().getString(key, "");
//     }
//     
//     public static String getString(String key, String defaultValue) {
//         return getSp().getString(key, defaultValue);
//     }
//     
//     public static void setInt(String key, int value) {
//         getSp().edit().putInt(key, value).apply();
//     }
//     
//     public static int getInt(String key) {
//         return getSp().getInt(key, 0);
//     }
//     
//     public static int getInt(String key, int defaultValue) {
//         return getSp().getInt(key, defaultValue);
//     }
//     
//     public static void setBoolean(String key, boolean value) {
//         getSp().edit().putBoolean(key, value).apply();
//     }
//     
//     public static boolean getBoolean(String key) {
//         return getSp().getBoolean(key, false);
//     }
// }


// Path: app/src/main/java/nich/work/aequorea/common/ui/widget/ACheckBox.java
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.annotation.AttrRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatCheckBox;
import nich.work.aequorea.R;
import nich.work.aequorea.common.Constants;
import nich.work.aequorea.common.utils.SPUtils;

    }
    
    public ACheckBox(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        
        View.inflate(context, R.layout.layout_custom_checkbox, this);
        init(context, attrs);
        setOnClickListener(this);
    }
    
    private void init(Context context, AttributeSet attrs) {
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ACheckBox);
        String title = typedArray.getString(R.styleable.ACheckBox_title);
        String summary = typedArray.getString(R.styleable.ACheckBox_summary);
        
        mCheckBox = findViewById(R.id.cb);
        mTitle = findViewById(R.id.tv_title);
        mSummary =findViewById(R.id.tv_summary);
    
        mTitle.setText(title);
        mSummary.setText(summary);
        
        typedArray.recycle();
    }
    
    @Override
    public void onClick(View view) {
        if (mKey != null) {
            boolean checked = !mCheckBox.isChecked();
            mCheckBox.setChecked(checked);
            if (!mKey.equals(Constants.THEME)) {