| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent cca70cc commit 8fc42ff
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -44,6 +44,6 @@ export function loadExamples() { | |||
| 44 | 44 | examples.set("background-shorthand", "css/background-shorthand"); | |
| 45 | 45 | examples.set("background-image-linear-gradient", "css/background-image-linear-gradient"); | |
| 46 | 46 | examples.set("background-image", "css/background-image"); | |
| 47 | - examples.set("clickable-span", "css/clickable-span"); | ||
| 47 | + examples.set("tappable-span", "css/tappable-span"); | ||
| 48 | 48 | return examples; | |
| 49 | 49 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,9 +5,9 @@ | |||
| 5 | 5 | <FormattedString> | |
| 6 | 6 | <FormattedString.spans> | |
| 7 | 7 | <Span text="The quick brown " style="font-weight: bold; color: green;" /> | |
| 8 | - <Span text="fox" style="font-weight: italic; color: green;" linkClick="foxTap"/> | ||
| 8 | + <Span text="fox" style="font-weight: italic; color: green;" linkTap="foxTap"/> | ||
| 9 | 9 | <Span text=" jumps over the lazy " style="font-weight: bold; color: red;" /> | |
| 10 | - <Span text="dog" style="font-weight: bold; color: blue;" linkClick="dogTap"/> | ||
| 10 | + <Span text="dog" style="font-weight: bold; color: blue;" linkTap="dogTap"/> | ||
| 11 | 11 | <Span text="." style="font-weight: bold; color: green;" /> | |
| 12 | 12 | </FormattedString.spans> | |
| 13 | 13 | </FormattedString> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -52,14 +52,14 @@ export class Span extends ViewBase { | |||
| 52 | 52 | public text: string; | |
| 53 | 53 | ||
| 54 | 54 | /** | |
| 55 | - * String value used when hooking to linkClicked event. | ||
| 55 | + * String value used when hooking to linkTap event. | ||
| 56 | 56 | */ | |
| 57 | - public static linkClickedEvent: string; | ||
| 57 | + public static linkTapEvent: string; | ||
| 58 | 58 | ||
| 59 | 59 | /** | |
| 60 | - * Gets if the span is clickable or not. | ||
| 60 | + * Gets if the span is tappable or not. | ||
| 61 | 61 | */ | |
| 62 | - public readonly clickable: boolean; | ||
| 62 | + public readonly tappable: boolean; | ||
| 63 | 63 | ||
| 64 | 64 | //@private | |
| 65 | 65 | /** | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,9 +5,9 @@ import { FontStyle, FontWeight, } from "../ui/styling/font"; | |||
| 5 | 5 | import { TextDecoration, EventData } from "../ui/text-base"; | |
| 6 | 6 | ||
| 7 | 7 | export class Span extends ViewBase implements SpanDefinition { | |
| 8 | - static linkClickEvent = "linkClick"; | ||
| 8 | + static linkTapEvent = "linkTap"; | ||
| 9 | 9 | private _text: string; | |
| 10 | - private _clickable: boolean = false; | ||
| 10 | + private _tappable: boolean = false; | ||
| 11 | 11 | ||
| 12 | 12 | get fontFamily(): string { | |
| 13 | 13 | return this.style.fontFamily; | |
@@ -70,28 +70,28 @@ export class Span extends ViewBase implements SpanDefinition { | |||
| 70 | 70 | } | |
| 71 | 71 | } | |
| 72 | 72 | ||
| 73 | - get clickable(): boolean { | ||
| 74 | - return this._clickable; | ||
| 73 | + get tappable(): boolean { | ||
| 74 | + return this._tappable; | ||
| 75 | 75 | } | |
| 76 | 76 | ||
| 77 | 77 | addEventListener(arg: string, callback: (data: EventData) => void, thisArg?: any) { | |
| 78 | 78 | super.addEventListener(arg, callback, thisArg); | |
| 79 | - this._setClickable(this.hasListeners(Span.linkClickEvent)); | ||
| 79 | + this._setTappable(this.hasListeners(Span.linkTapEvent)); | ||
| 80 | 80 | } | |
| 81 | 81 | ||
| 82 | 82 | removeEventListener(arg: string, callback?: any, thisArg?: any) { | |
| 83 | 83 | super.removeEventListener(arg, callback, thisArg); | |
| 84 | - this._setClickable(this.hasListeners(Span.linkClickEvent)); | ||
| 84 | + this._setTappable(this.hasListeners(Span.linkTapEvent)); | ||
| 85 | 85 | } | |
| 86 | 86 | ||
| 87 | 87 | _setTextInternal(value: string): void { | |
| 88 | 88 | this._text = value; | |
| 89 | 89 | } | |
| 90 | 90 | ||
| 91 | - private _setClickable(value: boolean): void { | ||
| 92 | - if (this._clickable !== value) { | ||
| 93 | - this._clickable = value; | ||
| 94 | - this.notifyPropertyChange("clickable", value); | ||
| 91 | + private _setTappable(value: boolean): void { | ||
| 92 | + if (this._tappable !== value) { | ||
| 93 | + this._tappable = value; | ||
| 94 | + this.notifyPropertyChange("tappable", value); | ||
| 95 | 95 | } | |
| 96 | 96 | } | |
| 97 | 97 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,7 +72,7 @@ function initializeClickableSpan(): void { | |||
| 72 | 72 | onClick(view: android.view.View): void { | |
| 73 | 73 | const owner = this.owner.get(); | |
| 74 | 74 | if (owner) { | |
| 75 | - owner._emit(Span.linkClickEvent); | ||
| 75 | + owner._emit(Span.linkTapEvent); | ||
| 76 | 76 | } | |
| 77 | 77 | view.clearFocus(); | |
| 78 | 78 | view.invalidate(); | |
@@ -94,7 +94,7 @@ export class TextBase extends TextBaseCommon { | |||
| 94 | 94 | private _maxHeight: number; | |
| 95 | 95 | private _minLines: number; | |
| 96 | 96 | private _maxLines: number; | |
| 97 | - private _clickable: boolean = false; | ||
| 97 | + private _tappable: boolean = false; | ||
| 98 | 98 | private _defaultMovementMethod: android.text.method.MovementMethod; | |
| 99 | 99 | ||
| 100 | 100 | public initNativeView(): void { | |
@@ -148,7 +148,7 @@ export class TextBase extends TextBaseCommon { | |||
| 148 | 148 | if (!reset && this.formattedText) { | |
| 149 | 149 | return; | |
| 150 | 150 | } | |
| 151 | - this._setClickableState(false); | ||
| 151 | + this._setTappableState(false); | ||
| 152 | 152 | ||
| 153 | 153 | this._setNativeText(reset); | |
| 154 | 154 | } | |
@@ -169,7 +169,7 @@ export class TextBase extends TextBaseCommon { | |||
| 169 | 169 | ||
| 170 | 170 | const spannableStringBuilder = createSpannableStringBuilder(value); | |
| 171 | 171 | nativeView.setText(<any>spannableStringBuilder); | |
| 172 | - this._setClickableState(isStringClickable(value)); | ||
| 172 | + this._setTappableState(isStringTappable(value)); | ||
| 173 | 173 | ||
| 174 | 174 | textProperty.nativeValueChange(this, (value === null || value === undefined) ? "" : value.toString()); | |
| 175 | 175 | ||
@@ -353,10 +353,10 @@ export class TextBase extends TextBaseCommon { | |||
| 353 | 353 | this.nativeTextViewProtected.setText(<any>transformedText); | |
| 354 | 354 | } | |
| 355 | 355 | ||
| 356 | - _setClickableState(clickable: boolean) { | ||
| 357 | - if (this._clickable !== clickable) { | ||
| 358 | - this._clickable = clickable; | ||
| 359 | - if (this._clickable) { | ||
| 356 | + _setTappableState(tappable: boolean) { | ||
| 357 | + if (this._tappable !== tappable) { | ||
| 358 | + this._tappable = tappable; | ||
| 359 | + if (this._tappable) { | ||
| 360 | 360 | this.nativeViewProtected.setMovementMethod(android.text.method.LinkMovementMethod.getInstance()); | |
| 361 | 361 | this.nativeViewProtected.setHighlightColor(null); | |
| 362 | 362 | } | |
@@ -396,13 +396,13 @@ export function getTransformedText(text: string, textTransform: TextTransform): | |||
| 396 | 396 | } | |
| 397 | 397 | } | |
| 398 | 398 | ||
| 399 | - function isStringClickable(formattedString: FormattedString) { | ||
| 399 | + function isStringTappable(formattedString: FormattedString) { | ||
| 400 | 400 | if (!formattedString) { | |
| 401 | 401 | return false; | |
| 402 | 402 | } | |
| 403 | 403 | for (let i = 0, length = formattedString.spans.length; i < length; i++) { | |
| 404 | 404 | const span = formattedString.spans.getItem(i); | |
| 405 | - if (span.clickable) { | ||
| 405 | + if (span.tappable) { | ||
| 406 | 406 | return true; | |
| 407 | 407 | } | |
| 408 | 408 | } | |
@@ -507,8 +507,8 @@ function setSpanModifiers(ssb: android.text.SpannableStringBuilder, span: Span, | |||
| 507 | 507 | } | |
| 508 | 508 | } | |
| 509 | 509 | ||
| 510 | - const clickable = span.clickable; | ||
| 511 | - if (clickable) { | ||
| 510 | + const tappable = span.tappable; | ||
| 511 | + if (tappable) { | ||
| 512 | 512 | initializeClickableSpan(); | |
| 513 | 513 | ssb.setSpan(new ClickableSpan(span), start, end, android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); | |
| 514 | 514 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments