From 82cc6c94fdc08b1814fbf7195e88cf335eed3e8d Mon Sep 17 00:00:00 2001 From: haijiang <181069201@qq.com> Date: Wed, 19 Sep 2018 14:00:15 +0800 Subject: [PATCH] 提交 --- app/src/main/java/com/moral/yunfushao/fragment/FragmentSettings.java | 74 ++++++++++++++++++++++++++++++++++++ 1 files changed, 73 insertions(+), 1 deletions(-) diff --git a/app/src/main/java/com/moral/yunfushao/fragment/FragmentSettings.java b/app/src/main/java/com/moral/yunfushao/fragment/FragmentSettings.java index cb7a3c5..585a957 100644 --- a/app/src/main/java/com/moral/yunfushao/fragment/FragmentSettings.java +++ b/app/src/main/java/com/moral/yunfushao/fragment/FragmentSettings.java @@ -6,16 +6,19 @@ import android.support.v7.widget.SwitchCompat; import android.view.View; import android.widget.Button; +import android.widget.CompoundButton; import android.widget.RelativeLayout; import android.widget.TextView; import com.bigkoo.pickerview.OptionsPickerView; import com.lzy.okgo.cache.CacheMode; import com.moral.andbrickslib.utils.ActivityManager; +import com.moral.andbrickslib.utils.FastJsonTools; import com.moral.yunfushao.MainActivity; import com.moral.yunfushao.MainApp; import com.moral.yunfushao.R; import com.moral.yunfushao.activity.LoginActivity; +import com.moral.yunfushao.activity.TestActivity; import com.moral.yunfushao.activity.VoiceSetActivity; import com.moral.yunfushao.base.BaseFragment; import com.moral.yunfushao.common.API; @@ -23,6 +26,8 @@ import com.moral.yunfushao.httputils.HttpCallBack; import com.moral.yunfushao.httputils.HttpUtils; import com.moral.yunfushao.model.EventMessage; +import com.moral.yunfushao.model.VoiceBean; +import com.moral.yunfushao.utils.DebugUtils; import org.greenrobot.eventbus.EventBus; @@ -39,7 +44,8 @@ private TextView tv_version; private RelativeLayout rl_setvoice,rl_refresh; private Button bt_sure; - private SwitchCompat sc_open; + private Button bt_look; + private SwitchCompat sc_open,sc_male; private int refreshIndex=0; @Override protected int getLayoutId() { @@ -51,9 +57,21 @@ rl_setvoice = findView(R.id.rl_setvoice); rl_refresh = findView(R.id.rl_refresh); bt_sure = findView(R.id.bt_sure); + bt_look = findView(R.id.bt_look); sc_open = findView(R.id.sc_open); + sc_male = findView(R.id.sc_male); tv_version = findView(R.id.tv_version); tv_version.setText("������������V"+getVersion()); + +// bt_look.setVisibility(DebugUtils.debug_mode ? View.VISIBLE : View.GONE); + bt_look.setVisibility(View.GONE); + if (MainApp.theApp.sharedPreferencesUtil.getVoiceType() == 0) { + sc_male.setChecked(false); + sc_male.setText("���"); + }else{ + sc_male.setChecked(true); + sc_male.setText("���"); + } } @Override @@ -69,6 +87,33 @@ }else{ update("is_open_upload","0"); } + } + }); + sc_male.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean b) { + if(b){ + sc_male.setText("���"); + MainApp.theApp.sharedPreferencesUtil.saveVoiceType(1); + AppConfig.voideUrl1 = "http://yfsapi.7drlb.com/video/girl/music.mp3"; + AppConfig.voideUrl2 = "http://yfsapi.7drlb.com/video/girl/music1.mp3"; + AppConfig.voideUrl3 = "http://yfsapi.7drlb.com/video/girl/music2.mp3"; + }else{ + sc_male.setText("���"); + MainApp.theApp.sharedPreferencesUtil.saveVoiceType(0); + AppConfig.voideUrl1 = "http://yfsapi.7drlb.com/video/boy/music.mp3"; + AppConfig.voideUrl2 = "http://yfsapi.7drlb.com/video/boy/music1.mp3"; + AppConfig.voideUrl3 = "http://yfsapi.7drlb.com/video/boy/music2.mp3"; + } + reset(); + } + }); + + bt_look.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent = new Intent(getActivity(), TestActivity.class); + startActivity(intent); } }); } @@ -194,4 +239,31 @@ return "1.0"; } } + + private ArrayList<VoiceBean> voiceList = new ArrayList<>(); + private void reset() { + voiceList.clear(); + VoiceBean voiceBean = new VoiceBean(); + voiceBean.setId(0); + voiceBean.setRes(AppConfig.voideUrl1); + voiceBean.setName("������������������"); + voiceBean.setVoiceName("������"); + voiceList.add(voiceBean); + voiceBean = new VoiceBean(); + voiceBean.setId(1); + voiceBean.setRes(AppConfig.voideUrl2); + voiceBean.setName("������������������"); + voiceBean.setVoiceName("������"); + voiceList.add(voiceBean); + voiceBean = new VoiceBean(); + voiceBean.setId(2); + voiceBean.setRes(AppConfig.voideUrl3); + voiceBean.setName("������������������"); + voiceBean.setVoiceName("������"); + voiceList.add(voiceBean); + MainApp.theApp.sharedPreferencesUtil.saveVideoList(FastJsonTools.toJson(voiceList)); + EventMessage eventMessage = new EventMessage(); + eventMessage.setType(AppConfig.SET_VOICE); + EventBus.getDefault().post(eventMessage); + } } -- Gitblit v1.8.0