| New file | 
|  |  |  | 
|---|
|  |  |  | package com.dayu.qihealonelibrary.activity; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import android.os.Bundle; | 
|---|
|  |  |  | import android.text.TextUtils; | 
|---|
|  |  |  | import android.view.LayoutInflater; | 
|---|
|  |  |  | import android.view.View; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.dayu.baselibrary.utils.TipUtil; | 
|---|
|  |  |  | import com.dayu.qihealonelibrary.databinding.ActivityPowerQhaBinding; | 
|---|
|  |  |  | import com.dayu.qihealonelibrary.dbBean.PowerBean; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * Copyright (C), 2023, | 
|---|
|  |  |  | * Author: zuo | 
|---|
|  |  |  | * Date: 2023-11-08 21:19 | 
|---|
|  |  |  | * Description: 功率设置 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public class PowerActivityQHAlone extends QHAloneBaseActivity { | 
|---|
|  |  |  | ActivityPowerQhaBinding powerBinding; | 
|---|
|  |  |  | PowerBean powerBean = new PowerBean(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | protected void onCreate(Bundle savedInstanceState) { | 
|---|
|  |  |  | super.onCreate(savedInstanceState); | 
|---|
|  |  |  | powerBinding = ActivityPowerQhaBinding.inflate(LayoutInflater.from(this)); | 
|---|
|  |  |  | setContentView(powerBinding.getRoot()); | 
|---|
|  |  |  | initData(); | 
|---|
|  |  |  | initView(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void initData() { | 
|---|
|  |  |  | PowerBean powerBean = baseDao.powerDao().findFirst(); | 
|---|
|  |  |  | if (powerBean != null) { | 
|---|
|  |  |  | this.powerBean = powerBean; | 
|---|
|  |  |  | powerBinding.villageOldNumber.setText(powerBean.getPower()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void initView() { | 
|---|
|  |  |  | powerBinding.villageOk.setOnClickListener(new View.OnClickListener() { | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void onClick(View v) { | 
|---|
|  |  |  | String data = powerBinding.villageNewNum.getText().toString(); | 
|---|
|  |  |  | if (!TextUtils.isEmpty(data)) { | 
|---|
|  |  |  | powerBean.setPower(data); | 
|---|
|  |  |  | baseDao.powerDao().insert(powerBean); | 
|---|
|  |  |  | TipUtil.show("保存成功"); | 
|---|
|  |  |  | //                    PowerActivity.this.finish(); | 
|---|
|  |  |  | initData(); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | TipUtil.show("请输入水泵功率"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|