feat(generallibrary): 新增制卡管理功能
- 添加制卡管理相关的活动和布局文件- 实现制卡管理卡界面和逻辑
- 新增搜索用户功能
- 优化标题栏样式
- 添加网络请求相关类和接口
11个文件已修改
1个文件已删除
20个文件已添加
New file |
| | |
| | | package com.dayu.baselibrary.net; |
| | | |
| | | public interface BaseApiService { |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | android:layout_weight="2" |
| | | android:background="@null" |
| | | android:gravity="center_vertical|right" |
| | | android:orientation="horizontal" |
| | | android:paddingRight="15dp"> |
| | | android:orientation="horizontal"> |
| | | |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_titlebar_right" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginRight="15dp" |
| | | android:background="@null" |
| | | android:text="完成" |
| | | android:textColor="#ffffff" |
| | |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:background="@null" |
| | | android:paddingLeft="5dp" |
| | | android:paddingTop="10dp" |
| | | android:paddingBottom="10dp" |
| | | android:src="@null" |
| | | android:visibility="visible" /> |
| | | </LinearLayout> |
| | |
| | | |
| | | <color name="button_text_color">#555</color> |
| | | <color name="button_select_text_color">#0aa666</color> |
| | | <color name="title_bar_text">#333333</color> |
| | | </resources> |
| | |
| | | <!-- </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.SearchUserActivity"/> |
| | | <activity android:name="com.dayu.general.activity.NfcWreatActivity" /> |
| | | <activity android:name="com.dayu.general.activity.NewCardActivity"/> |
| | | |
| | | |
| | | <meta-data |
| | |
| | | import com.dayu.general.databinding.FragmentCardBinding |
| | | import com.tencent.bugly.proguard.v |
| | | |
| | | /** |
| | | * @author: zuo |
| | | * @desc: 制卡首页 |
| | | * @since:2025/3/6 |
| | | */ |
| | | class BSCardFragment :Fragment() { |
| | | |
| | | private var binding: FragmentCardBinding? = null |
| | |
| | | |
| | | private fun initView() { |
| | | binding?.homeNewCard?.setOnClickListener { |
| | | val intent = Intent(context, NewCardActivity::class.java) |
| | | val intent = Intent(context, SearchUserActivity::class.java) |
| | | startActivity(intent) |
| | | } |
| | | binding?.homeManage?.setOnClickListener { |
| | | val intent = Intent(context, ManageListActivity::class.java) |
| | | startActivity(intent) |
| | | } |
| | | } |
New file |
| | |
| | | package com.dayu.general.activity |
| | | |
| | | import android.content.Intent |
| | | import com.dayu.baselibrary.activity.BaseNfcActivity |
| | | |
| | | abstract class BaseNfcActivity:BaseNfcActivity() { |
| | | |
| | | } |
New file |
| | |
| | | package com.dayu.general.activity |
| | | |
| | | import android.os.Bundle |
| | | import com.dayu.general.databinding.ActivityManageListGeBinding |
| | | |
| | | class ManageListActivity : BaseActivity() { |
| | | |
| | | var binding: ActivityManageListGeBinding? = null |
| | | override fun onCreate(savedInstanceState: Bundle?) { |
| | | super.onCreate(savedInstanceState) |
| | | binding = ActivityManageListGeBinding.inflate(layoutInflater) |
| | | setContentView(binding?.root) |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dayu.general.activity |
| | | |
| | | import android.content.Intent |
| | | import android.os.Bundle |
| | | import com.dayu.general.bean.card.CardCommon |
| | | import com.dayu.general.databinding.ActivityNfcWriteGeBinding |
| | | |
| | | /** |
| | | * @author: zuo |
| | | * @date: 2021/3/30 |
| | | * @description:写卡界面 |
| | | */ |
| | | class NfcWreatActivity:BaseNfcActivity() { |
| | | |
| | | var binding:ActivityNfcWriteGeBinding? = null |
| | | |
| | | var cardType = "" |
| | | |
| | | override fun onCreate(savedInstanceState: Bundle?) { |
| | | super.onCreate(savedInstanceState) |
| | | binding = ActivityNfcWriteGeBinding.inflate(layoutInflater) |
| | | setContentView(binding?.root) |
| | | getInitData() |
| | | } |
| | | |
| | | /** |
| | | * 获取数据 |
| | | */ |
| | | private fun getInitData(){ |
| | | cardType= intent?.getStringExtra("cardType")?:"" |
| | | } |
| | | |
| | | private fun setTextData(){ |
| | | when(cardType){ |
| | | CardCommon.CHECK_CARD->{ |
| | | binding?.cardData?.text = "写用户卡" |
| | | } |
| | | |
| | | } |
| | | } |
| | | override fun onNfcBack(intent: Intent?) { |
| | | TODO("Not yet implemented") |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.dayu.general.activity |
| | | |
| | | import android.os.Bundle |
| | | import android.widget.Toast |
| | | import com.dayu.baselibrary.view.TitleBar.ClickType_LEFT_IMAGE |
| | | import com.dayu.baselibrary.view.TitleBar.ClickType_RIGHT_IMAGE |
| | | import com.dayu.general.databinding.ActivitySearchUserGeBinding |
| | | import com.dayu.general.dialog.SearchDialog |
| | | |
| | | /** |
| | | * @author: zuo |
| | | * @date: 2023/6/26 16:09 |
| | | * @description:搜索用户 |
| | | */ |
| | | class SearchUserActivity : BaseActivity() { |
| | | |
| | | var binding: ActivitySearchUserGeBinding? = null |
| | | override fun onCreate(savedInstanceState: Bundle?) { |
| | | super.onCreate(savedInstanceState) |
| | | binding = ActivitySearchUserGeBinding.inflate(layoutInflater) |
| | | setContentView(binding?.root) |
| | | initView() |
| | | } |
| | | |
| | | |
| | | fun initView() { |
| | | binding?.titleBar?.setOnItemclickListner(ClickType_LEFT_IMAGE) { this.finish() } |
| | | binding?.titleBar?.setOnItemclickListner(ClickType_RIGHT_IMAGE) { |
| | | // 创建搜索对话框 |
| | | val searchDialog = SearchDialog(this) |
| | | |
| | | // 设置搜索监听器 |
| | | searchDialog.setOnSearchListener(object : SearchDialog.OnSearchListener { |
| | | override fun onSearch(farmerId: String, farmerName: String, cardNumber: String) { |
| | | // 处理搜索结果 |
| | | // 这里只是示例,实际应用中可能需要调用API或查询数据库 |
| | | val message = |
| | | "搜索条件:\n农户编号:$farmerId\n农户名称:$farmerName\n卡号:$cardNumber" |
| | | // 执行实际的搜索逻辑 |
| | | performSearch(farmerId, farmerName, cardNumber) |
| | | } |
| | | }) |
| | | // 显示对话框 |
| | | searchDialog.show() |
| | | } |
| | | } |
| | | /** |
| | | * 执行搜索逻辑 |
| | | * 这里只是一个示例方法,实际应用中需要根据具体需求实现 |
| | | */ |
| | | private fun performSearch(farmerId: String, farmerName: String, cardNumber: String) { |
| | | // 这里可以实现实际的搜索逻辑 |
| | | // 例如:调用API、查询数据库等 |
| | | |
| | | // 示例:构建搜索条件 |
| | | val searchConditions = mutableMapOf<String, String>() |
| | | |
| | | if (farmerId.isNotEmpty()) { |
| | | searchConditions["farmerId"] = farmerId |
| | | } |
| | | |
| | | if (farmerName.isNotEmpty()) { |
| | | searchConditions["farmerName"] = farmerName |
| | | } |
| | | |
| | | if (cardNumber.isNotEmpty()) { |
| | | searchConditions["cardNumber"] = cardNumber |
| | | } |
| | | |
| | | // 根据搜索条件执行搜索 |
| | | // 实际应用中,这里可能是网络请求或数据库查询 |
| | | // searchRepository.search(searchConditions) |
| | | } |
| | | } |
| | |
| | | |
| | | val ERROR_MOVE: Int = -2 |
| | | |
| | | /** |
| | | * 用户刷卡开泵前 |
| | | */ |
| | | |
| | | val USER_CARD_TYPE_1: String = "A1" |
| | | |
| | | /** |
| | | * 用户刷卡开泵后 |
| | | */ |
| | | |
| | | val USER_CARD_TYPE_2: String = "A8" |
| | | |
| | | /** |
| | | * 用户叠加充值 |
| | | */ |
| | | |
| | | val USER_CARD_TYPE_3: String = "A2" |
| | | |
| | | |
| | | /** |
| | | * 设置区域表号卡 |
| | | */ |
| | | |
| | | val REGION: String = "B0" |
| | | |
| | | |
| | | /** |
| | | * 设置用户电量单价卡 |
| | | */ |
| | | |
| | | val ELECTRIC_PRICE: String = "B1" |
| | | |
| | | |
| | | /** |
| | | * 管理卡 |
| | | */ |
| | | |
| | | val MANAGE_CRAD: String = "B2" |
| | | |
| | | |
| | | /** |
| | | * 清零卡 |
| | | */ |
| | | |
| | | val CLEAN_CARD_TYPE: String = "C8" |
| | | |
| | | |
| | | /** |
| | | * 密码卡 |
| | | */ |
| | | |
| | | val PASS_WORD_CRAD_TYPE: String = "B3" |
| | | |
| | | |
| | | /** |
| | | * 配置黑卡 当用户丢失卡时,需要在对应的控制器把此用户配置为黑户,防止非法用水 |
| | | */ |
| | | |
| | | val BLACK: String = "B4" |
| | | |
| | | |
| | | /** |
| | | * 以下未用到 |
| | | * ***************************************************************************************************************************************** |
| | | */ |
| | | /** |
| | | * 重新注册设备卡 |
| | | */ |
| | | |
| | | val REGISTERED_CARD_TYPE: String = "BA" |
| | | |
| | | /** |
| | | * 删除全部用户卡 |
| | | */ |
| | | |
| | | val CLEAN_ALL_USER_CARD_TYPE: String = "BB" |
| | | |
| | | /** |
| | | * 设置域名卡 |
| | | */ |
| | | |
| | | val DOMAIN_CARD_TYPE: String = "C1" |
| | | |
| | | /** |
| | | * 测试卡 |
| | | */ |
| | | |
| | | val TEST_CARD_TYPE: String = "A4" |
| | | |
| | | /** |
| | | * 配置设备注册信息卡 |
| | | */ |
| | | |
| | | val CONFIGURATION_CARD_TYPE: String = "BC" |
| | | |
| | | /** |
| | | * 配置水泵功率卡 |
| | | */ |
| | | |
| | | val CONFIGURATION_POWER_CARD_TYPE: String = "BD" |
| | | |
| | | /** |
| | | * 获取默认的卡标识 |
| | |
| | | var cardData = "" |
| | | when (cardType) { |
| | | CLEAN_CARD_TYPE -> cardData = "3668F7A30119" |
| | | MANAGE_CRAD, REGISTERED_CARD_TYPE, CLEAN_ALL_USER_CARD_TYPE, TEST_CARD_TYPE, CONFIGURATION_CARD_TYPE, CONFIGURATION_POWER_CARD_TYPE, PASS_WORD_CRAD_TYPE, BLACK, ELECTRIC_PRICE -> cardData = |
| | | MANAGE_CRAD, USER_CARD_TYPE_1, USER_CARD_TYPE_2, USER_CARD_TYPE_3, REGION_CARD, ELECTRIC_PRICE_CARD, MANAGE_CRAD, VALVE_TIME_CARD, GPS_CARD, AREA_CARD, IP_CARD, CHECK_CARD, DEBUG_CARD, CLEAN_CARD_TYPE -> cardData = |
| | | "A0B1C289" |
| | | } |
| | | return cardData |
| | | } |
| | | |
| | | companion object { |
| | | |
| | | |
| | | /** |
| | | * 用户刷卡开泵前 |
| | | */ |
| | | |
| | | const val USER_CARD_TYPE_1: String = "A1" |
| | | |
| | | /** |
| | | * 用户刷卡开泵后 |
| | | */ |
| | | |
| | | const val USER_CARD_TYPE_2: String = "A8" |
| | | |
| | | /** |
| | | * 用户叠加充值 |
| | | */ |
| | | |
| | | const val USER_CARD_TYPE_3: String = "A2" |
| | | |
| | | |
| | | /** |
| | | * 设置区域表号卡 |
| | | */ |
| | | |
| | | const val REGION_CARD: String = "B0" |
| | | |
| | | |
| | | /** |
| | | * 取数卡(需要刷卡取数) |
| | | */ |
| | | |
| | | const val ELECTRIC_PRICE_CARD: String = "B1" |
| | | |
| | | |
| | | /** |
| | | * 取数卡(刷卡取数返写成功) |
| | | */ |
| | | |
| | | const val MANAGE_CRAD: String = "B2" |
| | | |
| | | |
| | | /** |
| | | * 检查卡 |
| | | */ |
| | | const val CHECK_CARD: String = "B3" |
| | | |
| | | /** |
| | | * 调试卡 |
| | | */ |
| | | const val DEBUG_CARD = "B4" |
| | | |
| | | /** |
| | | * 清零卡 |
| | | */ |
| | | |
| | | const val CLEAN_CARD_TYPE: String = "C1" |
| | | |
| | | /** |
| | | * IP地址设置卡 |
| | | */ |
| | | |
| | | const val IP_CARD: String = "B5" |
| | | |
| | | /** |
| | | * 区域设置卡 |
| | | */ |
| | | const val AREA_CARD: String = "B6" |
| | | |
| | | |
| | | /** |
| | | * GPS设置卡 |
| | | */ |
| | | const val GPS_CARD: String = "B7" |
| | | |
| | | /** |
| | | * 配置开关阀时间 |
| | | */ |
| | | const val VALVE_TIME_CARD: String = "B8" |
| | | |
| | | |
| | | fun getDefaultCardData(cardType: String?): String? { |
| | | return getDefaultCardData(cardType) |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.dayu.general.dialog |
| | | |
| | | import android.app.Dialog |
| | | import android.content.Context |
| | | import android.os.Bundle |
| | | import android.view.Gravity |
| | | import android.view.LayoutInflater |
| | | import android.view.ViewGroup |
| | | import android.view.WindowManager |
| | | import com.dayu.general.R |
| | | import com.dayu.general.databinding.DialogSearchBinding |
| | | |
| | | /** |
| | | * 搜索对话框 |
| | | * 用于搜索农户编号、农户名称、卡号 |
| | | */ |
| | | class SearchDialog(context: Context) : Dialog(context) { |
| | | |
| | | private lateinit var binding: DialogSearchBinding |
| | | private var onSearchListener: OnSearchListener? = null |
| | | |
| | | override fun onCreate(savedInstanceState: Bundle?) { |
| | | super.onCreate(savedInstanceState) |
| | | binding = DialogSearchBinding.inflate(LayoutInflater.from(context)) |
| | | setContentView(binding.root) |
| | | |
| | | // 设置对话框宽度为屏幕宽度的85% |
| | | window?.apply { |
| | | val params = attributes |
| | | params.width = (context.resources.displayMetrics.widthPixels * 0.85).toInt() |
| | | params.height = ViewGroup.LayoutParams.WRAP_CONTENT |
| | | params.gravity = Gravity.CENTER |
| | | attributes = params |
| | | setBackgroundDrawableResource(android.R.color.transparent) |
| | | } |
| | | |
| | | // 设置点击外部不取消对话框 |
| | | setCanceledOnTouchOutside(false) |
| | | |
| | | // 设置搜索按钮点击事件 |
| | | binding.btnSearch.setOnClickListener { |
| | | val farmerId = binding.etFarmerId.text.toString().trim() |
| | | val farmerName = binding.etFarmerName.text.toString().trim() |
| | | val cardNumber = binding.etCardNumber.text.toString().trim() |
| | | |
| | | // 回调搜索事件 |
| | | onSearchListener?.onSearch(farmerId, farmerName, cardNumber) |
| | | dismiss() |
| | | } |
| | | |
| | | // 设置取消按钮点击事件 |
| | | binding.tvCancel.setOnClickListener { |
| | | dismiss() |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置搜索监听器 |
| | | */ |
| | | fun setOnSearchListener(listener: OnSearchListener) { |
| | | this.onSearchListener = listener |
| | | } |
| | | |
| | | /** |
| | | * 搜索监听器接口 |
| | | */ |
| | | interface OnSearchListener { |
| | | /** |
| | | * 搜索回调方法 |
| | | * @param farmerId 农户编号 |
| | | * @param farmerName 农户名称 |
| | | * @param cardNumber 卡号 |
| | | */ |
| | | fun onSearch(farmerId: String, farmerName: String, cardNumber: String) |
| | | } |
| | | } |
New file |
| | |
| | | package com.dayu.general.net |
| | | |
| | | import android.content.Context |
| | | import android.text.TextUtils |
| | | import com.dayu.baselibrary.business.BusinessProvider |
| | | import com.dayu.baselibrary.net.subscribers.BaseProgressSubscriber |
| | | import com.dayu.baselibrary.net.subscribers.SubscriberListener |
| | | import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers |
| | | import io.reactivex.rxjava3.core.Observable |
| | | import io.reactivex.rxjava3.functions.Function |
| | | import io.reactivex.rxjava3.schedulers.Schedulers |
| | | |
| | | /** |
| | | * Description: |
| | | * Author: zuo |
| | | * Date: 2025-03-06 |
| | | */ |
| | | class ApiManager { |
| | | |
| | | var apiService: ApiService? = null |
| | | |
| | | fun init() { |
| | | if (apiManager == null) { |
| | | apiManager = |
| | | com.dayu.qiheonlinelibrary.net.ApiManager() |
| | | } |
| | | } |
| | | |
| | | fun ApiManager() { |
| | | apiService = RetrofitClient.getInstance().getApiService() |
| | | } |
| | | |
| | | fun getInstance(): com.dayu.qiheonlinelibrary.net.ApiManager { |
| | | return apiManager |
| | | } |
| | | |
| | | |
| | | fun <T> requestPostLoading( |
| | | context: Context?, |
| | | path: String?, |
| | | tClass: Class<T>?, |
| | | params: Map<String?, Any?>?, |
| | | listener: SubscriberListener<*>? |
| | | ) { |
| | | request(context, false, path, false, tClass, params, listener) |
| | | } |
| | | |
| | | fun <T> requestPostHideLoading( |
| | | context: Context?, |
| | | path: String?, |
| | | tClass: Class<T>?, |
| | | params: Map<String?, Any?>?, |
| | | listener: SubscriberListener<*>? |
| | | ) { |
| | | request(context, true, path, false, tClass, params, listener) |
| | | } |
| | | |
| | | fun <T> requestPost( |
| | | context: Context?, |
| | | path: String?, |
| | | tClass: Class<T>?, |
| | | params: Map<String?, Any?>?, |
| | | listener: SubscriberListener<*>? |
| | | ) { |
| | | request(context, false, path, false, tClass, params, listener) |
| | | } |
| | | |
| | | /** |
| | | * 发送请求 |
| | | * |
| | | * @param context |
| | | * @param hideLoading 是否显示加载框 false:显示 true:隐藏 |
| | | * @param path 请求路径,在UrlConfig中定义 |
| | | * @param isGet 是否是Get请求 true:get 请求 |
| | | * @param tClass 对应的数据类型 |
| | | * @param params Post请求时,对应的参数 |
| | | * @param listener 回调请求 |
| | | * @param <T> |
| | | </T> */ |
| | | fun <T> request( |
| | | context: Context?, |
| | | hideLoading: Boolean, |
| | | path: String?, |
| | | isGet: Boolean, |
| | | tClass: Class<T>?, |
| | | params: Map<String?, Any?>?, |
| | | listener: SubscriberListener<*>? |
| | | ) { |
| | | val observable: Observable<*>=if (isGet) { |
| | | if (params == null) { |
| | | apiService.requestGet(path) |
| | | } else { |
| | | apiService.requestGet(path, params) |
| | | } |
| | | } else { |
| | | if (params != null) { |
| | | apiService.requestPost(path, params) |
| | | } else { |
| | | apiService.requestPost(path) |
| | | } |
| | | } |
| | | |
| | | val mySubscriber: BaseProgressSubscriber<*>=ProgressSubscriber<Any?>(context, hideLoading, listener) |
| | | observable.subscribeOn(Schedulers.io()).map |
| | | object : Function<Any?, com.dayu.qiheonlinelibrary.net.BaseResponse<T>?> { |
| | | override fun apply(o: Any): com.dayu.qiheonlinelibrary.net.BaseResponse<T> { |
| | | if (o is com.dayu.qiheonlinelibrary.net.BaseResponse) { |
| | | val tem: com.dayu.qiheonlinelibrary.net.BaseResponse = |
| | | o as com.dayu.qiheonlinelibrary.net.BaseResponse |
| | | val response: com.dayu.qiheonlinelibrary.net.BaseResponse<T> = |
| | | com.dayu.qiheonlinelibrary.net.BaseResponse<T>() |
| | | //未登录或登录超时,请重新登录 |
| | | if (tem.getCode() == 100401) { |
| | | if (BusinessProvider.getBusinessProvider() != null) { |
| | | BusinessProvider.getBusinessProvider().startLoginNavigotor.navigateToLogin( |
| | | context |
| | | ) |
| | | } |
| | | } |
| | | response.setCode(tem.getCode()) |
| | | response.setMsg(tem.getMsg()) |
| | | if (tClass != null) { |
| | | if (TextUtils.isEmpty( |
| | | tem.getData().toString() |
| | | ) && BaseResult::class.java.isAssignableFrom(tClass) |
| | | ) { |
| | | response.setData(null) |
| | | return response |
| | | } |
| | | if (tem.getData() is Map<*, *>) { |
| | | try { |
| | | // response.setData(MyJsonParser.getBeanFromMap((Map<String, Object>) tem.getData(), tClass)); |
| | | val jsonData: String = |
| | | MyJsonParser.getJsontoMap(tem.getData() as Map<*, *>) |
| | | response.setData(MyJsonParser.getBeanFromJson<T>(jsonData, tClass)) |
| | | } catch (e: Exception) { |
| | | e.printStackTrace() |
| | | } |
| | | } else if (tem.getData() is List<*>) { |
| | | try { |
| | | response.setData( |
| | | MyJsonParser.getListByJson<T>( |
| | | MyJsonParser.getJsonbyList<Any>( |
| | | tem.getData() as List<*> |
| | | ), tClass |
| | | ) as T |
| | | ) |
| | | } catch (e: Exception) { |
| | | e.printStackTrace() |
| | | } |
| | | } else if (tem.getData() is Int) { |
| | | response.setData(tem.getData() as T) |
| | | } else if (tem.getData() is Boolean) { |
| | | response.setData(tem.getData() as T) |
| | | } |
| | | if (tClass.name is String && tem.getData() is String) { |
| | | try { |
| | | response.setData(tem.getData() as T) |
| | | } catch (e: Exception) { |
| | | e.printStackTrace() |
| | | } |
| | | } |
| | | return response |
| | | } |
| | | } |
| | | |
| | | return null |
| | | } |
| | | } |
| | | .unsubscribeOn(Schedulers.newThread()) |
| | | .observeOn(AndroidSchedulers.mainThread()) |
| | | .subscribe(mySubscriber) |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dayu.general.net |
| | | |
| | | import com.dayu.baselibrary.net.BaseApiService |
| | | import io.reactivex.rxjava3.core.Observable |
| | | import retrofit2.http.Body |
| | | import retrofit2.http.GET |
| | | import retrofit2.http.POST |
| | | import retrofit2.http.Path |
| | | import retrofit2.http.QueryMap |
| | | import retrofit2.http.Url |
| | | |
| | | interface ApiService : BaseApiService { |
| | | |
| | | @POST |
| | | fun requestPost( |
| | | @Url url: String?, |
| | | @Body params: Map<String?, Any?>? |
| | | ): Observable<BaseResponse<Any?>>? |
| | | |
| | | @POST |
| | | fun requestPost(@Url url: String?): Observable<BaseResponse<Any?>>? |
| | | |
| | | @GET("{url}") |
| | | fun requestGet( |
| | | @Path("url") url: String?, |
| | | @QueryMap params: Map<String?, Any?>? |
| | | ): Observable<BaseResponse<Any?>>? |
| | | |
| | | @GET("{url}") |
| | | fun requestGet(@Path("url") url: String?): Observable<BaseResponse<Any?>>? |
| | | |
| | | } |
New file |
| | |
| | | package com.dayu.general.net |
| | | |
| | | /** |
| | | * Description: |
| | | * Author: zuo |
| | | * Date: 2025-03-06 |
| | | */ |
| | | class BaseResponse<T> { |
| | | var code: Int = 0 |
| | | var msg: String? = null |
| | | var content: T? = null |
| | | var success:Boolean = false |
| | | |
| | | companion object |
| | | |
| | | } |
New file |
| | |
| | | package com.dayu.general.net |
| | | |
| | | import android.text.TextUtils |
| | | import com.dayu.qiheonlinelibrary.QHOnLineApplication |
| | | import com.tencent.bugly.crashreport.CrashReport |
| | | import okhttp3.Interceptor |
| | | import okhttp3.Protocol |
| | | import okhttp3.Request |
| | | import okhttp3.Response |
| | | import okhttp3.ResponseBody |
| | | import java.io.IOException |
| | | import java.net.ConnectException |
| | | |
| | | /** |
| | | * Description: |
| | | * Author: zuo |
| | | * Date: 2025-03-06 |
| | | */ |
| | | class MyInercepterApplication :Interceptor{ |
| | | |
| | | @Throws(IOException::class) |
| | | override fun intercept(chain: Interceptor.Chain): Response { |
| | | val request: Request = chain.request() |
| | | try { |
| | | val myRequest = createRequest(chain.request()) |
| | | if (myRequest != null) { |
| | | var response: Response? = null |
| | | try { |
| | | response = chain.proceed(myRequest) |
| | | } catch (e: ConnectException) { |
| | | e.printStackTrace() |
| | | return getNullResponse(request) |
| | | } |
| | | return response |
| | | } |
| | | } catch (e: Exception) { |
| | | e.printStackTrace() |
| | | CrashReport.postCatchedException(e) |
| | | } |
| | | return getNullResponse(request) |
| | | } |
| | | |
| | | protected fun createRequest(request: Request): Request? { |
| | | try { |
| | | val builder: Request.Builder = request.newBuilder() |
| | | val params: Map<*, *> = HashMap<Any?, Any?>() |
| | | if (request.method == "GET") { |
| | | builder.url(request.url.toString()) |
| | | } else { |
| | | if (!TextUtils.isEmpty(QHOnLineApplication.getInstance().tokenStr)) { |
| | | builder.addHeader("Token-Cloud", QHOnLineApplication.getInstance().tokenStr) |
| | | } |
| | | } |
| | | return builder.build() |
| | | } catch (e: Exception) { |
| | | e.printStackTrace() |
| | | CrashReport.postCatchedException(e) |
| | | } |
| | | return null |
| | | } |
| | | |
| | | /** |
| | | * 网络错误时的异常处理 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | fun getNullResponse(request: Request?): Response { |
| | | val code = 20010 |
| | | val message = "咦,请检查网络" |
| | | val errJson = "{\"code\":$code,\"message\":\"$message\"}" |
| | | val responseBody = ResponseBody.create(null, errJson) |
| | | return Response.Builder() |
| | | .request(request!!) |
| | | .protocol(Protocol.HTTP_1_1) |
| | | .code(200) |
| | | .message(message) |
| | | .body(responseBody) |
| | | .build() |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dayu.general.net |
| | | |
| | | /** |
| | | * @author zuo |
| | | * @date 2025/3/6 |
| | | * @description |
| | | */ |
| | | class NetConstans { |
| | | companion object { |
| | | const val BASE_URL: String = "http://120.46.45.35:20081/api/sjgg/" |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dayu.general.net |
| | | |
| | | import com.dayu.baselibrary.BuildConfig |
| | | import com.dayu.qiheonlinelibrary.net.MyIntercepterApplication |
| | | import okhttp3.OkHttpClient |
| | | import okhttp3.logging.HttpLoggingInterceptor |
| | | import retrofit2.Retrofit |
| | | import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory |
| | | import retrofit2.converter.gson.GsonConverterFactory |
| | | import java.util.concurrent.TimeUnit |
| | | |
| | | /** |
| | | * Description: |
| | | * Author: zuo |
| | | * Date: 2025-03-06 |
| | | */ |
| | | class RetrofitClient { |
| | | |
| | | |
| | | |
| | | private var retrofit: Retrofit? = null |
| | | val READ_TIME_OUT: Int = 10 |
| | | val CONNECT_TIME_OUT: Int = 10 |
| | | |
| | | private fun RetrofitClient() { |
| | | val loggingInterceptor = HttpLoggingInterceptor() |
| | | // 包含header、body数据 |
| | | loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY) |
| | | // loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS); |
| | | val builder: OkHttpClient.Builder = OkHttpClient().newBuilder() |
| | | //设置连接和读取时间 |
| | | builder.readTimeout(READ_TIME_OUT.toLong(), TimeUnit.SECONDS) |
| | | builder.connectTimeout(CONNECT_TIME_OUT.toLong(), TimeUnit.SECONDS) |
| | | builder.writeTimeout(CONNECT_TIME_OUT.toLong(), TimeUnit.SECONDS) |
| | | //添加统一的header |
| | | builder.addInterceptor(MyIntercepterApplication()) |
| | | //添加日志拦截器 |
| | | //添加数据请求统一处理拦截器 |
| | | if (BuildConfig.DEBUG) { |
| | | builder.addInterceptor(loggingInterceptor) |
| | | } |
| | | |
| | | val client: OkHttpClient = builder.build() |
| | | |
| | | retrofit = Retrofit.Builder() |
| | | .baseUrl(NetConstans.BASE_URL) |
| | | .addConverterFactory(GsonConverterFactory.create()) |
| | | .addCallAdapterFactory(RxJava3CallAdapterFactory.create()) |
| | | .client(client).build() |
| | | } |
| | | |
| | | @Synchronized |
| | | |
| | | |
| | | fun getApiService(): ApiService { |
| | | return retrofit?.create(ApiService::class.java) ?: throw IllegalStateException("Retrofit instance is not initialized") |
| | | } |
| | | |
| | | companion object{ |
| | | var mInstance: RetrofitClient? = null |
| | | fun getInstance(): RetrofitClient { |
| | | if (mInstance == null) { |
| | | mInstance = RetrofitClient() |
| | | } |
| | | return mInstance as RetrofitClient |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | <?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="8dp" /> |
| | | <stroke |
| | | android:width="1dp" |
| | | android:color="#E0E0E0" /> |
| | | </shape> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <ripple xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:color="#20000000"> |
| | | <item android:id="@android:id/mask"> |
| | | <shape android:shape="rectangle"> |
| | | <solid android:color="#000000" /> |
| | | <corners android:radius="8dp" /> |
| | | </shape> |
| | | </item> |
| | | <item android:drawable="@drawable/bg_card" /> |
| | | </ripple> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <vector xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:width="24dp" |
| | | android:height="24dp" |
| | | android:viewportWidth="24.0" |
| | | android:viewportHeight="24.0"> |
| | | <path |
| | | android:fillColor="#AAAAAA" |
| | | android:pathData="M8.59,16.34l4.58,-4.59 -4.58,-4.59L10,5.75l6,6 -6,6z"/> |
| | | </vector> |
New file |
| | |
| | | <?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:orientation="vertical" |
| | | android:background="@color/white" |
| | | > |
| | | |
| | | <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" |
| | | app:centerText="制作管理卡" |
| | | app:leftImage="@mipmap/icon_back" /> |
| | | |
| | | <ScrollView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | > |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:padding="16dp" |
| | | android:orientation="vertical"> |
| | | <TextView |
| | | android:id="@+id/tv_area_card" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="设置区域表号卡" |
| | | android:textSize="16sp" |
| | | android:textColor="#333333" |
| | | android:padding="16dp" |
| | | android:layout_marginBottom="12dp" |
| | | android:background="@drawable/card_ripple_effect" |
| | | android:elevation="2dp" |
| | | android:drawableEnd="@drawable/ic_arrow_right" |
| | | android:gravity="center_vertical" |
| | | android:clickable="true" |
| | | android:focusable="true" /> |
| | | <TextView |
| | | android:id="@+id/tv_check_card" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="检查卡" |
| | | android:textSize="16sp" |
| | | android:textColor="#333333" |
| | | android:padding="16dp" |
| | | android:layout_marginBottom="12dp" |
| | | android:background="@drawable/card_ripple_effect" |
| | | android:elevation="2dp" |
| | | android:drawableEnd="@drawable/ic_arrow_right" |
| | | android:gravity="center_vertical" |
| | | android:clickable="true" |
| | | android:focusable="true" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_debug_card" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="调试卡" |
| | | android:textSize="16sp" |
| | | android:textColor="#333333" |
| | | android:padding="16dp" |
| | | android:layout_marginBottom="12dp" |
| | | android:background="@drawable/card_ripple_effect" |
| | | android:elevation="2dp" |
| | | android:drawableEnd="@drawable/ic_arrow_right" |
| | | android:gravity="center_vertical" |
| | | android:clickable="true" |
| | | android:focusable="true" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_clean_card" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="清理卡" |
| | | android:textSize="16sp" |
| | | android:textColor="#333333" |
| | | android:padding="16dp" |
| | | android:layout_marginBottom="12dp" |
| | | android:background="@drawable/card_ripple_effect" |
| | | android:elevation="2dp" |
| | | android:drawableEnd="@drawable/ic_arrow_right" |
| | | android:gravity="center_vertical" |
| | | android:clickable="true" |
| | | android:focusable="true" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_ip_setting_card" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="IP地址设置卡" |
| | | android:textSize="16sp" |
| | | android:textColor="#333333" |
| | | android:padding="16dp" |
| | | android:layout_marginBottom="12dp" |
| | | android:background="@drawable/card_ripple_effect" |
| | | android:elevation="2dp" |
| | | android:drawableEnd="@drawable/ic_arrow_right" |
| | | android:gravity="center_vertical" |
| | | android:clickable="true" |
| | | android:focusable="true" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_domain_setting_card" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="域名设置卡" |
| | | android:textSize="16sp" |
| | | android:textColor="#333333" |
| | | android:padding="16dp" |
| | | android:layout_marginBottom="12dp" |
| | | android:background="@drawable/card_ripple_effect" |
| | | android:elevation="2dp" |
| | | android:drawableEnd="@drawable/ic_arrow_right" |
| | | android:gravity="center_vertical" |
| | | android:clickable="true" |
| | | android:focusable="true" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_gps_card" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="GPS定位卡" |
| | | android:textSize="16sp" |
| | | android:textColor="#333333" |
| | | android:padding="16dp" |
| | | android:layout_marginBottom="12dp" |
| | | android:background="@drawable/card_ripple_effect" |
| | | android:elevation="2dp" |
| | | android:drawableEnd="@drawable/ic_arrow_right" |
| | | android:gravity="center_vertical" |
| | | android:clickable="true" |
| | | android:focusable="true" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_valve_time_card" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="配置开关阀时间卡" |
| | | android:textSize="16sp" |
| | | android:textColor="#333333" |
| | | android:padding="16dp" |
| | | android:layout_marginBottom="12dp" |
| | | android:background="@drawable/card_ripple_effect" |
| | | android:elevation="2dp" |
| | | android:drawableEnd="@drawable/ic_arrow_right" |
| | | android:gravity="center_vertical" |
| | | android:clickable="true" |
| | | android:focusable="true" /> |
| | | </LinearLayout> |
| | | </ScrollView> |
| | | </LinearLayout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="#F5F7FA"> |
| | | |
| | | <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="农户列表" |
| | | app:leftImage="@mipmap/icon_back" /> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | </RelativeLayout> |
New file |
| | |
| | | <?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:id="@+id/activity_main" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="@color/colorBackground"> |
| | | |
| | | <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="写卡" |
| | | app:leftImage="@mipmap/icon_back" |
| | | app:layout_constraintTop_toTopOf="parent" /> |
| | | |
| | | <androidx.cardview.widget.CardView |
| | | android:id="@+id/cardInfoContainer" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginStart="16dp" |
| | | android:layout_marginTop="24dp" |
| | | android:layout_marginEnd="16dp" |
| | | app:cardBackgroundColor="@android:color/white" |
| | | app:cardCornerRadius="12dp" |
| | | app:cardElevation="4dp" |
| | | android:visibility="visible" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintTop_toBottomOf="@id/titleBar"> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical" |
| | | android:padding="16dp"> |
| | | |
| | | <TextView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:gravity="center" |
| | | android:text="写卡信息" |
| | | android:textColor="@color/title_bar_text" |
| | | android:textSize="18sp" |
| | | android:textStyle="bold" /> |
| | | |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="1dp" |
| | | android:layout_marginTop="8dp" |
| | | android:layout_marginBottom="8dp" |
| | | android:background="#E0E0E0" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/cardData" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:gravity="center" |
| | | android:padding="8dp" |
| | | android:textColor="#333333" |
| | | android:textSize="@dimen/text_size" /> |
| | | </LinearLayout> |
| | | </androidx.cardview.widget.CardView> |
| | | |
| | | <androidx.cardview.widget.CardView |
| | | android:id="@+id/nfcContainer" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | android:layout_marginStart="16dp" |
| | | android:layout_marginTop="24dp" |
| | | android:layout_marginEnd="16dp" |
| | | android:layout_marginBottom="24dp" |
| | | app:cardBackgroundColor="@android:color/white" |
| | | app:cardCornerRadius="12dp" |
| | | app:cardElevation="4dp" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintTop_toBottomOf="@id/cardInfoContainer"> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:gravity="center" |
| | | android:orientation="vertical" |
| | | android:padding="16dp"> |
| | | |
| | | <TextView |
| | | android:id="@+id/textView" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:gravity="center" |
| | | android:text="请将卡贴在设备上进行写卡" |
| | | android:textColor="#333333" |
| | | android:textSize="18sp" |
| | | android:textStyle="bold" /> |
| | | |
| | | <ImageView |
| | | android:id="@+id/nfcImageView" |
| | | android:layout_width="200dp" |
| | | android:layout_height="200dp" |
| | | android:layout_marginTop="24dp" |
| | | android:scaleType="fitCenter" |
| | | android:src="@mipmap/nfc_write" /> |
| | | |
| | | <TextView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="16dp" |
| | | android:gravity="center" |
| | | android:text="请保持手机和卡片不要移动" |
| | | android:textColor="#666666" |
| | | android:textSize="14sp" /> |
| | | </LinearLayout> |
| | | </androidx.cardview.widget.CardView> |
| | | |
| | | <com.wang.avi.AVLoadingIndicatorView |
| | | android:id="@+id/avi" |
| | | style="@style/AVLoadingIndicatorView" |
| | | android:layout_width="80dp" |
| | | android:layout_height="80dp" |
| | | android:visibility="gone" |
| | | app:indicatorColor="@color/title_bg" |
| | | app:indicatorName="BallClipRotatePulseIndicator" |
| | | app:layout_constraintBottom_toBottomOf="parent" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintTop_toTopOf="parent" /> |
| | | </androidx.constraintlayout.widget.ConstraintLayout> |
New file |
| | |
| | | <?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:orientation="vertical"> |
| | | |
| | | <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="搜索用户" |
| | | app:layout_constraintTop_toTopOf="parent" |
| | | app:leftImage="@mipmap/icon_back" |
| | | app:rightImage="@mipmap/icon_search"/> |
| | | |
| | | |
| | | <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"> |
| | | |
| | | <androidx.recyclerview.widget.RecyclerView |
| | | android:id="@+id/recyclerView" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="#ffffff" |
| | | 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> |
| | | |
| | | |
| | | |
| | | </LinearLayout> |
New file |
| | |
| | | <?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_farmer_name_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_farmer_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_farmer_name_label" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_farmer_id_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_farmer_name" /> |
| | | |
| | | <EditText |
| | | android:id="@+id/et_farmer_id" |
| | | 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_farmer_id_label" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_card_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_farmer_id" /> |
| | | |
| | | <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" /> |
| | | |
| | | <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_card_number" /> |
| | | |
| | | <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> |
| | |
| | | android:layout_height="match_parent" |
| | | android:background="@color/white"> |
| | | |
| | | <androidx.appcompat.widget.Toolbar |
| | | |
| | | <com.dayu.baselibrary.view.TitleBar |
| | | android:id="@+id/titleBar" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="@dimen/dimen_title_height" |
| | | android:background="@color/bottom_color" |
| | | android:background="@color/title_bar_bg" |
| | | android:elevation="4dp" |
| | | app:layout_constraintTop_toTopOf="parent"> |
| | | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_gravity="center" |
| | | android:text="制卡" |
| | | android:textColor="@color/white" |
| | | android:textSize="@dimen/title_text_size" |
| | | android:textStyle="bold" /> |
| | | </androidx.appcompat.widget.Toolbar> |
| | | app:centerText="制卡" /> |
| | | |
| | | <ScrollView |
| | | android:layout_width="match_parent" |
| | |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="8dp" |
| | | android:gravity="center" |
| | | android:text="新卡开户" |
| | | android:text="开卡" |
| | | android:textColor="@color/text_selecter_color" |
| | | android:textSize="@dimen/home_text_size" /> |
| | | </LinearLayout> |
| | |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="8dp" |
| | | android:gravity="center" |
| | | android:text="读取卡片" |
| | | android:text="读卡" |
| | | android:textColor="@color/text_selecter_color" |
| | | android:textSize="@dimen/home_text_size" /> |
| | | </LinearLayout> |
| | |
| | | </androidx.cardview.widget.CardView> |
| | | |
| | | <androidx.cardview.widget.CardView |
| | | android:id="@+id/home_admin" |
| | | android:id="@+id/home_manage" |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginStart="8dp" |
| | |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="8dp" |
| | | android:gravity="center" |
| | | android:text="管理系统" |
| | | android:text="制作管理卡" |
| | | android:textColor="@color/text_selecter_color" |
| | | android:textSize="@dimen/home_text_size" /> |
| | | </LinearLayout> |
| | |
| | | android:orientation="vertical" |
| | | android:background="#F5F5F5"> |
| | | |
| | | <RelativeLayout |
| | | android:id="@+id/header_layout" |
| | | <com.dayu.baselibrary.view.TitleBar |
| | | android:id="@+id/titleBar" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="@dimen/dimen_title_height" |
| | | android:background="@color/bottom_color" |
| | | android:elevation="4dp"> |
| | | |
| | | <TextView |
| | | android:id="@+id/titleBar" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_centerInParent="true" |
| | | android:text="我的" |
| | | android:textColor="@color/white" |
| | | android:textSize="@dimen/title_text_size" |
| | | android:textStyle="bold" /> |
| | | </RelativeLayout> |
| | | android:background="@color/title_bar_bg" |
| | | android:elevation="4dp" |
| | | app:centerText="我的" /> |
| | | |
| | | <ScrollView |
| | | android:layout_width="match_parent" |
| | |
| | | android:layout_height="match_parent" |
| | | android:background="#F5F5F5"> |
| | | |
| | | <RelativeLayout |
| | | android:id="@+id/header_layout" |
| | | <com.dayu.baselibrary.view.TitleBar |
| | | android:id="@+id/titleBar" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="@dimen/dimen_title_height" |
| | | android:background="@color/bottom_color" |
| | | android:elevation="4dp"> |
| | | |
| | | <TextView |
| | | android:id="@+id/titleBar" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_centerInParent="true" |
| | | android:text="充值" |
| | | android:textColor="@color/white" |
| | | android:textSize="@dimen/title_text_size" |
| | | android:textStyle="bold" /> |
| | | </RelativeLayout> |
| | | 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/header_layout" |
| | | android:layout_below="@+id/titleBar" |
| | | android:orientation="vertical" |
| | | android:visibility="visible"> |
| | | |
| | |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical" |
| | | android:visibility="gone"> |
| | | |
| | | <androidx.cardview.widget.CardView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical" |
| | | android:padding="16dp"> |
| | | |
| | | |
| | | |
| | | <TextView |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:background="#F9F9F9" |
| | | android:padding="12dp" |
| | | android:orientation="vertical"> |
| | | android:orientation="vertical" |
| | | android:padding="12dp"> |
| | | |
| | | <TextView |
| | | android:id="@+id/recharge_tx" |
| | |
| | | </LinearLayout> |
| | | </LinearLayout> |
| | | </androidx.cardview.widget.CardView> |
| | | |
| | | <androidx.cardview.widget.CardView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginBottom="16dp" |
| | | android:layout_marginTop="15dp" |
| | | android:layout_marginBottom="16dp" |
| | | app:cardCornerRadius="8dp" |
| | | app:cardElevation="2dp"> |
| | | |
| | |
| | | package com.dayu.qiheonlinelibrary.net; |
| | | |
| | | |
| | | import com.dayu.baselibrary.net.BaseApiService; |
| | | |
| | | import java.util.Map; |
| | | |
| | | import io.reactivex.rxjava3.core.Observable; |
| | |
| | | * Date: 2023-03-27 14:56 |
| | | * Description: |
| | | */ |
| | | public interface ApiService { |
| | | |
| | | public interface ApiService extends BaseApiService { |
| | | |
| | | |
| | | // @FormUrlEncoded |
| | | @POST() |
| | | Observable<BaseResponse> requestPost(@Url String url, @Body Map<String, Object> params); |
| | | |
| | | @POST() |
| | | Observable<BaseResponse> requestPost(@Url String url); |
| | | |
| | | @GET("{url}") |
| | | Observable<BaseResponse> requestGet(@Path("url") String url, @QueryMap Map<String, Object> params); |
| | | |
| | |
| | | package com.dayu.qiheonlinelibrary.net; |
| | | |
| | | import android.os.Handler; |
| | | import android.os.Looper; |
| | | import android.text.TextUtils; |
| | | |
| | | import com.dayu.qiheonlinelibrary.QHOnLineApplication; |
| | | import com.dayu.qiheonlinelibrary.utils.ToastUtil; |
| | | import com.tencent.bugly.crashreport.CrashReport; |
| | | |
| | | import java.io.IOException; |
| | |
| | | */ |
| | | public Response getNullResponse(Request request) { |
| | | // 显示Toast提示 |
| | | new Handler(Looper.getMainLooper()).post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | ToastUtil.showToastLong(QHOnLineApplication.getInstance().application.getApplicationContext(), "请检查网络!!!"); |
| | | } |
| | | }); |
| | | int code = 20010; |
| | | String message = "咦,请检查网络"; |
| | | String errJson = "{\"code\":" + code + ",\"message\":\"" + message + "\"}"; |