Merge branch 'master' of https://gitee.com/renjianbo0118/HouseProperty
@@ -99,7 +99,7 @@ android {
|
||||
implementation 'com.android.databinding:baseLibrary:1.1'
|
||||
implementation 'com.android.databinding:adapters:1.1'
|
||||
|
||||
|
||||
implementation 'com.hjq:xxpermissions:5.5'
|
||||
implementation 'com.jzj.view:ObservableScrollView:0.0.2'
|
||||
implementation 'com.dalong:refreshlayout:1.0.1'
|
||||
implementation 'com.nineoldandroids:library:2.4.0'
|
||||
|
||||
@@ -164,7 +164,7 @@ public class CodeActivity extends BaseActivity<ActivityCodeBinding> {
|
||||
Gson gs = new Gson();
|
||||
LinkedTreeMap adta = (LinkedTreeMap) resultcode.data;
|
||||
String qrcode = (String) adta.get("qrcode");
|
||||
Bitmap qrCodeBitmap = QRCodeUtil.createQRCodeBitmap(qrcode, QRCodeUtil.dip2px(CodeActivity.this, 200), QRCodeUtil.dip2px(CodeActivity.this, 200));
|
||||
Bitmap qrCodeBitmap = QRCodeUtil.createQRCodeBitmap(qrcode, QRCodeUtil.dip2px(CodeActivity.this, 350), QRCodeUtil.dip2px(CodeActivity.this, 350));
|
||||
mDataBinding.ivCode.setImageBitmap(qrCodeBitmap);
|
||||
mDataBinding.ivCode.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.text.TextPaint;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
@@ -340,7 +341,7 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
|
||||
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.registerMyOnTouchListener(this);
|
||||
RegisterUser user =
|
||||
final RegisterUser user =
|
||||
Config.getInstance(getActivity()).getUser();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
if (user != null) {
|
||||
@@ -356,7 +357,11 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
|
||||
mDataBinding.service.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getContext(), PropertyActivity.class);
|
||||
// Intent intent = new Intent(getContext(), PropertyActivity.class);
|
||||
// startActivity(intent);
|
||||
Intent intent = new Intent(getContext(), HistoryRecordActivity.class);
|
||||
intent.putExtra("userId", user.getUserid());
|
||||
intent.putExtra("userName", user.getNickname());
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
@@ -616,17 +621,7 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
|
||||
// .placeholder(R.mipmap.icon_default_rectangle)
|
||||
// .transform(new PicassoRoundTransform())
|
||||
// .into(homeGridAdapterItemBinding.imageHead);
|
||||
mDataBinding.tvSendComment.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
CommonUtils.hideSoftInput(getContext(), mDataBinding.etComment);
|
||||
mDataBinding.llComment.setVisibility(View.GONE);
|
||||
activity.visibilyBottom(View.VISIBLE);
|
||||
comment(discoveryListEntity.getGoods_id(), position, "", mDataBinding.etComment.getText().toString());
|
||||
}
|
||||
});
|
||||
homeGridAdapterItemBinding.ivComment.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
@@ -649,7 +644,7 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
KeyboardUtil.showSoftInput(getContext());
|
||||
activity.visibilyBottom(View.GONE);
|
||||
|
||||
commentPosition = position;
|
||||
commentDialog.dismiss();
|
||||
mDataBinding.etComment.setText("");
|
||||
homeGridAdapterItemBinding.ivComment.postDelayed(new Runnable() {
|
||||
@@ -686,13 +681,11 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
|
||||
homeGridAdapterItemBinding.tvLike.setVisibility(View.VISIBLE);
|
||||
StringBuilder likeString = new StringBuilder();
|
||||
for (int i = 0; i < discoveryListEntity.getLike().size(); i++) {
|
||||
if (i == 0) {
|
||||
likeString.append("❤");
|
||||
|
||||
} else {
|
||||
if (i != 0 && i != discoveryListEntity.getLike().size() - 1) {
|
||||
likeString.append(",");
|
||||
}
|
||||
likeString.append(discoveryListEntity.getLike().get(i).getNickname());
|
||||
|
||||
}
|
||||
homeGridAdapterItemBinding.tvLike.setText(likeString.toString());
|
||||
|
||||
@@ -786,8 +779,22 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
|
||||
mDataBinding.recyView.setAdapter(baseRecycleViewAdapter);
|
||||
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
}
|
||||
mDataBinding.tvSendComment.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
if (commentPosition != -1) {
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
CommonUtils.hideSoftInput(getContext(), mDataBinding.etComment);
|
||||
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());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
private int commentPosition = -1;
|
||||
@Override
|
||||
public boolean onTouch(MotionEvent ev) {
|
||||
switch (ev.getAction()) {
|
||||
@@ -915,7 +922,18 @@ 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();
|
||||
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();
|
||||
|
||||
@@ -13,10 +13,15 @@ import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.hjq.permissions.OnPermission;
|
||||
import com.hjq.permissions.Permission;
|
||||
import com.hjq.permissions.XXPermissions;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.interfaces.OnConfirmListener;
|
||||
import com.sl.house_property.BaseActivity;
|
||||
import com.sl.house_property.R;
|
||||
import com.sl.house_property.databinding.ActivityAddDiscoveryBinding;
|
||||
@@ -49,7 +54,7 @@ public class AddDiscoveryActivity extends BaseActivity<ActivityAddDiscoveryBindi
|
||||
private static final int REQUEST_CODE_SELECT_PICTURE = 300;
|
||||
private int type;
|
||||
private AdditionImageWrapper additionImageWrapper;
|
||||
private ArrayList<String> strings;
|
||||
private ArrayList<GoodsInfoEntity> strings;
|
||||
private String goodsInfo = "";
|
||||
|
||||
@Override
|
||||
@@ -85,34 +90,42 @@ public class AddDiscoveryActivity extends BaseActivity<ActivityAddDiscoveryBindi
|
||||
mDataBinding.vi.setVisibility(View.VISIBLE);
|
||||
mDataBinding.rec2.setVisibility(View.VISIBLE);
|
||||
mDataBinding.tvGoods.setVisibility(View.VISIBLE);
|
||||
final BaseRecycleViewAdapter<String, ItemAddGoodsBinding> adapter = new BaseRecycleViewAdapter<>(AddDiscoveryActivity.this, R.layout.item_add_goods);
|
||||
final BaseRecycleViewAdapter<GoodsInfoEntity, ItemAddGoodsBinding> adapter = new BaseRecycleViewAdapter<>(AddDiscoveryActivity.this, R.layout.item_add_goods);
|
||||
strings = new ArrayList<>();
|
||||
strings.add("+");
|
||||
strings.add(new GoodsInfoEntity("+", "+"));
|
||||
adapter.setData(strings);
|
||||
adapter.setOnBindViewHolder(new BaseRecycleViewAdapter.BindView<ItemAddGoodsBinding>() {
|
||||
@Override
|
||||
public void onBindViewHolder(ItemAddGoodsBinding b, int position) {
|
||||
b.tv.setText(strings.get(position));
|
||||
b.tv.setText(strings.get(position).getValue());
|
||||
}
|
||||
});
|
||||
adapter.setOnItemClickListener(new BaseRecycleViewAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(View itemView, int position) {
|
||||
if (strings.get(position).equals("+")) {
|
||||
public void onItemClick(View itemView, final int position) {
|
||||
if (strings.get(position).getValue().equals("+")) {
|
||||
//添加
|
||||
AddGoodsDialog addGoodsDialog = new AddGoodsDialog(AddDiscoveryActivity.this);
|
||||
AddGoodsDialog addGoodsDialog = new AddGoodsDialog(AddDiscoveryActivity.this, null);
|
||||
addGoodsDialog.setOnAddGoodsInputListener(new AddGoodsDialog.OnAddGoodsInputListener() {
|
||||
@Override
|
||||
public void onConfirm(String info, String s) {
|
||||
if (goodsInfo.equals("")) {
|
||||
goodsInfo = info;
|
||||
} else {
|
||||
goodsInfo = goodsInfo + "|" + info;
|
||||
}
|
||||
|
||||
// if (goodsInfo.equals("")) {
|
||||
// goodsInfo = info;
|
||||
// } else {
|
||||
// goodsInfo = goodsInfo + "|" + info;
|
||||
// }
|
||||
Log.e("xxxx",info);
|
||||
Log.e("xxxx1",s);
|
||||
strings.remove(strings.size() - 1);
|
||||
strings.add(s);
|
||||
strings.add("+");
|
||||
strings.add(new GoodsInfoEntity(info, s));
|
||||
for (int i = 0; i < strings.size(); i++) {
|
||||
if (goodsInfo.equals("")) {
|
||||
goodsInfo = goodsInfo + strings.get(i).getInfo();
|
||||
} else {
|
||||
goodsInfo = goodsInfo + "|" + strings.get(i).getInfo();
|
||||
}
|
||||
}
|
||||
strings.add(new GoodsInfoEntity("+", "+"));
|
||||
adapter.setData(strings);
|
||||
|
||||
|
||||
@@ -120,6 +133,50 @@ public class AddDiscoveryActivity extends BaseActivity<ActivityAddDiscoveryBindi
|
||||
});
|
||||
new XPopup.Builder(AddDiscoveryActivity.this).asCustom(addGoodsDialog).show();
|
||||
|
||||
} else {
|
||||
SelectDialog selectDialog = new SelectDialog(AddDiscoveryActivity.this);
|
||||
selectDialog.setOnSelectListener(new SelectDialog.OnSelectListener() {
|
||||
@Override
|
||||
public void select(int type) {
|
||||
if (type == 1) {
|
||||
//编辑
|
||||
AddGoodsDialog addGoodsDialog = new AddGoodsDialog(AddDiscoveryActivity.this, strings.get(position).getInfo());
|
||||
addGoodsDialog.setOnAddGoodsInputListener(new AddGoodsDialog.OnAddGoodsInputListener() {
|
||||
@Override
|
||||
public void onConfirm(String info, String s) {
|
||||
Log.e("xxxx",info);
|
||||
Log.e("xxxx1",s);
|
||||
strings.set(position, new GoodsInfoEntity(info, s));
|
||||
strings.remove(strings.size() - 1);
|
||||
for (int i = 0; i < strings.size(); i++) {
|
||||
if (goodsInfo.equals("")) {
|
||||
goodsInfo = goodsInfo + strings.get(i).getInfo();
|
||||
} else {
|
||||
goodsInfo = goodsInfo + "|" + strings.get(i).getInfo();
|
||||
}
|
||||
}
|
||||
strings.add(new GoodsInfoEntity("+", "+"));
|
||||
adapter.setData(strings);
|
||||
}
|
||||
});
|
||||
new XPopup.Builder(AddDiscoveryActivity.this).asCustom(addGoodsDialog).show();
|
||||
} else if (type == 2) {
|
||||
//删除
|
||||
strings.remove(position);
|
||||
strings.remove(strings.size() - 1);
|
||||
for (int i = 0; i < strings.size(); i++) {
|
||||
if (goodsInfo.equals("")) {
|
||||
goodsInfo = goodsInfo + strings.get(i).getInfo();
|
||||
} else {
|
||||
goodsInfo = goodsInfo + "|" + strings.get(i).getInfo();
|
||||
}
|
||||
}
|
||||
strings.add(new GoodsInfoEntity("+", "+"));
|
||||
adapter.setData(strings);
|
||||
}
|
||||
}
|
||||
});
|
||||
new XPopup.Builder(AddDiscoveryActivity.this).asCustom(selectDialog).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -223,20 +280,41 @@ public class AddDiscoveryActivity extends BaseActivity<ActivityAddDiscoveryBindi
|
||||
/*
|
||||
* 检查访问相册权限
|
||||
* */
|
||||
private void checkAlbumPermission(int requestCode, int max) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||
selectImage(requestCode, max);
|
||||
return;
|
||||
}
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
//权限还没有授予,需要在这里写申请权限的代码
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 2);
|
||||
private void checkAlbumPermission(final int requestCode, final int max) {
|
||||
XXPermissions.with(this).permission(Permission.WRITE_EXTERNAL_STORAGE, Permission.CAMERA).request(new OnPermission() {
|
||||
@Override
|
||||
public void hasPermission(List<String> granted, boolean isAll) {
|
||||
if (isAll){
|
||||
selectImage(requestCode, max);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
selectImage(requestCode, max);
|
||||
}
|
||||
@Override
|
||||
public void noPermission(List<String> denied, boolean quick) {
|
||||
if (quick)
|
||||
new XPopup.Builder(AddDiscoveryActivity.this).asConfirm(
|
||||
"提示", "需要相册和相机权限才可以正常使用"
|
||||
, new OnConfirmListener() {
|
||||
@Override
|
||||
public void onConfirm() {
|
||||
XXPermissions.gotoPermissionSettings(AddDiscoveryActivity.this);
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
});
|
||||
// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||
// selectImage(requestCode, max);
|
||||
// return;
|
||||
// }
|
||||
// if ((ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)&&(ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED)) {
|
||||
// //权限还没有授予,需要在这里写申请权限的代码
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
// requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.CAMERA}, 2);
|
||||
// }
|
||||
//
|
||||
// } else {
|
||||
// selectImage(requestCode, max);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,24 +2,26 @@ package com.sl.house_property.discovery;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
import com.sl.house_property.R;
|
||||
|
||||
public class AddGoodsDialog extends CenterPopupView {
|
||||
|
||||
private final String info;
|
||||
private EditText etInfo;
|
||||
private EditText etPrice;
|
||||
private EditText etNum;
|
||||
private OnAddGoodsInputListener mListener=null;
|
||||
private OnAddGoodsInputListener mListener = null;
|
||||
|
||||
|
||||
public AddGoodsDialog(@NonNull Context context) {
|
||||
public AddGoodsDialog(@NonNull Context context, String info) {
|
||||
super(context);
|
||||
|
||||
this.info = info;
|
||||
|
||||
}
|
||||
|
||||
@@ -29,12 +31,34 @@ public class AddGoodsDialog extends CenterPopupView {
|
||||
etInfo = findViewById(R.id.et_info);
|
||||
etPrice = findViewById(R.id.et_price);
|
||||
etNum = findViewById(R.id.et_num);
|
||||
if (!TextUtils.isEmpty(info)) {
|
||||
try {
|
||||
String[] split = info.split(":");
|
||||
etInfo.setText(split[0]);
|
||||
etPrice.setText(split[1]);
|
||||
etNum.setText(split[2]);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
findViewById(R.id.btn_submit2).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (TextUtils.isEmpty(etInfo.getText().toString().trim())) {
|
||||
Toast.makeText(getContext(), "请输入商品描述", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (TextUtils.isEmpty(etPrice.getText().toString().trim())) {
|
||||
Toast.makeText(getContext(), "请输入商品单价", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (TextUtils.isEmpty(etNum.getText().toString().trim())) {
|
||||
Toast.makeText(getContext(), "请输入商品数量", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (mListener != null) {
|
||||
mListener.onConfirm(etInfo.getText().toString().trim() + ":" + etNum.getText().toString().trim() + ":" +
|
||||
etPrice.getText().toString().trim() ,etInfo.getText().toString().trim());
|
||||
etPrice.getText().toString().trim(), etInfo.getText().toString().trim());
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
public void onSelect(int position, String text) {
|
||||
Intent intent = new Intent(getContext(), AddDiscoveryActivity.class);
|
||||
intent.putExtra("type", position);
|
||||
startActivityForResult(intent,14);
|
||||
startActivityForResult(intent, 14);
|
||||
}
|
||||
}).show();
|
||||
|
||||
@@ -315,6 +315,7 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
return coordinate[1];
|
||||
}
|
||||
|
||||
private int commentPosition = -1;
|
||||
|
||||
private void intRecycleView() {
|
||||
mDataBinding.tvSendComment.setOnClickListener(new View.OnClickListener() {
|
||||
@@ -333,6 +334,7 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(baseActivity);
|
||||
mDataBinding.recyView.setNestedScrollingEnabled(false);//禁止rcyc嵌套滑动
|
||||
mDataBinding.recyView.setLayoutManager(linearLayoutManager);
|
||||
@@ -354,17 +356,7 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
// .placeholder(R.mipmap.icon_default_rectangle)
|
||||
// .transform(new PicassoRoundTransform())
|
||||
// .into(homeGridAdapterItemBinding.imageHead);
|
||||
mDataBinding.tvSendComment.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
CommonUtils.hideSoftInput(getContext(), mDataBinding.etComment);
|
||||
mDataBinding.llComment.setVisibility(View.GONE);
|
||||
activity.visibilyBottom(View.VISIBLE);
|
||||
comment(discoveryListEntity.getGoods_id(), position, "", mDataBinding.etComment.getText().toString());
|
||||
}
|
||||
});
|
||||
homeGridAdapterItemBinding.ivComment.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
@@ -390,12 +382,14 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
|
||||
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);
|
||||
|
||||
@@ -424,13 +418,11 @@ 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) {
|
||||
likeString.append("❤");
|
||||
|
||||
} else {
|
||||
if (i != 0 && i != discoveryListEntity.getLike().size() - 1) {
|
||||
likeString.append(",");
|
||||
}
|
||||
likeString.append(discoveryListEntity.getLike().get(i).getNickname());
|
||||
|
||||
}
|
||||
homeGridAdapterItemBinding.tvLike.setText(likeString.toString());
|
||||
|
||||
@@ -492,7 +484,7 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
|
||||
if (discoveryListEntity.getPic().size() > 0) {
|
||||
|
||||
// Log.e("pic", discoveryListEntity.getPic().get(0));
|
||||
// Log.e("pic", discoveryListEntity.getPic().get(0));
|
||||
for (int i = 0; i < discoveryListEntity.getPic().size(); i++) {
|
||||
if (discoveryListEntity.getPic().get(i).endsWith(".mp4") || discoveryListEntity.getPic().get(i).endsWith(".avi")) {
|
||||
ImageInfo imageInfo = new ImageInfo();
|
||||
@@ -524,6 +516,21 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
mDataBinding.recyView.setAdapter(baseRecycleViewAdapter);
|
||||
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
mDataBinding.tvSendComment.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// discoveryListEntity.
|
||||
if (commentPosition != -1) {
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
CommonUtils.hideSoftInput(getContext(), mDataBinding.etComment);
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getGankList(String myurl, Map<String, String> map, String msg, final int requstecode) {
|
||||
@@ -567,6 +574,7 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
.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);
|
||||
@@ -579,7 +587,7 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
|
||||
BaseRecycleViewAdapter baseRecycleViewAdapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
// Log.e("sizi", discoveryListEntities.size() + "");
|
||||
// Log.e("sizi", discoveryListEntities.size() + "");
|
||||
// int count = jsonObject.getInt("count");
|
||||
if (o.isEmpty()) {
|
||||
mDataBinding.dw.finishLoadMoreWithNoMoreData();
|
||||
@@ -749,6 +757,7 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
Map<String, String> map = new HashMap<>();
|
||||
if (user != null) {
|
||||
map.put("userid", user.getUserid());
|
||||
|
||||
} else {
|
||||
map.put("userid", 0 + "");
|
||||
}
|
||||
@@ -777,7 +786,18 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
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();
|
||||
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();
|
||||
@@ -808,7 +828,7 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode==14&&resultCode==200){
|
||||
if (requestCode == 14 && resultCode == 200) {
|
||||
page = 1;
|
||||
getlist(1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.sl.house_property.discovery;
|
||||
|
||||
public class GoodsInfoEntity {
|
||||
private String info;
|
||||
private String value;
|
||||
|
||||
public GoodsInfoEntity(String info, String value) {
|
||||
this.info = info;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
public void setInfo(String info) {
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import com.lzy.ninegrid.ImageInfo;
|
||||
import com.lzy.ninegrid.preview.NineGridViewClickAdapter;
|
||||
import com.sl.house_property.BaseActivity;
|
||||
import com.sl.house_property.MainFragment;
|
||||
import com.sl.house_property.MainTabActivity;
|
||||
import com.sl.house_property.R;
|
||||
import com.sl.house_property.databinding.ItemCommentBinding;
|
||||
import com.sl.house_property.databinding.ItemDiscoveryBinding;
|
||||
@@ -140,7 +141,17 @@ public class HistoryRecordActivity extends BaseActivity<LayoutHistoryRecordBindi
|
||||
}
|
||||
|
||||
|
||||
//2. 保存MyOnTouchListener接口的列表
|
||||
private ArrayList<MainTabActivity.MyOnTouchListener> onTouchListeners = new ArrayList<MainTabActivity.MyOnTouchListener>();
|
||||
//4.提供给Fragment通过getActivity()方法来注册自己的触摸事件的方法
|
||||
public void registerMyOnTouchListener(MainTabActivity.MyOnTouchListener myOnTouchListener) {
|
||||
onTouchListeners.add(myOnTouchListener);
|
||||
}
|
||||
|
||||
//5.提供给Fragment通过getActivity()方法来注销自己的触摸事件的方法
|
||||
public void unregisterMyOnTouchListener(MainTabActivity.MyOnTouchListener myOnTouchListener) {
|
||||
onTouchListeners.remove(myOnTouchListener);
|
||||
}
|
||||
class MyViewPagerAdapter extends FragmentPagerAdapter {
|
||||
public MyViewPagerAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
package com.sl.house_property.discovery;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
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;
|
||||
@@ -17,19 +24,23 @@ import com.bumptech.glide.request.RequestOptions;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.internal.LinkedTreeMap;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lzy.ninegrid.ImageInfo;
|
||||
import com.lzy.ninegrid.preview.NineGridViewClickAdapter;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
import com.sl.house_property.BaseFragment;
|
||||
import com.sl.house_property.Main2Fragment;
|
||||
import com.sl.house_property.MainTabActivity;
|
||||
import com.sl.house_property.R;
|
||||
import com.sl.house_property.databinding.FragmentHistoryRecordBinding;
|
||||
import com.sl.house_property.databinding.ItemCommentBinding;
|
||||
import com.sl.house_property.databinding.ItemDiscoveryBinding;
|
||||
import com.sl.house_property.order.SettleActivity;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import com.squareup.picasso.Target;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
@@ -39,17 +50,24 @@ import java.util.Map;
|
||||
|
||||
import adapter.BaseRecycleViewAdapter;
|
||||
import entity.DiscoveryListEntity;
|
||||
import entity.GoodsDetailEntity;
|
||||
import entity.RegisterUser;
|
||||
import http.ApiConfig;
|
||||
import my_loader.Loader;
|
||||
import my_loader.Resultcode;
|
||||
import my_view.CommentDialog;
|
||||
import my_view.tao_bao_refresh.FullyGridLayoutManager;
|
||||
import rx.Subscription;
|
||||
import rx.functions.Action1;
|
||||
import tools.Config;
|
||||
import tools.PicassoRoundTransform;
|
||||
import utils.CommonUtils;
|
||||
import utils.DateUtils;
|
||||
import utils.KeyboardUtil;
|
||||
import utils.Md5;
|
||||
import utils.UtilHelpers;
|
||||
|
||||
public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBinding> {
|
||||
public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBinding> implements MainTabActivity.MyOnTouchListener {
|
||||
private Context context;
|
||||
private int type = 2;
|
||||
private int page = 1;
|
||||
@@ -76,6 +94,19 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
super.onCreate(savedInstanceState);
|
||||
type = getArguments().getInt("param1");
|
||||
userId = getArguments().getString("param2");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreateVew(LayoutInflater inflater, Bundle savedInstanceState) {
|
||||
super.onCreateVew(inflater, savedInstanceState);
|
||||
if (getActivity() instanceof MainTabActivity) {
|
||||
final MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.registerMyOnTouchListener(this);
|
||||
} else if (getActivity() instanceof HistoryRecordActivity) {
|
||||
((HistoryRecordActivity) getActivity()).registerMyOnTouchListener(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,6 +115,7 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
|
||||
context = getContext();
|
||||
loader = new Loader();
|
||||
|
||||
mDataBinding.dw.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
@@ -100,9 +132,92 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
mDataBinding.dw.autoRefresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouch(MotionEvent ev) {
|
||||
switch (ev.getAction()) {
|
||||
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
//点击空白处隐藏键盘,隐藏输入框相关
|
||||
if (getActivity().getCurrentFocus() != null && getActivity().getCurrentFocus().getId() == R.id.tv_send_comment) {
|
||||
return false;
|
||||
}
|
||||
boolean b = UtilHelpers.hideKeyboard(ev, getActivity().getCurrentFocus(), getActivity());
|
||||
if (b) {
|
||||
CommonUtils.hideSoftInput(mDataBinding.etComment.getContext(), mDataBinding.etComment);
|
||||
if (getActivity() instanceof MainTabActivity) {
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.visibilyBottom(View.VISIBLE);
|
||||
}
|
||||
mDataBinding.llComment.setVisibility(View.GONE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private int currentKeyboardH;
|
||||
private int editTextBodyHeight;
|
||||
|
||||
private void setViewTreeObserver() {
|
||||
final ViewTreeObserver swipeRefreshLayoutVTO = mDataBinding.rl.getViewTreeObserver();
|
||||
swipeRefreshLayoutVTO.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
Rect r = new Rect();
|
||||
mDataBinding.rl.getWindowVisibleDisplayFrame(r);
|
||||
int statusBarH = ImmersionBar.getStatusBarHeight(HistoryRecordFragment.this);//状态栏高度
|
||||
int screenH = mDataBinding.rl.getRootView().getHeight();
|
||||
if (r.top != statusBarH) {
|
||||
//r.top代表的是状态栏高度,在沉浸式状态栏时r.top=0,通过getStatusBarHeight获取状态栏高度
|
||||
r.top = statusBarH;
|
||||
}
|
||||
int keyboardH = screenH - (r.bottom - r.top);
|
||||
|
||||
if (keyboardH == currentKeyboardH) {//有变化时才处理,否则会陷入死循环
|
||||
return;
|
||||
}
|
||||
currentKeyboardH = keyboardH;
|
||||
editTextBodyHeight = mDataBinding.llComment.getHeight();
|
||||
if (keyboardH < 150) {//说明是隐藏键盘的情况
|
||||
updateEditTextBodyVisible(View.GONE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateEditTextBodyVisible(int visibility) {
|
||||
mDataBinding.llComment.setVisibility(visibility);
|
||||
if (View.VISIBLE == visibility) {
|
||||
mDataBinding.llComment.requestFocus();
|
||||
//弹出键盘
|
||||
CommonUtils.showSoftInput(mDataBinding.etComment.getContext(), mDataBinding.etComment);
|
||||
|
||||
} else if (View.GONE == visibility) {
|
||||
//隐藏键盘
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.visibilyBottom(View.VISIBLE);
|
||||
CommonUtils.hideSoftInput(mDataBinding.etComment.getContext(), mDataBinding.etComment);
|
||||
}
|
||||
}
|
||||
|
||||
private void intRecycleView() {
|
||||
|
||||
mDataBinding.tvSendComment.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
setViewTreeObserver();
|
||||
}
|
||||
});
|
||||
mDataBinding.sv.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
if (mDataBinding.llComment.getVisibility() == View.VISIBLE) {
|
||||
updateEditTextBodyVisible(View.GONE);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
|
||||
mDataBinding.recyView.setNestedScrollingEnabled(false);//禁止rcyc嵌套滑动
|
||||
@@ -117,7 +232,7 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
if (!(position >= discoveryListEntities.size())) {
|
||||
final ItemDiscoveryBinding homeGridAdapterItemBinding = (ItemDiscoveryBinding) b;
|
||||
// homeGridAdapterItemBinding.setMyentity(discoveryListEntities.get(position));
|
||||
homeGridAdapterItemBinding.ivComment.setVisibility(View.GONE);
|
||||
homeGridAdapterItemBinding.ivComment.setVisibility(View.VISIBLE);
|
||||
final DiscoveryListEntity discoveryListEntity = discoveryListEntities.get(position);
|
||||
homeGridAdapterItemBinding.tvNikeName.setText(discoveryListEntity.getNickname());
|
||||
homeGridAdapterItemBinding.tvContent.setText(discoveryListEntity.getGoods_detail());
|
||||
@@ -129,13 +244,11 @@ 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) {
|
||||
likeString.append("❤");
|
||||
|
||||
} else {
|
||||
if (i != 0 && i != discoveryListEntity.getLike().size() - 1) {
|
||||
likeString.append(",");
|
||||
}
|
||||
likeString.append(discoveryListEntity.getLike().get(i).getNickname());
|
||||
|
||||
}
|
||||
homeGridAdapterItemBinding.tvLike.setText(likeString.toString());
|
||||
|
||||
@@ -188,7 +301,7 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
|
||||
if (discoveryListEntity.getPic().size() > 0) {
|
||||
|
||||
// Log.e("pic", discoveryListEntity.getPic().get(0));
|
||||
// Log.e("pic", discoveryListEntity.getPic().get(0));
|
||||
for (int i = 0; i < discoveryListEntity.getPic().size(); i++) {
|
||||
if (discoveryListEntity.getPic().get(i).endsWith(".mp4") || discoveryListEntity.getPic().get(i).endsWith(".avi")) {
|
||||
ImageInfo imageInfo = new ImageInfo();
|
||||
@@ -214,12 +327,344 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
imageInfos.add(imageInfo);
|
||||
}
|
||||
homeGridAdapterItemBinding.nineGrid.setAdapter(new NineGridViewClickAdapter(context, imageInfos));
|
||||
|
||||
homeGridAdapterItemBinding.ivComment.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
final CommentDialog commentDialog = new CommentDialog(getContext());
|
||||
commentDialog.setShowBug(discoveryListEntity.getType() == 2);
|
||||
commentDialog.setPraise(discoveryListEntity.getIs_like() == 1);
|
||||
// commentDialog.setShowBug(discoveryListEntity.getType() == 2);
|
||||
commentDialog.setPraise(discoveryListEntity.getIs_like() == 1);
|
||||
final int mBottomY = getCoordinateY(homeGridAdapterItemBinding.ivComment) + homeGridAdapterItemBinding.ivComment.getHeight();
|
||||
|
||||
commentDialog.setOnCommentOperateListener(new CommentDialog.OnCommentOperateListener() {
|
||||
@Override
|
||||
public void click(int type) {
|
||||
|
||||
if (type == 1 || type == 2) {
|
||||
//点赞/取消
|
||||
commentDialog.dismiss();
|
||||
like(discoveryListEntity.getGoods_id(), position);
|
||||
} else if (type == 3) {
|
||||
mDataBinding.llComment.setVisibility(View.VISIBLE);
|
||||
mDataBinding.etComment.requestFocus();
|
||||
mDataBinding.etComment.setHint("评论");
|
||||
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);
|
||||
|
||||
|
||||
} else if (type == 4) {
|
||||
// addCart(discoveryListEntity.getGoods_id(),discoveryListEntity.)
|
||||
getGoodsDetail(discoveryListEntity.getGoods_id(), discoveryListEntity, type);
|
||||
commentDialog.dismiss();
|
||||
|
||||
} else if (type == 5) {
|
||||
getGoodsDetail(discoveryListEntity.getGoods_id(), discoveryListEntity, type);
|
||||
commentDialog.dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
new XPopup.Builder(getContext()).hasShadowBg(false).atView(homeGridAdapterItemBinding.ivComment).asCustom(commentDialog)
|
||||
.show();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
mDataBinding.recyView.setAdapter(baseRecycleViewAdapter);
|
||||
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
mDataBinding.tvSendComment.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (getActivity() instanceof MainTabActivity) {
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
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());
|
||||
|
||||
} 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());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
private int commentPosition = -1;
|
||||
private void comment(String goodsId, final int position, String reply_id, final String content) {
|
||||
final RegisterUser user =
|
||||
Config.getInstance(getContext()).getUser();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
if (user != null) {
|
||||
map.put("userid", user.getUserid());
|
||||
} else {
|
||||
map.put("userid", 0 + "");
|
||||
}
|
||||
map.put("app", "Goods");
|
||||
map.put("class", "DisGoods");
|
||||
map.put("goods_id", goodsId);
|
||||
if (!TextUtils.isEmpty(reply_id)) {
|
||||
map.put("reply_id", reply_id);
|
||||
}
|
||||
|
||||
map.put("contents", content);
|
||||
map.put("sign", Md5.md5("Goods" + "DisGoods" + Md5.secret));
|
||||
progressDialog.setMessage("提交中");
|
||||
progressDialog.setCancelable(false);
|
||||
// progressDialog.show();
|
||||
|
||||
Loader mGankLoader = new Loader();
|
||||
Subscription subscription = 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();
|
||||
}
|
||||
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();
|
||||
dis_content1.add(dis_content);
|
||||
|
||||
discoveryListEntity.setDis_content(dis_content1);
|
||||
adapter.upDateOne(position,discoveryListEntity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}, new Action1<Throwable>() {
|
||||
@Override
|
||||
public void call(Throwable throwable) {
|
||||
progressDialog.dismiss();
|
||||
Toast.makeText(getContext(), "提交失败", Toast.LENGTH_SHORT).show();
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void getGoodsDetail(final String goodsId, final DiscoveryListEntity entity, final int goodtype) {
|
||||
final RegisterUser user =
|
||||
Config.getInstance(getContext()).getUser();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
if (user != null) {
|
||||
map.put("userid", user.getUserid());
|
||||
} else {
|
||||
map.put("userid", 0 + "");
|
||||
}
|
||||
map.put("app", "Goods");
|
||||
map.put("class", "GoodsInfo");
|
||||
map.put("goods_id", goodsId);
|
||||
map.put("sign", Md5.md5("Goods" + "GoodsInfo" + Md5.secret));
|
||||
progressDialog.setMessage("获取信息中");
|
||||
progressDialog.setCancelable(false);
|
||||
Loader mGankLoader = new Loader();
|
||||
Subscription subscription = mGankLoader.getMovie(ApiConfig.BASE_URL, map)
|
||||
.subscribe(new Action1<Resultcode>() {
|
||||
@Override
|
||||
public void call(Resultcode resultcode) {
|
||||
progressDialog.dismiss();
|
||||
if (resultcode.status == 0) {
|
||||
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");
|
||||
final Type type = new TypeToken<ArrayList<GoodsDetailEntity>>() {
|
||||
}.getType();
|
||||
ArrayList<GoodsDetailEntity> o = gs.fromJson(array.toString(), type);
|
||||
|
||||
GoodsInfoDialog goodsInfoDialog = new GoodsInfoDialog(getContext(), entity, o);
|
||||
goodsInfoDialog.setOnConfirmListener(new GoodsInfoDialog.OnGoodsSelectPropertyListener() {
|
||||
@Override
|
||||
public void onSelect(String code, int num) {
|
||||
if (goodtype == 4) {
|
||||
Intent intent = new Intent(getContext(), SettleActivity.class);
|
||||
intent.putExtra("goodsType", 1);
|
||||
intent.putExtra("goods_id", goodsId);
|
||||
intent.putExtra("product_code", code);
|
||||
intent.putExtra("sale_num", num + "");
|
||||
startActivity(intent);
|
||||
} else if (goodtype == 5) {
|
||||
addCart(goodsId, code, num + "");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
new XPopup.Builder(getContext()).asCustom(goodsInfoDialog).show();
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
// .setToast(resultcode.msg);
|
||||
Toast.makeText(getContext(), resultcode.msg, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}, new Action1<Throwable>() {
|
||||
@Override
|
||||
public void call(Throwable throwable) {
|
||||
progressDialog.dismiss();
|
||||
Toast.makeText(getContext(), "获取信息失败", Toast.LENGTH_SHORT).show();
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void addCart(String goods_id, String product_code, String goodsNum) {
|
||||
RegisterUser user =
|
||||
Config.getInstance(getContext()).getUser();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
if (user != null) {
|
||||
map.put("userid", user.getUserid());
|
||||
} else {
|
||||
map.put("userid", 0 + "");
|
||||
}
|
||||
map.put("app", "Goods");
|
||||
map.put("class", "AddCart");
|
||||
map.put("goods_id", goods_id);
|
||||
map.put("product_code", product_code);
|
||||
map.put("num", goodsNum);
|
||||
map.put("sign", Md5.md5("Goods" + "AddCart" + Md5.secret));
|
||||
progressDialog.setMessage("提交中");
|
||||
progressDialog.setCancelable(false);
|
||||
Loader mGankLoader = new Loader();
|
||||
Subscription subscribe = 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(), "成功加入购物车", Toast.LENGTH_SHORT).show();
|
||||
// baseActivity.setToast(0, "成功加入购物车");
|
||||
} else {
|
||||
Toast.makeText(getContext(), resultcode.msg, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}, new Action1<Throwable>() {
|
||||
@Override
|
||||
public void call(Throwable throwable) {
|
||||
progressDialog.dismiss();
|
||||
Toast.makeText(getContext(), "提交失败", Toast.LENGTH_SHORT).show();
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void like(String goodsId, final int position) {
|
||||
final RegisterUser user =
|
||||
Config.getInstance(getContext()).getUser();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
if (user != null) {
|
||||
map.put("userid", user.getUserid());
|
||||
} else {
|
||||
map.put("userid", 0 + "");
|
||||
}
|
||||
map.put("app", "Goods");
|
||||
map.put("class", "AddUp");
|
||||
map.put("goods_id", goodsId);
|
||||
map.put("sign", Md5.md5("Goods" + "AddUp" + Md5.secret));
|
||||
progressDialog.setMessage("提交中");
|
||||
progressDialog.setCancelable(false);
|
||||
// progressDialog.show();
|
||||
|
||||
Loader mGankLoader = new Loader();
|
||||
Subscription subscription = 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();
|
||||
}
|
||||
if (resultcode.status == 0) {
|
||||
BaseRecycleViewAdapter adapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
if (discoveryListEntities.get(position).getIs_like() == 1) {
|
||||
discoveryListEntities.get(position).setIs_like(0);
|
||||
ArrayList<DiscoveryListEntity.Like> like = discoveryListEntities.get(position).getLike();
|
||||
for (int i = 0; i < like.size(); i++) {
|
||||
if (user.getUserid().equals(like.get(i).getUserid())) {
|
||||
like.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
discoveryListEntities.get(position).setLike(like);
|
||||
} else {
|
||||
discoveryListEntities.get(position).setIs_like(1);
|
||||
DiscoveryListEntity.Like like = new DiscoveryListEntity.Like();
|
||||
like.setNickname(user.getNickname());
|
||||
like.setUserid(user.getUserid());
|
||||
discoveryListEntities.get(position).getLike().add(like);
|
||||
}
|
||||
|
||||
adapter.upDateOne(position, discoveryListEntities.get(position));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}, new Action1<Throwable>() {
|
||||
@Override
|
||||
public void call(Throwable throwable) {
|
||||
progressDialog.dismiss();
|
||||
Toast.makeText(getContext(), "提交失败", Toast.LENGTH_SHORT).show();
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取控件左上顶点Y坐标
|
||||
*
|
||||
* @param view
|
||||
* @return
|
||||
*/
|
||||
private int getCoordinateY(View view) {
|
||||
int[] coordinate = new int[2];
|
||||
view.getLocationOnScreen(coordinate);
|
||||
return coordinate[1];
|
||||
}
|
||||
|
||||
private void getData() {
|
||||
@@ -321,5 +766,4 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.view.LayoutInflater;
|
||||
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.sl.house_property.BaseFragment;
|
||||
import com.sl.house_property.MainTabActivity;
|
||||
import com.sl.house_property.R;
|
||||
import com.sl.house_property.databinding.FragmentLikeBinding;
|
||||
|
||||
@@ -61,6 +62,8 @@ public class LikeFragment extends BaseFragment<FragmentLikeBinding> {
|
||||
}
|
||||
}
|
||||
|
||||
private MainTabActivity.MyOnTouchListener myOnTouchListener;
|
||||
|
||||
@Override
|
||||
protected void onCreateVew(LayoutInflater inflater, Bundle savedInstanceState) {
|
||||
super.onCreateVew(inflater, savedInstanceState);
|
||||
@@ -83,6 +86,7 @@ public class LikeFragment extends BaseFragment<FragmentLikeBinding> {
|
||||
} else {
|
||||
userId = "0";
|
||||
}
|
||||
|
||||
fragments.add(HistoryRecordFragment.newInstance(1, userId));
|
||||
fragments.add(HistoryRecordFragment.newInstance(2, userId));
|
||||
MyViewPagerAdapter myViewPagerAdapter = new MyViewPagerAdapter(getChildFragmentManager());
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.sl.house_property.discovery;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.view.View;
|
||||
|
||||
import com.lxj.xpopup.core.BottomPopupView;
|
||||
import com.sl.house_property.R;
|
||||
|
||||
public class SelectDialog extends BottomPopupView {
|
||||
|
||||
private OnSelectListener listener;
|
||||
|
||||
public SelectDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.dialog_select;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
findViewById(R.id.btn_edit).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (listener!=null){
|
||||
listener.select(1);
|
||||
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
findViewById(R.id.btn_delete).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (listener != null) {
|
||||
listener.select(2);
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
findViewById(R.id.btn_cancel).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setOnSelectListener(OnSelectListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public interface OnSelectListener {
|
||||
void select(int type);
|
||||
}
|
||||
}
|
||||
@@ -207,6 +207,7 @@ public class OrderActivity extends BaseActivity<ActivityOrderBinding> {
|
||||
//付款
|
||||
Intent intent = new Intent(context, PayActivity.class);
|
||||
intent.putExtra("payment_amount", orderListBean.getOrder_money());
|
||||
intent.putExtra("order_number",orderListBean.getOrder_number());
|
||||
startActivityForResult(intent, 18);
|
||||
} else if (b.btnFk.getText().equals("取消订单")) {
|
||||
new XPopup.Builder(context).asConfirm("", "确定要取消订单吗?", new OnConfirmListener() {
|
||||
|
||||
@@ -198,6 +198,7 @@ public class OrderDetailActivity extends BaseActivity<ActivityOrderDetailBinding
|
||||
//付款
|
||||
Intent intent = new Intent(context, PayActivity.class);
|
||||
intent.putExtra("payment_amount", orderListBean.getOrder_money());
|
||||
intent.putExtra("order_number",orderListBean.getOrder_number());
|
||||
startActivityForResult(intent, 18);
|
||||
} else if (mDataBinding.btnFk.getText().equals("取消订单")) {
|
||||
new XPopup.Builder(context).asConfirm("", "确定要取消订单吗?", new OnConfirmListener() {
|
||||
|
||||
@@ -33,6 +33,7 @@ import utils.Md5;
|
||||
public class PayActivity extends BaseActivity<ActivityPayBinding> {
|
||||
private Context context;
|
||||
private String payment_amount;
|
||||
private String order_number;
|
||||
private BroadcastReceiver receiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent1) {
|
||||
@@ -49,6 +50,7 @@ public class PayActivity extends BaseActivity<ActivityPayBinding> {
|
||||
}
|
||||
};
|
||||
private int type;
|
||||
private String cart_id;
|
||||
|
||||
@Override
|
||||
protected int getLayoutResId() {
|
||||
@@ -76,7 +78,7 @@ public class PayActivity extends BaseActivity<ActivityPayBinding> {
|
||||
mDataBinding.tvTitle.setText("支付");
|
||||
type = intent.getIntExtra("type", 0);
|
||||
payment_amount = intent.getStringExtra("payment_amount");
|
||||
|
||||
order_number=intent.getStringExtra("order_number");
|
||||
String wallet = intent.getStringExtra("wallet");
|
||||
mDataBinding.tv.setText("钱包支付(余额 ¥" + wallet + ")");
|
||||
mDataBinding.tvAmount.setText(payment_amount);
|
||||
@@ -135,6 +137,8 @@ public class PayActivity extends BaseActivity<ActivityPayBinding> {
|
||||
IntentFilter intentFilter = new IntentFilter();
|
||||
intentFilter.addAction("PaySuccess");
|
||||
registerReceiver(receiver, intentFilter);
|
||||
cart_id = getIntent().getStringExtra("cart_id");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,9 +156,13 @@ public class PayActivity extends BaseActivity<ActivityPayBinding> {
|
||||
} else {
|
||||
map.put("userid", 0 + "");
|
||||
}
|
||||
if (cart_id != null) {
|
||||
map.put("cart_ids", cart_id);
|
||||
}
|
||||
map.put("app", "System");
|
||||
map.put("class", "OrderPrePayId");
|
||||
map.put("amount", payment_amount);
|
||||
map.put("order_number", order_number);
|
||||
map.put("sign", Md5.md5("System" + "OrderPrePayId" + Md5.secret));
|
||||
loader.getMovie(ApiConfig.BASE_URL, map).subscribe(new Action1<Resultcode>() {
|
||||
@Override
|
||||
@@ -193,6 +201,7 @@ public class PayActivity extends BaseActivity<ActivityPayBinding> {
|
||||
}
|
||||
map.put("app", "Order");
|
||||
map.put("class", "PayBalance");
|
||||
|
||||
map.put("order_number", payment_amount);
|
||||
map.put("sign", Md5.md5("Order" + "PayBalance" + Md5.secret));
|
||||
loader.getMovie(ApiConfig.BASE_URL, map).subscribe(new Action1<Resultcode>() {
|
||||
|
||||
@@ -301,6 +301,9 @@ public class SettleActivity extends BaseActivity<ActivitySettleBinding> {
|
||||
JSONObject jsonObject = new JSONObject(s);
|
||||
String order_number = jsonObject.getString("order_number");
|
||||
intent.putExtra("order_number", order_number);
|
||||
if (goodsType==2){
|
||||
intent.putExtra("cart_id",cart_id);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="78.5885"
|
||||
android:endY="90.9159"
|
||||
android:startX="48.7653"
|
||||
android:startY="61.0927"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1" />
|
||||
</vector>
|
||||
@@ -69,8 +69,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_code"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="200dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="50dp"
|
||||
android:src="@mipmap/qrcode" />
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
android:padding="8dp">
|
||||
|
||||
<TextView
|
||||
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
|
||||
android:id="@+id/tv_zan"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -57,14 +58,13 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:drawableLeft="@mipmap/buy"
|
||||
android:drawableLeft="@mipmap/gm"
|
||||
android:drawablePadding="5dp"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="14dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingRight="14dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="购买"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
@@ -73,14 +73,13 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:drawableLeft="@mipmap/gwc1"
|
||||
android:drawablePadding="5dp"
|
||||
android:drawableLeft="@mipmap/gwc3"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="14dp"
|
||||
android:paddingTop="5dp"
|
||||
android:drawablePadding="5dp"
|
||||
android:paddingRight="14dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="购物车"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
/>
|
||||
</LinearLayout>
|
||||
51
app/src/main/res/layout/dialog_select.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<?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:textAllCaps="false"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<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: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>
|
||||
@@ -18,19 +18,19 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/ll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="@dimen/mystatusbar"
|
||||
android:orientation="horizontal">
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="发现"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
@@ -38,14 +38,15 @@
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:id="@+id/iv_add"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:src="@drawable/ic_photo_camera" />
|
||||
android:src="@mipmap/xj2" />
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/dw"
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/rl"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/dw"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:background="@color/white"
|
||||
app:srlDisableContentWhenLoading="true"
|
||||
app:srlEnableLoadMore="true"
|
||||
@@ -76,5 +75,50 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_alignParentBottom="true"
|
||||
android:id="@+id/ll_comment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="#f6f6f6"
|
||||
android:elevation="3dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_comment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginRight="7dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_comment_bg"
|
||||
android:ellipsize="end"
|
||||
android:hint="说点什么"
|
||||
android:maxLength="300"
|
||||
android:paddingLeft="10dp"
|
||||
android:singleLine="true"
|
||||
android:textColorHint="#a2a2a2"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_send_comment"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:background="@drawable/shape_comment"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="发送"
|
||||
android:textColor="#fff"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</layout>
|
||||
@@ -44,8 +44,8 @@
|
||||
app:ngv_gridSpacing="5dp"
|
||||
app:ngv_maxSize="9"
|
||||
app:ngv_mode="grid"
|
||||
app:ngv_singleImageRatio="1"
|
||||
app:ngv_singleImageSize="250dp" />
|
||||
app:ngv_singleImageRatio="0.8"
|
||||
app:ngv_singleImageSize="180dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -75,19 +75,20 @@
|
||||
|
||||
|
||||
<TextView
|
||||
android:drawableLeft="@mipmap/like"
|
||||
android:padding="3dp"
|
||||
android:id="@+id/tv_like"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/LightGraydddddd"
|
||||
android:text="❤ 哈哈哈,呵呵呵" />
|
||||
android:background="#15Dddddd"
|
||||
/>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:paddingLeft="3dp"
|
||||
android:id="@+id/rv_comment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/LightGraydddddd" />
|
||||
android:background="#20Dddddd" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
BIN
app/src/main/res/mipmap-xhdpi/gm.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
app/src/main/res/mipmap-xhdpi/gwc3.png
Normal file
|
After Width: | Height: | Size: 871 B |
BIN
app/src/main/res/mipmap-xhdpi/xj.png
Normal file
|
After Width: | Height: | Size: 936 B |
BIN
app/src/main/res/mipmap-xhdpi/xj2.png
Normal file
|
After Width: | Height: | Size: 936 B |
BIN
app/src/main/res/mipmap-xxhdpi/like.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/xj.png
Normal file
|
After Width: | Height: | Size: 936 B |
@@ -22,8 +22,8 @@ public class NineGridView extends ViewGroup {
|
||||
|
||||
private static ImageLoader mImageLoader; //全局的图片加载器(必须设置,否者不显示图片)
|
||||
|
||||
private int singleImageSize = 250; // 单张图片时的最大大小,单位dp
|
||||
private float singleImageRatio = 1.0f; // 单张图片的宽高比(宽/高)
|
||||
private int singleImageSize = 220; // 单张图片时的最大大小,单位dp
|
||||
private float singleImageRatio = 2f; // 单张图片的宽高比(宽/高)
|
||||
private int maxImageSize = 9; // 最大显示的图片数
|
||||
private int gridSpacing = 3; // 宫格间距,单位dp
|
||||
private int mode = MODE_FILL; // 默认使用fill模式
|
||||
|
||||
@@ -38,7 +38,7 @@ public abstract class NineGridViewAdapter implements Serializable {
|
||||
protected NineGridViewWrapper generateImageView(Context context, int type) {
|
||||
NineGridViewWrapper imageView = new NineGridViewWrapper(context);
|
||||
imageView.setType(type);
|
||||
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
|
||||
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
imageView.setImageResource(R.drawable.ic_default_color);
|
||||
return imageView;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.text.TextPaint;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.MotionEvent;
|
||||
import android.widget.ImageView;
|
||||
@@ -59,9 +60,12 @@ public class NineGridViewWrapper extends ImageView {
|
||||
if (mType == 2) {
|
||||
// canvas.drawColor(maskColor);
|
||||
// float baseY = getHeight() / 2 - (textPaint.ascent() + textPaint.descent()) / 2;
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon_image);
|
||||
canvas.translate(getWidth() / 2, getHeight() / 2);
|
||||
canvas.drawBitmap(bitmap, -50, -50, null);
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.bf);
|
||||
// canvas.translate(getWidth() / 2, getHeight() / 2);
|
||||
// canvas.drawBitmap(bitmap, 0, 0, null);
|
||||
|
||||
|
||||
canvas.drawBitmap(bitmap, getWidth()/2 - bitmap.getWidth() / 2, getHeight()/2 - bitmap.getHeight() / 2,null);
|
||||
}
|
||||
// if (mType == 2) {
|
||||
// Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.phone);
|
||||
|
||||
BIN
ninegridview/src/main/res/drawable/bf.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |