新增搜索便签功能

pull/27/head
蒋天翔 3 months ago
parent 2e86cf6334
commit 19721c364f

@ -13,3 +13,8 @@
.externalNativeBuild
.cxx
local.properties
build.gradle.kts
gradle.properties
gradlew
gradlew.bat
settings.gradle.kts

@ -91,6 +91,15 @@
android:resource="@xml/searchable" />
</activity>
<!-- ==================== 搜索活动 ==================== -->
<activity
android:name=".ui.NoteSearchActivity"
android:label="@string/search"
android:launchMode="singleTop"
android:theme="@style/Theme.Notesmaster"
android:windowSoftInputMode="stateVisible|adjustResize"
android:exported="false" />
<!-- ==================== 内容提供者 ==================== -->
<!-- 提供笔记数据的访问接口,允许其他应用访问笔记数据 -->
<provider

@ -739,13 +739,15 @@ public class NotesRepository {
return;
}
String selection = "(" + NoteColumns.TYPE + " = ?) AND (" +
String selection = "(" + NoteColumns.TYPE + " <> ?) AND (" +
NoteColumns.TITLE + " LIKE ? OR " +
NoteColumns.SNIPPET + " LIKE ? OR " +
NoteColumns.ID + " IN (SELECT " + DataColumns.NOTE_ID +
" FROM data WHERE " + DataColumns.CONTENT + " LIKE ?))";
String[] selectionArgs = new String[]{
String.valueOf(Notes.TYPE_NOTE),
String.valueOf(Notes.TYPE_SYSTEM),
"%" + keyword + "%",
"%" + keyword + "%",
"%" + keyword + "%"
};

@ -746,8 +746,8 @@ public class NotesListActivity extends AppCompatActivity
switch (itemId) {
case R.id.menu_search:
// TODO: 打开搜索对话框
Toast.makeText(this, "搜索功能开发中", Toast.LENGTH_SHORT).show();
Intent searchIntent = new Intent(this, NoteSearchActivity.class);
startActivity(searchIntent);
return true;
case R.id.menu_new_folder:
// 创建新文件夹

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 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.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:color="#88555555" />
<item android:state_selected="true" android:color="#ff999999" />
<item android:color="#ff000000" />
</selector>

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 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.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#50000000" />
</selector>

@ -22,7 +22,7 @@
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/list_background">
android:background="@color/background_color">
<!-- 主内容区域 -->
<androidx.coordinatorlayout.widget.CoordinatorLayout
@ -89,6 +89,7 @@
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:contentDescription="@string/notelist_menu_new"
app:backgroundTint="@color/fab_color"
app:srcCompat="@android:drawable/ic_input_add" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

@ -17,7 +17,10 @@
<resources>
<color name="user_query_highlight">#335b5b5b</color>
<color name="primary_color">#1976D2</color>
<color name="primary_color">#263238</color>
<color name="on_primary_color">#FFFFFF</color>
<color name="background_color">#FAFAFA</color>
<color name="background_color">#E8E8E8</color>
<color name="primary_text_dark">#000000</color>
<color name="secondary_text_dark">#808080</color>
<color name="fab_color">#FFC107</color>
</resources>

@ -161,4 +161,9 @@
<string name="delete_confirmation">Are you sure you want to delete selected notes?</string>
<string name="menu_unpin">Unpin</string>
<string name="menu_unlock">Unlock</string>
<!-- Search related -->
<string name="search_no_results">No results found</string>
<string name="search_history_title">Search History</string>
<string name="search_history_clear">Clear</string>
</resources>

Loading…
Cancel
Save