baselibrary/src/main/res/drawable/bukou.xml
New file @@ -0,0 +1,9 @@ <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:pathData="M18,9l-1.41,-1.42L10,14.17l-2.59,-2.58L6,13l4,4zM19,3h-4.18C14.4,1.84 13.3,1 12,1c-1.3,0 -2.4,0.84 -2.82,2L5,3c-0.14,0 -0.27,0.01 -0.4,0.04 -0.39,0.08 -0.74,0.28 -1.01,0.55 -0.18,0.18 -0.33,0.4 -0.43,0.64 -0.1,0.23 -0.16,0.49 -0.16,0.77v14c0,0.27 0.06,0.54 0.16,0.78s0.25,0.45 0.43,0.64c0.27,0.27 0.62,0.47 1.01,0.55 0.13,0.02 0.26,0.03 0.4,0.03h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM12,2.75c0.41,0 0.75,0.34 0.75,0.75s-0.34,0.75 -0.75,0.75 -0.75,-0.34 -0.75,-0.75 0.34,-0.75 0.75,-0.75zM19,19L5,19L5,5h14v14z" android:fillColor="#009ad6"/> </vector> baselibrary/src/main/res/drawable/chongzheng.xml
New file @@ -0,0 +1,9 @@ <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:pathData="M11,15h2v2h-2zM11,7h2v6h-2zM19,3h-4.18C14.4,1.84 13.3,1 12,1c-1.3,0 -2.4,0.84 -2.82,2L5,3c-0.14,0 -0.27,0.01 -0.4,0.04 -0.39,0.08 -0.74,0.28 -1.01,0.55 -0.18,0.18 -0.33,0.4 -0.43,0.64 -0.1,0.23 -0.16,0.49 -0.16,0.77v14c0,0.27 0.06,0.54 0.16,0.78s0.25,0.45 0.43,0.64c0.27,0.27 0.62,0.47 1.01,0.55 0.13,0.02 0.26,0.03 0.4,0.03h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM12,2.75c0.41,0 0.75,0.34 0.75,0.75s-0.34,0.75 -0.75,0.75 -0.75,-0.34 -0.75,-0.75 0.34,-0.75 0.75,-0.75zM19,19L5,19L5,5h14v14z" android:fillColor="#009ad6"/> </vector> baselibrary/src/main/res/drawable/fanxie.xml
New file @@ -0,0 +1,9 @@ <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:pathData="M12,2C6.5,2 2,6.5 2,12s4.5,10 10,10 10,-4.5 10,-10S17.5,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM7,15h10v2L7,17zM10.3,11.2L8.4,9.3 7,10.7l3.3,3.3L17,7.3l-1.4,-1.4z" android:fillColor="#009ad6"/> </vector> generallibrary/build.gradle
@@ -13,6 +13,13 @@ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" // 添加Room数据库的导出schema选项 javaCompileOptions { annotationProcessorOptions { arguments += ["room.schemaLocation": "$projectDir/schemas".toString()] } } } buildTypes { @@ -56,11 +63,10 @@ compileOnly project(':pickerviewlibrary') //数据库 implementation "androidx.room:room-runtime:2.3.0" implementation "androidx.room:room-ktx:2.3.0" runtimeOnly("androidx.room:room-common:2.3.0") kapt "androidx.room:room-compiler:2.3.0" //数据库 - 更新版本以更好支持协程 implementation "androidx.room:room-runtime:2.6.1" implementation "androidx.room:room-ktx:2.6.1" kapt "androidx.room:room-compiler:2.6.1" //权限申请 compileOnly 'com.github.getActivity:XXPermissions:18.5' generallibrary/src/main/AndroidManifest.xml
@@ -39,14 +39,6 @@ android:supportsRtl="true" android:theme="@style/AppTheme"> <!-- <activity--> <!-- android:name="com.dayu.recharge.activity.LoginActivity"--> <!-- android:exported="true">--> <!-- <intent-filter>--> <!-- <action android:name="android.intent.action.MAIN" />--> <!-- <category android:name="android.intent.category.LAUNCHER" />--> <!-- </intent-filter>--> <!-- </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" /> @@ -60,7 +52,17 @@ <data android:mimeType="text/plain" /> </intent-filter> </activity> <activity android:name=".activity.MainActivity" /> <activity android:name=".activity.MainActivity" android:launchMode="singleTop" android:windowSoftInputMode="adjustPan"> <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.ManagerReadActivity" android:exported="false" @@ -83,6 +85,9 @@ </intent-filter> </activity> <!-- 新增补卡Activity --> <activity android:name=".activity.CardReplaceActivity" /> <meta-data android:name="BUGLY_APP_VERSION" generallibrary/src/main/java/com/dayu/general/activity/CardReplaceActivity.kt
New file @@ -0,0 +1,173 @@ package com.dayu.general.activity import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.inputmethod.EditorInfo import androidx.recyclerview.widget.LinearLayoutManager import com.dayu.baselibrary.net.subscribers.SubscriberListener import com.dayu.baselibrary.utils.ToastUtil import com.dayu.general.adapter.CardReplaceAdapter import com.dayu.general.bean.net.CardReplaceInfo import com.dayu.general.bean.net.CardReplaceResponse import com.dayu.general.databinding.ActivityCardReplaceBinding import com.dayu.general.net.ApiManager import com.dayu.general.net.BaseResponse import com.scwang.smart.refresh.layout.api.RefreshLayout import com.scwang.smart.refresh.layout.listener.OnRefreshLoadMoreListener /** * 卡片补办Activity */ class CardReplaceActivity : BaseActivity() { private lateinit var binding: ActivityCardReplaceBinding private var currentCardInfo: CardReplaceInfo? = null private lateinit var adapter: CardReplaceAdapter // 分页参数 private var pageCurr: Int = 1 private val pageSize: Int = 20 private var hasMoreData: Boolean = true override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityCardReplaceBinding.inflate(LayoutInflater.from(this)) setContentView(binding.root) initView() initRecyclerView() setupRefreshLayout() loadCardReplaceList(true) } /** * 初始化视图 */ private fun initView() { // 初始化标题栏 binding.titleBar.setOnItemclickListner(com.dayu.baselibrary.view.TitleBar.ClickType_LEFT_IMAGE) { finish() } } /** * 初始化RecyclerView */ private fun initRecyclerView() { // 创建适配器 adapter = CardReplaceAdapter(this) // 设置布局管理器和适配器 binding.recyclerView.apply { layoutManager = LinearLayoutManager(this@CardReplaceActivity) adapter = this@CardReplaceActivity.adapter } // 设置卡片点击监听器 - 点击列表项时执行补办操作 adapter.setOnItemClickListener { cardInfo -> currentCardInfo = cardInfo // 直接执行补办操作 performCardReplace(cardInfo) } } /** * 设置刷新布局 */ private fun setupRefreshLayout() { binding.refreshLayout.setOnRefreshLoadMoreListener(object : OnRefreshLoadMoreListener { override fun onRefresh(refreshLayout: RefreshLayout) { // 下拉刷新,重置页码并重新加载数据 pageCurr = 1 hasMoreData = true loadCardReplaceList(true) } override fun onLoadMore(refreshLayout: RefreshLayout) { // 上拉加载更多 if (hasMoreData) { pageCurr++ loadCardReplaceList(false) } else { // 没有更多数据时,结束加载更多 refreshLayout.finishLoadMoreWithNoMoreData() } } }) } /** * 加载可补办卡片列表 * * @param isRefresh 是否为刷新操作(true: 刷新,false: 加载更多) */ private fun loadCardReplaceList(isRefresh: Boolean = true) { // 构建查询参数 val params = HashMap<String, Any>().apply { put("pageCurr", pageCurr) put("pageSize", pageSize) } // 调用API查询挂失卡片信息 ApiManager.getInstance().requestGetLoading( this, "sell/clientcard/getUnreplaced", CardReplaceResponse::class.java, params, object : SubscriberListener<BaseResponse<CardReplaceResponse>>() { override fun onNext(response: BaseResponse<CardReplaceResponse>) { // 结束刷新或加载更多状态 finishRefreshOrLoadMore(isRefresh) if (response.success) { val cardResponse = response.content val cardList = cardResponse?.obj ?: emptyList() // 更新数据列表 if (isRefresh) { adapter.setData(cardList) } else { adapter.addData(cardList) } // 判断是否还有更多数据 hasMoreData = cardList.size >= pageSize if (!hasMoreData && !isRefresh) { binding.refreshLayout.finishLoadMoreWithNoMoreData() } } else { ToastUtil.show(response.msg) } } override fun onError(e: Throwable?) { // 结束刷新或加载更多状态 finishRefreshOrLoadMore(isRefresh) ToastUtil.show("查询失败: ${e?.message ?: "未知错误"}") } } ) } /** * 结束刷新或加载更多状态 */ private fun finishRefreshOrLoadMore(isRefresh: Boolean) { if (isRefresh) { binding.refreshLayout.finishRefresh() } else { binding.refreshLayout.finishLoadMore() } } /** * 执行卡片补办操作 */ private fun performCardReplace(cardInfo: CardReplaceInfo) { // 这里实现卡片补办的业务逻辑 ToastUtil.show("选择了卡片进行补办:${cardInfo.cardNum}") // TODO: 调用补办卡片API } } generallibrary/src/main/java/com/dayu/general/activity/MainActivity.kt
@@ -1,5 +1,6 @@ package com.dayu.general.activity import android.content.Intent import android.os.Bundle import android.view.KeyEvent import android.view.LayoutInflater @@ -16,7 +17,7 @@ import com.dayu.general.net.ApiManager import com.dayu.general.net.BaseResponse class MainActivity : BaseActivity() { class MainActivity : BaseNfcActivity() { var binding: ActivityMainBinding? = null private val fragments: ArrayList<Fragment> = ArrayList() @@ -30,6 +31,18 @@ initView() initTab() getUserInfo() } override fun onNfcBack(intent: Intent?) { intent?.let { nfcIntent -> // 获取当前显示的Fragment val currentFragment = fragments[binding?.viewPager?.currentItem ?: 0] // 如果当前显示的是充值Fragment,则将NFC信息传递给它处理 if (currentFragment is RechargeFragment) { currentFragment.handleNfcIntent(nfcIntent) } } } @@ -63,8 +76,8 @@ private fun initView() { binding!!.BSCardLL.setOnClickListener { changeBottomState(Tab.BSC) } binding!!.rechargeLL.setOnClickListener { changeBottomState(Tab.RECHARGE) } binding!!.myLL.setOnClickListener { changeBottomState(Tab.MY) } binding!!.rechargeLL.setOnClickListener { changeBottomState(Tab.RECHARGE) } } @@ -153,8 +166,6 @@ } } //点击两次退出程序 有时间间隔 间隔内点击则退出程序 否则 则提示 override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { if (keyCode == KeyEvent.KEYCODE_BACK) { @@ -169,6 +180,4 @@ } return super.onKeyDown(keyCode, event) } } generallibrary/src/main/java/com/dayu/general/activity/MyFragment.kt
@@ -1,5 +1,6 @@ package com.dayu.general.activity import android.content.Intent import android.os.Bundle import android.view.LayoutInflater import android.view.View @@ -22,8 +23,10 @@ ConfirmDialog(requireContext(), "提示", "确定要退出登录吗?") { logout() }.show() } return binding?.root } generallibrary/src/main/java/com/dayu/general/activity/RechargeFragment.kt
@@ -1,14 +1,23 @@ package com.dayu.general.activity import android.content.Intent import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment import com.dayu.baselibrary.net.subscribers.SubscriberListener import com.dayu.baselibrary.tools.nfc.NfcReadAdapter import com.dayu.baselibrary.utils.ToastUtil import com.dayu.general.bean.net.CardInfoResult import com.dayu.general.databinding.FragmentRechargeBinding import com.dayu.general.net.ApiManager import com.dayu.general.net.BaseResponse class RechargeFragment : Fragment() { var binding: FragmentRechargeBinding? = null private var cardNumber: String? = null private var cardInfo: CardInfoResult? = null override fun onCreateView( inflater: LayoutInflater, @@ -16,6 +25,121 @@ savedInstanceState: Bundle? ): View? { binding = FragmentRechargeBinding.inflate(inflater, container, false) return binding?.root; return binding?.root } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) initView() } private fun initView() { // 初始化界面显示读卡状态 binding?.rechargeReadLL?.visibility = View.VISIBLE binding?.rechargeTextLL?.visibility = View.GONE } private fun resetView() { // 重置界面显示读卡状态 binding?.rechargeReadLL?.visibility = View.VISIBLE binding?.rechargeTextLL?.visibility = View.GONE cardInfo = null } /** * 处理NFC刷卡信息 * 该方法由MainActivity调用 */ fun handleNfcIntent(intent: Intent) { activity?.let { activity -> try { // 使用NfcReadAdapter读取卡号 val nfcAdapter = NfcReadAdapter(intent, activity) cardNumber = nfcAdapter.cardNumber if (cardNumber.isNullOrEmpty()) { ToastUtil.show("读卡失败,请重新刷卡") return } // 显示读到的卡号 binding?.redInitCode?.text = cardNumber // 根据卡号获取卡片详细信息 getCardInfo(cardNumber!!) } catch (e: Exception) { ToastUtil.show("读卡异常:${e.message}") e.printStackTrace() } } } /** * 获取卡片详细信息 */ private fun getCardInfo(cardNumber: String) { activity?.let { activity -> ApiManager.getInstance().requestGetLoading( activity, "card/getCardInfo/$cardNumber", // 假设API路径 CardInfoResult::class.java, null, object : SubscriberListener<BaseResponse<CardInfoResult>>() { override fun onNext(t: BaseResponse<CardInfoResult>) { if (t.success) { // 保存卡片信息 cardInfo = t.content // 显示卡片信息 displayCardInfo(t.content) } else { // 处理获取失败的情况 ToastUtil.show(t.msg) binding?.redStatu?.text = "卡状态异常" } } override fun onError(e: Throwable?) { super.onError(e) ToastUtil.show("获取卡信息失败: ${e?.message ?: "未知错误"}") } } ) } } /** * 显示卡片信息 */ private fun displayCardInfo(cardInfo: CardInfoResult?) { if (cardInfo == null) { ToastUtil.show("卡信息为空") return } // 切换到显示信息界面 binding?.rechargeReadLL?.visibility = View.GONE binding?.rechargeTextLL?.visibility = View.VISIBLE // 设置卡片信息 binding?.userName?.text = cardInfo.userName ?: "" binding?.redUserCode?.text = cardInfo.userCode ?: "" binding?.redRemainderBlance?.text = "${cardInfo.balance ?: 0} 元" // 设置卡状态 val cardStatus = when(cardInfo.status) { 1 -> "正常" 2 -> "挂失" 3 -> "锁定" else -> "未知" } binding?.redStatu?.text = cardStatus } } generallibrary/src/main/java/com/dayu/general/adapter/CardReplaceAdapter.kt
New file @@ -0,0 +1,110 @@ package com.dayu.general.adapter import android.content.Context import android.view.LayoutInflater import android.view.ViewGroup import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.RecyclerView import com.dayu.baselibrary.databinding.ItemNoMoreBinding import com.dayu.general.bean.net.CardReplaceInfo import com.dayu.general.databinding.ItemCardReplaceBinding /** * 卡片补办适配器 */ class CardReplaceAdapter(private val context: Context) : BaseRecycleAdapter<RecyclerView.ViewHolder>() { // 卡片补办列表数据 private var cardList: List<CardReplaceInfo> = emptyList() // 点击监听器 - 用于选择要补办的卡片 private var onItemClickListener: ((CardReplaceInfo) -> Unit)? = null /** * 设置新数据(重置) */ fun setData(data: List<CardReplaceInfo>) { cardList = data notifyDataSetChanged() } /** * 添加更多数据(分页加载) */ fun addData(data: List<CardReplaceInfo>) { val oldSize = cardList.size cardList = cardList + data notifyItemRangeInserted(oldSize, data.size) } /** * 设置项点击监听器 - 用于选择卡片进行补办 */ fun setOnItemClickListener(listener: (CardReplaceInfo) -> Unit) { onItemClickListener = listener } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { return if (viewType == VIEW_TYPE_EMPTY) { // 空视图 val emptyView: ItemNoMoreBinding = DataBindingUtil.inflate( (context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater), com.dayu.baselibrary.R.layout.item_no_more, parent, false ) ViewHolderEmpty(emptyView) } else { // 卡片项视图 val binding = ItemCardReplaceBinding.inflate( context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater, parent, false ) CardViewHolder(binding) } } override fun getItemViewType(position: Int): Int { return if (cardList.isEmpty()) { VIEW_TYPE_EMPTY } else { VIEW_TYPE_ITEM } } override fun getItemCount(): Int { return if (cardList.isEmpty()) { 1 // 显示空视图 } else { cardList.size } } override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { if (holder is ViewHolderEmpty) { // 空视图无需绑定数据 return } if (holder is CardViewHolder) { val card = cardList[position] holder.bind(card) // 设置整个项的点击事件,用于选择要补办的卡片 holder.itemView.setOnClickListener { onItemClickListener?.invoke(card) } } } /** * 卡片视图持有者 */ inner class CardViewHolder(val binding: ItemCardReplaceBinding) : RecyclerView.ViewHolder(binding.root) { fun bind(card: CardReplaceInfo) { binding.cardInfo = card binding.executePendingBindings() } } } generallibrary/src/main/java/com/dayu/general/bean/db/CardRegistrationBean.kt
@@ -17,5 +17,6 @@ val orderId: String? = null, // 订单id,初始为null,后续更新 val isReported: Boolean = false, // 是否上报成功 val isCardWritten: Boolean = false, // 是否写卡成功 val operatorId: String = "", // 操作人id val createTime: Long = System.currentTimeMillis() // 创建时间 ) generallibrary/src/main/java/com/dayu/general/bean/db/RechargeRecordBean.kt
New file @@ -0,0 +1,21 @@ package com.dayu.general.bean.db import androidx.room.Entity import androidx.room.PrimaryKey @Entity(tableName = "recharge_record") data class RechargeRecordBean( @PrimaryKey(autoGenerate = true) val id: Long = 0, val cardNumber: String, // 水卡编号 val balance: Double, // 余额 val rechargeAmount: Double, // 充值金额 val bonusAmount: Double, // 赠送金额 val paymentMethod: Int, // 支付方式 val waterPrice: Double, // 水价 val remark: String, // 备注 val operatorId: String, // 操作人id val orderId: String? = null, // 订单id,初始为null,后续更新 val isReported: Boolean = false, // 是否上报成功 val createTime: Long = System.currentTimeMillis() // 创建时间 ) generallibrary/src/main/java/com/dayu/general/bean/net/CardInfoResult.kt
New file @@ -0,0 +1,16 @@ package com.dayu.general.bean.net /** * 卡片信息结果实体类 */ data class CardInfoResult( val cardId: String? = null, // 卡号 val userName: String? = null, // 用户姓名 val userCode: String? = null, // 用户编号 val phone: String? = null, // 手机号 val address: String? = null, // 地址 val balance: Double? = 0.0, // 余额 val status: Int? = 0, // 卡状态: 1-正常, 2-挂失, 3-锁定 val createTime: String? = null, // 创建时间 val updateTime: String? = null // 更新时间 ) generallibrary/src/main/java/com/dayu/general/bean/net/CardReplaceInfo.kt
New file @@ -0,0 +1,28 @@ package com.dayu.general.bean.net /** * 卡片补办信息实体类 * 对应接口返回的卡片补办信息数据 */ data class CardReplaceResponse( val itemTotal: Int = 0, val obj: List<CardReplaceInfo> = emptyList(), val pageCurr: Int = 0, val pageSize: Int = 0, val pageTotal: Int = 0 ) /** * 卡片补办信息 */ data class CardReplaceInfo( val cardNum: String = "", // 卡号 val cardState: Int = 0, // 卡片状态码 val cardType: String = "", // 卡片类型 val clientName: String = "", // 客户姓名 val clientNum: String = "", // 客户编号 val idCard: String = "", // 身份证号 val money: String = "", // 卡内余额 val phone: String = "", // 手机号码 val stateName: String = "" // 卡片状态名称 ) generallibrary/src/main/java/com/dayu/general/dao/AppDataBase.kt
@@ -6,10 +6,12 @@ import com.dayu.general.bean.db.CardRegistrationBean import com.dayu.general.bean.db.PassWordCardBean import com.dayu.general.bean.db.ProjectDataBean import com.dayu.general.bean.db.RechargeRecordBean @Database(entities = [PassWordCardBean::class, CardData::class, ProjectDataBean::class, CardRegistrationBean::class], version = 2, exportSchema = false) @Database(entities = [PassWordCardBean::class, CardData::class, ProjectDataBean::class, CardRegistrationBean::class, RechargeRecordBean::class], version = 4, exportSchema = false) abstract class AppDataBase : RoomDatabase() { abstract fun cardDataDao(): CardDataDao abstract fun projectDataDao(): ProjectDataDao abstract fun cardRegistrationDao(): CardRegistrationDao abstract fun rechargeRecordDao(): RechargeRecordDao } generallibrary/src/main/java/com/dayu/general/dao/BaseDaoSingleton.kt
@@ -3,7 +3,8 @@ import android.content.Context import android.os.Environment import androidx.room.Room import com.dayu.general.activity.BaseActivity import androidx.room.migration.Migration import androidx.sqlite.db.SupportSQLiteDatabase import java.io.File class BaseDaoSingleton { @@ -14,6 +15,15 @@ @JvmField val SqlitePath: String = Environment.getExternalStorageDirectory().absolutePath + File.separator + ".dayu" + File.separator + "data" + File.separator // 数据库迁移策略:从版本3迁移到版本4 private val MIGRATION_3_4 = object : Migration(3, 4) { override fun migrate(database: SupportSQLiteDatabase) { // 这里不需要实际的数据库结构修改,因为我们只是更新了Room版本 // 如果需要修改数据库结构,可以在这里添加 ALTER TABLE 语句 } } fun getInstance(context: Context): AppDataBase { if (baseDao == null) { baseDao = Room.databaseBuilder<AppDataBase>( @@ -24,15 +34,26 @@ } return baseDao as AppDataBase } fun getAsynchInstance(context: Context?): AppDataBase? { fun getAsynchInstance(context: Context): AppDataBase { if (AsynchBaseDao == null) { AsynchBaseDao = Room.databaseBuilder<AppDataBase>( context!!, AppDataBase::class.java, SqlitePath + "ConfigurationData_generalV1" ).build() synchronized(this) { if (AsynchBaseDao == null) { AsynchBaseDao = Room.databaseBuilder( context.applicationContext, AppDataBase::class.java, "GeneralLibrary.db" ) .addMigrations(MIGRATION_3_4) // 添加迁移策略 .build() } } } return AsynchBaseDao return AsynchBaseDao as AppDataBase } // 销毁数据库实例 fun destroyInstance() { AsynchBaseDao = null } } generallibrary/src/main/java/com/dayu/general/dao/RechargeRecordDao.kt
New file @@ -0,0 +1,35 @@ package com.dayu.general.dao import androidx.room.Dao import androidx.room.Insert import androidx.room.OnConflictStrategy import androidx.room.Query import androidx.room.Update import com.dayu.general.bean.db.RechargeRecordBean @Dao interface RechargeRecordDao { @Insert(onConflict = OnConflictStrategy.REPLACE) fun insert(rechargeRecord: RechargeRecordBean) @Insert(onConflict = OnConflictStrategy.REPLACE) fun insertAll(rechargeRecords: List<RechargeRecordBean>) @Update fun update(rechargeRecord: RechargeRecordBean) @Query("SELECT * FROM recharge_record WHERE id = :id") fun findById(id: Long): RechargeRecordBean? @Query("SELECT * FROM recharge_record WHERE cardNumber = :cardNumber ORDER BY createTime DESC") fun findByCardNumber(cardNumber: String): List<RechargeRecordBean> @Query("SELECT * FROM recharge_record WHERE isReported = 0") fun findUnreportedRecords(): List<RechargeRecordBean> @Query("UPDATE recharge_record SET isReported = 1 WHERE id = :id") fun markAsReported(id: Long) @Query("SELECT * FROM recharge_record ORDER BY createTime DESC") fun getAllRecords(): List<RechargeRecordBean> } generallibrary/src/main/java/com/dayu/general/net/ApiManager.kt
@@ -2,6 +2,7 @@ import android.content.Context import android.util.Log import com.dayu.baselibrary.business.BusinessProvider import com.dayu.baselibrary.net.subscribers.ProgressSubscriber import com.dayu.baselibrary.net.subscribers.SubscriberListener import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers @@ -120,13 +121,13 @@ observable .subscribeOn(Schedulers.io()) .map(mapResponse(tClass)) .map(mapResponse(context, tClass)) .unsubscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(mySubscriber) } private fun <T> mapResponse(tClass: Class<T>): Function<Any, BaseResponse<T>> { private fun <T> mapResponse(context: Context, tClass: Class<T>): Function<Any, BaseResponse<T>> { return Function { rawResponse -> when (rawResponse) { is BaseResponse<*> -> { @@ -142,7 +143,7 @@ // 处理token失效的情况 if (temp.code == NetConstans.TOKEN_INVALID) { // 可以在这里添加重定向到登录页面的逻辑 // redirectToLogin() BusinessProvider.getBusinessProvider().startLoginNavigotor.navigateToLogin(context) return@Function response } generallibrary/src/main/res/drawable/bottom_tab_bg.xml
New file @@ -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="@color/bottom_color" /> <corners android:radius="0dp" /> <stroke android:width="0.5dp" android:color="#10000000" /> </shape> generallibrary/src/main/res/drawable/bottom_tab_selected.xml
New file @@ -0,0 +1,14 @@ <?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="@color/bottom_color" /> </shape> </item> <item android:gravity="bottom" android:left="15dp" android:right="15dp"> <shape android:shape="rectangle"> <solid android:color="#4285F4" /> <size android:height="2dp" /> </shape> </item> </layer-list> generallibrary/src/main/res/drawable/bottom_tab_selector.xml
New file @@ -0,0 +1,13 @@ <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"> <shape android:shape="rectangle"> <solid android:color="#20000000" /> </shape> </item> <item android:state_focused="true"> <shape android:shape="rectangle"> <solid android:color="#10000000" /> </shape> </item> </selector> generallibrary/src/main/res/drawable/recharge_button_ripple.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="#40FFFFFF"> <item android:id="@android:id/mask"> <shape android:shape="rectangle"> <solid android:color="#FFFFFF" /> <corners android:radius="8dp" /> </shape> </item> <item android:drawable="@drawable/rounded_button_bg" /> </ripple> generallibrary/src/main/res/drawable/tab_indicator.xml
@@ -3,5 +3,5 @@ android:shape="rectangle"> <solid android:color="#4285F4" /> <corners android:radius="2dp" /> <size android:height="3dp" android:width="20dp" /> <size android:height="3dp" /> </shape> generallibrary/src/main/res/drawable/tab_selector_background.xml
New file @@ -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/bottom_tab_selected" android:state_selected="true" /> <item android:drawable="@drawable/bottom_tab_bg" /> </selector> generallibrary/src/main/res/drawable/text_color_selector.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:color="#4285F4" android:state_selected="true" /> <item android:color="#333333" /> </selector> generallibrary/src/main/res/layout/activity_card_replace.xml
New file @@ -0,0 +1,49 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout 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="match_parent" android:background="@color/white" android:orientation="vertical"> <com.dayu.baselibrary.view.TitleBar android:id="@+id/titleBar" android:layout_width="match_parent" android:layout_height="@dimen/dimen_title_height" app:centerText="补卡" /> <FrameLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"> <com.scwang.smart.refresh.layout.SmartRefreshLayout android:id="@+id/refreshLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/titleBar"> <com.scwang.smart.refresh.header.ClassicsHeader android:layout_width="match_parent" android:layout_height="wrap_content" /> <androidx.recyclerview.widget.RecyclerView android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/base_list_bg" android:overScrollMode="never" android:padding="10dp" /> <com.scwang.smart.refresh.footer.ClassicsFooter android:layout_width="match_parent" android:layout_height="wrap_content" /> </com.scwang.smart.refresh.layout.SmartRefreshLayout> </FrameLayout> </LinearLayout> generallibrary/src/main/res/layout/activity_main.xml
@@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffffff"> @@ -12,115 +13,117 @@ android:layout_height="match_parent" android:layout_above="@id/bottom_navigation" /> <!-- 底部导航阴影 --> <View android:layout_width="match_parent" android:layout_height="3dp" android:layout_above="@id/bottom_navigation" android:background="@drawable/shadow_gradient" /> <LinearLayout android:id="@+id/bottom_navigation" android:layout_width="match_parent" android:layout_height="70dp" android:layout_height="55dp" android:layout_alignParentBottom="true" android:layout_marginTop="-20dp" android:background="#00ffffff" android:background="#FFFFFF" android:elevation="8dp" android:gravity="bottom" android:orientation="horizontal"> <LinearLayout android:id="@+id/BSCardLL" android:layout_width="0dp" android:layout_height="50dp" android:layout_height="match_parent" android:layout_weight="1" android:background="@color/bottom_color" android:background="@drawable/tab_selector_background" android:clickable="true" android:focusable="true" android:foreground="@drawable/bottom_tab_selector" android:gravity="center" android:orientation="vertical"> <RelativeLayout android:layout_width="25dp" android:layout_height="33dp"> <ImageView android:id="@+id/BSCardImg" android:layout_width="wrap_content" android:layout_height="25dp" android:layout_marginTop="8dp" android:src="@drawable/bottom_card_black" /> <ImageView android:id="@+id/BSCardImg" android:layout_width="24dp" android:layout_height="24dp" android:layout_marginTop="6dp" android:src="@drawable/bottom_card_black" /> </RelativeLayout> <TextView android:id="@+id/BSCardText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="2dp" android:layout_marginBottom="3dp" android:text="制卡" android:textColor="@drawable/text_color_selector" android:textSize="12sp" /> </LinearLayout> <FrameLayout <LinearLayout android:id="@+id/rechargeLL" android:layout_width="0dp" android:layout_height="match_parent" android:layout_gravity="center" android:layout_weight="1" android:gravity="bottom" android:background="@drawable/tab_selector_background" android:clickable="true" android:focusable="true" android:foreground="@drawable/bottom_tab_selector" android:gravity="center" android:orientation="vertical"> <View android:layout_width="match_parent" android:layout_height="50dp" android:layout_gravity="bottom" android:background="@color/bottom_color" android:orientation="vertical" /> <ImageView android:id="@+id/rechargeImg" android:layout_width="24dp" android:layout_height="24dp" android:layout_marginTop="6dp" android:src="@drawable/bottom_recharge_white" /> <LinearLayout android:layout_width="80dp" android:layout_height="70dp" android:layout_gravity="center" android:background="@drawable/bottom_circle_bg" android:gravity="center" android:orientation="vertical"> <TextView android:id="@+id/rechargeText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="2dp" android:layout_marginBottom="3dp" android:text="充值" android:textColor="@color/white" android:textSize="12sp" /> <ImageView android:id="@+id/rechargeImg" android:layout_width="40dp" android:layout_height="40dp" android:layout_marginTop="8dp" android:src="@drawable/bottom_recharge_white" /> </LinearLayout> <TextView android:id="@+id/rechargeText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="充值" android:textColor="@color/white" android:textSize="15sp" /> </LinearLayout> </FrameLayout> <LinearLayout android:id="@+id/myLL" android:layout_width="0dp" android:layout_height="50dp" android:layout_height="match_parent" android:layout_weight="1" android:background="@color/bottom_color" android:background="@drawable/tab_selector_background" android:clickable="true" android:focusable="true" android:foreground="@drawable/bottom_tab_selector" android:gravity="center" android:orientation="vertical"> <ImageView android:id="@+id/myImg" android:layout_width="wrap_content" android:layout_height="25dp" android:layout_marginTop="8dp" android:layout_width="24dp" android:layout_height="24dp" android:layout_marginTop="6dp" android:src="@drawable/bottom_my_black" /> <TextView android:id="@+id/myText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="2dp" android:layout_marginBottom="3dp" android:text="我的" android:textColor="@drawable/text_color_selector" android:textSize="12sp" /> </LinearLayout> generallibrary/src/main/res/layout/fragment_card.xml
@@ -263,7 +263,7 @@ <ImageView android:layout_width="55dp" android:layout_height="55dp" android:src="@drawable/home_system" /> android:src="@drawable/chongzheng" /> <TextView android:layout_width="wrap_content" @@ -302,7 +302,7 @@ <ImageView android:layout_width="55dp" android:layout_height="55dp" android:src="@drawable/home_system" /> android:src="@drawable/bukou" /> <TextView android:layout_width="wrap_content" @@ -341,7 +341,7 @@ <ImageView android:layout_width="55dp" android:layout_height="55dp" android:src="@drawable/home_system" /> android:src="@drawable/fanxie" /> <TextView android:layout_width="wrap_content" generallibrary/src/main/res/layout/fragment_my.xml
@@ -331,35 +331,6 @@ android:src="@drawable/ic_arrow_right"/> </RelativeLayout> <TextView android:id="@+id/sys_ip" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="12dp" android:background="#F9F9F9" android:drawableStart="@android:drawable/ic_menu_manage" android:drawablePadding="8dp" android:drawableTint="#666666" android:padding="12dp" android:text="IP设置" android:textColor="#333333" android:textSize="@dimen/text_size" android:visibility="gone" /> <TextView android:id="@+id/card_replacement" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="12dp" android:background="#F9F9F9" android:drawableStart="@android:drawable/ic_menu_edit" android:drawablePadding="8dp" android:drawableTint="#666666" android:padding="12dp" android:text="用户补卡" android:textColor="#333333" android:textSize="@dimen/text_size" android:visibility="gone" /> <TextView android:id="@+id/my_psw" @@ -376,19 +347,7 @@ android:textSize="@dimen/text_size" android:visibility="gone" /> <TextView android:id="@+id/my_testConnect" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#F9F9F9" android:drawableStart="@android:drawable/ic_menu_compass" android:drawablePadding="8dp" android:drawableTint="#666666" android:padding="12dp" android:text="未连接数据中心" android:textColor="#333333" android:textSize="@dimen/text_size" android:visibility="gone" /> </LinearLayout> </androidx.cardview.widget.CardView> </LinearLayout> generallibrary/src/main/res/layout/fragment_recharge.xml
@@ -3,54 +3,73 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#F5F5F5"> android:background="@color/base_green_bg"> <com.dayu.baselibrary.view.TitleBar android:id="@+id/titleBar" android:layout_width="match_parent" android:layout_height="@dimen/dimen_title_height" android:background="@color/title_bar_bg" android:elevation="4dp" app:centerText="我的" /> <LinearLayout android:id="@+id/recharge_read_LL" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/titleBar" android:gravity="center" android:orientation="vertical" android:visibility="visible"> <androidx.cardview.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="match_parent" android:layout_margin="16dp" app:cardCornerRadius="8dp" app:cardElevation="2dp"> <LinearLayout <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_height="match_parent" android:padding="16dp"> <TextView android:id="@+id/text1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_marginTop="10dp" android:layout_marginBottom="16dp" android:gravity="center" android:text="请将卡贴在设备上进行读卡" android:textColor="#333333" android:textSize="@dimen/text_size" android:text="充值读卡" android:textColor="@color/base_blue_bg" android:textSize="@dimen/big_text_size" android:textStyle="bold" /> <ImageView android:layout_width="200dp" android:layout_height="200dp" android:layout_gravity="center" android:scaleType="fitCenter" android:src="@mipmap/nfc_write" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerVertical="true" android:orientation="vertical"> <TextView android:id="@+id/textView2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginBottom="40dp" android:gravity="center" android:text="请将卡贴在设备上进行读卡" android:textColor="#333333" android:textSize="@dimen/text_size" android:textStyle="bold" /> <ImageView android:layout_width="200dp" android:layout_height="200dp" android:layout_below="@+id/textView2" android:layout_centerHorizontal="true" android:layout_gravity="center" android:scaleType="fitCenter" android:src="@mipmap/nfc_write" /> </LinearLayout> </RelativeLayout> </androidx.cardview.widget.CardView> </LinearLayout> @@ -58,8 +77,8 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/recharge_registBtn" android:layout_below="@+id/header_layout" android:fillViewport="true"> android:fillViewport="true" android:visibility="gone"> <LinearLayout android:layout_width="match_parent" @@ -72,68 +91,13 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:visibility="gone"> android:visibility="visible"> <androidx.cardview.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" app:cardCornerRadius="8dp" app:cardElevation="2dp"> <LinearLayout android:id="@+id/recharge_LL" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="16dp"> <TextView android:id="@+id/red_recharge_water" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:text="充值水量:" android:textColor="#333333" android:textSize="@dimen/text_size" android:visibility="gone" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#F9F9F9" android:orientation="vertical" android:padding="12dp"> <TextView android:id="@+id/recharge_tx" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:text="充值金额(元):" android:textColor="@color/red" android:textSize="@dimen/new_card_size" android:textStyle="bold" /> <EditText android:id="@+id/recharge_water" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/white" android:hint="请输入充值的金额" android:inputType="numberDecimal" android:padding="12dp" 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_marginTop="15dp" android:layout_marginBottom="16dp" android:layout_marginBottom="10dp" app:cardCornerRadius="8dp" app:cardElevation="2dp"> @@ -141,7 +105,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="16dp"> android:padding="12dp"> <TextView android:layout_width="match_parent" @@ -155,49 +119,7 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="卡状态:" android:textColor="#666666" android:textSize="@dimen/text_size" /> <TextView android:id="@+id/red_statu" android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="@color/red" android:textSize="@dimen/new_card_size" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="姓名:" android:textColor="#666666" android:textSize="@dimen/new_card_size" /> <TextView android:id="@+id/userName" android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="#333333" android:textSize="@dimen/new_card_size" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:layout_marginBottom="5dp" android:orientation="horizontal"> <TextView @@ -219,7 +141,50 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:layout_marginBottom="5dp" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="卡状态:" android:textColor="#666666" android:textSize="@dimen/text_size" /> <TextView android:id="@+id/red_statu" android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="@color/red" android:textSize="@dimen/new_card_size" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="5dp" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="姓名:" android:textColor="#666666" android:textSize="@dimen/new_card_size" /> <TextView android:id="@+id/userName" android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="#333333" android:textSize="@dimen/new_card_size" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="5dp" android:orientation="horizontal"> <TextView @@ -241,14 +206,14 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:layout_marginBottom="5dp" android:orientation="horizontal" android:visibility="visible"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="充值后剩余金额:" android:text="当前余额:" android:textColor="#666666" android:textSize="@dimen/text_size" /> @@ -265,7 +230,73 @@ <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/recharge_LL" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="12dp"> <TextView android:id="@+id/red_recharge_water" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:text="充值水量:" android:textColor="#333333" android:textSize="@dimen/text_size" android:visibility="gone" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/base_green_bg" android:orientation="vertical" android:padding="12dp"> <TextView android:id="@+id/recharge_tx" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:text="充值金额(元):" android:textColor="@color/red" android:textSize="@dimen/new_card_size" android:textStyle="bold" /> <EditText android:id="@+id/recharge_morny" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/white" android:hint="请输入充值的金额" android:inputType="numberDecimal" android:padding="5dp" android:textSize="@dimen/new_card_size" /> <EditText android:id="@+id/recharge_water" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:background="@android:color/white" android:hint="请输入赠送的金额(选填)" android:inputType="numberDecimal" android:padding="5dp" 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_marginTop="10dp" app:cardCornerRadius="8dp" app:cardElevation="2dp"> @@ -273,103 +304,67 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="16dp"> android:padding="12dp"> <TextView android:layout_width="match_parent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="12dp" android:text="电量信息" android:layout_marginBottom="10dp" android:text="支付方式" android:textColor="#333333" android:textSize="16sp" android:textSize="18sp" android:textStyle="bold" /> <TextView android:id="@+id/red_balance_electric" <RadioGroup android:id="@+id/newCard_paymentMethod" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:background="#F9F9F9" android:padding="12dp" android:text="剩余电量:" android:textColor="#333333" android:textSize="@dimen/text_size" android:visibility="visible" /> android:orientation="horizontal"> <TextView android:id="@+id/red_rechargeDate" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:background="#F9F9F9" android:padding="12dp" android:text="最后购水日期:" android:textColor="#333333" android:textSize="@dimen/text_size" android:visibility="visible" /> <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" <TextView android:id="@+id/red_rechargeElectric" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:background="#F9F9F9" android:padding="12dp" android:text="电量单价:" android:textColor="#333333" android:textSize="@dimen/text_size" android:visibility="visible" /> android:text="现金" android:textColor="@color/radio_button_text_color" android:textSize="@dimen/new_card_size" /> <TextView android:id="@+id/red_rechargeNumber" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:background="#F9F9F9" android:padding="12dp" android:text="充值次数:" android:textColor="#333333" android:textSize="@dimen/text_size" android:visibility="gone" /> <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" <TextView android:id="@+id/red_total_water" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:background="#F9F9F9" android:padding="12dp" android:text="总用水量:" android:textColor="#333333" android:textSize="@dimen/text_size" android:visibility="gone" /> android:text="POS机" android:textColor="@color/radio_button_text_color" android:textSize="@dimen/new_card_size" /> <TextView android:id="@+id/red_total_power" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:background="#F9F9F9" android:padding="12dp" android:text="总用电量:" android:textColor="#333333" android:textSize="@dimen/text_size" android:visibility="gone" /> <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" <TextView android:id="@+id/red_waterPrice" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#F9F9F9" android:padding="12dp" android:text="每立方米水价格:" android:textColor="#333333" android:textSize="@dimen/text_size" android:visibility="gone" /> android:text="银行转账" android:textColor="@color/radio_button_text_color" android:textSize="@dimen/new_card_size" /> </RadioGroup> </LinearLayout> </androidx.cardview.widget.CardView> </LinearLayout> </LinearLayout> </ScrollView> @@ -379,11 +374,14 @@ android:layout_width="match_parent" android:layout_height="50dp" android:layout_alignParentBottom="true" android:layout_margin="16dp" android:background="@drawable/rounded_button_bg" android:layout_marginLeft="16dp" android:layout_marginTop="10dp" android:layout_marginRight="16dp" android:layout_marginBottom="10dp" android:background="@drawable/recharge_button_ripple" android:elevation="2dp" android:gravity="center" android:text="充值" android:text="下一步(写卡)" android:textColor="@color/white" android:textSize="@dimen/new_card_size" android:textStyle="bold"