From eb53d9c4837b5a0df0db1ca153e05bf305ce498a Mon Sep 17 00:00:00 2001 From: zuoxiao <470321431@qq.com> Date: 星期二, 08 四月 2025 15:32:01 +0800 Subject: [PATCH] feat(generallibrary): 新增用户开卡功能 --- generallibrary/src/main/java/com/dayu/general/activity/NewCard2Activity.kt | 224 ++++++++++++++++ generallibrary/src/main/res/layout/activity_card_list.xml | 1 generallibrary/src/main/java/com/dayu/general/activity/SearchUserListActivity.kt | 42 +- generallibrary/src/main/res/layout/activity_new_card_1_ge.xml | 359 +++++++++++++++++++++++++ generallibrary/src/main/res/drawable/radio_selector.xml | 5 generallibrary/src/main/res/drawable/radio_unchecked.xml | 7 generallibrary/src/main/AndroidManifest.xml | 27 + generallibrary/src/main/java/com/dayu/general/bean/net/SearchUserResult.kt | 4 generallibrary/src/main/res/values/colors.xml | 4 generallibrary/src/main/res/layout/dialog_search_card_ge.xml | 142 ++++++++++ generallibrary/src/main/res/drawable/radio_checked.xml | 12 11 files changed, 795 insertions(+), 32 deletions(-) diff --git a/generallibrary/src/main/AndroidManifest.xml b/generallibrary/src/main/AndroidManifest.xml index 3172cdf..f167a9f 100644 --- a/generallibrary/src/main/AndroidManifest.xml +++ b/generallibrary/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:tools="http://schemas.android.com/tools" - xmlns:android="http://schemas.android.com/apk/res/android"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools"> <uses-permission android:name="android.permission.NFC" /> <!--鐢ㄤ簬璁块棶缃戠粶锛岀綉缁滃畾浣嶉渶瑕佷笂缃�--> @@ -49,18 +49,18 @@ <!-- </activity>--> <activity android:name="com.dayu.general.activity.NewCardActivity" /> <activity android:name="com.dayu.general.activity.ManageListActivity" /> - <activity android:name="com.dayu.general.activity.SearchUserListActivity"/> - <activity android:name="com.dayu.general.activity.NfcWreatActivity" + <activity android:name="com.dayu.general.activity.SearchUserListActivity" /> + <activity + android:name="com.dayu.general.activity.NfcWreatActivity" android:exported="false" - android:launchMode="singleTop" - > + android:launchMode="singleTop"> <intent-filter> <action android:name="android.nfc.action.ACTION_NDEF_DISCOVERED" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="text/plain" /> </intent-filter> </activity> - <activity android:name=".activity.MainActivity"/> + <activity android:name=".activity.MainActivity" /> <activity android:name=".activity.ManagerReadActivity" android:exported="false" @@ -71,8 +71,17 @@ <data android:mimeType="text/plain" /> </intent-filter> </activity> - <activity android:name=".activity.SearchCardListActivity"/> - + <activity android:name=".activity.SearchCardListActivity" /> + <activity + android:name=".activity.NewCard2Activity" + android:exported="false" + android:launchMode="singleTop"> + <intent-filter> + <action android:name="android.nfc.action.ACTION_NDEF_DISCOVERED" /> + <category android:name="android.intent.category.DEFAULT" /> + <data android:mimeType="text/plain" /> + </intent-filter> + </activity> <meta-data diff --git a/generallibrary/src/main/java/com/dayu/general/activity/NewCard2Activity.kt b/generallibrary/src/main/java/com/dayu/general/activity/NewCard2Activity.kt new file mode 100644 index 0000000..9ab0d3d --- /dev/null +++ b/generallibrary/src/main/java/com/dayu/general/activity/NewCard2Activity.kt @@ -0,0 +1,224 @@ +package com.dayu.general.activity + +import android.content.Intent +import android.os.Bundle +import android.text.Editable +import android.text.TextWatcher +import android.view.View +import android.widget.Toast +import com.dayu.baselibrary.net.subscribers.SubscriberListener +import com.dayu.baselibrary.view.TitleBar.ClickType_LEFT_IMAGE +import com.dayu.general.BaseApplication +import com.dayu.general.R +import com.dayu.general.databinding.ActivityNewCard1GeBinding +import com.dayu.general.net.ApiManager +import com.dayu.general.net.BaseResponse +import com.dayu.general.tool.NfcReadHelper + +/** + * Description: 鐢ㄦ埛寮�鍗$晫闈� + * Author: zuo + * Date: 2025/4/7 + */ +class NewCard2Activity : BaseNfcActivity() { + + private lateinit var binding: ActivityNewCard1GeBinding + + // 鏀粯鏂瑰紡 + private var paymentMethod: String = "鐜伴噾" + + // 鍗$墿鐞咺D + private var cardPhysicalId: String = "" + + // 鐢ㄦ埛ID + private var userId: String = "" + + companion object { + private const val TAG = "NewCard2Activity" + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding = ActivityNewCard1GeBinding.inflate(layoutInflater) + setContentView(binding.root) + + initView() + initListener() + } + + + private fun initView() { + // 鍒濆鍖栨爣棰樻爮杩斿洖鎸夐挳 + binding.titleBar.setOnItemclickListner(ClickType_LEFT_IMAGE) { + finish() + } + + // 鍒濆鍖朜FC璇诲崱瀹瑰櫒锛屽垵濮嬮殣钘� + binding.nfcContainer.visibility = View.VISIBLE + + // 浠嶪ntent涓幏鍙栫敤鎴蜂俊鎭紙濡傛灉鏈夛級 + val userName = intent.getStringExtra("userName") ?: "" + val rawIdCard = intent.getStringExtra("idCard") + val idCard = if (rawIdCard.isNullOrBlank()) "鏃�" else rawIdCard + val farmerCode = intent.getStringExtra("farmerCode") ?: "" + userId = intent.getStringExtra("userId") ?: "" + + // 璁剧疆鐢ㄦ埛淇℃伅 + binding.newCardUserName.text = userName + binding.newCardIdCard.text = idCard + binding.newCardFarmerCode.text = farmerCode + + // 璁剧疆閲戦杈撳叆闄愬埗涓轰袱浣嶅皬鏁� + binding.newCardRechargeAmount.addTextChangedListener(createDecimalTextWatcher()) + binding.newCardCardFee.addTextChangedListener(createDecimalTextWatcher()) + } + + /** + * 鍒涘缓闄愬埗杈撳叆涓や綅灏忔暟鐨凾extWatcher + */ + private fun createDecimalTextWatcher(): TextWatcher { + return object : TextWatcher { + override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { + // 涓嶉渶瑕佸疄鐜� + } + + override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { + // 涓嶉渶瑕佸疄鐜� + } + + override fun afterTextChanged(s: Editable?) { + if (s == null || s.isEmpty()) return + + val str = s.toString() + // 濡傛灉杈撳叆鐨勪笉鏄湁鏁堢殑灏忔暟鏍煎紡锛岃繘琛屽鐞� + if (str.contains(".")) { + val decimalIndex = str.indexOf(".") + // 濡傛灉灏忔暟鐐瑰悗瓒呰繃涓や綅锛屾埅鍙栧埌涓や綅 + if (decimalIndex >= 0 && str.length - decimalIndex > 3) { + s.delete(decimalIndex + 3, str.length) + } + } + } + } + } + + private fun initListener() { + // 璁剧疆鏀粯鏂瑰紡閫夋嫨鐩戝惉 + binding.newCardPaymentMethod.setOnCheckedChangeListener { group, checkedId -> + paymentMethod = when (checkedId) { + R.id.newCard_cashPayment -> "鐜伴噾" + R.id.newCard_posPayment -> "POS鏈�" + R.id.newCard_bankTransfer -> "閾惰杞处" + else -> "鐜伴噾" + } + } + + // 璁剧疆寮�鍗℃寜閽偣鍑荤洃鍚� + binding.newCardRegistBtn.setOnClickListener { + if (cardPhysicalId.isEmpty()) { + // 濡傛灉灏氭湭璇诲彇鍒板崱鐗╃悊ID锛屾樉绀篘FC璇诲崱鐣岄潰 + binding.nfcContainer.visibility = View.VISIBLE + } else { + // 宸茶鍙栧埌鍗$墿鐞咺D锛岃繘琛屽紑鍗℃搷浣� + registerNewCard() + } + } + } + + private fun registerNewCard() { + // 鑾峰彇鍏呭�奸噾棰� + val rechargeAmountStr = binding.newCardRechargeAmount.text.toString() + val rechargeAmount = if (rechargeAmountStr.isEmpty()) 0.0 else rechargeAmountStr.toDouble() + + // 鑾峰彇宸ユ湰璐� + val cardFeeStr = binding.newCardCardFee.text.toString() + val cardFee = if (cardFeeStr.isEmpty()) 0.0 else cardFeeStr.toDouble() + + // 鏍煎紡鍖栭噾棰濅负涓や綅灏忔暟 + val formattedRechargeAmount = String.format("%.2f", rechargeAmount) + val formattedCardFee = String.format("%.2f", cardFee) + + // 鑾峰彇鏀粯鏂瑰紡ID + val paymentId = when (paymentMethod) { + "鐜伴噾" -> 1 + "POS鏈�" -> 2 + "閾惰杞处" -> 3 + else -> 1 + } + + val remark = binding.newCardRemark.text.toString() + + // 鏋勫缓璇锋眰鍙傛暟 + val params = HashMap<String, Any>() + params["cardAddr"] = cardPhysicalId // 姘村崱鍦板潃锛堢墿鐞咺D锛� + params["clientNum"] = binding.newCardFarmerCode.text.toString() // 鍐滄埛缂栧彿 + params["cardCost"] = (cardFee * 100).toInt() // 璐崱閲戦锛堝伐鏈垂锛夎浆涓哄垎 + params["amount"] = (rechargeAmount * 100).toInt() // 鍏呭�奸噾棰濊浆涓哄垎 + params["paymentId"] = paymentId // 鏀粯鏂瑰紡 + params["remarks"] = remark // 澶囨敞 + params["operator"] = BaseApplication.userId // 鎿嶄綔浜篒D + + // 鎵ц鍗$墖婵�娲籄PI璇锋眰 + ApiManager.getInstance().requestPostLoading( + this, + "sell/card/active", + String::class.java, + params, + object : SubscriberListener<BaseResponse<String>>() { + override fun onNext(response: BaseResponse<String>) { + if (response.success) { + // 婵�娲绘垚鍔� + Toast.makeText(this@NewCard2Activity, "寮�鍗℃垚鍔�", Toast.LENGTH_SHORT).show() + setResult(RESULT_OK) + finish() + } else { + // 婵�娲诲け璐� + Toast.makeText( + this@NewCard2Activity, + "寮�鍗″け璐�: ${response.msg}", + Toast.LENGTH_SHORT + ).show() + } + } + + override fun onError(e: Throwable?) { + super.onError(e) + // 璇锋眰寮傚父 + Toast.makeText( + this@NewCard2Activity, + "寮�鍗″け璐�: ${e?.message ?: "缃戠粶寮傚父"}", + Toast.LENGTH_SHORT + ).show() + } + } + ) + } + + override fun onResume() { + super.onResume() + // 寮�鍚墠鍙拌皟搴︾郴缁燂紝浼樺厛澶勭悊NFC鏍囩 + + } + + override fun onPause() { + super.onPause() + // 鍏抽棴鍓嶅彴璋冨害绯荤粺 + + } + + override fun onNfcBack(intent: Intent) { + var cardNumber = NfcReadHelper.getInstance(intent, this).getCardNumber() + if (!cardNumber.isEmpty()) { + // 淇濆瓨鍗$墿鐞咺D + cardPhysicalId = cardNumber + // 鏇存柊UI + binding.newCardArerNumber.text = cardNumber + // 闅愯棌NFC璇诲崱鐣岄潰 + binding.nfcContainer.visibility = View.GONE + + Toast.makeText(this, "璇诲崱鎴愬姛", Toast.LENGTH_SHORT).show() + } + } + + +} \ No newline at end of file diff --git a/generallibrary/src/main/java/com/dayu/general/activity/SearchUserListActivity.kt b/generallibrary/src/main/java/com/dayu/general/activity/SearchUserListActivity.kt index 5e11d51..9f9311c 100644 --- a/generallibrary/src/main/java/com/dayu/general/activity/SearchUserListActivity.kt +++ b/generallibrary/src/main/java/com/dayu/general/activity/SearchUserListActivity.kt @@ -1,5 +1,6 @@ package com.dayu.general.activity +import android.content.Intent import android.os.Bundle import androidx.recyclerview.widget.LinearLayoutManager import com.dayu.baselibrary.net.subscribers.SubscriberListener @@ -25,12 +26,12 @@ var binding: ActivitySearchUserGeBinding? = null private var userAdapter: SearchUserListAdapter? = null var searchDialog: SearchDialog? = null - + // 鍒嗛〉鐩稿叧鍙橀噺 private var currentPage = 1 private val pageSize = 20 private var hasMoreData = true - + // 淇濆瓨褰撳墠鎼滅储鏉′欢 private var currentFarmerId = "" private var currentFarmerName = "" @@ -57,11 +58,11 @@ currentFarmerId = farmerId currentFarmerName = farmerName currentCardNumber = cardNumber - + // 閲嶇疆鍒嗛〉鐘舵�� currentPage = 1 hasMoreData = true - + // 鎵ц鎼滅储 searchUser(farmerId, farmerName, cardNumber, true) } @@ -79,20 +80,22 @@ layoutManager = LinearLayoutManager(this@SearchUserListActivity) adapter = userAdapter } - + // 璁剧疆鍒楄〃椤圭偣鍑讳簨浠� userAdapter?.setOnItemClickListener { user -> // 澶勭悊鐢ㄦ埛鐐瑰嚮浜嬩欢 - ToastUtil.show("宸查�夋嫨鐢ㄦ埛锛�${user.name}") - // 杩欓噷鍙互娣诲姞璺宠浆鍒扮敤鎴疯鎯呴〉闈㈢殑閫昏緫 - // val intent = Intent(this, UserDetailActivity::class.java) - // intent.putExtra("userId", user.id) - // startActivity(intent) + // 浼犻�掔敤鎴蜂俊鎭埌寮�鍗$晫闈� + val intent = Intent(this, NewCard2Activity::class.java) + intent.putExtra("userName", user.name) + intent.putExtra("idCard", user.idCard) + intent.putExtra("farmerCode", user.clientNum) + intent.putExtra("userId", user.id) + startActivity(intent) } } - + private fun setupRefreshLayout() { binding?.refreshLayout?.apply { // 璁剧疆鍒锋柊鍜屽姞杞芥洿澶氱洃鍚櫒 @@ -103,7 +106,7 @@ hasMoreData = true searchUser(currentFarmerId, currentFarmerName, currentCardNumber, true) } - + override fun onLoadMore(refreshLayout: RefreshLayout) { // 濡傛灉杩樻湁鏇村鏁版嵁锛屽姞杞戒笅涓�椤� if (hasMoreData) { @@ -130,7 +133,12 @@ * @param cardNumber 閾惰鍗″彿 * @param isRefresh 鏄惁涓哄埛鏂版搷浣� */ - private fun searchUser(farmerId: String, farmerName: String, cardNumber: String, isRefresh: Boolean = true) { + private fun searchUser( + farmerId: String, + farmerName: String, + cardNumber: String, + isRefresh: Boolean = true + ) { val map = mutableMapOf<String, Any>() if (farmerId.isNotEmpty()) { @@ -144,7 +152,7 @@ if (cardNumber.isNotEmpty()) { map["cardNum"] = cardNumber } - + // 娣诲姞鍒嗛〉鍙傛暟 map["pageCurr"] = currentPage map["pageSize"] = pageSize @@ -159,7 +167,7 @@ override fun onNext(t: BaseResponse<SearchUserResult>) { // 瀹屾垚鍒锋柊鎴栧姞杞藉姩浣� finishRefreshOrLoad(isRefresh) - + if (t.success) { // 澶勭悊鎼滅储鎴愬姛鐨勬儏鍐� val result = t.content @@ -172,7 +180,7 @@ } else { userAdapter?.addData(result.obj) } - + // 鍒ゆ柇鏄惁杩樻湁鏇村鏁版嵁锛氭牴鎹綋鍓嶉〉鐮佸拰鎬婚〉鏁板垽鏂� hasMoreData = currentPage < result.pageTotal } else { @@ -205,7 +213,7 @@ } ) } - + /** * 瀹屾垚鍒锋柊鎴栧姞杞芥搷浣� * @param isRefresh 鏄惁涓哄埛鏂版搷浣� diff --git a/generallibrary/src/main/java/com/dayu/general/bean/net/SearchUserResult.kt b/generallibrary/src/main/java/com/dayu/general/bean/net/SearchUserResult.kt index cce0c19..a3ba94c 100644 --- a/generallibrary/src/main/java/com/dayu/general/bean/net/SearchUserResult.kt +++ b/generallibrary/src/main/java/com/dayu/general/bean/net/SearchUserResult.kt @@ -1,5 +1,7 @@ package com.dayu.general.bean.net +import android.os.Parcelable + /** * Description: 鎼滅储鐢ㄦ埛缁撴灉Bean * Author: zuo @@ -15,7 +17,7 @@ /** * 鐢ㄦ埛淇℃伅 */ - data class UserInfo( + data class UserInfo ( val address: String? = null, // 鍦板潃 val cardCount: Int? = null, // 鍗℃暟閲� val clientNum: String? = null, // 瀹㈡埛缂栧彿 diff --git a/generallibrary/src/main/res/drawable/radio_checked.xml b/generallibrary/src/main/res/drawable/radio_checked.xml new file mode 100644 index 0000000..ea97fb1 --- /dev/null +++ b/generallibrary/src/main/res/drawable/radio_checked.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item> + <shape android:shape="rectangle"> + <solid android:color="#E6F2FF" /> + <corners android:radius="4dp" /> + <stroke android:color="#4285F4" android:width="1dp" /> + </shape> + </item> + + +</layer-list> \ No newline at end of file diff --git a/generallibrary/src/main/res/drawable/radio_selector.xml b/generallibrary/src/main/res/drawable/radio_selector.xml new file mode 100644 index 0000000..5ae176e --- /dev/null +++ b/generallibrary/src/main/res/drawable/radio_selector.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="@drawable/radio_checked" android:state_checked="true" /> + <item android:drawable="@drawable/radio_unchecked" android:state_checked="false" /> +</selector> \ No newline at end of file diff --git a/generallibrary/src/main/res/drawable/radio_unchecked.xml b/generallibrary/src/main/res/drawable/radio_unchecked.xml new file mode 100644 index 0000000..0999e13 --- /dev/null +++ b/generallibrary/src/main/res/drawable/radio_unchecked.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <solid android:color="#FFFFFF" /> + <corners android:radius="4dp" /> + <stroke android:color="#DDDDDD" android:width="1dp" /> +</shape> \ No newline at end of file diff --git a/generallibrary/src/main/res/layout/activity_card_list.xml b/generallibrary/src/main/res/layout/activity_card_list.xml index cea652a..674de9e 100644 --- a/generallibrary/src/main/res/layout/activity_card_list.xml +++ b/generallibrary/src/main/res/layout/activity_card_list.xml @@ -39,6 +39,7 @@ android:paddingTop="8dp" android:paddingBottom="8dp" android:clipToPadding="false" + android:background="@color/base_list_bg" android:overScrollMode="never" /> <com.scwang.smart.refresh.footer.ClassicsFooter diff --git a/generallibrary/src/main/res/layout/activity_new_card_1_ge.xml b/generallibrary/src/main/res/layout/activity_new_card_1_ge.xml index 86e7d76..0fdbd92 100644 --- a/generallibrary/src/main/res/layout/activity_new_card_1_ge.xml +++ b/generallibrary/src/main/res/layout/activity_new_card_1_ge.xml @@ -1,9 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout 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" - xmlns:app="http://schemas.android.com/apk/res-auto"> + android:background="#F5F7FA"> + <com.dayu.baselibrary.view.TitleBar android:id="@+id/titleBar" android:layout_width="match_parent" @@ -14,7 +16,6 @@ app:leftImage="@mipmap/icon_back" tools:ignore="MissingConstraints" /> - <androidx.cardview.widget.CardView android:id="@+id/nfcContainer" android:layout_width="match_parent" @@ -23,6 +24,7 @@ android:layout_marginTop="24dp" android:layout_marginEnd="16dp" android:layout_marginBottom="24dp" + android:visibility="gone" app:cardBackgroundColor="@android:color/white" app:cardCornerRadius="12dp" app:cardElevation="4dp" @@ -43,8 +45,17 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" - android:text="璇峰皢鏂板崱璐村湪璁惧涓婅繘琛屽啓鍗�" + android:text="璇峰皢鏂板崱璐村湪璁惧涓婅繘琛岃鍗�" android:textColor="#333333" + android:textSize="18sp" + android:textStyle="bold" /> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center" + android:text="锛堝皢鑾峰彇鐗╃悊鍗″崱鍙凤級" + android:textColor="#999999" android:textSize="18sp" android:textStyle="bold" /> @@ -61,12 +72,352 @@ android:layout_height="wrap_content" android:layout_marginTop="16dp" android:gravity="center" - android:text="璇蜂繚鎸佹墜鏈哄拰鍗$墖涓嶈绉诲姩" + android:text="璇蜂繚鎸佹墜鎸佹満鍜屽崱鐗囦笉瑕佺Щ鍔�" android:textColor="#666666" android:textSize="14sp" /> </LinearLayout> </androidx.cardview.widget.CardView> + <ScrollView + android:layout_width="match_parent" + android:layout_height="0dp" + android:fillViewport="true" + android:scrollbars="none" + android:visibility="gone" + app:layout_constraintBottom_toTopOf="@+id/newCard_registBtn" + app:layout_constraintTop_toBottomOf="@+id/titleBar"> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="16dp"> + + <androidx.cardview.widget.CardView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="16dp" + app:cardCornerRadius="8dp" + app:cardElevation="2dp"> + + <LinearLayout + android:id="@+id/center_data" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="16dp"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="16dp" + android:text="鍩烘湰淇℃伅" + android:textColor="#333333" + android:textSize="18sp" + android:textStyle="bold" /> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="12dp" + android:gravity="center_vertical" + android:orientation="horizontal"> + + <TextView + android:layout_width="120dp" + android:layout_height="wrap_content" + android:text="鍗″彿锛�" + android:textColor="#666666" + android:textSize="@dimen/new_card_size" /> + + <TextView + android:id="@+id/newCard_arerNumber" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:textColor="#333333" + android:textSize="@dimen/new_card_size" /> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="12dp" + android:gravity="center_vertical" + android:orientation="horizontal"> + + <TextView + android:layout_width="120dp" + android:layout_height="wrap_content" + android:text="濮撳悕锛�" + android:textColor="#666666" + android:textSize="@dimen/new_card_size" /> + + <TextView + android:id="@+id/newCard_userName" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:textColor="#333333" + android:textSize="@dimen/new_card_size" /> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="12dp" + android:gravity="center_vertical" + android:orientation="horizontal"> + + <TextView + android:layout_width="120dp" + android:layout_height="wrap_content" + android:text="韬唤璇佸彿锛�" + android:textColor="#666666" + android:textSize="@dimen/new_card_size" /> + + <TextView + android:id="@+id/newCard_idCard" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:textColor="#333333" + android:textSize="@dimen/new_card_size" /> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="12dp" + android:gravity="center_vertical" + android:orientation="horizontal"> + + <TextView + android:layout_width="120dp" + android:layout_height="wrap_content" + android:text="鍐滄埛缂栧彿锛�" + android:textColor="#666666" + android:textSize="@dimen/new_card_size" /> + + <TextView + android:id="@+id/newCard_farmerCode" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:textColor="#333333" + android:textSize="@dimen/new_card_size" /> + </LinearLayout> + </LinearLayout> + </androidx.cardview.widget.CardView> + + <androidx.cardview.widget.CardView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="16dp" + app:cardCornerRadius="8dp" + app:cardElevation="2dp"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="16dp"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="16dp" + android:text="璐圭敤淇℃伅" + android:textColor="#333333" + android:textSize="18sp" + android:textStyle="bold" /> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="12dp" + android:gravity="center_vertical" + android:orientation="horizontal"> + + <TextView + android:layout_width="120dp" + android:layout_height="wrap_content" + android:text="宸ユ湰璐癸細" + android:textColor="#666666" + android:textSize="@dimen/new_card_size" /> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="#FFFFFF" + android:orientation="vertical"> + + <EditText + android:id="@+id/newCard_rechargeAmount" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@null" + android:hint="璇疯緭鍏ュ伐鏈垂(閫夊~)" + android:inputType="numberDecimal" + android:padding="12dp" + android:textColor="#333333" + android:textSize="@dimen/new_card_size" /> + </LinearLayout> + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="12dp" + android:gravity="center_vertical" + android:orientation="horizontal"> + + <TextView + android:layout_width="120dp" + android:layout_height="wrap_content" + android:text="鍏呭�奸噾棰濓細" + android:textColor="#666666" + android:textSize="@dimen/new_card_size" /> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="#FFFFFF" + android:orientation="vertical"> + + <EditText + android:id="@+id/newCard_cardFee" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@null" + android:hint="璇疯緭鍏ュ厖鍊奸噾棰�(閫夊~)" + android:inputType="numberDecimal" + android:padding="12dp" + android:textColor="#333333" + android:textSize="@dimen/new_card_size" /> + </LinearLayout> + </LinearLayout> + + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="12dp" + android:gravity="center_vertical" + android:orientation="horizontal"> + + <TextView + android:layout_width="120dp" + android:layout_height="wrap_content" + android:text="澶囨敞锛�" + android:textColor="#666666" + android:textSize="@dimen/new_card_size" /> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="#FFFFFF" + android:orientation="vertical"> + + <EditText + android:id="@+id/newCard_remark" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@null" + android:hint="璇疯緭鍏ュ娉�(閫夊~)" + android:padding="12dp" + android:textColor="#333333" + android:textSize="@dimen/new_card_size" /> + </LinearLayout> + </LinearLayout> + </LinearLayout> + </androidx.cardview.widget.CardView> + + <androidx.cardview.widget.CardView + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:cardCornerRadius="8dp" + app:cardElevation="2dp"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="16dp"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="16dp" + android:text="鏀粯鏂瑰紡" + android:textColor="#333333" + android:textSize="18sp" + android:textStyle="bold" /> + + <RadioGroup + android:id="@+id/newCard_paymentMethod" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <RadioButton + android:id="@+id/newCard_cashPayment" + android:layout_width="0dp" + android:layout_height="40dp" + android:layout_marginRight="15dp" + android:layout_weight="1" + android:background="@drawable/radio_selector" + android:button="@null" + android:checked="true" + android:gravity="center" + + android:text="鐜伴噾" + android:textColor="@color/radio_button_text_color" + android:textSize="@dimen/new_card_size" /> + + <RadioButton + android:id="@+id/newCard_posPayment" + android:layout_width="0dp" + android:layout_height="40dp" + android:layout_marginRight="15dp" + android:layout_weight="1" + android:background="@drawable/radio_selector" + android:button="@null" + android:gravity="center" + + android:text="POS鏈�" + android:textColor="@color/radio_button_text_color" + android:textSize="@dimen/new_card_size" /> + + <RadioButton + android:id="@+id/newCard_bankTransfer" + android:layout_width="0dp" + android:layout_height="40dp" + android:layout_weight="1" + android:background="@drawable/radio_selector" + android:button="@null" + android:gravity="center" + + android:text="閾惰杞处" + android:textColor="@color/radio_button_text_color" + android:textSize="@dimen/new_card_size" /> + </RadioGroup> + </LinearLayout> + </androidx.cardview.widget.CardView> + </LinearLayout> + </ScrollView> + + <TextView + android:id="@+id/newCard_registBtn" + android:layout_width="match_parent" + android:layout_height="56dp" + android:layout_margin="16dp" + android:background="#4285F4" + android:visibility="gone" + android:gravity="center" + android:text="纭寮�鍗�" + android:textColor="#FFFFFF" + android:textSize="16sp" + app:layout_constraintBottom_toBottomOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/generallibrary/src/main/res/layout/dialog_search_card_ge.xml b/generallibrary/src/main/res/layout/dialog_search_card_ge.xml new file mode 100644 index 0000000..840da8d --- /dev/null +++ b/generallibrary/src/main/res/layout/dialog_search_card_ge.xml @@ -0,0 +1,142 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@drawable/search_dialog_bg" + android:padding="20dp"> + + <TextView + android:id="@+id/tv_title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="鍗$墖鎼滅储" + android:textColor="@color/black" + android:textSize="20sp" + android:textStyle="bold" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <View + android:id="@+id/divider" + android:layout_width="match_parent" + android:layout_height="1dp" + android:layout_marginTop="12dp" + android:background="#E0E0E0" + app:layout_constraintTop_toBottomOf="@id/tv_title" /> + + <TextView + android:id="@+id/tv_card_number_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="16dp" + android:text="鍗″彿" + android:textColor="#666666" + android:textSize="14sp" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toBottomOf="@id/divider" /> + + <EditText + android:id="@+id/et_card_number" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="6dp" + android:background="@drawable/edit_text_bg" + android:hint="璇疯緭鍏ュ崱鍙�" + android:inputType="text" + android:singleLine="true" + android:textColorHint="#BBBBBB" + android:textSize="15sp" + app:layout_constraintTop_toBottomOf="@id/tv_card_number_label" /> + + <TextView + android:id="@+id/tv_client_number_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="14dp" + android:text="瀹㈡埛缂栧彿" + android:textColor="#666666" + android:textSize="14sp" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toBottomOf="@id/et_card_number" /> + + <EditText + android:id="@+id/et_client_number" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="6dp" + android:background="@drawable/edit_text_bg" + android:hint="璇疯緭鍏ュ鎴风紪鍙�" + android:inputType="text" + android:singleLine="true" + android:textColorHint="#BBBBBB" + android:textSize="15sp" + app:layout_constraintTop_toBottomOf="@id/tv_client_number_label" /> + + <TextView + android:id="@+id/tv_client_name_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="14dp" + android:text="瀹㈡埛濮撳悕" + android:textColor="#666666" + android:textSize="14sp" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintTop_toBottomOf="@id/et_client_number" /> + + <EditText + android:id="@+id/et_client_name" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="6dp" + android:background="@drawable/edit_text_bg" + android:hint="璇疯緭鍏ュ鎴峰鍚�" + android:inputType="text" + android:singleLine="true" + android:textColorHint="#BBBBBB" + android:textSize="15sp" + app:layout_constraintTop_toBottomOf="@id/tv_client_name_label" /> + + <Button + android:id="@+id/tv_cancel" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginTop="24dp" + android:layout_marginEnd="6dp" + android:background="@drawable/cancel_button_ripple" + android:clickable="true" + android:focusable="true" + android:paddingTop="10dp" + android:paddingBottom="10dp" + android:stateListAnimator="@null" + android:text="鍙栨秷" + android:textColor="#666666" + android:textSize="15sp" + app:layout_constraintEnd_toStartOf="@id/btn_search" + app:layout_constraintHorizontal_chainStyle="packed" + app:layout_constraintHorizontal_weight="1" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/et_client_name" /> + + <Button + android:id="@+id/btn_search" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="6dp" + android:background="@drawable/search_button_ripple" + android:clickable="true" + android:elevation="2dp" + android:focusable="true" + android:paddingTop="12dp" + android:paddingBottom="12dp" + android:stateListAnimator="@null" + android:text="鎼滅储" + android:textColor="@android:color/white" + android:textSize="16sp" + android:textStyle="bold" + app:layout_constraintBaseline_toBaselineOf="@id/tv_cancel" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_weight="1" + app:layout_constraintStart_toEndOf="@id/tv_cancel" /> + +</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file diff --git a/generallibrary/src/main/res/values/colors.xml b/generallibrary/src/main/res/values/colors.xml index b812742..b34be43 100644 --- a/generallibrary/src/main/res/values/colors.xml +++ b/generallibrary/src/main/res/values/colors.xml @@ -6,5 +6,7 @@ <color name="nav_item_color">#555555</color> <color name="base_list_bg">#e6e6e6</color> <color name="green">#32CD32</color> - + <color name="blue">#007BFF</color> + <color name="grey">#808080</color> + <color name="light_grey">#E0E0E0</color> </resources> \ No newline at end of file -- Gitblit v1.8.0