Commit a2361c66 by llxqb

购物车界面-支付部分

parent dd9e6149
...@@ -9,6 +9,7 @@ import android.support.v7.widget.LinearLayoutManager; ...@@ -9,6 +9,7 @@ import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
...@@ -21,11 +22,12 @@ import com.freemud.app.facepay.help.DialogFactory; ...@@ -21,11 +22,12 @@ import com.freemud.app.facepay.help.DialogFactory;
import com.freemud.app.facepay.views.CustomPopWindow; import com.freemud.app.facepay.views.CustomPopWindow;
import com.freemud.app.facepay.views.LoginDialog; import com.freemud.app.facepay.views.LoginDialog;
import com.freemud.app.facepay.views.MainDialog; import com.freemud.app.facepay.views.MainDialog;
import com.freemud.app.facepay.views.ShoppingCartDialog;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class ShoppingCartActivity extends AppCompatActivity implements View.OnClickListener, MainDialog.MainDialogListener{ public class ShoppingCartActivity extends AppCompatActivity implements View.OnClickListener, MainDialog.MainDialogListener,ShoppingCartDialog.ShoppingCartDialogListener{
public static String TAG = "ShoppingCartActivity"; public static String TAG = "ShoppingCartActivity";
private RecyclerView mCartRecyclerView; private RecyclerView mCartRecyclerView;
private CartGoodsAdapter mCartGoodsAdapter; private CartGoodsAdapter mCartGoodsAdapter;
...@@ -34,6 +36,7 @@ public class ShoppingCartActivity extends AppCompatActivity implements View.OnCl ...@@ -34,6 +36,7 @@ public class ShoppingCartActivity extends AppCompatActivity implements View.OnCl
private CustomPopWindow mCustomPopWindow; private CustomPopWindow mCustomPopWindow;
private List<ShoppingBag> shoppingBagList; private List<ShoppingBag> shoppingBagList;
private LinearLayout mCartLlCartNoShopping;//购物车没商品显示的布局 private LinearLayout mCartLlCartNoShopping;//购物车没商品显示的布局
private Button mCartBtnPay;//去付款
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -51,10 +54,12 @@ public class ShoppingCartActivity extends AppCompatActivity implements View.OnCl ...@@ -51,10 +54,12 @@ public class ShoppingCartActivity extends AppCompatActivity implements View.OnCl
mCartRecyclerView = findViewById(R.id.cart_recyclerView); mCartRecyclerView = findViewById(R.id.cart_recyclerView);
mCartLlAddbag = findViewById(R.id.cart_ll_addbag); mCartLlAddbag = findViewById(R.id.cart_ll_addbag);
mCartLlCartNoShopping = findViewById(R.id.cart_ll_cart_no_shopping); mCartLlCartNoShopping = findViewById(R.id.cart_ll_cart_no_shopping);
mCartBtnPay = findViewById(R.id.cart_btn_pay);
mCommonTvLeft.setOnClickListener(this); mCommonTvLeft.setOnClickListener(this);
mCartBarcodeHands.setOnClickListener(this); mCartBarcodeHands.setOnClickListener(this);
mCartLlAddbag.setOnClickListener(this); mCartLlAddbag.setOnClickListener(this);
mCartBtnPay.setOnClickListener(this);
} }
@Override @Override
...@@ -72,14 +77,23 @@ public class ShoppingCartActivity extends AppCompatActivity implements View.OnCl ...@@ -72,14 +77,23 @@ public class ShoppingCartActivity extends AppCompatActivity implements View.OnCl
case R.id.cart_ll_addbag://添加购物袋 case R.id.cart_ll_addbag://添加购物袋
initPopWindow(); initPopWindow();
break; break;
case R.id.cart_btn_pay://去付款
goPay();
break;
} }
} }
private void goPay(){
ShoppingCartDialog shoppingCartDialog = ShoppingCartDialog.newInstance();
shoppingCartDialog.setListener(ShoppingCartActivity.this);
DialogFactory.showDialogFragment(getSupportFragmentManager(), shoppingCartDialog, LoginDialog.TAG);
}
private void initPopWindow() { private void initPopWindow() {
initBagData(); initBagData();
View contentView = LayoutInflater.from(this).inflate(R.layout.popwindow_bag, null); View contentView = LayoutInflater.from(this).inflate(R.layout.popwindow_bag, null);
//处理popWindow 显示内容 //处理popWindow 显示内容
handleListView(contentView); handlePopListView(contentView);
//创建并显示popWindow //创建并显示popWindow
mCustomPopWindow = new CustomPopWindow.PopupWindowBuilder(this) mCustomPopWindow = new CustomPopWindow.PopupWindowBuilder(this)
...@@ -111,7 +125,7 @@ public class ShoppingCartActivity extends AppCompatActivity implements View.OnCl ...@@ -111,7 +125,7 @@ public class ShoppingCartActivity extends AppCompatActivity implements View.OnCl
} }
} }
private void handleListView(View contentView) { private void handlePopListView(View contentView) {
RecyclerView recyclerView = contentView.findViewById(R.id.item_popwindow_recyclerView); RecyclerView recyclerView = contentView.findViewById(R.id.item_popwindow_recyclerView);
LinearLayoutManager manager = new LinearLayoutManager(this); LinearLayoutManager manager = new LinearLayoutManager(this);
manager.setOrientation(LinearLayoutManager.VERTICAL); manager.setOrientation(LinearLayoutManager.VERTICAL);
...@@ -192,4 +206,9 @@ public class ShoppingCartActivity extends AppCompatActivity implements View.OnCl ...@@ -192,4 +206,9 @@ public class ShoppingCartActivity extends AppCompatActivity implements View.OnCl
public void mainDialogBtnOkListener(boolean mainFlag) { public void mainDialogBtnOkListener(boolean mainFlag) {
} }
@Override
public void shoppingCartDialogBtnOkListener(boolean flag) {
}
} }
...@@ -34,10 +34,12 @@ public class CommonDialog extends BaseDialogFragment { ...@@ -34,10 +34,12 @@ public class CommonDialog extends BaseDialogFragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.dialog_common, container, true); View view = inflater.inflate(R.layout.dialog_common, container, true);
LinearLayout mDialogLayouyCommon = view.findViewById(R.id.dialog_layout_common); LinearLayout mDialogLayoutCommon = view.findViewById(R.id.dialog_layout_common);
LinearLayout mDialogCommonLlCenter = view.findViewById(R.id.dialog_common_ll_center);
TextView mCommonDialogTvSure = view.findViewById(R.id.common_dialog_tv_sure); TextView mCommonDialogTvSure = view.findViewById(R.id.common_dialog_tv_sure);
mCommonDialogTvSure.setOnClickListener(this); mCommonDialogTvSure.setOnClickListener(this);
mDialogLayouyCommon.setOnClickListener(this); mDialogLayoutCommon.setOnClickListener(this);
mDialogCommonLlCenter.setOnClickListener(this);
return view; return view;
} }
......
package com.freemud.app.facepay.views;
import android.os.Bundle;
import android.support.constraint.ConstraintLayout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.freemud.app.facepay.R;
import com.freemud.app.facepay.help.DialogFactory;
/**
* 公用提示的dialog
*
* @author li
*/
public class ShoppingCartDialog extends BaseDialogFragment {
public static final String TAG = ShoppingCartDialog.class.getSimpleName();
private ShoppingCartDialogListener dialogBtnListener;
private String newValue = "";
public static ShoppingCartDialog newInstance() {
return new ShoppingCartDialog();
}
public void setListener(ShoppingCartDialogListener dialogBtnListener) {
this.dialogBtnListener = dialogBtnListener;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.dialog_shoppingcart_pay, container, true);
LinearLayout mDialogLayoutCartPay = view.findViewById(R.id.dialog_layout_cart_pay);
ConstraintLayout mDialogCartClPay = view.findViewById(R.id.dialog_cart_cl_pay);
mDialogCartClPay.setOnClickListener(this);
LinearLayout mDialogCartLlExit = view.findViewById(R.id.dialog_cart_ll_exit);
LinearLayout mDialogCartFacePay = view.findViewById(R.id.dialog_cart_ll_face_pay);
LinearLayout mDialogCartFaceQrCodePay = view.findViewById(R.id.dialog_cart_ll_qr_code_pay);
mDialogLayoutCartPay.setOnClickListener(this);
mDialogCartLlExit.setOnClickListener(this);
mDialogCartFacePay.setOnClickListener(this);
mDialogCartFaceQrCodePay.setOnClickListener(this);
return view;
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.dialog_layout_cart_pay:
closeLoginDialog();
break;
case R.id.dialog_cart_ll_exit:
closeLoginDialog();
break;
case R.id.dialog_cart_ll_face_pay:
break;
case R.id.dialog_cart_ll_qr_code_pay:
break;
}
}
private boolean toLogin() {
if (dialogBtnListener != null) {
closeLoginDialog();
dialogBtnListener.shoppingCartDialogBtnOkListener(true);
}
return true;
}
public interface ShoppingCartDialogListener {
void shoppingCartDialogBtnOkListener(boolean flag);
}
public void closeLoginDialog() {
try {
this.dismiss();
} catch (Exception e) {
DialogFactory.dismissDialogFragment(getActivity().getSupportFragmentManager(), TAG);
}
}
}
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
android:background="#90000000"> android:background="#90000000">
<LinearLayout <LinearLayout
android:id="@+id/dialog_common_ll_center"
android:layout_width="@dimen/height_460px" android:layout_width="@dimen/height_460px"
android:layout_height="@dimen/height_300px" android:layout_height="@dimen/height_300px"
android:background="@drawable/app_write_bg" android:background="@drawable/app_write_bg"
...@@ -38,9 +39,10 @@ ...@@ -38,9 +39,10 @@
<TextView <TextView
android:id="@+id/common_dialog_tv_sure" android:id="@+id/common_dialog_tv_sure"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/height_30px" android:layout_marginTop="@dimen/height_30px"
android:gravity="center"
android:text="@string/common_dialog_shopping_sure" android:text="@string/common_dialog_shopping_sure"
android:textColor="@color/app_color" android:textColor="@color/app_color"
android:textSize="@dimen/sp_30px" /> android:textSize="@dimen/sp_30px" />
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout 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"
android:id="@+id/dialog_layout_main" android:id="@+id/dialog_layout_cart_pay"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#90000000" android:background="#90000000"
...@@ -10,18 +10,110 @@ ...@@ -10,18 +10,110 @@
<android.support.constraint.ConstraintLayout <android.support.constraint.ConstraintLayout
android:id="@+id/dialog_cl_main" android:id="@+id/dialog_cart_cl_pay"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="@dimen/height_300px" android:layout_marginTop="@dimen/height_300px"
android:background="@color/write"> android:background="@color/write">
<ImageView <LinearLayout
android:id="@+id/dialog_cart_ll_exit"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/exit" android:layout_margin="@dimen/height_8px"
/> android:background="@drawable/dialog_iv_exit_selector"
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/dialog_cart_iv_exit"
android:layout_width="@dimen/height_38px"
android:layout_height="@dimen/height_38px"
android:layout_margin="@dimen/height_28px"
android:contentDescription="@string/app_name"
android:src="@drawable/exit" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/height_32px"
android:text="@string/dialog_cart_pay_title"
android:textColor="@color/black"
android:textSize="@dimen/sp_30px"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/height_330px"
android:layout_marginEnd="@dimen/height_36px"
android:layout_marginStart="@dimen/height_36px"
android:layout_marginTop="@dimen/height_326px"
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:id="@+id/dialog_cart_ll_face_pay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:background="@drawable/app_btn_login_selector"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/height_144px"
android:layout_height="@dimen/height_140px"
android:src="@drawable/facepay" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_30px"
android:textColor="@color/black"
android:layout_marginTop="@dimen/height_30px"
android:text="@string/dialog_cart_pay_facePay" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="@dimen/height_180px"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/height_20px"
android:layout_marginStart="@dimen/height_20px"
android:background="@color/line_color" />
<LinearLayout
android:id="@+id/dialog_cart_ll_qr_code_pay"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:background="@drawable/app_btn_login_selector"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/height_144px"
android:layout_height="@dimen/height_140px"
android:src="@drawable/qr_pay" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_30px"
android:textColor="@color/black"
android:layout_marginTop="@dimen/height_30px"
android:text="@string/dialog_cart_pay_qrCodePay" />
</LinearLayout>
</LinearLayout>
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
<dimen name="height_128px">64dp</dimen> <dimen name="height_128px">64dp</dimen>
<dimen name="height_130px">65dp</dimen> <dimen name="height_130px">65dp</dimen>
<dimen name="height_140px">70dp</dimen> <dimen name="height_140px">70dp</dimen>
<dimen name="height_144px">72dp</dimen>
<dimen name="height_150px">75dp</dimen> <dimen name="height_150px">75dp</dimen>
<dimen name="height_160px">80dp</dimen> <dimen name="height_160px">80dp</dimen>
<dimen name="height_172px">86dp</dimen> <dimen name="height_172px">86dp</dimen>
...@@ -67,6 +68,7 @@ ...@@ -67,6 +68,7 @@
<dimen name="height_300px">150dp</dimen> <dimen name="height_300px">150dp</dimen>
<dimen name="height_310px">155dp</dimen> <dimen name="height_310px">155dp</dimen>
<dimen name="height_326px">163dp</dimen> <dimen name="height_326px">163dp</dimen>
<dimen name="height_330px">165dp</dimen>
<dimen name="height_336px">168dp</dimen> <dimen name="height_336px">168dp</dimen>
<dimen name="height_340px">170dp</dimen> <dimen name="height_340px">170dp</dimen>
<dimen name="height_400px">200dp</dimen> <dimen name="height_400px">200dp</dimen>
......
...@@ -38,5 +38,8 @@ ...@@ -38,5 +38,8 @@
<!--ShoppingCart--> <!--ShoppingCart-->
<string name="item_cartgoods_delete">删除</string> <string name="item_cartgoods_delete">删除</string>
<string name="cart_no_shopping_hint">请在机器下方扫码区扫描商品</string> <string name="cart_no_shopping_hint">请在机器下方扫码区扫描商品</string>
<string name="dialog_cart_pay_title">选择支付方式</string>
<string name="dialog_cart_pay_facePay">刷脸支付</string>
<string name="dialog_cart_pay_qrCodePay">扫码支付</string>
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment