first commit

unknown 9 months ago
commit f4c190c81f

9
.gitignore vendored

@ -0,0 +1,9 @@
# generated files
bin/
gen/
# Local configuration file (sdk path, etc)
project.properties
.settings/
.classpath
.project

@ -0,0 +1,2 @@
#Sun Jun 15 00:29:56 CST 2025
gradle.version=8.14.2

@ -0,0 +1,2 @@
#Sat Jun 14 15:16:47 CST 2025
java.home=C\:\\Program Files\\Android\\Android Studio\\jbr

Binary file not shown.

3
.idea/.gitignore vendored

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

@ -0,0 +1 @@
Notes

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="21" />
</component>
</project>

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetSelector">
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-06-15T03:39:56.990608400Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="LocalEmulator" identifier="path=C:\Users\ZhuanZ\.android\avd\Pixel_9_Pro_XL.avd" />
</handle>
</Target>
</DropdownSelection>
<DialogSelection />
</SelectionState>
</selectionStates>
</component>
</project>

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="CHOOSE_PER_TEST" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
</set>
</option>
</component>
</project>

@ -0,0 +1,119 @@
# Android Studio 项目设置指南
这个项目已经从2012年的Eclipse项目升级为现代Android Studio项目。
## 升级内容
1. **项目结构现代化**
- 从Eclipse项目结构转换为Gradle项目结构
- 创建了标准的Android Studio目录结构
2. **构建系统升级**
- 添加了Gradle构建脚本 (build.gradle)
- 配置了现代的Android Gradle插件
- 设置了合适的编译SDK版本 (API 34)
- 最低支持版本设为API 21 (Android 5.0)
3. **代码兼容性修复**
- 替换了已弃用的AsyncTask为ExecutorService + Handler
- 更新了SharedPreferences.Editor.commit()为apply()
- 修复了通知API以支持现代Android版本
- 添加了必要的android:exported属性
4. **依赖库更新**
- 迁移到AndroidX
- 添加了现代的支持库
## 在Android Studio中打开项目
1. 打开Android Studio
2. 选择 "Open an existing Android Studio project"
3. 导航到项目根目录并选择它
4. Android Studio会自动识别这是一个Gradle项目
5. 等待Gradle同步完成
## 可能需要的额外步骤
1. **如果遇到Gradle同步问题**
- 确保你的Android Studio是最新版本
- 检查是否安装了Java 8或更高版本
- 在Android Studio中检查SDK Manager确保安装了API 34
2. **如果遇到编译错误**
- 清理项目Build -> Clean Project
- 重新构建Build -> Rebuild Project
3. **运行项目**
- 连接Android设备或启动模拟器
- 点击运行按钮或使用Shift+F10
## 项目特性
- 小米便签的开源版本
- 支持便签创建、编辑、删除
- 支持文件夹管理
- 支持Google Task同步
- 支持桌面小部件
- 支持提醒功能
## 技术栈
- Android SDK API 21-34
- Java 8
- AndroidX
- Material Design组件
- SQLite数据库
- Google Tasks API (用于同步)
## 升级完成的具体修改
### 1. 项目结构改造
- ✅ 创建了标准的Gradle项目结构
- ✅ 移动源代码到 `app/src/main/java/`
- ✅ 移动资源文件到 `app/src/main/res/`
- ✅ 移动AndroidManifest.xml到 `app/src/main/`
### 2. 构建配置
- ✅ 创建了项目级别和应用级别的build.gradle文件
- ✅ 配置了现代Android Gradle插件 (8.1.4)
- ✅ 设置了合适的SDK版本 (compileSdk 34, minSdk 21, targetSdk 34)
- ✅ 添加了必要的依赖库 (AndroidX, Material Design)
### 3. 代码兼容性修复
- ✅ 替换AsyncTask为ExecutorService + Handler模式
- ✅ 修复SharedPreferences.Editor.commit()为apply()
- ✅ 更新通知API以支持Android 8.0+的通知渠道
- ✅ 添加PendingIntent.FLAG_IMMUTABLE标志
- ✅ 为所有组件添加android:exported属性
### 4. AndroidManifest.xml更新
- ✅ 添加了现代Android所需的属性
- ✅ 更新了权限声明以兼容分区存储
- ✅ 添加了必要的工具命名空间
### 5. 资源文件更新
- ✅ 添加了现代主题样式
- ✅ 添加了Material Design颜色
- ✅ 保持了原有的UI风格
## 注意事项
- ✅ 项目已完全升级并可在Android Studio中打开
- ⚠️ Google Tasks同步功能可能需要额外的API密钥配置
- ⚠️ 建议在现代Android设备上测试所有功能
- ⚠️ 某些UI元素可能需要根据现代设计规范进行调整
## 已知问题和建议
1. **存储权限**: 项目使用了传统的外部存储权限在Android 10+设备上可能需要额外处理
2. **主题适配**: 当前使用Holo主题建议升级到Material Design主题
3. **API兼容性**: 某些Google Tasks API可能已过时需要更新到最新版本
## 测试建议
1. 在不同Android版本的设备上测试 (API 21-34)
2. 测试便签的创建、编辑、删除功能
3. 测试文件夹管理功能
4. 测试桌面小部件功能
5. 测试导出功能
6. 测试同步功能如果配置了API密钥

190
NOTICE

@ -0,0 +1,190 @@
Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

@ -0,0 +1,125 @@
# 小米便签 (MiCode Notes)
## 项目简介
小米便签是一款轻量级的便签应用提供便签创建、编辑、管理等功能支持文件夹分类、便签提醒、桌面小部件等特性。本项目是小米便签的开源版本采用现代Android开发技术栈基于MVC架构模式设计。
## 主要功能
- **便签管理**:创建、编辑、删除便签
- **文件夹分类**:支持创建文件夹对便签进行分类管理
- **便签提醒**:可设置便签提醒时间,到点提醒
- **桌面小部件**支持2x2和4x4两种尺寸的桌面小部件
- **便签搜索**:快速查找便签内容
- **背景颜色**:支持设置便签背景颜色,便于分类识别
- **文本导出**:支持将便签导出为文本文件
- **Google Task同步**支持与Google Task同步(当前版本已禁用)
- **🆕 Markdown导出**支持将便签导出为Markdown格式
- **🆕 深色模式**:完整的深色主题支持,自动适配系统设置
- **🆕 标签管理**:为便签添加标签,支持按标签筛选和管理
## 新功能详细说明
### 1. Markdown导出功能
- 在便签列表菜单中选择"Export markdown"
- 自动将所有便签转换为标准Markdown格式
- 保持文件夹结构和便签层次关系
- 支持通话记录便签的特殊格式化
- 导出文件保存在 `/MIUI/notes/` 目录下
### 2. 深色模式支持
- 自动跟随系统深色模式设置
- 完整的深色主题配色方案
- 优化的文字对比度和可读性
- 所有界面元素都支持深色模式
### 3. 标签管理系统
- **创建标签**:在便签列表菜单中选择"Tag Manager"创建新标签
- **编辑标签**:点击标签可编辑名称,长按可删除
- **为便签添加标签**:在便签编辑界面菜单中选择"Add Tag"
- **标签筛选**:便签列表顶部显示标签筛选栏,点击标签按钮筛选便签
- **移除标签**:在便签编辑界面菜单中选择"Remove Tag"移除所有标签
#### 标签筛选选项
- **All Notes**:显示所有便签
- **Untagged**:显示未添加标签的便签
- **特定标签**:显示包含该标签的便签
## 系统架构
项目采用MVC架构模式主要分为以下几个模块
### 数据层 (Model)
- **data包**包含数据库相关类如Notes、NotesDatabaseHelper和NotesProvider
- **model包**定义核心数据模型如Note和WorkingNote类
### 视图层 (View)
- **ui包**包含所有用户界面相关类如NotesListActivity、NoteEditActivity等
- **widget包**:实现桌面小部件功能
### 控制层 (Controller)
- **tool包**提供工具类如BackupUtils、DataUtils等
- **gtask包**负责与Google Task同步的功能
## 技术特点
- 使用ContentProvider提供统一的数据访问接口
- 采用SQLite数据库存储便签数据
- 使用触发器(Trigger)维护数据一致性
- 实现AppWidget提供桌面小部件功能
- 采用异步任务处理数据同步
## 环境要求
- Android Studio 3.0+
- Android SDK API 21+
- JDK 8+
## 安装与使用
1. 克隆项目到本地:
```
git clone https://bdgit.educoder.net/pgjkpzfyq/MiCode-Notes.git
```
2. 使用Android Studio打开项目
3. 构建并运行项目到模拟器或实际设备
## 主要类说明
| 包 | 类 | 主要作用 |
|---|---|---|
| data | Notes | 便签数据库,用于记录便签相关属性和数据 |
| data | NotesDatabaseHelper | 数据库帮助类,用于辅助创建、处理数据库的表目 |
| data | NotesProvider | 便签信息提供类,提供便签数据的访问接口 |
| model | Note | 便签模型类,表示便签的核心数据结构和操作方法 |
| model | WorkingNote | 工作便签类在UI层和数据层之间提供便捷的接口 |
| ui | NotesListActivity | 便签列表界面,显示所有便签和文件夹 |
| ui | NoteEditActivity | 便签编辑界面,用于创建和编辑便签 |
| ui | TagManagerActivity | 标签管理界面,用于创建、编辑和删除标签 |
| ui | TagFilterManager | 标签筛选管理器,处理便签列表的标签筛选功能 |
| model | Tag | 标签数据模型类,表示标签的核心数据结构和操作方法 |
| widget | NoteWidgetProvider | 桌面小部件提供者,管理便签小部件 |
| tool | BackupUtils | 备份工具类提供便签数据的导出和备份功能包含Markdown导出 |
## 项目目录结构
```
app/src/main/
├── java/net/micode/notes/
│ ├── data/ # 数据库相关类
│ ├── gtask/ # Google Task同步相关类
│ │ ├── data/ # 同步数据模型
│ │ ├── exception/ # 异常处理类
│ │ └── remote/ # 远程同步类
│ ├── model/ # 核心数据模型
│ ├── tool/ # 工具类
│ ├── ui/ # 用户界面类
│ └── widget/ # 桌面小部件类
└── res/ # 资源文件
```
## 开源协议
本项目遵循Apache License 2.0协议。

@ -0,0 +1,61 @@
plugins {
id 'com.android.application'
}
android {
namespace 'net.micode.notes'
compileSdk 34
defaultConfig {
applicationId "net.micode.notes"
minSdk 21
targetSdk 34
versionCode 1
versionName "0.1"
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
}
useLibrary 'org.apache.http.legacy'
packaging {
resources {
excludes += ['META-INF/DEPENDENCIES', 'META-INF/LICENSE', 'META-INF/LICENSE.txt', 'META-INF/NOTICE', 'META-INF/NOTICE.txt']
}
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.10.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.preference:preference:1.2.1'
// Apache HTTP Client for legacy code
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
implementation 'org.apache.httpcomponents:httpcore:4.4.16'
// Markdown support
implementation 'io.noties.markwon:core:4.6.2'
implementation 'io.noties.markwon:editor:4.6.2'
implementation 'io.noties.markwon:html:4.6.2'
// Material Components for dark mode
implementation 'com.google.android.material:material:1.11.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

@ -0,0 +1,21 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "net.micode.notes",
"variantName": "debug",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "0.1",
"outputFile": "app-debug.apk"
}
],
"elementType": "File",
"minSdkVersionForDexing": 24
}

@ -0,0 +1,2 @@
#- File Locator -
listingFile=../../../apk/debug/output-metadata.json

@ -0,0 +1,2 @@
appMetadataVersion=1.1
androidGradlePluginVersion=8.10.1

@ -0,0 +1,10 @@
{
"version": 3,
"artifactType": {
"type": "COMPATIBLE_SCREEN_MANIFEST",
"kind": "Directory"
},
"applicationId": "net.micode.notes",
"variantName": "debug",
"elements": []
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save