首页 > 其他分享 >2023年3月6日(软件工程日报)

2023年3月6日(软件工程日报)

时间:2023-03-06 19:14:18浏览次数:56  
标签:String 日报 et 软件工程 mHelper 2023 import android public

今天完成个人作业第一部分内容,其中最长打卡天数未能实现,打卡显示没有完成,在第二阶段会加以完善。

以下为个人代码

java代码方面,包括闹钟设定,登录设定,注册设定,封装类,连接数据库,创建表结构

package com.example.myapplication2;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import android.content.DialogInterface;
import android.os.Bundle;

public class AlarmActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_alarm);
        AlertDialog alert = new AlertDialog.Builder(this).create();
       alert.setTitle("传播正能量");
       alert.setMessage("赶紧摆烂");
       alert.setButton(DialogInterface.BUTTON_POSITIVE, "确定", new DialogInterface.OnClickListener() {
           @Override
           public void onClick(DialogInterface dialogInterface, int i) {}
       });
       alert.show();
    }
}
View Code
package com.example.myapplication2;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class FirstActivity extends AppCompatActivity implements View.OnClickListener {
     private Button btn_clock,btn_time,btn_return;
    private UserDBHelper mHelper;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_first);
        btn_clock = findViewById(R.id.btn_clock);
        btn_time = findViewById(R.id.btn_time);
        btn_return = findViewById(R.id.btn_return);
        btn_clock.setOnClickListener(this);
        btn_time.setOnClickListener(this);
        btn_return.setOnClickListener(this);
    }
    @Override
    protected void onStart() {
        super.onStart();
        mHelper = UserDBHelper.getInstance(this);
        mHelper.openWriteLink();
        mHelper.openReadLink();
    }

    @Override
    protected void onStop() {
        super.onStop();
        mHelper.closeLink();
    }

    @Override
    public void onClick(View view) {
        switch (view.getId())
        {
            case R.id.btn_clock:
                Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
                startActivity(intent);
                break;
            case R.id.btn_time:
                Intent intent1 = new Intent(FirstActivity.this, TimeActivity.class);
                startActivity(intent1);
                break;
            case R.id.btn_return:
                Intent intent2 = new Intent(FirstActivity.this, LoginActivity.class);
                startActivity(intent2);
                break;
        }
    }
}
View Code
package com.example.myapplication2;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.example.myapplication2.Until.ToastUntil;

public class LoginActivity extends AppCompatActivity implements View.OnClickListener {
   private Button btn_regist,btn_login;
    private EditText tv_name, tv_password;
    private UserDBHelper mHelper;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        tv_name = findViewById(R.id.tv_name);
        tv_password = findViewById(R.id.tv_password);
        btn_regist = findViewById(R.id.btn_regist);
        btn_login = findViewById(R.id.btn_login);
        tv_name.setOnClickListener(this);
        tv_password.setOnClickListener(this);
        btn_regist.setOnClickListener(this);
        btn_login.setOnClickListener(this);
    }

    @Override
    protected void onStart() {
        super.onStart();
        mHelper = UserDBHelper.getInstance(this);
        mHelper.openWriteLink();
        mHelper.openReadLink();
    }

    @Override
    protected void onStop() {
        super.onStop();
        mHelper.closeLink();
    }

    @Override
    public void onClick(View view) {
        switch (view.getId())
        {
            case R.id.btn_regist:
                Intent intent = new Intent(LoginActivity.this,RegisteActivity.class);
                startActivity(intent);
            case R.id.btn_login:
                String name = tv_name.getText().toString();
                String password = tv_password.getText().toString();
                if(name.equals("") || password.equals("")) {

                    ToastUntil.show(this, "有输入为空");
                }
                else {
                    if (mHelper.search(name, password) == 0) {
                        ToastUntil.show(this, "账户不存在");
                    } else if (mHelper.search(name, password) == 1) {
                        ToastUntil.show(this, "登录成功");
                        Intent intent1 = new Intent(LoginActivity.this, FirstActivity.class);
                        startActivity(intent1);
                    } else if (mHelper.search(name, password) == 2) {
                        ToastUntil.show(this, "密码错误");
                    }
                }

        }
    }
}
View Code
package com.example.myapplication2;

public class Passage {
    private String usename;
    private String sometime;
    private String essential;
    private String word;
    private String day;

    public Passage() {
    }

    public Passage(String usename, String sometime, String essential, String word, String day) {
        this.usename = usename;
        this.sometime = sometime;
        this.essential = essential;
        this.word = word;
        this.day = day;
    }

    @Override
    public String toString() {
        return "Passage{" +
                "usename='" + usename + '\'' +
                ", sometime='" + sometime + '\'' +
                ", essential='" + essential + '\'' +
                ", word='" + word + '\'' +
                ", day='" + day + '\'' +
                '}';
    }

    public String getUsename() {
        return usename;
    }

    public void setUsename(String usename) {
        this.usename = usename;
    }

    public String getSometime() {
        return sometime;
    }

    public void setSometime(String sometime) {
        this.sometime = sometime;
    }

    public String getEssential() {
        return essential;
    }

    public void setEssential(String essential) {
        this.essential = essential;
    }

    public String getWord() {
        return word;
    }

    public void setWord(String word) {
        this.word = word;
    }

    public String getDay() {
        return day;
    }

    public void setDay(String day) {
        this.day = day;
    }


}
View Code
package com.example.myapplication2;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.example.myapplication2.Until.ToastUntil;

public class RegisteActivity extends AppCompatActivity implements View.OnClickListener {
    private EditText et_name, et_password, et_number, et_phone, et_class;
    private Button btn_registe, btn_cannel;
    private UserDBHelper mHelper;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_registe);
        et_name = findViewById(R.id.et_name);
        et_password = findViewById(R.id.et_password);
        et_number = findViewById(R.id.et_number);
        et_phone = findViewById(R.id.et_phone);
        et_class = findViewById(R.id.et_class);
        findViewById(R.id.et_name).setOnClickListener(this);
        findViewById(R.id.et_password).setOnClickListener(this);
        findViewById(R.id.et_number).setOnClickListener(this);
        findViewById(R.id.et_phone).setOnClickListener(this);
        findViewById(R.id.et_class).setOnClickListener(this);
        findViewById(R.id.btn_registe).setOnClickListener(this);
        findViewById(R.id.btn_cannel).setOnClickListener(this);
    }

    @Override
    protected void onStart() {
        super.onStart();
        mHelper = UserDBHelper.getInstance(this);
        mHelper.openWriteLink();
        mHelper.openReadLink();
    }

    @Override
    protected void onStop() {
        super.onStop();
        mHelper.closeLink();
    }


    @Override
    public void onClick(View view) {
        String name = et_name.getText().toString();
        String password = et_password.getText().toString();
        String number = et_number.getText().toString();
        String phone = et_phone.getText().toString();
        String classt = et_class.getText().toString();
        User user = null;
        switch (view.getId()) {
            case R.id.btn_registe:
                user = new User(name, password, number, phone, classt);
                if(name.equals("") || password.equals("") || number.equals("") || phone.equals("") || classt.equals(""))
                {
                    ToastUntil.show(this, "有输入为空");
                }
                else if (mHelper.search1(name) == 1) {
                    ToastUntil.show(this, "账户存在");
                }
                else if(mHelper.search1(name) == 0)
                {
                    if (mHelper.insert(user) > 0) {
                        ToastUntil.show(this, "添加成功");
                        Intent intent = new Intent(RegisteActivity.this, LoginActivity.class);
                        startActivity(intent);
                    }
                }
                break;
            case R.id.btn_cannel:
                Intent intent = new Intent(RegisteActivity.this,LoginActivity.class);
                startActivity(intent);
        }
    }
}
View Code
package com.example.myapplication2;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.example.myapplication2.Until.ToastUntil;

public class SecondActivity extends AppCompatActivity implements View.OnClickListener {
    private EditText et_usename, et_essential, et_word, et_day, et_sometime;
    private Button btn_add, btn_noadd;
    private UserDBHelp mHelper;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);
        et_usename = findViewById(R.id.et_usename);
        et_essential = findViewById(R.id.et_essential);
        et_word = findViewById(R.id.et_word);
        et_sometime = findViewById(R.id.et_sometime);
        findViewById(R.id.et_usename).setOnClickListener(this);
        findViewById(R.id.et_essential).setOnClickListener(this);
        findViewById(R.id.et_word).setOnClickListener(this);
        findViewById(R.id.et_sometime).setOnClickListener(this);
        findViewById(R.id.btn_add).setOnClickListener(this);
        findViewById(R.id.btn_noadd).setOnClickListener(this);
    }

    @Override
    protected void onStart() {
        super.onStart();
        mHelper = UserDBHelp.getInstance(this);
        mHelper.openWriteLink();
        mHelper.openReadLink();
    }

    @Override
    protected void onStop() {
        super.onStop();
        mHelper.closeLink();
    }


    @Override
    public void onClick(View view) {
        String usename = et_usename.getText().toString();
        String essential = et_essential.getText().toString();
        String word = et_word.getText().toString();
        String sometime = et_sometime.getText().toString();
        String day = String.valueOf(mHelper.search2(usename));
        Passage passage = null;
        switch (view.getId()) {
            case R.id.btn_noadd:
                Intent intent = new Intent(SecondActivity.this, FirstActivity.class);
                startActivity(intent);
                break;
            case R.id.btn_add:
                passage = new Passage(usename, sometime, essential, word, day);
                if(usename.equals("") || essential.equals("") || word.equals("") || sometime.equals(""))
                {
                    ToastUntil.show(this, "有输入为空");
                }
                else {
                    if (mHelper.insert(passage) > 0) {
                        ToastUntil.show(this, "添加成功");
                        Intent intent1 = new Intent(SecondActivity.this, FirstActivity.class);
                        startActivity(intent1);
                    }
                    break;
                }
        }
    }
}
View Code
package com.example.myapplication2;

import androidx.appcompat.app.AppCompatActivity;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TimePicker;
import android.widget.Toast;

import java.util.Calendar;

public class TimeActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_time);
        final TimePicker timePicker = (TimePicker) findViewById(R.id.tv_time);
        timePicker.setIs24HourView(true);
        Button button1 = (Button) findViewById(R.id.btn_times);
        button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(TimeActivity.this,AlarmActivity.class);
                PendingIntent pendingIntent = PendingIntent.getActivity(TimeActivity.this,0,intent,0);
                AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
                Calendar c = Calendar.getInstance();
                c.set(Calendar.HOUR_OF_DAY,timePicker.getCurrentHour());
                c.set(Calendar.MINUTE,timePicker.getCurrentMinute());
                c.set(Calendar.SECOND,0);
                alarm.set(AlarmManager.RTC_WAKEUP,c.getTimeInMillis(),pendingIntent);
                Toast.makeText(TimeActivity.this, "闹钟设置成功", Toast.LENGTH_SHORT).show();
            }
        });
    }
}
View Code
package com.example.myapplication2;

public class User {
    private String name;
    private String password;
    private String number;
    private String classroom;
    private String phone;

    public User() {
    }

    public User(String username, String password, String number, String classroom, String phone) {
        this.name = username;
        this.password = password;
        this.number = number;
        this.classroom = classroom;
        this.phone = phone;
    }

    @Override
    public String toString() {
        return "User{" +
                "username='" + name + '\'' +
                ", password='" + password + '\'' +
                ", number='" + number + '\'' +
                ", classroom='" + classroom + '\'' +
                ", phone='" + phone + '\'' +
                '}';
    }

    public String getUsername() {
        return name;
    }

    public void setUsername(String username) {
        this.name = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getClassroom() {
        return classroom;
    }

    public void setClassroom(String classroom) {
        this.classroom = classroom;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }
}
View Code
package com.example.myapplication2;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class UserDBHelp extends SQLiteOpenHelper {
    private static final String DB_NAME = "note.db";//名字
    private static final String TABLE_NAME = "notes";//名字
    private static final int DB_VERSION = 1;//版本
    private static UserDBHelp mHelper = null;
    private SQLiteDatabase mRDB = null;
    private SQLiteDatabase wRDB = null;
    private UserDBHelp(Context context)
    {
        super(context,DB_NAME,null,DB_VERSION);
    }
    public static UserDBHelp getInstance(Context context)
    {
        if (mHelper == null)
        {
            mHelper = new UserDBHelp(context);
        }
        return  mHelper;
    }
    public  SQLiteDatabase openReadLink()//读连接
    {
        if(mRDB == null || !mRDB.isOpen()) {
            mRDB = mHelper.getReadableDatabase();
        }
        return mRDB;
    }
    public  SQLiteDatabase openWriteLink()//写连接
    {
        if(wRDB == null || !wRDB.isOpen()) {
        }
        return wRDB;
    }
    public void closeLink()
    {
        if(mRDB != null && mRDB.isOpen())
        {
            mRDB.close();
            mRDB = null;
        }
        if(wRDB != null && wRDB.isOpen())
        {
            wRDB.close();
            wRDB = null;
        }
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql1 = "CREATE TABLE IF NOT EXISTS "+TABLE_NAME+" (" + "usename VARCHAR NOT NULL," + "sometime VARCHAR NOT NULL," + "essential VARCHAR NOT NULL," + "word VARCHAR NOT NULL," + "day VARCHAR NOT NULL);";
        db.execSQL(sql1);
    }


    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
    public long insert(Passage passage)
    {
        ContentValues values = new ContentValues();
        values.put("usename",passage.getUsename());
        values.put("sometime",passage.getSometime());
        values.put("essential",passage.getEssential());
        values.put("word",passage.getWord());
        values.put("day",passage.getDay());
        if (wRDB == null)
        {
            wRDB = mHelper.getWritableDatabase();

        }
        return wRDB.insert(TABLE_NAME,null,values);
    }
    public int search2(String usename) {
        int i = 1;
        if (wRDB == null)
        {
            wRDB = mHelper.getReadableDatabase();

        }
        Cursor cursor = wRDB.query("notes", new String[]{"usename"}, "usename=?", new String[]{usename}, null, null, null, null);
        while (cursor.moveToNext()) {
            if (usename.equals(cursor.getString(0))) {
                i++;
            }
        }

        return i;
    }
}
View Code
package com.example.myapplication2;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import com.example.myapplication2.Until.ToastUntil;

public class UserDBHelper extends SQLiteOpenHelper {
    private static final String DB_NAME = "users.db";//名字
    private static final String TABLE_NAME = "enroll";//名字
   // private static final String TABLE_NAME1 = "notes";//名字
    private static final int DB_VERSION = 1;//版本
    private static UserDBHelper mHelper = null;
    private SQLiteDatabase mRDB = null;
    private SQLiteDatabase wRDB = null;
    private UserDBHelper(Context context)
    {
        super(context,DB_NAME,null,DB_VERSION);
    }
    public static UserDBHelper getInstance(Context context)
    {
        if (mHelper == null)
        {
            mHelper = new UserDBHelper(context);
        }
        return  mHelper;
    }
    public  SQLiteDatabase openReadLink()//读连接
    {
        if(mRDB == null || !mRDB.isOpen()) {
            mRDB = mHelper.getReadableDatabase();
        }
        return mRDB;
    }
    public  SQLiteDatabase openWriteLink()//写连接
    {
        if(wRDB == null || !wRDB.isOpen()) {
        }
        return wRDB;
    }
    public void closeLink()
    {
        if(mRDB != null && mRDB.isOpen())
        {
            mRDB.close();
            mRDB = null;
        }
        if(wRDB != null && wRDB.isOpen())
        {
            wRDB.close();
            wRDB = null;
        }
    }
   /* String sql1 = "CREATE TABLE IF NOT EXISTS "+TABLE_NAME1+" (" + "usename VARCHAR NOT NULL," + "sometime VARCHAR NOT NULL," + "essential VARCHAR NOT NULL," + "word VARCHAR NOT NULL," + "day VARCHAR NOT NULL);";
        db.execSQL(sql1);*/
    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql = "CREATE TABLE IF NOT EXISTS "+TABLE_NAME+" (" + "name VARCHAR NOT NULL," + "password VARCHAR NOT NULL," + "number VARCHAR NOT NULL," + "classroom VARCHAR NOT NULL," + "phone VARCHAR NOT NULL);";
        db.execSQL(sql);

    }


    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
    public long insert(User user)
    {
        ContentValues values = new ContentValues();
        values.put("name",user.getUsername());
        values.put("password",user.getPassword());
        values.put("number",user.getNumber());
        values.put("classroom",user.getClassroom());
        values.put("phone",user.getPhone());
        if (wRDB == null)
        {
            wRDB = mHelper.getWritableDatabase();

        }
        return wRDB.insert(TABLE_NAME,null,values);
    }
       public int search(String name,String password) {
        int i = 0;
           if (wRDB == null)
           {
               wRDB = mHelper.getReadableDatabase();

           }
        Cursor cursor = wRDB.query("enroll", new String[]{"password"}, "name=?", new String[]{name}, null, null, null, null);
        while (cursor.moveToNext()) {
        if (password.equals(cursor.getString(0))) {
            i = 1;

        } else {
            i = 2;

        }
    }

    return i;
}
    public int search1(String name) {
        int i = 0;
        if (wRDB == null)
        {
            wRDB = mHelper.getReadableDatabase();

        }
        Cursor cursor = wRDB.query("enroll", new String[]{"name"}, "name=?", new String[]{name}, null, null, null, null);
        while (cursor.moveToNext()) {
            if (name.equals(cursor.getString(0))) {
                i = 1;
            }
        }

        return i;
    }

}
View Code

xml方面

包括登录界面,注册界面,闹钟提醒界面,打卡界面

<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <Button
            android:id="@+id/btn_clock"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="打卡" />
        <Button
            android:id="@+id/btn_time"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="定时" />
        <Button
            android:id="@+id/btn_return"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="返回登录界面" />

    </LinearLayout>
</LinearLayout>
View Code
<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:orientation="horizontal">
            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="0.3"
                android:gravity="center"
                android:textSize="18dp"
                android:text="用户名:"/>
            <EditText
                android:id="@+id/tv_name"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_marginRight="20dp"/>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:orientation="horizontal">
            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:textSize="18dp"
                android:layout_weight="0.3"
                android:text="密    码:"/>
            <EditText
                android:id="@+id/tv_password"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:inputType="textPassword"
                android:layout_weight="1"
                android:layout_marginRight="20dp"
                />
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
            <Button
                android:id="@+id/btn_login"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_margin="5dp"
                android:text="登录"
                />
            <Button
                android:id="@+id/btn_regist"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_margin="5dp"
                android:text="注册"
                />
        </LinearLayout>
    </LinearLayout>


</LinearLayout>
View Code
<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <!-- 用户名部分 -->
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="用户名:" />

        <EditText
            android:id="@+id/et_name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="密 码:"
            />

        <EditText
            android:id="@+id/et_password"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textPassword"

            />
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="学号:" />

        <EditText
            android:id="@+id/et_number"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="手机号:" />

        <EditText
            android:id="@+id/et_phone"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />
        <!-- 密码部分 -->

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="用户班级"
            />

        <EditText
            android:id="@+id/et_class"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />
        <Button
            android:id="@+id/btn_registe"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="注册" />
        <Button
            android:id="@+id/btn_cannel"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="取消" />

    </LinearLayout>
</LinearLayout>
View Code
<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <!-- 用户名部分 -->
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="学号:" />
        <EditText
            android:id="@+id/et_usename"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="时间:" />
        <EditText
            android:id="@+id/et_sometime"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="关键字:" />

        <EditText
            android:id="@+id/et_essential"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="总结:" />
        <EditText
            android:id="@+id/et_word"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />
        <Button
            android:id="@+id/btn_add"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="增加" />
        <Button
            android:id="@+id/btn_noadd"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="返回" />

    </LinearLayout>
</LinearLayout>
View Code
<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".TimeActivity">
<TimePicker
    android:id="@+id/tv_time"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    />
    <Button
        android:id="@+id/btn_times"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="设置闹钟"
        />
</LinearLayout>
View Code

以上为第一阶段所有代码

在第二阶段的代码会在之后的的日报中更新

标签:String,日报,et,软件工程,mHelper,2023,import,android,public
From: https://www.cnblogs.com/ewqewq/p/17185004.html

相关文章

  • 每日总结2023/3/6(安卓连接mysql)
    更换网络需要更改ip如何查找自己ip?cmd-输入ipconfig  先上结果   原文链接(26条消息)mysql5.7.35安装配置教程【超级详细安装教程】_qq-1438608594的博客-......
  • 2023,大前端技术趋势及小程序未来分析
    几个月前,小程序游戏“羊了个羊”大火、一时间和“老板每天赚468万全款买两套豪宅”的消息在网上引爆了网络。回望,小程序被视为互联网流量的存量时代;流量变现“全村的希望”......
  • 20230306
    68269AC0-B82A-34DF-63BD-8D0E38AA96513F9DA294-72DC-E2A5-4F4E-DCEE6D0BC7F8BB385073-2B96-3F78-13C9-D4CFA1985A47F5346E12-4637-48EB-D87F-176046A11A3593553B63-37......
  • hutool XML反序列化漏洞(CVE-2023-24162)
    漏洞简介Hutool中的XmlUtil.readObjectFromXml方法直接封装调用XMLDecoder.readObject解析xml数据,当使用readObjectFromXml去处理恶意的XML字符串时会造成任意代......
  • 2023 NOI 春季测试
    2023NOI春季测试T1不再赘述。P9118[春季测试2023]幂次【民间数据】考场上没判k巨大的情况。\(n\le10^{18}\),所以当\(b\ge3\)时就有\(a\le10^6\)了。考虑......
  • 2023.3.6软件工程日报
    所花时间:3小时 代码量:100行 博客量:1 今天由于课上验收加了0.5分日期为2023.3.6    此外看了其他优秀同学的作品,深感自己的差距,感觉应该更细化业务逻辑......
  • 【游记】NOI2023春测 VP 记
    游记趁着有空就做了一下,考前听说好多省预估一等线\(300+\)表示相当震惊。开始做题啦~一看\(T1\)感觉直接倒序然后暴力染色复杂度大概就是\(O(nm)\)的,但是写起来有......
  • 抢先看!界面控件DevExtreme 2023产品路线图曝光
    DevExtreme拥有高性能的HTML5/JavaScript小部件集合,使您可以利用现代Web开发堆栈(包括React,Angular,ASP.NETCore,jQuery,Knockout等)构建交互式的Web应用程序,该套件附带功能......
  • 英语 2023-3-6
    Television,sinceitsfirstprevalenceoverradiointhe1950s,hasplayedamoreandmoreimportantroleinpeople'slives,Asamatteroffact,ithasbecomes......
  • C++学生成绩管理系统[2023-03-06]
    C++学生成绩管理系统[2023-03-06]C++课程设计说明参与专业信息和数学专业所有学生时间安排完成需求分析、类设计以及代码的实现答辩注意:答辩未过的需要参加下届C++......