Compare commits

...

2 Commits

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\庞浩的电脑\.android\avd\Pixel_3_API_22.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-04-07T06:12:47.008280900Z" />
</component>
</project>

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17_PREVIEW" project-jdk-name="temurin-17" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_17_PREVIEW" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>

@ -2,11 +2,11 @@
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/minote.iml" filepath="$PROJECT_DIR$/minote.iml" /> <module fileurl="file://$PROJECT_DIR$/.idea/modules/gitProject.iml" filepath="$PROJECT_DIR$/.idea/modules/gitProject.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/app/minote.app.iml" filepath="$PROJECT_DIR$/.idea/modules/app/minote.app.iml" /> <module fileurl="file://$PROJECT_DIR$/.idea/modules/app/gitProject.app.iml" filepath="$PROJECT_DIR$/.idea/modules/app/gitProject.app.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/app/minote.app.androidTest.iml" filepath="$PROJECT_DIR$/.idea/modules/app/minote.app.androidTest.iml" /> <module fileurl="file://$PROJECT_DIR$/.idea/modules/app/gitProject.app.androidTest.iml" filepath="$PROJECT_DIR$/.idea/modules/app/gitProject.app.androidTest.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/app/minote.app.main.iml" filepath="$PROJECT_DIR$/.idea/modules/app/minote.app.main.iml" /> <module fileurl="file://$PROJECT_DIR$/.idea/modules/app/gitProject.app.main.iml" filepath="$PROJECT_DIR$/.idea/modules/app/gitProject.app.main.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/app/minote.app.unitTest.iml" filepath="$PROJECT_DIR$/.idea/modules/app/minote.app.unitTest.iml" /> <module fileurl="file://$PROJECT_DIR$/.idea/modules/app/gitProject.app.unitTest.iml" filepath="$PROJECT_DIR$/.idea/modules/app/gitProject.app.unitTest.iml" />
</modules> </modules>
</component> </component>
</project> </project>

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$/../../../app" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="minote" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
<option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" />
<option name="LAST_KNOWN_AGP_VERSION" value="7.4.2" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../app/src/main/res;file://$MODULE_DIR$/../../../app/src/debug/res;file://$MODULE_DIR$/../../../app/build/generated/res/rs/debug;file://$MODULE_DIR$/../../../app/build/generated/res/resValues/debug" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../app/src/androidTest/res;file://$MODULE_DIR$/../../../app/src/androidTestDebug/res;file://$MODULE_DIR$/../../../app/build/generated/res/rs/androidTest/debug;file://$MODULE_DIR$/../../../app/build/generated/res/resValues/androidTest/debug" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/../../../app/build/intermediates/javac/debug/classes" />
<output-test url="file://$MODULE_DIR$/../../../app/build/intermediates/javac/debugUnitTest/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../../app">
<excludeFolder url="file://$MODULE_DIR$/../../../app/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/../../../app/build" />
</content>
<orderEntry type="jdk" jdkName="Android API 33, extension level 3 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app:main" external.linked.project.path="$MODULE_DIR$/../../../app" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.type="sourceSet" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../app/src/main/res;file://$MODULE_DIR$/../../../app/src/debug/res;file://$MODULE_DIR$/../../../app/build/generated/res/rs/debug;file://$MODULE_DIR$/../../../app/build/generated/res/resValues/debug" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../app/src/androidTest/res;file://$MODULE_DIR$/../../../app/src/androidTestDebug/res;file://$MODULE_DIR$/../../../app/build/generated/res/rs/androidTest/debug;file://$MODULE_DIR$/../../../app/build/generated/res/resValues/androidTest/debug" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/../../../app/build/intermediates/javac/debug/classes" />
<output-test url="file://$MODULE_DIR$/../../../app/build/intermediates/javac/debugUnitTest/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../../app/build/generated/aidl_source_output_dir/debug/out" />
<content url="file://$MODULE_DIR$/../../../app/build/generated/ap_generated_sources/debug/out">
<sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/ap_generated_sources/debug/out" isTestSource="false" generated="true" />
</content>
<content url="file://$MODULE_DIR$/../../../app/build/generated/renderscript_source_output_dir/debug/out" />
<content url="file://$MODULE_DIR$/../../../app/build/generated/res/resValues/debug">
<sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/res/resValues/debug" type="java-resource" />
</content>
<content url="file://$MODULE_DIR$/../../../app/build/generated/res/rs/debug" />
<content url="file://$MODULE_DIR$/../../../app/build/generated/source/buildConfig/debug">
<sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
</content>
<content url="file://$MODULE_DIR$/../../../app/src/debug" />
<content url="file://$MODULE_DIR$/../../../app/src/main">
<sourceFolder url="file://$MODULE_DIR$/../../../app/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../app/src/main/res" type="java-resource" />
</content>
<orderEntry type="jdk" jdkName="Android API 33, extension level 3 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app:unitTest" external.linked.project.path="$MODULE_DIR$/../../../app" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.type="sourceSet" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../app/src/main/res;file://$MODULE_DIR$/../../../app/src/debug/res;file://$MODULE_DIR$/../../../app/build/generated/res/rs/debug;file://$MODULE_DIR$/../../../app/build/generated/res/resValues/debug" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../app/src/androidTest/res;file://$MODULE_DIR$/../../../app/src/androidTestDebug/res;file://$MODULE_DIR$/../../../app/build/generated/res/rs/androidTest/debug;file://$MODULE_DIR$/../../../app/build/generated/res/resValues/androidTest/debug" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/../../../app/build/intermediates/javac/debug/classes" />
<output-test url="file://$MODULE_DIR$/../../../app/build/intermediates/javac/debugUnitTest/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../../app/build/generated/ap_generated_sources/debugUnitTest/out" />
<content url="file://$MODULE_DIR$/../../../app/src/test" />
<content url="file://$MODULE_DIR$/../../../app/src/testDebug" />
<orderEntry type="jdk" jdkName="Android API 33, extension level 3 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="minote.app.main" scope="TEST" />
</component>
<component name="TestModuleProperties" production-module="minote.app.main" />
</module>

@ -788,6 +788,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
case R.id.menu_export_text: { case R.id.menu_export_text: {
exportNoteToText(); exportNoteToText();
break; break;
} }
case R.id.menu_sync: { case R.id.menu_sync: {
if (isSyncMode()) { if (isSyncMode()) {
@ -809,6 +810,10 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
createNewNote(); createNewNote();
break; break;
} }
case R.id.menu_countallNotes: {
showNumberofNotes();
break;
}
case R.id.menu_search: case R.id.menu_search:
onSearchRequested(); onSearchRequested();
break; break;
@ -951,4 +956,11 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
} }
return false; return false;
} }
private void showNumberofNotes() {
AlertDialog.Builder btr = new AlertDialog.Builder(this);
btr.setTitle("目前便签数");
btr.setMessage("目前有 " + Integer.toString(mNotesListAdapter.retCount()) + "个便签");
btr.show();
}
} }

@ -181,4 +181,23 @@ public class NotesListAdapter extends CursorAdapter {
} }
} }
} }
public int retCount() {
int NotesCount = mNotesCount;
int ItemCount = getCount();
for (int i = 0; i < ItemCount; i++) {
Cursor c = (Cursor) getItem(i);
if (c != null) {
if (NoteItemData.getNoteType(c) == Notes.TYPE_NOTE) {
NoteItemData NoteItem = new NoteItemData(mContext, c);
NotesCount += NoteItem.getNotesCount();
}
} else {
Log.e(TAG, "Invalid cursor");
return -1;
}
}
return NotesCount;
}
} }

@ -65,16 +65,19 @@ public abstract class NoteWidgetProvider extends AppWidgetProvider {
使 getContentResolver() ContentResolver update() NoteColumns.WIDGET_ID + "=?" NoteColumns.WIDGET_ID ID values NoteColumns.WIDGET_ID AppWidgetManager.INVALID_APPWIDGET_ID*/ 使 getContentResolver() ContentResolver update() NoteColumns.WIDGET_ID + "=?" NoteColumns.WIDGET_ID ID values NoteColumns.WIDGET_ID AppWidgetManager.INVALID_APPWIDGET_ID*/
private Cursor getNoteWidgetInfo(Context context, int widgetId) {// 使用 getContentResolver() 方法获取 ContentResolver 对象,通过该对象进行对笔记数据库的查询操作 private Cursor getNoteWidgetInfo(Context context, int widgetId) {
return context.getContentResolver().query(Notes.CONTENT_NOTE_URI, // 使用 query() 方法查询笔记数据库,返回一个 Cursor 对象 return context.getContentResolver().query(Notes.CONTENT_NOTE_URI,
return context.getContentResolver().query(// 查询的 URI笔记数据库中笔记的内容保存在该 URI 下
PROJECTION, PROJECTION,
Notes.CONTENT_NOTE_URI, NoteColumns.WIDGET_ID + "=? AND " + NoteColumns.PARENT_ID + "<>?",
PROJECTION, new String[] { String.valueOf(widgetId), String.valueOf(Notes.ID_TRASH_FOLER) },
NoteColumns.WIDGET_ID + "=? AND " + NoteColumns.PARENT_ID + "<>?",// 查询的列,即笔记 ID、笔记背景颜色 ID 和笔记摘录内容 null);
new String[] { String.valueOf(widgetId), String.valueOf(Notes.ID_TRASH_FOLER) },//查询的条件,即笔记关联的小部件 ID 以及笔记的父 ID 不为回收站的笔记 }/*使ContentResolverNotes.CONTENT_NOTE_URIURI
null);// 排序方式,这里为 null 表示不排序
} PROJECTIONNoteColumns.WIDGET_IDNoteColumns.PARENT_IDNoteColumns.WIDGET_IDIDNoteColumns.PARENT_IDID
IDID使selectionArgssortOrdernull
CursorCursor*/
protected void update(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { protected void update(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
update(context, appWidgetManager, appWidgetIds, false); update(context, appWidgetManager, appWidgetIds, false);

@ -23,12 +23,11 @@
<item <item
android:id="@+id/menu_export_text" android:id="@+id/menu_export_text"
android:title="@string/menu_export_text"/> android:title="@string/menu_export_text" />
<item <item
android:id="@+id/menu_sync" android:id="@+id/menu_sync"
android:title="@string/menu_sync"/> android:title="@string/menu_sync" />
<item <item
android:id="@+id/menu_setting" android:id="@+id/menu_setting"
android:title="@string/menu_setting" /> android:title="@string/menu_setting" />
@ -36,4 +35,8 @@
<item <item
android:id="@+id/menu_search" android:id="@+id/menu_search"
android:title="@string/menu_search"/> android:title="@string/menu_search"/>
<item
android:id="@+id/menu_countallNotes"
android:title="@string/menu_countallNotes"/>
</menu> </menu>

@ -119,6 +119,7 @@
<string name="button_delete">Delete</string> <string name="button_delete">Delete</string>
<string name="call_record_folder_name">Call notes</string> <string name="call_record_folder_name">Call notes</string>
<string name="hint_foler_name">Input name</string> <string name="hint_foler_name">Input name</string>
<string name="menu_countallNotes" translatable="false">countallNotes" </string>
<string name="search_label">Searching Notes</string> <string name="search_label">Searching Notes</string>
<string name="search_hint">Search notes</string> <string name="search_hint">Search notes</string>

@ -63,7 +63,7 @@
</style> </style>
<style name="NoteActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid"> <style name="NoteActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:displayOptions" /> <!--<item name="android:displayOptions" />-->
<item name="android:visibility">gone</item> <item name="android:visibility">visible</item>
</style> </style>
</resources> </resources>

@ -2,6 +2,7 @@
# as it contains information specific to your local configuration. # as it contains information specific to your local configuration.
# #
# Location of the SDK. This is only used by Gradle. # Location of the SDK. This is only used by Gradle.
# # For customization when using a Version Control System, please read the
#Fri Apr 07 12:55:13 CST 2023 # header note.
sdk.dir=D\:\\Androidsdk #Thu Apr 13 12:26:55 GMT+08:00 2023
sdk.dir=C\:\\Users\\zxy\\AppData\\Local\\Android\\Sdk

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="minote" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Loading…
Cancel
Save