@ -0,0 +1,15 @@
|
|||||||
|
*.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
|
||||||
|
local.properties
|
@ -0,0 +1 @@
|
|||||||
|
SleepHelper
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
<bytecodeTargetLevel target="17" />
|
<bytecodeTargetLevel target="11" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -1,6 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,38 @@
|
|||||||
|
plugins {
|
||||||
|
id 'com.android.application'
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace 'com.example.sleephelper'
|
||||||
|
compileSdk 33
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "com.example.sleephelper"
|
||||||
|
minSdk 31
|
||||||
|
targetSdk 33
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||||
|
implementation 'com.google.android.material:material:1.5.0'
|
||||||
|
testImplementation 'junit:junit:4.13.2'
|
||||||
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||||
|
}
|
@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.example.sleep">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
<uses-permission android:name="android.permission.SENSOR_INFO" />
|
||||||
|
<uses-permission android:name="android.permission.SENSOR_ENABLE" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.CAMERA"/>
|
||||||
|
|
||||||
|
<uses-feature
|
||||||
|
android:name="android.hardware.camera"
|
||||||
|
android:required="false" />
|
||||||
|
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name="com.example.sleep.App"
|
||||||
|
android:allowBackup="false"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/AppTheme">
|
||||||
|
<activity android:name=".SplashActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".activity.LoginActivity"
|
||||||
|
android:theme="@style/Theme.NoAction"/>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".activity.RegisterActivity"
|
||||||
|
android:theme="@style/Theme.NoAction"/>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.example.sleep.MainScreen"
|
||||||
|
|
||||||
|
android:launchMode="standard"
|
||||||
|
android:theme="@style/Theme.NoAction" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.example.sleep.Record"
|
||||||
|
android:launchMode="standard" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.example.sleep.SleepresultScreen"
|
||||||
|
android:launchMode="standard" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.example.sleep.SleepMonitoringScreen"
|
||||||
|
android:launchMode="standard"
|
||||||
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.example.sleep.AfterSleep"
|
||||||
|
android:launchMode="singleTask" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.example.sleep.CalendarPage"
|
||||||
|
android:theme="@style/Theme.NoAction" />
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name="com.example.sleep.service.DaemonService"
|
||||||
|
android:enabled="true"
|
||||||
|
android:process=":daemon_service" />
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name="com.example.sleep.service.SensorService"
|
||||||
|
android:process=":work" />
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name="com.example.sleep.service.GoSleepService"
|
||||||
|
android:enabled="true"
|
||||||
|
android:process=":go_sleep" />
|
||||||
|
|
||||||
|
<receiver android:name="com.example.sleep.GoSleepBroadcastReceiver">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name="com.example.sleep.service.PlayerMusicService"
|
||||||
|
android:enabled="true"
|
||||||
|
android:process=":music_service" />
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name="com.example.sleep.service.MediaService"
|
||||||
|
android:enabled="true" />
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name="com.example.sleep.service.AliveJobService"
|
||||||
|
android:permission="android.permission.BIND_JOB_SERVICE" />
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name="com.example.sleep.service.GrayService"
|
||||||
|
android:enabled="true"
|
||||||
|
android:process=":gray_service" />
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="preloaded_fonts"
|
||||||
|
android:resource="@array/preloaded_fonts" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".EditScreen"/>
|
||||||
|
|
||||||
|
<receiver android:name=".AlarmReceiver" />
|
||||||
|
|
||||||
|
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
</adaptive-icon>
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 982 B After Width: | Height: | Size: 982 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
@ -0,0 +1,16 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="Theme.SleepHelper" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
|
<!-- Primary brand color. -->
|
||||||
|
<item name="colorPrimary">@color/purple_200</item>
|
||||||
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
|
<item name="colorOnPrimary">@color/black</item>
|
||||||
|
<!-- Secondary brand color. -->
|
||||||
|
<item name="colorSecondary">@color/teal_200</item>
|
||||||
|
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||||
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
|
<!-- Status bar color. -->
|
||||||
|
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
</style>
|
||||||
|
</resources>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="purple_200">#FFBB86FC</color>
|
||||||
|
<color name="purple_500">#FF6200EE</color>
|
||||||
|
<color name="purple_700">#FF3700B3</color>
|
||||||
|
<color name="teal_200">#FF03DAC5</color>
|
||||||
|
<color name="teal_700">#FF018786</color>
|
||||||
|
<color name="black">#FF000000</color>
|
||||||
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
</resources>
|
@ -0,0 +1,3 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name">SleepHelper</string>
|
||||||
|
</resources>
|
@ -0,0 +1,16 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="Theme.SleepHelper" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
|
<!-- Primary brand color. -->
|
||||||
|
<item name="colorPrimary">@color/purple_500</item>
|
||||||
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
|
<item name="colorOnPrimary">@color/white</item>
|
||||||
|
<!-- Secondary brand color. -->
|
||||||
|
<item name="colorSecondary">@color/teal_200</item>
|
||||||
|
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||||
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
|
<!-- Status bar color. -->
|
||||||
|
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
</style>
|
||||||
|
</resources>
|
@ -0,0 +1,5 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
plugins {
|
||||||
|
id 'com.android.application' version '7.4.2' apply false
|
||||||
|
id 'com.android.library' version '7.4.2' apply false
|
||||||
|
}
|
@ -1,2 +0,0 @@
|
|||||||
#Sat Sep 23 18:12:37 CST 2023
|
|
||||||
gradle.version=8.0
|
|
@ -1 +0,0 @@
|
|||||||
DrameSleep
|
|
@ -1,42 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id("com.android.application")
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
namespace = "com.example.dramesleep"
|
|
||||||
compileSdk = 33
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
applicationId = "com.example.dramesleep"
|
|
||||||
minSdk = 24
|
|
||||||
targetSdk = 33
|
|
||||||
versionCode = 1
|
|
||||||
versionName = "1.0"
|
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
isMinifyEnabled = false
|
|
||||||
proguardFiles(
|
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
||||||
"proguard-rules.pro"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
|
|
||||||
implementation("androidx.appcompat:appcompat:1.6.1")
|
|
||||||
implementation("com.google.android.material:material:1.9.0")
|
|
||||||
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
|
||||||
testImplementation("junit:junit:4.13.2")
|
|
||||||
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
|
||||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
package com.example.dramesleep;
|
|
||||||
|
|
||||||
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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
|
||||||
*/
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
|
||||||
public class ExampleInstrumentedTest {
|
|
||||||
@Test
|
|
||||||
public void useAppContext() {
|
|
||||||
// Context of the app under test.
|
|
||||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
|
||||||
assertEquals("com.example.dramesleep", appContext.getPackageName());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
|
|
||||||
<application
|
|
||||||
android:allowBackup="true"
|
|
||||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
|
||||||
android:fullBackupContent="@xml/backup_rules"
|
|
||||||
android:icon="@mipmap/ic_launcher"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:name=".MyApplication"
|
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
|
||||||
android:supportsRtl="true"
|
|
||||||
android:theme="@style/Base.Theme.DrameSleep"
|
|
||||||
tools:targetApi="31">
|
|
||||||
<activity
|
|
||||||
android:name=".LoginActivity"
|
|
||||||
android:exported="true">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".RegisterActivity"/>
|
|
||||||
<activity
|
|
||||||
android:name=".MainActivity"/>
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
@ -1,86 +0,0 @@
|
|||||||
package com.example.dramesleep;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
|
|
||||||
import com.example.dramesleep.db.DBUtils;
|
|
||||||
|
|
||||||
public class LoginActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
private EditText usrNameEd;
|
|
||||||
private EditText passwordEd;
|
|
||||||
private Button registerBtn;
|
|
||||||
private Button loginBtn;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_login);
|
|
||||||
usrNameEd = findViewById(R.id.user_name_edit);
|
|
||||||
passwordEd = findViewById(R.id.password_name_edit);
|
|
||||||
loginBtn = findViewById(R.id.login_btn);
|
|
||||||
registerBtn = findViewById(R.id.register_btn);
|
|
||||||
|
|
||||||
initListener();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initListener() {
|
|
||||||
registerBtn.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
|
|
||||||
if (true) {
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.setClass(LoginActivity.this,RegisterActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (TextUtils.isEmpty(usrNameEd.getText().toString())) {
|
|
||||||
Toast.makeText(LoginActivity.this,"请输入用户名",Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (TextUtils.isEmpty(passwordEd.getText().toString())) {
|
|
||||||
Toast.makeText(LoginActivity.this,"请输入密码",Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String userName = usrNameEd.getText().toString();
|
|
||||||
String password = passwordEd.getText().toString();
|
|
||||||
DBUtils.insertData(new UserBean(userName,password));
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
loginBtn.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (TextUtils.isEmpty(usrNameEd.getText().toString())) {
|
|
||||||
Toast.makeText(LoginActivity.this,"请输入用户名",Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (TextUtils.isEmpty(passwordEd.getText().toString())) {
|
|
||||||
Toast.makeText(LoginActivity.this,"请输入密码",Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String userName = usrNameEd.getText().toString();
|
|
||||||
String password = passwordEd.getText().toString();
|
|
||||||
int userId = DBUtils.query(new UserBean(userName,password));
|
|
||||||
if (userId == -1) {
|
|
||||||
Toast.makeText(LoginActivity.this,"请输入正确的密码或用户名",Toast.LENGTH_SHORT).show();
|
|
||||||
} else {
|
|
||||||
Toast.makeText(LoginActivity.this,"登陆成功",Toast.LENGTH_SHORT).show();
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.setClass(LoginActivity.this,MainActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
package com.example.dramesleep;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
private RecyclerView recyclerView;
|
|
||||||
private List<SleepBean> dataList;
|
|
||||||
private RecyclerViewAdapter adapter;
|
|
||||||
private TextView timeClock;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_main);
|
|
||||||
|
|
||||||
recyclerView = findViewById(R.id.rl);
|
|
||||||
timeClock = findViewById(R.id.time_clock);
|
|
||||||
dataList = Utils.getSleepList();
|
|
||||||
adapter = new RecyclerViewAdapter(dataList);
|
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false));
|
|
||||||
recyclerView.setAdapter(adapter);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
package com.example.dramesleep;
|
|
||||||
|
|
||||||
import android.app.Application;
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
public class MyApplication extends Application {
|
|
||||||
private static Context mContext;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
super.onCreate();
|
|
||||||
mContext = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Context getApplicatiopContext(){
|
|
||||||
return mContext;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
package com.example.dramesleep;
|
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.ViewHolder> {
|
|
||||||
|
|
||||||
private List<SleepBean> dataList;
|
|
||||||
|
|
||||||
public RecyclerViewAdapter(List<SleepBean> dataList) {
|
|
||||||
this.dataList = dataList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
|
||||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.sleep_list, parent, false);
|
|
||||||
return new ViewHolder(view);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
|
||||||
SleepBean item = dataList.get(position);
|
|
||||||
holder.textView.setText(item.text);
|
|
||||||
holder.imageIcon.setImageResource(item.icon);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemCount() {
|
|
||||||
return dataList.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
|
||||||
private final ImageView imageIcon;
|
|
||||||
public TextView textView;
|
|
||||||
|
|
||||||
public ViewHolder(View itemView) {
|
|
||||||
super(itemView);
|
|
||||||
textView = itemView.findViewById(R.id.sleep_item_text);
|
|
||||||
imageIcon = itemView.findViewById(R.id.sleep_item_icon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
|||||||
package com.example.dramesleep;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
|
|
||||||
import com.example.dramesleep.db.DBUtils;
|
|
||||||
|
|
||||||
public class RegisterActivity extends AppCompatActivity {
|
|
||||||
|
|
||||||
private EditText usrNameEd;
|
|
||||||
private EditText passwordEd;
|
|
||||||
private Button registerBtn;
|
|
||||||
private Button loginBtn;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_gister);
|
|
||||||
usrNameEd = findViewById(R.id.user_name_edit);
|
|
||||||
passwordEd = findViewById(R.id.password_name_edit);
|
|
||||||
registerBtn = findViewById(R.id.register_btn);
|
|
||||||
|
|
||||||
/* Toolbar toolbar = findViewById(R.id.toolbar);
|
|
||||||
setSupportActionBar(toolbar);
|
|
||||||
|
|
||||||
// 启用返回按钮(显示左上角的返回箭头)
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
|
|
||||||
// 设置返回按钮的点击事件
|
|
||||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
// 在这里处理返回按钮的点击事件,例如返回上一个界面
|
|
||||||
onBackPressed();
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
initListener();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initListener() {
|
|
||||||
registerBtn.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (TextUtils.isEmpty(usrNameEd.getText().toString())) {
|
|
||||||
Toast.makeText(RegisterActivity.this,"请输入用户名",Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (TextUtils.isEmpty(passwordEd.getText().toString())) {
|
|
||||||
Toast.makeText(RegisterActivity.this,"请输入密码",Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String userName = usrNameEd.getText().toString();
|
|
||||||
String password = passwordEd.getText().toString();
|
|
||||||
long id = DBUtils.insertData(new UserBean(userName,password));
|
|
||||||
if (id != -1) Toast.makeText(RegisterActivity.this,"注册成功",Toast.LENGTH_SHORT).show();
|
|
||||||
finish();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package com.example.dramesleep;
|
|
||||||
|
|
||||||
public class SleepBean {
|
|
||||||
public int icon;
|
|
||||||
public String text;
|
|
||||||
|
|
||||||
public SleepBean(int shequ, String text) {
|
|
||||||
icon = shequ;
|
|
||||||
this.text = text;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package com.example.dramesleep;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
public class UserBean implements Serializable {
|
|
||||||
public String userName;
|
|
||||||
public String userPassword;
|
|
||||||
|
|
||||||
public UserBean(String userName, String password) {
|
|
||||||
this.userName = userName;
|
|
||||||
this.userPassword = password;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.example.dramesleep;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Utils {
|
|
||||||
public static List<SleepBean> getSleepList(){
|
|
||||||
// 添加一些示例数据
|
|
||||||
List<SleepBean> dataList = new ArrayList<>();
|
|
||||||
dataList.add(new SleepBean(R.mipmap.shequ,"社区"));
|
|
||||||
dataList.add(new SleepBean(R.mipmap.report,"报告"));
|
|
||||||
dataList.add(new SleepBean(R.mipmap.sleep,"睡眠\n监测"));
|
|
||||||
dataList.add(new SleepBean(R.mipmap.jiemeng,"解梦"));
|
|
||||||
dataList.add(new SleepBean(R.mipmap.zhumin,"助眠"));
|
|
||||||
return dataList;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
package com.example.dramesleep.db;
|
|
||||||
|
|
||||||
import android.content.ContentValues;
|
|
||||||
import android.database.Cursor;
|
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
|
||||||
|
|
||||||
import com.example.dramesleep.MyApplication;
|
|
||||||
import com.example.dramesleep.UserBean;
|
|
||||||
|
|
||||||
public class DBUtils {
|
|
||||||
public static long insertData(UserBean bean) {
|
|
||||||
DatabaseHelper dbHelper = new DatabaseHelper(MyApplication.getApplicatiopContext());
|
|
||||||
SQLiteDatabase db = dbHelper.getWritableDatabase();
|
|
||||||
|
|
||||||
String username = bean.userName;
|
|
||||||
String password = bean.userPassword;
|
|
||||||
|
|
||||||
ContentValues values = new ContentValues();
|
|
||||||
values.put("username", username);
|
|
||||||
values.put("password", password);
|
|
||||||
|
|
||||||
long newRowId = db.insert("users", null, values);
|
|
||||||
return newRowId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int query(UserBean userBean) {
|
|
||||||
DatabaseHelper dbHelper = new DatabaseHelper(MyApplication.getApplicatiopContext());
|
|
||||||
SQLiteDatabase db = dbHelper.getWritableDatabase();
|
|
||||||
String[] projection = {"id"};
|
|
||||||
String selection = "username = ? AND password = ?";
|
|
||||||
String[] selectionArgs = {userBean.userName, userBean.userPassword};
|
|
||||||
|
|
||||||
Cursor cursor = db.query("users", projection, selection, selectionArgs, null, null, null);
|
|
||||||
int userId;
|
|
||||||
if (cursor.moveToFirst()) {
|
|
||||||
// 用户验证成功
|
|
||||||
userId = cursor.getInt(cursor.getColumnIndexOrThrow("id"));
|
|
||||||
// 进行登录后的操作
|
|
||||||
} else {
|
|
||||||
// 用户验证失败
|
|
||||||
// 显示错误消息
|
|
||||||
userId = -1;
|
|
||||||
}
|
|
||||||
cursor.close();
|
|
||||||
db.close();
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
package com.example.dramesleep.db;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
|
||||||
import android.database.sqlite.SQLiteOpenHelper;
|
|
||||||
|
|
||||||
public class DatabaseHelper extends SQLiteOpenHelper {
|
|
||||||
private static final String DATABASE_NAME = "MyAppDatabase";
|
|
||||||
private static final int DATABASE_VERSION = 1;
|
|
||||||
|
|
||||||
// 构造函数
|
|
||||||
public DatabaseHelper(Context context) {
|
|
||||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建表格
|
|
||||||
@Override
|
|
||||||
public void onCreate(SQLiteDatabase db) {
|
|
||||||
String createUserTable = "CREATE TABLE users (id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT, password TEXT);";
|
|
||||||
db.execSQL(createUserTable);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 升级数据库
|
|
||||||
@Override
|
|
||||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
|
||||||
db.execSQL("DROP TABLE IF EXISTS users");
|
|
||||||
onCreate(db);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item>
|
|
||||||
<shape android:shape="rectangle">
|
|
||||||
<corners android:radius="10dp"/>
|
|
||||||
<stroke
|
|
||||||
android:width="2dp"
|
|
||||||
android:color="@color/black"/>
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</selector>
|
|
@ -1,121 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:context=".RegisterActivity"
|
|
||||||
android:background="#3635B9"
|
|
||||||
android:theme="@style/AppToolbar">
|
|
||||||
|
|
||||||
<!-- <androidx.appcompat.widget.Toolbar
|
|
||||||
android:id="@+id/toolbar"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="#3635B9"
|
|
||||||
android:theme="@style/AppToolbar"
|
|
||||||
android:elevation="4dp">
|
|
||||||
|
|
||||||
<!– 返回按钮 –>
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/backButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:src="@mipmap/back" />
|
|
||||||
|
|
||||||
<!– 文本字符串 –>
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/titleTextView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="返回"
|
|
||||||
android:textColor="#000"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
</androidx.appcompat.widget.Toolbar>-->
|
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/user_icon"
|
|
||||||
android:layout_width="62dp"
|
|
||||||
android:layout_height="62dp"
|
|
||||||
android:src="@mipmap/user_icon_1"
|
|
||||||
android:layout_marginTop="60dp"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
android:layout_marginLeft="10dp"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/user_name"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="用户名:"
|
|
||||||
android:textColor="#000"
|
|
||||||
android:textSize="30sp"
|
|
||||||
android:layout_marginLeft="20dp"
|
|
||||||
app:layout_constraintLeft_toRightOf="@id/user_icon"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/user_icon"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/user_icon" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/user_name_edit"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="#000"
|
|
||||||
android:hint="请输入用户名"
|
|
||||||
android:textSize="30sp"
|
|
||||||
android:layout_marginLeft="10dp"
|
|
||||||
app:layout_constraintLeft_toRightOf="@id/user_name"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/user_icon"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/user_icon" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/password_icon"
|
|
||||||
android:layout_width="62dp"
|
|
||||||
android:layout_height="62dp"
|
|
||||||
android:src="@mipmap/lock"
|
|
||||||
android:layout_marginTop="40dp"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
android:layout_marginLeft="10dp"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/user_icon"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/password_name"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="密码:"
|
|
||||||
android:textColor="#000"
|
|
||||||
android:textSize="30sp"
|
|
||||||
android:layout_marginLeft="20dp"
|
|
||||||
app:layout_constraintLeft_toRightOf="@id/user_icon"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/password_icon"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/password_icon" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/password_name_edit"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="#000"
|
|
||||||
android:hint="请输入密码"
|
|
||||||
android:textSize="30sp"
|
|
||||||
android:layout_marginLeft="10dp"
|
|
||||||
app:layout_constraintLeft_toRightOf="@id/user_name"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/password_icon"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/password_icon" />
|
|
||||||
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/register_btn"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="#000"
|
|
||||||
android:text="注册"
|
|
||||||
android:textSize="30sp"
|
|
||||||
android:layout_marginTop="40dp"
|
|
||||||
android:layout_marginRight="20dp"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/password_icon" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -1,114 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:context=".LoginActivity"
|
|
||||||
android:background="#3635B9">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="健康睡眠"
|
|
||||||
android:textColor="#000"
|
|
||||||
android:textSize="40sp"
|
|
||||||
android:layout_marginTop="30dp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/user_icon"
|
|
||||||
android:layout_width="62dp"
|
|
||||||
android:layout_height="62dp"
|
|
||||||
android:src="@mipmap/user_icon_1"
|
|
||||||
android:layout_marginTop="60dp"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
android:layout_marginLeft="10dp"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/title"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/user_name"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="用户名:"
|
|
||||||
android:textColor="#000"
|
|
||||||
android:textSize="30sp"
|
|
||||||
android:layout_marginLeft="20dp"
|
|
||||||
app:layout_constraintLeft_toRightOf="@id/user_icon"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/user_icon"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/user_icon" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/user_name_edit"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="#000"
|
|
||||||
android:hint="请输入用户名"
|
|
||||||
android:textSize="30sp"
|
|
||||||
android:layout_marginLeft="10dp"
|
|
||||||
app:layout_constraintLeft_toRightOf="@id/user_name"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/user_icon"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/user_icon" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/password_icon"
|
|
||||||
android:layout_width="62dp"
|
|
||||||
android:layout_height="62dp"
|
|
||||||
android:src="@mipmap/lock"
|
|
||||||
android:layout_marginTop="40dp"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
android:layout_marginLeft="10dp"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/user_icon"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/password_name"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="密码:"
|
|
||||||
android:textColor="#000"
|
|
||||||
android:textSize="30sp"
|
|
||||||
android:layout_marginLeft="20dp"
|
|
||||||
app:layout_constraintLeft_toRightOf="@id/user_icon"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/password_icon"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/password_icon" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/password_name_edit"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="#000"
|
|
||||||
android:hint="请输入密码"
|
|
||||||
android:textSize="30sp"
|
|
||||||
android:layout_marginLeft="10dp"
|
|
||||||
app:layout_constraintLeft_toRightOf="@id/user_name"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/password_icon"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/password_icon" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/login_btn"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="#000"
|
|
||||||
android:text="登录"
|
|
||||||
android:textSize="30sp"
|
|
||||||
android:layout_marginLeft="10dp"
|
|
||||||
android:layout_marginTop="40dp"
|
|
||||||
app:layout_constraintLeft_toLeftOf="@id/password_icon"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/password_icon" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/register_btn"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="#000"
|
|
||||||
android:text="注册"
|
|
||||||
android:textSize="30sp"
|
|
||||||
android:layout_marginTop="40dp"
|
|
||||||
android:layout_marginRight="20dp"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/password_icon" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -1,63 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:context=".MainActivity"
|
|
||||||
android:background="#3635B9">
|
|
||||||
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:layout_marginTop="150dp"
|
|
||||||
android:id="@+id/time_clock_bg"
|
|
||||||
android:layout_width="200dp"
|
|
||||||
android:backgroundTint="#4D78A2"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_marginLeft="20dp"
|
|
||||||
android:id="@+id/time_clock"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColor="#7990A6"
|
|
||||||
android:textSize="25sp"
|
|
||||||
android:text="19:04:11"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/time_clock_bg"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/time_clock_bg"
|
|
||||||
app:layout_constraintLeft_toLeftOf="@id/time_clock_bg" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:src="@mipmap/time_clock"
|
|
||||||
android:layout_marginLeft="20dp"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/time_clock_bg"
|
|
||||||
app:layout_constraintLeft_toRightOf="@id/time_clock"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/time_clock_bg"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:layout_marginTop="300dp"
|
|
||||||
android:id="@+id/start_sleep"
|
|
||||||
android:layout_width="200dp"
|
|
||||||
android:text="开始睡眠"
|
|
||||||
android:textColor="#000"
|
|
||||||
android:textSize="25sp"
|
|
||||||
android:backgroundTint="#4D78A2"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/time_clock_bg"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"/>
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/rl"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
android:layout_marginRight="15dp"/>
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -1,29 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<RelativeLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<!-- 添加自定义视图和控件 -->
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/custom_imageview"
|
|
||||||
android:layout_width="48dp"
|
|
||||||
android:layout_height="48dp"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:src="@mipmap/back"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/custom_title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="返回"
|
|
||||||
android:textSize="25sp"
|
|
||||||
android:textColor="#000"
|
|
||||||
android:layout_alignTop="@id/custom_imageview"
|
|
||||||
android:layout_alignBottom="@id/custom_imageview"
|
|
||||||
android:layout_toRightOf="@id/custom_imageview"
|
|
||||||
android:layout_marginLeft="50dp" />
|
|
||||||
|
|
||||||
<!-- 还可以添加其他控件 -->
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
@ -1,47 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
tools:context=".MainActivity"
|
|
||||||
android:layout_marginBottom="20dp"
|
|
||||||
android:layout_marginRight="20dp"
|
|
||||||
android:background="#3635B9">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/sleep_item_bg"
|
|
||||||
android:layout_width="120dp"
|
|
||||||
android:layout_height="150dp"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
android:src="@drawable/white_button"/>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/sleep_item_icon"
|
|
||||||
android:layout_width="72dp"
|
|
||||||
android:layout_height="72dp"
|
|
||||||
app:layout_constraintRight_toRightOf="@id/sleep_item_bg"
|
|
||||||
app:layout_constraintLeft_toLeftOf="@id/sleep_item_bg"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/sleep_item_bg"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:src="@mipmap/report"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/sleep_item_text"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/sleep_item_icon"
|
|
||||||
app:layout_constraintLeft_toLeftOf="@id/sleep_item_bg"
|
|
||||||
app:layout_constraintRight_toRightOf="@id/sleep_item_bg"
|
|
||||||
android:text="社区"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:textSize="25sp"
|
|
||||||
android:textColor="#000"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
Before Width: | Height: | Size: 880 B |
Before Width: | Height: | Size: 852 B |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 841 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 799 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 764 B |
Before Width: | Height: | Size: 811 B |
Before Width: | Height: | Size: 927 B |
@ -1,7 +0,0 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
<!-- Base application theme. -->
|
|
||||||
<style name="Base.Theme.DrameSleep" parent="Theme.Material3.DayNight.NoActionBar">
|
|
||||||
<!-- Customize your dark theme here. -->
|
|
||||||
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
|
|
||||||
</style>
|
|
||||||
</resources>
|
|
@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<color name="black">#FF000000</color>
|
|
||||||
<color name="white">#FFFFFFFF</color>
|
|
||||||
</resources>
|
|
@ -1,3 +0,0 @@
|
|||||||
<resources>
|
|
||||||
<string name="app_name">DrameSleep</string>
|
|
||||||
</resources>
|
|
@ -1,14 +0,0 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
<!-- Base application theme. -->
|
|
||||||
<style name="Base.Theme.DrameSleep" parent="Theme.Material3.DayNight.NoActionBar">
|
|
||||||
<!-- Customize your light theme here. -->
|
|
||||||
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="Theme.DrameSleep" parent="Base.Theme.DrameSleep" />
|
|
||||||
|
|
||||||
<style name="AppToolbar" parent="Widget.AppCompat.Toolbar">
|
|
||||||
<item name="android:label">""</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</resources>
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.example.dramesleep;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Example local unit test, which will execute on the development machine (host).
|
|
||||||
*
|
|
||||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
|
||||||
*/
|
|
||||||
public class ExampleUnitTest {
|
|
||||||
@Test
|
|
||||||
public void addition_isCorrect() {
|
|
||||||
assertEquals(4, 2 + 2);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
plugins {
|
|
||||||
id("com.android.application") version "8.1.1" apply false
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
## This file must *NOT* be checked into Version Control Systems,
|
|
||||||
# as it contains information specific to your local configuration.
|
|
||||||
#
|
|
||||||
# Location of the SDK. This is only used by Gradle.
|
|
||||||
# For customization when using a Version Control System, please read the
|
|
||||||
# header note.
|
|
||||||
#Sat Sep 23 21:50:08 CST 2023
|
|
||||||
sdk.dir=D\:\\Android\\AndriodSDK
|
|
@ -1,6 +1,6 @@
|
|||||||
#Sat Sep 23 18:11:57 CST 2023
|
#Fri Nov 10 20:57:04 CST 2023
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|