Merge branch 'master' of https://gitee.com/renjianbo0118/HouseProperty
This commit is contained in:
@@ -46,6 +46,11 @@ android {
|
||||
abiFilters 'armeabi-v7a'
|
||||
|
||||
}
|
||||
manifestPlaceholders = [
|
||||
JPUSH_PKGNAME : applicationId,
|
||||
JPUSH_APPKEY : "4b6e03f9cc9466efbc0b2528", //JPush 上注册的包名对应的 Appkey.
|
||||
JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
|
||||
]
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
@@ -149,6 +154,8 @@ android {
|
||||
|
||||
|
||||
implementation 'com.lzy.net:okgo:3.0.4'
|
||||
implementation 'cn.jiguang.sdk:jpush:3.6.6'
|
||||
implementation 'cn.jiguang.sdk:jcore:2.3.8'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -78,6 +78,26 @@
|
||||
<!-- <queries>-->
|
||||
<!-- <package android:name="com.tencent.mm" />-->
|
||||
<!-- </queries>-->
|
||||
<receiver
|
||||
android:name=".push.MyReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
|
||||
|
||||
<category android:name="com.sl.house_property" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service
|
||||
android:name=".push.XService"
|
||||
android:enabled="true"
|
||||
android:exported="false"
|
||||
android:process=":pushcore">
|
||||
<intent-filter>
|
||||
<action android:name="cn.jiguang.user.service.action" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<provider
|
||||
android:name="com.sl.house_property.ImagePickerProvider"
|
||||
android:authorities="${applicationId}.provider"
|
||||
|
||||
@@ -19,6 +19,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
import entity.RegisterUser;
|
||||
import my_loader.Loader;
|
||||
import my_loader.Resultcode;
|
||||
@@ -157,6 +158,7 @@ public class LoginActivity extends BaseActivity<ActivityLoginBinding> implements
|
||||
LinkedTreeMap adta = (LinkedTreeMap) resultcode.data;
|
||||
String s = gs.toJson(adta);
|
||||
RegisterUser user = gs.fromJson(s, RegisterUser.class);//把JSON字符串转为对象
|
||||
JPushInterface.setAlias(getApplicationContext(),0,user.getUserid());
|
||||
Config.getInstance(LoginActivity.this).putUser(user);
|
||||
Config.getInstance(LoginActivity.this).put("username", mDataBinding.phone.getText().toString().trim());
|
||||
|
||||
|
||||
@@ -42,13 +42,16 @@ import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
import com.selectpicker.OptionsPopupWindow;
|
||||
import com.sl.house_property.databinding.FragmentMainBinding;
|
||||
|
||||
import com.sl.house_property.databinding.ItemCommentBinding;
|
||||
import com.sl.house_property.databinding.ItemDiscoveryBinding;
|
||||
import com.sl.house_property.db.CommentBeanData;
|
||||
import com.sl.house_property.db.dao.CommentDao;
|
||||
import com.sl.house_property.discovery.DeleteCommentDialog;
|
||||
import com.sl.house_property.discovery.GoodsInfoDialog;
|
||||
import com.sl.house_property.discovery.HistoryRecordActivity;
|
||||
import com.sl.house_property.discovery.HistoryRecordActivitytwo;
|
||||
import com.sl.house_property.discovery.SelectDialog;
|
||||
import com.sl.house_property.okgonet.HttpConstants;
|
||||
import com.sl.house_property.okgonet.Observer;
|
||||
import com.sl.house_property.order.SettleActivity;
|
||||
@@ -788,12 +791,15 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
|
||||
commentDialog.dismiss();
|
||||
like(discoveryListEntity.getGoods_id(), position);
|
||||
} else if (type == 3) {
|
||||
itemIndex = -1;
|
||||
mDataBinding.llComment.setVisibility(View.VISIBLE);
|
||||
mDataBinding.etComment.requestFocus();
|
||||
mDataBinding.etComment.setHint("评论");
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
if (getActivity() instanceof MainTabActivity) {
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.visibilyBottom(View.GONE);
|
||||
}
|
||||
KeyboardUtil.showSoftInput(getContext());
|
||||
activity.visibilyBottom(View.GONE);
|
||||
commentPosition = position;
|
||||
commentDialog.dismiss();
|
||||
mDataBinding.etComment.setText("");
|
||||
@@ -805,6 +811,23 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
|
||||
mDataBinding.scrollViewExtend.smoothScrollBy(0, mBottomY - y);
|
||||
}
|
||||
}, 300);
|
||||
// mDataBinding.llComment.setVisibility(View.VISIBLE);
|
||||
// mDataBinding.etComment.requestFocus();
|
||||
// mDataBinding.etComment.setHint("评论");
|
||||
// MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
// KeyboardUtil.showSoftInput(getContext());
|
||||
// activity.visibilyBottom(View.GONE);
|
||||
// commentPosition = position;
|
||||
// commentDialog.dismiss();
|
||||
// mDataBinding.etComment.setText("");
|
||||
// homeGridAdapterItemBinding.ivComment.postDelayed(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// int y = getCoordinateY(mDataBinding.llComment) - 20;
|
||||
// //评论时滑动到对应item底部和输入框顶部对齐
|
||||
// mDataBinding.scrollViewExtend.smoothScrollBy(0, mBottomY - y);
|
||||
// }
|
||||
// }, 300);
|
||||
|
||||
|
||||
} else if (type == 4) {
|
||||
@@ -857,21 +880,72 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
|
||||
final ArrayList<DiscoveryListEntity.Dis_content> dis_content = discoveryListEntity.getDis_content();
|
||||
baseRecycleViewAdapter.setOnBindViewHolder(new BaseRecycleViewAdapter.BindView() {
|
||||
@Override
|
||||
public void onBindViewHolder(Object b, int position) {
|
||||
public void onBindViewHolder(Object b, final int itemPosition) {
|
||||
ItemCommentBinding itemCommentBinding = (ItemCommentBinding) b;
|
||||
itemCommentBinding.tvName.setText(dis_content.get(position).getNickname() + ": ");
|
||||
itemCommentBinding.tvInfo.setText(dis_content.get(position).getContents());
|
||||
if (dis_content.get(position).getReply().isEmpty()) {
|
||||
if (dis_content.get(itemPosition).getReply().isEmpty()) {
|
||||
itemCommentBinding.llHf.setVisibility(View.GONE);
|
||||
|
||||
itemCommentBinding.ll.setVisibility(View.VISIBLE);
|
||||
itemCommentBinding.tvName.setText(dis_content.get(itemPosition).getNickname() + ": ");
|
||||
itemCommentBinding.tvInfo.setText(dis_content.get(itemPosition).getContents());
|
||||
} else {
|
||||
|
||||
itemCommentBinding.ll.setVisibility(View.GONE);
|
||||
itemCommentBinding.llHf.setVisibility(View.VISIBLE);
|
||||
itemCommentBinding.tvName2.setText(discoveryListEntity.getNickname());
|
||||
itemCommentBinding.tvName2.setText(dis_content.get(itemPosition).getNickname());
|
||||
itemCommentBinding.tvInfo2.setText("回复");
|
||||
itemCommentBinding.tvName3.setText(dis_content.get(position).getNickname() + ":");
|
||||
itemCommentBinding.tvInfo3.setText(dis_content.get(position).getReply());
|
||||
itemCommentBinding.tvName3.setText(dis_content.get(itemPosition).getReply() + ":");
|
||||
itemCommentBinding.tvInfo3.setText(dis_content.get(itemPosition).getContents());
|
||||
|
||||
}
|
||||
itemCommentBinding.llItem.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
final RegisterUser registerUser = Config.getInstance(getContext()).getUser();
|
||||
if (registerUser == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int mBottomY = getCoordinateY(homeGridAdapterItemBinding.ivComment) + homeGridAdapterItemBinding.ivComment.getHeight();
|
||||
if (dis_content.get(itemPosition).getFrom_id()==null
|
||||
||registerUser.getUserid().equals(dis_content.get(itemPosition).getFrom_id())){
|
||||
mDataBinding.llComment.setVisibility(View.GONE);
|
||||
DeleteCommentDialog deleteCommentDialog = new DeleteCommentDialog(getContext());
|
||||
deleteCommentDialog.setOnSelectListener(new SelectDialog.OnSelectListener() {
|
||||
@Override
|
||||
public void select(int type) {
|
||||
deleteComment(dis_content.get(itemPosition).getDis_id(),registerUser.getUserid(),position,itemPosition);
|
||||
}
|
||||
});
|
||||
new XPopup.Builder(getContext()).asCustom(deleteCommentDialog).show();
|
||||
}else {
|
||||
itemIndex =itemPosition;
|
||||
|
||||
mDataBinding.llComment.setVisibility(View.VISIBLE);
|
||||
mDataBinding.etComment.requestFocus();
|
||||
mDataBinding.etComment.setHint("回复 " + dis_content.get(itemPosition).getNickname());
|
||||
if (getActivity() instanceof MainTabActivity) {
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.visibilyBottom(View.GONE);
|
||||
}
|
||||
KeyboardUtil.showSoftInput(getContext());
|
||||
commentPosition = position;
|
||||
// commentDialog.dismiss();
|
||||
mDataBinding.etComment.setText("");
|
||||
homeGridAdapterItemBinding.ivComment.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int y = getCoordinateY(mDataBinding.llComment) - 20;
|
||||
//评论时滑动到对应item底部和输入框顶部对齐
|
||||
mDataBinding.scrollViewExtend.smoothScrollBy(0, mBottomY - y);
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
baseRecycleViewAdapter.setData(dis_content);
|
||||
@@ -943,12 +1017,13 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
|
||||
mDataBinding.llComment.setVisibility(View.GONE);
|
||||
activity.visibilyBottom(View.VISIBLE);
|
||||
Log.e("xxx", discoveryListEntities.get(commentPosition).getGoods_id());
|
||||
comment(discoveryListEntities.get(commentPosition).getGoods_id(), commentPosition, "", mDataBinding.etComment.getText().toString());
|
||||
comment(discoveryListEntities.get(commentPosition).getGoods_id(), commentPosition, itemIndex, mDataBinding.etComment.getText().toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
private int commentPosition = -1;
|
||||
private int itemIndex = -1;
|
||||
@Override
|
||||
public boolean onTouch(MotionEvent ev) {
|
||||
switch (ev.getAction()) {
|
||||
@@ -1042,7 +1117,7 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
|
||||
baseActivity.addSubscription(subscription);
|
||||
}
|
||||
|
||||
private void comment(String goodsId, final int position, String reply_id, final String content) {
|
||||
private void comment(String goodsId, final int position, final int itemIndex, final String content) {
|
||||
final RegisterUser user =
|
||||
Config.getInstance(getContext()).getUser();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
@@ -1054,8 +1129,13 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
|
||||
map.put("app", "Goods");
|
||||
map.put("class", "DisGoods");
|
||||
map.put("goods_id", goodsId);
|
||||
if (!TextUtils.isEmpty(reply_id)) {
|
||||
map.put("reply_id", reply_id);
|
||||
if (itemIndex!=-1){
|
||||
DiscoveryListEntity discoveryListEntity = discoveryListEntities.get(position);
|
||||
ArrayList<DiscoveryListEntity.Dis_content> dis_content1 = discoveryListEntity.getDis_content();
|
||||
String from_id = dis_content1.get(itemIndex).getFrom_id();
|
||||
if (!TextUtils.isEmpty(from_id)) {
|
||||
map.put("reply_id", from_id);
|
||||
}
|
||||
}
|
||||
|
||||
map.put("contents", content);
|
||||
@@ -1076,18 +1156,21 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
|
||||
baseActivity.setToast(1, resultcode.msg);
|
||||
}
|
||||
if (resultcode.status == 0) {
|
||||
|
||||
String nickname = user.getNickname();
|
||||
BaseRecycleViewAdapter adapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
DiscoveryListEntity.Dis_content dis_content = new DiscoveryListEntity.Dis_content();
|
||||
dis_content.setContents(content);
|
||||
dis_content.setNickname(nickname);
|
||||
dis_content.setReply("");
|
||||
|
||||
DiscoveryListEntity discoveryListEntity = discoveryListEntities.get(position);
|
||||
ArrayList<DiscoveryListEntity.Dis_content> dis_content1 = discoveryListEntity.getDis_content();
|
||||
if (itemIndex!=-1){
|
||||
dis_content.setReply(dis_content1.get(itemIndex).getNickname());
|
||||
}
|
||||
dis_content1.add(dis_content);
|
||||
|
||||
discoveryListEntity.setDis_content(dis_content1);
|
||||
adapter.upDateOne(position,discoveryListEntity);
|
||||
adapter.upDateOne(position, discoveryListEntity);
|
||||
// BaseRecycleViewAdapter adapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
// if (discoveryListEntities.get(position).getDis_content().isEmpty()) {
|
||||
// DiscoveryListEntity.Dis_content dis_content = new DiscoveryListEntity.Dis_content();
|
||||
@@ -1513,4 +1596,36 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
|
||||
});
|
||||
|
||||
}
|
||||
private void deleteComment(String dis_id, String userid, final int superPosition, final int itemPosition) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
|
||||
progressDialog.show();
|
||||
map.put("app", "Goods");
|
||||
|
||||
map.put("class", "DelDis");
|
||||
map.put("sign", Md5.md5("Goods" + "DelDis" + Md5.secret));
|
||||
map.put("dis_id", dis_id);
|
||||
map.put("userid", userid);
|
||||
mGankLoader.getMovie(ApiConfig.BASE_URL, map).subscribe(new Action1<Resultcode>() {
|
||||
@Override
|
||||
public void call(Resultcode resultcode) {
|
||||
progressDialog.dismiss();
|
||||
if (!(resultcode.status == 0)) {
|
||||
Toast.makeText(getContext(), resultcode.msg, Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
BaseRecycleViewAdapter adapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
DiscoveryListEntity discoveryListEntity = discoveryListEntities.get(superPosition);
|
||||
ArrayList<DiscoveryListEntity.Dis_content> dis_content1 = discoveryListEntity.getDis_content();
|
||||
dis_content1.remove(itemPosition);
|
||||
discoveryListEntity.setDis_content(dis_content1);
|
||||
adapter.upDateOne(superPosition, discoveryListEntity);
|
||||
}
|
||||
}
|
||||
}, new Action1<Throwable>() {
|
||||
@Override
|
||||
public void call(Throwable throwable) {
|
||||
Toast.makeText(getContext(), getString(R.string.getdatafailure), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||
for (MyOnTouchListener listener : onTouchListeners) {
|
||||
// listener.onTouch(ev);
|
||||
//listener.onTouch(ev);
|
||||
}
|
||||
return super.dispatchTouchEvent(ev);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
import okhttp3.OkHttpClient;
|
||||
import tools.CrashHandler;
|
||||
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard;
|
||||
@@ -84,6 +85,8 @@ public class MyApplication extends Application{
|
||||
super.onCreate();
|
||||
instance = this;
|
||||
initOkGo();
|
||||
JPushInterface.init(this);
|
||||
JPushInterface.setDebugMode(true);
|
||||
//
|
||||
// CrashHandler crashHandler = CrashHandler.getInstance();
|
||||
// crashHandler.init(this);
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.widget.Toast;
|
||||
|
||||
import com.sl.house_property.databinding.ActivitySettingBinding;
|
||||
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
import tools.APKVersionCodeUtils;
|
||||
import tools.Config;
|
||||
import utils.CacheDataManager;
|
||||
@@ -92,6 +93,7 @@ public class SettingActivity extends BaseActivity<ActivitySettingBinding> implem
|
||||
|
||||
break;
|
||||
case R.id.loginout:
|
||||
JPushInterface.deleteAlias(getApplicationContext(),0);
|
||||
Config.getInstance(SettingActivity.this).DeleteUser();
|
||||
MyApplication.getApp().existActivitys();
|
||||
intent = new Intent(SettingActivity.this, LoginActivity.class);
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.sl.house_property.discovery;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.lxj.xpopup.core.BottomPopupView;
|
||||
import com.sl.house_property.R;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class DeleteCommentDialog extends BottomPopupView {
|
||||
private SelectDialog.OnSelectListener listener;
|
||||
private TextView tv1;
|
||||
|
||||
public DeleteCommentDialog(@NonNull @NotNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.dialog_select_delete;
|
||||
|
||||
}
|
||||
public void setOnSelectListener(SelectDialog.OnSelectListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
findViewById(R.id.btn_delete).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (listener!=null){
|
||||
listener.select(1);
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
findViewById(R.id.btn_cancel).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
@@ -385,26 +386,47 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
commentDialog.dismiss();
|
||||
like(discoveryListEntity.getGoods_id(), position);
|
||||
} else if (type == 3) {
|
||||
itemIndex = -1;
|
||||
mDataBinding.llComment.setVisibility(View.VISIBLE);
|
||||
mDataBinding.etComment.requestFocus();
|
||||
mDataBinding.etComment.setHint("评论");
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
if (getActivity() instanceof MainTabActivity) {
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.visibilyBottom(View.GONE);
|
||||
}
|
||||
KeyboardUtil.showSoftInput(getContext());
|
||||
activity.visibilyBottom(View.GONE);
|
||||
|
||||
commentPosition = position;
|
||||
commentDialog.dismiss();
|
||||
mDataBinding.etComment.setText("");
|
||||
commentPosition = position;
|
||||
homeGridAdapterItemBinding.ivComment.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int y = getCoordinateY(mDataBinding.llComment) - 20;
|
||||
//评论时滑动到对应item底部和输入框顶部对齐
|
||||
mDataBinding.sv.smoothScrollBy(0, mBottomY - y);
|
||||
|
||||
}
|
||||
}, 300);
|
||||
|
||||
// mDataBinding.llComment.setVisibility(View.VISIBLE);
|
||||
// mDataBinding.etComment.requestFocus();
|
||||
// mDataBinding.etComment.setHint("评论");
|
||||
// MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
// KeyboardUtil.showSoftInput(getContext());
|
||||
// activity.visibilyBottom(View.GONE);
|
||||
//
|
||||
// commentDialog.dismiss();
|
||||
// mDataBinding.etComment.setText("");
|
||||
// commentPosition = position;
|
||||
// homeGridAdapterItemBinding.ivComment.postDelayed(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// int y = getCoordinateY(mDataBinding.llComment) - 20;
|
||||
// //评论时滑动到对应item底部和输入框顶部对齐
|
||||
// mDataBinding.sv.smoothScrollBy(0, mBottomY - y);
|
||||
//
|
||||
// }
|
||||
// }, 300);
|
||||
|
||||
|
||||
} else if (type == 4) {
|
||||
// addCart(discoveryListEntity.getGoods_id(),discoveryListEntity.)
|
||||
@@ -431,13 +453,13 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
homeGridAdapterItemBinding.tvLike.setVisibility(View.VISIBLE);
|
||||
StringBuilder likeString = new StringBuilder();
|
||||
for (int i = 0; i < discoveryListEntity.getLike().size(); i++) {
|
||||
// if (i != 0 && i != discoveryListEntity.getLike().size() - 1) {
|
||||
// likeString.append(",");
|
||||
// }
|
||||
// if (i != 0 && i != discoveryListEntity.getLike().size() - 1) {
|
||||
// likeString.append(",");
|
||||
// }
|
||||
|
||||
if (i != 0) {
|
||||
likeString.append(",");
|
||||
}
|
||||
if (i != 0) {
|
||||
likeString.append(",");
|
||||
}
|
||||
likeString.append(discoveryListEntity.getLike().get(i).getNickname());
|
||||
|
||||
}
|
||||
@@ -459,21 +481,84 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
final ArrayList<DiscoveryListEntity.Dis_content> dis_content = discoveryListEntity.getDis_content();
|
||||
baseRecycleViewAdapter.setOnBindViewHolder(new BaseRecycleViewAdapter.BindView() {
|
||||
@Override
|
||||
public void onBindViewHolder(Object b, int position) {
|
||||
public void onBindViewHolder(Object b, final int itemPosition) {
|
||||
ItemCommentBinding itemCommentBinding = (ItemCommentBinding) b;
|
||||
itemCommentBinding.tvName.setText(dis_content.get(position).getNickname() + ": ");
|
||||
itemCommentBinding.tvInfo.setText(dis_content.get(position).getContents());
|
||||
if (dis_content.get(position).getReply().isEmpty()) {
|
||||
// itemCommentBinding.tvName.setText(dis_content.get(position).getNickname() + ": ");
|
||||
// itemCommentBinding.tvInfo.setText(dis_content.get(position).getContents());
|
||||
// if (dis_content.get(position).getReply().isEmpty()) {
|
||||
// itemCommentBinding.llHf.setVisibility(View.GONE);
|
||||
//
|
||||
// } else {
|
||||
// itemCommentBinding.llHf.setVisibility(View.VISIBLE);
|
||||
// itemCommentBinding.tvName2.setText(discoveryListEntity.getNickname());
|
||||
// itemCommentBinding.tvInfo2.setText("回复");
|
||||
// itemCommentBinding.tvName3.setText(dis_content.get(position).getNickname() + ":");
|
||||
// itemCommentBinding.tvInfo3.setText(dis_content.get(position).getReply());
|
||||
//
|
||||
// }
|
||||
if (dis_content.get(itemPosition).getReply().isEmpty()) {
|
||||
itemCommentBinding.llHf.setVisibility(View.GONE);
|
||||
|
||||
itemCommentBinding.ll.setVisibility(View.VISIBLE);
|
||||
itemCommentBinding.tvName.setText(dis_content.get(itemPosition).getNickname() + ": ");
|
||||
itemCommentBinding.tvInfo.setText(dis_content.get(itemPosition).getContents());
|
||||
} else {
|
||||
itemCommentBinding.ll.setVisibility(View.GONE);
|
||||
itemCommentBinding.llHf.setVisibility(View.VISIBLE);
|
||||
itemCommentBinding.tvName2.setText(discoveryListEntity.getNickname());
|
||||
itemCommentBinding.tvName2.setText(dis_content.get(itemPosition).getNickname());
|
||||
itemCommentBinding.tvInfo2.setText("回复");
|
||||
itemCommentBinding.tvName3.setText(dis_content.get(position).getNickname() + ":");
|
||||
itemCommentBinding.tvInfo3.setText(dis_content.get(position).getReply());
|
||||
itemCommentBinding.tvName3.setText(dis_content.get(itemPosition).getReply() + ":");
|
||||
itemCommentBinding.tvInfo3.setText(dis_content.get(itemPosition).getContents());
|
||||
|
||||
}
|
||||
itemCommentBinding.llItem.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final RegisterUser registerUser = Config.getInstance(getContext()).getUser();
|
||||
if (registerUser == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int mBottomY = getCoordinateY(homeGridAdapterItemBinding.ivComment) + homeGridAdapterItemBinding.ivComment.getHeight();
|
||||
|
||||
if (dis_content.get(itemPosition).getFrom_id() == null
|
||||
|| registerUser.getUserid().equals(dis_content.get(itemPosition).getFrom_id())) {
|
||||
mDataBinding.llComment.setVisibility(View.GONE);
|
||||
DeleteCommentDialog deleteCommentDialog = new DeleteCommentDialog(getContext());
|
||||
deleteCommentDialog.setOnSelectListener(new SelectDialog.OnSelectListener() {
|
||||
@Override
|
||||
public void select(int type) {
|
||||
deleteComment(dis_content.get(itemPosition).getDis_id(), registerUser.getUserid(), position, itemPosition);
|
||||
}
|
||||
});
|
||||
new XPopup.Builder(getContext()).asCustom(deleteCommentDialog).show();
|
||||
} else {
|
||||
itemIndex = itemPosition;
|
||||
|
||||
mDataBinding.llComment.setVisibility(View.VISIBLE);
|
||||
mDataBinding.etComment.requestFocus();
|
||||
mDataBinding.etComment.setHint("回复 " + dis_content.get(itemPosition).getNickname());
|
||||
if (getActivity() instanceof MainTabActivity) {
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.visibilyBottom(View.GONE);
|
||||
}
|
||||
KeyboardUtil.showSoftInput(getContext());
|
||||
commentPosition = position;
|
||||
// commentDialog.dismiss();
|
||||
mDataBinding.etComment.setText("");
|
||||
homeGridAdapterItemBinding.ivComment.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int y = getCoordinateY(mDataBinding.llComment) - 20;
|
||||
//评论时滑动到对应item底部和输入框顶部对齐
|
||||
mDataBinding.sv.smoothScrollBy(0, mBottomY - y);
|
||||
}
|
||||
}, 300);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
baseRecycleViewAdapter.setData(dis_content);
|
||||
@@ -544,7 +629,7 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
mDataBinding.llComment.setVisibility(View.GONE);
|
||||
activity.visibilyBottom(View.VISIBLE);
|
||||
Log.e("xxx", discoveryListEntities.get(commentPosition).getGoods_id());
|
||||
comment(discoveryListEntities.get(commentPosition).getGoods_id(), commentPosition, "", mDataBinding.etComment.getText().toString());
|
||||
comment(discoveryListEntities.get(commentPosition).getGoods_id(), commentPosition, itemIndex, mDataBinding.etComment.getText().toString());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -575,25 +660,25 @@ 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);
|
||||
LinkedTreeMap adta = (LinkedTreeMap) resultcode.data;
|
||||
String s = gs.toJson(adta);
|
||||
|
||||
// String s = new GetJsonDataUtil().getJson(getActivity(), "controlStatus.json");//获取assets目录下的json文件数据
|
||||
// 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();
|
||||
// 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)){
|
||||
if (!TextUtils.isEmpty(fengmian)) {
|
||||
Picasso.with(getActivity()).load(fengmian)
|
||||
.placeholder(R.mipmap.icon_default_rectangle)
|
||||
.into(target);
|
||||
}
|
||||
if (!TextUtils.isEmpty(avatar)){
|
||||
if (!TextUtils.isEmpty(avatar)) {
|
||||
Picasso.with(getActivity()).load(avatar)
|
||||
.placeholder(R.mipmap.icon_default_rectangle)
|
||||
.transform(new PicassoRoundTransform())
|
||||
@@ -607,7 +692,7 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
page++;
|
||||
} else {
|
||||
// ArrayList<DiscoveryListEntity> o = new Gson().fromJson(array.toString(), type);
|
||||
// ArrayList<DiscoveryListEntity> o = new Gson().fromJson(array.toString(), type);
|
||||
List<DiscoveryListEntity> info = discoverEntity.getInfo();
|
||||
discoveryListEntities.addAll(info);
|
||||
|
||||
@@ -777,7 +862,9 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
baseActivity.addSubscription(subscription);
|
||||
}
|
||||
|
||||
private void comment(String goodsId, final int position, String reply_id, final String content) {
|
||||
private int itemIndex = -1;
|
||||
|
||||
private void comment(String goodsId, final int position, final int itemIndex, final String content) {
|
||||
final RegisterUser user =
|
||||
Config.getInstance(getContext()).getUser();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
@@ -790,8 +877,13 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
map.put("app", "Goods");
|
||||
map.put("class", "DisGoods");
|
||||
map.put("goods_id", goodsId);
|
||||
if (!TextUtils.isEmpty(reply_id)) {
|
||||
map.put("reply_id", reply_id);
|
||||
if (itemIndex != -1) {
|
||||
DiscoveryListEntity discoveryListEntity = discoveryListEntities.get(position);
|
||||
ArrayList<DiscoveryListEntity.Dis_content> dis_content1 = discoveryListEntity.getDis_content();
|
||||
String from_id = dis_content1.get(itemIndex).getFrom_id();
|
||||
if (!TextUtils.isEmpty(from_id)) {
|
||||
map.put("reply_id", from_id);
|
||||
}
|
||||
}
|
||||
|
||||
map.put("contents", content);
|
||||
@@ -817,13 +909,27 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
DiscoveryListEntity.Dis_content dis_content = new DiscoveryListEntity.Dis_content();
|
||||
dis_content.setContents(content);
|
||||
dis_content.setNickname(nickname);
|
||||
dis_content.setReply("");
|
||||
|
||||
DiscoveryListEntity discoveryListEntity = discoveryListEntities.get(position);
|
||||
ArrayList<DiscoveryListEntity.Dis_content> dis_content1 = discoveryListEntity.getDis_content();
|
||||
if (itemIndex != -1) {
|
||||
dis_content.setReply(dis_content1.get(itemIndex).getNickname());
|
||||
}
|
||||
dis_content1.add(dis_content);
|
||||
|
||||
discoveryListEntity.setDis_content(dis_content1);
|
||||
adapter.upDateOne(position, discoveryListEntity);
|
||||
// String nickname = user.getNickname();
|
||||
// BaseRecycleViewAdapter adapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
// DiscoveryListEntity.Dis_content dis_content = new DiscoveryListEntity.Dis_content();
|
||||
// dis_content.setContents(content);
|
||||
// dis_content.setNickname(nickname);
|
||||
// dis_content.setReply("");
|
||||
// DiscoveryListEntity discoveryListEntity = discoveryListEntities.get(position);
|
||||
// ArrayList<DiscoveryListEntity.Dis_content> dis_content1 = discoveryListEntity.getDis_content();
|
||||
// dis_content1.add(dis_content);
|
||||
//
|
||||
// discoveryListEntity.setDis_content(dis_content1);
|
||||
// adapter.upDateOne(position, discoveryListEntity);
|
||||
// BaseRecycleViewAdapter adapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
// if (discoveryListEntities.get(position).getDis_content().isEmpty()) {
|
||||
// DiscoveryListEntity.Dis_content dis_content = new DiscoveryListEntity.Dis_content();
|
||||
@@ -860,4 +966,36 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
}
|
||||
|
||||
}
|
||||
private void deleteComment(String dis_id, String userid, final int superPosition, final int itemPosition) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
|
||||
progressDialog.show();
|
||||
map.put("app", "Goods");
|
||||
|
||||
map.put("class", "DelDis");
|
||||
map.put("sign", Md5.md5("Goods" + "DelDis" + Md5.secret));
|
||||
map.put("dis_id", dis_id);
|
||||
map.put("userid", userid);
|
||||
mGankLoader.getMovie(ApiConfig.BASE_URL, map).subscribe(new Action1<Resultcode>() {
|
||||
@Override
|
||||
public void call(Resultcode resultcode) {
|
||||
progressDialog.dismiss();
|
||||
if (!(resultcode.status == 0)) {
|
||||
Toast.makeText(getContext(), resultcode.msg, Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
BaseRecycleViewAdapter adapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
DiscoveryListEntity discoveryListEntity = discoveryListEntities.get(superPosition);
|
||||
ArrayList<DiscoveryListEntity.Dis_content> dis_content1 = discoveryListEntity.getDis_content();
|
||||
dis_content1.remove(itemPosition);
|
||||
discoveryListEntity.setDis_content(dis_content1);
|
||||
adapter.upDateOne(superPosition, discoveryListEntity);
|
||||
}
|
||||
}
|
||||
}, new Action1<Throwable>() {
|
||||
@Override
|
||||
public void call(Throwable throwable) {
|
||||
Toast.makeText(getContext(), getString(R.string.getdatafailure), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,14 +84,14 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
return R.layout.fragment_history_record;
|
||||
}
|
||||
|
||||
public static HistoryRecordFragment newInstance(int param1, String param2, int i, int num,String wy_id) {
|
||||
public static HistoryRecordFragment newInstance(int param1, String param2, int i, int num, String wy_id) {
|
||||
HistoryRecordFragment fragment = new HistoryRecordFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("param1", param1);
|
||||
args.putString("param2", param2);
|
||||
args.putInt("num",i);
|
||||
args.putInt("dataType",num);
|
||||
args.putString("wy_id",wy_id);
|
||||
args.putInt("num", i);
|
||||
args.putInt("dataType", num);
|
||||
args.putString("wy_id", wy_id);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
@@ -113,9 +113,9 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
activity.registerMyOnTouchListener(this);
|
||||
} else if (getActivity() instanceof HistoryRecordActivity) {
|
||||
((HistoryRecordActivity) getActivity()).registerMyOnTouchListener(this);
|
||||
}else if (getActivity() instanceof LikeActivity){
|
||||
} else if (getActivity() instanceof LikeActivity) {
|
||||
((LikeActivity) getActivity()).registerMyOnTouchListener(this);
|
||||
}else if (getActivity() instanceof HistoryRecordActivitytwo){
|
||||
} else if (getActivity() instanceof HistoryRecordActivitytwo) {
|
||||
((HistoryRecordActivitytwo) getActivity()).registerMyOnTouchListener(this);
|
||||
}
|
||||
|
||||
@@ -160,6 +160,7 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.visibilyBottom(View.VISIBLE);
|
||||
}
|
||||
|
||||
mDataBinding.llComment.setVisibility(View.GONE);
|
||||
}
|
||||
break;
|
||||
@@ -207,8 +208,23 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
|
||||
} else if (View.GONE == visibility) {
|
||||
//隐藏键盘
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.visibilyBottom(View.VISIBLE);
|
||||
|
||||
// if (getActivity() instanceof MainTabActivity) {
|
||||
// final MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
// activity.registerMyOnTouchListener(this);
|
||||
// } else if (getActivity() instanceof HistoryRecordActivity) {
|
||||
// ((HistoryRecordActivity) getActivity()).registerMyOnTouchListener(this);
|
||||
// } else if (getActivity() instanceof LikeActivity) {
|
||||
// ((LikeActivity) getActivity()).registerMyOnTouchListener(this);
|
||||
// } else if (getActivity() instanceof HistoryRecordActivitytwo) {
|
||||
// ((HistoryRecordActivitytwo) getActivity()).registerMyOnTouchListener(this);
|
||||
// }
|
||||
|
||||
if (getActivity() instanceof MainTabActivity) {
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.visibilyBottom(View.VISIBLE);
|
||||
|
||||
}
|
||||
CommonUtils.hideSoftInput(mDataBinding.etComment.getContext(), mDataBinding.etComment);
|
||||
}
|
||||
}
|
||||
@@ -256,7 +272,7 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
homeGridAdapterItemBinding.tvLike.setVisibility(View.VISIBLE);
|
||||
StringBuilder likeString = new StringBuilder();
|
||||
for (int i = 0; i < discoveryListEntity.getLike().size(); i++) {
|
||||
if (i != 0 ) {
|
||||
if (i != 0) {
|
||||
likeString.append(",");
|
||||
}
|
||||
likeString.append(discoveryListEntity.getLike().get(i).getNickname());
|
||||
@@ -280,23 +296,75 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
final ArrayList<DiscoveryListEntity.Dis_content> dis_content = discoveryListEntity.getDis_content();
|
||||
baseRecycleViewAdapter.setOnBindViewHolder(new BaseRecycleViewAdapter.BindView() {
|
||||
@Override
|
||||
public void onBindViewHolder(Object b, int position) {
|
||||
public void onBindViewHolder(Object b, final int itemPosition) {
|
||||
ItemCommentBinding itemCommentBinding = (ItemCommentBinding) b;
|
||||
itemCommentBinding.tvName.setText(dis_content.get(position).getNickname() + ": ");
|
||||
itemCommentBinding.tvInfo.setText(dis_content.get(position).getContents());
|
||||
if (dis_content.get(position).getReply().isEmpty()) {
|
||||
itemCommentBinding.llHf.setVisibility(View.GONE);
|
||||
|
||||
if (dis_content.get(itemPosition).getReply().isEmpty()) {
|
||||
itemCommentBinding.llHf.setVisibility(View.GONE);
|
||||
itemCommentBinding.ll.setVisibility(View.VISIBLE);
|
||||
itemCommentBinding.tvName.setText(dis_content.get(itemPosition).getNickname() + ": ");
|
||||
itemCommentBinding.tvInfo.setText(dis_content.get(itemPosition).getContents());
|
||||
} else {
|
||||
itemCommentBinding.ll.setVisibility(View.GONE);
|
||||
itemCommentBinding.llHf.setVisibility(View.VISIBLE);
|
||||
itemCommentBinding.tvName2.setText(discoveryListEntity.getNickname());
|
||||
itemCommentBinding.tvName2.setText(dis_content.get(itemPosition).getNickname());
|
||||
itemCommentBinding.tvInfo2.setText("回复");
|
||||
itemCommentBinding.tvName3.setText(dis_content.get(position).getNickname() + ":");
|
||||
itemCommentBinding.tvInfo3.setText(dis_content.get(position).getReply());
|
||||
itemCommentBinding.tvName3.setText(dis_content.get(itemPosition).getReply() + ":");
|
||||
itemCommentBinding.tvInfo3.setText(dis_content.get(itemPosition).getContents());
|
||||
|
||||
}
|
||||
itemCommentBinding.llItem.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final RegisterUser registerUser = Config.getInstance(getContext()).getUser();
|
||||
if (registerUser == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int mBottomY = getCoordinateY(homeGridAdapterItemBinding.ivComment) + homeGridAdapterItemBinding.ivComment.getHeight();
|
||||
if (dis_content.get(itemPosition).getFrom_id()==null
|
||||
||registerUser.getUserid().equals(dis_content.get(itemPosition).getFrom_id())){
|
||||
mDataBinding.llComment.setVisibility(View.GONE);
|
||||
DeleteCommentDialog deleteCommentDialog = new DeleteCommentDialog(getContext());
|
||||
deleteCommentDialog.setOnSelectListener(new SelectDialog.OnSelectListener() {
|
||||
@Override
|
||||
public void select(int type) {
|
||||
deleteComment(dis_content.get(itemPosition).getDis_id(),registerUser.getUserid(),position,itemPosition);
|
||||
}
|
||||
});
|
||||
new XPopup.Builder(getContext()).asCustom(deleteCommentDialog).show();
|
||||
}else {
|
||||
itemIndex = itemPosition;
|
||||
|
||||
mDataBinding.llComment.setVisibility(View.VISIBLE);
|
||||
mDataBinding.etComment.requestFocus();
|
||||
mDataBinding.etComment.setHint("回复 " + dis_content.get(itemPosition).getNickname());
|
||||
if (getActivity() instanceof MainTabActivity) {
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.visibilyBottom(View.GONE);
|
||||
}
|
||||
KeyboardUtil.showSoftInput(getContext());
|
||||
commentPosition = position;
|
||||
// commentDialog.dismiss();
|
||||
mDataBinding.etComment.setText("");
|
||||
homeGridAdapterItemBinding.ivComment.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int y = getCoordinateY(mDataBinding.llComment) - 20;
|
||||
//评论时滑动到对应item底部和输入框顶部对齐
|
||||
mDataBinding.sv.smoothScrollBy(0, mBottomY - y);
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
baseRecycleViewAdapter.setData(dis_content);
|
||||
|
||||
}
|
||||
@@ -331,7 +399,7 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
|
||||
}
|
||||
|
||||
} else if (!TextUtils.isEmpty(discoveryListEntity.getThumb())){
|
||||
} else if (!TextUtils.isEmpty(discoveryListEntity.getThumb())) {
|
||||
ImageInfo imageInfo = new ImageInfo();
|
||||
imageInfo.setType(1);
|
||||
imageInfo.setBigImageUrl(discoveryListEntity.getThumb());
|
||||
@@ -360,6 +428,7 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
commentDialog.dismiss();
|
||||
like(discoveryListEntity.getGoods_id(), position);
|
||||
} else if (type == 3) {
|
||||
itemIndex = -1;
|
||||
mDataBinding.llComment.setVisibility(View.VISIBLE);
|
||||
mDataBinding.etComment.requestFocus();
|
||||
mDataBinding.etComment.setHint("评论");
|
||||
@@ -412,22 +481,22 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
CommonUtils.hideSoftInput(getContext(), mDataBinding.etComment);
|
||||
mDataBinding.llComment.setVisibility(View.GONE);
|
||||
activity.visibilyBottom(View.VISIBLE);
|
||||
comment(discoveryListEntities.get(commentPosition).getGoods_id(), commentPosition, "", mDataBinding.etComment.getText().toString());
|
||||
comment(discoveryListEntities.get(commentPosition).getGoods_id(), commentPosition, itemIndex, mDataBinding.etComment.getText().toString());
|
||||
|
||||
} else if (getActivity() instanceof HistoryRecordActivity) {
|
||||
CommonUtils.hideSoftInput(getContext(), mDataBinding.etComment);
|
||||
mDataBinding.llComment.setVisibility(View.GONE);
|
||||
comment(discoveryListEntities.get(commentPosition).getGoods_id(), commentPosition, "", mDataBinding.etComment.getText().toString());
|
||||
comment(discoveryListEntities.get(commentPosition).getGoods_id(), commentPosition, itemIndex, mDataBinding.etComment.getText().toString());
|
||||
|
||||
}else if (getActivity() instanceof LikeActivity){
|
||||
} else if (getActivity() instanceof LikeActivity) {
|
||||
CommonUtils.hideSoftInput(getContext(), mDataBinding.etComment);
|
||||
mDataBinding.llComment.setVisibility(View.GONE);
|
||||
comment(discoveryListEntities.get(commentPosition).getGoods_id(), commentPosition, "", mDataBinding.etComment.getText().toString());
|
||||
comment(discoveryListEntities.get(commentPosition).getGoods_id(), commentPosition, itemIndex, mDataBinding.etComment.getText().toString());
|
||||
|
||||
}else if (getActivity() instanceof HistoryRecordActivitytwo){
|
||||
} else if (getActivity() instanceof HistoryRecordActivitytwo) {
|
||||
CommonUtils.hideSoftInput(getContext(), mDataBinding.etComment);
|
||||
mDataBinding.llComment.setVisibility(View.GONE);
|
||||
comment(discoveryListEntities.get(commentPosition).getGoods_id(), commentPosition, "", mDataBinding.etComment.getText().toString());
|
||||
comment(discoveryListEntities.get(commentPosition).getGoods_id(), commentPosition, itemIndex, mDataBinding.etComment.getText().toString());
|
||||
|
||||
}
|
||||
|
||||
@@ -436,8 +505,9 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
}
|
||||
|
||||
private int commentPosition = -1;
|
||||
private int itemIndex = -1;
|
||||
|
||||
private void comment(String goodsId, final int position, String reply_id, final String content) {
|
||||
private void comment(String goodsId, final int position, final int itemIndex, final String content) {
|
||||
final RegisterUser user =
|
||||
Config.getInstance(getContext()).getUser();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
@@ -449,10 +519,16 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
map.put("app", "Goods");
|
||||
map.put("class", "DisGoods");
|
||||
map.put("goods_id", goodsId);
|
||||
if (!TextUtils.isEmpty(reply_id)) {
|
||||
map.put("reply_id", reply_id);
|
||||
if (itemIndex != -1) {
|
||||
DiscoveryListEntity discoveryListEntity = discoveryListEntities.get(position);
|
||||
ArrayList<DiscoveryListEntity.Dis_content> dis_content1 = discoveryListEntity.getDis_content();
|
||||
String from_id = dis_content1.get(itemIndex).getFrom_id();
|
||||
if (!TextUtils.isEmpty(from_id)) {
|
||||
map.put("reply_id", from_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
map.put("contents", content);
|
||||
map.put("sign", Md5.md5("Goods" + "DisGoods" + Md5.secret));
|
||||
progressDialog.setMessage("提交中");
|
||||
@@ -477,11 +553,13 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
DiscoveryListEntity.Dis_content dis_content = new DiscoveryListEntity.Dis_content();
|
||||
dis_content.setContents(content);
|
||||
dis_content.setNickname(nickname);
|
||||
dis_content.setReply("");
|
||||
|
||||
DiscoveryListEntity discoveryListEntity = discoveryListEntities.get(position);
|
||||
ArrayList<DiscoveryListEntity.Dis_content> dis_content1 = discoveryListEntity.getDis_content();
|
||||
if (itemIndex != -1) {
|
||||
dis_content.setReply(dis_content1.get(itemIndex).getNickname());
|
||||
}
|
||||
dis_content1.add(dis_content);
|
||||
|
||||
discoveryListEntity.setDis_content(dis_content1);
|
||||
adapter.upDateOne(position, discoveryListEntity);
|
||||
}
|
||||
@@ -645,10 +723,10 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
if (resultcode.status == 0) {
|
||||
BaseRecycleViewAdapter adapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
if (discoveryListEntities.get(position).getIs_like() == 1) {
|
||||
if (getArguments().getInt("dataType")==3){
|
||||
if (getArguments().getInt("dataType") == 3) {
|
||||
discoveryListEntities.remove(position);
|
||||
adapter.notifyDataSetChanged();
|
||||
}else {
|
||||
} else {
|
||||
discoveryListEntities.get(position).setIs_like(0);
|
||||
ArrayList<DiscoveryListEntity.Like> like = discoveryListEntities.get(position).getLike();
|
||||
for (int i = 0; i < like.size(); i++) {
|
||||
@@ -704,17 +782,17 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
|
||||
map.put("type", type + "");
|
||||
map.put("app", "Goods");
|
||||
if (getArguments().getInt("dataType")==1){
|
||||
// String wy_id=(String) SPUtils.getSp(getActivity(), DoConfig.MY_HOUST_WYID,"");
|
||||
Log.e("物业id",wy_id);
|
||||
if (getArguments().getInt("dataType") == 1) {
|
||||
// String wy_id=(String) SPUtils.getSp(getActivity(), DoConfig.MY_HOUST_WYID,"");
|
||||
Log.e("物业id", wy_id);
|
||||
map.put("userid", wy_id);
|
||||
map.put("class", "WyGoodsLists");
|
||||
map.put("sign", Md5.md5("Goods" + "WyGoodsLists" + Md5.secret));
|
||||
} else if (getArguments().getInt("dataType")==3) {
|
||||
} else if (getArguments().getInt("dataType") == 3) {
|
||||
map.put("userid", userId);
|
||||
map.put("class", "UpGoodsLists");
|
||||
map.put("sign", Md5.md5("Goods" + "UpGoodsLists" + Md5.secret));
|
||||
}else {
|
||||
} else {
|
||||
map.put("userid", userId);
|
||||
map.put("class", "MyGoodsLists");
|
||||
map.put("sign", Md5.md5("Goods" + "MyGoodsLists" + Md5.secret));
|
||||
@@ -750,65 +828,64 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
e.printStackTrace();
|
||||
}
|
||||
Type type = new TypeToken<ArrayList<DiscoveryListEntity>>() {
|
||||
}.getType();
|
||||
if (page == 1) {
|
||||
if (num == 1) {
|
||||
mDataBinding.rl1.setVisibility(View.GONE);
|
||||
} else {
|
||||
mDataBinding.rl1.setVisibility(View.VISIBLE);
|
||||
String fengmian = null;
|
||||
try {
|
||||
fengmian = jsonObject.getString("fengmian");
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String avatar = null;
|
||||
try {
|
||||
avatar = jsonObject.getString("avatar");
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (!TextUtils.isEmpty(fengmian)){
|
||||
Picasso.with(context).load(fengmian)
|
||||
.placeholder(R.mipmap.icon_default_rectangle)
|
||||
.into(target);
|
||||
}
|
||||
if (!TextUtils.isEmpty(avatar)){
|
||||
Picasso.with(context).load(avatar)
|
||||
.placeholder(R.mipmap.icon_default_rectangle)
|
||||
.transform(new PicassoRoundTransform())
|
||||
.into(mDataBinding.head);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ArrayList<DiscoveryListEntity> o = new Gson().fromJson(array.toString(), type);
|
||||
discoveryListEntities.clear();
|
||||
discoveryListEntities.addAll(o);
|
||||
BaseRecycleViewAdapter baseRecycleViewAdapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
page++;
|
||||
}.getType();
|
||||
if (page == 1) {
|
||||
if (num == 1) {
|
||||
mDataBinding.rl1.setVisibility(View.GONE);
|
||||
} else {
|
||||
ArrayList<DiscoveryListEntity> o = new Gson().fromJson(array.toString(), type);
|
||||
discoveryListEntities.addAll(o);
|
||||
|
||||
BaseRecycleViewAdapter baseRecycleViewAdapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
Log.e("sizi", discoveryListEntities.size() + "");
|
||||
// int count = jsonObject.getInt("count");
|
||||
if (o.isEmpty()) {
|
||||
mDataBinding.dw.finishLoadMoreWithNoMoreData();
|
||||
} else {
|
||||
|
||||
page++;
|
||||
|
||||
mDataBinding.rl1.setVisibility(View.VISIBLE);
|
||||
String fengmian = null;
|
||||
try {
|
||||
fengmian = jsonObject.getString("fengmian");
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String avatar = null;
|
||||
try {
|
||||
avatar = jsonObject.getString("avatar");
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (!TextUtils.isEmpty(fengmian)) {
|
||||
Picasso.with(context).load(fengmian)
|
||||
.placeholder(R.mipmap.icon_default_rectangle)
|
||||
.into(target);
|
||||
}
|
||||
if (!TextUtils.isEmpty(avatar)) {
|
||||
Picasso.with(context).load(avatar)
|
||||
.placeholder(R.mipmap.icon_default_rectangle)
|
||||
.transform(new PicassoRoundTransform())
|
||||
.into(mDataBinding.head);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ArrayList<DiscoveryListEntity> o = new Gson().fromJson(array.toString(), type);
|
||||
discoveryListEntities.clear();
|
||||
discoveryListEntities.addAll(o);
|
||||
BaseRecycleViewAdapter baseRecycleViewAdapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
page++;
|
||||
} else {
|
||||
ArrayList<DiscoveryListEntity> o = new Gson().fromJson(array.toString(), type);
|
||||
discoveryListEntities.addAll(o);
|
||||
|
||||
BaseRecycleViewAdapter baseRecycleViewAdapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
Log.e("sizi", discoveryListEntities.size() + "");
|
||||
// int count = jsonObject.getInt("count");
|
||||
if (o.isEmpty()) {
|
||||
mDataBinding.dw.finishLoadMoreWithNoMoreData();
|
||||
} else {
|
||||
|
||||
page++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}else {
|
||||
Log.e("xxxxx","fffff");
|
||||
} else {
|
||||
Log.e("xxxxx", "fffff");
|
||||
}
|
||||
}
|
||||
}, new Action1<Throwable>() {
|
||||
@@ -843,5 +920,37 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
}
|
||||
};
|
||||
|
||||
private void deleteComment(String dis_id, String userid, final int superPosition, final int itemPosition) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
|
||||
progressDialog.show();
|
||||
map.put("app", "Goods");
|
||||
|
||||
map.put("class", "DelDis");
|
||||
map.put("sign", Md5.md5("Goods" + "DelDis" + Md5.secret));
|
||||
map.put("dis_id", dis_id);
|
||||
map.put("userid", userid);
|
||||
loader.getMovie(ApiConfig.BASE_URL, map).subscribe(new Action1<Resultcode>() {
|
||||
@Override
|
||||
public void call(Resultcode resultcode) {
|
||||
progressDialog.dismiss();
|
||||
if (!(resultcode.status == 0)) {
|
||||
Toast.makeText(context, resultcode.msg, Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
BaseRecycleViewAdapter adapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
DiscoveryListEntity discoveryListEntity = discoveryListEntities.get(superPosition);
|
||||
ArrayList<DiscoveryListEntity.Dis_content> dis_content1 = discoveryListEntity.getDis_content();
|
||||
dis_content1.remove(itemPosition);
|
||||
discoveryListEntity.setDis_content(dis_content1);
|
||||
adapter.upDateOne(superPosition, discoveryListEntity);
|
||||
}
|
||||
}
|
||||
}, new Action1<Throwable>() {
|
||||
@Override
|
||||
public void call(Throwable throwable) {
|
||||
Toast.makeText(context, getString(R.string.getdatafailure), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
32
app/src/main/java/com/sl/house_property/push/MyReceiver.java
Normal file
32
app/src/main/java/com/sl/house_property/push/MyReceiver.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.sl.house_property.push;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
import cn.jpush.android.api.CustomMessage;
|
||||
import cn.jpush.android.api.NotificationMessage;
|
||||
import cn.jpush.android.service.JPushMessageReceiver;
|
||||
|
||||
public class MyReceiver extends JPushMessageReceiver {
|
||||
|
||||
|
||||
@Override
|
||||
public void onRegister(Context context, String s) {
|
||||
super.onRegister(context, s);
|
||||
Log.e("xxxx", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(Context context, CustomMessage customMessage) {
|
||||
super.onMessage(context, customMessage);
|
||||
Log.e("message", customMessage.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNotifyMessageArrived(Context context, NotificationMessage notificationMessage) {
|
||||
super.onNotifyMessageArrived(context, notificationMessage);
|
||||
Log.e("极光" , "收到了推送消息");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.sl.house_property.push;
|
||||
|
||||
import cn.jpush.android.service.JCommonService;
|
||||
|
||||
public class XService extends JCommonService {
|
||||
|
||||
}
|
||||
@@ -474,7 +474,6 @@ public class MyPropertyActivity extends BaseActivity<ActivityMyPropertyBinding>
|
||||
mDataBinding.myaddress.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Log.e("dsfsdfdsfs",adding+"");
|
||||
if (!adding) {
|
||||
adding = true;
|
||||
SimpleEntity simpleEntity = new SimpleEntity();
|
||||
|
||||
@@ -113,13 +113,13 @@
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rlzhuce"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dip"
|
||||
android:layout_marginRight="20dip"
|
||||
android:layout_marginTop="16dp"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
android:textColor="@color/white">
|
||||
|
||||
<TextView
|
||||
@@ -189,7 +189,7 @@
|
||||
android:id="@+id/agreewhitemegy"
|
||||
android:button="@drawable/checkbox_style"
|
||||
android:layout_width="wrap_content"
|
||||
android:checked="false"
|
||||
android:checked="true"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:layout_marginStart="10dp"
|
||||
|
||||
@@ -227,7 +227,7 @@
|
||||
android:id="@+id/agreewhitemeg"
|
||||
android:button="@drawable/checkbox_style"
|
||||
android:layout_width="wrap_content"
|
||||
android:checked="true"
|
||||
android:checked="false"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:layout_marginStart="10dp"
|
||||
@@ -255,7 +255,7 @@
|
||||
android:id="@+id/agreewhitemegy"
|
||||
android:button="@drawable/checkbox_style"
|
||||
android:layout_width="wrap_content"
|
||||
android:checked="true"
|
||||
android:checked="false"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:layout_marginStart="10dp"
|
||||
@@ -267,7 +267,7 @@
|
||||
android:onClick="yinagreementEvent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/agreewhitemeg1"
|
||||
android:text="@string/agreewhitemeg2"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
50
app/src/main/res/layout/dialog_select_delete.xml
Normal file
50
app/src/main/res/layout/dialog_select_delete.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_edit"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="@drawable/selector_bottom_dialog_btn"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="删除我的评论"
|
||||
android:textColor="@color/darkgray"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dip"
|
||||
android:background="@color/LightGray" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_delete"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="@drawable/selector_bottom_dialog_btn"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="删除"
|
||||
android:textColor="@color/red"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_cancel"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:background="@drawable/selector_bottom_dialog_btn"
|
||||
android:paddingTop="5dp"
|
||||
android:text="取消"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -2,11 +2,14 @@
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
@@ -38,11 +41,12 @@
|
||||
android:id="@+id/tv_name2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/light_color_blue"
|
||||
android:text="1111"
|
||||
android:textColor="@color/text_name"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
|
||||
android:text="回复"
|
||||
android:id="@+id/tv_info2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -50,14 +54,15 @@
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:text="3333"
|
||||
android:id="@+id/tv_name3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/light_color_blue"
|
||||
android:textColor="@color/text_name"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
|
||||
android:text="12163"
|
||||
android:id="@+id/tv_info3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
Reference in New Issue
Block a user