d
This commit is contained in:
@@ -629,7 +629,7 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
|
||||
public void onClick(final View v) {
|
||||
final CommentDialog commentDialog = new CommentDialog(baseActivity);
|
||||
|
||||
commentDialog.setShowBug(discoveryListEntity.getType() == 2);
|
||||
commentDialog.setShowBug(discoveryListEntity.getType().equals("2"));
|
||||
commentDialog.setPraise(discoveryListEntity.getIs_like() == 1);
|
||||
final int mBottomY = getCoordinateY(homeGridAdapterItemBinding.ivComment) + homeGridAdapterItemBinding.ivComment.getHeight();
|
||||
commentDialog.setOnCommentOperateListener(new CommentDialog.OnCommentOperateListener() {
|
||||
|
||||
@@ -33,6 +33,9 @@ public class MyApplication extends Application{
|
||||
public static boolean mainonce;
|
||||
|
||||
*/
|
||||
public static Context getContext() {
|
||||
return context;
|
||||
}
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.sl.house_property.discovery;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import entity.DiscoveryListEntity;
|
||||
|
||||
/**
|
||||
* Time: 2021/2/19
|
||||
* Author: jianbo
|
||||
* Description:
|
||||
*/
|
||||
class DiscoverEntity {
|
||||
private String avatar;
|
||||
private String count;
|
||||
private String fengmian;
|
||||
private ArrayList<DiscoveryListEntity> info;
|
||||
|
||||
public List<DiscoveryListEntity> getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
public void setInfo(ArrayList<DiscoveryListEntity> info) {
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getFengmian() {
|
||||
return fengmian;
|
||||
}
|
||||
|
||||
public void setFengmian(String fengmian) {
|
||||
this.fengmian = fengmian;
|
||||
}
|
||||
|
||||
public String getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(String count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,7 @@ import org.json.JSONObject;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import adapter.BaseRecycleViewAdapter;
|
||||
@@ -62,6 +63,7 @@ import tools.Config;
|
||||
import tools.PicassoRoundTransform;
|
||||
import utils.CommonUtils;
|
||||
import utils.DateUtils;
|
||||
import utils.GetJsonDataUtil;
|
||||
import utils.KeyboardUtil;
|
||||
import utils.Md5;
|
||||
import utils.UtilHelpers;
|
||||
@@ -371,7 +373,7 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
final CommentDialog commentDialog = new CommentDialog(baseActivity);
|
||||
commentDialog.setShowBug(discoveryListEntity.getType() == 2);
|
||||
commentDialog.setShowBug(discoveryListEntity.getType().equals("2"));
|
||||
commentDialog.setPraise(discoveryListEntity.getIs_like() == 1);
|
||||
final int mBottomY = getCoordinateY(homeGridAdapterItemBinding.ivComment) + homeGridAdapterItemBinding.ivComment.getHeight();
|
||||
commentDialog.setOnCommentOperateListener(new CommentDialog.OnCommentOperateListener() {
|
||||
@@ -569,39 +571,47 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
if (resultcode.status == 0) {
|
||||
// intRecycleView();
|
||||
Gson gs = new Gson();
|
||||
LinkedTreeMap adta = (LinkedTreeMap) resultcode.data;
|
||||
String s = gs.toJson(adta);
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(s);
|
||||
org.json.JSONArray array = jsonObject.getJSONArray("info");
|
||||
Type type = new TypeToken<ArrayList<DiscoveryListEntity>>() {
|
||||
}.getType();
|
||||
if (page == 1) {
|
||||
String fengmian = jsonObject.getString("fengmian");
|
||||
String avatar = jsonObject.getString("avatar");
|
||||
Picasso.with(getActivity()).load(fengmian)
|
||||
.placeholder(R.mipmap.icon_default_rectangle)
|
||||
.into(target);
|
||||
Picasso.with(getActivity()).load(avatar)
|
||||
.placeholder(R.mipmap.icon_default_rectangle)
|
||||
.transform(new PicassoRoundTransform())
|
||||
.into(mDataBinding.head);
|
||||
LinkedTreeMap adta = (LinkedTreeMap) resultcode.data;
|
||||
String s = gs.toJson(adta);
|
||||
|
||||
ArrayList<DiscoveryListEntity> o = new Gson().fromJson(array.toString(), type);
|
||||
// String s = new GetJsonDataUtil().getJson(getActivity(), "controlStatus.json");//获取assets目录下的json文件数据
|
||||
try {
|
||||
DiscoverEntity discoverEntity = gs.fromJson(s, DiscoverEntity.class);
|
||||
// JSONObject jsonObject = new JSONObject(s);
|
||||
// org.json.JSONArray array = jsonObject.getJSONArray("info");
|
||||
// Type type = new TypeToken<ArrayList<DiscoveryListEntity>>() {
|
||||
// }.getType();
|
||||
if (page == 1) {
|
||||
String fengmian = discoverEntity.getFengmian();
|
||||
String avatar = discoverEntity.getAvatar();
|
||||
if (!TextUtils.isEmpty(fengmian)){
|
||||
Picasso.with(getActivity()).load(fengmian)
|
||||
.placeholder(R.mipmap.icon_default_rectangle)
|
||||
.into(target);
|
||||
}
|
||||
if (!TextUtils.isEmpty(avatar)){
|
||||
Picasso.with(getActivity()).load(avatar)
|
||||
.placeholder(R.mipmap.icon_default_rectangle)
|
||||
.transform(new PicassoRoundTransform())
|
||||
.into(mDataBinding.head);
|
||||
}
|
||||
|
||||
List<DiscoveryListEntity> info = discoverEntity.getInfo();
|
||||
discoveryListEntities.clear();
|
||||
discoveryListEntities.addAll(o);
|
||||
discoveryListEntities.addAll(info);
|
||||
BaseRecycleViewAdapter baseRecycleViewAdapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
page++;
|
||||
} else {
|
||||
ArrayList<DiscoveryListEntity> o = new Gson().fromJson(array.toString(), type);
|
||||
discoveryListEntities.addAll(o);
|
||||
// ArrayList<DiscoveryListEntity> o = new Gson().fromJson(array.toString(), type);
|
||||
List<DiscoveryListEntity> info = discoverEntity.getInfo();
|
||||
discoveryListEntities.addAll(info);
|
||||
|
||||
BaseRecycleViewAdapter baseRecycleViewAdapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
// Log.e("sizi", discoveryListEntities.size() + "");
|
||||
// int count = jsonObject.getInt("count");
|
||||
if (o.isEmpty()) {
|
||||
if (info.isEmpty()) {
|
||||
mDataBinding.dw.finishLoadMoreWithNoMoreData();
|
||||
} else {
|
||||
|
||||
|
||||
@@ -334,7 +334,7 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
final CommentDialog commentDialog = new CommentDialog(getContext());
|
||||
commentDialog.setShowBug(discoveryListEntity.getType() == 2);
|
||||
commentDialog.setShowBug(discoveryListEntity.getType().equals("2"));
|
||||
commentDialog.setPraise(discoveryListEntity.getIs_like() == 1);
|
||||
// commentDialog.setShowBug(discoveryListEntity.getType() == 2);
|
||||
commentDialog.setPraise(discoveryListEntity.getIs_like() == 1);
|
||||
|
||||
Reference in New Issue
Block a user