Wrap keywords with quotation marks if they are tags
This commit is contained in:
1 parent
c83fcee21a
commit
db31e5c740
1 file changed
+20
@@ -500,6 +500,23 @@ public final class GalleryListScene extends BaseScene
|
||||
}
|
||||
}
|
||||
|
||||
private String wrapTagKeyword(String keyword) {
|
||||
keyword = keyword.trim();
|
||||
|
||||
int index1 = keyword.indexOf(':');
|
||||
if (index1 == -1 || index1 >= keyword.length() - 1) {
|
||||
// Can't find :, or : is the last char
|
||||
return keyword;
|
||||
}
|
||||
int index2 = keyword.indexOf(' ');
|
||||
if (index2 <= index1) {
|
||||
// Can't find space, or space is before :
|
||||
return keyword;
|
||||
}
|
||||
|
||||
return keyword.substring(0, index1 + 1) + "\"" + keyword.substring(index1 + 1) + "$\"";
|
||||
}
|
||||
|
||||
// Update search bar title, drawer checked item
|
||||
private void onUpdateUrlBuilder() {
|
||||
ListUrlBuilder builder = mUrlBuilder;
|
||||
@@ -518,6 +535,9 @@ public final class GalleryListScene extends BaseScene
|
||||
|
||||
// Update search edit text
|
||||
if (!TextUtils.isEmpty(keyword) && null != mSearchBar) {
|
||||
if (builder.getMode() == ListUrlBuilder.MODE_TAG) {
|
||||
keyword = wrapTagKeyword(keyword);
|
||||
}
|
||||
mSearchBar.setText(keyword);
|
||||
mSearchBar.cursorToEnd();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user