Allow copy tags
This commit is contained in:
1 parent
b0e2ad5a7b
commit
b46032f633
4 files changed
+18
-2
No files matched your search
@@ -107,6 +107,7 @@ import com.hippo.scene.TransitionHelper;
|
||||
import com.hippo.text.Html;
|
||||
import com.hippo.text.URLImageGetter;
|
||||
import com.hippo.util.AppHelper;
|
||||
import com.hippo.util.ClipboardUtil;
|
||||
import com.hippo.util.ExceptionUtils;
|
||||
import com.hippo.util.ReadableTime;
|
||||
import com.hippo.view.ViewTransition;
|
||||
@@ -1427,7 +1428,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
.show();
|
||||
}
|
||||
|
||||
private void showTagDialog(final String tag) {
|
||||
private void showTagDialog(TextView tv, final String tag) {
|
||||
final Context context = getContext();
|
||||
if (null == context) {
|
||||
return;
|
||||
@@ -1445,6 +1446,12 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
final IntList menuId = new IntList();
|
||||
Resources resources = context.getResources();
|
||||
|
||||
menu.add(resources.getString(android.R.string.copy));
|
||||
menuId.add(R.id.copy);
|
||||
if (!tag.equals(tv.getText().toString())) {
|
||||
menu.add(resources.getString(R.string.copy_trans));
|
||||
menuId.add(R.id.copy_trans);
|
||||
}
|
||||
menu.add(resources.getString(R.string.show_definition));
|
||||
menuId.add(R.id.show_definition);
|
||||
menu.add(resources.getString(R.string.add_filter));
|
||||
@@ -1471,6 +1478,12 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
UrlOpener.openUrl(context, EhUrl.getTagDefinitionUrl(tag2), false);
|
||||
} else if (id == R.id.add_filter) {
|
||||
showFilterTagDialog(tag);
|
||||
} else if (id == R.id.copy) {
|
||||
ClipboardUtil.addTextToClipboard(tag);
|
||||
showTip(R.string.copied_to_clipboard, LENGTH_SHORT);
|
||||
} else if (id == R.id.copy_trans) {
|
||||
ClipboardUtil.addTextToClipboard(tv.getText().toString());
|
||||
showTip(R.string.copied_to_clipboard, LENGTH_SHORT);
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
@@ -1527,7 +1540,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
} else {
|
||||
String tag = (String) v.getTag(R.id.tag);
|
||||
if (null != tag) {
|
||||
showTagDialog(tag);
|
||||
showTagDialog((TextView) v, tag);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -751,4 +751,5 @@
|
||||
<string name="metered_network_warning">正在使用流量计费网络</string>
|
||||
<string name="read_from">从第 %d 页阅读</string>
|
||||
<string name="settings_request_news_title">启动时请求新闻页面</string>
|
||||
<string name="copy_trans">复制翻译</string>
|
||||
</resources>
|
||||
@@ -28,6 +28,7 @@
|
||||
<item name="edit_comment" type="id" />
|
||||
<item name="show_definition" type="id" />
|
||||
<item name="add_filter" type="id" />
|
||||
<item name="copy_trans" type="id" />
|
||||
|
||||
<item name="fab_translation_y" type="id" />
|
||||
<item name="fab_translation_y_animator" type="id" />
|
||||
|
||||
@@ -815,4 +815,5 @@
|
||||
<string name="metered_network_warning">Connected to metered networks</string>
|
||||
<string name="read_from">Read page %d</string>
|
||||
<string name="settings_request_news_title">Request news page on start</string>
|
||||
<string name="copy_trans">Copy translation</string>
|
||||
</resources>
|
||||
Reference in new issue
Block a user