| | |
| | | import android.os.Bundle; |
| | | import android.view.View; |
| | | |
| | | import com.lzy.okgo.cache.CacheMode; |
| | | import com.moral.andbrickslib.baseadapter.headandfooter.DividerItemDecoration; |
| | | import com.moral.yunfushao.MainApp; |
| | | import com.moral.yunfushao.R; |
| | | import com.moral.yunfushao.adapter.VoiceAdapter; |
| | | import com.moral.yunfushao.base.BaseListActivity; |
| | | import com.moral.yunfushao.common.API; |
| | | import com.moral.yunfushao.httputils.HttpCallBack; |
| | | import com.moral.yunfushao.httputils.HttpUtils; |
| | | import com.moral.yunfushao.model.VoiceBean; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Created by haijiang on 2017/7/12. |
| | |
| | | @Override |
| | | protected void onLoadMore() { |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void onRefresh() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void onDestroy() { |
| | | super.onDestroy(); |
| | | if(mp!=null&&mp.isPlaying()){ |
| | | mp.stop(); |
| | | mp.release(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | protected void initData() { |
| | | setNormalView(); |
| | | |
| | | int index = MainApp.theApp.sharedPreferencesUtil.getLoginInfo().getVideo(); |
| | | voiceList.get(index).setSet(true); |
| | | adapter.notifyDataSetChanged(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void setClick(int position) { |
| | | update("video",position+""); |
| | | for (VoiceBean voice :voiceList){ |
| | | voice.setSet(false); |
| | | } |
| | | VoiceBean voiceBean = voiceList.get(position); |
| | | voiceBean.setSet(true); |
| | | adapter.notifyDataSetChanged(); |
| | | } |
| | | |
| | | /** |
| | | * 字段名称,目前仅支持修改['refresh_frequency', 'video', 'is_open_upload'] |
| | | * @param field |
| | | * @param value |
| | | */ |
| | | private void update(String field, final String value) { |
| | | Map<String, String> params = new HashMap<>(); |
| | | params.put("user_id", MainApp.userId); |
| | | params.put("field", field); |
| | | params.put("value", value); |
| | | String url = API.UPDATEUSERINFO; |
| | | HttpUtils.doPost(url, params, CacheMode.DEFAULT, true, new HttpCallBack() { |
| | | @Override |
| | | public void onSuccess(String res, String msg) { |
| | | mToatUtils.showSingletonToast(msg); |
| | | MainApp.theApp.sharedPreferencesUtil.setVideo(Integer.parseInt(value)); |
| | | if (progressDialog.isShowing()) { |
| | | progressDialog.dismiss(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void showLoadingDialog() { |
| | | progressDialog.setTitleText("提交中..."); |
| | | progressDialog.show(); |
| | | } |
| | | |
| | | @Override |
| | | public void onFail(int errno,String s) { |
| | | mToatUtils.showSingletonToast(s); |
| | | if (progressDialog.isShowing()) { |
| | | progressDialog.dismiss(); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |