Commit 122246be authored by wanglei's avatar wanglei

...

parent 665edc94
...@@ -4,4 +4,27 @@ object SearchRecordUtils { ...@@ -4,4 +4,27 @@ object SearchRecordUtils {
const val SEARCH_RECORD_SP_KEY = "SEARCH_RECORD_SP_KEY" const val SEARCH_RECORD_SP_KEY = "SEARCH_RECORD_SP_KEY"
private fun getSearchRecord(): List<String> {
val sp = AppPreferences.getInstance().getString(SEARCH_RECORD_SP_KEY, "")
return if (sp.equals("")) {
listOf()
} else {
sp.split(",")
}
}
fun deleteSearchRecord(value: String) {
val list = getSearchRecord().toMutableList()
list.remove(value)
val string = list.joinToString(separator = ",")
AppPreferences.getInstance().put(SEARCH_RECORD_SP_KEY, string)
}
fun clearSearchRecord() {
AppPreferences.getInstance().put(SEARCH_RECORD_SP_KEY, "")
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment