LabelPlus - Additional methods for the Label component

Blocks:

- These blocks set and return whether the entire label is clickable.


clickable - true - label is clickable, false - no clickable,

feedback - determines whether the click should be felt in the form of vibration or sound depending on the phone settings,

blocks (86)

blocks - 2021-05-30T195137.952

- This block sets the label text range as a clickable link.


hideLink - the text that will be returned to the Click event, if this text is empty, the method will return the clicked text,
clickableText - if this text is not empty, the method will find the first occurrence of this text in the label and replace it with link,
start and length - if the text attached to clickableText is empty, the method replace the text from "start" of length "length" into a link,

- This event detects clicks on the label and clicks on the clickable text. When clicking on a label, it returns component and empty text. When clicking on text, it returns the component and the clicked text.


- This event detects long clicks on the label. When long clicking on a label, it returns component.


- These blocks are used to set the type of permalinks to detect in label and activation of html links. These links are clickable and will open in your phone's default apps. We define the types of detected links using the LinkType block. We can also set the color of the links and remove the underline.


blocks - 2021-05-30T205506.486

- These blocks set and return whether multiline text is to be aligned on both sides by extending a space.


blocks (87)

blocks - 2021-05-30T203801.268

- These blocks set and return whether the label text should be selectable. We can select the text, for example, to copy it. We can also set the color of the selection.


blocks (88)

blocks - 2021-05-30T210313.984

- These blocks return whether the label contains highlighted text, and the position of the beginning and end of the selection.


blocks - 2021-05-31T215241.988

- These blocks set and return the method of truncating the text to one line. The ShortenType block is used to select the method. The START, MIDDLE and END methods truncate the text and place 3 dots at the beginning, middle or end of the text. The MARQUEE method scrolls the text.

These methods do not work when text is selectable.



- These blocks manage the number of lines in the label. Set and return the count of lines.


blocks - 2021-05-30T211841.991

- These blocks set and return text alignment horizontally and vertically.


- Set a shadow under text of the specified blur radius and color, and the specified distance from text position.


blocks - 2021-05-31T213400.441

- Sets a custom font for the label. You must add the font file to the app's assets.


- Sets the colors and shape of the label.


bgColorList - color list for label background gradient, if the list is single element, then the color will be uniform.
gradientOrientation - gradient orientation, four orientation properties in GradienOrientation block are available.
borderWidth - sets the width of the label border, if you do not want the border, set the value to 0.
borderColor - sets the color of the label border, if you don't want the border, set the value to any numeric value or any color.
padding - sets the text spacing from the edges of the label. Useful for a border so that the text does not overlap the border.
radius - sets the radius of the rounded corners, if you don't want rounding set the value to 0.

- Sets the color gradient for the label text. This also changes the color of the links.


- Sets the height to elevate label. Creates a shadow under the label.


- Sets the text style to bold or/and italic using the TextStyle block. You can also check whether the text is bold or italic.


blocks (13)

blocks (14)

- Sets the quote effect on the label by adding a vertical bar to the left of the label.


color - strip color
width - strip width (works from android9 +)
padding - width of the space between the bar and the text (works from android9 +)

blocks (16)

- Sets the blur effect on the text range.


radius - value specifies the amount of blur
blurEffect - the type of blur effect, we indicate with the BlurEffect block
textToBlur - if this text is not empty, the method will find the first occurrence of this text in the label and apply a blur effect to it
start and lenght - if the text attached to textToBlur is empty, specify the starting position and length of the text to which the blur effect is to be applied

- Inserts an image from the project's assets into the label. (New in v4)


image - select name of the picture from assets
height - image height
width - image width
textToReplaced - if this text is not empty, the method will find the first occurrence of this text in the label and replaces it with a picture
start and lenght - if the text attached to textToReplaced is empty, specify the starting position and length of the text that will be replaced with an image

- Sets the icon to the left of the label.


image - select name of the picture from assets
padding - width of the space between the icon and the text

blocks (74)

- Sets the font for the selected range of text in the label.


font - select name of the font from assets
textToReplaced - if this text is not empty, the method will find the first occurrence of this text in the label and replaces the font with your own font
start and lenght - if the text attached to textToReplaced is empty, specify the starting position and the length of the text, whose font will be replaced with your font

- Sets various decorations for a range of text.


typeDecoration - use the TypeDecoration block to set the decoration type, description below
value - the value that a given type of decoration requires
textToReplaced - if this text is not empty, the method will find the first occurrence of this text in the label and apply a decoration to it
start and lenght - if the text attached to textToReplaced is empty, specify the starting position and the length of the text, to which the decoration is to be applied

  • stretch - stretches the text horizontally, the value is a factor, and takes float numbers

  • background color - sets the background color under the text, value takes colors

  • color - sets the text color, value takes colors

  • font size - sets the font size, value takes integer values

  • strikethrough - sets text to strikethrough, set the value to any type

  • text style - to make text bold and / or italic, set the value with the TextStyle helper block of the TextStyle property.

  • underline - sets the text to underline, set the value to any type

- Set the paragraph bullets. To set a bullet, a paragraph must be a new line in the text.


radius - bullet radius
color - bullet color
padding - width of the space between the bullet and the text
textToReplaced - if this text is not empty, it must be a new line, the method will find the first occurrence of this text in the label and apply a bullet to it
start and lenght - if the text attached to textToReplaced is empty, specify the starting position and the length of the text of paragraph, to which the bullet is to be applied

- Set a scrollable label, we no longer need to put a label in the VerticalScrollArrangement.


blocks (34)

- Enable label scroll detection. As we scroll through the label, the Scrolled event will be triggered.


- The event that is triggered when the label is scrolled. Returns the current highest line displayed and the height in PX.


- Methods for scrolling the label programmatically.


  • scroll the text to the specified line

blocks (37)

  • scroll the text to the specified height, expressed in PX

blocks (38)

- Methods that return height and width values, expressed in PX.


  • height of the displayed label

  • the height of the entire text

  • width of the displayed label

  • width of the displayed text in specific line

- This method returns the height of the beginning of a specific line in label, in PX.


- Methods that return the text offset.


  • return the offset of the first character on a given line

  • return the offset of the last character on a given line

  • return a list of all instance offsets of the given text

- Returns the line where the given text offset occurs.


- Sets the ability to set the sharpness of the label. Appropriate events will be triggered when focus is got or lost.


blocks (50)

- Methods that programmatically request and clear focus on a label.


blocks (52)

blocks (51)

- The events that will be triggered when the focus is changed for the label.


blocks (49)

blocks (48)

- Methods to stretch text horizontally or vertically by the scale multiplier.


- Methods that shift the label horizontally or vertically by the pixel value.


blocks (57)

- The methods by which we rotate the label in any axis.


  • rotates label vertically by the specified angle

blocks (62)

  • rotates label horizontaly by the specified angle

blocks (61)

  • rotates the label along the Z axis

blocks (63)

  • Set the axis shift by the specified amount horizontally. The standard value is half the label width.

blocks (64)

  • Set the axis shift by the specified amount vertically. The standard value is half the label heigth.

blocks (65)

- A method for stretching the line spacing of a label.

Thanks @Ken


- This block sets the touch label..


touchable - true - label is touchable, false - no,

blocks (90)

- Events that will be triggered after touching and releasing the label..


component_event (1)

component_event (2)

- Method that sets multiple or single lines in a label.


multiline - true - the label has many lines, false - the label has one line,

blocks - 2023-10-28T214656.033

Extension v12:

  • new block "SetMultiLine" added

Extension v13:

  • fixed helper blocks
  • new block added: SetLinksUnderlined
  • new block added: SetActiveHtmlLinks
  • block removed: GetTypeLinksShow
  • block modified: SetAlignment

Extension v14:

  • fixed errors in the SetDecorationInRange block

Extension v15:

  • fixed errors in the SetColorAndShape block

com.extension.LabelPlus.aix (59.8 KB)

Test projects:

Using the extension with different links:
LabelPlusLinkTest.aia (57.8 KB)

44 Likes

Nice Extension :+1:

2 Likes

Also for constants you should use the naming conventions... for example
LinkTypeWEB_URLS should be LinkTypeWebUrls
etc

Taifun

3 Likes

During construction, at the beginning I had it. Later I changed to make the type of the constant more visible. I have a few more ideas so I will update and rename.

3 Likes

Great Extension! thanks a lot!

1 Like

Great extension !

1 Like

@Patryk_F to make the block image looks normal you have to download the image in this way.
First, do not left-click on the block, but left-click on the block editor, for example :

Screenshot (19)

@Patryk_F very good extension.
I am also thinking for similar to this I want to add spannable string support If I get time in summer I will discuss with mentor on this project.

2 Likes

I have a source of Label component with the above methods implemented. I can send you a file, you will change, you will improve, maybe some work will save.

1 Like

Yes I know about it. Here I just downloaded individual blocks from a sample project. I think it does not matter, blocks are visible and readable.

1 Like

I updated the extension.

  • new blocks added,
  • improved naming
2 Likes

Awesome Tool! :+1:

Possible to add a "long click" option so that accidentally brushing against the label does nothing?

1 Like

Thx. Yes, I can add that. I have a few more new ideas that I will also add and update the extension.

1 Like

Ultra cooooool extension !!!

1 Like

Is the modified extension available for download now?
If so, what is the URL?

1 Like

Nice extension!

1 Like

The link to the latest aix is at the bottom of the first post in this topic.

Not yet. Give me some time as I have other activities besides ai2 :blush:.

Hi @Patryk_F Great job, it works perfect :100:
Can we use the extension for textbox instead of labels. It would be so helpful if it worked for textbox as well.

My need is just that link blocks. detect links, numbers from a textbox.

2 Likes

I'm in the process of working on an extension for the textbox. I will see how this method works with textbox.

2 Likes