Add show tag definition

This commit is contained in:
seven332 committed 2016-03-26 22:39:13 +08:00
1 parent 10c814fc2b
commit dcac616391
7 files changed
+50 -31

No files matched your search

@@ -95,4 +95,8 @@ public class EhUrl {
public static String getAddFavorites(long gid, String token) {
return getHost() + "gallerypopups.php?gid=" + gid + "&t=" + token + "&act=addfav";
}
public static String getTagDefinitionUrl(String tag) {
return "https://ehwiki.org/wiki/" + tag.replace(' ', '_');
}
}
@@ -1204,32 +1204,46 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
filter.text = uploader;
EhFilter.getInstance().addFilter(filter);
showTip(getString(R.string.uploader_blocked, uploader), LENGTH_SHORT);
showTip(R.string.filter_added, LENGTH_SHORT);
}
}).show();
}
private void showBlockTagDialog(final String tag) {
Context context = getContext2();
private void addTagFilter(String tag) {
Filter filter = new Filter();
filter.mode = EhFilter.MODE_TAG;
filter.text = tag;
EhFilter.getInstance().addFilter(filter);
showTip(R.string.filter_added, LENGTH_SHORT);
}
private void showTagDialog(final String tag) {
final Context context = getContext2();
if (null == context) {
return;
}
String temp;
int index = tag.indexOf(':');
if (index >= 0) {
temp = tag.substring(index + 1);
} else {
temp = tag;
}
final String tag2 = temp;
new AlertDialog.Builder(context)
.setMessage(getString(R.string.block_the_tag, tag))
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
.setTitle(tag)
.setItems(R.array.tag_menu_entries, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (DialogInterface.BUTTON_POSITIVE != which) {
return;
switch (which) {
case 0:
UrlOpener.openUrl(context, EhUrl.getTagDefinitionUrl(tag2), false, true);
break;
case 1:
addTagFilter(tag);
break;
}
Filter filter = new Filter();
filter.mode = EhFilter.MODE_TAG;
filter.text = tag;
EhFilter.getInstance().addFilter(filter);
showTip(getString(R.string.tag_blocked, tag), LENGTH_SHORT);
}
}).show();
}
@@ -1252,7 +1266,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
} else {
String tag = (String) v.getTag(R.id.tag);
if (null != tag) {
showBlockTagDialog(tag);
showTagDialog(tag);
return true;
}
}
+3 -4
View File
@@ -190,10 +190,8 @@
<string name="remove_from_favorite_success">移除收藏</string>
<string name="add_to_favorite_failure">添加收藏失败</string>
<string name="remove_from_favorite_failure">移除收藏失败</string>
<string name="block_the_uploader">屏蔽上传者“%s”?</string>
<string name="block_the_tag">屏蔽标签“%s”?</string>
<string name="uploader_blocked">已屏蔽上传者“%s”</string>
<string name="tag_blocked">已屏蔽标签“%s”</string>
<string name="block_the_uploader">添加上传者过滤项“%s”?</string>
<string name="filter_added">已添加过滤项</string>
<!-- Rating -->
<string name="rating10">根本把持不住</string>
@@ -309,6 +307,7 @@
<string name="delete_filter">删除过滤项“%s”?</string>
<string name="tip">提示</string>
<string name="add_filter">添加过滤项</string>
<string name="show_definition">查看定义</string>
<string name="filter_text">过滤项文本</string>
<string name="filter_tip">标题过滤项:排除标题含有该关键字的画廊。\n\n上传者过滤项:排除该上传者上传的画廊。\n\n标签过滤项:排除包含该标签的画廊,这会使获取画廊列表花费更多时间。\n\n标签组过滤项:排除包含该标签组的画廊,这会使获取画廊列表花费更多时间。</string>
+3 -4
View File
@@ -190,10 +190,8 @@
<string name="remove_from_favorite_success">移除收藏</string>
<string name="add_to_favorite_failure">添加收藏失敗</string>
<string name="remove_from_favorite_failure">移除收藏失敗</string>
<string name="block_the_uploader">屏蔽上傳者“%s”?</string>
<string name="block_the_tag">屏蔽標籤“%s”?</string>
<string name="uploader_blocked">已屏蔽上傳者“%s”</string>
<string name="tag_blocked">已屏蔽標籤“%s”</string>
<string name="block_the_uploader">添加上傳者過濾項“%s”?</string>
<string name="filter_added">已添加過濾項</string>
<!-- Rating -->
<string name="rating10">根本把持不住</string>
@@ -309,6 +307,7 @@
<string name="delete_filter">刪除過濾項“%s”?</string>
<string name="tip">提示</string>
<string name="add_filter">添加過濾項</string>
<string name="show_definition">查看定義</string>
<string name="filter_text">過濾項文本</string>
<string name="filter_tip">標題過濾項:排除標題含有該關鍵字的畫廊。\n\n上傳者過濾項:排除該上傳者上傳的畫廊。\n\n標籤過濾項:排除包含該標籤的畫廊,這會使獲取畫廊列表花費更多時間。\n\n標籤組過濾項:排除包含該標籤組的畫廊,這會使獲取畫廊列表花費更多時間。</string>
+3 -4
View File
@@ -190,10 +190,8 @@
<string name="remove_from_favorite_success">移除收藏</string>
<string name="add_to_favorite_failure">新增收藏失敗</string>
<string name="remove_from_favorite_failure">移除收藏失敗</string>
<string name="block_the_uploader">遮蔽上傳者“%s”?</string>
<string name="block_the_tag">遮蔽標籤“%s”?</string>
<string name="uploader_blocked">已遮蔽上傳者“%s”</string>
<string name="tag_blocked">已遮蔽標籤“%s”</string>
<string name="block_the_uploader">新增上傳者過濾項“%s”?</string>
<string name="filter_added">已新增過濾項</string>
<!-- Rating -->
<string name="rating10">根本把持不住</string>
@@ -309,6 +307,7 @@
<string name="delete_filter">刪除過濾項“%s”?</string>
<string name="tip">提示</string>
<string name="add_filter">新增過濾項</string>
<string name="show_definition">檢視定義</string>
<string name="filter_text">過濾項文字</string>
<string name="filter_tip">標題過濾項:排除標題含有該關鍵字的畫廊。\n\n上傳者過濾項:排除該上傳者上傳的畫廊。\n\n標籤過濾項:排除包含該標籤的畫廊,這會使獲取畫廊列表花費更多時間。\n\n標籤組過濾項:排除包含該標籤組的畫廊,這會使獲取畫廊列表花費更多時間。</string>
+5
View File
@@ -139,4 +139,9 @@
<item>@string/filter_tag_namespace</item>
</string-array>
<string-array name="tag_menu_entries">
<item>@string/show_definition</item>
<item>@string/add_filter</item>
</string-array>
</resources>
+3 -4
View File
@@ -233,10 +233,8 @@
<string name="remove_from_favorite_success">Removed from favorites</string>
<string name="add_to_favorite_failure">Failed to add to favorites</string>
<string name="remove_from_favorite_failure">Failed to remove from favorites</string>
<string name="block_the_uploader">Block the uploader \"%s\"?</string>
<string name="block_the_tag">Block the tag \"%s\"?</string>
<string name="uploader_blocked">The uploader \"%s\" is blocked</string>
<string name="tag_blocked">The tag \"%s\" is blocked</string>
<string name="block_the_uploader">Add the uploader \"%s\" to filter list?</string>
<string name="filter_added">Filter added</string>
<!-- Rating -->
<string name="rating10">MASTERPIECE</string>
@@ -352,6 +350,7 @@
<string name="delete_filter">Delete filter \"%s\"?</string>
<string name="tip">Tip</string>
<string name="add_filter">Add filter</string>
<string name="show_definition">Show definition</string>
<string name="filter_text">Filter text</string>
<string name="filter_tip">Title Filter: exclude the gallery whose title contains the word.\n\nUploader Filter: exclude the gallery which was uploaded by the uploader.\n\nTag Filter: exclude the gallery which contain the tag, it takes more time to get gallery list.\n\nTag Namespace Filter: exclude the gallery which contain the tag namespace, it takes more time to get gallery list.</string>