@ -0,0 +1,129 @@
|
|||||||
|
package com.android.activity;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import com.android.R;
|
||||||
|
import com.android.bean.Good;
|
||||||
|
import com.android.bean.ResponseData;
|
||||||
|
import com.android.bean.User;
|
||||||
|
import com.android.bean.postBean.UserPurchase;
|
||||||
|
import com.android.databinding.ActivityConfirmPurchaseBinding;
|
||||||
|
import com.android.databinding.ActivityMainBinding;
|
||||||
|
import com.android.model.purchase.GoodsTradeListener;
|
||||||
|
import com.android.model.purchase.GoodsTradingModel;
|
||||||
|
import com.android.model.purchase.GoodsTradingModelimpl;
|
||||||
|
import com.android.utils.ToastUtil;
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
|
public class ConfirmPurchaseActivity extends AppCompatActivity implements View.OnClickListener, GoodsTradeListener {
|
||||||
|
private Good goods;
|
||||||
|
private User user;
|
||||||
|
private GoodsTradingModel tradingModel;
|
||||||
|
private UserPurchase userPurchase;
|
||||||
|
|
||||||
|
//视图绑定
|
||||||
|
private ActivityConfirmPurchaseBinding binding;
|
||||||
|
private View view;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
//注册eventbus
|
||||||
|
EventBus.getDefault().register(this);
|
||||||
|
|
||||||
|
// setContentView(R.layout.activity_confirm_purchase);
|
||||||
|
//初始化binding
|
||||||
|
binding = ActivityConfirmPurchaseBinding.inflate(getLayoutInflater());
|
||||||
|
view = binding.getRoot();
|
||||||
|
setContentView(view);
|
||||||
|
|
||||||
|
//初始化View
|
||||||
|
initView();
|
||||||
|
tradingModel = new GoodsTradingModelimpl();
|
||||||
|
//设置购买按钮监听器
|
||||||
|
binding.btnConfirm.setOnClickListener(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initView() {
|
||||||
|
if (goods != null){
|
||||||
|
binding.tvPrice.setText(goods.getPrice().toString());
|
||||||
|
binding.tvTotalPrice.setText(goods.getPrice().toString());
|
||||||
|
binding.tvDesc.setText(goods.getContent());
|
||||||
|
binding.tvAddress.setText(goods.getAddr());
|
||||||
|
Glide.with(this)
|
||||||
|
.load(goods.getImageUrlList().get(0))
|
||||||
|
.into(binding.ivPic);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//拿取点进来的商品数据
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN,sticky = true)
|
||||||
|
public void getGoods(Good data){
|
||||||
|
if(data != null){
|
||||||
|
this.goods = data;
|
||||||
|
Log.e("Goods",goods.getImageUrlList().get(0).toString());
|
||||||
|
}else {
|
||||||
|
Log.e("Goods","获取失败");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//拿取点进来的用户数据
|
||||||
|
@Subscribe(threadMode = ThreadMode.POSTING,sticky = true)
|
||||||
|
public void getLoginUser(ResponseData<User> responseData){
|
||||||
|
this.user = responseData.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
|
||||||
|
//解注eventbus
|
||||||
|
super.onDestroy();
|
||||||
|
EventBus.getDefault().unregister(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
switch (v.getId()){
|
||||||
|
case R.id.btn_confirm:
|
||||||
|
onPurchase();
|
||||||
|
Log.e("1",goods.getId().toString());
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPurchase() {
|
||||||
|
userPurchase = new UserPurchase();
|
||||||
|
userPurchase.setGoodsId(goods.getId());
|
||||||
|
userPurchase.setPrice(goods.getPrice());
|
||||||
|
userPurchase.setBuyerId(user.getId());
|
||||||
|
userPurchase.setSellerId(goods.gettUserId());
|
||||||
|
tradingModel.goodsTrading(this,userPurchase);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccessGoodsTrading(ResponseData<String> responseData) {
|
||||||
|
Log.e("ConfirmPurchaseActivity",String.valueOf(responseData.getCode()));
|
||||||
|
if(responseData.getCode() == 200){
|
||||||
|
ToastUtil.showMsg(this,"购买商品成功");
|
||||||
|
Intent intent = new Intent(this, HomePageActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFail(ResponseData<String> responseData) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.android.bean.postBean;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class UserPurchase {
|
||||||
|
@SerializedName("buyerId")
|
||||||
|
private Long buyerId;
|
||||||
|
@SerializedName("goodsId")
|
||||||
|
private Long goodsId;
|
||||||
|
@SerializedName("price")
|
||||||
|
private Integer price;
|
||||||
|
@SerializedName("sellerId")
|
||||||
|
private Long sellerId;
|
||||||
|
|
||||||
|
public UserPurchase() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getBuyerId() {
|
||||||
|
return buyerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBuyerId(Long buyerId) {
|
||||||
|
this.buyerId = buyerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getGoodsId() {
|
||||||
|
return goodsId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGoodsId(Long goodsId) {
|
||||||
|
this.goodsId = goodsId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPrice() {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(Integer price) {
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSellerId() {
|
||||||
|
return sellerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSellerId(Long sellerId) {
|
||||||
|
this.sellerId = sellerId;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.android.model.purchase;
|
||||||
|
|
||||||
|
import com.android.bean.ResponseData;
|
||||||
|
|
||||||
|
public interface GoodsTradeListener {
|
||||||
|
void onSuccessGoodsTrading(ResponseData<String> responseData);
|
||||||
|
void onFail(ResponseData<String> responseData);
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.android.model.purchase;
|
||||||
|
|
||||||
|
import com.android.bean.postBean.UserPurchase;
|
||||||
|
|
||||||
|
public interface GoodsTradingModel {
|
||||||
|
void goodsTrading(GoodsTradeListener goodsTradeListener,
|
||||||
|
UserPurchase userPurchase);
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
package com.android.model.purchase;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.android.bean.ResponseData;
|
||||||
|
import com.android.bean.postBean.UserPurchase;
|
||||||
|
import com.android.utils.constraint.Constants;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.rxjava3.annotations.NonNull;
|
||||||
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
|
import io.reactivex.rxjava3.core.Observer;
|
||||||
|
import io.reactivex.rxjava3.disposables.Disposable;
|
||||||
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||||
|
import retrofit2.Retrofit;
|
||||||
|
import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory;
|
||||||
|
import retrofit2.converter.gson.GsonConverterFactory;
|
||||||
|
|
||||||
|
public class GoodsTradingModelimpl implements GoodsTradingModel{
|
||||||
|
@Override
|
||||||
|
public void goodsTrading(GoodsTradeListener goodsTradeListener,
|
||||||
|
UserPurchase userPurchase) {
|
||||||
|
Retrofit retrofit = new Retrofit.Builder()
|
||||||
|
.baseUrl("http://47.107.52.7:88/member/")
|
||||||
|
.addConverterFactory(GsonConverterFactory.create())
|
||||||
|
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Purchase_interface anInterface
|
||||||
|
= retrofit.create(Purchase_interface.class);
|
||||||
|
Log.e("getBuyerId",userPurchase.getBuyerId().toString());
|
||||||
|
Log.e("getGoodsId",userPurchase.getGoodsId().toString());
|
||||||
|
Log.e("getPrice",userPurchase.getPrice().toString());
|
||||||
|
Log.e("sellerId",userPurchase.getSellerId().toString());
|
||||||
|
|
||||||
|
|
||||||
|
Observable<ResponseData<String>> observable
|
||||||
|
= anInterface.sendTrading(userPurchase.getBuyerId(),userPurchase.getGoodsId(),
|
||||||
|
userPurchase.getPrice(),userPurchase.getSellerId());
|
||||||
|
|
||||||
|
observable
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Observer<ResponseData<String>>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@NonNull ResponseData<String> responseData) {
|
||||||
|
goodsTradeListener.onSuccessGoodsTrading(responseData);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@NonNull Throwable e) {
|
||||||
|
Log.e("GoodsTradingModelimpl","请求错误");
|
||||||
|
Log.e("GoodsTradingModelimpl",e.toString());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.android.model.purchase;
|
||||||
|
|
||||||
|
import com.android.bean.ResponseData;
|
||||||
|
import com.android.bean.postBean.UserPurchase;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.core.Observable;
|
||||||
|
import retrofit2.http.Body;
|
||||||
|
import retrofit2.http.Field;
|
||||||
|
import retrofit2.http.FormUrlEncoded;
|
||||||
|
import retrofit2.http.GET;
|
||||||
|
import retrofit2.http.Headers;
|
||||||
|
import retrofit2.http.POST;
|
||||||
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
|
public interface Purchase_interface {
|
||||||
|
@FormUrlEncoded
|
||||||
|
@POST("tran/trading")
|
||||||
|
@Headers({"appId:b34ac21286ae45938add627b418a4871",
|
||||||
|
"appSecret:67526def9de11d4a64f5e80e60ed3372eea69"})
|
||||||
|
Observable<ResponseData<String>> sendTrading(@Field("buyerId") Long buyerId,
|
||||||
|
@Field("goodsId") Long goodsId,
|
||||||
|
@Field("price") Integer price,
|
||||||
|
@Field("sellerId") Long sellerId);
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.android.utils;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
public class ToastUtil {
|
||||||
|
|
||||||
|
public static Toast mToast;
|
||||||
|
public static void showMsg(Context context, String msg)
|
||||||
|
{
|
||||||
|
if(mToast == null){
|
||||||
|
mToast = Toast.makeText(context, msg, Toast.LENGTH_LONG);
|
||||||
|
}else{
|
||||||
|
mToast.setText(msg);
|
||||||
|
}
|
||||||
|
mToast.show();
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package com.android.utils.constraint;
|
package com.android.utils.constraint;
|
||||||
|
|
||||||
public class LoginConstraint {
|
public class Constants {
|
||||||
public static final String AppId_VALUE = "appId:b34ac21286ae45938add627b418a4871";
|
public static final String AppId_VALUE = "appId:b34ac21286ae45938add627b418a4871";
|
||||||
public static final String AppSecret_VALUE = "appId:b34ac21286ae45938add627b418a4871";
|
public static final String AppSecret_VALUE = "appId:b34ac21286ae45938add627b418a4871";
|
||||||
public static final String BASE_URL = "http://47.107.52.7:88/member/";
|
public static final String BASE_URL = "http://47.107.52.7:88/member/";
|
@ -1,41 +0,0 @@
|
|||||||
package com.android.utils.eventBus;
|
|
||||||
|
|
||||||
import com.android.bean.Good;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class EventMsg<T> {
|
|
||||||
private String msg;
|
|
||||||
private int status;
|
|
||||||
private T data;
|
|
||||||
|
|
||||||
public EventMsg(String msg, int status, T data) {
|
|
||||||
this.msg = msg;
|
|
||||||
this.status = status;
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMsg() {
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMsg(String msg) {
|
|
||||||
this.msg = msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(int status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setData(T data) {
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
}
|
|
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 896 B |
After Width: | Height: | Size: 686 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 987 B |
After Width: | Height: | Size: 468 B |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 569 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 697 B |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 988 B |
@ -0,0 +1,130 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout
|
||||||
|
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"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".activity.ConfirmPurchase">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ll_1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="150dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_pic"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:padding="20dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_desc"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:text="商品详细描述商品详细描述商品详细描述商品详细描述商品详细描述商品详细描述商品详细描述商品详细描述商品详细描述商品详细描述商品详细描述商品详细描述商品详细描述商品详细描述商品详细描述商品详细描述"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="75dp"
|
||||||
|
android:ellipsize="none"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:textColor="#ff0000"
|
||||||
|
android:text="¥50"
|
||||||
|
android:id="@+id/tv_price"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ll_2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_below="@id/ll_1"
|
||||||
|
android:layout_marginLeft="30dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:text="卖家所在地" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_address"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginLeft="50dp"
|
||||||
|
android:layout_marginRight="30dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:text="地址" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- <RelativeLayout-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:layout_height="100dp"-->
|
||||||
|
<!-- android:layout_below="@id/ll_2"-->
|
||||||
|
<!-- android:layout_marginLeft="30dp"-->
|
||||||
|
<!-- android:orientation="horizontal">-->
|
||||||
|
|
||||||
|
<!-- <TextView-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="match_parent"-->
|
||||||
|
<!-- android:gravity="center_vertical"-->
|
||||||
|
<!-- android:text="运费" />-->
|
||||||
|
|
||||||
|
<!-- <TextView-->
|
||||||
|
<!-- android:id="@+id/tv_express_fee"-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:layout_alignParentEnd="true"-->
|
||||||
|
<!-- android:layout_alignParentRight="true"-->
|
||||||
|
<!-- android:layout_centerInParent="true"-->
|
||||||
|
<!-- android:layout_marginRight="10dp"-->
|
||||||
|
<!-- android:text="¥0.00"-->
|
||||||
|
<!-- android:textColor="#ff0000" />-->
|
||||||
|
<!-- </RelativeLayout>-->
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginLeft="30dp"
|
||||||
|
android:text="佣金:" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_total_price"
|
||||||
|
android:textColor="#FF0000"
|
||||||
|
android:textSize="17sp"
|
||||||
|
android:layout_toRightOf="@+id/tv_1"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:text="¥100.00"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_confirm"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:text="确定"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:background="#FE4543"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_width="120dp"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
@ -1,16 +1,137 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="15dp"
|
||||||
tools:context=".activity.GoodsDetailsActivity">
|
tools:context=".activity.GoodsDetailsActivity">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/layout_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_head_portrait"
|
||||||
|
app:srcCompat="@drawable/head_portrait"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:textColor="#000000"
|
||||||
|
android:id="@+id/tv_username"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:text="1158677160"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_marginTop="3dp"
|
||||||
|
android:id="@+id/tv_location"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:text="桂林电子科技大学"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/layout_price"
|
||||||
|
android:layout_below="@+id/layout_title"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="10sp"
|
||||||
|
android:layout_marginTop="3dp"
|
||||||
|
android:text="¥"
|
||||||
|
android:textColor="#ff4242" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_price"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="3dp"
|
||||||
|
android:text="88.00"
|
||||||
|
android:textColor="#ff4242" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_goods_show"
|
android:id="@+id/tv_desc"
|
||||||
android:layout_width="wrap_content"
|
android:layout_below="@+id/layout_price"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:text="商品描述"
|
||||||
|
android:textColor="#000000"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_pic"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="180dp"
|
||||||
|
android:layout_below="@id/tv_desc"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
app:srcCompat="@drawable/logo" />
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="商品详细页面"
|
android:layout_alignParentBottom="true"
|
||||||
android:gravity="center"
|
android:orientation="horizontal">
|
||||||
tools:ignore="MissingConstraints" />
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_comment"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#00000000"
|
||||||
|
android:drawableTop="@drawable/comment"
|
||||||
|
android:text="评论"
|
||||||
|
android:textColor="#8a8a8a" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_collect"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_toRightOf="@id/btn_comment"
|
||||||
|
android:background="#00000000"
|
||||||
|
android:drawableTop="@drawable/collect"
|
||||||
|
android:text="收藏"
|
||||||
|
android:textColor="#8a8a8a" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_talk"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="#00000000"
|
||||||
|
android:drawableTop="@drawable/chat"
|
||||||
|
android:layout_toLeftOf="@id/btn_buy_cart"
|
||||||
|
android:text="聊一聊"
|
||||||
|
android:textColor="#8a8a8a" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_buy_cart"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:background="#00000000"
|
||||||
|
android:drawableTop="@drawable/cart"
|
||||||
|
android:text="购买"
|
||||||
|
android:textColor="#8a8a8a" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</RelativeLayout>
|
@ -0,0 +1,70 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".activity.fragment.PublishProductFragment">
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="10dp">
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_desc"
|
||||||
|
android:gravity="start"
|
||||||
|
android:hint="商品描述"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="270dp"/>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:scaleType="fitXY"
|
||||||
|
android:id="@+id/btn_add_image"
|
||||||
|
android:background="@drawable/addimageiv"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:gravity="left|center_vertical"
|
||||||
|
android:paddingLeft="30dp"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
|
android:id="@+id/btn_location"
|
||||||
|
android:text="货物地址"
|
||||||
|
android:textColor="#8c8c8c"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="30dp"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:drawableLeft="@drawable/price"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:drawablePadding="10dp"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:text="价格"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_price"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:hint="开个价"
|
||||||
|
android:inputType="numberDecimal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:background="#00000000"
|
||||||
|
android:drawableTop="@drawable/release_orange"
|
||||||
|
android:id="@+id/btn_release"
|
||||||
|
android:text="发布"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
@ -1,14 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:context=".activity.fragment.ShopCarPageFragment">
|
|
||||||
|
|
||||||
<!-- TODO: Update blank fragment layout -->
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:text="shop" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
|