Skip to content

Commit cce1de2

Browse files
author
duy
committed
Set tag for copy button in markdown view for testing
1 parent 668cdb7 commit cce1de2

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

modules/programming/src/main/java/com/symja/programming/document/view/MarkdownVisitor.java

+10-7
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ public class MarkdownVisitor extends AbstractVisitor {
8787
private TableRow tableRow;
8888
private boolean inHeader = false;
8989

90+
private int copyButtonCounter = 0;
91+
9092
MarkdownVisitor(@NonNull NativeMarkdownView container, @Nullable MarkdownViewDelegate delegate) {
9193
this.container = container;
9294
this.delegate = delegate;
@@ -211,17 +213,18 @@ public void visit(FencedCodeBlock fencedCodeBlock) {
211213
btnCopy.setTextColor(editorTheme.getFgColor());
212214
btnCopy.setIconTint(ColorStateList.valueOf(editorTheme.getFgColor()));
213215
divider.setVisibility(View.VISIBLE);
214-
divider.setBackgroundDrawable(new ColorDrawable(editorTheme.getGutterStyle().getFoldColor()));
216+
divider.setBackground(new ColorDrawable(editorTheme.getGutterStyle().getFoldColor()));
215217

216-
btnCopy.setOnClickListener(new View.OnClickListener() {
217-
@Override
218-
public void onClick(View v) {
219-
if (delegate != null) {
220-
delegate.onCopyCodeButtonClicked(v, code);
221-
}
218+
btnCopy.setOnClickListener(v -> {
219+
if (delegate != null) {
220+
delegate.onCopyCodeButtonClicked(v, code);
222221
}
223222
});
224223

224+
// for testing
225+
btnCopy.setTag("Copy button " + copyButtonCounter);
226+
copyButtonCounter++;
227+
225228
} else {
226229
btnCopy.setVisibility(View.GONE);
227230
divider.setVisibility(View.GONE);

0 commit comments

Comments
 (0)