From d184f34a67f46234ead273b6f2424e3e1c777474 Mon Sep 17 00:00:00 2001 From: langqingjie <1154192803@qq.com> Date: Thu, 18 Feb 2021 12:38:52 +0800 Subject: [PATCH] code --- SoftEngineering_selectiveCourse/.gitignore | 14 + .../.idea/codeStyles/Project.xml | 164 +++++++ .../.idea/dbnavigator.xml | 461 ++++++++++++++++++ .../.idea/gradle.xml | 21 + .../.idea/jarRepositories.xml | 25 + .../.idea/misc.xml | 9 + .../.idea/runConfigurations.xml | 12 + .../.idea/sonarIssues.xml | 124 +++++ .../.idea/sonarSettings.xml | 10 + .../8c55c3ccc257e5907959013f99656e4c8ec3903e | 0 .../.idea/sonarlint/issuestore/index.pb | 3 + .../app/.gitignore | 1 + .../app/build.gradle | 40 ++ .../app/proguard-rules.pro | 21 + .../ExampleInstrumentedTest.java | 26 + .../app/src/main/AndroidManifest.xml | 30 ++ .../app/src/main/assets/litepal.xml | 10 + .../Comments.java | 46 ++ .../Course.java | 118 +++++ .../CourseBasicInfoActivity.java | 14 + .../CourseRecommendedActivity.java | 280 +++++++++++ .../CourseReviewActivity.java | 14 + .../CourseSelectingActivity.java | 14 + .../Course_ManagerActivity.java | 260 ++++++++++ .../LoginActivity.java | 178 +++++++ .../PersonalBasicInfoActivity.java | 189 +++++++ .../RegisterActivity.java | 108 ++++ .../softengineering_selectivecourse/User.java | 180 +++++++ .../User_ManagerActivity.java | 211 ++++++++ .../drawable-v24/ic_launcher_foreground.xml | 30 ++ .../res/drawable/ic_launcher_background.xml | 170 +++++++ .../res/layout/activity_course__manager.xml | 208 ++++++++ .../res/layout/activity_course_basic_info.xml | 9 + .../layout/activity_course_recommended.xml | 78 +++ .../res/layout/activity_course_review.xml | 9 + .../res/layout/activity_course_selecting.xml | 69 +++ .../src/main/res/layout/activity_login.xml | 131 +++++ .../layout/activity_personal_basic_info.xml | 243 +++++++++ .../src/main/res/layout/activity_register.xml | 79 +++ .../res/layout/activity_user__manager.xml | 127 +++++ .../app/src/main/res/layout/sqlist.xml | 102 ++++ .../app/src/main/res/layout/user_sqlist.xml | 102 ++++ .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 + .../mipmap-anydpi-v26/ic_launcher_round.xml | 5 + .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3593 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 5339 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2636 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 0 -> 3388 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4926 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 0 -> 7472 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 7909 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 0 -> 11873 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 10652 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 16570 bytes .../app/src/main/res/values/colors.xml | 6 + .../app/src/main/res/values/dimens.xml | 5 + .../app/src/main/res/values/strings.xml | 12 + .../app/src/main/res/values/styles.xml | 10 + .../ExampleUnitTest.java | 17 + SoftEngineering_selectiveCourse/build.gradle | 24 + .../gradle.properties | 19 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54329 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + SoftEngineering_selectiveCourse/gradlew | 172 +++++++ SoftEngineering_selectiveCourse/gradlew.bat | 84 ++++ .../settings.gradle | 2 + 66 files changed, 4307 insertions(+) create mode 100644 SoftEngineering_selectiveCourse/.gitignore create mode 100644 SoftEngineering_selectiveCourse/.idea/codeStyles/Project.xml create mode 100644 SoftEngineering_selectiveCourse/.idea/dbnavigator.xml create mode 100644 SoftEngineering_selectiveCourse/.idea/gradle.xml create mode 100644 SoftEngineering_selectiveCourse/.idea/jarRepositories.xml create mode 100644 SoftEngineering_selectiveCourse/.idea/misc.xml create mode 100644 SoftEngineering_selectiveCourse/.idea/runConfigurations.xml create mode 100644 SoftEngineering_selectiveCourse/.idea/sonarIssues.xml create mode 100644 SoftEngineering_selectiveCourse/.idea/sonarSettings.xml create mode 100644 SoftEngineering_selectiveCourse/.idea/sonarlint/issuestore/8/c/8c55c3ccc257e5907959013f99656e4c8ec3903e create mode 100644 SoftEngineering_selectiveCourse/.idea/sonarlint/issuestore/index.pb create mode 100644 SoftEngineering_selectiveCourse/app/.gitignore create mode 100644 SoftEngineering_selectiveCourse/app/build.gradle create mode 100644 SoftEngineering_selectiveCourse/app/proguard-rules.pro create mode 100644 SoftEngineering_selectiveCourse/app/src/androidTest/java/com/example/softengineering_selectivecourse/ExampleInstrumentedTest.java create mode 100644 SoftEngineering_selectiveCourse/app/src/main/AndroidManifest.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/assets/litepal.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/Comments.java create mode 100644 SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/Course.java create mode 100644 SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/CourseBasicInfoActivity.java create mode 100644 SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/CourseRecommendedActivity.java create mode 100644 SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/CourseReviewActivity.java create mode 100644 SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/CourseSelectingActivity.java create mode 100644 SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/Course_ManagerActivity.java create mode 100644 SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/LoginActivity.java create mode 100644 SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/PersonalBasicInfoActivity.java create mode 100644 SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/RegisterActivity.java create mode 100644 SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/User.java create mode 100644 SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/User_ManagerActivity.java create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/drawable-v24/ic_launcher_foreground.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/layout/activity_course__manager.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/layout/activity_course_basic_info.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/layout/activity_course_recommended.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/layout/activity_course_review.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/layout/activity_course_selecting.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/layout/activity_login.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/layout/activity_personal_basic_info.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/layout/activity_register.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/layout/activity_user__manager.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/layout/sqlist.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/layout/user_sqlist.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/mipmap-mdpi/ic_launcher_round.png create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/values/colors.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/values/dimens.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/values/strings.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/main/res/values/styles.xml create mode 100644 SoftEngineering_selectiveCourse/app/src/test/java/com/example/softengineering_selectivecourse/ExampleUnitTest.java create mode 100644 SoftEngineering_selectiveCourse/build.gradle create mode 100644 SoftEngineering_selectiveCourse/gradle.properties create mode 100644 SoftEngineering_selectiveCourse/gradle/wrapper/gradle-wrapper.jar create mode 100644 SoftEngineering_selectiveCourse/gradle/wrapper/gradle-wrapper.properties create mode 100644 SoftEngineering_selectiveCourse/gradlew create mode 100644 SoftEngineering_selectiveCourse/gradlew.bat create mode 100644 SoftEngineering_selectiveCourse/settings.gradle diff --git a/SoftEngineering_selectiveCourse/.gitignore b/SoftEngineering_selectiveCourse/.gitignore new file mode 100644 index 0000000..ebdd23d --- /dev/null +++ b/SoftEngineering_selectiveCourse/.gitignore @@ -0,0 +1,14 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx diff --git a/SoftEngineering_selectiveCourse/.idea/codeStyles/Project.xml b/SoftEngineering_selectiveCourse/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..7fb7384 --- /dev/null +++ b/SoftEngineering_selectiveCourse/.idea/codeStyles/Project.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+
+
\ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/.idea/dbnavigator.xml b/SoftEngineering_selectiveCourse/.idea/dbnavigator.xml new file mode 100644 index 0000000..1ca4006 --- /dev/null +++ b/SoftEngineering_selectiveCourse/.idea/dbnavigator.xml @@ -0,0 +1,461 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/.idea/gradle.xml b/SoftEngineering_selectiveCourse/.idea/gradle.xml new file mode 100644 index 0000000..8708f9d --- /dev/null +++ b/SoftEngineering_selectiveCourse/.idea/gradle.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/.idea/jarRepositories.xml b/SoftEngineering_selectiveCourse/.idea/jarRepositories.xml new file mode 100644 index 0000000..17c8136 --- /dev/null +++ b/SoftEngineering_selectiveCourse/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/.idea/misc.xml b/SoftEngineering_selectiveCourse/.idea/misc.xml new file mode 100644 index 0000000..f797995 --- /dev/null +++ b/SoftEngineering_selectiveCourse/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/.idea/runConfigurations.xml b/SoftEngineering_selectiveCourse/.idea/runConfigurations.xml new file mode 100644 index 0000000..9b770a6 --- /dev/null +++ b/SoftEngineering_selectiveCourse/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/.idea/sonarIssues.xml b/SoftEngineering_selectiveCourse/.idea/sonarIssues.xml new file mode 100644 index 0000000..e719ebb --- /dev/null +++ b/SoftEngineering_selectiveCourse/.idea/sonarIssues.xml @@ -0,0 +1,124 @@ + + + + + + \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/.idea/sonarSettings.xml b/SoftEngineering_selectiveCourse/.idea/sonarSettings.xml new file mode 100644 index 0000000..1466328 --- /dev/null +++ b/SoftEngineering_selectiveCourse/.idea/sonarSettings.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/.idea/sonarlint/issuestore/8/c/8c55c3ccc257e5907959013f99656e4c8ec3903e b/SoftEngineering_selectiveCourse/.idea/sonarlint/issuestore/8/c/8c55c3ccc257e5907959013f99656e4c8ec3903e new file mode 100644 index 0000000..e69de29 diff --git a/SoftEngineering_selectiveCourse/.idea/sonarlint/issuestore/index.pb b/SoftEngineering_selectiveCourse/.idea/sonarlint/issuestore/index.pb new file mode 100644 index 0000000..1193101 --- /dev/null +++ b/SoftEngineering_selectiveCourse/.idea/sonarlint/issuestore/index.pb @@ -0,0 +1,3 @@ + +P + app/src/main/AndroidManifest.xml,8\c\8c55c3ccc257e5907959013f99656e4c8ec3903e \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/app/.gitignore b/SoftEngineering_selectiveCourse/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/app/build.gradle b/SoftEngineering_selectiveCourse/app/build.gradle new file mode 100644 index 0000000..64e9e9c --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/build.gradle @@ -0,0 +1,40 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 30 + buildToolsVersion "30.0.2" + + defaultConfig { + applicationId "com.example.softengineering_selectivecourse" + minSdkVersion 14 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: "libs", include: ["*.jar"]) + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + implementation 'com.google.android.material:material:1.0.0' + implementation 'androidx.annotation:annotation:1.1.0' + implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + implementation 'org.litepal.android:core:1.5.1' + //noinspection GradleCompatible + implementation 'com.android.support:appcompat-v7:27.0.1' + + +} \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/app/proguard-rules.pro b/SoftEngineering_selectiveCourse/app/proguard-rules.pro new file mode 100644 index 0000000..64b4a05 --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/app/src/androidTest/java/com/example/softengineering_selectivecourse/ExampleInstrumentedTest.java b/SoftEngineering_selectiveCourse/app/src/androidTest/java/com/example/softengineering_selectivecourse/ExampleInstrumentedTest.java new file mode 100644 index 0000000..4715ef9 --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/src/androidTest/java/com/example/softengineering_selectivecourse/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.softengineering_selectivecourse; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.example.softengineering_selectivecourse", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/app/src/main/AndroidManifest.xml b/SoftEngineering_selectiveCourse/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a6f3c00 --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/src/main/AndroidManifest.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/app/src/main/assets/litepal.xml b/SoftEngineering_selectiveCourse/app/src/main/assets/litepal.xml new file mode 100644 index 0000000..3c5b078 --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/src/main/assets/litepal.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/Comments.java b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/Comments.java new file mode 100644 index 0000000..5a65ce5 --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/Comments.java @@ -0,0 +1,46 @@ +package com.example.softengineering_selectivecourse; + +import org.litepal.crud.DataSupport; + +public class Comments extends DataSupport { + private int id; + private String comments; + private User provider = new User(); + private Course course = new Course(); + private User.courseIdentification CourseOf; + private Course.userIdentification UserOf; + private float point; + + public Course getCourse() { + return course; + } + + public float getPoint() { + return point; + } + + public String getComments() { + return comments; + } + + public User getProvider() { + return provider; + } + + public void setComments(String comments) { + this.comments = comments; + } + + public void setCourse(Course course) { + this.course = course; + } + + + public void setPoint(float point) { + this.point = point; + } + + public void setProvider(User provider) { + this.provider = provider; + } +} diff --git a/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/Course.java b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/Course.java new file mode 100644 index 0000000..85a6e57 --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/Course.java @@ -0,0 +1,118 @@ +package com.example.softengineering_selectivecourse; + +import org.litepal.crud.DataSupport; + +import java.util.ArrayList; + +public class Course extends DataSupport { + private int id; + + private String name; + private String teacher; + private String classFeature; + private int credit; + private int classtime; + private int NumOfCourseSelected; + private int NumOfCourseNeeded; + private String brief_introduction; + private ArrayList selected = new ArrayList(); + private ArrayList comments = new ArrayList(); + + private ArrayList numOfStuSelected= new ArrayList(); + private ArrayList Comments = new ArrayList(); + + public class userIdentification{ + private int id; + private String name; + } + public ArrayList getComments() { + return comments; + } + + public String getClassFeature() { + return classFeature; + } + + public void setClassFeature(String classFeature) { + this.classFeature = classFeature; + } + + public int getId() { + return id; + } + + public String getName() { + return name; + } + + public ArrayList getSelected() { + return selected; + } + + public int getClasstime() { + return classtime; + } + + public int getCredit() { + return credit; + } + + + public int getNumOfCourseNeeded() { + return NumOfCourseNeeded; + } + + public int getNumOfCourseSelected() { + return NumOfCourseSelected; + } + + public String getBrief_introduction() { + return brief_introduction; + } + + public String getTeacher() { + return teacher; + } + + public void setComments(ArrayList comments) { + this.comments = comments; + } + + public void setId(int id) { + this.id = id; + } + + public void setName(String name) { + this.name = name; + } + + public void setBrief_introduction(String brief_introduction) { + this.brief_introduction = brief_introduction; + } + + public void setClasstime(int classtime) { + this.classtime = classtime; + } + + public void setCredit(int credit) { + this.credit = credit; + } + + + public void setNumOfCourseNeeded(int numOfCourseNeeded) { + NumOfCourseNeeded = numOfCourseNeeded; + } + + public void setNumOfCourseSelected(int numOfCourseSelected) { + NumOfCourseSelected = numOfCourseSelected; + } + + public void setSelected(ArrayList selected) { + this.selected = selected; + } + + public void setTeacher(String teacher) { + this.teacher = teacher; + } + +} diff --git a/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/CourseBasicInfoActivity.java b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/CourseBasicInfoActivity.java new file mode 100644 index 0000000..17066ac --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/CourseBasicInfoActivity.java @@ -0,0 +1,14 @@ +package com.example.softengineering_selectivecourse; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; + +public class CourseBasicInfoActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_course_basic_info); + } +} \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/CourseRecommendedActivity.java b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/CourseRecommendedActivity.java new file mode 100644 index 0000000..a9cd600 --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/CourseRecommendedActivity.java @@ -0,0 +1,280 @@ +package com.example.softengineering_selectivecourse; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.AdapterView; +import android.widget.Button; +import android.widget.ListView; +import android.widget.SimpleAdapter; +import android.widget.TextView; +import android.widget.Toast; + +import org.litepal.crud.DataSupport; +import org.litepal.util.DBUtility; +import org.w3c.dom.Text; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CourseRecommendedActivity extends AppCompatActivity { + private TextView textClikedCourse; + private Button attendCourse; + private Button getCourseDetails; + private ListView lv; + + + + private ArrayList> data;//所有记录 + private Map item; //每一条记录 + private SimpleAdapter listAdapter; //适配器 + View view; + int selCourseId; + long selUserId; + String selUserName; + String selCourseName; + Course selCourse; + String courseTable = DBUtility.getTableNameByClassName(Course.class.getName()); + String userTable = DBUtility.getTableNameByClassName(User.class.getName()); + String commentTable = DBUtility.getTableNameByClassName(Comments.class.getName()); +// classroomTable = DBUtility.getTableNameByClassName(Classroom.class.getName()); +// studentTable = DBUtility.getTableNameByClassName(Student.class.getName()); +// teacherTable = DBUtility.getTableNameByClassName(Teacher.class.getName()); +// idcardTable = DBUtility.getTableNameByClassName(IdCard.class.getName()); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_course_recommended); + Intent intent = getIntent(); + final String userName = intent.getStringExtra("name"); + List users = DataSupport.where("name = ?", userName).find(User.class); + + if (users.isEmpty()) + { + Toast.makeText(CourseRecommendedActivity.this,"发生未知错误,显示详细信息失败",Toast.LENGTH_SHORT).show(); + } + else + { + User user = users.get(0); + selUserId = user.getId(); + selUserName = user.getName(); + + } + + + + getCourseDetails = (Button) findViewById(R.id.buttonCourseRecommendedQueryDetail); + getCourseDetails.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(); + intent.putExtra("name", userName); + intent.putExtra("course", selCourseId); + intent.setClass(CourseRecommendedActivity.this, CourseBasicInfoActivity.class); + startActivity(intent); + } + }); + + lv = (ListView) findViewById(R.id.lv5); + data = new ArrayList>();//将data实例化 + + dbFindAll(); //查询的方法//查询 + + + attendCourse = (Button) findViewById(R.id.buttonCourseRecommendedSelect); + attendCourse.setEnabled(false); + attendCourse.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + CourseAdd(); + dbFindAll(); + textClikedCourse.setText(""); + attendCourse.setEnabled(false); + Toast.makeText(CourseRecommendedActivity.this,"选课成功!",Toast.LENGTH_SHORT).show(); + } + }); + textClikedCourse = (TextView) findViewById(R.id.textCourseRecommendedClikedCourse); +// + lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + Map listItem = (Map)lv.getItemAtPosition(position); + textClikedCourse.setText((String)listItem.get("cname")); + List courses = DataSupport.where("name = ? and id = ?", (String)listItem.get("cname"), listItem.get("cid").toString() ).find(Course.class); + if(courses.isEmpty()) + { + Toast.makeText(CourseRecommendedActivity.this,"can't find the course, some wrong happened",Toast.LENGTH_SHORT).show(); + } + else { + Course course = courses.get(0); + selCourse = course; + selCourseId = course.getId(); + selCourseName = course.getName(); + attendCourse.setEnabled(true); + } + + } + }); + } + private void CourseAdd() + { + User updateUser = new User(); + List users = DataSupport.where("id = ? and name = ?", Long.toString(selUserId), selUserName).find(User.class); + if (users.isEmpty()) + { + Toast.makeText(CourseRecommendedActivity.this,"发生未知错误,显示详细信息失败",Toast.LENGTH_SHORT).show(); + } + else { + User user = users.get(0); + user.getCourse_selected().add(selCourse); + if(user.save()) + { + List userss = DataSupport.where("id = ? and name = ?", Long.toString(selUserId), selUserName).find(User.class); + User xuser = userss.get(0); + + List xcourse = xuser.getCourse_selected(); + if(xcourse.isEmpty()) + { + Log.d("CourseRecommended", Integer.toString(xcourse.size())); + } + } + else + { + Log.d("CourseRecommended", "update lose"); + } +// if (selectedCourse.isEmpty()) +// { +// Log.d("CourseRecommended", "the selectedCourse is empty"); +// } +// else +// { +// User userUpdate = new User(); +// userUpdate.setCourse_selected(selectedCourse); +//// for (Course courseHad: selectedCourse) +//// { +//// userUpdate.getCourse_selected().add(courseHad); +//// } +//// userUpdate.getCourse_selected().add(selCourse); +// +// userUpdate.updateAll("name = ? and id = ? ", selUserName, Long.toString(selUserId)); +// List userss = DataSupport.where("id = ? and name = ?", Long.toString(selUserId), selUserName).find(User.class); +// User xuser = userss.get(0); +// Log.d("CourseRecommended", xuser.getName()); +// ArrayList tt = xuser.getCourse_selected(); +// if(tt.isEmpty()) +// { +// Log.d("CourseRecommended", "the tt is empty"); +// } +// else +// { +// Log.d("CourseRecommended", tt.get(0).getName()); +// } +// } + } + } + private void dbFindAll(){ + data.clear();//防止重复添加,每次清空 + List users = DataSupport.where("id = ? and name = ?", Long.toString(selUserId), selUserName).find(User.class); + if (users.isEmpty()) + { + Toast.makeText(CourseRecommendedActivity.this,"发生未知错误,显示详细信息失败",Toast.LENGTH_SHORT).show(); + } + else + { + User user = users.get(0); + int militaryNotTaken = user.getMilitary_class_NotTaken(); + int natureNotTaken = user.getNaturalScience_class_NotTaken(); + int politicalNotTaken = user.getPolitical_class_NotTaken(); + int humanityNotTaken = user.getHumanity_class_NotTaken(); + List courseMilitary = DataSupport.where("classFeature = ? and credit < ?", "Military", Integer.toString(militaryNotTaken)).find(Course.class); + List courseNature = DataSupport.where("classFeature = ? and credit < ?", "Nature", Integer.toString(natureNotTaken)).find(Course.class); + List coursePolitical = DataSupport.where("classFeature = ? and credit < ?", "Political", Integer.toString(politicalNotTaken)).find(Course.class); + List courseHumanity = DataSupport.where("classFeature = ? and credit < ?", "Humanity", Integer.toString(humanityNotTaken)).find(Course.class); +// List recommendedCourse = ;//TO DO 没有去除已经选择的课程,这是一个重要的不足 +// ArrayList courses = user.getCourse_selected(); + int num = 1; + for (Course course: courseMilitary) + { + int uid = course.getId(); + String uclass = course.getClassFeature(); + String uname = course.getName(); + int ucredit = course.getCredit(); + item = new HashMap(); + item.put("id", num); + item.put("cid", uid); + item.put("cclass", uclass); + item.put("cname", uname); + item.put("ccredit", ucredit); + data.add(item); + num++; + } + + for (Course course: courseNature) + { + int uid = course.getId(); + String uclass = course.getClassFeature(); + String uname = course.getName(); + int ucredit = course.getCredit(); + item = new HashMap(); + item.put("id", num); + item.put("cid", uid); + item.put("cclass", uclass); + item.put("cname", uname); + item.put("ccredit", ucredit); + data.add(item); + num++; + } + for (Course course: coursePolitical) + { + int uid = course.getId(); + String uclass = course.getClassFeature(); + String uname = course.getName(); + int ucredit = course.getCredit(); + item = new HashMap(); + item.put("id", num); + item.put("cid", uid); + item.put("cclass", uclass); + item.put("cname", uname); + item.put("ccredit", ucredit); + data.add(item); + num++; + } + for (Course course: courseHumanity) + { + int uid = course.getId(); + String uclass = course.getClassFeature(); + String uname = course.getName(); + int ucredit = course.getCredit(); + item = new HashMap(); + item.put("id", num); + item.put("cid", uid); + item.put("cclass", uclass); + item.put("cname", uname); + item.put("ccredit", ucredit); + data.add(item); + num++; + } + + } + showList(); + } + + //显示所有的记录 + public void showList(){ + listAdapter = new SimpleAdapter(this,data, + R.layout.sqlist, + new String[]{"id", "cid", "cclass", "cname", "ccredit"}, + new int[]{R.id.textID1, R.id.textCID1, R.id.textCourseClass1, R.id.textCourseName1, R.id.textCredit1}); + lv.setAdapter(listAdapter); + } + + + + +} \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/CourseReviewActivity.java b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/CourseReviewActivity.java new file mode 100644 index 0000000..f089d42 --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/CourseReviewActivity.java @@ -0,0 +1,14 @@ +package com.example.softengineering_selectivecourse; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; + +public class CourseReviewActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_course_review); + } +} \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/CourseSelectingActivity.java b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/CourseSelectingActivity.java new file mode 100644 index 0000000..c2d6f55 --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/CourseSelectingActivity.java @@ -0,0 +1,14 @@ +package com.example.softengineering_selectivecourse; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; + +public class CourseSelectingActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_course_selecting); + } +} \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/Course_ManagerActivity.java b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/Course_ManagerActivity.java new file mode 100644 index 0000000..6c32939 --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/Course_ManagerActivity.java @@ -0,0 +1,260 @@ +package com.example.softengineering_selectivecourse; + + +import android.annotation.SuppressLint; +import android.content.ContentValues; +import android.content.Intent; +import android.database.Cursor; +import android.os.Bundle; +import android.view.View; +import android.widget.AdapterView; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ListView; +import android.widget.SimpleAdapter; +import android.widget.Toast; + +import androidx.appcompat.app.AppCompatActivity; + +import org.litepal.crud.DataSupport; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class Course_ManagerActivity extends AppCompatActivity { + + private EditText inputclass; + private EditText inputName; + private EditText inputcredit; + private EditText professor; + private EditText studentNeed; + private EditText briefIntroduce; + private Button select; + private Button add; + private Button delete; + private Button update; + private Button User; + private ListView lv; + + + private ArrayList> data;//所有记录 + private Map item; //每一条记录 + private SimpleAdapter listAdapter; //适配器 + View view; + + long selId; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_course__manager); + + inputclass = (EditText) findViewById(R.id.editClass); + inputName = (EditText) findViewById(R.id.inputCouseName); + inputcredit = (EditText) findViewById(R.id.editCredit); + professor = (EditText) findViewById(R.id.editTeacher); + studentNeed = (EditText) findViewById(R.id.editStuNeeded); + briefIntroduce = (EditText) findViewById(R.id.editBriefIntroduce); + select = (Button) findViewById(R.id.buttonQuery); + add = (Button) findViewById(R.id.buttonAdd); + delete = (Button) findViewById(R.id.buttonDelete); + update = (Button) findViewById(R.id.buttonUpdate); + User = (Button) findViewById(R.id.userManager); + lv = (ListView) findViewById(R.id.lv); + + data = new ArrayList>();//将data实例化 + + dbFindAll(); //查询的方法//查询 + + select.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + dbFindAll(); + } + }); + + User.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent = new Intent(); + intent.setClass(Course_ManagerActivity.this, User_ManagerActivity.class); + startActivity(intent); + } + }); + + + //添加 + add.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + dbAdd(); + dbFindAll(); + inputclass.setText(""); + inputName.setText(""); + inputcredit.setText(""); + professor.setText(""); + studentNeed.setText(""); + briefIntroduce.setText(""); + + } + }); + + //删除 + delete.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + dbDelete(); + dbFindAll(); + inputclass.setText(""); + inputName.setText(""); + inputcredit.setText(""); + professor.setText(""); + studentNeed.setText(""); + briefIntroduce.setText(""); + delete.setEnabled(false); + update.setEnabled(false); + Toast.makeText(Course_ManagerActivity.this,"删除成功!",Toast.LENGTH_SHORT).show(); + } + }); + + //修改 + update.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + dbUpdate(); + dbFindAll(); + inputclass.setText(""); + inputName.setText(""); + inputcredit.setText(""); + professor.setText(""); + studentNeed.setText(""); + briefIntroduce.setText(""); + delete.setEnabled(false); + update.setEnabled(false); + inputName.setEnabled(true); + Toast.makeText(Course_ManagerActivity.this,"修改成功!",Toast.LENGTH_SHORT).show(); + } + }); + /*1.修改代码,实现界面显示连贯序号 + 2.不能添加已存在的用户名 + 3.控件内容为空的时候不能实现操作且有对应提示 + 4.登录时勾选,可以记住用户名和密码*/ + + //鼠标点击数据,可以获取相对应的数据,存入Map中 + lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + Map listItem = (Map)lv.getItemAtPosition(position); + inputName.setText((String)listItem.get("cname")); + List courses = DataSupport.where("name = ? and id = ?", inputName.getText().toString(), listItem.get("id").toString() ).find(Course.class); + if(courses.isEmpty()) + { + Toast.makeText(Course_ManagerActivity.this,"can't find the course, some wrong happened",Toast.LENGTH_SHORT).show(); + } + Course course = courses.get(0); + selId = course.getId(); + inputclass.setText((String)course.getClassFeature()); + inputName.setText((String)course.getName()); + inputcredit.setText(Integer.toString(course.getCredit())); + professor.setText(course.getTeacher()); + studentNeed.setText(Integer.toString(course.getNumOfCourseNeeded())); + briefIntroduce.setText(course.getBrief_introduction()); + delete.setEnabled(true); + update.setEnabled(true); + + } + }); + + } + + private void dbUpdate(){ + + Course course = new Course(); + course.setClassFeature(inputclass.getText().toString().trim()); + course.setName(inputName.getText().toString().trim()); + course.setCredit( Integer.parseInt(inputcredit.getText().toString().trim())); + + course.setBrief_introduction(briefIntroduce.getText().toString().trim()); + course.setNumOfCourseNeeded(Integer.parseInt(studentNeed.getText().toString().trim())); + course.setTeacher(professor.getText().toString().trim()); + course.setClasstime(Integer.parseInt(inputcredit.getText().toString().trim()) * 16); + course.setNumOfCourseSelected(0); + course.updateAll("id = ?", Long.toString(selId)); + } + + private void dbDelete(){ + //the basic information is id and name + DataSupport.deleteAll(Course.class, "id = ? and name = ?", Long.toString(selId), inputName.getText().toString()); + } + + private void dbAdd(){ + if(inputName.getText().toString().isEmpty() || inputclass.getText().toString().isEmpty() || inputcredit.getText().toString().isEmpty() || + studentNeed.getText().toString().isEmpty() || professor.getText().toString().isEmpty()) + { + Toast.makeText(Course_ManagerActivity.this,"添加失败,信息未填完整",Toast.LENGTH_SHORT).show(); + } + else{ + List courses = DataSupport.where("name = ?", inputName.getText().toString().trim()).find(Course.class); + if (!courses.isEmpty()) + { + Toast.makeText(Course_ManagerActivity.this,"课程已存在,增加失败",Toast.LENGTH_SHORT).show(); + } + else + { + Course course = new Course(); + course.setClassFeature(inputclass.getText().toString().trim()); + course.setName(inputName.getText().toString().trim()); + course.setCredit( Integer.parseInt(inputcredit.getText().toString().trim())); + + course.setBrief_introduction(briefIntroduce.getText().toString().trim()); + course.setNumOfCourseNeeded(Integer.parseInt(studentNeed.getText().toString().trim())); + course.setTeacher(professor.getText().toString().trim()); + course.setClasstime(Integer.parseInt(inputcredit.getText().toString().trim()) * 16); + course.setNumOfCourseSelected(0); + if(course.save()) + { + Toast.makeText(Course_ManagerActivity.this, "增加成功!", Toast.LENGTH_SHORT).show(); + } + else + { + Toast.makeText(Course_ManagerActivity.this,"发生未知错误,增加失败",Toast.LENGTH_SHORT).show(); + } + } + } + + } + + private void dbFindAll () { + data.clear();//防止重复添加,每次清空 + List courses = DataSupport.findAll(Course.class); + int num = 1; + for (Course course : courses) { + int uid = course.getId(); + String uclass = course.getClassFeature(); + String uname = course.getName(); + int ucredit = course.getCredit(); + item = new HashMap(); + item.put("id", num); + item.put("cid", uid); + item.put("cclass", uclass); + item.put("cname", uname); + item.put("ccredit", ucredit); + data.add(item); + num++; + + } + showList(); + } + + //显示所有的记录 + public void showList () { + listAdapter = new SimpleAdapter(this, data, + R.layout.sqlist, + new String[]{"id", "cid", "cclass", "cname", "ccredit"}, + new int[]{R.id.textID1, R.id.textCID1, R.id.textCourseClass1, R.id.textCourseName1, R.id.textCredit1}); + lv.setAdapter(listAdapter); + } + + +} \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/LoginActivity.java b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/LoginActivity.java new file mode 100644 index 0000000..769586a --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/LoginActivity.java @@ -0,0 +1,178 @@ +package com.example.softengineering_selectivecourse; + + +import android.content.DialogInterface; +import android.content.Intent; +import android.os.Bundle; + + +import android.content.SharedPreferences; +import android.view.View; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.EditText; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; + +import org.litepal.LitePal; +import org.litepal.crud.DataSupport; + +import java.util.List; +import java.util.Random; + +public class LoginActivity extends AppCompatActivity { + + EditText username, pwd; + Button login, exit; + TextView register, us, showCode, forget; + + CheckBox saveName; + String sname; + String spwd; + + private int forgetpwd; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_login); + + username = (EditText) findViewById(R.id.editText); + pwd = (EditText) findViewById(R.id.editText2); + + login = (Button) findViewById(R.id.button); + exit = (Button) findViewById(R.id.button2); + + register = (TextView) findViewById(R.id.textView4); + + saveName = (CheckBox) findViewById(R.id.saveName); + forget = (TextView) findViewById(R.id.textView36); + + //先判断是否存过 + final SharedPreferences sp = getSharedPreferences("sname", MODE_PRIVATE); + final SharedPreferences sp1 = getSharedPreferences("spwd", MODE_PRIVATE); + + sname = sp.getString("sname", ""); + spwd = sp1.getString("spwd", ""); + if (!sname.equals("") && !spwd.equals("")) { + username.setText(sp.getString("sname", "")); + pwd.setText(sp1.getString("spwd", "")); + saveName.setChecked(true); //what is the differece? + } + //创建连接,并打开数据库 + LitePal.getDatabase(); + + saveName.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (username.getText().toString().equals("") || pwd.getText().toString().equals("")) { + Toast.makeText(LoginActivity.this, "用户名或密码不能为空", Toast.LENGTH_SHORT).show(); + } + } + }); + + forget.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Toast.makeText(LoginActivity.this, "请联系管理员", Toast.LENGTH_SHORT).show(); + } + }); + + login.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (username.getText().toString().equals("admin")&&pwd.getText().toString().equals("123")) { + Intent intent = new Intent(); + intent.setClass(LoginActivity.this,Course_ManagerActivity.class); + startActivity(intent); + } + else { + List users = DataSupport.findAll(User.class); + int flag = 0; + for (User user : users) { + if (username.getText().toString().trim().equals(user.getName()) && pwd.getText().toString().trim().equals(user.getPwd())) { + Toast.makeText(LoginActivity.this, "欢迎回来," + username.getText().toString().trim(), Toast.LENGTH_SHORT).show(); + flag = 1; + Intent intent = new Intent(); + intent.putExtra("name", username.getText().toString()); + intent.setClass(LoginActivity.this, PersonalBasicInfoActivity.class); + startActivity(intent); + //登陆成功时,存saveName + if (saveName.isChecked() == true) { + sname = username.getText().toString(); + spwd = pwd.getText().toString(); + SharedPreferences.Editor editor = sp.edit(); + editor.putString("sname", sname); + SharedPreferences.Editor editor1 = sp1.edit(); + editor1.putString("spwd", spwd); + editor.commit(); + editor1.commit(); + } else { + SharedPreferences.Editor editor = sp.edit(); + editor.clear(); + editor.commit(); + } + } + + } + if(flag == 0) { + Toast.makeText(LoginActivity.this, "用户名或密码不存在,登录失败!", Toast.LENGTH_SHORT).show(); + } + + } + } + }); +// + register.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent = new Intent(); + intent.setClass(LoginActivity.this,RegisterActivity.class); + startActivity(intent); + } + }); +// + exit.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + AlertDialog.Builder ab = new AlertDialog.Builder(LoginActivity.this); + ab.setMessage("您是否要退出?"); + ab.setPositiveButton("否", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + Toast.makeText(LoginActivity.this,"明智的选择",Toast.LENGTH_SHORT).show(); + } + }); + ab.setNegativeButton("是", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + LoginActivity.this.finish();//返回上一页面 + android.os.Process.killProcess(android.os.Process.myPid()); + } + }); + ab.create().show(); + } + }); + long firstTime = 0; +// //keyCode按键的编码,KeyEvent事件 +// public boolean onKeyDown(int keyCode,KeyEvent event) +// { +// long secondTime = System.currentTimeMillis();//时间间隔 +// //选择返回键 +// if(keyCode==KeyEvent.KEYCODE_BACK){ +// if(secondTime-firstTime<2000){ +// System.exit(0); +// }else{ +// Toast.makeText(LoginActivity.this,"再按一次,程序退出!",Toast.LENGTH_SHORT).show(); +// firstTime = System.currentTimeMillis(); +// } +// return true; +// } +// return super.onKeyDown(keyCode,event); +// } + } +} diff --git a/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/PersonalBasicInfoActivity.java b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/PersonalBasicInfoActivity.java new file mode 100644 index 0000000..a20f29e --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/PersonalBasicInfoActivity.java @@ -0,0 +1,189 @@ +package com.example.softengineering_selectivecourse; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.AdapterView; +import android.widget.Button; +import android.widget.ListView; +import android.widget.SimpleAdapter; +import android.widget.TextView; +import android.widget.Toast; + +import org.litepal.crud.DataSupport; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PersonalBasicInfoActivity extends AppCompatActivity { + + private TextView TextViewUserName; + private TextView TextViewUserID; + private TextView TextViewUserMajor; + private TextView TextViewUserCreditNotTaken_Military; + private TextView TextViewUserCreditNotTaken_Nature; + private TextView TextViewUserCreditNotTaken_Political; + private TextView TextViewUserCreditNotTaken_Humanity; + private ListView lv; + private TextView TextViewUserSelectedCourse; + private Button ButtonDropCourse; + + + + private ArrayList> data;//所有记录 + private Map item; //每一条记录 + private SimpleAdapter listAdapter; //适配器 + View view; + int selCourseId; + long selUserId; + String selUserName; + + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_personal_basic_info); + Intent intent = getIntent(); + final String userName = intent.getStringExtra("name"); + List users = DataSupport.where("name = ?", userName).find(User.class); + + TextViewUserName = (TextView) findViewById(R.id.textBasicInfoName); + TextViewUserID = (TextView) findViewById(R.id.textBasicINfoID1); + TextViewUserMajor = (TextView) findViewById(R.id.textBasicINfoMajor1); + TextViewUserCreditNotTaken_Military = (TextView) findViewById(R.id.textBasicINfoMilitary1); + TextViewUserCreditNotTaken_Nature = (TextView) findViewById(R.id.textBasicINfoNature1); + TextViewUserCreditNotTaken_Political = (TextView) findViewById(R.id.textBasicINfoPolitical1); + TextViewUserCreditNotTaken_Humanity = (TextView) findViewById(R.id.textBasicINfohumanity1); + TextViewUserSelectedCourse = (TextView) findViewById(R.id.textBasicINfoClikedCourse); + ButtonDropCourse = (Button) findViewById(R.id.buttonBasicInfoDrop); + Button buttonRecommend = (Button) findViewById(R.id.buttonBasicInfoRecommend); + Button buttonQuery = (Button) findViewById(R.id.buttonBasicInfoSelect); + + buttonRecommend.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(); + intent.putExtra("name", userName); + intent.setClass(PersonalBasicInfoActivity.this, CourseRecommendedActivity.class); + startActivity(intent); + } + }); + + buttonQuery.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(); + intent.putExtra("name", userName); + intent.setClass(PersonalBasicInfoActivity.this, CourseSelectingActivity.class); + startActivity(intent); + } + }); + + lv = (ListView) findViewById(R.id.lv4); + + if (users.isEmpty()) + { + Toast.makeText(PersonalBasicInfoActivity.this,"发生未知错误,显示详细信息失败",Toast.LENGTH_SHORT).show(); + } + + else + { + User user = users.get(0); + TextViewUserName.setText(userName); + selUserId = user.getId(); + selUserName = user.getName(); + TextViewUserID.setText(Long.toString(user.getId())); + TextViewUserMajor.setText(user.getMajor()); + TextViewUserCreditNotTaken_Humanity.setText(Integer.toString(user.getHumanity_class_NotTaken())); + TextViewUserCreditNotTaken_Political.setText(Integer.toString(user.getPolitical_class_NotTaken())); + TextViewUserCreditNotTaken_Nature.setText(Integer.toString(user.getNaturalScience_class_NotTaken())); + TextViewUserCreditNotTaken_Military.setText(Integer.toString(user.getMilitary_class_NotTaken())); + + } + + ButtonDropCourse.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + CourseDelete(); + dbFindAll(); + TextViewUserSelectedCourse.setText(""); + ButtonDropCourse.setEnabled(false); + Toast.makeText(PersonalBasicInfoActivity.this,"删除成功!",Toast.LENGTH_SHORT).show(); + } + }); +// lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { +// @Override +// public void onItemClick(AdapterView parent, View view, int position, long id) { +// Map listItem = (Map)lv.getItemAtPosition(position); +// TextViewUserSelectedCourse.setText((String)listItem.get("cname")); +// List courses = DataSupport.where("name = ? and id = ?", userName, listItem.get("id").toString() ).find(Course.class); +// if(courses.isEmpty()) +// { +// Toast.makeText(PersonalBasicInfoActivity.this,"can't find the course, some wrong happened",Toast.LENGTH_SHORT).show(); +// } +// Course course = courses.get(0); +// selCourseId = course.getId(); +// ButtonDropCourse.setEnabled(true); +// } +// }); + + + + } + private void CourseDelete() + { + //TO DO + } + private void dbFindAll(){ + data.clear();//防止重复添加,每次清空 + List users = DataSupport.where("id = ? and name = ?", Long.toString(selUserId), selUserName).find(User.class); + if (users.isEmpty()) + { + Toast.makeText(PersonalBasicInfoActivity.this,"发生未知错误,显示详细信息失败",Toast.LENGTH_SHORT).show(); + } + else + { + User user = users.get(0); +// ArrayList courses = user.getCourseAttend(); +// int num = 1; +// for (User.courseIdentification course : courses) +// { +// +// } + + List courses = user.getCourse_selected(); + int num = 1; + for (Course course: courses) + { + int uid = course.getId(); + String uclass = course.getClassFeature(); + String uname = course.getName(); + int ucredit = course.getCredit(); + item = new HashMap(); + item.put("id", num); + item.put("cid", uid); + item.put("cclass", uclass); + item.put("cname", uname); + item.put("ccredit", ucredit); + data.add(item); + num++; + } + } + showList(); + } + + //显示所有的记录 + public void showList(){ + listAdapter = new SimpleAdapter(this,data, + R.layout.sqlist, + new String[]{"id", "cid", "cclass", "cname", "ccredit"}, + new int[]{R.id.textID1, R.id.textCID1, R.id.textCourseClass1, R.id.textCourseName1, R.id.textCredit1}); + lv.setAdapter(listAdapter); + } + +} \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/RegisterActivity.java b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/RegisterActivity.java new file mode 100644 index 0000000..29dfa9c --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/RegisterActivity.java @@ -0,0 +1,108 @@ +package com.example.softengineering_selectivecourse; + +import androidx.appcompat.app.AppCompatActivity; + +import android.Manifest; +import android.annotation.TargetApi; +import android.content.ContentUris; +import android.content.ContentValues; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; +import android.provider.DocumentsContract; +import android.provider.MediaStore; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.Toast; + +import org.litepal.crud.DataSupport; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.List; + +public class RegisterActivity extends AppCompatActivity { + + private EditText username; + private EditText pwd; + private EditText major; + private Button register; + private Button back; + private Button btn1, btn2; + private ImageView picture; + + //实例化 + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_register); + username = (EditText) findViewById(R.id.editText); + pwd = (EditText) findViewById(R.id.editText2); + major = (EditText) findViewById(R.id.editText4); + register = (Button) findViewById(R.id.button7); + back = (Button) findViewById(R.id.button8); + + + + //返回监听 + back.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + RegisterActivity.this.finish(); + Intent intent = new Intent(); + intent.setClass(RegisterActivity.this,LoginActivity.class); + startActivity(intent); + } + }); + + //创建连接 + //打开数据库 + + //注册监听 + register.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + ContentValues values = new ContentValues(); + List Users = DataSupport.where("name = ?", username.getText().toString().trim()).find(User.class); + + //如果可以注册 + if(Users.isEmpty()){ + User user = new User(); + user.setName(username.getText().toString().trim()); + user.setPwd(pwd.getText().toString().trim()); + user.setMajor(major.getText().toString().trim()); + user.setMilitary_class_NotTaken(4); + user.setHumanity_class_NotTaken(2); + user.setPolitical_class_NotTaken(3); + user.setNaturalScience_class_NotTaken(3); + if(user.save()){ + Toast.makeText(RegisterActivity.this,"注册成功!",Toast.LENGTH_SHORT).show(); + Intent intent = new Intent(); + intent.setClass(RegisterActivity.this,LoginActivity.class); + startActivity(intent); + RegisterActivity.this.finish();//退出之前注销该活动 + } + else + { + Toast.makeText(RegisterActivity.this,"发生未知错误,注册失败",Toast.LENGTH_SHORT).show(); + } + + }else{ + Toast.makeText(RegisterActivity.this,"用户名已存在!",Toast.LENGTH_SHORT).show(); + } + } + }); + } +} diff --git a/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/User.java b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/User.java new file mode 100644 index 0000000..af107e4 --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/User.java @@ -0,0 +1,180 @@ +package com.example.softengineering_selectivecourse; + +import org.litepal.crud.DataSupport; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class User extends DataSupport { + private long id; + private String name; + private String pwd; + private String major; + private List course_selected = new ArrayList(); + private List completed_courses =new ArrayList(); + private List comments = new ArrayList(); + + private ArrayList courseAttend = new ArrayList(); + private ArrayList courseFinished = new ArrayList(); + private ArrayList CommentsOF = new ArrayList(); + + + private int military_class_NotTaken; + private int humanity_class_NotTaken; + private int political_class_NotTaken; + private int naturalScience_class_NotTaken; + + public class courseIdentification{ + private int id; + private String name; + private String feature; + private int credit; + + public int getCredit() { + return credit; + } + + public String getName() { + return name; + } + + public int getId() { + return id; + } + + public String getFeature() { + return feature; + } + + public void setFeature(String feature) { + this.feature = feature; + } + + public void setCredit(int credit) { + this.credit = credit; + } + + public void setName(String name) { + this.name = name; + } + + public void setId(int id) { + this.id = id; + } + } + + public ArrayList getCourseAttend() { + return courseAttend; + } + + public ArrayList getCourseFinished() { + return courseFinished; + } + + public ArrayList getCommentsOF() { + return CommentsOF; + } + + public void setCommentsOF(ArrayList commentsOF) { + CommentsOF = commentsOF; + } + + public void setCourseAttend(ArrayList courseAttend) { + this.courseAttend = courseAttend; + } + + public void setCourseFinished(ArrayList courseFinished) { + this.courseFinished = courseFinished; + } + + public void setPwd(String pwd) { + this.pwd = pwd; + } + + public void setName(String name) { + this.name = name; + } + + public void setMajor(String major) { + this.major = major; + } + + public void setId(long id) { + this.id = id; + } + + public void setComments(ArrayList comments) { + this.comments = comments; + } + + public void setCompleted_courses(ArrayList completed_courses) { + this.completed_courses = completed_courses; + } + + public void setCourse_selected(ArrayList course_selected) { + this.course_selected = course_selected; + } + + public void setHumanity_class_NotTaken(int humanity_class_NotTaken) { + this.humanity_class_NotTaken = humanity_class_NotTaken; + } + + public void setMilitary_class_NotTaken(int military_class_NotTaken) { + this.military_class_NotTaken = military_class_NotTaken; + } + + public void setNaturalScience_class_NotTaken(int naturalScience_class_NotTaken) { + this.naturalScience_class_NotTaken = naturalScience_class_NotTaken; + } + + public void setPolitical_class_NotTaken(int political_class_NotTaken) { + this.political_class_NotTaken = political_class_NotTaken; + } + + + public String getName() { + return name; + } + + public String getMajor() { + return major; + } + + public String getPwd() { + return pwd; + } + + public long getId() { + return id; + } + + public List getComments() { + return comments; + } + + public List getCompleted_courses() { + return completed_courses; + } + + public List getCourse_selected() { + return course_selected; + } + + public int getHumanity_class_NotTaken() { + return humanity_class_NotTaken; + } + + public int getMilitary_class_NotTaken() { + return military_class_NotTaken; + } + + public int getNaturalScience_class_NotTaken() { + return naturalScience_class_NotTaken; + } + + public int getPolitical_class_NotTaken() { + return political_class_NotTaken; + } + +} diff --git a/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/User_ManagerActivity.java b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/User_ManagerActivity.java new file mode 100644 index 0000000..87f56a0 --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/src/main/java/com/example/softengineering_selectivecourse/User_ManagerActivity.java @@ -0,0 +1,211 @@ +package com.example.softengineering_selectivecourse; + +import android.os.Bundle; +import android.view.View; +import android.widget.AdapterView; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ListView; +import android.widget.SimpleAdapter; +import android.widget.Toast; + +import androidx.appcompat.app.AppCompatActivity; + +import org.litepal.crud.DataSupport; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class User_ManagerActivity extends AppCompatActivity { + + + private EditText inputName; + private EditText inputPwd; + private EditText inputMajor; + private Button select; + private Button add; + private Button delete; + private Button update; + private ListView lv; + + + + private ArrayList> data;//所有记录 + private Map item; //每一条记录 + private SimpleAdapter listAdapter; //适配器 + View view; + + long selId; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_user__manager); + + inputName = (EditText) findViewById(R.id.editTextName); + inputMajor = (EditText) findViewById(R.id.editMajor); + inputPwd = (EditText) findViewById(R.id.editPwd); + select = (Button) findViewById(R.id.buttonUserQuery); + add = (Button) findViewById(R.id.buttonUserAdd); + delete = (Button) findViewById(R.id.buttonUSerDelete); + update = (Button) findViewById(R.id.buttonUSerUpdate); + lv = (ListView) findViewById(R.id.lv2); + + + data = new ArrayList>();//将data实例化 + + dbFindAll(); //查询的方法 + //查询 + select.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + dbFindAll(); + } + }); + + //添加 + add.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + dbAdd(); + dbFindAll(); + inputName.setText(""); + inputPwd.setText(""); + inputMajor.setText(""); + } + }); +// +// //删除 + delete.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + dbDelete(); + dbFindAll(); + inputName.setText(""); + inputPwd.setText(""); + inputMajor.setText(""); + delete.setEnabled(false); + update.setEnabled(false); + inputName.setEnabled(true); + Toast.makeText(User_ManagerActivity.this,"删除成功!",Toast.LENGTH_SHORT).show(); + } + }); +// +// //修改 + update.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + dbUpdate(); + dbFindAll(); + inputName.setText(""); + inputPwd.setText(""); + inputMajor.setText(""); + delete.setEnabled(false); + update.setEnabled(false); + inputName.setEnabled(true); + Toast.makeText(User_ManagerActivity.this,"修改成功!",Toast.LENGTH_SHORT).show(); + } + }); +// +// //鼠标点击数据,可以获取相对应的数据,存入Map中 + lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + Map listItem = (Map)lv.getItemAtPosition(position); + inputName.setText((String)listItem.get("uname")); + List users = DataSupport.where("name = ? and id = ?", inputName.getText().toString(), listItem.get("uid").toString() ).find(User.class); + if(users.isEmpty()) + { + Toast.makeText(User_ManagerActivity.this,"can't find the course, some wrong happened",Toast.LENGTH_SHORT).show(); + } + User user = users.get(0); + selId = user.getId(); + inputName.setText((String)user.getName()); + inputPwd.setText((String)user.getPwd()); + inputMajor.setText((String)user.getMajor()); + delete.setEnabled(true); + update.setEnabled(true); + + } + }); + + } + + private void dbUpdate(){ + User user = new User(); + user.setName(inputName.getText().toString().trim()); + user.setPwd(inputPwd.getText().toString().trim()); + user.setMajor(inputMajor.getText().toString().trim()); + user.updateAll("id = ?", Long.toString(selId)); + } +// + private void dbDelete(){ + DataSupport.deleteAll(User.class, "id = ? and name = ?", Long.toString(selId), inputName.getText().toString()); + } +// + private void dbAdd(){ + if(inputName.getText().toString().isEmpty() || inputMajor.getText().toString().isEmpty() || inputPwd.getText().toString().isEmpty()) + { + Toast.makeText(User_ManagerActivity.this,"添加失败,信息未填完整",Toast.LENGTH_SHORT).show(); + } + else{ + List users = DataSupport.where("name = ?", inputName.getText().toString().trim()).find(User.class); + if (!users.isEmpty()) + { + Toast.makeText(User_ManagerActivity.this,"用户已存在,增加失败",Toast.LENGTH_SHORT).show(); + } + else + { + User user = new User(); + user.setName(inputName.getText().toString().trim()); + user.setPwd(inputPwd.getText().toString().trim()); + user.setMajor(inputMajor.getText().toString().trim()); + user.setMilitary_class_NotTaken(4); + user.setHumanity_class_NotTaken(2); + user.setPolitical_class_NotTaken(3); + user.setNaturalScience_class_NotTaken(3); + if(user.save()) + { + Toast.makeText(User_ManagerActivity.this, "增加成功!", Toast.LENGTH_SHORT).show(); + } + else + { + Toast.makeText(User_ManagerActivity.this,"发生未知错误,增加失败",Toast.LENGTH_SHORT).show(); + } + } + } + } + + private void dbFindAll(){ + data.clear();//防止重复添加,每次清空 + List users = DataSupport.findAll(User.class); + int num = 1; + for (User user: users) { + long uid = user.getId(); + + String name = user.getName(); + String pwd = user.getPwd(); + String major = user.getMajor(); + item = new HashMap(); + item.put("id",num); + item.put("uid",uid); + item.put("uname",name); + item.put("pwd",pwd); + item.put("major",major); + data.add(item); + num++; + } + showList(); + } + + //显示所有的记录 + public void showList(){ + listAdapter = new SimpleAdapter(this,data, + R.layout.user_sqlist, + new String[]{"id","uid","uname","pwd","major"}, + new int[]{R.id.textUserID1,R.id.textUserCID1,R.id.textUserNamelist1,R.id.textUserKeylist1,R.id.textUserMajor1}); + lv.setAdapter(listAdapter); + } +} diff --git a/SoftEngineering_selectiveCourse/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/SoftEngineering_selectiveCourse/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..cc14f03 --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/SoftEngineering_selectiveCourse/app/src/main/res/drawable/ic_launcher_background.xml b/SoftEngineering_selectiveCourse/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..a4f78de --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SoftEngineering_selectiveCourse/app/src/main/res/layout/activity_course__manager.xml b/SoftEngineering_selectiveCourse/app/src/main/res/layout/activity_course__manager.xml new file mode 100644 index 0000000..30af0ed --- /dev/null +++ b/SoftEngineering_selectiveCourse/app/src/main/res/layout/activity_course__manager.xml @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +