package com.sunzee.utils;

import com.sunzee.R;
import com.sunzee.base.BaseFragment;
import com.sunzee.ui.fragment.AdvanceParameterFragment;
import com.sunzee.ui.fragment.AlarmRecordFragment;
import com.sunzee.ui.fragment.DebugFragment;
import com.sunzee.ui.fragment.GeneralParameterFragment;
import com.sunzee.ui.fragment.HomepageFragment;
import com.sunzee.ui.fragment.LanguageSetFragment;
import com.sunzee.ui.fragment.OtherFragment;
import com.sunzee.ui.fragment.PasswordResetFragment;
import com.sunzee.ui.fragment.ShowMaterialFragment;
import com.sunzee.ui.fragment.StatisticsFragment;

/**
 * 主界面的page增加，使用簡單工廠模式，只需要生產方提供數據，使用者無需修改代碼。
 */
public class HomePagerSimpleFactory {
    //組合依賴
    private static HomepageFragment sHomepageFragment = new HomepageFragment();
    private static StatisticsFragment sStatisticsFragment = new StatisticsFragment();
    private static DebugFragment sDebugFragment = new DebugFragment();
    private static GeneralParameterFragment sGeneralParameterFragment = new GeneralParameterFragment();
    private static AdvanceParameterFragment sAdvanceParameterFragment = new AdvanceParameterFragment();
    private static AlarmRecordFragment sAlarmRecordFragment = new AlarmRecordFragment();
    private static LanguageSetFragment sLanguageSetFragment = new LanguageSetFragment();
    private static PasswordResetFragment sPasswordResetFragment = new PasswordResetFragment();
    private static OtherFragment sOtherFragment = new OtherFragment();
    private static ShowMaterialFragment sShowMaterialFragment = new ShowMaterialFragment();

    public static BaseFragment getFragment(int id) {
        switch (id) {
            case R.id.home:
                return sHomepageFragment;
            case R.id.data:
                return sStatisticsFragment;
            case R.id.debug:
                return sDebugFragment;
            case R.id.parameter1:
                return sGeneralParameterFragment;
            case R.id.parameter2:
                return sAdvanceParameterFragment;
            case R.id.warring:
                return sAlarmRecordFragment;
            case R.id.language:
                return sLanguageSetFragment;
            case R.id.password:
                return sPasswordResetFragment;
            case R.id.other:
                return sOtherFragment;
            case R.id.material:
                return sShowMaterialFragment;
        }
        return null;
    }
}
