// 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;
package com.zsorg.neteasecloudmusic.models;




/**
 * Project:NeteaseCloudMusic
 *
 * @Author: piyel_000
 * Created on 2017/1/31.
 * E-mail:piyell@qq.com
 */

public class ConfigModel implements IConfigModel{

    private static ConfigModel mModel;
    private final SoftReference<Context> mContext;

    List<ConfigBean> mList;
    private final SharedPreferences mSP;
    private final String[] orders;
    private int mMusicOrder;
    private ConfigCallback callback;

    @Override
    public List<ConfigBean> getConfigList() {
        return mList;
    }

    public void setMusicOrder(int musicOrder) {
        mList.get(0).setItemRight(orders[musicOrder]);
        mMusicOrder = musicOrder;
        SharedPreferences.Editor edit = mSP.edit();
// 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;

package com.zsorg.neteasecloudmusic.models;




/**
 * Project:NeteaseCloudMusic
 *
 * @Author: piyel_000
 * Created on 2017/1/31.
 * E-mail:piyell@qq.com
 */

public class ConfigModel implements IConfigModel{

    private static ConfigModel mModel;
    private final SoftReference<Context> mContext;

    List<ConfigBean> mList;
    private final SharedPreferences mSP;
    private final String[] orders;
    private int mMusicOrder;
    private ConfigCallback callback;

    @Override
    public List<ConfigBean> getConfigList() {
        return mList;
    }

    public void setMusicOrder(int musicOrder) {
        mList.get(0).setItemRight(orders[musicOrder]);
        mMusicOrder = musicOrder;
        SharedPreferences.Editor edit = mSP.edit();
        edit.putInt(CONST.SP_MUSIC_ORDER, musicOrder);