1
This commit is contained in:
@@ -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();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -220,7 +220,7 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
|||||||
// ((HistoryRecordActivitytwo) getActivity()).registerMyOnTouchListener(this);
|
// ((HistoryRecordActivitytwo) getActivity()).registerMyOnTouchListener(this);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (getActivity() instanceof MainTabActivity){
|
if (getActivity() instanceof MainTabActivity) {
|
||||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||||
activity.visibilyBottom(View.VISIBLE);
|
activity.visibilyBottom(View.VISIBLE);
|
||||||
|
|
||||||
@@ -317,8 +317,19 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
final int mBottomY = getCoordinateY(homeGridAdapterItemBinding.ivComment) + homeGridAdapterItemBinding.ivComment.getHeight();
|
final int mBottomY = getCoordinateY(homeGridAdapterItemBinding.ivComment) + homeGridAdapterItemBinding.ivComment.getHeight();
|
||||||
|
if (dis_content.get(itemPosition).getFrom_id()==null
|
||||||
itemIndex =itemPosition;
|
||userId.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(),userId,position,itemPosition);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
new XPopup.Builder(getContext()).asCustom(deleteCommentDialog).show();
|
||||||
|
}else {
|
||||||
|
itemIndex = itemPosition;
|
||||||
|
|
||||||
mDataBinding.llComment.setVisibility(View.VISIBLE);
|
mDataBinding.llComment.setVisibility(View.VISIBLE);
|
||||||
mDataBinding.etComment.requestFocus();
|
mDataBinding.etComment.requestFocus();
|
||||||
@@ -339,6 +350,8 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
|||||||
mDataBinding.sv.smoothScrollBy(0, mBottomY - y);
|
mDataBinding.sv.smoothScrollBy(0, mBottomY - y);
|
||||||
}
|
}
|
||||||
}, 300);
|
}, 300);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -489,7 +502,7 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
|||||||
private int commentPosition = -1;
|
private int commentPosition = -1;
|
||||||
private int itemIndex = -1;
|
private int itemIndex = -1;
|
||||||
|
|
||||||
private void comment(String goodsId, final int position, final int itemIndex, final String content) {
|
private void comment(String goodsId, final int position, final int itemIndex, final String content) {
|
||||||
final RegisterUser user =
|
final RegisterUser user =
|
||||||
Config.getInstance(getContext()).getUser();
|
Config.getInstance(getContext()).getUser();
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
@@ -501,7 +514,7 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
|||||||
map.put("app", "Goods");
|
map.put("app", "Goods");
|
||||||
map.put("class", "DisGoods");
|
map.put("class", "DisGoods");
|
||||||
map.put("goods_id", goodsId);
|
map.put("goods_id", goodsId);
|
||||||
if (itemIndex!=-1){
|
if (itemIndex != -1) {
|
||||||
DiscoveryListEntity discoveryListEntity = discoveryListEntities.get(position);
|
DiscoveryListEntity discoveryListEntity = discoveryListEntities.get(position);
|
||||||
ArrayList<DiscoveryListEntity.Dis_content> dis_content1 = discoveryListEntity.getDis_content();
|
ArrayList<DiscoveryListEntity.Dis_content> dis_content1 = discoveryListEntity.getDis_content();
|
||||||
String from_id = dis_content1.get(itemIndex).getFrom_id();
|
String from_id = dis_content1.get(itemIndex).getFrom_id();
|
||||||
@@ -538,7 +551,7 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
|||||||
|
|
||||||
DiscoveryListEntity discoveryListEntity = discoveryListEntities.get(position);
|
DiscoveryListEntity discoveryListEntity = discoveryListEntities.get(position);
|
||||||
ArrayList<DiscoveryListEntity.Dis_content> dis_content1 = discoveryListEntity.getDis_content();
|
ArrayList<DiscoveryListEntity.Dis_content> dis_content1 = discoveryListEntity.getDis_content();
|
||||||
if (itemIndex!=-1){
|
if (itemIndex != -1) {
|
||||||
dis_content.setReply(dis_content1.get(itemIndex).getNickname());
|
dis_content.setReply(dis_content1.get(itemIndex).getNickname());
|
||||||
}
|
}
|
||||||
dis_content1.add(dis_content);
|
dis_content1.add(dis_content);
|
||||||
@@ -902,5 +915,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();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
53
app/src/main/res/layout/dialog_select_delete.xml
Normal file
53
app/src/main/res/layout/dialog_select_delete.xml
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?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:layout_margin="8dp"
|
||||||
|
android:background="@null"
|
||||||
|
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:paddingBottom="5dp"
|
||||||
|
android:text="取消"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="1111"
|
android:text="1111"
|
||||||
android:textColor="@color/light_color_blue"
|
android:textColor="@color/text_name"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
android:id="@+id/tv_name3"
|
android:id="@+id/tv_name3"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="@color/light_color_blue"
|
android:textColor="@color/text_name"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|||||||
Reference in New Issue
Block a user