3/12每日总结-每日打卡app

所花时间:3小时

代码量:如下

博客量:本学期截至目前18篇

了解到的知识点:app的掌握

经过几天的努力我完成了个人作业每日打卡app,以下是部分项目源码和app打卡截图。

Bean :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package Bean;
public class User {
        private int id;
        private String name;
        private String password;
        private String names;
        private String tel;
        private String classs;
 
        public User(String name, String password, String names, String tel, String classs) {
            this.name = name;
            this.password = password;
            this.names = names;
            this.tel = tel;
            this.classs = classs;
        }
 
        public int getId() {
            return id;
        }
 
        public void setId(int id) {
            this.id = id;
        }
 
        public String getName() {
            return name;
        }
 
        public void setName(String name) {
            this.name = name;
        }
 
        public String getPassword() {
            return password;
        }
 
        public void setPassword(String password) {
            this.password = password;
        }
 
        public String getNames() {
            return names;
        }
 
        public void setNames(String names) {
            this.names = names;
        }
 
        public String getTel() {
            return tel;
        }
 
        public void setTel(String tel) {
            this.tel = tel;
        }
 
        public String getClasss() {
            return classs;
        }
 
        public void setClasss(String classs) {
            this.classs = classs;
        }
 
        @Override
        public String toString() {
            return "User{" +
                    "id=" + id +
                    ", name='" + name + '\'' +
                    ", password='" + password + '\'' +
                    ", names='" + names + '\'' +
                    ", tel='" + tel + '\'' +
                    ", classs='" + classs + '\'' +
                    '}';
        }
    }

  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package Bean;
    public class User1 {
        private String date;    //日期
        private String keys;    //关键字
        private String summarize;   //每日总结
        private String day;     //坚持天数
        private String maxday;  //连续最长天数
 
        public String getDate() {
            return date;
        }
 
        public void setDate(String date) {
            this.date = date;
        }
 
        public String getKeys() {
            return keys;
        }
 
        public void setKeys(String keys) {
            this.keys = keys;
        }
 
        public String getSummarize() {
            return summarize;
        }
 
        public void setSummarize(String summarize) {
            this.summarize = summarize;
        }
 
        public String getDay() {
            return day;
        }
 
        public void setDay(String day) {
            this.day = day;
        }
 
        public String getMaxday() {
            return maxday;
        }
 
        public void setMaxday(String maxday) {
            this.maxday = maxday;
        }
 
        public User1(String date, String keys, String summarize, String day, String maxday) {
            this.date = date;
            this.keys = keys;
            this.summarize = summarize;
            this.day = day;
            this.maxday = maxday;
        }
 
        @Override
        public String toString() {
            return "Punch{" +
                    "date='" + date + '\'' +
                    ", keys='" + keys + '\'' +
                    ", summarize='" + summarize + '\'' +
                    ", day='" + day + '\'' +
                    ", maxday='" + maxday + '\'' +
                    '}';
        }
    }

  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.example.riji;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
 
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
 
public class Alarm extends AppCompatActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_alarm);
        Intent intent=new Intent();
        intent=getIntent();
        String nao = intent.getStringExtra("nao");
        //创建一个闹钟提醒的对话框,点击确定关闭铃声与页面
        new AlertDialog.Builder(Alarm.this).setTitle("闹钟").setMessage(nao)
                .setPositiveButton("关闭闹铃", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        Alarm.this.finish();
                    }
                }).show();
    }
        }

  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package com.example.riji;
/*
 * 初始界面
 * */
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import db.DatabaseHelper;
import Bean.User;
import java.util.ArrayList;
public class Login extends AppCompatActivity implements View.OnClickListener {
    private int ll;
    private int i;
    private Button btn_login, btn_register;
    private EditText ed_name, ed_password;
    private DatabaseHelper mSQLite;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        init();
        findViewById(R.id.rb_stu).setOnClickListener(Login.this);
        findViewById(R.id.rb_teacher).setOnClickListener(Login.this);
//        登录
//        登录
        btn_login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String name = ed_name.getText().toString().trim();
                String password = ed_password.getText().toString().trim();
                ArrayList<User> data = mSQLite.getAllDATA();
                boolean flag = false;
                for (int i = 0; i < data.size(); i++) {
                    User userdata = data.get(i);
                    if (name.equals(userdata.getName()) && password.equals(userdata.getPassword())) {
                        flag = true;
                        break;
                    } else {
                        flag = false;
                    }
                }
 
                if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(password)) {
                    if (flag) {
 
                        if (ll == 1) {
                            Intent intent2 = new Intent(Login.this,MainActivity.class);
                            startActivity(intent2);
                            finish();
                            Toast.makeText(Login.this, "登录成功", Toast.LENGTH_SHORT).show();
                        } else if (ll == 0) {
                            Intent intent1 = new Intent(Login.this,cha.class);
                            startActivity(intent1);
                            finish();
                            Toast.makeText(Login.this, "登录成功", Toast.LENGTH_SHORT).show();
                        }
                    } else {
                        Toast.makeText(Login.this, "用户名或密码不正确", Toast.LENGTH_SHORT).show();
                    }
                } else {
                    Toast.makeText(Login.this, "用户名与密码不能为空", Toast.LENGTH_SHORT).show();
                }
            }
        });
 
 
//        注册
        btn_register.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent2 = new Intent(Login.this, Register.class);
                startActivity(intent2);
                finish();
            }
        });
        mSQLite = new DatabaseHelper(Login.this);
    }
 
    private void init() {
        btn_login = findViewById(R.id.main_bu_deng);
        btn_register = findViewById(R.id.main_bu_zhu);
        ed_name = findViewById(R.id.main_et_zhang);
        ed_password = findViewById(R.id.main_et_password);
 
    }
 
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.rb_stu:
                ll = 1;
                break;
            case R.id.rb_teacher:
                ll = 0;
                break;
        }
    }
}

  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.example.riji;
/*
 * 显示数据的主界面
 * */
 
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
//        查询控件
        ImageView im_back = findViewById(R.id.zhu_iv_back);
        Button bt_record = findViewById(R.id.zhu_bt_record);
        Button bt_alarm = findViewById(R.id.zhu_bt_alarm);
        Button bt_query = findViewById(R.id.zhu_bt_query);
//        进入主界面
 
//      返回登录界面
        im_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, Login.class);
                startActivity(intent);
                finish();
            }
        });
 
//      进入闹钟界面
        bt_alarm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent2 = new Intent(MainActivity.this,AlarmReceiver.class);
                startActivity(intent2);
            }
        });
 
//        进入打卡界面
        bt_record.setOnClickListener(new View.OnClickListener() {
 
            @Override
            public void onClick(View v) {
                Intent intent1 = new Intent(MainActivity.this, daka.class);
                startActivity(intent1);
            }
        });
 
//        进入查询界面
        bt_query.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent5 = new Intent(MainActivity.this, cha.class);
                startActivity(intent5);
            }
        });
    }
}

  

程序运行截图:

 

posted @   南北啊  阅读(6)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
1 2 3
4
点击右上角即可分享
微信分享提示