[paid] ⭐ Text Formater Extension

Untitled design

Introducing

the TextFormater Extension by Mr.Koder

Are you looking to enhance the text formatting capabilities of your Mit app Inventor (AI2) projects? Look no further!

We're excited to introduce you to the TextFormater Extension, meticulously crafted by Mr.Koder, a passionate developer dedicated to simplifying your text manipulation needs.

TextFormater is a powerful and versatile extension designed to empower you with an array of text formatting tools, all at your fingertips. Whether you're striving to beautify your app's user interface or add interactive elements to your text, this extension is here to make your life easier.

Blocks

Events

TextClicked(AndroidViewComponent androidViewComponent, String clickedText):
An event that handles the click event of a clickable portion of the text. It dispatches the event with the clicked text as a parameter.

Methods



SetHyperlinkForTextComponent
block is a remarkable one that allows you to make a portion of the text within a TextBox or Label in an Android app clickable as a hyperlink and when you click on it you will redirected to the linked URL to the hyperlink text.

Result:

Screenshot 2023-10-01 223842



ApplyCustomFontWithOptions
This Block allows you to apply a custom font with various styling options to a portion of text within a TextView or TextBox component,

It checks if the provided source is a valid file path. If it's a file path, the custom font is loaded from that file. If not, it assumes that source is an asset file name and constructs the asset file path based on the package name.
in this example, I used material icons .otf file font :




before:

image


after:

image


Blocks:



ReplaceTextWithImage
This Block replaces a portion of text within a TextView or EditText component with an image loaded from either an asset or a file path. It offers customization options for the image's dimensions.

before:
Screenshot_1696904580


after:

Screenshot_1696904586


Blocks:



ReplaceTextWithImageFromURL
This Block replaces a portion of text within a TextView or EditText component with an image loaded from image URL. It offers customization options for the image's dimensions.

Note: This method needs memory space because it stores images loaded from their URLs. >You can locate these images in the package's cache folder.

Block:



JustifyText
This Block justifies the text within a TextView component. It takes a single parameter:




before:
Screenshot_1696904674


after:

Screenshot_1696904674


Blocks:



RemoveStyling(AndroidViewComponent androidViewComponent):
A function to remove all styling from the text in a TextView. It uses HtmlCompat.fromHtml to reset the text styling.



SetClickable(AndroidViewComponent androidViewComponent, int start, int end, int textColor, boolean underline): This function makes a specified portion of the text in a TextView clickable. It creates a ClickableSpan to handle the click event and set the text color and underline based on parameters.

Result:
Screenshot 2023-10-01 223842



SetUnderlineTextWithStyle , is designed to format a portion of the text within a TextView in an Android app. It allows you to apply different underline styles and colors to the specified text range.

Result:
Screenshot 2023-10-01 223842



SetTextMargins :
This blcok sets the left, right, top, and bottom margins (padding) for the text inside a TextView.
It adjusts the padding of the TextView, creating space around the text. This can be used to control the text's positioning within the TextView.



SetTextShadowForTextComponent :
This block applies a shadow effect to a specified portion of the text in a TextView or TextBox.

Result:

Screenshot 2023-10-01 223842



SetTextBorderForTextComponent:
This function adds a border around a specified portion of the text in a TextView.

border styles : The style of the border, such as "dotted," "dashed," "solid," "double,"

Result:
Screenshot 2023-10-01 223842



LinkfyTextComponent
block is a versatile tool for detecting and styling various types of content, such as URLs, emails, and numbers, within a TextBox or Label in an Android app.

Result:

Screenshot 2023-10-01 223842



GetEndPosForTextComponent :
This block retrieves the positions of the end (rightmost) character of each occurrence of a substring within the text content.




GetStartPosForTextComponent :
This block retrieves the positions of the start (leftmost) character of each occurrence of a substring within the text content.



BlurTextForTextComponent
block allows you to apply a blur effect to a specified portion of the text within a TextBox or Label in an Android app.

Result:

Screenshot 2023-10-01 223842



SetItalicTextForTextComponent :
This block allows you to make a portion of the text within a TextBox or Label appear in italic style.

Result:

Screenshot 2023-10-01 223842



HighlighTextComponent :
This block highlights a portion of the text in a TextBox or Label with a background color.

Results:

Screenshot 2023-10-01 223842



SetBoldTextForTextComponent :
This block applies bold formatting to a portion of the text within a TextBox or Label.


Result:
Screenshot 2023-10-01 223842



SetTextSizeForTextComponent :
This block sets the text size for a portion of the text within a TextBox or Label.

Result:

Screenshot 2023-10-01 223842



SetSubscriptTextForTextComponent :
This block allows you to apply a subscript style to a portion of the text within a TextBox or Label. Subscript text appears slightly below the normal text line.

Result:

Screenshot 2023-10-01 223842



SetSuperscriptTextForTextComponent :
This function allows you to apply a superscript style to a portion of the text within a TextBox or Label. Superscript text appears slightly above the normal text line.

Result:

Screenshot 2023-10-01 223842



ChangeColorOfTextForTextComponent :
This block allows you to change the color of a portion of the text within a TextBox or Label to a specified color.

Result:
blocks (1)



SetHorizontalTextGradientForTextComponent :
This block applies a horizontal gradient to the entire text within a TextBox or Label, transitioning from the startColor to the endColor from left to right.

Result:

Screenshot 2023-10-01 223842



SetVerticalTextGradientForTextComponent :
Similar to the previous function, this one applies a vertical gradient to the entire text within a TextBox or Label, transitioning from the startColor to the endColor from top to bottom.



SetMonospaceText :
This block sets the text in a TextView or TextBox to use a monospace font (fixed-width font), which is often used for code or other situations where characters should align vertically.


result:
Screenshot 2023-10-01 223842



SetMonospaceTextWithOptions:
This block allows you to set text as monospace in a TextView or TextBox while customizing various options within a specified text range. You can set the monospace font, text color, and highlight color for the specified range.

Results:

Screenshot 2023-10-01 223842

Screenshot 2023-10-02 225352



SetStrikethroughText:
This block applies a strikethrough style to a portion of the text in a TextView or TextBox, allowing you to visually indicate that the text has been crossed out.

Result:

Screenshot 2023-10-01 223842



FormatText:
This block applies full formate styles to a portion of the text in a TextView or TextBox, allowing you to fully formate text check format syntax

this is the simplest way to format text at all

Result:

Aix file :

you can buy it from PayPal it only costs 2$ and after you pay you will automatically be directed to the download URL of AIX file

Mr.Koder

1 Like

Or use the LabelPlus extension which offers similar features for free.

With my full respect I have already tried it before it has some blocks not working like "set custom font in range" and "set image in range" it always gives that the file not available in assets :confused:

I'm just saying this as feedback so I won't be misunderstood

And in my extension when I create hyperlink l don't want an event function to listen to clicks on the hyperlink the link automatically opened in browser ,

Also it has option to replace images not only from assets and local paths but also from their URLs.

Any one try it and these worked with him ?

Does it work in App Inventor? Please use App Inventor to test, since this is App Inventor Community.

Sorry, but it give me the the same error Also with mit app inventor :

Thanks for reporting the bugs, I'll look into it and fix it. I think it's just the wrong path to assets. I will modify and share the fix soon.

1 Like

Yes, in the app inventor there are two paths to assets, from Android 10 onwards it is different, which I did not introduce in this extension. Of course, the error is only in the companion, in the apk it was always ok.

Edit.
Paths corrected, now everything will be ok.

hey l dont see the download link to this extension

@njabulo_prince_mavik see

or if you need labelplus see here

1 Like

New big update added check it out :point_down: