消息
This commit is contained in:
@@ -496,7 +496,7 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
|||||||
// itemCommentBinding.tvInfo3.setText(dis_content.get(position).getReply());
|
// itemCommentBinding.tvInfo3.setText(dis_content.get(position).getReply());
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
if (dis_content.get(itemPosition).getReply().isEmpty()) {
|
if (TextUtils.isEmpty(dis_content.get(itemPosition).getReply())) {
|
||||||
itemCommentBinding.llHf.setVisibility(View.GONE);
|
itemCommentBinding.llHf.setVisibility(View.GONE);
|
||||||
itemCommentBinding.ll.setVisibility(View.VISIBLE);
|
itemCommentBinding.ll.setVisibility(View.VISIBLE);
|
||||||
itemCommentBinding.tvName.setText(dis_content.get(itemPosition).getNickname() + ": ");
|
itemCommentBinding.tvName.setText(dis_content.get(itemPosition).getNickname() + ": ");
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.sl.house_property.message;
|
package com.sl.house_property.message;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
@@ -18,6 +20,9 @@ import com.google.gson.Gson;
|
|||||||
import com.google.gson.internal.LinkedTreeMap;
|
import com.google.gson.internal.LinkedTreeMap;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
||||||
|
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||||
|
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
|
||||||
import com.sl.house_property.MainTabActivity;
|
import com.sl.house_property.MainTabActivity;
|
||||||
import com.sl.house_property.R;
|
import com.sl.house_property.R;
|
||||||
import com.sl.house_property.WebActivitytwo;
|
import com.sl.house_property.WebActivitytwo;
|
||||||
@@ -41,6 +46,7 @@ public class MessageFragment extends Fragment {
|
|||||||
// private int pageIndex = 0;
|
// private int pageIndex = 0;
|
||||||
private MessageAdapter adapter = null;
|
private MessageAdapter adapter = null;
|
||||||
private TextView tvTitle;
|
private TextView tvTitle;
|
||||||
|
private SmartRefreshLayout sr;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
@@ -72,7 +78,14 @@ public class MessageFragment extends Fragment {
|
|||||||
WebActivitytwo.runActivity(getContext(), adapter.getData().get(i).getTitle(), adapter.getData().get(i).getUrl());
|
WebActivitytwo.runActivity(getContext(), adapter.getData().get(i).getTitle(), adapter.getData().get(i).getUrl());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
sr = view.findViewById(R.id.sr);
|
||||||
|
sr.setOnRefreshListener(new OnRefreshListener() {
|
||||||
|
@Override
|
||||||
|
public void onRefresh(@NonNull @NotNull RefreshLayout refreshLayout) {
|
||||||
|
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -97,26 +110,35 @@ public class MessageFragment extends Fragment {
|
|||||||
mGankLoader.getMovie(ApiConfig.BASE_URL, map).subscribe(new Action1<Resultcode>() {
|
mGankLoader.getMovie(ApiConfig.BASE_URL, map).subscribe(new Action1<Resultcode>() {
|
||||||
@Override
|
@Override
|
||||||
public void call(Resultcode resultcode) {
|
public void call(Resultcode resultcode) {
|
||||||
|
sr.finishRefresh();
|
||||||
if (!(resultcode.status == 0)) {
|
if (!(resultcode.status == 0)) {
|
||||||
// getActivity().setToast(1, resultcode.msg);
|
// getActivity().setToast(1, resultcode.msg);
|
||||||
Toast.makeText(getContext(), resultcode.msg, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), resultcode.msg, Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gson gs = new Gson();
|
Gson gs = new Gson();
|
||||||
LinkedTreeMap adta = (LinkedTreeMap) resultcode.data;
|
LinkedTreeMap adta = (LinkedTreeMap) resultcode.data;
|
||||||
String s = gs.toJson(adta);
|
String s = gs.toJson(adta);
|
||||||
Log.e("json", s);
|
|
||||||
|
|
||||||
|
|
||||||
MessageEntity messageEntity = gs.fromJson(s, MessageEntity.class);
|
MessageEntity messageEntity = gs.fromJson(s, MessageEntity.class);
|
||||||
int i = Integer.parseInt(messageEntity.getMsg_count());
|
int i = Integer.parseInt(messageEntity.getMsg_count());
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
tvTitle.setText("消息(" + i + ")");
|
tvTitle.setText("消息(" + i + ")");
|
||||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
|
||||||
|
try {
|
||||||
|
MainTabActivity activity = (MainTabActivity) MessageFragment.this.getActivity();
|
||||||
|
if (activity != null) {
|
||||||
activity.setMessageCount(i);
|
activity.setMessageCount(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
e.fillInStackTrace();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
MainTabActivity activity = (MainTabActivity) MessageFragment.this.getActivity();
|
||||||
|
if (activity != null) {
|
||||||
activity.setMessageCount(i);
|
activity.setMessageCount(i);
|
||||||
|
}
|
||||||
tvTitle.setText("消息");
|
tvTitle.setText("消息");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user