1
This commit is contained in:
@@ -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,21 @@
|
||||
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.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 +23,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.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,6 +49,7 @@ import java.util.Map;
|
||||
|
||||
import adapter.BaseRecycleViewAdapter;
|
||||
import entity.DiscoveryListEntity;
|
||||
import entity.GoodsDetailEntity;
|
||||
import entity.RegisterUser;
|
||||
import http.ApiConfig;
|
||||
import my_loader.Loader;
|
||||
@@ -49,10 +60,13 @@ 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;
|
||||
@@ -79,6 +93,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
|
||||
@@ -87,6 +114,7 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
|
||||
context = getContext();
|
||||
loader = new Loader();
|
||||
|
||||
mDataBinding.dw.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
@@ -103,9 +131,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嵌套滑动
|
||||
@@ -125,7 +236,23 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
homeGridAdapterItemBinding.tvNikeName.setText(discoveryListEntity.getNickname());
|
||||
homeGridAdapterItemBinding.tvContent.setText(discoveryListEntity.getGoods_detail());
|
||||
|
||||
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(discoveryListEntity.getGoods_id(), position, "", mDataBinding.etComment.getText().toString());
|
||||
} else if (getActivity() instanceof HistoryRecordActivity) {
|
||||
CommonUtils.hideSoftInput(getContext(), mDataBinding.etComment);
|
||||
mDataBinding.llComment.setVisibility(View.GONE);
|
||||
comment(discoveryListEntity.getGoods_id(), position, "", mDataBinding.etComment.getText().toString());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
if (discoveryListEntity.getLike().isEmpty()) {
|
||||
homeGridAdapterItemBinding.tvLike.setVisibility(View.GONE);
|
||||
} else {
|
||||
@@ -222,9 +349,12 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
final CommentDialog commentDialog = new CommentDialog(getContext());
|
||||
commentDialog.setShowBug(discoveryListEntity.getType() == 2);
|
||||
commentDialog.setPraise(discoveryListEntity.getIs_like() == 1);
|
||||
// commentDialog.setShowBug(discoveryListEntity.getType() == 2);
|
||||
commentDialog.setPraise(discoveryListEntity.getIs_like() == 1);
|
||||
commentDialog.setType();
|
||||
final int mBottomY = getCoordinateY(homeGridAdapterItemBinding.ivComment) + homeGridAdapterItemBinding.ivComment.getHeight();
|
||||
|
||||
commentDialog.setOnCommentOperateListener(new CommentDialog.OnCommentOperateListener() {
|
||||
@Override
|
||||
public void click(int type) {
|
||||
@@ -233,6 +363,34 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
//点赞/取消
|
||||
commentDialog.dismiss();
|
||||
like(discoveryListEntity.getGoods_id(), position);
|
||||
} else if (type == 3) {
|
||||
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("");
|
||||
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();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -249,6 +407,180 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
BaseRecycleViewAdapter adapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
DiscoveryListEntity.Dis_content dis_content = new DiscoveryListEntity.Dis_content();
|
||||
LinkedTreeMap adta = (LinkedTreeMap) resultcode.data;
|
||||
dis_content.setContents(adta.get("contents").toString());
|
||||
// dis_content.set(adta.get("goods_id").toString());
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
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();
|
||||
@@ -266,7 +598,7 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
progressDialog.setCancelable(false);
|
||||
// progressDialog.show();
|
||||
|
||||
Loader mGankLoader = new Loader();
|
||||
Loader mGankLoader = new Loader();
|
||||
Subscription subscription = mGankLoader.getMovie(ApiConfig.BASE_URL, map).subscribe(new Action1<Resultcode>() {
|
||||
|
||||
|
||||
@@ -275,7 +607,7 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
|
||||
progressDialog.dismiss();
|
||||
if (!(resultcode.status == 0)) {
|
||||
Toast.makeText(getContext(),resultcode.msg,Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getContext(), resultcode.msg, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
if (resultcode.status == 0) {
|
||||
BaseRecycleViewAdapter adapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
@@ -307,14 +639,14 @@ public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBin
|
||||
@Override
|
||||
public void call(Throwable throwable) {
|
||||
progressDialog.dismiss();
|
||||
Toast.makeText(getContext(),"提交失败",Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getContext(), "提交失败", Toast.LENGTH_SHORT).show();
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取控件左上顶点Y坐标
|
||||
*
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -60,12 +60,7 @@ public class CommentDialog extends HorizontalAttachPopupView {
|
||||
}
|
||||
});
|
||||
}
|
||||
public void setType(){
|
||||
findViewById(R.id.tv_comment).setVisibility(View.GONE);
|
||||
findViewById(R.id.tv_bug).setVisibility(View.GONE);
|
||||
findViewById(R.id.tv_add).setVisibility(View.GONE);
|
||||
findViewById(R.id.v).setVisibility(GONE);
|
||||
}
|
||||
|
||||
public void setShowBug(boolean type) {
|
||||
|
||||
if (type) {
|
||||
|
||||
@@ -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>
|
||||
@@ -64,7 +64,6 @@
|
||||
android:paddingTop="5dp"
|
||||
android:paddingRight="14dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="购买"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
@@ -80,7 +79,6 @@
|
||||
android:paddingTop="5dp"
|
||||
android:paddingRight="14dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:text="购物车"
|
||||
android:textColor="@color/white"
|
||||
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="200dp" />
|
||||
app:ngv_singleImageRatio="0.8"
|
||||
app:ngv_singleImageSize="180dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -79,7 +79,7 @@
|
||||
android:id="@+id/tv_like"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/LightGraydddddd"
|
||||
android:background="#15Dddddd"
|
||||
android:text="❤ 哈哈哈,呵呵呵" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
@@ -87,7 +87,7 @@
|
||||
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/xj.png
Normal file
BIN
app/src/main/res/mipmap-xhdpi/xj.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 936 B |
BIN
app/src/main/res/mipmap-xhdpi/xj2.png
Normal file
BIN
app/src/main/res/mipmap-xhdpi/xj2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 936 B |
BIN
app/src/main/res/mipmap-xxhdpi/xj.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/xj.png
Normal file
Binary file not shown.
|
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模式
|
||||
|
||||
@@ -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
BIN
ninegridview/src/main/res/drawable/bf.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Reference in New Issue
Block a user