├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── raw │ │ │ │ ├── ding.mp3 │ │ │ │ ├── bling.mp3 │ │ │ │ ├── bling2.aiff │ │ │ │ └── tap_wooden_fish.wav │ │ │ ├── drawable │ │ │ │ ├── cj.jpg │ │ │ │ ├── cjz.jpg │ │ │ │ ├── jsj.jpg │ │ │ │ ├── lxf.jpg │ │ │ │ ├── yhq.jpg │ │ │ │ ├── ic_launcher_foreground.xml │ │ │ │ └── ic_launcher_background.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ ├── ic_launcher_round.webp │ │ │ │ └── smarttodoicon_256.png │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── themes.xml │ │ │ ├── menu │ │ │ │ └── main.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── xml │ │ │ │ ├── backup_rules.xml │ │ │ │ └── data_extraction_rules.xml │ │ │ ├── values-night │ │ │ │ └── themes.xml │ │ │ └── layout │ │ │ │ ├── cardview_item.xml │ │ │ │ ├── activity_second.xml │ │ │ │ ├── activity_advise.xml │ │ │ │ └── first_layout.xml │ │ ├── java │ │ │ ├── baidu │ │ │ │ └── com │ │ │ │ │ ├── ChatCompletion.java │ │ │ │ │ ├── RequestBodyGenerator.java │ │ │ │ │ └── Sample.java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── emptyactivity │ │ │ │ ├── SecondActivity.java │ │ │ │ ├── AdviseActivity.java │ │ │ │ └── FirstActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── emptyactivity │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── example │ │ └── emptyactivity │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── .idea ├── .gitignore ├── compiler.xml ├── vcs.xml ├── migrations.xml ├── misc.xml ├── deploymentTargetSelector.xml └── gradle.xml ├── img ├── img.png ├── img_1.png ├── img_2.png └── img_3.png ├── gradle ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties └── libs.versions.toml ├── .gitignore ├── README.md ├── settings.gradle ├── gradle.properties ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # 默认忽略的文件 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /img/img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/img/img.png -------------------------------------------------------------------------------- /img/img_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/img/img_1.png -------------------------------------------------------------------------------- /img/img_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/img/img_2.png -------------------------------------------------------------------------------- /img/img_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/img/img_3.png -------------------------------------------------------------------------------- /app/src/main/res/raw/ding.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/raw/ding.mp3 -------------------------------------------------------------------------------- /app/src/main/res/drawable/cj.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/drawable/cj.jpg -------------------------------------------------------------------------------- /app/src/main/res/raw/bling.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/raw/bling.mp3 -------------------------------------------------------------------------------- /app/src/main/res/raw/bling2.aiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/raw/bling2.aiff -------------------------------------------------------------------------------- /app/src/main/res/drawable/cjz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/drawable/cjz.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/jsj.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/drawable/jsj.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/lxf.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/drawable/lxf.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/yhq.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/drawable/yhq.jpg -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/raw/tap_wooden_fish.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/raw/tap_wooden_fish.wav -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/smarttodoicon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FormerOR/Smart-Todo-App/HEAD/app/src/main/res/mipmap-xxxhdpi/smarttodoicon_256.png -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 智慧待办 3 | Version:3.0.1 By LucasLynn 4 | 这是一只赛博木鱼 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jun 10 12:03:26 HKT 2024 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /.idea/migrations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /app/src/test/java/com/example/emptyactivity/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.example.emptyactivity; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/res/xml/backup_rules.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | -------------------------------------------------------------------------------- /app/src/main/java/baidu/com/ChatCompletion.java: -------------------------------------------------------------------------------- 1 | package baidu.com; 2 | 3 | public class ChatCompletion { 4 | String id; 5 | String object; 6 | long created; 7 | String result; 8 | boolean isTruncated; 9 | boolean needClearHistory; 10 | Usage usage; 11 | 12 | // 注意:Usage类定义应包含prompt_tokens, completion_tokens, total_tokens字段 13 | static class Usage { 14 | int prompt_tokens; 15 | int completion_tokens; 16 | int total_tokens; 17 | } 18 | 19 | public String getResult() { 20 | return result; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | #66EAEEF4 11 | #FEFEFE 12 | #254CABF3 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Smart Todo App 2 | 3 | > ✏️作者:FormerOR(别名LucasLynn) 更新日期:2024年6月23日21:59:16 4 | > 5 | > 📝智慧待办,一款安卓应用,目标是在用户输入待办事项后,能通过AI分析来规划日程和事项安排,基于java开发 6 | > 7 | > 开发动机是NJUPT的Java程序设计课程大作业,老师给了几个选择,前几个都是清一色老掉牙的系统或者游戏,但最后两个分别是用Java开发安卓应用或者鸿蒙应用,然后觉得系统什么的也太无聊了,直接去CSDN都不用Chat出手,就打算自学一下安卓 8 | > 正好@feipiao594 他想做一个跨平台的Todolist,我就顺着他的思路想,发挥自己在AI上略知一二能力的优势,结合当下很火的NLP,做一个API调用来实现AI分析功能 9 | 10 | ## 船新升级 v3.0.1 11 | - 修改布局 12 | - 能够添加多个待办事项 13 | - 点击待办事项能够切换界面 14 | - 在新界面能够单独进行获取建议 15 | - 过长的文本能够实现自动滚动 16 | - 为控件添加了合适的间距和边框 17 | - 点击版本号能够跳转至Github仓库 18 | - 重构代码(依旧屎山) 19 | 20 | 21 | ## 应用截图 22 | ![img_2.png](img/img_2.png) 23 | ![img_3.png](img/img_3.png) -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | google { 4 | content { 5 | includeGroupByRegex("com\\.android.*") 6 | includeGroupByRegex("com\\.google.*") 7 | includeGroupByRegex("androidx.*") 8 | } 9 | } 10 | mavenCentral() 11 | gradlePluginPortal() 12 | } 13 | } 14 | dependencyResolutionManagement { 15 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 16 | repositories { 17 | google() 18 | mavenCentral() 19 | } 20 | } 21 | 22 | rootProject.name = "EmptyActivity" 23 | include ':app' 24 | -------------------------------------------------------------------------------- /app/src/main/res/xml/data_extraction_rules.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 12 | 13 | 19 | -------------------------------------------------------------------------------- /.idea/deploymentTargetSelector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/example/emptyactivity/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.example.emptyactivity; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | assertEquals("com.example.emptyactivity", appContext.getPackageName()); 25 | } 26 | } -------------------------------------------------------------------------------- /gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | agp = "8.5.0" 3 | junit = "4.13.2" 4 | junitVersion = "1.1.5" 5 | espressoCore = "3.5.1" 6 | appcompat = "1.6.1" 7 | material = "1.10.0" 8 | activity = "1.8.0" 9 | constraintlayout = "2.1.4" 10 | cardview = "1.0.0" 11 | 12 | [libraries] 13 | junit = { group = "junit", name = "junit", version.ref = "junit" } 14 | ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } 15 | espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } 16 | appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } 17 | material = { group = "com.google.android.material", name = "material", version.ref = "material" } 18 | activity = { group = "androidx.activity", name = "activity", version.ref = "activity" } 19 | constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" } 20 | cardview = { group = "androidx.cardview", name = "cardview", version.ref = "cardview" } 21 | 22 | [plugins] 23 | android-application = { id = "com.android.application", version.ref = "agp" } 24 | 25 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. For more details, visit 12 | # https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Enables namespacing of each library's R class so that its R class includes only the 19 | # resources declared in the library itself and none from the library's dependencies, 20 | # thereby reducing the size of the R class for that library 21 | android.nonTransitiveRClass=true -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 19 | 22 | 25 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | alias(libs.plugins.android.application) 3 | } 4 | 5 | android { 6 | namespace 'com.example.emptyactivity' 7 | compileSdk 34 8 | 9 | defaultConfig { 10 | applicationId "com.example.emptyactivity" 11 | minSdk 24 12 | targetSdk 34 13 | versionCode 1 14 | versionName "1.0" 15 | 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 | } 18 | 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | compileOptions { 26 | sourceCompatibility JavaVersion.VERSION_1_8 27 | targetCompatibility JavaVersion.VERSION_1_8 28 | } 29 | } 30 | 31 | dependencies { 32 | 33 | implementation libs.appcompat 34 | implementation libs.material 35 | implementation libs.activity 36 | implementation libs.constraintlayout 37 | implementation libs.cardview 38 | testImplementation libs.junit 39 | androidTestImplementation libs.ext.junit 40 | androidTestImplementation libs.espresso.core 41 | // 添加OkHttp的依赖 42 | implementation 'com.squareup.okhttp3:okhttp:4.12.0' 43 | // 添加Moshi的依赖 44 | implementation 'com.squareup.moshi:moshi:1.13.0' 45 | implementation 'com.squareup.moshi:moshi-adapters:1.13.0' 46 | implementation 'com.google.code.gson:gson:2.8.8' 47 | implementation 'com.google.android.material:material:1.8.0' 48 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/cardview_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 19 | 20 | 21 | 22 | 27 | 28 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/emptyactivity/SecondActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.emptyactivity; 2 | 3 | import android.media.MediaPlayer; 4 | import android.os.Bundle; 5 | import android.widget.Button; 6 | import android.widget.ImageView; 7 | import android.widget.TextView; 8 | 9 | import androidx.activity.EdgeToEdge; 10 | import androidx.appcompat.app.AppCompatActivity; 11 | import androidx.core.graphics.Insets; 12 | import androidx.core.view.ViewCompat; 13 | import androidx.core.view.WindowInsetsCompat; 14 | 15 | public class SecondActivity extends AppCompatActivity { 16 | 17 | @Override 18 | protected void onCreate(Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | EdgeToEdge.enable(this); 21 | setContentView(R.layout.activity_second); 22 | ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> { 23 | Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); 24 | v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); 25 | return insets; 26 | }); 27 | 28 | Button button2 = (Button) findViewById(R.id.Button_page2); 29 | TextView textView = (TextView) findViewById(R.id.textView4); 30 | ImageView imageView = (ImageView) findViewById(R.id.imageView); 31 | final MediaPlayer mediaPlayer = MediaPlayer.create(this, R.raw.tap_wooden_fish); 32 | button2.setOnClickListener(v -> { 33 | // 点击按钮后文本框数字加一 34 | int num = Integer.parseInt(textView.getText().toString()); 35 | textView.setText(String.valueOf(num + 1)); 36 | // 播放音效 37 | mediaPlayer.start(); 38 | 39 | // 切换图片,根据图片列表的顺序切换 40 | String[] imageList = {"cj", "jsj","yhq","lxf","cjz"}; 41 | int index = num % imageList.length; 42 | int imageId = getResources().getIdentifier(imageList[index], "drawable", getPackageName()); 43 | imageView.setImageResource(imageId); 44 | 45 | }); 46 | } 47 | } -------------------------------------------------------------------------------- /app/src/main/java/baidu/com/RequestBodyGenerator.java: -------------------------------------------------------------------------------- 1 | package baidu.com; 2 | 3 | import com.squareup.moshi.JsonAdapter; 4 | import com.squareup.moshi.Moshi; 5 | import okhttp3.MediaType; 6 | import okhttp3.RequestBody; 7 | 8 | import java.io.IOException; 9 | 10 | public class RequestBodyGenerator { 11 | 12 | private static final Moshi MOSHI = new Moshi.Builder().build(); 13 | private static final JsonAdapter JSON_ADAPTER = MOSHI.adapter(RequestBodyModel.class); 14 | 15 | // 定义一个数据模型类,对应请求体的结构 16 | public static class RequestBodyModel { 17 | public Message[] messages; 18 | public double temperature; 19 | public double top_p; 20 | public int penalty_score; 21 | public String system; 22 | 23 | // 必要的构造方法、getter和setter省略 24 | } 25 | 26 | public static class Message { 27 | public String role; 28 | public String content; 29 | 30 | public Message(String user, String userInput) { 31 | this.role = user; 32 | this.content = userInput; 33 | } 34 | 35 | // 必要的构造方法、getter和setter 36 | 37 | 38 | } 39 | 40 | /** 41 | * 根据用户输入动态生成RequestBody 42 | * @param userInput 用户的具体输入内容 43 | * @return 返回根据用户输入创建的RequestBody实例 44 | */ 45 | public static RequestBody createRequestBody(String userInput) throws IOException { 46 | // 创建请求体数据模型实例 47 | RequestBodyModel requestBodyModel = new RequestBodyModel(); 48 | requestBodyModel.messages = new Message[]{new Message("user", userInput)}; 49 | requestBodyModel.temperature = 0.95; 50 | requestBodyModel.top_p = 0.7; 51 | requestBodyModel.penalty_score = 1; 52 | // requestBodyModel.system = "你是一个“时间管理大师”,根据待办事项可以立刻做出合理精细且简洁的执行计划,执行计划是指将待办事项作为一个父任务,给出将执行待办事项需要完成的子任务计划。计划中的每个事件的内容格式为“开始时间-结束时间:具体内容:准备:建议:”。除了计划内容以外不要输出其他内容。请将具体内容分为几个点具体列出,同时给出准备和建议。"; 53 | requestBodyModel.system = "请制定一个合理的、精细的、简洁的执行计划,将待办任务分配成子任务,并标明每个子任务的开始和结束时间,以及具体的任务内容、准备工作和建议。请将具体任务内容细分为多个点详细列出,并提供准备和建议。注意,除了计划内容外,不应包含任何其他信息。"; 54 | // 使用Moshi将数据模型转换为JSON字符串 55 | String json = JSON_ADAPTER.toJson(requestBodyModel); 56 | return RequestBody.create(MediaType.parse("application/json; charset=utf-8"), json); 57 | } 58 | 59 | // public static void main(String[] args) { 60 | // try { 61 | // String userInput = "7:30-10:30去教学楼303拍摄一场招聘会"; 62 | // RequestBody body = createRequestBody(userInput); 63 | // // 现在你可以使用这个body发起网络请求 64 | // // ... 65 | // } catch (IOException e) { 66 | // e.printStackTrace(); 67 | // } 68 | // } 69 | } -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_second.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 |