2.5日 Andriod 记账本开发
//点击眼睛时,如果是明文就加密,如果是密文,就变成明文
private void toggleShow() {
if (isShow) {
PasswordTransformationMethod passwordMethod = PasswordTransformationMethod.getInstance();
topInTv.setTransformationMethod(passwordMethod);
topOutTv.setTransformationMethod(passwordMethod);
topbudgetTv.setTransformationMethod(passwordMethod);
topShowIv.setImageResource(R.mipmap.ih_hide);
isShow = false;
} else {
HideReturnsTransformationMethod hideReturnsTransformationMethod = HideReturnsTransformationMethod.getInstance();
topInTv.setTransformationMethod(hideReturnsTransformationMethod);
topOutTv.setTransformationMethod(hideReturnsTransformationMethod);
topbudgetTv.setTransformationMethod(hideReturnsTransformationMethod);
topShowIv.setImageResource(R.mipmap.ih_show);
isShow = true;
}
}
private void toggleShow() {
if (isShow) {
PasswordTransformationMethod passwordMethod = PasswordTransformationMethod.getInstance();
topInTv.setTransformationMethod(passwordMethod);
topOutTv.setTransformationMethod(passwordMethod);
topbudgetTv.setTransformationMethod(passwordMethod);
topShowIv.setImageResource(R.mipmap.ih_hide);
isShow = false;
} else {
HideReturnsTransformationMethod hideReturnsTransformationMethod = HideReturnsTransformationMethod.getInstance();
topInTv.setTransformationMethod(hideReturnsTransformationMethod);
topOutTv.setTransformationMethod(hideReturnsTransformationMethod);
topbudgetTv.setTransformationMethod(hideReturnsTransformationMethod);
topShowIv.setImageResource(R.mipmap.ih_show);
isShow = true;
}
}
private void showBudgetDialog() {
//显示设置预算对话框
BudgetDialog dialog = new BudgetDialog(this);
dialog.show();
dialog.setOnEnsureListener(money -> {
//将金额写入共享参数中,进行存储
SharedPreferences.Editor editor = preferences.edit();
editor.putFloat("bmoney", money);
editor.commit();
//计算剩余金额
float outComeMonth = DBManager.getMoneyOneMonth(year, month, 0);
float sMoney = money - outComeMonth;//预算剩余
topbudgetTv.setText("¥ " + sMoney);
});
}
//显示设置预算对话框
BudgetDialog dialog = new BudgetDialog(this);
dialog.show();
dialog.setOnEnsureListener(money -> {
//将金额写入共享参数中,进行存储
SharedPreferences.Editor editor = preferences.edit();
editor.putFloat("bmoney", money);
editor.commit();
//计算剩余金额
float outComeMonth = DBManager.getMoneyOneMonth(year, month, 0);
float sMoney = money - outComeMonth;//预算剩余
topbudgetTv.setText("¥ " + sMoney);
});
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)