diff --git a/.idea/misc.xml b/.idea/misc.xml index 5241332..f539713 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,6 +3,7 @@ diff --git a/app/src/main/java/xyz/fycz/myreader/model/SearchWordEngine.kt b/app/src/main/java/xyz/fycz/myreader/model/SearchWordEngine.kt index 79502c6..a3fd4ca 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/SearchWordEngine.kt +++ b/app/src/main/java/xyz/fycz/myreader/model/SearchWordEngine.kt @@ -112,7 +112,7 @@ class SearchWordEngine( emitter.onNext(searchWord1) return@ObservableOnSubscribe } - var content = pageLoader.getChapterReader(chapter) + var content = chapter.title + "\n" + pageLoader.getChapterReader(chapter) content = pageLoader.contentHelper.replaceContent( book.name + "-" + book.author, book.source, diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchWordActivity.kt b/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchWordActivity.kt index 7ca570f..735aefc 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchWordActivity.kt +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/SearchWordActivity.kt @@ -2,6 +2,8 @@ package xyz.fycz.myreader.ui.activity import android.os.Bundle import android.view.KeyEvent +import android.view.Menu +import android.view.MenuItem import android.view.View import android.view.inputmethod.EditorInfo import android.view.inputmethod.InputMethodManager @@ -192,4 +194,20 @@ class SearchWordActivity : BaseActivity() { searchWordEngine.stopSearch() searchWordEngine.closeSearchEngine() } + + override fun onCreateOptionsMenu(menu: Menu?): Boolean { + menuInflater.inflate(R.menu.menu_search_word, menu) + return super.onCreateOptionsMenu(menu) + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + if (item.itemId == R.id.action_clear) { + adapter.clear() + searchWord = null + setUpToolbarTitle() + DbManager.getDaoSession().searchWordDao.deleteByKey(book.id) + return true + } + return super.onOptionsItemSelected(item) + } } \ No newline at end of file diff --git a/app/src/main/res/menu/menu_search_word.xml b/app/src/main/res/menu/menu_search_word.xml new file mode 100644 index 0000000..867b220 --- /dev/null +++ b/app/src/main/res/menu/menu_search_word.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b41b097..15eef49 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -514,6 +514,7 @@ 输入关键词 内容搜索 搜索书籍已缓存的内容 + 清除搜索结果 diff --git a/app/version_code.properties b/app/version_code.properties index b9904de..44f55a5 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,3 +1,3 @@ #Fri Jun 18 21:45:31 CST 2021 VERSION_CODE=226 -NEED_CREATE_RELEASE=true +NEED_CREATE_RELEASE=false