Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[Android] Fire event when a-label with pseudo_ref is clicked. (#2271)
Browse files Browse the repository at this point in the history
If a label is with pseudo_ref , then it will just fire an event, not open a new page.
Otherwise it will open a new page like normal a label do.
  • Loading branch information
zzqgork authored and YorkShen committed Apr 3, 2019
1 parent 81a5902 commit f466641
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import android.text.SpannableStringBuilder;

import com.taobao.weex.ui.component.richtext.span.ASpan;
import com.taobao.weex.ui.component.richtext.span.ItemClickSpan;

class ANode extends RichTextNode {

Expand Down Expand Up @@ -53,10 +54,14 @@ protected boolean isInternalNode() {
@Override
protected void updateSpans(SpannableStringBuilder spannableStringBuilder, int level) {
super.updateSpans(spannableStringBuilder, level);
if (attr != null && attr.containsKey(HREF)) {
ASpan aSpan = new ASpan(mInstanceId, attr.get(HREF).toString());
spannableStringBuilder.setSpan(aSpan, 0, spannableStringBuilder.length(),
createSpanFlag(level));
}
if (attr != null && attr.containsKey(RichTextNode.PSEUDO_REF)) {
ItemClickSpan itemClickSpan = new ItemClickSpan(mInstanceId, mComponentRef, attr.get(RichTextNode.PSEUDO_REF).toString());
spannableStringBuilder.setSpan(itemClickSpan, 0, spannableStringBuilder.length(),
createSpanFlag(level));
} else if (attr != null && attr.containsKey(HREF)) {
ASpan aSpan = new ASpan(mInstanceId, attr.get(HREF).toString());
spannableStringBuilder.setSpan(aSpan, 0, spannableStringBuilder.length(),
createSpanFlag(level));
}
}
}

0 comments on commit f466641

Please sign in to comment.