| | |
| | | import android.graphics.drawable.AnimationDrawable; |
| | | import android.os.Bundle; |
| | | import android.provider.Settings; |
| | | |
| | | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.widget.ImageView; |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.tejia.lijin.app.ShoppingApplication; |
| | | import com.tejia.lijin.app.util.downutil.StringUtils; |
| | | import com.wpc.library.content.ConnectivityChangeHelper; |
| | | import com.wpc.library.okhttp.OkHttpUtils; |
| | |
| | | srl_user_message.setColorSchemeColors(getResources().getColor(R.color.theme)); |
| | | |
| | | String title = getIntent().getStringExtra("title"); |
| | | title= StringUtils.isNullOrEmpty(title)?"消息":title; |
| | | title = StringUtils.isNullOrEmpty(title) ? "消息" : title; |
| | | tv_middle.setText(title); |
| | | |
| | | if (title.equals("邀请消息")) { |
| | |
| | | } else if (title.equals("其它消息") || title.equals("账号消息")) { |
| | | tv_no_data_hint.setText("主人,我这里空空如也~"); |
| | | iv_no_data.setImageDrawable(getResources().getDrawable(R.drawable.ic_msg_other_null)); |
| | | }else{ |
| | | } else { |
| | | tv_no_data_hint.setText("暂无消息"); |
| | | } |
| | | |
| | | MessageCustomEvent.msgItemClick(UserMessageActivity.this, title); |
| | | mList = new ArrayList<>(); |
| | | adapter = new UserMessageAdapter(this, mList,new IDeleteMessageListener() { |
| | | adapter = new UserMessageAdapter(this, mList, new IDeleteMessageListener() { |
| | | @Override |
| | | public void delete(final UserMessage msg) { |
| | | if (LoginAndInviteStatusUtil.acessNext(getApplicationContext(), UserUtil.getUid(getApplicationContext()) + "", true)) { |
| | | ShoppingApi.deleteMsg(getApplicationContext(), UserUtil.getUid(getApplicationContext()) + "", msg.getType(), msg.getId(), new BasicTextHttpResponseHandler() { |
| | | if (LoginAndInviteStatusUtil.acessNext(getApplicationContext(), UserUtil.getUid(getApplicationContext()), true)) { |
| | | ShoppingApi.deleteMsg(getApplicationContext(), UserUtil.getUid(getApplicationContext()), msg.getType(), msg.getId(), new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | super.onSuccessPerfect(statusCode, headers, jsonObject); |
| | | if (jsonObject.optInt("code") == 0) { |
| | | for (int i = 0; i < mList.size(); i++) { |
| | | if (mList.get(i)!= null && msg.getId().equalsIgnoreCase(mList.get(i).getId()) && msg.getType().equalsIgnoreCase(mList.get(i).getType())) { |
| | | if (mList.get(i) != null && msg.getId().equalsIgnoreCase(mList.get(i).getId()) && msg.getType().equalsIgnoreCase(mList.get(i).getType())) { |
| | | mList.remove(i); |
| | | adapter.notifyDataSetChanged(); |
| | | Toast.makeText(getApplicationContext(), "删除成功", Toast.LENGTH_SHORT).show(); |
| | |
| | | |
| | | @Override |
| | | public void onNetworkUnAvailable() { |
| | | if (mList.size()==0) |
| | | if (mList.size() == 0) |
| | | requestState(3); |
| | | } |
| | | |
| | |
| | | * |
| | | */ |
| | | private void getMsgList() { |
| | | String uid = getSharedPreferences("user", MODE_PRIVATE) |
| | | .getString("uid", ""); |
| | | String type = getIntent().getStringExtra("type"); |
| | | ShoppingApi.getMsgList(this, uid, mPage + "", type, new BasicTextHttpResponseHandler() { |
| | | ShoppingApi.getMsgList(this, UserUtil.getUid(ShoppingApplication.application), mPage + "", type, new BasicTextHttpResponseHandler() { |
| | | |
| | | @Override |
| | | public void onStart() { |