| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.tejia.lijin.app.ShoppingApplication; |
| | | import com.wpc.library.content.ConnectivityChangeHelper; |
| | | import com.wpc.library.recyclerviewhelper.DividerItemDecoration; |
| | | import com.wpc.library.util.NetUtils; |
| | |
| | | initView(view); |
| | | addListener(); |
| | | spkefu = getActivity().getSharedPreferences("kefurecord", Context.MODE_PRIVATE);//是否打开过客服 记录 |
| | | if (sp.getBoolean("isLogin", false)) {//登陆显示消息中心红包弹窗 |
| | | if (UserUtil.isLogin(getContext())) {//登陆显示消息中心红包弹窗 |
| | | getMSGConfig();//消息中心红包 |
| | | } |
| | | } |
| | |
| | | adapter = new MainMessageAdapter(rv_message.getContext(), mList, new IDeleteMessageListener() { |
| | | @Override |
| | | public void delete(final UserMessage msg) { |
| | | if (LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) { |
| | | ShoppingApi.deleteMsg(getContext(), UserUtil.getUid(getContext()) + "", msg.getType(), msg.getId(), new BasicTextHttpResponseHandler() { |
| | | if (LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) , true)) { |
| | | ShoppingApi.deleteMsg(getContext(), UserUtil.getUid(getContext()) , msg.getType(), msg.getId(), new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | super.onSuccessPerfect(statusCode, headers, jsonObject); |
| | |
| | | ll_request_failture = view.findViewById(R.id.ll_request_failture); |
| | | tv_no_data_hint = view.findViewById(R.id.tv_no_data_hint); |
| | | iv_no_data = view.findViewById(R.id.iv_no_data); |
| | | tv_no_data_hint.setText("还没有消息~"); |
| | | iv_no_data.setImageDrawable(getActivity().getResources().getDrawable(R.drawable.ic_no_friends)); |
| | | view.findViewById(R.id.tv_net_setting).setOnClickListener(this); |
| | | view.findViewById(R.id.tv_refresh).setOnClickListener(this); |
| | | |
| | |
| | | mChangeHelper.registerReceiver(); |
| | | getMessage(); |
| | | getUnReadMsgCount(); |
| | | boolean isLogin = sp.getBoolean("isLogin", false); |
| | | boolean isLogin = UserUtil.isLogin(getContext()); |
| | | if (!isLogin) { //判断未登陆 隐藏清空按钮和 去旧版 |
| | | if (iv_top_bar_clear.getVisibility() == View.VISIBLE | tv_top_bar_right.getVisibility() == View.VISIBLE) { |
| | | iv_top_bar_clear.setVisibility(View.GONE); |
| | |
| | | * 获取主页消息列表 |
| | | */ |
| | | private void getMessage() { |
| | | final boolean isLogin = sp.getBoolean("isLogin", false); |
| | | final boolean isLogin =UserUtil.isLogin(getContext()); |
| | | ((MainActivity) getActivity()).getMessageMain(new MainActivity.getHomeMsgListListener() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws JSONException, ParseException { |
| | |
| | | * 获取消息未读数量 |
| | | */ |
| | | private void getUnReadMsgCount() { |
| | | mPresenter.getUnReadMsgCount(mPresenter.getUID()); |
| | | mPresenter.getUnReadMsgCount(UserUtil.getUid(ShoppingApplication.application)); |
| | | } |
| | | |
| | | /** |
| | | * 一键清空未读消息 |
| | | */ |
| | | private void setAllMsgRead() { |
| | | mPresenter.setAllMsgRead(mPresenter.getUID()); |
| | | mPresenter.setAllMsgRead(UserUtil.getUid(ShoppingApplication.application)); |
| | | } |
| | | |
| | | @Override |
| | | public void onClick(View v) { |
| | | boolean isLogin = sp.getBoolean("isLogin", false); |
| | | boolean isLogin =UserUtil.isLogin(getContext()); |
| | | switch (v.getId()) { |
| | | case R.id.fl_order_notice: { |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) , true)) |
| | | return; |
| | | |
| | | if (!isLogin) {//判断登陆 |
| | |
| | | break; |
| | | } |
| | | case R.id.fl_capital_notice: { |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) , true)) |
| | | return; |
| | | if (!isLogin) {//判断登陆 |
| | | isChoice = true;//代表点击 |
| | |
| | | break; |
| | | } |
| | | case R.id.fl_account_notice: { |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) , true)) |
| | | return; |
| | | if (!isLogin) {//判断登陆 |
| | | isChoice = true;//代表点击 |
| | |
| | | break; |
| | | } |
| | | case R.id.fl_invite_notice: { |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) , true)) |
| | | return; |
| | | if (!isLogin) {//判断登陆 |
| | | isChoice = true;//代表点击 |
| | |
| | | break; |
| | | } |
| | | case R.id.fl_other_msg: { |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) , true)) |
| | | return; |
| | | if (!isLogin) {//判断登陆 |
| | | isChoice = true;//代表点击 |
| | |
| | | break; |
| | | } |
| | | case R.id.ll_critical_notice://系统消息 |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true)) |
| | | if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) , true)) |
| | | return; |
| | | if (!isLogin) {//判断登陆 |
| | | UserUtil.jumpLogin(fl_order_notice.getContext()); |
| | |
| | | * 消息中心红包 |
| | | */ |
| | | private void getMSGConfig() { |
| | | mPresenter.getMSGConfig(mPresenter.getUID()); |
| | | mPresenter.getMSGConfig(UserUtil.getUid(ShoppingApplication.application)); |
| | | } |
| | | |
| | | /** |
| | | * 展示红包等级福利提示Dialog |
| | | */ |
| | | private void showHintDialog(RedPacketHintDialog.Builder builder, final JSONObject floatImgDetail) { |
| | | final boolean isLogin = getContext().getSharedPreferences("user", Context.MODE_PRIVATE).getBoolean("isLogin", false); |
| | | final boolean isLogin = UserUtil.isLogin(getContext()); |
| | | mPresenter.showHintDialog(builder, floatImgDetail, accountLogin, isLogin); |
| | | } |
| | | |
| | |
| | | mPresenter.setMSGConfig_jumpDetailnull(builder); |
| | | } else { |
| | | String showTime = floatImgDetail.optString("showTime"); |
| | | final boolean isLogin = sp.getBoolean("isLogin", false); |
| | | final boolean isLogin = UserUtil.isLogin(getContext()); |
| | | //是否是当天当月当年 |
| | | if (showTime.equalsIgnoreCase("everyday") && mPresenter.isSameDay(new Date(System.currentTimeMillis()), new Date(sp.getLong("redPacketHintmsg", 0l)))) { |
| | | return; |