commit 7e2a5023320eab96dfbc561ea2789f964f6eaf55 Author: mxb <3137609705@qq.com> Date: Sun Jun 2 14:55:59 2024 +0800 第一次提交 diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..8055b99 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,46 @@ +plugins { + id("com.android.application") +} + +android { + namespace = "com.hnucm.law4" + compileSdk = 34 + + defaultConfig { + applicationId = "com.hnucm.law4" + 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_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") + + implementation ("io.github.youth5201314:banner:2.2.3") + implementation ("com.github.bumptech.glide:glide:4.15.1") + +} \ No newline at end of file diff --git a/proguard-rules.pro b/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/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/src/androidTest/java/com/hnucm/law4/ExampleInstrumentedTest.java b/src/androidTest/java/com/hnucm/law4/ExampleInstrumentedTest.java new file mode 100644 index 0000000..5bbf50d --- /dev/null +++ b/src/androidTest/java/com/hnucm/law4/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.hnucm.law4; + +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.hnucm.law4", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a6af35d --- /dev/null +++ b/src/main/AndroidManifest.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/hnucm/law4/MainActivity.java b/src/main/java/com/hnucm/law4/MainActivity.java new file mode 100644 index 0000000..57bd0dc --- /dev/null +++ b/src/main/java/com/hnucm/law4/MainActivity.java @@ -0,0 +1,94 @@ +package com.hnucm.law4; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.constraintlayout.widget.ConstraintLayout; + +import android.os.Bundle; +import android.view.View; + +public class MainActivity extends AppCompatActivity { + + MainFragment mainFragment = new MainFragment(); + MassageFragment massageFragment = new MassageFragment(); + MyFragment myFragment = new MyFragment(); + PlanFragment planFragment = new PlanFragment(); + RequireFragment requireFragment = new RequireFragment(); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + getSupportFragmentManager().beginTransaction() + .add(R.id.layout,mainFragment) + .commit(); + getSupportFragmentManager().beginTransaction() + .add(R.id.layout,massageFragment) + .commit(); + getSupportFragmentManager().beginTransaction() + .add(R.id.layout,myFragment) + .commit(); + getSupportFragmentManager().beginTransaction() + .add(R.id.layout,planFragment) + .commit(); + getSupportFragmentManager().beginTransaction() + .add(R.id.layout,requireFragment) + .commit(); + + getSupportFragmentManager().beginTransaction() + .hide(planFragment).hide(requireFragment).hide(massageFragment).hide(myFragment) + .show(mainFragment).commit(); + + ConstraintLayout constraintLayout = findViewById(R.id.constraintLayout2); + ConstraintLayout constraintLayout2 = findViewById(R.id.constraintLayout); + ConstraintLayout constraintLayout3 = findViewById(R.id.constraintLayout3); + ConstraintLayout constraintLayout4 = findViewById(R.id.constraintLayout4); + ConstraintLayout constraintLayout5 = findViewById(R.id.constraintLayout5); + + constraintLayout.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + getSupportFragmentManager().beginTransaction() + .hide(planFragment).hide(requireFragment).hide(massageFragment).hide(myFragment) + .show(mainFragment).commit(); + } + }); + + constraintLayout2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + getSupportFragmentManager().beginTransaction() + .hide(mainFragment).hide(requireFragment).hide(massageFragment).hide(myFragment) + .show(planFragment).commit(); + } + }); + + constraintLayout3.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + getSupportFragmentManager().beginTransaction() + .hide(planFragment).hide(mainFragment).hide(massageFragment).hide(myFragment) + .show(requireFragment).commit(); + } + }); + + constraintLayout4.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + getSupportFragmentManager().beginTransaction() + .hide(planFragment).hide(requireFragment).hide(mainFragment).hide(myFragment) + .show(massageFragment).commit(); + } + }); + + constraintLayout5.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + getSupportFragmentManager().beginTransaction() + .hide(planFragment).hide(requireFragment).hide(massageFragment).hide(mainFragment) + .show(myFragment).commit(); + } + }); + + } +} \ No newline at end of file diff --git a/src/main/java/com/hnucm/law4/MainFragment.java b/src/main/java/com/hnucm/law4/MainFragment.java new file mode 100644 index 0000000..aadb16f --- /dev/null +++ b/src/main/java/com/hnucm/law4/MainFragment.java @@ -0,0 +1,33 @@ +package com.hnucm.law4; + +import android.os.Bundle; + +import androidx.fragment.app.Fragment; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.youth.banner.Banner; + +import java.util.ArrayList; +import java.util.List; + +public class MainFragment extends Fragment { + +//https://tse1-mm.cn.bing.net/th/id/OIP-C.DYI8ThDSDCx0ktvdecknDwHaDt?w=333&h=174&c=7&r=0&o=5&pid=1.7 + //https://tse3-mm.cn.bing.net/th/id/OIP-C.LZNNQUtlJO-oJG0j0FduNAHaDi?w=318&h=167&c=7&r=0&o=5&pid=1.7 + //https://tse2-mm.cn.bing.net/th/id/OIP-C.uZzfjR-j7uktyt3moCJxwQHaDt?w=328&h=174&c=7&r=0&o=5&pid=1.7 + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + + List list = new ArrayList<>(); + list.add("https://alifei04.cfp.cn/creative/vcg/800/new/VCG211411797047.jpg"); + list.add("https://tenfei04.cfp.cn/creative/vcg/800/new/VCG211299303675.jpg"); + list.add("https://tenfei03.cfp.cn/creative/vcg/800/new/VCG41157281931.jpg"); + + return inflater.inflate(R.layout.fragment_main, container, false); + } +} \ No newline at end of file diff --git a/src/main/java/com/hnucm/law4/MassageFragment.java b/src/main/java/com/hnucm/law4/MassageFragment.java new file mode 100644 index 0000000..55686f3 --- /dev/null +++ b/src/main/java/com/hnucm/law4/MassageFragment.java @@ -0,0 +1,20 @@ +package com.hnucm.law4; + +import android.os.Bundle; + +import androidx.fragment.app.Fragment; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + + +public class MassageFragment extends Fragment { + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_massage, container, false); + } +} \ No newline at end of file diff --git a/src/main/java/com/hnucm/law4/MyFragment.java b/src/main/java/com/hnucm/law4/MyFragment.java new file mode 100644 index 0000000..26a3c41 --- /dev/null +++ b/src/main/java/com/hnucm/law4/MyFragment.java @@ -0,0 +1,20 @@ +package com.hnucm.law4; + +import android.os.Bundle; + +import androidx.fragment.app.Fragment; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + + +public class MyFragment extends Fragment { + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_my, container, false); + } +} \ No newline at end of file diff --git a/src/main/java/com/hnucm/law4/PlanFragment.java b/src/main/java/com/hnucm/law4/PlanFragment.java new file mode 100644 index 0000000..3fe1036 --- /dev/null +++ b/src/main/java/com/hnucm/law4/PlanFragment.java @@ -0,0 +1,19 @@ +package com.hnucm.law4; + +import android.os.Bundle; + +import androidx.fragment.app.Fragment; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +public class PlanFragment extends Fragment { + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_plan, container, false); + } +} \ No newline at end of file diff --git a/src/main/java/com/hnucm/law4/RequireFragment.java b/src/main/java/com/hnucm/law4/RequireFragment.java new file mode 100644 index 0000000..b841ee3 --- /dev/null +++ b/src/main/java/com/hnucm/law4/RequireFragment.java @@ -0,0 +1,19 @@ +package com.hnucm.law4; + +import android.os.Bundle; + +import androidx.fragment.app.Fragment; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +public class RequireFragment extends Fragment { + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_require, container, false); + } +} \ No newline at end of file diff --git a/src/main/res/drawable/a.png b/src/main/res/drawable/a.png new file mode 100644 index 0000000..20ca47d Binary files /dev/null and b/src/main/res/drawable/a.png differ diff --git a/src/main/res/drawable/b.png b/src/main/res/drawable/b.png new file mode 100644 index 0000000..529c660 Binary files /dev/null and b/src/main/res/drawable/b.png differ diff --git a/src/main/res/drawable/c.png b/src/main/res/drawable/c.png new file mode 100644 index 0000000..d8846fe Binary files /dev/null and b/src/main/res/drawable/c.png differ diff --git a/src/main/res/drawable/ic_launcher_background.xml b/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/res/drawable/ic_launcher_foreground.xml b/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/res/drawable/img.png b/src/main/res/drawable/img.png new file mode 100644 index 0000000..ac29106 Binary files /dev/null and b/src/main/res/drawable/img.png differ diff --git a/src/main/res/drawable/img_1.png b/src/main/res/drawable/img_1.png new file mode 100644 index 0000000..46ba820 Binary files /dev/null and b/src/main/res/drawable/img_1.png differ diff --git a/src/main/res/drawable/img_2.png b/src/main/res/drawable/img_2.png new file mode 100644 index 0000000..b45a919 Binary files /dev/null and b/src/main/res/drawable/img_2.png differ diff --git a/src/main/res/drawable/img_3.png b/src/main/res/drawable/img_3.png new file mode 100644 index 0000000..a435e78 Binary files /dev/null and b/src/main/res/drawable/img_3.png differ diff --git a/src/main/res/drawable/img_4.png b/src/main/res/drawable/img_4.png new file mode 100644 index 0000000..500e269 Binary files /dev/null and b/src/main/res/drawable/img_4.png differ diff --git a/src/main/res/layout/activity_main.xml b/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..1878508 --- /dev/null +++ b/src/main/res/layout/activity_main.xml @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/res/layout/fragment_main.xml b/src/main/res/layout/fragment_main.xml new file mode 100644 index 0000000..627d329 --- /dev/null +++ b/src/main/res/layout/fragment_main.xml @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/res/layout/fragment_massage.xml b/src/main/res/layout/fragment_massage.xml new file mode 100644 index 0000000..9d4bb75 --- /dev/null +++ b/src/main/res/layout/fragment_massage.xml @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/res/layout/fragment_my.xml b/src/main/res/layout/fragment_my.xml new file mode 100644 index 0000000..63a2b71 --- /dev/null +++ b/src/main/res/layout/fragment_my.xml @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/res/layout/fragment_plan.xml b/src/main/res/layout/fragment_plan.xml new file mode 100644 index 0000000..abff6e0 --- /dev/null +++ b/src/main/res/layout/fragment_plan.xml @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/res/layout/fragment_require.xml b/src/main/res/layout/fragment_require.xml new file mode 100644 index 0000000..ef249d1 --- /dev/null +++ b/src/main/res/layout/fragment_require.xml @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/res/mipmap-hdpi/ic_launcher.webp b/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 Binary files /dev/null and b/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d Binary files /dev/null and b/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/src/main/res/mipmap-mdpi/ic_launcher.webp b/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 Binary files /dev/null and b/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d Binary files /dev/null and b/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/src/main/res/mipmap-xhdpi/ic_launcher.webp b/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 Binary files /dev/null and b/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 Binary files /dev/null and b/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 Binary files /dev/null and b/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 Binary files /dev/null and b/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/src/main/res/values-night/themes.xml b/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..97be96e --- /dev/null +++ b/src/main/res/values-night/themes.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/src/main/res/values/colors.xml b/src/main/res/values/colors.xml new file mode 100644 index 0000000..c8524cd --- /dev/null +++ b/src/main/res/values/colors.xml @@ -0,0 +1,5 @@ + + + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml new file mode 100644 index 0000000..96ca948 --- /dev/null +++ b/src/main/res/values/strings.xml @@ -0,0 +1,5 @@ + + law4 + + Hello blank fragment + \ No newline at end of file diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml new file mode 100644 index 0000000..d03ae0a --- /dev/null +++ b/src/main/res/values/themes.xml @@ -0,0 +1,9 @@ + + + + +