From 623b8854cc47d537ebab2b8986760d28dc10ddac Mon Sep 17 00:00:00 2001 From: firgk <1627368483@qq.com> Date: Tue, 23 Apr 2024 22:30:44 +0800 Subject: [PATCH] upload --- .gitignore | 15 ++ .idea/.gitignore | 3 + .idea/.name | 1 + .idea/compiler.xml | 6 + .idea/deploymentTargetDropDown.xml | 29 +++ .idea/encodings.xml | 6 + .idea/gradle.xml | 19 ++ .idea/migrations.xml | 10 + .idea/misc.xml | 9 + app/.gitignore | 1 + app/build.gradle.kts | 39 ++++ app/proguard-rules.pro | 21 ++ .../example/todo/ExampleInstrumentedTest.java | 26 +++ app/src/main/AndroidManifest.xml | 28 +++ app/src/main/ic_launcher-playstore.png | Bin 0 -> 11383 bytes .../com/example/todo/ListPersistence.java | 30 +++ .../java/com/example/todo/MainActivity.java | 100 ++++++++++ .../res/drawable/ic_launcher_background.xml | 170 ++++++++++++++++ .../res/drawable/ic_launcher_foreground.xml | 30 +++ app/src/main/res/layout/activity_main.xml | 45 +++++ .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 + .../mipmap-anydpi-v26/ic_launcher_round.xml | 5 + app/src/main/res/mipmap-hdpi/ic_launcher.webp | Bin 0 -> 800 bytes .../mipmap-hdpi/ic_launcher_foreground.webp | Bin 0 -> 598 bytes .../res/mipmap-hdpi/ic_launcher_round.webp | Bin 0 -> 2554 bytes app/src/main/res/mipmap-mdpi/ic_launcher.webp | Bin 0 -> 614 bytes .../mipmap-mdpi/ic_launcher_foreground.webp | Bin 0 -> 434 bytes .../res/mipmap-mdpi/ic_launcher_round.webp | Bin 0 -> 1650 bytes .../main/res/mipmap-xhdpi/ic_launcher.webp | Bin 0 -> 1088 bytes .../mipmap-xhdpi/ic_launcher_foreground.webp | Bin 0 -> 798 bytes .../res/mipmap-xhdpi/ic_launcher_round.webp | Bin 0 -> 3602 bytes .../main/res/mipmap-xxhdpi/ic_launcher.webp | Bin 0 -> 1792 bytes .../mipmap-xxhdpi/ic_launcher_foreground.webp | Bin 0 -> 1192 bytes .../res/mipmap-xxhdpi/ic_launcher_round.webp | Bin 0 -> 5626 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.webp | Bin 0 -> 2392 bytes .../ic_launcher_foreground.webp | Bin 0 -> 1792 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.webp | Bin 0 -> 8046 bytes app/src/main/res/values-night/themes.xml | 7 + app/src/main/res/values/colors.xml | 5 + .../res/values/ic_launcher_background.xml | 4 + app/src/main/res/values/strings.xml | 3 + app/src/main/res/values/themes.xml | 9 + app/src/main/res/xml/backup_rules.xml | 13 ++ .../main/res/xml/data_extraction_rules.xml | 19 ++ .../com/example/todo/ExampleUnitTest.java | 17 ++ build.gradle.kts | 4 + gradle.properties | 21 ++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 59203 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 185 ++++++++++++++++++ gradlew.bat | 89 +++++++++ settings.gradle.kts | 18 ++ todo.apk | Bin 0 -> 5464206 bytes 53 files changed, 998 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/.name create mode 100644 .idea/compiler.xml create mode 100644 .idea/deploymentTargetDropDown.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/gradle.xml create mode 100644 .idea/migrations.xml create mode 100644 .idea/misc.xml create mode 100644 app/.gitignore create mode 100644 app/build.gradle.kts create mode 100644 app/proguard-rules.pro create mode 100644 app/src/androidTest/java/com/example/todo/ExampleInstrumentedTest.java create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/ic_launcher-playstore.png create mode 100644 app/src/main/java/com/example/todo/ListPersistence.java create mode 100644 app/src/main/java/com/example/todo/MainActivity.java create mode 100644 app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 app/src/main/res/drawable/ic_launcher_foreground.xml create mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/values-night/themes.xml create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/ic_launcher_background.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/themes.xml create mode 100644 app/src/main/res/xml/backup_rules.xml create mode 100644 app/src/main/res/xml/data_extraction_rules.xml create mode 100644 app/src/test/java/com/example/todo/ExampleUnitTest.java create mode 100644 build.gradle.kts create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle.kts create mode 100644 todo.apk diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -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 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/.name b/.idea/.name new file mode 100644 index 0000000..4d94406 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +todo \ No newline at end of file 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/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..b083070 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..c2bae49 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ 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..29bddc6 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,39 @@ +plugins { + id("com.android.application") +} + +android { + namespace = "com.example.todo" + compileSdk = 34 + + defaultConfig { + applicationId = "com.example.todo" + 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") +} \ 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/todo/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/todo/ExampleInstrumentedTest.java new file mode 100644 index 0000000..c5bc76b --- /dev/null +++ b/app/src/androidTest/java/com/example/todo/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.todo; + +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.myapplication8", 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..f7951b5 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png new file mode 100644 index 0000000000000000000000000000000000000000..22212707c074d2adb42cfd6c481f7a59e6b78746 GIT binary patch literal 11383 zcmeIYX*`te8#jJgLW}KgQT9TTwUlizgsf3YlC4cDjAX`?ZB%!wB4jBsDv~7=$}pBu zk%rs8C8n`v#xRp%jM<;7Tl&5Hzy3eZ{pNChe9k$SWBq=Q@?>V2+6N-sFQ#nCCVds2|yLCga%;h~L6iIe8JS zyKDEn$ZCF&u@6Y4R&u)EQ!n!6{e#0%RG5$u}=jGv*^AjrM zlK9|89~n@B5ZvgiBlwY12mg}*$b&=iyWmINMjZT#>;OMfav}g=lOP2SMeV`Qe^dYe zAc2IgIM}07DBeun2L*hQ;&5j)<55hc`4mfOSyJ3)^th#&wibUdXyQqX=eK$L-7?Tj zTu%68rZ8r``m17A{eyUKG$Di5QZY7?Lq;waZ%R^gW%DHjYenRqc5=0-M_*3j&3CjN zbZ@;~i9FX<-r_l6vLpS_S^j%)*e}Jk3i-S*Z~Nw=HJHA^QwrKl8!`3Ii^$_BB)0wF zyuigI2WQx9XO+4zCMS}B*#U^A^5^p=+pC-|wmdqvK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QY!@Q@r?8>nIHz0j+5C-HMqjgJK9f^FuG z0Vu|T6Uj`mYbCA!XEi-ECBvFtYKIXIJ1J1Wvu2bw5Vdvb=*%hE&en>tqe<3#PY9|9 z-%J+z%7qw}{%XtdEE*DQX zenMf#JEhS=VO%SE{ngcy9q`{k1AHy^yT|q40Bl*97N#$czjm;aPDa;7-Mx5=Q4!+kw;fzZN7rfkl@OVJ;B=f zb<8JVh;gxU0*s2{LHb9J(Nc<`IfFs-_midwfQ^Ct+Y|3!zR?2MsLw<-r2Ha95>73m zT53vwXd|vu8uqiZr%*fpUECLyO{ub*fY9y|p<+FUu5!0b0MVLe*%h@&h$jP5e}7+l z0wt(AwlAqrSr7R7qEpZ|oZDJ_-BqVWbacI_`X)5X^~1S4o1hfu4HA8hBECmum4Urk z-1^+~ilx&!s>@|ISXs{dbXufL3Sa{KNxbOwL zMrq-w(U5_;TDIrP^RZJEV4JYxj-BVP)+@*)-`8qy+bVU=EQcOAw9kNQ@cr?N?uk@B z`lcKAleat|(o=N(TIHJx_&eVLG+x6Or|RlMH7>GP{wS?{B~hY1@{x#~tVMx0W=U7} zp)=T8ABvqVFRh7amR|N{2;Q#ePm*HPw~5GAkk!k_KbZT(uy2Q2GHqIuWE>?QA347c z*yCNvO0Vt57cAT>rK?;tjbObZe;%>Q0_{@*A84(jUgd`H2q0dG*lfU|?Uec6FiH~tSuW0kxB literal 0 HcmV?d00001 diff --git a/app/src/main/java/com/example/todo/ListPersistence.java b/app/src/main/java/com/example/todo/ListPersistence.java new file mode 100644 index 0000000..ea91ba5 --- /dev/null +++ b/app/src/main/java/com/example/todo/ListPersistence.java @@ -0,0 +1,30 @@ +package com.example.todo; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.ArrayList; + +public class ListPersistence { + public ListPersistence() { + } + + public void serializeList(ArrayList list, String fileName) { + try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(fileName))) { + oos.writeObject(list); + } catch (IOException e) { + e.printStackTrace(); + } + } + public ArrayList deserializeList(String fileName) { + ArrayList list = new ArrayList<>(); + try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(fileName))) { + list = (ArrayList) ois.readObject(); + } catch (IOException | ClassNotFoundException e) { + e.printStackTrace(); + } + return list; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/todo/MainActivity.java b/app/src/main/java/com/example/todo/MainActivity.java new file mode 100644 index 0000000..655c3d0 --- /dev/null +++ b/app/src/main/java/com/example/todo/MainActivity.java @@ -0,0 +1,100 @@ +package com.example.todo; + + +import android.content.Context; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.os.Handler; +import android.view.View; +import android.widget.AdapterView; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ListView; +import android.widget.ArrayAdapter; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; + +import java.io.File; +import java.util.ArrayList; +import java.util.Calendar; + +public class MainActivity extends AppCompatActivity { + + private EditText todoEditText; + private Button addButton; + private ListView todoListView; + private ArrayList todoList = new ArrayList<>(); + private ArrayAdapter todoAdapter; + + private ListPersistence listPersistence = new ListPersistence(); + private String TAG; + private String path; + private TextView leastMonth; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + + + todoEditText = findViewById(R.id.todoEditText); + addButton = findViewById(R.id.addButton); + todoListView = findViewById(R.id.todoListView); + + + todoAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, todoList); + todoListView.setAdapter(todoAdapter); + + + + System.out.println("启动"); + String fileName = "list.ser"; + // 内部存储私有空间 + String directory = getFilesDir().toString(); + path = directory + File.separatorChar + fileName; + // + System.out.println(path); + ArrayList todo_from_file = listPersistence.deserializeList(path); + for (String item : + todo_from_file) { + todoList.add(item); + // + System.out.println(item); + } + todoAdapter.notifyDataSetChanged(); + + + addButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + String todo = todoEditText.getText().toString(); + todo=todo.trim().replaceAll("(\r\n|\r|\n)$", ""); + if (todo.trim().isEmpty()) { + todoEditText.setText(""); + } else if (!todo.isEmpty()) { + todoList.add(todo); + listPersistence.serializeList(todoList, path); + todoAdapter.notifyDataSetChanged(); + todoEditText.setText(""); + } + + } + }); + + + todoListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { + @Override + public boolean onItemLongClick(AdapterView parent, View view, int position, long id) { + // 在长按事件发生时执行删除操作 + String selectedItem = (String) parent.getItemAtPosition(position); + todoList.remove(selectedItem); + todoAdapter.notifyDataSetChanged(); + return true; + } + }); + + } + +} 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/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..7b62192 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,45 @@ + + + + + + + + + +