// Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
//     public static final String MUSIC_TYPE = "MUSIC_TYPE";
//     public static final int TYPE_SINGLE = 0;
//     public static final int TYPE_SINGER = 1;
//     public static final int TYPE_ALBUM = 2;
//     public static final int TYPE_FOLDER = 3;
// 
//     public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
//     public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
// 
//     public static final int DEFAULT_PLAYLIST_POSITION = 0;
//     public static final int TEMP_PLAYLIST_ID = -1;
// 
//     public static final int IMAGE_LOADED = 1;
//     public static final int IMAGE_REQUEST_LOADING = 2;
//     public static final int PLAYLIST_FAVORITE = 0;
// 
//     public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
//     public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
//     public static final int SP_MUSIC_ORDER_DEFAULT = 0;
//     public static final int MUSIC_ORDER_LIST = 0;
//     public static final int MUSIC_ORDER_SINGLE = 2;
//     public static final int MUSIC_ORDER_RANDOM = 1;
// }
// 
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/ConfigCallback.java
// public interface ConfigCallback {
//     void onMusicOrderConfigChanged(int newOrder);
//     void onIsShow60sConfigChanged(boolean isShow);
// }
// 
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/ConfigBean.java
// public class ConfigBean {
//     private String mGroupTitle;
//     private String mItemTitle;
//     private String mItemContent;
//     private String mItemRight;
//     private boolean mSwitchVisible;
//     private boolean mIsSwitchChecked;
//     private boolean mIsBottomVisible;
// 
//     public ConfigBean(String groupTitle, String itemTitle, String content, String itemRight, boolean isSwitchVisible, boolean isSwitchChecked, boolean isBottomVisible) {
//         mGroupTitle = groupTitle;
//         mItemTitle = itemTitle;
//         mItemContent = content;
//         mItemRight = itemRight;
//         mSwitchVisible = isSwitchVisible;
//         mIsSwitchChecked = isSwitchChecked;
//         mIsBottomVisible = isBottomVisible;
//     }
// 
//     public String getGroupTitle() {
//         return mGroupTitle;
//     }
// 
//     public void setGroupTitle(String mGroupTitle) {
//         this.mGroupTitle = mGroupTitle;
//     }
// 
//     public String getItemTitle() {
//         return mItemTitle;
//     }
// 
//     public void setItemTitle(String mItemTitle) {
//         this.mItemTitle = mItemTitle;
//     }
// 
//     public String getItemContent() {
//         return mItemContent;
//     }
// 
//     public void setItemContent(String mItemContent) {
//         this.mItemContent = mItemContent;
//     }
// 
//     public String getItemRight() {
//         return mItemRight;
//     }
// 
//     public void setItemRight(String mItemRight) {
//         this.mItemRight = mItemRight;
//     }
// 
//     public boolean isSwitchVisible() {
//         return mSwitchVisible;
//     }
// 
//     public void setRightVisible(boolean mRightVisible) {
//         this.mSwitchVisible = mRightVisible;
//     }
// 
//     public void setSwitchChecked(boolean isChecked) {
//         this.mIsSwitchChecked = isChecked;
//     }
// 
//     public boolean isSwitchChecked() {
//         return mIsSwitchChecked;
//     }
// 
//     public boolean isBottomVisible() {
//         return mIsBottomVisible;
//     }
// 
//     public void setIsBottomVisible(boolean mIsBottomVisible) {
//         this.mIsBottomVisible = mIsBottomVisible;
//     }
// }


import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.util.Log;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.callbacks.ConfigCallback;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.models.beans.ConfigBean;
import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.List;
        return orders[mMusicOrder];
    }

    public int getMusicOrder() {
        return mMusicOrder;
    }

    public static ConfigModel getInstance(Context context) {
        if (null == mModel) {
            synchronized (ConfigModel.class) {
                mModel = new ConfigModel(context);
            }
        }
        return mModel;
    }

    @Override
    protected void finalize() throws Throwable {
        callback = null;
        super.finalize();
        Log.e("tag", "ConfigModel finalize");
    }

    private ConfigModel(@NonNull Context context) {
        mContext = new SoftReference<Context>(context);
        mList = new ArrayList<>();
        mSP = PreferenceManager.getDefaultSharedPreferences(context);
        boolean isFilter = mSP.getBoolean(CONST.SP_IS_FILTER_60, true);
        mMusicOrder = mSP.getInt(CONST.SP_MUSIC_ORDER, CONST.SP_MUSIC_ORDER_DEFAULT);
        orders = context.getResources().getStringArray(R.array.array_music_order);
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/CONST.java
// public class CONST {
//     public static final String MUSIC_TYPE = "MUSIC_TYPE";
//     public static final int TYPE_SINGLE = 0;
//     public static final int TYPE_SINGER = 1;
//     public static final int TYPE_ALBUM = 2;
//     public static final int TYPE_FOLDER = 3;
// 
//     public static final String INTENT_PLAYLIST_ID = "INTENT_PLAYLIST_ID";
//     public static final String INTENT_PLAYLIST_POSITION = "INTENT_PLAYLIST_POSITION";
// 
//     public static final int DEFAULT_PLAYLIST_POSITION = 0;
//     public static final int TEMP_PLAYLIST_ID = -1;
// 
//     public static final int IMAGE_LOADED = 1;
//     public static final int IMAGE_REQUEST_LOADING = 2;
//     public static final int PLAYLIST_FAVORITE = 0;
// 
//     public static final String SP_IS_FILTER_60 = "SP_IS_FILTER_60";
//     public static final String SP_MUSIC_ORDER = "SP_MUSIC_ORDER";
//     public static final int SP_MUSIC_ORDER_DEFAULT = 0;
//     public static final int MUSIC_ORDER_LIST = 0;
//     public static final int MUSIC_ORDER_SINGLE = 2;
//     public static final int MUSIC_ORDER_RANDOM = 1;
// }
// 
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/callbacks/ConfigCallback.java
// public interface ConfigCallback {
//     void onMusicOrderConfigChanged(int newOrder);
//     void onIsShow60sConfigChanged(boolean isShow);
// }
// 
// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/beans/ConfigBean.java
// public class ConfigBean {
//     private String mGroupTitle;
//     private String mItemTitle;
//     private String mItemContent;
//     private String mItemRight;
//     private boolean mSwitchVisible;
//     private boolean mIsSwitchChecked;
//     private boolean mIsBottomVisible;
// 
//     public ConfigBean(String groupTitle, String itemTitle, String content, String itemRight, boolean isSwitchVisible, boolean isSwitchChecked, boolean isBottomVisible) {
//         mGroupTitle = groupTitle;
//         mItemTitle = itemTitle;
//         mItemContent = content;
//         mItemRight = itemRight;
//         mSwitchVisible = isSwitchVisible;
//         mIsSwitchChecked = isSwitchChecked;
//         mIsBottomVisible = isBottomVisible;
//     }
// 
//     public String getGroupTitle() {
//         return mGroupTitle;
//     }
// 
//     public void setGroupTitle(String mGroupTitle) {
//         this.mGroupTitle = mGroupTitle;
//     }
// 
//     public String getItemTitle() {
//         return mItemTitle;
//     }
// 
//     public void setItemTitle(String mItemTitle) {
//         this.mItemTitle = mItemTitle;
//     }
// 
//     public String getItemContent() {
//         return mItemContent;
//     }
// 
//     public void setItemContent(String mItemContent) {
//         this.mItemContent = mItemContent;
//     }
// 
//     public String getItemRight() {
//         return mItemRight;
//     }
// 
//     public void setItemRight(String mItemRight) {
//         this.mItemRight = mItemRight;
//     }
// 
//     public boolean isSwitchVisible() {
//         return mSwitchVisible;
//     }
// 
//     public void setRightVisible(boolean mRightVisible) {
//         this.mSwitchVisible = mRightVisible;
//     }
// 
//     public void setSwitchChecked(boolean isChecked) {
//         this.mIsSwitchChecked = isChecked;
//     }
// 
//     public boolean isSwitchChecked() {
//         return mIsSwitchChecked;
//     }
// 
//     public boolean isBottomVisible() {
//         return mIsBottomVisible;
//     }
// 
//     public void setIsBottomVisible(boolean mIsBottomVisible) {
//         this.mIsBottomVisible = mIsBottomVisible;
//     }
// }


// Path: app/src/main/java/com/zsorg/neteasecloudmusic/models/ConfigModel.java
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.util.Log;
import com.zsorg.neteasecloudmusic.CONST;
import com.zsorg.neteasecloudmusic.callbacks.ConfigCallback;
import com.zsorg.neteasecloudmusic.R;
import com.zsorg.neteasecloudmusic.models.beans.ConfigBean;
import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.List;

        return orders[mMusicOrder];
    }

    public int getMusicOrder() {
        return mMusicOrder;
    }

    public static ConfigModel getInstance(Context context) {
        if (null == mModel) {
            synchronized (ConfigModel.class) {
                mModel = new ConfigModel(context);
            }
        }
        return mModel;
    }

    @Override
    protected void finalize() throws Throwable {
        callback = null;
        super.finalize();
        Log.e("tag", "ConfigModel finalize");
    }

    private ConfigModel(@NonNull Context context) {
        mContext = new SoftReference<Context>(context);
        mList = new ArrayList<>();
        mSP = PreferenceManager.getDefaultSharedPreferences(context);
        boolean isFilter = mSP.getBoolean(CONST.SP_IS_FILTER_60, true);
        mMusicOrder = mSP.getInt(CONST.SP_MUSIC_ORDER, CONST.SP_MUSIC_ORDER_DEFAULT);
        orders = context.getResources().getStringArray(R.array.array_music_order);
        mList.add(new ConfigBean(getString(R.string.music), getString(R.string.music_play_order), null, orders[mMusicOrder], false, false, true));