diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b589d56 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..67f169a --- /dev/null +++ b/.idea/deploymentTargetSelector.xml @@ -0,0 +1,18 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..0897082 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..8978d23 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..5eedab0 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,41 @@ +plugins { + alias(libs.plugins.android.application) +} + +android { + namespace = "com.example.goukumusic" + compileSdk = 34 + + defaultConfig { + applicationId = "com.example.goukumusic" + minSdk = 24 + targetSdk = 34 + 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_17 + targetCompatibility = JavaVersion.VERSION_17 + } + buildToolsVersion = "34.0.0" +} + +dependencies { + + implementation(libs.appcompat) + implementation(libs.material) + implementation(libs.activity) + implementation(libs.constraintlayout) + testImplementation(libs.junit) + androidTestImplementation(libs.ext.junit) + androidTestImplementation(libs.espresso.core) +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/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/app/src/androidTest/java/com/example/goukumusic/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/goukumusic/ExampleInstrumentedTest.java new file mode 100644 index 0000000..276c6ee --- /dev/null +++ b/app/src/androidTest/java/com/example/goukumusic/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.goukumusic; + +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.goukumusic", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..5e9e27a --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/goukumusic/ForgetPassword.java b/app/src/main/java/com/example/goukumusic/ForgetPassword.java new file mode 100644 index 0000000..cf5857e --- /dev/null +++ b/app/src/main/java/com/example/goukumusic/ForgetPassword.java @@ -0,0 +1,55 @@ +package com.example.goukumusic; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; + +import androidx.activity.EdgeToEdge; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.graphics.Insets; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; + +public class ForgetPassword extends AppCompatActivity { + + private EditText UserName,Password,Password_again; + private Button Btn_return; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_forget_password); + setTitle("狗酷音乐新用户注册"); + // 添加监控 + UserName = (EditText) findViewById(R.id.username); + Password = (EditText) findViewById(R.id.password); + Password = (EditText) findViewById(R.id.password_again); + Button btn_forget_pwd = (Button) findViewById(R.id.btn_forget_pwd); + Btn_return = (Button) findViewById(R.id.btn_return); + + // 设置注册按钮btn_register监听器 + btn_forget_pwd.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent_register = new Intent(ForgetPassword.this, MainActivity.class); + Bundle bundle1 = new Bundle(); + bundle1.putString("usre_name", UserName.getText().toString()); + bundle1.putString("user_password", Password.getText().toString()); + bundle1.putString("user_password_again",Password_again.getText().toString()); + intent_register.putExtras(bundle1); //上传注册的参数 + startActivity(intent_register); + } + }); + + // 设置返回按钮btn_return监听器 + Btn_return.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent_return = new Intent(ForgetPassword.this, MainActivity.class); + startActivity(intent_return); + } + }); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/goukumusic/LoginSuccess.java b/app/src/main/java/com/example/goukumusic/LoginSuccess.java new file mode 100644 index 0000000..b0eb497 --- /dev/null +++ b/app/src/main/java/com/example/goukumusic/LoginSuccess.java @@ -0,0 +1,41 @@ +package com.example.goukumusic; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; + + +public class LoginSuccess extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_login_success); + setTitle("用户登录成功界面"); + TextView Name = (TextView) findViewById(R.id.username); +// TextView Password = (TextView) findViewById(R.id.password); + // 接受上传的参数 + Intent intent = this.getIntent(); + Bundle bundle = intent.getExtras(); + assert bundle != null; + String username = bundle.getString("user_name"); + String password = bundle.getString("user_password"); + // 将接受的参数和文件控件绑定 + Name.setText(String.format("用户名: %s", username)); +// Password.setText(String.format("密码: %s", password)); + Button button2 = (Button) findViewById(R.id.btn_return_login); + button2.setOnClickListener(new View.OnClickListener() { // 设置按钮的监听器 + @Override + public void onClick(View v) { + // 创建intent对象 + Intent intent = new Intent(LoginSuccess.this,MainActivity.class); + startActivity(intent); //启动Activity + finish(); //关闭Activity + } + }); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/goukumusic/MainActivity.java b/app/src/main/java/com/example/goukumusic/MainActivity.java new file mode 100644 index 0000000..c2eeb0d --- /dev/null +++ b/app/src/main/java/com/example/goukumusic/MainActivity.java @@ -0,0 +1,70 @@ +package com.example.goukumusic; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; + +import androidx.activity.EdgeToEdge; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.graphics.Insets; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; + +public class MainActivity extends AppCompatActivity { + /** + * author:xiaotao + */ + private EditText UserName,Password; + private Button Btn_login,Btn_tv_register,Btn_tv_find_pwd; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + setTitle("狗酷音乐用户登录系统"); + //组件初始化,获取获取 + UserName = (EditText)findViewById(R.id.username); + Password = (EditText)findViewById(R.id.password); + Btn_login = (Button) findViewById(R.id.btn_login); + Btn_tv_register = (Button) findViewById(R.id.btn_tv_register); + Btn_tv_find_pwd = (Button) findViewById(R.id.btn_tv_find_pwd); + + //获取注册得到的信息 +// Intent intent_register = this.getIntent(); +// Bundle bundle_register = intent_register.getExtras(); +// String register_username = bundle_register.getString("user_name"); +// String register_password = bundle_register.getString("user_password"); + + // 设置登录按钮Btn_login监听器 + Btn_login.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent_login = new Intent(MainActivity.this,LoginSuccess.class); + Bundle bundle = new Bundle(); + bundle.putString("user_name", UserName.getText().toString()); + bundle.putString("user_password", Password.getText().toString()); + intent_login.putExtras(bundle); // 上传参数 + startActivity(intent_login); + } + }); + + // 设置立即注册按钮Btn_tv_register监听器 + Btn_tv_register.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent_register = new Intent(MainActivity.this, Register.class); + startActivity(intent_register); + } + }); + + // 设置忘记密码按钮Btn_tv_find_pwd监听器 + Btn_tv_find_pwd.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent_find_pwd = new Intent(MainActivity.this, ForgetPassword.class); + startActivity(intent_find_pwd); + } + }); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/goukumusic/Register.java b/app/src/main/java/com/example/goukumusic/Register.java new file mode 100644 index 0000000..2fee79e --- /dev/null +++ b/app/src/main/java/com/example/goukumusic/Register.java @@ -0,0 +1,54 @@ +package com.example.goukumusic; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; + +import androidx.activity.EdgeToEdge; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.graphics.Insets; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; + +public class Register extends AppCompatActivity { + + private EditText UserName,Password; + private Button Btn_register; + private Button Btn_return; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_register); + setTitle("狗酷音乐新用户注册"); + // 添加监控 + UserName = (EditText) findViewById(R.id.username); + Password = (EditText) findViewById(R.id.password); + Btn_register = (Button) findViewById(R.id.btn_register); + Btn_return = (Button) findViewById(R.id.btn_return); + + // 设置注册按钮btn_register监听器 + Btn_register.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent_register = new Intent(Register.this, MainActivity.class); + Bundle bundle1 = new Bundle(); + bundle1.putString("user_name", UserName.getText().toString()); + bundle1.putString("user_password", Password.getText().toString()); + intent_register.putExtras(bundle1); //上传注册的参数 + startActivity(intent_register); + } + }); + + // 设置返回按钮btn_return监听器 + Btn_return.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent_return = new Intent(Register.this, MainActivity.class); + startActivity(intent_return); + } + }); + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable/background.jpeg b/app/src/main/res/drawable/background.jpeg new file mode 100644 index 0000000..9f5f54e Binary files /dev/null and b/app/src/main/res/drawable/background.jpeg differ diff --git a/app/src/main/res/drawable/bg1.jpeg b/app/src/main/res/drawable/bg1.jpeg new file mode 100644 index 0000000..336f71d Binary files /dev/null and b/app/src/main/res/drawable/bg1.jpeg differ diff --git a/app/src/main/res/drawable/c.png b/app/src/main/res/drawable/c.png new file mode 100644 index 0000000..026410e Binary files /dev/null and b/app/src/main/res/drawable/c.png differ diff --git a/app/src/main/res/drawable/gouku.png b/app/src/main/res/drawable/gouku.png new file mode 100644 index 0000000..774f53e Binary files /dev/null and b/app/src/main/res/drawable/gouku.png differ diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/psw_icon.png b/app/src/main/res/drawable/psw_icon.png new file mode 100644 index 0000000..b27fb7e Binary files /dev/null and b/app/src/main/res/drawable/psw_icon.png differ diff --git a/app/src/main/res/drawable/psw_icon_again.png b/app/src/main/res/drawable/psw_icon_again.png new file mode 100644 index 0000000..af8c225 Binary files /dev/null and b/app/src/main/res/drawable/psw_icon_again.png differ diff --git a/app/src/main/res/drawable/register_psw_bg.png b/app/src/main/res/drawable/register_psw_bg.png new file mode 100644 index 0000000..ba6e1b3 Binary files /dev/null and b/app/src/main/res/drawable/register_psw_bg.png differ diff --git a/app/src/main/res/drawable/register_user_name_bg.png b/app/src/main/res/drawable/register_user_name_bg.png new file mode 100644 index 0000000..00957bf Binary files /dev/null and b/app/src/main/res/drawable/register_user_name_bg.png differ diff --git a/app/src/main/res/drawable/return1.png b/app/src/main/res/drawable/return1.png new file mode 100644 index 0000000..4834776 Binary files /dev/null and b/app/src/main/res/drawable/return1.png differ diff --git a/app/src/main/res/drawable/star.png b/app/src/main/res/drawable/star.png new file mode 100644 index 0000000..51073bd Binary files /dev/null and b/app/src/main/res/drawable/star.png differ diff --git a/app/src/main/res/drawable/user_name_icon.png b/app/src/main/res/drawable/user_name_icon.png new file mode 100644 index 0000000..1384f87 Binary files /dev/null and b/app/src/main/res/drawable/user_name_icon.png differ diff --git a/app/src/main/res/layout/activity_forget_password.xml b/app/src/main/res/layout/activity_forget_password.xml new file mode 100644 index 0000000..61a79b3 --- /dev/null +++ b/app/src/main/res/layout/activity_forget_password.xml @@ -0,0 +1,200 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +