Home
last modified time | relevance | path

Searched refs:spans (Results 1 – 25 of 57) sorted by relevance

123

/frameworks/base/tools/aapt2/compile/
DPseudolocaleGenerator_test.cpp30 original_style.spans = {Span{"i", 1, 10}, Span{"b", 2, 3}, Span{"b", 6, 7}}; in TEST()
37 ASSERT_EQ(original_style.spans.size(), new_string->value->spans.size()); in TEST()
39 EXPECT_EQ(std::string("i"), *new_string->value->spans[0].name); in TEST()
40 EXPECT_EQ(std::u16string(u"H").size(), new_string->value->spans[0].first_char); in TEST()
41 EXPECT_EQ(std::u16string(u"Hello worl").size(), new_string->value->spans[0].last_char); in TEST()
43 EXPECT_EQ(std::string("b"), *new_string->value->spans[1].name); in TEST()
44 EXPECT_EQ(std::u16string(u"He").size(), new_string->value->spans[1].first_char); in TEST()
45 EXPECT_EQ(std::u16string(u"Hel").size(), new_string->value->spans[1].last_char); in TEST()
47 EXPECT_EQ(std::string("b"), *new_string->value->spans[2].name); in TEST()
48 EXPECT_EQ(std::u16string(u"Hello ").size(), new_string->value->spans[2].first_char); in TEST()
[all …]
/frameworks/base/core/tests/coretests/src/android/text/
DSpannedStringNoCopyTest.java45 final Object[] spans = copied.getSpans(0, copied.length(), Object.class); in testCopyConstructor_copyNoCopySpans_SpannableStringInternalImpl() local
46 assertNotNull(spans); in testCopyConstructor_copyNoCopySpans_SpannableStringInternalImpl()
47 assertEquals(3, spans.length); in testCopyConstructor_copyNoCopySpans_SpannableStringInternalImpl()
59 final Object[] spans = copied.getSpans(0, copied.length(), Object.class); in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl() local
60 assertNotNull(spans); in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl()
61 assertEquals(2, spans.length); in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl()
63 for (int i = 0; i < spans.length; i++) { in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl()
64 assertFalse(spans[i] instanceof NoCopySpan); in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl()
77 final Object[] spans = copied.getSpans(0, copied.length(), Object.class); in testCopyConstructor_copyNoCopySpans_OtherSpannedImpl() local
78 assertNotNull(spans); in testCopyConstructor_copyNoCopySpans_OtherSpannedImpl()
[all …]
DSpannableStringNoCopyTest.java45 final Object[] spans = copied.getSpans(0, copied.length(), Object.class); in testCopyConstructor_copyNoCopySpans_SpannableStringInternalImpl() local
46 assertNotNull(spans); in testCopyConstructor_copyNoCopySpans_SpannableStringInternalImpl()
47 assertEquals(3, spans.length); in testCopyConstructor_copyNoCopySpans_SpannableStringInternalImpl()
59 final Object[] spans = copied.getSpans(0, copied.length(), Object.class); in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl() local
60 assertNotNull(spans); in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl()
61 assertEquals(2, spans.length); in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl()
63 for (int i = 0; i < spans.length; i++) { in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl()
64 assertFalse(spans[i] instanceof NoCopySpan); in testCopyConstructor_doesNotCopyNoCopySpans_SpannableStringInternalImpl()
77 final Object[] spans = copied.getSpans(0, copied.length(), Object.class); in testCopyConstructor_copyNoCopySpans_OtherSpannableImpl() local
78 assertNotNull(spans); in testCopyConstructor_copyNoCopySpans_OtherSpannableImpl()
[all …]
DSpannableTest.java47 Object[] spans; in testGetSpans() local
52 spans = spannable.getSpans(0, 1, Object.class); in testGetSpans()
53 MoreAsserts.assertEquals(new Object[]{emptySpan}, spans); in testGetSpans()
54 spans = spannable.getSpans(0, 2, Object.class); in testGetSpans()
55 MoreAsserts.assertEquals(new Object[]{emptySpan, unemptySpan}, spans); in testGetSpans()
56 spans = spannable.getSpans(1, 2, Object.class); in testGetSpans()
57 MoreAsserts.assertEquals(new Object[]{emptySpan, unemptySpan}, spans); in testGetSpans()
58 spans = spannable.getSpans(2, 2, Object.class); in testGetSpans()
59 MoreAsserts.assertEquals(new Object[]{unemptySpan}, spans); in testGetSpans()
DSpannableStringBuilderTest.java57 Object[] spans = builder.getSpans(0, text.length(), Object.class, false); in testGetSpans_sortsByPriorityEvenWhenSortParamIsFalse() local
59 assertNotNull(spans); in testGetSpans_sortsByPriorityEvenWhenSortParamIsFalse()
60 assertEquals(4, spans.length); in testGetSpans_sortsByPriorityEvenWhenSortParamIsFalse()
62 assertEquals(fourth, spans[0]); in testGetSpans_sortsByPriorityEvenWhenSortParamIsFalse()
63 assertEquals(third, spans[1]); in testGetSpans_sortsByPriorityEvenWhenSortParamIsFalse()
65 assertEquals(second, spans[2]); in testGetSpans_sortsByPriorityEvenWhenSortParamIsFalse()
66 assertEquals(first, spans[3]); in testGetSpans_sortsByPriorityEvenWhenSortParamIsFalse()
DTextLineTest.java199 final Object[] spans = { new TabStopSpan.Standard(100) }; in testMeasure_Tab_LTR() local
200 final TabStops stops = new TabStops(100, spans); in testMeasure_Tab_LTR()
214 final Object[] spans = { new TabStopSpan.Standard(100) }; in testMeasure_Tab_RTL() local
215 final TabStops stops = new TabStops(100, spans); in testMeasure_Tab_RTL()
229 final Object[] spans = { new TabStopSpan.Standard(100) }; in testMeasure_Tab_BiDi() local
230 final TabStops stops = new TabStops(100, spans); in testMeasure_Tab_BiDi()
244 final Object[] spans = { new TabStopSpan.Standard(100) }; in testMeasure_Tab_BiDi2() local
245 final TabStops stops = new TabStops(100, spans); in testMeasure_Tab_BiDi2()
DTextUtilsTest.java153 private void checkContains(Spanned text, String[] spans, String spanName, in checkContains() argument
155 for (String i: spans) { in checkContains()
169 String[] spans; in testTemplateSpan() local
181 spans = result.getSpans(0, result.length(), String.class); in testTemplateSpan()
184 assertEquals(4, spans.length); in testTemplateSpan()
185 checkContains(result, spans, "before", 0, 1); in testTemplateSpan()
186 checkContains(result, spans, "during", 1, 4); in testTemplateSpan()
187 checkContains(result, spans, "after", 4, 5); in testTemplateSpan()
188 checkContains(result, spans, "during+after", 1, 5); in testTemplateSpan()
195 spans = result.getSpans(0, result.length(), String.class); in testTemplateSpan()
[all …]
DSpannedTest.java131 Object[] spans = s.getSpans(0, s.length(), Object.class); in checkPriority() local
133 for (int i = 0; i < spans.length - 1; i++) { in checkPriority()
134 assertEquals((s.getSpanFlags(spans[i]) & Spanned.SPAN_PRIORITY) >= in checkPriority()
135 (s.getSpanFlags(spans[i + 1]) & Spanned.SPAN_PRIORITY), in checkPriority()
/frameworks/base/core/tests/coretests/src/android/text/util/
DLinkifyTest.java114 URLSpan[] spans = spannable.getSpans(0, spannable.length(), URLSpan.class); in testAddLinks_addsLinksWhenDefaultSchemeIsNull() local
115 assertEquals("android.com and https://android.com should be linkified", 2, spans.length); in testAddLinks_addsLinksWhenDefaultSchemeIsNull()
116 assertEquals("https://android.com", spans[0].getURL()); in testAddLinks_addsLinksWhenDefaultSchemeIsNull()
117 assertEquals("android.com", spans[1].getURL()); in testAddLinks_addsLinksWhenDefaultSchemeIsNull()
125 URLSpan[] spans = spannable.getSpans(0, spannable.length(), URLSpan.class); in testAddLinks_addsLinksWhenSchemesArrayIsNull() local
126 assertEquals("android.com and https://android.com should be linkified", 2, spans.length); in testAddLinks_addsLinksWhenSchemesArrayIsNull()
128 assertEquals("http://https://android.com", spans[0].getURL()); in testAddLinks_addsLinksWhenSchemesArrayIsNull()
129 assertEquals("http://android.com", spans[1].getURL()); in testAddLinks_addsLinksWhenSchemesArrayIsNull()
138 URLSpan[] spans = spannable.getSpans(0, spannable.length(), URLSpan.class); in testAddLinks_prependsDefaultSchemeToBeginingOfLink() local
139 assertEquals("android.com should be linkified", 1, spans.length); in testAddLinks_prependsDefaultSchemeToBeginingOfLink()
[all …]
/frameworks/opt/setupwizard/library/test/robotest/src/com/android/setupwizardlib/view/
DRichTextViewTest.java63 Object[] spans = ((Spanned) text).getSpans(0, text.length(), Annotation.class); in testLinkAnnotation() local
64 assertThat(spans).isEmpty(); in testLinkAnnotation()
66 spans = ((Spanned) text).getSpans(0, text.length(), LinkSpan.class); in testLinkAnnotation()
67 assertThat(spans).hasLength(1); in testLinkAnnotation()
68 assertThat(spans[0]).isInstanceOf(LinkSpan.class); in testLinkAnnotation()
70 .that(((LinkSpan) spans[0]).getId()) in testLinkAnnotation()
89 LinkSpan[] spans = ((Spanned) text).getSpans(0, text.length(), LinkSpan.class); in testOnLinkClickListener() local
90 spans[0].onClick(textView); in testOnLinkClickListener()
92 verify(listener).onLinkClick(eq(spans[0])); in testOnLinkClickListener()
108 LinkSpan[] spans = ((Spanned) text).getSpans(0, text.length(), LinkSpan.class); in testLegacyContextOnClickListener() local
[all …]
/frameworks/base/core/java/android/text/
DSpanSet.java38 E[] spans; field in SpanSet
53 if (length > 0 && (spans == null || spans.length < length)) { in init()
55 spans = (E[]) Array.newInstance(classType, length); in init()
72 spans[numberOfSpans] = span; in init()
83 Arrays.fill(spans, numberOfSpans, prevNumberOfSpans, null); in init()
117 if (spans != null) { in recycle()
118 Arrays.fill(spans, 0, numberOfSpans, null); in recycle()
DSpannableStringInternal.java69 Object[] spans = src.getSpans(start, end, Object.class); in copySpans() local
71 for (int i = 0; i < spans.length; i++) { in copySpans()
72 if (ignoreNoCopySpan && spans[i] instanceof NoCopySpan) { in copySpans()
75 int st = src.getSpanStart(spans[i]); in copySpans()
76 int en = src.getSpanEnd(spans[i]); in copySpans()
77 int fl = src.getSpanFlags(spans[i]); in copySpans()
84 setSpan(spans[i], st - start, en - start, fl, false/*enforceParagraph*/); in copySpans()
219 Object[] spans = mSpans; in setSpan() local
223 if (spans[i] == what) { in setSpan()
268 Object[] spans = mSpans; in removeSpan() local
[all …]
DMeasuredParagraph.java359 MetricAffectingSpan[] spans = mt.mSpanned.getSpans(spanStart, spanEnd, in buildForMeasurement() local
361 spans = TextUtils.removeEmptySpans(spans, mt.mSpanned, MetricAffectingSpan.class); in buildForMeasurement()
363 paint, spans, spanStart, spanEnd, null /* native builder ptr */); in buildForMeasurement()
423 MetricAffectingSpan[] spans = mt.mSpanned.getSpans(spanStart, spanEnd, in buildForStaticLayout() local
425 spans = TextUtils.removeEmptySpans(spans, mt.mSpanned, in buildForStaticLayout()
427 mt.applyMetricsAffectingSpan(paint, spans, spanStart, spanEnd, builder); in buildForStaticLayout()
461 ReplacementSpan[] spans = mSpanned.getSpans(start, end, ReplacementSpan.class); in resetAndAnalyzeBidi() local
463 for (int i = 0; i < spans.length; i++) { in resetAndAnalyzeBidi()
464 int startInPara = mSpanned.getSpanStart(spans[i]) - start; in resetAndAnalyzeBidi()
465 int endInPara = mSpanned.getSpanEnd(spans[i]) - start; in resetAndAnalyzeBidi()
[all …]
DLayout.java341 ParagraphStyle[] spans = NO_PARA_SPANS; in getJustifyWidth() local
351 spans = getParagraphSpans(sp, start, spanEnd, ParagraphStyle.class); in getJustifyWidth()
353 for (int n = spans.length - 1; n >= 0; n--) { in getJustifyWidth()
354 if (spans[n] instanceof AlignmentSpan) { in getJustifyWidth()
355 paraAlign = ((AlignmentSpan) spans[n]).getAlignment(); in getJustifyWidth()
361 final int length = spans.length; in getJustifyWidth()
364 if (spans[n] instanceof LeadingMarginSpan2) { in getJustifyWidth()
365 int count = ((LeadingMarginSpan2) spans[n]).getLeadingMarginLineCount(); in getJustifyWidth()
366 int startLine = getLineForOffset(sp.getSpanStart(spans[n])); in getJustifyWidth()
374 if (spans[n] instanceof LeadingMarginSpan) { in getJustifyWidth()
[all …]
DTextUtils.java1086 ReplacementSpan[] spans = ((Spanned) text).getSpans(offset, offset, in getOffsetBefore() local
1089 for (int i = 0; i < spans.length; i++) { in getOffsetBefore()
1090 int start = ((Spanned) text).getSpanStart(spans[i]); in getOffsetBefore()
1091 int end = ((Spanned) text).getSpanEnd(spans[i]); in getOffsetBefore()
1123 ReplacementSpan[] spans = ((Spanned) text).getSpans(offset, offset, in getOffsetAfter() local
1126 for (int i = 0; i < spans.length; i++) { in getOffsetAfter()
1127 int start = ((Spanned) text).getSpanStart(spans[i]); in getOffsetAfter()
1128 int end = ((Spanned) text).getSpanEnd(spans[i]); in getOffsetAfter()
1160 Object[] spans = source.getSpans(start, end, kind); in copySpansFrom() local
1162 for (int i = 0; i < spans.length; i++) { in copySpansFrom()
[all …]
/frameworks/base/core/jni/
Dandroid_util_StringBlock.cpp107 const ResStringPool_span* spans = osb->styleAt(idx); in android_content_StringBlock_nativeGetStyle() local
108 if (spans == NULL) { in android_content_StringBlock_nativeGetStyle()
112 const ResStringPool_span* pos = spans; in android_content_StringBlock_nativeGetStyle()
130 while (spans->name.index != ResStringPool_span::END) { in android_content_StringBlock_nativeGetStyle()
133 (jint*)spans); in android_content_StringBlock_nativeGetStyle()
134 spans++; in android_content_StringBlock_nativeGetStyle()
/frameworks/base/tools/aapt/
DStringPool.h75 entry_style(const entry_style& o) : offset(o.offset), spans(o.spans) { } in entry_style()
78 Vector<entry_style_span> spans; member
98 ssize_t add(const String16& value, const Vector<entry_style_span>& spans,
103 status_t addStyleSpans(size_t idx, const Vector<entry_style_span>& spans);
DStringPool.cpp123 ssize_t StringPool::add(const String16& value, const Vector<entry_style_span>& spans, in add() argument
128 addStyleSpans(res, spans); in add()
186 mEntryStyleArray[pos].spans.size() : 0; in add()
214 status_t StringPool::addStyleSpans(size_t idx, const Vector<entry_style_span>& spans) in addStyleSpans() argument
216 const size_t N=spans.size(); in addStyleSpans()
218 status_t err = addStyleSpan(idx, spans[i]); in addStyleSpans()
234 style.spans.add(span); in addStyleSpan()
343 if (style.spans.size() > 0) { in sortByConfig()
412 const size_t N = style.spans.size(); in writeStringBlock()
414 entry_style_span& span = style.spans.editItemAt(i); in writeStringBlock()
[all …]
/frameworks/opt/setupwizard/library/test/instrumentation/src/com/android/setupwizardlib/test/
DSpanHelperTest.java43 final Object[] spans = ssb.getSpans(0, ssb.length(), Object.class); in testReplaceSpan() local
44 assertEquals("There should be one span in the builder", 1, spans.length); in testReplaceSpan()
45 assertSame("The span should be newSpan", newSpan, spans[0]); in testReplaceSpan()
/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/notification/
DTextViewTransformState.java69 Object[] spans = ownSpanned.getSpans(0, ownSpanned.length(), Object.class); in hasSameSpans() local
72 if (spans.length != otherSpans.length) { in hasSameSpans()
75 for (int i = 0; i < spans.length; i++) { in hasSameSpans()
76 Object span = spans[i]; in hasSameSpans()
/frameworks/opt/setupwizard/library/platform/src/com/android/setupwizardlib/view/
DRichTextView.java67 final Annotation[] spans = spannable.getSpans(0, spannable.length(), Annotation.class); in getRichText() local
68 for (Annotation span : spans) { in getRichText()
135 final ClickableSpan[] spans = in hasLinks() local
137 return spans.length > 0; in hasLinks()
/frameworks/base/tools/aapt2/
DStringPool.cpp129 if (entry_->spans.size() != rhs.entry_->spans.size()) { in operator ==()
133 auto rhs_iter = rhs.entry_->spans.begin(); in operator ==()
134 for (const Span& span : entry_->spans) { in operator ==()
213 for (const aapt::Span& span : str.spans) { in MakeRef()
214 entry->spans.emplace_back(Span{MakeRef(span.name), span.first_char, span.last_char}); in MakeRef()
228 for (const Span& span : ref.entry_->spans) { in MakeRef()
229 entry->spans.emplace_back(Span{MakeRef(*span.name), span.first_char, span.last_char}); in MakeRef()
474 if (!entry->spans.empty()) { in Flatten()
476 out->NextBlock<android::ResStringPool_span>(entry->spans.size()); in Flatten()
477 for (const Span& s : entry->spans) { in Flatten()
/frameworks/base/core/java/android/view/textservice/
DTextInfo.java76 final SpellCheckSpan[] spans = spannableString.getSpans(0, spannableString.length(), in TextInfo() local
78 for (int i = 0; i < spans.length; ++i) { in TextInfo()
79 spannableString.removeSpan(spans[i]); in TextInfo()
/frameworks/opt/setupwizard/library/gingerbread/src/com/android/setupwizardlib/view/
DRichTextView.java67 final Annotation[] spans = spannable.getSpans(0, spannable.length(), Annotation.class); in getRichText() local
68 for (Annotation span : spans) { in getRichText()
149 final ClickableSpan[] spans = in hasLinks() local
151 return spans.length > 0; in hasLinks()
/frameworks/base/packages/SettingsLib/src/com/android/settingslib/widget/
DLinkTextView.java44 final ClickableSpan[] spans = in setText() local
46 if (spans.length > 0) { in setText()

123