From cdbaf79d124d46b69dc62b653fde55f9d40b5534 Mon Sep 17 00:00:00 2001 From: 陈奇 <1650699704@qq.com> Date: Thu, 01 Nov 2018 17:23:32 +0800 Subject: [PATCH] [*]修改电磁版本 --- app/src/main/java/com/moral/yunfushao/fragment/FragmentSettings.java | 96 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 95 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 b3964bc..585a957 100644 --- a/app/src/main/java/com/moral/yunfushao/fragment/FragmentSettings.java +++ b/app/src/main/java/com/moral/yunfushao/fragment/FragmentSettings.java @@ -1,18 +1,24 @@ package com.moral.yunfushao.fragment; import android.content.Intent; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; 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; @@ -20,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; @@ -33,9 +41,11 @@ */ public class FragmentSettings extends BaseFragment { + 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() { @@ -47,7 +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 @@ -63,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); } }); } @@ -172,4 +223,47 @@ } }); } + + /** + * ��������������� + * @return ������������������������ + */ + public String getVersion() { + try { + PackageManager manager = getActivity().getPackageManager(); + PackageInfo info = manager.getPackageInfo(getActivity().getPackageName(), 0); + String version = info.versionName; + return version; + } catch (Exception e) { + e.printStackTrace(); + 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