陈奇
2018-11-26 50aacfed3ceb60997c2c9a4cc0f9e6fe6b5ed718
app/src/main/java/com/moral/yunfushao/activity/VoiceSetActivity.java
@@ -20,7 +20,6 @@
import com.moral.yunfushao.R;
import com.moral.yunfushao.adapter.VoiceAdapter;
import com.moral.yunfushao.base.BaseListActivity;
import com.moral.yunfushao.ble.BLECommon;
import com.moral.yunfushao.common.API;
import com.moral.yunfushao.common.AppConfig;
import com.moral.yunfushao.httputils.HttpCallBack;
@@ -46,6 +45,7 @@
    MediaPlayer mp;
    private MaterialDialog resetDialog;
    private int oldType = 0;
    private void showReset() {
        resetDialog = MaterialDialogUtils.showCallBaclDialog(this, "温馨提示", "是否重置为默认铃声?", new MaterialDialog.SingleButtonCallback() {
@@ -101,6 +101,8 @@
                MainApp.theApp.sharedPreferencesUtil.saveVideoList(FastJsonTools.toJson(voiceList));
                adapter.notifyDataSetChanged();
                mToatUtils.showSingleLongToast("铃声设置成功");
                oldType = MainApp.theApp.sharedPreferencesUtil.getVoiceType();
                MainApp.theApp.sharedPreferencesUtil.saveVoiceType(3);
                EventMessage eventMessage = new EventMessage();
                eventMessage.setType(AppConfig.SET_VOICE);
                EventBus.getDefault().post(eventMessage);
@@ -184,8 +186,10 @@
                adapter.notifyDataSetChanged();
            }
            if (voiceBean.isDefaultMusic()) {
                mp = MediaPlayer.create(this, Uri.parse(voiceBean.getRes()));
                mp.start();
                if (voiceBean.getRes() != null) {
                    mp = MediaPlayer.create(this, Uri.parse(voiceBean.getRes()));
                    mp.start();
                }
            } else {
                mp = new MediaPlayer();
                try {
@@ -269,6 +273,7 @@
        voiceBean.setVoiceName("默认");
        voiceList.add(voiceBean);
        MainApp.theApp.sharedPreferencesUtil.saveVideoList(FastJsonTools.toJson(voiceList));
        MainApp.theApp.sharedPreferencesUtil.saveVoiceType(oldType);
        adapter.notifyDataSetChanged();
        EventMessage eventMessage = new EventMessage();
        eventMessage.setType(AppConfig.SET_VOICE);