统计小米便签数量

zxy_branch
邹兴云 2 years ago
parent 4086638dc2
commit 926c2306c6

@ -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>

@ -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;
}
}

@ -28,7 +28,6 @@
<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>
Loading…
Cancel
Save