1
This commit is contained in:
@@ -137,6 +137,9 @@ android {
|
||||
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0' //1.0.5及以前版本的老用户升级需谨慎,API改动过大
|
||||
// 基础依赖包,必须要依赖
|
||||
implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
|
||||
|
||||
|
||||
// implementation 'com.zhihu.android:matisse:0.5.3-beta3'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -281,6 +281,9 @@
|
||||
android:exported="false"
|
||||
android:screenOrientation="behind">
|
||||
</activity>
|
||||
<activity android:name=".discovery.ImageViewerAndDeleteActivity" />
|
||||
<activity android:name=".discovery.AddDiscoveryActivity" />
|
||||
<activity android:name=".cart.AddressListActivity" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -126,6 +126,7 @@ public abstract class BaseActivity<VDB extends ViewDataBinding> extends RxAppCom
|
||||
View mActionBarView;
|
||||
mActionBarView = mactionBarBinding.getRoot();
|
||||
ActionBar actionBar = this.getSupportActionBar();
|
||||
if (actionBar==null)return mactionBarBinding.getRoot();
|
||||
if (MyPhoneValue.getSDKVersion()[0] > 4) {
|
||||
actionBar.setElevation(0);
|
||||
}
|
||||
@@ -173,9 +174,9 @@ public abstract class BaseActivity<VDB extends ViewDataBinding> extends RxAppCom
|
||||
|
||||
public void fullScreen(Activity activity) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
Window window = activity.getWindow();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
//5.x开始需要把颜色设置透明,否则导航栏会呈现系统默认的浅灰色
|
||||
Window window = activity.getWindow();
|
||||
View decorView = window.getDecorView();
|
||||
//两个 flag 要结合使用,表示让应用的主体内容占用系统状态栏的空间
|
||||
int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
@@ -186,7 +187,6 @@ public abstract class BaseActivity<VDB extends ViewDataBinding> extends RxAppCom
|
||||
//导航栏颜色也可以正常设置
|
||||
// window.setNavigationBarColor(Color.TRANSPARENT);
|
||||
} else {
|
||||
Window window = activity.getWindow();
|
||||
WindowManager.LayoutParams attributes = window.getAttributes();
|
||||
int flagTranslucentStatus = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
|
||||
int flagTranslucentNavigation = WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
|
||||
|
||||
@@ -8,14 +8,14 @@ import android.support.v4.app.Fragment;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.cutil.SizeUtils;
|
||||
import com.cutil.StringUtils;
|
||||
import com.cutil.Utils;
|
||||
import com.sl.house_property.cart.AddressListActivity;
|
||||
import com.sl.house_property.databinding.FragmentMain4Binding;
|
||||
import com.sl.house_property.f1.UserdlistActivity;
|
||||
import com.sl.house_property.user.MyAuthorizedFamilyHistory;
|
||||
import com.sl.house_property.user.MyBillHistory;
|
||||
@@ -26,8 +26,6 @@ import com.sl.house_property.user.MyPropertyActivity;
|
||||
import com.sl.house_property.user.MyServiceHistory;
|
||||
import com.sl.house_property.user.MyUserMessage;
|
||||
import com.sl.house_property.user.MyWalletActivity;
|
||||
import com.sl.house_property.databinding.FragmentMain4Binding;
|
||||
import com.sl.house_property.databinding.UserFragmentItemBinding;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import java.io.File;
|
||||
@@ -36,7 +34,6 @@ import java.util.ArrayList;
|
||||
import adapter.BaseRecycleViewAdapter;
|
||||
import entity.MyUserFEntity;
|
||||
import entity.RegisterUser;
|
||||
import my_view.tao_bao_refresh.FullyGridLayoutManager;
|
||||
import tools.Config;
|
||||
import utils.BitmapTools;
|
||||
|
||||
@@ -49,7 +46,7 @@ import utils.BitmapTools;
|
||||
* Use the {@link Main1Fragment#newInstance} factory method to
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
|
||||
public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
@@ -59,7 +56,7 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
|
||||
// TODO: Rename and change types of parameters
|
||||
private String mParam1;
|
||||
private String mParam2;
|
||||
private int userImgeREQUST=10000;
|
||||
private int userImgeREQUST = 10000;
|
||||
private OnFragmentInteractionListener mListener;
|
||||
private boolean istakepic;
|
||||
private ArrayList<MyUserFEntity> myUserFEntities;
|
||||
@@ -69,14 +66,15 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
|
||||
public Main4Fragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreateVew(LayoutInflater inflater, Bundle savedInstanceState) {
|
||||
super.onCreateVew(inflater, savedInstanceState);
|
||||
mDataBinding.setting.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent=new Intent(getActivity(),SettingActivity.class);
|
||||
startActivity(intent);
|
||||
Intent intent = new Intent(getActivity(), SettingActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
//mDataBinding.myRecyView;
|
||||
@@ -87,9 +85,9 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
|
||||
}
|
||||
});
|
||||
initTopView();
|
||||
initMyReycyView();
|
||||
// initMyReycyView();
|
||||
initData();
|
||||
// mDataBinding.usermale;
|
||||
// mDataBinding.usermale;
|
||||
|
||||
|
||||
/* toolbar.set*/
|
||||
@@ -105,7 +103,7 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
|
||||
}
|
||||
}, 0, null, R.mipmap.head);
|
||||
*/
|
||||
// int height= MyPhoneValue.getStatusBarHeight(getActivity());
|
||||
// int height= MyPhoneValue.getStatusBarHeight(getActivity());
|
||||
|
||||
|
||||
/* mDataBinding.myhistory.setOnClickListener(this);
|
||||
@@ -116,15 +114,15 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* 初始化顶部view
|
||||
* */
|
||||
private void initTopView(){
|
||||
*
|
||||
* 初始化顶部view
|
||||
* */
|
||||
private void initTopView() {
|
||||
DisplayMetrics dm = getResources().getDisplayMetrics();
|
||||
View topView = mDataBinding.topView;
|
||||
LinearLayout.LayoutParams topViewLp = (LinearLayout.LayoutParams) topView.getLayoutParams();
|
||||
topViewLp.width = dm.widthPixels;
|
||||
topViewLp.height = topViewLp.width*152/375;
|
||||
topViewLp.height = topViewLp.width * 152 / 375;
|
||||
topView.setLayoutParams(topViewLp);
|
||||
|
||||
View userView = mDataBinding.userLayout;
|
||||
@@ -136,82 +134,131 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
|
||||
|
||||
userImageView = mDataBinding.userImage;
|
||||
RelativeLayout.LayoutParams userImageLP = (RelativeLayout.LayoutParams) userImageView.getLayoutParams();
|
||||
int userImageHeight = (int) ( userViewLp.height*0.7);
|
||||
int userImageHeight = (int) (userViewLp.height * 0.7);
|
||||
userImageLP.height = userImageHeight;
|
||||
userImageLP.width = userImageHeight;
|
||||
userImageView.setLayoutParams(userImageLP);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void initMyReycyView() {
|
||||
myUserFEntities=getMyActivityList();
|
||||
|
||||
FullyGridLayoutManager mgr = new FullyGridLayoutManager(getActivity(),1);
|
||||
mgr.setOrientation(FullyGridLayoutManager.VERTICAL);
|
||||
mgr.setSmoothScrollbarEnabled(true);
|
||||
mDataBinding.myRecyView.setLayoutManager(mgr);
|
||||
|
||||
baseRecycleViewAdapter=new BaseRecycleViewAdapter(getActivity(),R.layout.user_fragment_item);
|
||||
|
||||
baseRecycleViewAdapter.setOnBindViewHolder(new BaseRecycleViewAdapter.BindView() {
|
||||
mDataBinding.llQianbao.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onBindViewHolder(Object b, final int position) {
|
||||
if(!(position>=myUserFEntities.size())) {
|
||||
UserFragmentItemBinding homeGridAdapterItemBinding = (UserFragmentItemBinding) b;
|
||||
homeGridAdapterItemBinding.setMyentity(myUserFEntities.get(position));
|
||||
homeGridAdapterItemBinding.imageViewlogo.setImageResource(myUserFEntities.get(position).getImagetResource());homeGridAdapterItemBinding.userFragmentItem.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(getActivity(), myUserFEntities.get(position).getMyclazz());
|
||||
intent.putExtra("usertitile", myUserFEntities.get(position).getTitile());
|
||||
startActivityForResult(intent,0);
|
||||
}
|
||||
});
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getActivity(), MyWalletActivity.class);
|
||||
intent.putExtra("usertitile", "我的钱包");
|
||||
startActivityForResult(intent, 0);
|
||||
}
|
||||
});
|
||||
mDataBinding.llShouquan.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getActivity(),MyAuthorizedFamilyHistory.class);
|
||||
intent.putExtra("usertitile", "授权家庭");
|
||||
startActivityForResult(intent, 0);
|
||||
}
|
||||
});
|
||||
mDataBinding.llFangchan.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getActivity(), MyPropertyActivity.class);
|
||||
intent.putExtra("usertitile", "我的房产");
|
||||
startActivityForResult(intent, 0);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
mDataBinding.llYaoshi.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getActivity(), MyKeyManagement.class);
|
||||
intent.putExtra("usertitile", "钥匙管理");
|
||||
startActivityForResult(intent, 0);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
mDataBinding.myRecyView.setAdapter(baseRecycleViewAdapter);
|
||||
baseRecycleViewAdapter.setData(myUserFEntities);
|
||||
mDataBinding.llGeren.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getActivity(), MyUserMessage.class);
|
||||
intent.putExtra("usertitile", "个人信息");
|
||||
startActivityForResult(intent, 0);
|
||||
|
||||
}
|
||||
});
|
||||
mDataBinding.llShouhuo.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getActivity(), AddressListActivity.class);
|
||||
intent.putExtra("usertitile", "收货地址");
|
||||
startActivityForResult(intent, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void refreshData(){
|
||||
// private void initMyReycyView() {
|
||||
// myUserFEntities=getMyActivityList();
|
||||
//
|
||||
// FullyGridLayoutManager mgr = new FullyGridLayoutManager(getActivity(),1);
|
||||
// mgr.setOrientation(FullyGridLayoutManager.VERTICAL);
|
||||
// mgr.setSmoothScrollbarEnabled(true);
|
||||
// mDataBinding.myRecyView.setLayoutManager(mgr);
|
||||
//
|
||||
// baseRecycleViewAdapter=new BaseRecycleViewAdapter(getActivity(),R.layout.user_fragment_item);
|
||||
//
|
||||
// baseRecycleViewAdapter.setOnBindViewHolder(new BaseRecycleViewAdapter.BindView() {
|
||||
// @Override
|
||||
// public void onBindViewHolder(Object b, final int position) {
|
||||
// if(!(position>=myUserFEntities.size())) {
|
||||
// UserFragmentItemBinding homeGridAdapterItemBinding = (UserFragmentItemBinding) b;
|
||||
// homeGridAdapterItemBinding.setMyentity(myUserFEntities.get(position));
|
||||
// homeGridAdapterItemBinding.imageViewlogo.setImageResource(myUserFEntities.get(position).getImagetResource());homeGridAdapterItemBinding.userFragmentItem.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// Intent intent = new Intent(getActivity(), myUserFEntities.get(position).getMyclazz());
|
||||
// intent.putExtra("usertitile", myUserFEntities.get(position).getTitile());
|
||||
// startActivityForResult(intent,0);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// mDataBinding.myRecyView.setAdapter(baseRecycleViewAdapter);
|
||||
// baseRecycleViewAdapter.setData(myUserFEntities);
|
||||
//
|
||||
// }
|
||||
|
||||
public void refreshData() {
|
||||
initTopView();
|
||||
initMyReycyView();
|
||||
// initMyReycyView();
|
||||
initData();
|
||||
}
|
||||
|
||||
/*
|
||||
* 初始化数据
|
||||
* */
|
||||
private void initData(){
|
||||
RegisterUser user = Config.getInstance(getActivity()).getUser();
|
||||
* 初始化数据
|
||||
* */
|
||||
private void initData() {
|
||||
RegisterUser user = Config.getInstance(getActivity()).getUser();
|
||||
mDataBinding.username.setText(user.getNickname());
|
||||
if(StringUtils.isEmpty(user.getAvatar())){
|
||||
if (StringUtils.isEmpty(user.getAvatar())) {
|
||||
Picasso.with(getActivity()).load(R.mipmap.head).error(R.mipmap.head).placeholder(R.mipmap.head).into(mDataBinding.userImage);
|
||||
}else {
|
||||
} else {
|
||||
Picasso.with(getActivity()).load(user.getAvatar()).error(R.mipmap.head).placeholder(R.mipmap.head).into(mDataBinding.userImage);
|
||||
|
||||
}
|
||||
String gender = user.getGender();
|
||||
if(gender.equals("0")){
|
||||
if (gender.equals("0")) {
|
||||
Picasso.with(getActivity()).load(R.mipmap.icon_secret).into(mDataBinding.usermale);
|
||||
}else if(gender.equals("1")){
|
||||
} else if (gender.equals("1")) {
|
||||
Picasso.with(getActivity()).load(R.mipmap.boy).into(mDataBinding.usermale);
|
||||
}else if(gender.equals("2")){
|
||||
} else if (gender.equals("2")) {
|
||||
Picasso.with(getActivity()).load(R.mipmap.lady).into(mDataBinding.usermale);
|
||||
}else {
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Use this factory method to create a new instance of
|
||||
* this fragment using the provided parameters.
|
||||
@@ -230,11 +277,12 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
|
||||
return fragment;
|
||||
}
|
||||
|
||||
private boolean onclik=false;
|
||||
private boolean onclik = false;
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
onclik=false;
|
||||
onclik = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -248,7 +296,7 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
|
||||
BaseActivity baseActivity= (BaseActivity) getActivity();
|
||||
baseActivity.setSupportActionBar(toolbar);*/
|
||||
|
||||
/* toolbar.set*/
|
||||
/* toolbar.set*/
|
||||
/* baseActivity.setAbr(getString(R.string.news4), new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@@ -302,7 +350,7 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
|
||||
|
||||
@Override
|
||||
protected void loadData() {
|
||||
initData();
|
||||
initData();
|
||||
}
|
||||
|
||||
|
||||
@@ -310,16 +358,15 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
|
||||
public void onResume() {
|
||||
|
||||
super.onResume();
|
||||
onclik=true;
|
||||
|
||||
onclik = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public ArrayList<MyUserFEntity> getMyActivityList() {
|
||||
ArrayList<MyUserFEntity> myUserFEntities=new ArrayList<>();
|
||||
String myActivityListString[]=getActivity().getResources().getStringArray(R.array.useraction);
|
||||
int imageres[]={R.mipmap.genren,
|
||||
ArrayList<MyUserFEntity> myUserFEntities = new ArrayList<>();
|
||||
String myActivityListString[] = getActivity().getResources().getStringArray(R.array.useraction);
|
||||
int imageres[] = {R.mipmap.genren,
|
||||
R.mipmap.qianbao,
|
||||
R.mipmap.shangcheng,
|
||||
R.mipmap.zhangdan,
|
||||
@@ -329,7 +376,7 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
|
||||
R.mipmap.shouquan,
|
||||
R.mipmap.fangchan,
|
||||
R.mipmap.yaoshi};
|
||||
Class tClass[]={MyUserMessage.class,
|
||||
Class tClass[] = {MyUserMessage.class,
|
||||
MyWalletActivity.class,
|
||||
MyMarketShopActivity.class,
|
||||
MyBillHistory.class,
|
||||
@@ -339,8 +386,8 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
|
||||
MyAuthorizedFamilyHistory.class,
|
||||
MyPropertyActivity.class,
|
||||
MyKeyManagement.class};
|
||||
for (int i = 0; i <9 ; i++) {
|
||||
MyUserFEntity myUserFEntity=new MyUserFEntity();
|
||||
for (int i = 0; i < 9; i++) {
|
||||
MyUserFEntity myUserFEntity = new MyUserFEntity();
|
||||
myUserFEntity.setImagetResource(imageres[i]);
|
||||
myUserFEntity.setMyclazz(tClass[i]);
|
||||
myUserFEntity.setTitile(myActivityListString[i]);
|
||||
@@ -370,8 +417,8 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if(deletePath.size()>0){
|
||||
for (int i = 0; i <deletePath.size(); i++) {
|
||||
if (deletePath.size() > 0) {
|
||||
for (int i = 0; i < deletePath.size(); i++) {
|
||||
BitmapTools.deleteFile(new File(deletePath.get(i)));
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.sl.house_property.cart.CartFragment;
|
||||
import com.sl.house_property.databinding.ActivityMainTabBinding;
|
||||
import com.sl.house_property.discovery.DiscoveryFragment;
|
||||
|
||||
@@ -41,7 +42,7 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
||||
private MainFragment fragment0;
|
||||
private DiscoveryFragment fragment1;
|
||||
private Main3Fragment fragment2;
|
||||
private Main2Fragment fragment3;
|
||||
private CartFragment fragment3;
|
||||
private Main4Fragment fragment4;
|
||||
private Fragment currentFragment;
|
||||
|
||||
@@ -174,7 +175,7 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
|
||||
case R.id.button3:
|
||||
// mDataBinding.getRoot().setBackground(getResources().getDrawable(R.drawable.background_slowly));
|
||||
if (fragment3 == null) {
|
||||
fragment3 = Main2Fragment.newInstance("", "");
|
||||
fragment3 = CartFragment.newInstance();
|
||||
fragmentTransaction.add(R.id.mycontent, fragment3, "fragment3");
|
||||
} else {
|
||||
fragmentTransaction.show(fragment3);
|
||||
|
||||
@@ -59,9 +59,9 @@ public class MyApplication extends Application{
|
||||
Log.d(TAG, "[ExampleApplication] onCreate");
|
||||
super.onCreate();
|
||||
instance = this;
|
||||
|
||||
CrashHandler crashHandler = CrashHandler.getInstance();
|
||||
crashHandler.init(this);
|
||||
//
|
||||
// CrashHandler crashHandler = CrashHandler.getInstance();
|
||||
// crashHandler.init(this);
|
||||
System.setProperty("http.proxyHost", "haotian.hoheng.cn");
|
||||
System.setProperty("http.proxyPort", "8080");
|
||||
|
||||
|
||||
@@ -0,0 +1,242 @@
|
||||
package com.sl.house_property.cart;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
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.lxj.xpopup.interfaces.OnConfirmListener;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
import com.sl.house_property.BaseActivity;
|
||||
import com.sl.house_property.R;
|
||||
import com.sl.house_property.databinding.ActivityAddressListBinding;
|
||||
import com.sl.house_property.databinding.ItemAddressBinding;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import adapter.BaseRecycleViewAdapter;
|
||||
import entity.AddressEntity;
|
||||
import entity.RegisterUser;
|
||||
import http.ApiConfig;
|
||||
import my_loader.Loader;
|
||||
import my_loader.Resultcode;
|
||||
import rx.functions.Action1;
|
||||
import tools.Config;
|
||||
import utils.Md5;
|
||||
|
||||
public class AddressListActivity extends BaseActivity<ActivityAddressListBinding> {
|
||||
private int page = 1;
|
||||
private Context context;
|
||||
private ArrayList<AddressEntity> list = new ArrayList<>();
|
||||
private ProgressDialog progressDialog;
|
||||
|
||||
@Override
|
||||
protected int getLayoutResId() {
|
||||
return R.layout.activity_address_list;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
context = this;
|
||||
ImmersionBar.with(this)
|
||||
.keyboardEnable(true) //解决软键盘与底部输入框冲突问题
|
||||
// .keyboardEnable(true, WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE
|
||||
// | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) //软键盘自动弹出
|
||||
.init();
|
||||
progressDialog = new ProgressDialog(this);
|
||||
initRec();
|
||||
mDataBinding.dw.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
getList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
page = 1;
|
||||
getList();
|
||||
}
|
||||
});
|
||||
mDataBinding.dw.autoRefresh();
|
||||
|
||||
}
|
||||
|
||||
private void initRec() {
|
||||
BaseRecycleViewAdapter<AddressEntity, ItemAddressBinding> adapter = new BaseRecycleViewAdapter<>(context, R.layout.item_address);
|
||||
adapter.setOnBindViewHolder(new BaseRecycleViewAdapter.BindView<ItemAddressBinding>() {
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ItemAddressBinding b, int position) {
|
||||
final AddressEntity addressEntity = list.get(position);
|
||||
b.tvName.setText(addressEntity.getName());
|
||||
b.tvPhone.setText(addressEntity.getMobile());
|
||||
b.tvDetail.setText(addressEntity.getRegion() + addressEntity.getAddress());
|
||||
if (addressEntity.getIs_default().equals("1")) {
|
||||
b.tvState.setVisibility(View.VISIBLE);
|
||||
b.ivEdit.setVisibility(View.GONE);
|
||||
} else {
|
||||
b.tvState.setVisibility(View.GONE);
|
||||
b.ivEdit.setVisibility(View.VISIBLE);
|
||||
}
|
||||
b.ivEdit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new XPopup.Builder(context).asConfirm("", "真的要设置为默认吗?", new OnConfirmListener() {
|
||||
@Override
|
||||
public void onConfirm() {
|
||||
|
||||
opera(addressEntity.getConsignee_id(), "1");
|
||||
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
});
|
||||
b.ivDelete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new XPopup.Builder(context).asConfirm("", "真的要删除吗?", new OnConfirmListener() {
|
||||
@Override
|
||||
public void onConfirm() {
|
||||
|
||||
opera(addressEntity.getConsignee_id(), "2");
|
||||
|
||||
}
|
||||
}).show();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
mDataBinding.rec.setAdapter(adapter);
|
||||
mDataBinding.rec.setLayoutManager(new LinearLayoutManager(context));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointerCaptureChanged(boolean hasCapture) {
|
||||
|
||||
}
|
||||
|
||||
Loader loader = new Loader();
|
||||
|
||||
private void opera(String consignee_id, String action) {
|
||||
progressDialog.setMessage("提交中");
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
RegisterUser user =
|
||||
Config.getInstance(context).getUser();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
if (user != null) {
|
||||
map.put("userid", user.getUserid());
|
||||
} else {
|
||||
map.put("userid", 0 + "");
|
||||
}
|
||||
map.put("app", "Order");
|
||||
map.put("class", "UserAddressAction");
|
||||
map.put("action", action);
|
||||
map.put("consignee_id", consignee_id);
|
||||
map.put("sign", Md5.md5("Order" + "UserAddressAction" + Md5.secret));
|
||||
|
||||
loader.getMovie(ApiConfig.BASE_URL, map).subscribe(new Action1<Resultcode>() {
|
||||
@Override
|
||||
public void call(Resultcode resultcode) {
|
||||
progressDialog.dismiss();
|
||||
if (!(resultcode.status == 0)) {
|
||||
Toast.makeText(context, resultcode.msg, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
if (resultcode.status == 0) {
|
||||
Toast.makeText(context, resultcode.msg, Toast.LENGTH_SHORT).show();
|
||||
page = 1;
|
||||
getList();
|
||||
}
|
||||
}
|
||||
}, new Action1<Throwable>() {
|
||||
@Override
|
||||
public void call(Throwable throwable) {
|
||||
progressDialog.dismiss();
|
||||
throwable.fillInStackTrace();
|
||||
Toast.makeText(context, "提交失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getList() {
|
||||
RegisterUser user =
|
||||
Config.getInstance(context).getUser();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
if (user != null) {
|
||||
map.put("userid", user.getUserid());
|
||||
} else {
|
||||
map.put("userid", 0 + "");
|
||||
}
|
||||
map.put("app", "Order");
|
||||
map.put("class", "UserAddressInfo");
|
||||
map.put("page", page + "");
|
||||
map.put("sign", Md5.md5("Order" + "UserAddressInfo" + Md5.secret));
|
||||
|
||||
loader.getMovie(ApiConfig.BASE_URL, map).subscribe(new Action1<Resultcode>() {
|
||||
@Override
|
||||
public void call(Resultcode resultcode) {
|
||||
mDataBinding.dw.finishRefresh();
|
||||
mDataBinding.dw.finishLoadMore();
|
||||
if (!(resultcode.status == 0)) {
|
||||
Toast.makeText(context, resultcode.msg, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
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");
|
||||
Type type = new TypeToken<ArrayList<AddressEntity>>() {
|
||||
}.getType();
|
||||
ArrayList<AddressEntity> newList = gs.fromJson(array.toString(), type);
|
||||
int count = jsonObject.getInt("count");
|
||||
|
||||
if (page == 1) {
|
||||
list.clear();
|
||||
}
|
||||
list.addAll(newList);
|
||||
if (list.size() == count || newList.isEmpty()) {
|
||||
mDataBinding.dw.finishLoadMoreWithNoMoreData();
|
||||
} else {
|
||||
page++;
|
||||
}
|
||||
BaseRecycleViewAdapter baseRecycleViewAdapter = (BaseRecycleViewAdapter) mDataBinding.rec.getAdapter();
|
||||
baseRecycleViewAdapter.setData(list);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}, new Action1<Throwable>() {
|
||||
@Override
|
||||
public void call(Throwable throwable) {
|
||||
mDataBinding.dw.finishRefresh();
|
||||
mDataBinding.dw.finishLoadMore();
|
||||
Toast.makeText(context, getString(R.string.getdatafailure), Toast.LENGTH_SHORT).show();
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
136
app/src/main/java/com/sl/house_property/cart/AmountView.java
Normal file
136
app/src/main/java/com/sl/house_property/cart/AmountView.java
Normal file
@@ -0,0 +1,136 @@
|
||||
package com.sl.house_property.cart;
|
||||
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.sl.house_property.R;
|
||||
|
||||
|
||||
/**
|
||||
* 自定义组件:购买数量,带减少增加按钮
|
||||
* Created by hiwhitley on 2016/7/4.
|
||||
*/
|
||||
public class AmountView extends LinearLayout implements View.OnClickListener, TextWatcher {
|
||||
|
||||
private static final String TAG = "AmountView";
|
||||
private int amount = 1; //购买数量
|
||||
private int goods_storage = 100; //商品库存
|
||||
|
||||
private OnAmountChangeListener mListener;
|
||||
|
||||
private TextView etAmount;
|
||||
private ImageView btnDecrease;
|
||||
private ImageView btnIncrease;
|
||||
|
||||
public AmountView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
|
||||
public AmountView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
LayoutInflater.from(context).inflate(R.layout.view_amount, this);
|
||||
etAmount = findViewById(R.id.etAmount);
|
||||
btnDecrease = findViewById(R.id.btnDecrease);
|
||||
btnIncrease = findViewById(R.id.btnIncrease);
|
||||
btnDecrease.setOnClickListener(this);
|
||||
btnIncrease.setOnClickListener(this);
|
||||
etAmount.addTextChangedListener(this);
|
||||
|
||||
TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attrs, R.styleable.AmountView);
|
||||
int btnWidth = obtainStyledAttributes.getDimensionPixelSize(R.styleable.AmountView_btnWidth, LayoutParams.WRAP_CONTENT);
|
||||
int tvWidth = obtainStyledAttributes.getDimensionPixelSize(R.styleable.AmountView_tvWidth, 80);
|
||||
int tvTextSize = obtainStyledAttributes.getDimensionPixelSize(R.styleable.AmountView_tvTextSize, 0);
|
||||
// int btnTextSize = obtainStyledAttributes.getDimensionPixelSize(R.styleable.AmountView_btnTextSize, 0);
|
||||
obtainStyledAttributes.recycle();
|
||||
|
||||
LayoutParams btnParams = new LayoutParams(btnWidth, LayoutParams.MATCH_PARENT);
|
||||
btnDecrease.setLayoutParams(btnParams);
|
||||
btnIncrease.setLayoutParams(btnParams);
|
||||
// if (btnTextSize != 0) {
|
||||
//// 0
|
||||
//// btnIncrease.setTextSize(TypedValue.COMPLEX_UNIT_PX, btnTextSize);
|
||||
// }
|
||||
|
||||
LayoutParams textParams = new LayoutParams(tvWidth, LayoutParams.MATCH_PARENT);
|
||||
etAmount.setLayoutParams(textParams);
|
||||
if (tvTextSize != 0) {
|
||||
etAmount.setTextSize(tvTextSize);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnAmountChangeListener(OnAmountChangeListener onAmountChangeListener) {
|
||||
this.mListener = onAmountChangeListener;
|
||||
}
|
||||
|
||||
public void setGoods_storage(int goods_storage) {
|
||||
this.goods_storage = goods_storage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int i = v.getId();
|
||||
if (i == R.id.btnDecrease) {
|
||||
if (amount > 1) {
|
||||
amount--;
|
||||
etAmount.setText(amount + "");
|
||||
}
|
||||
} else if (i == R.id.btnIncrease) {
|
||||
if (amount < goods_storage) {
|
||||
amount++;
|
||||
etAmount.setText(amount + "");
|
||||
}
|
||||
}
|
||||
|
||||
etAmount.clearFocus();
|
||||
|
||||
if (mListener != null) {
|
||||
mListener.onAmountChange(this, amount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
public void changeAmount(int num){
|
||||
amount=num;
|
||||
etAmount.setText(num+"");
|
||||
}
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (s.toString().isEmpty())
|
||||
return;
|
||||
amount = Integer.valueOf(s.toString());
|
||||
if (amount > goods_storage) {
|
||||
etAmount.setText(goods_storage + "");
|
||||
return;
|
||||
}
|
||||
|
||||
// if (mListener != null) {
|
||||
//// mListener.onAmountChange(this, amount);
|
||||
//// }
|
||||
}
|
||||
|
||||
|
||||
public interface OnAmountChangeListener {
|
||||
void onAmountChange(View view, int amount);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,366 @@
|
||||
package com.sl.house_property.cart;
|
||||
|
||||
public class CartFragment {
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
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.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
|
||||
import com.sl.house_property.BaseActivity;
|
||||
import com.sl.house_property.BaseFragment;
|
||||
import com.sl.house_property.R;
|
||||
import com.sl.house_property.databinding.FragmentCartBinding;
|
||||
import com.sl.house_property.databinding.ItemCartBinding;
|
||||
import com.sl.house_property.databinding.ItemCartCartBinding;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import adapter.BaseRecycleViewAdapter;
|
||||
import entity.CartEntity;
|
||||
import entity.RegisterUser;
|
||||
import http.ApiConfig;
|
||||
import my_loader.Loader;
|
||||
import my_loader.Resultcode;
|
||||
import rx.functions.Action1;
|
||||
import tools.Config;
|
||||
import utils.Md5;
|
||||
|
||||
public class CartFragment extends BaseFragment<FragmentCartBinding> {
|
||||
BaseActivity baseActivity;
|
||||
private ProgressDialog progressDialog;
|
||||
//private int page = 1;
|
||||
private Loader loader;
|
||||
private ArrayList<CartEntity> cartEntities;
|
||||
private double amount = 0.00;
|
||||
|
||||
public static CartFragment newInstance() {
|
||||
CartFragment fragment = new CartFragment();
|
||||
Bundle args = new Bundle();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_cart;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadData() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreateVew(LayoutInflater inflater, Bundle savedInstanceState) {
|
||||
super.onCreateVew(inflater, savedInstanceState);
|
||||
baseActivity = (BaseActivity) getActivity();
|
||||
progressDialog = new ProgressDialog(baseActivity);
|
||||
intRecycleView();
|
||||
mDataBinding.dw.setOnRefreshListener(new OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
getData();
|
||||
}
|
||||
});
|
||||
mDataBinding.dw.autoRefresh();
|
||||
mDataBinding.tvManager.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!cartEntities.isEmpty()) {
|
||||
for (int i = 0; i < cartEntities.size(); i++) {
|
||||
cartEntities.get(i).setCheck(false);
|
||||
for (int j = 0; j < cartEntities.get(i).getList().size(); j++) {
|
||||
cartEntities.get(i).getList().get(j).setCheck(false);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
amount = 0.00;
|
||||
mDataBinding.cbAll.setChecked(false);
|
||||
mDataBinding.rec.getAdapter().notifyDataSetChanged();
|
||||
if (mDataBinding.tvManager.getText().equals("管理")) {
|
||||
mDataBinding.tvManager.setText("完成");
|
||||
mDataBinding.tvAmount.setVisibility(View.GONE);
|
||||
mDataBinding.btnDelete.setVisibility(View.VISIBLE);
|
||||
mDataBinding.btnSettle.setVisibility(View.GONE);
|
||||
mDataBinding.tvT.setVisibility(View.GONE);
|
||||
} else {
|
||||
mDataBinding.tvManager.setText("管理");
|
||||
mDataBinding.tvAmount.setVisibility(View.VISIBLE);
|
||||
mDataBinding.btnDelete.setVisibility(View.GONE);
|
||||
mDataBinding.btnSettle.setVisibility(View.VISIBLE);
|
||||
mDataBinding.tvT.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
mDataBinding.btnDelete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!cartEntities.isEmpty()) {
|
||||
StringBuilder id = new StringBuilder();
|
||||
for (int i = 0; i < cartEntities.size(); i++) {
|
||||
for (int j = 0; j < cartEntities.get(i).getList().size(); j++) {
|
||||
if (cartEntities.get(i).getList().get(j).isCheck()) {
|
||||
if (id.toString().equals("")) {
|
||||
id = new StringBuilder(cartEntities.get(i).getList().get(j).getCart_id());
|
||||
} else {
|
||||
id.append(",").append(cartEntities.get(i).getList().get(j).getCart_id());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!id.toString().equals("")) {
|
||||
editGoods(1, id.toString(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getData() {
|
||||
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", "GetCart");
|
||||
// map.put("page", page + "");
|
||||
map.put("sign", Md5.md5("Goods" + "GetCart" + Md5.secret));
|
||||
// progressDialog.setMessage("正在请求数据");
|
||||
//progressDialog.setCancelable(false);
|
||||
loader = new Loader();
|
||||
loader.getMovie(ApiConfig.BASE_URL, map)
|
||||
.subscribe(new Action1<Resultcode>() {
|
||||
@Override
|
||||
public void call(Resultcode resultcode) {
|
||||
mDataBinding.dw.finishRefresh();
|
||||
mDataBinding.dw.finishLoadMore();
|
||||
// progressDialog.dismiss();
|
||||
if (!(resultcode.status == 0)) {
|
||||
baseActivity.setToast(1, resultcode.msg);
|
||||
}
|
||||
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("cart");
|
||||
Type type = new TypeToken<ArrayList<CartEntity>>() {
|
||||
}.getType();
|
||||
|
||||
cartEntities = new Gson().fromJson(array.toString(), type);
|
||||
BaseRecycleViewAdapter baseRecycleViewAdapter = (BaseRecycleViewAdapter) mDataBinding.rec.getAdapter();
|
||||
baseRecycleViewAdapter.setData(cartEntities);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}, new Action1<Throwable>() {
|
||||
@Override
|
||||
public void call(Throwable throwable) {
|
||||
// progressDialog.dismiss();
|
||||
mDataBinding.dw.finishRefresh();
|
||||
mDataBinding.dw.finishLoadMore();
|
||||
baseActivity.setToast(2, getString(R.string.getdatafailure));
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void intRecycleView() {
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(baseActivity);
|
||||
mDataBinding.rec.setLayoutManager(linearLayoutManager);
|
||||
final BaseRecycleViewAdapter<CartEntity, ItemCartBinding> adapter = new BaseRecycleViewAdapter<>(baseActivity, R.layout.item_cart);
|
||||
|
||||
mDataBinding.rec.setAdapter(adapter);
|
||||
cartEntities = new ArrayList<>();
|
||||
adapter.setOnBindViewHolder(new BaseRecycleViewAdapter.BindView<ItemCartBinding>() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ItemCartBinding b, final int position) {
|
||||
if (!(position >= cartEntities.size())) {
|
||||
final CartEntity cartEntity = cartEntities.get(position);
|
||||
b.cbCheck.setChecked(cartEntity.isCheck());
|
||||
b.tvUsername.setText(cartEntity.getNickname());
|
||||
RequestOptions requestOptions = new RequestOptions();
|
||||
requestOptions.placeholder(R.mipmap.head);
|
||||
requestOptions.error(R.mipmap.head);
|
||||
Glide.with(getContext()).load(cartEntity.getAvatar())
|
||||
.apply(requestOptions)
|
||||
.into(b.ivHead);
|
||||
b.itemRec.setLayoutManager(new LinearLayoutManager(baseActivity));
|
||||
final BaseRecycleViewAdapter<CartEntity.CartList, ItemCartCartBinding> itemAdapter = new BaseRecycleViewAdapter<>(baseActivity, R.layout.item_cart_cart);
|
||||
itemAdapter.setData(cartEntity.getList());
|
||||
b.itemRec.setAdapter(itemAdapter);
|
||||
b.ll.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
cartEntities.get(position).setCheck(!cartEntities.get(position).isCheck());
|
||||
for (int i = 0; i < cartEntities.get(position).getList().size(); i++) {
|
||||
cartEntities.get(position).getList().get(i).setCheck(cartEntities.get(position).isCheck());
|
||||
|
||||
}
|
||||
boolean isAllCheck = true;
|
||||
for (int i = 0; i < cartEntities.size(); i++) {
|
||||
if (!cartEntities.get(position).isCheck()) {
|
||||
isAllCheck = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
mDataBinding.cbAll.setChecked(isAllCheck);
|
||||
}
|
||||
});
|
||||
itemAdapter.setOnBindViewHolder(new BaseRecycleViewAdapter.BindView<ItemCartCartBinding>() {
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ItemCartCartBinding b, final int position) {
|
||||
if (!(position >= cartEntity.getList().size())) {
|
||||
b.cb.setChecked(cartEntity.getList().get(position).isCheck());
|
||||
b.tvGoodsName.setText(cartEntity.getList().get(position).getGoods_detail());
|
||||
b.tvInfo2.setText(cartEntity.getList().get(position).getProperty());
|
||||
RequestOptions requestOptions = new RequestOptions();
|
||||
requestOptions.placeholder(R.mipmap.icon_default_rectangle);
|
||||
requestOptions.error(R.mipmap.icon_default_rectangle);
|
||||
|
||||
Glide.with(getContext()).load(cartEntity.getList().get(position).getThumb())
|
||||
.apply(requestOptions)
|
||||
.into(b.ivGoods);
|
||||
b.tvPrice.setText("¥" + cartEntity.getList().get(position).getSale_price());
|
||||
if (!cartEntity.getList().get(position).getSale_num().isEmpty()) {
|
||||
b.amountView.changeAmount(Integer.parseInt(cartEntity.getList().get(position).getSale_num()));
|
||||
|
||||
}
|
||||
b.amountView.setOnAmountChangeListener(new AmountView.OnAmountChangeListener() {
|
||||
@Override
|
||||
public void onAmountChange(View view, int amount) {
|
||||
editGoods(2, cartEntity.getList().get(position).getCart_id(), amount);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
itemAdapter.setOnItemClickListener(new BaseRecycleViewAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(View itemView, int x) {
|
||||
// if (mDataBinding.tvAmount.getVisibility()==View.VISIBLE){
|
||||
// if (!cartEntities.get(position).getList().get(x).isCheck()) {
|
||||
// BigDecimal bigDecimal = new BigDecimal(0.00);
|
||||
// BigDecimal bigDecimal1 = new BigDecimal(amount);
|
||||
// BigDecimal add = bigDecimal.add(bigDecimal1);
|
||||
// amount = add.doubleValue();
|
||||
// mDataBinding.tvAmount.setText(amount+"");
|
||||
// } else {
|
||||
// BigDecimal bigDecimal = new BigDecimal(0.00);
|
||||
// BigDecimal bigDecimal1 = new BigDecimal(amount);
|
||||
// BigDecimal subtract = bigDecimal1.subtract(bigDecimal);
|
||||
// amount = subtract.doubleValue();
|
||||
// mDataBinding.tvAmount.setText(amount+"");
|
||||
// }
|
||||
// }
|
||||
|
||||
cartEntities.get(position).getList().get(x).setCheck(!cartEntities.get(position).getList().get(x).isCheck());
|
||||
|
||||
itemAdapter.notifyDataSetChanged();
|
||||
boolean isItemAllCheck = true;
|
||||
boolean isAllCheck = true;
|
||||
for (int i = 0; i < cartEntities.get(position).getList().size(); i++) {
|
||||
if (!cartEntities.get(position).getList().get(i).isCheck()) {
|
||||
isItemAllCheck = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
cartEntities.get(position).setCheck(isItemAllCheck);
|
||||
adapter.notifyDataSetChanged();
|
||||
if (isItemAllCheck) {
|
||||
for (int i = 0; i < cartEntities.size(); i++) {
|
||||
if (!cartEntities.get(i).isCheck()) {
|
||||
isAllCheck = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
isAllCheck = false;
|
||||
}
|
||||
mDataBinding.cbAll.setChecked(isAllCheck);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void editGoods(final int action, String cart_id, int num) {
|
||||
progressDialog.setMessage("提交中...");
|
||||
progressDialog.show();
|
||||
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", "CartAction");
|
||||
map.put("action", action + "");
|
||||
map.put("cart_id", cart_id);
|
||||
if (action == 2) {
|
||||
map.put("num", num + "");
|
||||
}
|
||||
// map.put("page", page + "");
|
||||
map.put("sign", Md5.md5("Goods" + "CartAction" + Md5.secret));
|
||||
// progressDialog.setMessage("正在请求数据");
|
||||
//progressDialog.setCancelable(false);
|
||||
loader.getMovie(ApiConfig.BASE_URL, map).subscribe(new Action1<Resultcode>() {
|
||||
@Override
|
||||
public void call(Resultcode resultcode) {
|
||||
progressDialog.dismiss();
|
||||
if (resultcode.status == 0) {
|
||||
Toast.makeText(baseActivity, resultcode.msg, Toast.LENGTH_SHORT).show();
|
||||
if (action == 1) {
|
||||
getData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, new Action1<Throwable>() {
|
||||
@Override
|
||||
public void call(Throwable throwable) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.sl.house_property.discovery;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.View;
|
||||
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.sl.house_property.BaseActivity;
|
||||
import com.sl.house_property.R;
|
||||
import com.sl.house_property.databinding.ActivityAddDiscoveryBinding;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import imageselector.utils.ImageSelector;
|
||||
|
||||
public class AddDiscoveryActivity extends BaseActivity<ActivityAddDiscoveryBinding> {
|
||||
|
||||
private static final int REQUEST_CODE_SELECT_PICTURE = 300;
|
||||
private int type;
|
||||
private AdditionImageWrapper additionImageWrapper;
|
||||
|
||||
@Override
|
||||
protected int getLayoutResId() {
|
||||
return R.layout.activity_add_discovery;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
ImmersionBar.with(this)
|
||||
.keyboardEnable(true) //解决软键盘与底部输入框冲突问题
|
||||
// .keyboardEnable(true, WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE
|
||||
// | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) //软键盘自动弹出
|
||||
.barColor(R.color.backcolorAccent)
|
||||
.init();
|
||||
mDataBinding.rec2.setNestedScrollingEnabled(false);
|
||||
mDataBinding.rvDynamicImage.setNestedScrollingEnabled(false);
|
||||
type = getIntent().getIntExtra("type", 0);
|
||||
if (type == 0) {
|
||||
mDataBinding.tvCover.setVisibility(View.GONE);
|
||||
mDataBinding.vi.setVisibility(View.GONE);
|
||||
mDataBinding.rec2.setVisibility(View.GONE);
|
||||
mDataBinding.tvGoods.setVisibility(View.GONE);
|
||||
} else if (type == 1) {
|
||||
|
||||
mDataBinding.tvCover.setVisibility(View.VISIBLE);
|
||||
mDataBinding.vi.setVisibility(View.VISIBLE);
|
||||
mDataBinding.rec2.setVisibility(View.VISIBLE);
|
||||
mDataBinding.tvGoods.setVisibility(View.VISIBLE);
|
||||
}
|
||||
additionImageWrapper = new AdditionImageWrapper(this, mDataBinding.rvDynamicImage);
|
||||
additionImageWrapper.wrap(new AdditionImageWrapper.OnAdditionLayoutItemClick() {
|
||||
@Override
|
||||
public void onAdditionItemClick() {
|
||||
//
|
||||
checkAlbumPermission();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onImageItemClick(int position) {
|
||||
//普通图片被点击
|
||||
List<File> imageList = additionImageWrapper.getImageList();
|
||||
ArrayList<String> arrayListOf = new ArrayList<>();
|
||||
for (int i = 0; i < imageList.size(); i++) {
|
||||
arrayListOf.add(imageList.get(i).getAbsolutePath());
|
||||
}
|
||||
Intent intent = new Intent(AddDiscoveryActivity.this, ImageViewerAndDeleteActivity.class);
|
||||
intent.putExtra("index", position);
|
||||
intent.putStringArrayListExtra("images", arrayListOf);
|
||||
startActivityForResult(intent, 111);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 111 && resultCode == 111) {
|
||||
ArrayList<String> images = data.getStringArrayListExtra("images");
|
||||
ArrayList<File> files = new ArrayList<>();
|
||||
for (int i = 0; i < images.size(); i++) {
|
||||
files.add(new File(images.get(i)));
|
||||
}
|
||||
additionImageWrapper.setData(files);
|
||||
|
||||
} else if (requestCode == REQUEST_CODE_SELECT_PICTURE && data != null) {
|
||||
ArrayList<String> images = data.getStringArrayListExtra(ImageSelector.SELECT_RESULT);
|
||||
ArrayList<File> files = new ArrayList<>();
|
||||
files.addAll(additionImageWrapper.getImageList());
|
||||
for (int i = 0; i < images.size(); i++) {
|
||||
files.add(new File(images.get(i)));
|
||||
}
|
||||
additionImageWrapper.setData(files);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void selectImage() {
|
||||
ImageSelector.builder()
|
||||
.useCamera(false) // 设置是否使用拍照
|
||||
.setSingle(false) //设置是否单选
|
||||
.setViewImage(true) //是否点击放大图片查看,,默认为true
|
||||
.setMaxSelectCount(additionImageWrapper.getRemainCount()) // 图片的最大选择数量,小于等于0时,不限数量。
|
||||
.start(AddDiscoveryActivity.this, REQUEST_CODE_SELECT_PICTURE); // 打开相册
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 检查访问相册权限
|
||||
* */
|
||||
private void checkAlbumPermission() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||
selectImage();
|
||||
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);
|
||||
}
|
||||
|
||||
} else {
|
||||
selectImage();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
package com.sl.house_property.discovery;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.sl.house_property.R;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by: xudiwei
|
||||
* <p>
|
||||
* on: 2017/4/13.
|
||||
* <p>
|
||||
* 描述:用于处理带有可添加item的列表布局,可用于动态创建时的图片内容的显示操作布局
|
||||
* <p>
|
||||
* ------
|
||||
* | |
|
||||
* | + |
|
||||
* | |
|
||||
* ------
|
||||
* <p>
|
||||
* 用例 :
|
||||
* <p>
|
||||
* AdditionImageWrapper additionImageWrapper = new AdditionImageWrapper(Context, RecyclerView);
|
||||
* additionImageWrapper.wrap(new AdditionImageWrapper.OnAdditionLayoutItemClick() {
|
||||
*
|
||||
* @Override public void onAdditionItemClick() {
|
||||
* //添加item被点击
|
||||
* }
|
||||
* @Override public void onImageItemClick(int position) {
|
||||
* //普通图片被点击
|
||||
* }
|
||||
* });
|
||||
* <p>
|
||||
* //设置图片的数据
|
||||
* additionImageWrapper.setData(List<String>);
|
||||
* <p>
|
||||
* //设置最多显示的图片数量(默认为9张)
|
||||
* additionImageWrapper.setLimit(int);
|
||||
* <p>
|
||||
* //设置RecyclerView的列(默认为4列)
|
||||
* addition.setRow(int);
|
||||
*/
|
||||
|
||||
public class AdditionImageWrapper {
|
||||
private static final String TAG = "AdditionImageWrapper";
|
||||
/*默认图片数量为4张*/
|
||||
public static final int DEFAULT_COUNT = 9;
|
||||
/*默认图片的列数为4格*/
|
||||
public static final int DEFAULT_ROW = 4;
|
||||
/*图片数据有存在包含添加item的数据的,(当图片的数量小于mImageCountLimit时)*/
|
||||
private List<File> mList = new ArrayList<>();
|
||||
/*直实通过setData设置进来的图片*/
|
||||
private List<File> mRealList = new ArrayList<>();
|
||||
//剩下几张 mImageCountLimit - list
|
||||
private int mRemainCount = DEFAULT_COUNT;
|
||||
|
||||
private Context mContext;
|
||||
private RecyclerView mRecyclerView;
|
||||
private int mImageCountLimit = DEFAULT_COUNT;
|
||||
private int mRecyclerViewRow = DEFAULT_ROW;
|
||||
private OnAdditionLayoutItemClick mItemClick;
|
||||
private CreateDynamicRVAdapter mAdapter;
|
||||
|
||||
|
||||
public AdditionImageWrapper(Context context, RecyclerView recyclerView) {
|
||||
this.mContext = context;
|
||||
this.mRecyclerView = recyclerView;
|
||||
}
|
||||
|
||||
public void setLimit(int imageCountLimit) {
|
||||
this.mImageCountLimit = imageCountLimit;
|
||||
this.mRemainCount = imageCountLimit;
|
||||
}
|
||||
|
||||
public void setRow(int recyclerViewRow) {
|
||||
this.mRecyclerViewRow = recyclerViewRow;
|
||||
}
|
||||
|
||||
public int getRemainCount() {
|
||||
return mRemainCount;
|
||||
}
|
||||
|
||||
public List<File> getImageList() {
|
||||
return mRealList;
|
||||
}
|
||||
|
||||
|
||||
public void setData(List<File> list) {
|
||||
if (list.size() > mImageCountLimit) {
|
||||
throw new IllegalArgumentException(" list size is 大于limit, limit是:" + mImageCountLimit + " 你给的是: " + list.size());
|
||||
}
|
||||
mRealList.clear();
|
||||
|
||||
mRealList.addAll(list);
|
||||
mRemainCount = mImageCountLimit - list.size();
|
||||
|
||||
this.mList.clear();
|
||||
this.mList.addAll(list);
|
||||
if (this.mList.size() < mImageCountLimit) {
|
||||
addDefaultItem();
|
||||
}
|
||||
if (null != mAdapter) {
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 包裹
|
||||
*
|
||||
* @param itemClick
|
||||
*/
|
||||
public void wrap(OnAdditionLayoutItemClick itemClick) {
|
||||
this.mItemClick = itemClick;
|
||||
initRecyclerView();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加珍上空的Item数据
|
||||
*/
|
||||
private void addDefaultItem() {
|
||||
mList.add(null);
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
addDefaultItem();
|
||||
GridLayoutManager manager = new GridLayoutManager(mContext, mRecyclerViewRow);
|
||||
mAdapter = new CreateDynamicRVAdapter(mContext, mList);
|
||||
mRecyclerView.setLayoutManager(manager);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public interface OnAdditionLayoutItemClick {
|
||||
/**
|
||||
* 添加图片的item被点击
|
||||
*/
|
||||
void onAdditionItemClick();
|
||||
|
||||
/**
|
||||
* 图片item被点击
|
||||
*
|
||||
* @param position
|
||||
*/
|
||||
void onImageItemClick(int position);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* RecyclerView适配器
|
||||
*/
|
||||
private class CreateDynamicRVAdapter extends RecyclerView.Adapter<CreateDynamicRVAdapter.ViewHolder> {
|
||||
private Context mContext;
|
||||
private List<File> mList;
|
||||
|
||||
CreateDynamicRVAdapter(Context context, List<File> list) {
|
||||
this.mContext = context;
|
||||
this.mList = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateDynamicRVAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(mContext).inflate(R.layout.item_rv_create_dynamic, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(CreateDynamicRVAdapter.ViewHolder holder, int position) {
|
||||
File path = mList.get(position);
|
||||
if (position == mList.size() - 1 && null == path) {
|
||||
holder.ivImage.setImageResource(R.mipmap.icon_add);
|
||||
} else {
|
||||
// holder.ivImage.setImageResource(R.mipmap.ic_avatar_default);
|
||||
// mContext.(mContext, holder.ivImage, path);
|
||||
// ImageLoaderKt.loadToFile(mContext,holder.ivImage,path);
|
||||
RequestOptions requestOptions = new RequestOptions();
|
||||
requestOptions.placeholder(R.mipmap.icon_default_rectangle);
|
||||
requestOptions.error(R.mipmap.icon_default_rectangle);
|
||||
requestOptions.skipMemoryCache(false);
|
||||
Glide.with(mContext).load(path).apply(requestOptions).into(holder.ivImage);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* ViewHolder
|
||||
*/
|
||||
class ViewHolder extends RecyclerView.ViewHolder {
|
||||
ImageView ivImage;
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
ivImage = (ImageView) itemView.findViewById(R.id.riv_img);
|
||||
if (null == mItemClick) {
|
||||
return;
|
||||
}
|
||||
|
||||
//设置点击事件
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int position = ViewHolder.this.getLayoutPosition();
|
||||
File path = mList.get(position);
|
||||
if (null == path && position == mList.size() - 1) {
|
||||
mItemClick.onAdditionItemClick();
|
||||
} else {
|
||||
mItemClick.onImageItemClick(position);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.sl.house_property.discovery;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
@@ -100,6 +101,14 @@ public class DiscoveryFragment extends BaseFragment<FragmentDiscoveryBinding> im
|
||||
intRecycleView();
|
||||
MainTabActivity activity = (MainTabActivity) getActivity();
|
||||
activity.registerMyOnTouchListener(this);
|
||||
mDataBinding.ivAdd.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getContext(), AddDiscoveryActivity.class);
|
||||
intent.putExtra("type",0);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.sl.house_property.discovery;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.view.PagerAdapter;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.github.chrisbanes.photoview.PhotoView;
|
||||
import com.sl.house_property.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 日期:2017.01.06
|
||||
* <p>
|
||||
* 作者:xudiwei
|
||||
* <p>
|
||||
* 描述::图片预览/删除页面的适配器
|
||||
*/
|
||||
public class ImageViewerAdapter extends PagerAdapter {
|
||||
|
||||
private static final String TAG = "ImageViewerAdapter";
|
||||
|
||||
private Context mContext;
|
||||
private List<String> mList;
|
||||
private OnImageLongClickListener mImageLongClickListener;
|
||||
|
||||
public ImageViewerAdapter(Context context, List<String> list) {
|
||||
mContext = context;
|
||||
mList = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isViewFromObject(View view, Object object) {
|
||||
return view == object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object instantiateItem(ViewGroup container, final int position) {
|
||||
View view = LayoutInflater.from(mContext).inflate(R.layout.item_preview, container, false);
|
||||
PhotoView photoView = (PhotoView) view.findViewById(R.id.photoView);
|
||||
photoView.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
|
||||
//点击事件
|
||||
if (null != mImageLongClickListener) {
|
||||
photoView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
mImageLongClickListener.onImageLongClick(position, v);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
String url = mList.get(position);
|
||||
Log.d(TAG,"url: "+url);
|
||||
// ImageLoader.loadToUrl(mContext, photoView, url);
|
||||
// ImageLoaderKt.loadToUrl(mContext,photoView,url);
|
||||
RequestOptions requestOptions = new RequestOptions();
|
||||
requestOptions.placeholder(R.mipmap.icon_default_rectangle);
|
||||
requestOptions.error(R.mipmap.icon_default_rectangle);
|
||||
requestOptions.skipMemoryCache(false);
|
||||
Glide.with(mContext).load(url).apply(requestOptions).into(photoView);
|
||||
container.addView(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyItem(ViewGroup container, int position, Object object) {
|
||||
container.removeView((View) object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemPosition(Object object) {
|
||||
return POSITION_NONE;
|
||||
// return super.getItemPosition(object);
|
||||
}
|
||||
|
||||
public void setOnImageLongClickListener(OnImageLongClickListener listener) {
|
||||
this.mImageLongClickListener = listener;
|
||||
}
|
||||
|
||||
public interface OnImageLongClickListener {
|
||||
void onImageLongClick(int position, View view);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.sl.house_property.discovery;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.view.View;
|
||||
|
||||
import com.sl.house_property.BaseActivity;
|
||||
import com.sl.house_property.R;
|
||||
import com.sl.house_property.databinding.ActivityImagePreviewAndDeleteBinding;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ImageViewerAndDeleteActivity extends BaseActivity<ActivityImagePreviewAndDeleteBinding> {
|
||||
|
||||
private ArrayList<String> mList;
|
||||
private ImageViewerAdapter adapter;
|
||||
private int index;
|
||||
|
||||
@Override
|
||||
protected int getLayoutResId() {
|
||||
return R.layout.activity_image_preview_and_delete;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mList = getIntent().getStringArrayListExtra("images");
|
||||
index = getIntent().getIntExtra("index", 0);
|
||||
adapter = new ImageViewerAdapter(this, mList);
|
||||
mDataBinding.tvTitle.setText(getString(R.string.text_preview_index, index + 1, mList.size()));
|
||||
|
||||
mDataBinding.tvDelete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mList.size() == 1) {
|
||||
mList.remove(index);
|
||||
|
||||
} else {
|
||||
mList.remove(index);
|
||||
adapter.notifyDataSetChanged();
|
||||
mDataBinding.tvTitle.setText(getString(R.string.text_preview_index, index + 1, mList.size()));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
mDataBinding.vpPreview.setAdapter(adapter);
|
||||
mDataBinding.vpPreview.setCurrentItem(index);
|
||||
mDataBinding.vpPreview.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int i, float v, int i1) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int i) {
|
||||
mDataBinding.tvTitle.setText(getString(R.string.text_preview_index, i + 1, mList.size()));
|
||||
index = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int i) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
//返回操作后的数据
|
||||
Intent intent = new Intent();
|
||||
intent.putStringArrayListExtra("images", mList);
|
||||
setResult(200, intent);
|
||||
super.onBackPressed();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.sl.house_property.discovery;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
|
||||
/***
|
||||
* 自定义viewPager操作类
|
||||
*/
|
||||
public class PhotoViewPager extends ViewPager {
|
||||
|
||||
public PhotoViewPager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public PhotoViewPager(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
try {
|
||||
return super.onTouchEvent(ev);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
try {
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
85
app/src/main/java/entity/AddressEntity.java
Normal file
85
app/src/main/java/entity/AddressEntity.java
Normal file
@@ -0,0 +1,85 @@
|
||||
package entity;
|
||||
|
||||
public class AddressEntity {
|
||||
private String consignee_id;
|
||||
private String userid;
|
||||
private String name;
|
||||
private String address;
|
||||
private String mobile;
|
||||
private String is_default;
|
||||
private String is_del;
|
||||
private String ctime;
|
||||
private String region;
|
||||
|
||||
public String getConsignee_id() {
|
||||
return consignee_id;
|
||||
}
|
||||
|
||||
public void setConsignee_id(String consignee_id) {
|
||||
this.consignee_id = consignee_id;
|
||||
}
|
||||
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public void setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
public String getIs_default() {
|
||||
return is_default;
|
||||
}
|
||||
|
||||
public void setIs_default(String is_default) {
|
||||
this.is_default = is_default;
|
||||
}
|
||||
|
||||
public String getIs_del() {
|
||||
return is_del;
|
||||
}
|
||||
|
||||
public void setIs_del(String is_del) {
|
||||
this.is_del = is_del;
|
||||
}
|
||||
|
||||
public String getCtime() {
|
||||
return ctime;
|
||||
}
|
||||
|
||||
public void setCtime(String ctime) {
|
||||
this.ctime = ctime;
|
||||
}
|
||||
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
}
|
||||
154
app/src/main/java/entity/CartEntity.java
Normal file
154
app/src/main/java/entity/CartEntity.java
Normal file
@@ -0,0 +1,154 @@
|
||||
package entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CartEntity {
|
||||
private String userid;
|
||||
private String nickname;
|
||||
private String avatar;
|
||||
private ArrayList<CartList> list;
|
||||
private boolean isCheck;
|
||||
|
||||
public boolean isCheck() {
|
||||
return isCheck;
|
||||
}
|
||||
|
||||
public void setCheck(boolean check) {
|
||||
isCheck = check;
|
||||
}
|
||||
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
public String getNickname() {
|
||||
return nickname;
|
||||
}
|
||||
|
||||
public void setNickname(String nickname) {
|
||||
this.nickname = nickname;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public ArrayList<CartList> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(ArrayList<CartList> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public static class CartList {
|
||||
private String goods_detail;
|
||||
private String thumb;
|
||||
private String property;
|
||||
private String sale_price;
|
||||
private String sale_num;
|
||||
private String cart_id;
|
||||
private String goods_id;
|
||||
private String product_code;
|
||||
private String stock_status;
|
||||
private String stock_msg;
|
||||
private boolean isCheck;
|
||||
|
||||
public boolean isCheck() {
|
||||
return isCheck;
|
||||
}
|
||||
|
||||
public void setCheck(boolean check) {
|
||||
isCheck = check;
|
||||
}
|
||||
|
||||
public String getGoods_detail() {
|
||||
return goods_detail;
|
||||
}
|
||||
|
||||
public void setGoods_detail(String goods_detail) {
|
||||
this.goods_detail = goods_detail;
|
||||
}
|
||||
|
||||
public String getThumb() {
|
||||
return thumb;
|
||||
}
|
||||
|
||||
public void setThumb(String thumb) {
|
||||
this.thumb = thumb;
|
||||
}
|
||||
|
||||
public String getProperty() {
|
||||
return property;
|
||||
}
|
||||
|
||||
public void setProperty(String property) {
|
||||
this.property = property;
|
||||
}
|
||||
|
||||
public String getSale_price() {
|
||||
return sale_price;
|
||||
}
|
||||
|
||||
public void setSale_price(String sale_price) {
|
||||
this.sale_price = sale_price;
|
||||
}
|
||||
|
||||
public String getSale_num() {
|
||||
return sale_num;
|
||||
}
|
||||
|
||||
public void setSale_num(String sale_num) {
|
||||
this.sale_num = sale_num;
|
||||
}
|
||||
|
||||
public String getCart_id() {
|
||||
return cart_id;
|
||||
}
|
||||
|
||||
public void setCart_id(String cart_id) {
|
||||
this.cart_id = cart_id;
|
||||
}
|
||||
|
||||
public String getGoods_id() {
|
||||
return goods_id;
|
||||
}
|
||||
|
||||
public void setGoods_id(String goods_id) {
|
||||
this.goods_id = goods_id;
|
||||
}
|
||||
|
||||
public String getProduct_code() {
|
||||
return product_code;
|
||||
}
|
||||
|
||||
public void setProduct_code(String product_code) {
|
||||
this.product_code = product_code;
|
||||
}
|
||||
|
||||
public String getStock_status() {
|
||||
return stock_status;
|
||||
}
|
||||
|
||||
public void setStock_status(String stock_status) {
|
||||
this.stock_status = stock_status;
|
||||
}
|
||||
|
||||
public String getStock_msg() {
|
||||
return stock_msg;
|
||||
}
|
||||
|
||||
public void setStock_msg(String stock_msg) {
|
||||
this.stock_msg = stock_msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,7 @@ public class PreviewActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_preview2);
|
||||
setContentView(R.layout.activity_preview);
|
||||
|
||||
setStatusBarVisible(true);
|
||||
mImages = tempImages;
|
||||
|
||||
6
app/src/main/res/drawable/bg_tv_blue_round.xml
Normal file
6
app/src/main/res/drawable/bg_tv_blue_round.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<stroke android:width="1dp" android:color="#2587f5"/>
|
||||
<corners android:radius="3dp" />
|
||||
<solid android:color="#2587f5"/>
|
||||
</shape>
|
||||
7
app/src/main/res/drawable/shape_blank.xml
Normal file
7
app/src/main/res/drawable/shape_blank.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<solid android:color="#FFFFFF" />
|
||||
<stroke android:color="#000000"
|
||||
android:width="1dp"
|
||||
/>
|
||||
</shape>
|
||||
11
app/src/main/res/drawable/shape_delete_bg.xml
Normal file
11
app/src/main/res/drawable/shape_delete_bg.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<size android:width="2dp" />
|
||||
|
||||
<corners android:radius="16dp"/>
|
||||
<stroke
|
||||
android:width="1dip"
|
||||
android:color="@color/red" />
|
||||
|
||||
</shape>
|
||||
11
app/src/main/res/drawable/text_login.xml
Normal file
11
app/src/main/res/drawable/text_login.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
|
||||
<solid android:color="@android:color/transparent">
|
||||
</solid>
|
||||
<corners android:radius="80dp"></corners>
|
||||
<stroke
|
||||
android:width="0.5dp"
|
||||
android:color="#E9E9E9"></stroke>
|
||||
</shape>
|
||||
114
app/src/main/res/layout/activity_add_discovery.xml
Normal file
114
app/src/main/res/layout/activity_add_discovery.xml
Normal file
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
app:layout_srlBackgroundColor="@color/white">
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
android:background="@color/white"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="@dimen/mystatusbar"
|
||||
android:background="@color/backcolorAccent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_send"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="5dp"
|
||||
android:text="发布"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_cover"
|
||||
android:visibility="gone"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:background="@drawable/shape_blank"
|
||||
android:gravity="center"
|
||||
android:text="添加封面"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:hint="这一刻的想法"
|
||||
android:textColor="@color/black"
|
||||
android:textColorHint="@color/gray"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/rv_dynamic_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/vi"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:background="@drawable/background_grey_line" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_goods"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:text="商品规格"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:id="@+id/rec2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
|
||||
</FrameLayout>
|
||||
</layout>
|
||||
56
app/src/main/res/layout/activity_address_list.xml
Normal file
56
app/src/main/res/layout/activity_address_list.xml
Normal file
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="@dimen/mystatusbar"
|
||||
android:background="@color/backcolorAccent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="收货地址"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_manager"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="12dp"
|
||||
android:padding="8dp"
|
||||
android:text="新增"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/dw"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/lighteeeeee"
|
||||
app:srlEnableLoadMore="true"
|
||||
app:srlEnableLoadMoreWhenContentNotFull="true">
|
||||
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/rec"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout>
|
||||
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/ll_image_viewer_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="@dimen/mystatusbar"
|
||||
android:background="@color/backcolorAccent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_delete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="5dp"
|
||||
android:text="删除"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.sl.house_property.discovery.PhotoViewPager
|
||||
android:id="@+id/vp_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</com.sl.house_property.discovery.PhotoViewPager>
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
143
app/src/main/res/layout/fragment_cart.xml
Normal file
143
app/src/main/res/layout/fragment_cart.xml
Normal file
@@ -0,0 +1,143 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="@dimen/mystatusbar"
|
||||
android:background="@color/backcolorAccent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="购物车"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_manager"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="12dp"
|
||||
android:padding="8dp"
|
||||
android:text="管理"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/dw"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:background="@color/white"
|
||||
app:srlEnableLoadMore="false"
|
||||
android:layout_weight="1"
|
||||
app:srlEnableLoadMoreWhenContentNotFull="false">
|
||||
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/rec"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="@drawable/background_grey_line" />
|
||||
|
||||
<RelativeLayout
|
||||
android:background="@color/white"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:paddingLeft="16dp"
|
||||
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb_all"
|
||||
android:layout_width="25dp"
|
||||
android:button="@null"
|
||||
android:layout_height="25dp"
|
||||
android:background="@drawable/checkbox_style"
|
||||
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_toRightOf="@id/cb_all"
|
||||
android:text="全选" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_settle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@drawable/femalradio"
|
||||
android:text="结算(0)"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_amount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_toLeftOf="@id/btn_settle"
|
||||
android:text="¥0.00"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="14sp"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_t"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_toLeftOf="@id/tv_amount"
|
||||
android:text="合计:"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:visibility="visible" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_delete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@drawable/shape_delete_bg"
|
||||
android:text="删除"
|
||||
android:visibility="gone"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="16sp" />
|
||||
</RelativeLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="@drawable/background_grey_line" />
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
@@ -1,93 +1,428 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
<ScrollView
|
||||
android:id="@+id/scroll_view_extend"
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#F7F7F7"
|
||||
android:fillViewport="true">
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/l2"
|
||||
<ScrollView
|
||||
android:id="@+id/scroll_view_extend"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical">
|
||||
android:background="#F7F7F7"
|
||||
android:fillViewport="true">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/topView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@mipmap/beijing">
|
||||
<ImageView
|
||||
android:id="@+id/setting"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingRight="18dip"
|
||||
android:paddingTop="36dp"
|
||||
android:src="@mipmap/shezhi" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/userLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<tools.RoundedCornerImageView
|
||||
android:id="@+id/userImage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="15dip"
|
||||
android:src="@mipmap/head" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_toEndOf="@+id/userImage"
|
||||
android:text=""
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/usermale"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toEndOf="@+id/username"
|
||||
android:src="@mipmap/lady" />
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<my_view.tao_bao_refresh.RecyView
|
||||
android:id="@+id/myRecyView"
|
||||
<LinearLayout
|
||||
android:id="@+id/l2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/white"
|
||||
android:layout_marginBottom="50dip"
|
||||
android:layout_marginTop="15dip">
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
</my_view.tao_bao_refresh.RecyView>
|
||||
<RelativeLayout
|
||||
android:id="@+id/topView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:background="@mipmap/beijing">
|
||||
|
||||
<TextView
|
||||
android:layout_width="50dip"
|
||||
android:layout_height="50dip" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/setting"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingTop="36dp"
|
||||
android:paddingRight="18dip"
|
||||
android:src="@mipmap/shezhi" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/userLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true">
|
||||
|
||||
<tools.RoundedCornerImageView
|
||||
android:id="@+id/userImage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="15dip"
|
||||
android:src="@mipmap/head" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_toEndOf="@+id/userImage"
|
||||
android:text=""
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/usermale"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_toEndOf="@+id/username"
|
||||
android:src="@mipmap/lady" />
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- <my_view.tao_bao_refresh.RecyView-->
|
||||
<!-- android:id="@+id/myRecyView"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:background="@android:color/white"-->
|
||||
<!-- android:layout_marginBottom="50dip"-->
|
||||
<!-- android:layout_marginTop="15dip">-->
|
||||
|
||||
<!-- </my_view.tao_bao_refresh.RecyView>-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:background="@drawable/backroundcouner"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_qianbao"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:text="我的钱包" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:src="@mipmap/qianbao" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="0.5dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@color/divider_line_color" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_shouquan"
|
||||
android:layout_width="0dp"
|
||||
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:text="授权家庭" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:src="@mipmap/shouquan" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="@color/divider_line_color" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_fangchan"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:text="我的房产" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:src="@mipmap/fangchan" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="0.5dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@color/divider_line_color" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_yaoshi"
|
||||
android:layout_width="0dp"
|
||||
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:text="钥匙管理" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:src="@mipmap/yaoshi" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="@color/divider_line_color" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_geren"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:text="个人信息" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:src="@mipmap/genren" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="0.5dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@color/divider_line_color" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_shouhuo"
|
||||
android:layout_width="0dp"
|
||||
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:text="收货地址" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:src="@mipmap/fangchan" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:background="@drawable/backroundcouner"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:padding="8dp"
|
||||
android:text="购买订单"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="@color/divider_line_color"
|
||||
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:drawableTop="@mipmap/qianbao"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="待付款" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:drawableTop="@mipmap/qianbao"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="待发货" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:drawableTop="@mipmap/qianbao"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="待收货" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:background="@drawable/backroundcouner"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:padding="8dp"
|
||||
android:text="销售订单"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="@color/divider_line_color"
|
||||
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:drawableTop="@mipmap/qianbao"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="待付款" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:drawableTop="@mipmap/qianbao"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="待发货" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:drawableTop="@mipmap/qianbao"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="待收货" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="50dip"
|
||||
android:layout_height="50dip" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
99
app/src/main/res/layout/item_address.xml
Normal file
99
app/src/main/res/layout/item_address.xml
Normal file
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="1dp"
|
||||
android:background="@color/white"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="杨力量"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_phone"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:text="15091196878"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_state"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:background="@drawable/bg_tv_blue_round"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="3dp"
|
||||
android:paddingRight="3dp"
|
||||
android:text="默认"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_detail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="陕西省西安市雁塔区街道中华世纪城C区猴神大叔肯德基哈克斯的机会"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="16dp"
|
||||
android:visibility="visible">
|
||||
|
||||
<TextView
|
||||
|
||||
android:id="@+id/iv_edit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:text="设为默认"
|
||||
android:textSize="12sp"
|
||||
android:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
|
||||
android:id="@+id/iv_delete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:padding="5dp"
|
||||
android:src="@mipmap/del" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
58
app/src/main/res/layout/item_cart.xml
Normal file
58
app/src/main/res/layout/item_cart.xml
Normal file
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:background="#F7F7F7"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<CheckBox
|
||||
android:clickable="false"
|
||||
android:id="@+id/cb_check"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:background="@drawable/checkbox_style"
|
||||
android:button="@null" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_head"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:src="@mipmap/head" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:text="梦"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:id="@+id/item_rec"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
74
app/src/main/res/layout/item_cart_cart.xml
Normal file
74
app/src/main/res/layout/item_cart_cart.xml
Normal file
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:clickable="false"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@drawable/checkbox_style"
|
||||
android:button="@null" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_goods"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_toRightOf="@id/cb"
|
||||
android:src="@color/default_text_color"
|
||||
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_goods_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_toRightOf="@id/iv_goods"
|
||||
android:text="多恐惧感"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_info2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tv_goods_name"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_toRightOf="@id/iv_goods"
|
||||
android:text="明年考了"
|
||||
android:textColor="#999999" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_price"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/iv_goods"
|
||||
android:layout_toRightOf="@id/iv_goods"
|
||||
android:text="¥135.00"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="16sp"
|
||||
|
||||
/>
|
||||
|
||||
<com.sl.house_property.cart.AmountView
|
||||
android:id="@+id/amount_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/iv_goods"
|
||||
android:layout_alignParentRight="true"
|
||||
app:btnTextSize="12sp"
|
||||
app:btnWidth="24dp"
|
||||
app:tvWidth="32dp" />
|
||||
</RelativeLayout>
|
||||
</layout>
|
||||
13
app/src/main/res/layout/item_preview.xml
Normal file
13
app/src/main/res/layout/item_preview.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.github.chrisbanes.photoview.PhotoView
|
||||
android:id="@+id/photoView"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</RelativeLayout>
|
||||
13
app/src/main/res/layout/item_rv_create_dynamic.xml
Normal file
13
app/src/main/res/layout/item_rv_create_dynamic.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/riv_img"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="70dp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
37
app/src/main/res/layout/view_amount.xml
Normal file
37
app/src/main/res/layout/view_amount.xml
Normal file
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="true"
|
||||
|
||||
android:showDividers="middle"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btnDecrease"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/icon_minus"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/etAmount"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:minWidth="100dp"
|
||||
android:layout_weight="2"
|
||||
android:background="@drawable/text_login"
|
||||
android:gravity="center"
|
||||
android:text="1"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btnIncrease"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/icon_add1"
|
||||
/>
|
||||
</LinearLayout>
|
||||
BIN
app/src/main/res/mipmap-xhdpi/icon_add1.png
Normal file
BIN
app/src/main/res/mipmap-xhdpi/icon_add1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-xhdpi/icon_minus.png
Normal file
BIN
app/src/main/res/mipmap-xhdpi/icon_minus.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/icon_add1.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/icon_add1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/icon_minus.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/icon_minus.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
@@ -27,5 +27,13 @@
|
||||
|
||||
</declare-styleable>
|
||||
|
||||
|
||||
<declare-styleable name="AmountView">
|
||||
<!-- 左右2边+-按钮的宽度 -->
|
||||
<attr name="btnWidth" format="dimension" />
|
||||
<!-- 中间TextView的宽度 -->
|
||||
<attr name="tvWidth" format="dimension" />
|
||||
<!--<attr name="tvColor" format="color"/>-->
|
||||
<attr name="tvTextSize" format="dimension"/>
|
||||
<attr name="btnTextSize" format="dimension"/>
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
@@ -14,7 +14,7 @@
|
||||
<string name="loading">加载中...</string>
|
||||
<string name="fee_money_tip">请选择或输入缴费金额</string>
|
||||
<string name="fee_select_tip">请选择需要缴费的房屋</string>
|
||||
|
||||
<string name="text_preview_index">(%1$d/%2$d)预览</string>
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
<string name="title_activity_login">Sign in</string>
|
||||
|
||||
Reference in New Issue
Block a user