2024.3.19软件工程日报
学习时间2h
代码量100
package com.example.text_five;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import java.util.Calendar;
public class Main extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main3);
}
public void 打卡记录(View view) {
String account = getIntent().getStringExtra("account");
Intent intent = new Intent(this, View_records.class);
intent.putExtra("account", account);
startActivity(intent);
}
public void 打卡(View view) {
String account = getIntent().getStringExtra("account");
Intent intent = new Intent(this, Clock_in.class);
intent.putExtra("account", account);
startActivity(intent);
}
public void 分析(View view) {
Calendar calendar = Calendar.getInstance();
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
// 判断当前系统日期是否为周五(Calendar.FRIDAY 对应值为6)
if (dayOfWeek == Calendar.FRIDAY) {
String account = getIntent().getStringExtra("account");
Intent intent = new Intent(this, analysis.class);
intent.putExtra("account", account);
startActivity(intent);
} else {
// 如果不是周五,给出提示或者执行其他操作
Toast.makeText(this, "今天不是周五,无法进行下列操作", Toast.LENGTH_SHORT).show();
}
}
public void 目标(View view) {
Calendar calendar = Calendar.getInstance();
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
// 判断当前系统日期是否为周一(Calendar.SUNDAY 对应值为1,Calendar.MONDAY 对应值为2)
if (dayOfWeek == Calendar.MONDAY) {
String account = getIntent().getStringExtra("account");
Intent intent = new Intent(this, target.class);
intent.putExtra("account", account);
startActivity(intent);
} else {
// 如果不是周一,给出提示或者执行其他操作
Toast.makeText(this, "今天不是周一,无法进行下列操作", Toast.LENGTH_SHORT).show();
}
}
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通