添加日程和课程表

pull/13/head
Dai 4 years ago
parent f27fd32235
commit bb177f62a1

@ -0,0 +1,56 @@
package com.diary.showme.Course;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.diary.showme.R;
public class AddCourseActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_course);
setFinishOnTouchOutside(false);
final EditText inputCourseName = (EditText) findViewById(R.id.course_name);
final EditText inputTeacher = (EditText) findViewById(R.id.teacher_name);
final EditText inputClassRoom = (EditText) findViewById(R.id.class_room);
final EditText inputDay = (EditText) findViewById(R.id.week);
final EditText inputStart = (EditText) findViewById(R.id.classes_begin);
final EditText inputEnd = (EditText) findViewById(R.id.classes_ends);
final EditText inputWeeks = (EditText) findViewById(R.id.weeks);
Button okButton = (Button) findViewById(R.id.button);
okButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String courseName = inputCourseName.getText().toString();
String teacher = inputTeacher.getText().toString();
String classRoom = inputClassRoom.getText().toString();
String day = inputDay.getText().toString();
String start = inputStart.getText().toString();
String end = inputEnd.getText().toString();
String weeks = inputWeeks.getText().toString();
if (courseName.equals("") || day.equals("") || start.equals("") || end.equals("")) {
Toast.makeText(AddCourseActivity.this, "基本课程信息未填写", Toast.LENGTH_SHORT).show();
} else {
Course course = new Course(courseName, teacher, classRoom,
Integer.valueOf(day), Integer.valueOf(start), Integer.valueOf(end), weeks);
Intent intent = new Intent(AddCourseActivity.this, CourseActivity.class);
intent.putExtra("course", course);
setResult(Activity.RESULT_OK, intent);
finish();
}
}
});
}
}

@ -0,0 +1,81 @@
package com.diary.showme.Course;
import java.io.Serializable;
public class Course implements Serializable {
private String courseName;
private String teacher;
private String classRoom;
private int day;
private int classStart;
private int classEnd;
private String weeks;
public Course(String courseName, String teacher, String classRoom, int day, int classStart, int classEnd, String weeks) {
this.courseName = courseName;
this.teacher = teacher;
this.classRoom = classRoom;
this.day = day;
this.classStart = classStart;
this.classEnd = classEnd;
this.weeks = weeks;
}
public String getCourseName() {
return courseName;
}
public void setCourseName(String courseName) {
this.courseName = courseName;
}
public String getTeacher() {
return teacher;
}
public void setTeacher(String teacher) {
this.teacher = teacher;
}
public String getClassRoom() {
return classRoom;
}
public void setClassRoom(String classRoom) {
this.classRoom = classRoom;
}
public int getDay() {
return day;
}
public void setDay(int day) {
this.day = day;
}
public int getStart() {
return classStart;
}
public void setStart(int classStart) {
this.classEnd = classStart;
}
public int getEnd() {
return classEnd;
}
public void setEnd(int classEnd) {
this.classEnd = classEnd;
}
public String getWeeks() {
return weeks;
}
public void setWeeks(String weeks) {
this.weeks = weeks;
}
}

@ -0,0 +1,171 @@
package com.diary.showme.Course;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.diary.database.DatabaseHelper.CourseSQLHelper;
import com.diary.database.utils.CourseSQLUtils;
import com.diary.showme.R;
import java.util.ArrayList;
public class CourseActivity extends AppCompatActivity {
private RelativeLayout day;
private Button addCourse;
private Button backToCalendar;
//SQLite Helper类
private CourseSQLHelper databaseHelper = new CourseSQLHelper(this);
int currentCoursesNumber = 0;
int maxCoursesNumber = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_course);
//从数据库读取数据
addCourse = findViewById(R.id.add_courses);
backToCalendar = findViewById(R.id.back_to_calendar);
addCourse.setOnClickListener(v -> {
Intent intent = new Intent(CourseActivity.this, AddCourseActivity.class);
startActivityForResult(intent, 0);
});
backToCalendar.setOnClickListener(v -> finish());
loadData();
}
private void loadData() {
ArrayList<Course> coursesList = new ArrayList<>(); //课程列表
SQLiteDatabase courseSQL = databaseHelper.getReadableDatabase();
Cursor cursor = courseSQL.rawQuery("select * from courses", null);
if (cursor.moveToFirst()) {
do {
coursesList.add(new Course(
cursor.getString(cursor.getColumnIndex("course_name")),
cursor.getString(cursor.getColumnIndex("teacher")),
cursor.getString(cursor.getColumnIndex("class_room")),
cursor.getInt(cursor.getColumnIndex("day")),
cursor.getInt(cursor.getColumnIndex("class_start")),
cursor.getInt(cursor.getColumnIndex("class_end")),
cursor.getString(cursor.getColumnIndex("weeks"))));
} while(cursor.moveToNext());
}
cursor.close();
//使用从数据库读取出来的课程信息来加载课程表视图
for (Course course : coursesList) {
createLeftView(course);
createItemCourseView(course);
}
}
//创建"第几节数"视图
private void createLeftView(Course course) {
int endNumber = course.getEnd();
if (endNumber > maxCoursesNumber) {
for (int i = 0; i < endNumber-maxCoursesNumber; i++) {
View view = LayoutInflater.from(this).inflate(R.layout.course_left_view, null);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(110,180);
view.setLayoutParams(params);
TextView text = view.findViewById(R.id.class_number_text);
text.setText(String.valueOf(++currentCoursesNumber));
LinearLayout leftViewLayout = findViewById(R.id.left_view_layout);
leftViewLayout.addView(view);
}
maxCoursesNumber = endNumber;
}
}
//创建单个课程视图
private void createItemCourseView(final Course course) {
int getDay = course.getDay();
if ((getDay < 1 || getDay > 7) || course.getStart() > course.getEnd())
Toast.makeText(this, "星期几没写对,或课程结束时间比开始时间还早~~", Toast.LENGTH_LONG).show();
else {
int dayId = 0;
switch (getDay) {
case 1: dayId = R.id.monday; break;
case 2: dayId = R.id.tuesday; break;
case 3: dayId = R.id.wednesday; break;
case 4: dayId = R.id.thursday; break;
case 5: dayId = R.id.friday; break;
case 6: dayId = R.id.saturday; break;
case 7: dayId = R.id.weekday; break;
}
day = findViewById(dayId);
int height = 180;
final View v = LayoutInflater.from(this).inflate(R.layout.course_card, null); //加载单个课程布局
v.setY(height * (course.getStart()-1)); //设置开始高度,即第几节课开始
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams
(ViewGroup.LayoutParams.MATCH_PARENT,(course.getEnd()-course.getStart()+1)*height - 8); //设置布局高度,即跨多少节课
v.setLayoutParams(params);
TextView text = v.findViewById(R.id.text_view);
text.setText(course.getCourseName() + "\n" + course.getTeacher() + "\n" + course.getClassRoom() + "\n" + course.getWeeks() ); //显示课程名
day.addView(v);
//长按删除课程
v.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
v.setVisibility(View.GONE);//先隐藏
day.removeView(v);//再移除课程视图
SQLiteDatabase sqLiteDatabase = databaseHelper.getWritableDatabase();
sqLiteDatabase.execSQL("delete from courses where course_name = ?", new String[] {course.getCourseName()});
return true;
}
});
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 0 && resultCode == Activity.RESULT_OK && data != null) {
Course course = (Course) data.getSerializableExtra("course");
//创建课程表左边视图(节数)
createLeftView(course);
//创建课程表视图
createItemCourseView(course);
//存储数据到数据库
saveData(course);
}
}
//保存数据到数据库
private void saveData(Course course) {
SQLiteDatabase sqLiteDatabase = databaseHelper.getWritableDatabase();
sqLiteDatabase.execSQL
("insert into courses(course_name, teacher, class_room, day, class_start, class_end, weeks) " + "values(?, ?, ?, ?, ?, ?, ?)",
new String[] {course.getCourseName(),
course.getTeacher(),
course.getClassRoom(),
course.getDay()+"",
course.getStart()+"",
course.getEnd()+"",
course.getWeeks()}
);
}
}

@ -0,0 +1,139 @@
package com.diary.showme.Schedule;
import android.app.Activity;
import android.content.ContentValues;
import android.content.Context;
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 android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.diary.database.DatabaseHelper.ScheduleSQLHelper;
import com.diary.showme.R;
public class AddScheduleActivity extends AppCompatActivity implements View.OnClickListener{
private EditText scheduleNameInput;
private EditText schedulePlaceInput;
private EditText scheduleStartHourInput;
private EditText scheduleStartMinInput;
private EditText scheduleEndHourInput;
private EditText scheduleEndMinInput;
private Button checkAdd1;
private ScheduleSQLHelper mySQLiteOpenHelper;
private SQLiteDatabase myDatabase;
private Context context;
private TextView mySchedule2;
private String date;
private Integer cnt=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_schedule_add);
initView();
}
private void initView() {
mySQLiteOpenHelper = new ScheduleSQLHelper(this);
myDatabase = mySQLiteOpenHelper.getWritableDatabase();
context = this;
scheduleNameInput = findViewById(R.id.scheduleNameInput);
schedulePlaceInput = findViewById(R.id.schedulePlaceInput);
scheduleStartHourInput = findViewById(R.id.scheduleStartHourInput);
scheduleStartMinInput = findViewById(R.id.scheduleStartMinInput);
scheduleEndHourInput = findViewById(R.id.scheduleEndHourInput);
scheduleEndMinInput = findViewById(R.id.scheduleEndMinInput);
checkAdd1 = findViewById(R.id.checkAdd1);
checkAdd1.setOnClickListener(this);
mySchedule2 = findViewById(R.id.schedule2);
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.checkAdd1:
ContentValues values = new ContentValues();
Intent intent = getIntent();
date = intent.getStringExtra("date");
Integer cnt1=0;
if(scheduleNameInput.getText().toString().equals("")){
Toast.makeText(this, "日程标题未填写", Toast.LENGTH_SHORT).show();
}else if((scheduleStartHourInput.getText().toString().equals("") && !scheduleStartMinInput.getText().toString().equals("")) || (!scheduleStartHourInput.getText().toString().equals("") && scheduleStartMinInput.getText().toString().equals(""))){
Toast.makeText(this, "开始时间未填写完全", Toast.LENGTH_SHORT).show();
}else if((scheduleEndHourInput.getText().toString().equals("") && !scheduleEndMinInput.getText().toString().equals("")) || (!scheduleEndHourInput.getText().toString().equals("") && scheduleEndMinInput.getText().toString().equals(""))){
Toast.makeText(this, "结束时间未填写完全", Toast.LENGTH_SHORT).show();
}else if(!scheduleStartHourInput.getText().toString().equals("") && !scheduleStartMinInput.getText().toString().equals("") && !scheduleEndHourInput.getText().toString().equals("") && !scheduleEndMinInput.getText().toString().equals("")){
if(Integer.parseInt(scheduleEndHourInput.getText().toString())<Integer.parseInt(scheduleStartHourInput.getText().toString())){
Toast.makeText(this, "时间输入不合法", Toast.LENGTH_SHORT).show();
cnt1+=1;
}
if(Integer.parseInt(scheduleEndHourInput.getText().toString())==Integer.parseInt(scheduleStartHourInput.getText().toString()) && Integer.parseInt(scheduleEndMinInput.getText().toString())<Integer.parseInt(scheduleStartMinInput.getText().toString()) && cnt==0){
Toast.makeText(this, "时间输入不合法", Toast.LENGTH_SHORT).show();
cnt1+=1;
}
if(Integer.parseInt(scheduleStartHourInput.getText().toString())<0 || Integer.parseInt(scheduleStartHourInput.getText().toString())>24){
Toast.makeText(this, "开始时输入不合法", Toast.LENGTH_SHORT).show();
cnt1+=1;
}
if(Integer.parseInt(scheduleStartMinInput.getText().toString())<0 || Integer.parseInt(scheduleStartMinInput.getText().toString())>60){
Toast.makeText(this, "开始分输入不合法", Toast.LENGTH_SHORT).show();
cnt1+=1;
}
if(Integer.parseInt(scheduleEndHourInput.getText().toString())<0 || Integer.parseInt(scheduleEndHourInput.getText().toString())>24){
Toast.makeText(this, "结束时输入不合法", Toast.LENGTH_SHORT).show();
cnt1+=1;
}
if(Integer.parseInt(scheduleEndMinInput.getText().toString())<0 || Integer.parseInt(scheduleEndMinInput.getText().toString())>60){
Toast.makeText(this, "结束分输入不合法", Toast.LENGTH_SHORT).show();
cnt1+=1;
}
if(cnt1==0){
cnt=1;
}
}else{
cnt = 1;
}
if(cnt==1) {
//第一个参数是表中的列名
values.put("scheduleName", scheduleNameInput.getText().toString());
if(schedulePlaceInput.getText().toString().equals("")){
values.put("ifSchedulePlace", 0);
}else {
values.put("ifSchedulePlace", 1);
}
if(scheduleStartHourInput.getText().toString().equals("") && scheduleStartMinInput.getText().toString().equals("")){
values.put("ifStartTime", 0);
}else {
values.put("ifStartTime", 1);
}
if(scheduleEndHourInput.getText().toString().equals("") && scheduleEndMinInput.getText().toString().equals("")){
values.put("ifEndTime", 0);
}else {
values.put("ifEndTime", 1);
}
values.put("schedulePlace", schedulePlaceInput.getText().toString());
values.put("startTime", scheduleStartHourInput.getText().toString() + ":" + scheduleStartMinInput.getText().toString());
values.put("endTime", scheduleEndHourInput.getText().toString() + ":" + scheduleEndMinInput.getText().toString());
values.put("time", date);
myDatabase.insert("schedules", null, values);
// Intent intent2 = new Intent(AddSchedule.this, MainActivity.class);
// startActivity(intent2);
setResult(Activity.RESULT_OK);
finish();
//queryByDate(date);
break;
}
}
}
}

@ -0,0 +1,199 @@
package com.diary.showme.Schedule;
import android.app.Activity;
import android.content.ContentValues;
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 androidx.appcompat.app.AppCompatActivity;
import com.diary.database.DatabaseHelper.ScheduleSQLHelper;
import com.diary.showme.R;
public class EditScheduleActivity extends AppCompatActivity implements View.OnClickListener{
private Button editBtn,deleteBtn;
private EditText scheduleNameInput;
private EditText schedulePlaceInput;
private EditText scheduleStartHourInput;
private EditText scheduleStartMinInput;
private EditText scheduleEndHourInput;
private EditText scheduleEndMinInput;
private ScheduleSQLHelper mySQLiteOpenHelper;
private SQLiteDatabase myDatabase;
private String scheduleName;
private String date;
private Integer cnt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_schedule_edit);
// 首先获取到意图对象
Intent intent = getIntent();
// 获取到传递过来的姓名
scheduleName = intent.getStringExtra("scheduleName");
//获得时间
date = intent.getStringExtra("date");
initView();
}
private void initView() {
mySQLiteOpenHelper = new ScheduleSQLHelper(this);
myDatabase = mySQLiteOpenHelper.getWritableDatabase();
editBtn = findViewById(R.id.editBtn);
editBtn.setOnClickListener(this);
deleteBtn = findViewById(R.id.deleteSchedule);
deleteBtn.setOnClickListener(this);
Cursor cursor = myDatabase.query("schedules",null,"scheduleName=? and time=?",new String[]{scheduleName,date},null,null,null);
if(cursor.moveToFirst()){
String aScheduleName = cursor.getString(cursor.getColumnIndex("scheduleName"));
String aSchedulePlace = cursor.getString(cursor.getColumnIndex("schedulePlace"));
String aStartTime = cursor.getString(cursor.getColumnIndex("startTime"));
String aEndTime = cursor.getString(cursor.getColumnIndex("endTime"));
Integer ifSchedulePlace = cursor.getInt(cursor.getColumnIndex("ifSchedulePlace"));
Integer ifStartTime = cursor.getInt(cursor.getColumnIndex("ifStartTime"));
Integer ifEndTime = cursor.getInt(cursor.getColumnIndex("ifEndTime"));
String[] aStartTime1; //=aStartTime.split(":");
String[] aEndTime1; //=aEndTime.split(":");
scheduleNameInput = findViewById(R.id.scheduleNameInput);
schedulePlaceInput = findViewById(R.id.schedulePlaceInput);
scheduleStartHourInput = findViewById(R.id.scheduleStartHourInput);
scheduleStartMinInput = findViewById(R.id.scheduleStartMinInput);
scheduleEndHourInput = findViewById(R.id.scheduleEndHourInput);
scheduleEndMinInput = findViewById(R.id.scheduleEndMinInput);
scheduleNameInput.setText(aScheduleName);
if(ifSchedulePlace==1){
schedulePlaceInput.setText(aSchedulePlace);
}
if(ifStartTime == 1) {
aStartTime1=aStartTime.split(":");
scheduleStartHourInput.setText(aStartTime1[0]);
scheduleStartMinInput.setText(aStartTime1[1]);
}
if(ifEndTime == 1) {
aEndTime1=aEndTime.split(":");
scheduleEndHourInput.setText(aEndTime1[0]);
scheduleEndMinInput.setText(aEndTime1[1]);
}
}
}
@Override
public void onClick(View v){
switch (v.getId()){
case R.id.deleteSchedule:
deleteMySchedule();
break;
case R.id.editBtn:
editSchedule();
break;
}
}
private void editSchedule() {
// ContentValues values = new ContentValues();
// values.put("scheduleName",scheduleNameInput.getText().toString());
// values.put("scheduleName",scheduleNameInput.getText().toString());
// values.put("schedulePlace",schedulePlaceInput.getText().toString());
// values.put("startTime",scheduleStartHourInput.getText().toString()+":"+scheduleStartMinInput.getText().toString());
// values.put("endTime",scheduleEndHourInput.getText().toString()+":"+scheduleEndMinInput.getText().toString());
//
// myDatabase.update("schedules",values,"scheduleName=?",new String[]{scheduleName});
//
// Intent intent = new Intent(EditScheduleActivity.this, MainActivity.class);
// startActivity(intent);
ContentValues values = new ContentValues();
Intent intent = getIntent();
Integer cnt1 = 0;
date = intent.getStringExtra("date");
if(scheduleNameInput.getText().toString().equals("")){
Toast.makeText(this, "日程标题未填写", Toast.LENGTH_SHORT).show();
}else if((scheduleStartHourInput.getText().toString().equals("") && !scheduleStartMinInput.getText().toString().equals("")) || (!scheduleStartHourInput.getText().toString().equals("") && scheduleStartMinInput.getText().toString().equals(""))){
Toast.makeText(this, "开始时间未填写完全", Toast.LENGTH_SHORT).show();
}else if((scheduleEndHourInput.getText().toString().equals("") && !scheduleEndMinInput.getText().toString().equals("")) || (!scheduleEndHourInput.getText().toString().equals("") && scheduleEndMinInput.getText().toString().equals(""))){
Toast.makeText(this, "结束时间未填写完全", Toast.LENGTH_SHORT).show();
}else if(!scheduleStartHourInput.getText().toString().equals("") && !scheduleStartMinInput.getText().toString().equals("") && !scheduleEndHourInput.getText().toString().equals("") && !scheduleEndMinInput.getText().toString().equals("")){
if(Integer.parseInt(scheduleEndHourInput.getText().toString())<Integer.parseInt(scheduleStartHourInput.getText().toString())){
Toast.makeText(this, "时间输入不合法", Toast.LENGTH_SHORT).show();
cnt1+=1;
}
if(Integer.parseInt(scheduleEndHourInput.getText().toString())==Integer.parseInt(scheduleStartHourInput.getText().toString()) && Integer.parseInt(scheduleEndMinInput.getText().toString())<Integer.parseInt(scheduleStartMinInput.getText().toString()) && cnt==0){
Toast.makeText(this, "时间输入不合法", Toast.LENGTH_SHORT).show();
cnt1+=1;
}
if(Integer.parseInt(scheduleStartHourInput.getText().toString())<0 || Integer.parseInt(scheduleStartHourInput.getText().toString())>24){
Toast.makeText(this, "开始时输入不合法", Toast.LENGTH_SHORT).show();
cnt1+=1;
}
if(Integer.parseInt(scheduleStartMinInput.getText().toString())<0 || Integer.parseInt(scheduleStartMinInput.getText().toString())>60){
Toast.makeText(this, "开始分输入不合法", Toast.LENGTH_SHORT).show();
cnt1+=1;
}
if(Integer.parseInt(scheduleEndHourInput.getText().toString())<0 || Integer.parseInt(scheduleEndHourInput.getText().toString())>24){
Toast.makeText(this, "结束时输入不合法", Toast.LENGTH_SHORT).show();
cnt1+=1;
}
if(Integer.parseInt(scheduleEndMinInput.getText().toString())<0 || Integer.parseInt(scheduleEndMinInput.getText().toString())>60){
Toast.makeText(this, "结束分输入不合法", Toast.LENGTH_SHORT).show();
cnt1+=1;
}
if(cnt1==0){
cnt=1;
}
}else{
cnt = 1;
}
if(cnt==1) {
//第一个参数是表中的列名
values.put("scheduleName", scheduleNameInput.getText().toString());
if (schedulePlaceInput.getText().toString().equals("")) {
values.put("ifSchedulePlace", 0);
} else {
values.put("ifSchedulePlace", 1);
}
if (scheduleStartHourInput.getText().toString().equals("") && scheduleStartMinInput.getText().toString().equals("")) {
values.put("ifStartTime", 0);
} else {
values.put("ifStartTime", 1);
}
if (scheduleEndHourInput.getText().toString().equals("") && scheduleEndMinInput.getText().toString().equals("")) {
values.put("ifEndTime", 0);
} else {
values.put("ifEndTime", 1);
}
values.put("schedulePlace", schedulePlaceInput.getText().toString());
values.put("startTime", scheduleStartHourInput.getText().toString() + ":" + scheduleStartMinInput.getText().toString());
values.put("endTime", scheduleEndHourInput.getText().toString() + ":" + scheduleEndMinInput.getText().toString());
values.put("time", date);
// myDatabase.insert("schedules", null, values);
myDatabase.update("schedules",values,"scheduleName=?",new String[]{scheduleName});
// Intent intent2 = new Intent(AddSchedule.this, MainActivity.class);
// startActivity(intent2);
finish();
}
}
private void deleteMySchedule() {
myDatabase.delete("schedules","scheduleName=?",new String[]{scheduleName});
finish();
}
@Override
public void finish() {
setResult(Activity.RESULT_OK);
super.finish();
}
}

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_gravity="center"
android:scrollbars="vertical"
android:scrollbarAlwaysDrawHorizontalTrack="true">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="\n课程名:" />
<EditText
android:id="@+id/course_name"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:imeOptions="actionNext"
android:singleLine="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="\n星期几:" />
<EditText
android:id="@+id/week"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:inputType="number" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="\n第几节课开始:" />
<EditText
android:id="@+id/classes_begin"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:inputType="number" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="\n第几节课结束:" />
<EditText
android:id="@+id/classes_ends"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:inputType="number" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="\n周次:" />
<EditText
android:id="@+id/weeks"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:imeOptions="actionNext"
android:singleLine="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="\n教师名:" />
<EditText
android:id="@+id/teacher_name"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:imeOptions="actionNext"
android:singleLine="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="\n课室:" />
<EditText
android:id="@+id/class_room"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:imeOptions="actionNext"
android:singleLine="true" />
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_gravity="center"
android:text="完成" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="\n 在课程表界面长按一个课程可以删除它 \n"/>
</LinearLayout>

@ -0,0 +1,184 @@
<?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"
android:id="@+id/CLayout"
android:orientation="vertical"
android:background="@drawable/bg"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="41dp"
android:orientation="horizontal">
<Button
android:id="@+id/back_to_calendar"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#0D000000"
android:text="返回"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="28"
android:textAlignment="center"
android:textSize="28sp"
android:background="#0D000000"
android:text="课程表" />
<Button
android:id="@+id/add_courses"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#0D000000"
android:text="添加课程"
android:layout_weight="1"/>
</LinearLayout>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!--星期条-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="#0DA993C5">
<TextView
android:layout_width="120px"
android:layout_height="match_parent"
android:gravity="center"
android:text="节/周"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="周一"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="周二"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="周三"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="周四"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="周五"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="周六"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="周日"/>
</LinearLayout>
<!--课程表-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--左侧"节数"布局-->
<LinearLayout
android:id="@+id/left_view_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"/>
<!--星期一到星期天的布局-->
<RelativeLayout
android:id="@+id/monday"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:layout_margin="1dp"/>
<RelativeLayout
android:id="@+id/tuesday"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:layout_margin="1dp"/>
<RelativeLayout
android:id="@+id/wednesday"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:layout_margin="1dp"/>
<RelativeLayout
android:id="@+id/thursday"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:layout_margin="1dp"/>
<RelativeLayout
android:id="@+id/friday"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:layout_margin="1dp"/>
<RelativeLayout
android:id="@+id/saturday"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:layout_margin="1dp"/>
<RelativeLayout
android:id="@+id/weekday"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:layout_marginTop="1dp"
android:layout_marginLeft="1dp"
android:layout_marginBottom="1dp"/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
</ScrollView>
</LinearLayout>

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/addSchedulePage">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:ignore="MissingConstraints">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="@+id/scheduleNameInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入日程"/>
<EditText
android:id="@+id/schedulePlaceInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入地点"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="40dp">
<TextView
android:id="@+id/tv_st"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="18sp"
android:hint="请输入开始时间"
android:gravity="center"/>
<EditText
android:id="@+id/scheduleStartHourInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/tv_st"
android:hint="时"
android:layout_marginLeft="10dp"
android:paddingRight="40dp"
android:inputType="number"/>
<EditText
android:id="@+id/scheduleStartMinInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/scheduleStartHourInput"
android:hint="分"
android:layout_marginLeft="10dp"
android:paddingRight="40dp"
android:inputType="number"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="40dp">
<TextView
android:id="@+id/tv_et"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="18sp"
android:hint="请输入结束时间"
android:gravity="center"/>
<EditText
android:id="@+id/scheduleEndHourInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="时"
android:layout_toRightOf="@id/tv_et"
android:layout_marginLeft="10dp"
android:paddingRight="40dp"
android:inputType="number"/>/>
<EditText
android:id="@+id/scheduleEndMinInput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/scheduleEndHourInput"
android:hint="分"
android:layout_marginLeft="10dp"
android:paddingRight="40dp"
android:inputType="number"/>
</RelativeLayout>
</LinearLayout>
<Button
android:id="@+id/checkAdd1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="确认添加"
android:clickable="true"/>
<TextView
android:id="@+id/schedule2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:clickable="true"
android:textSize="30dp"
android:layout_marginLeft="20dp"/>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="45dp"
android:layout_height="70dp"
android:foreground="?android:attr/selectableItemBackground"
app:cardBackgroundColor="#7feacdd1"
app:cardCornerRadius="7dp">
<TextView
android:id="@+id/text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"/>
</androidx.cardview.widget.CardView>

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="45dp"
android:layout_height="100dp"
android:background="#7fab96c5"
android:orientation="vertical">
<TextView
android:id="@+id/time_start"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:gravity="center"/>
<TextView
android:id="@+id/class_number_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"/>
<TextView
android:id="@+id/time_end"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#7fD5D5D5"
android:layout_alignParentBottom="true"/>
</RelativeLayout>

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/common_title_ll"
android:background="#161414"
android:layout_width="match_parent"
android:layout_height="45dp"
android:orientation="horizontal"
>
<ImageView
android:id="@+id/common_iv_back"
android:paddingLeft="5dp"
android:layout_width="50dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_arrow_back_black_24dp"
/>
<TextView
android:id="@+id/common_tv_title"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="添加日记"
android:textColor="#ffffff"
android:layout_gravity="center"
android:gravity="center"
android:textSize="18sp"
android:textStyle="bold"
/>
<ImageView
android:id="@+id/common_iv_test"
android:layout_width="50dp"
android:layout_height="30dp"
/>
</LinearLayout>

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<paths>
<root-path
name="root"
path="" />
<files-path
name="files"
path="" />
<cache-path
name="cache"
path="" />
<external-path
name="camera_photos"
path="" />
<external-files-path
name="external_file_path"
path="" />
<external-cache-path
name="external_cache_path"
path="" />
</paths>
</resources>
Loading…
Cancel
Save