Xamarin Forms - WinPhone - Formatted text - html

My app needs to run on Android, iOS and WinPhone 8.1. It needs to have a page with a long text that include a lot of format:
bold
bullet list
link (http, mail, phone)
Because it has to run on all 3 platforms, I tried to create an HTML string in order to send it to a WebView like this :
MyWebView.Source = new HtmlWebViewSource {Html = stringHtml };
So I can use <b> for bolds, <ul> for bullet lists, <a> for links.
Because I need also a custom font and specific size, in my html string there is a new style with all these the informations.
It works.... but with 2 problems on Windows Phone:
all the bullet list font size are really smaller than the rest of text
all the pages show a blank webview, but if I reload it (a lot of times) or wait 3/4 seconds then it shows the content
Any idea about these problems?
And if there's another solution different from WebView... it's welcome!

Xamarin.Forms includes a FormattedText property in the Label (this guide should help you to understand it: Xamarin.Forms FormattedText). But there are some things you want to do that can't be done with it, and these are:
FormattedText doesn't have links, but if I'm not mistaken, if you use links in a WebView, they will only work within that WebView, so the link will be open in the same space as your text.
FormattedText doesn't have a bullet list. You can go around this problem adding the ASCII bullet character (in windows: Hold ALT and press the number 7) and some spaces to indent the paragraph.
The rest of what you want (bold, italic, color changes, etc.) FormattedText has.
Hope it helps! :)

Related

ADF RichTextEditor autosubmit doesn't work in Google Chrome

I'm facing a problem when using the RichTextEditor with autosubmit="true" in JDev 12c. The component is added programmatically on a form.
In Firefox the autosubmit fires correctly for any  kind of action (e.g.: typing, changing text style, etc)
On the other side in Chrome, not every action fires the autosubmit. For example, typing some text would fire the autosubmit, but then selecting the text and changing the color or the font size for example, doesn't fire a value change event / autosubmit.
Has anyone else encountered this type of behavior before?
Thanks in advance!
I had the same problem as well, RichTextEditor's text is very difficult to erase the content or reset programatically too,
I advise to use other text tools like the very known RichTextArea:
// Create a rich text area
final RichTextArea rtArea = new RichTextArea();
rtArea .setCaption("My Rich Text Area");
// Set initial content as HTML
rtArea .setValue("<h1>Hello</h1>\n" +
"<p>This rich text area contains some text.</p>");
Then you could resize it to the size of the RichTextEditor and give it the same visual color by some tricks through js and css as usual.

How to control the ios keyboard at the time of using the input tag of html

I am creating a learning Ipad app for the Japanese by using the objective-c.
The app downloads and views learning contents that has been made in HTML every time learning.
In English Learning contents of the application, There are input boxes to enter the English.
So, I want to control the ios keyboard to force the alphanumeric half size at the time of using the input box of html (or, to display the English keyboard by default),But I couldn't.
I tried using the type attribute specification of the input tag of html, but none could not be used.
I would like you to tell me if there is any good way.
You can't force-change the keyboard on the user, Apple doesn't allow that. If your UITextField requires a specific type of the standard keyboard, you can select that in Interface Builder or from code. If the user has selected a custom keyboard for themselves, you can't force them to change it to the one you want.

Flash CS6 dynamic text display not clear?

I am using dynamic text field to store score in it, I have embedded font that I am using and its only one.
But on run time while text changing one character at the left most becomes bogus/strange character, unable to figure out why its happening.
Finally I am using bitmap anti-alias for the dynamic field, it fixes the issue but text is not smooth.
If anyone had the same issue ?
You may have embedded the font, but have selected the correct character types to be embedded? i.e. if it's a score, then numerals needs to be selected like so:
(The dialog above may look slightly different in CS6, or may be somewhere else, I'm not sure; I don't use CS6)
Characters that are in the field when compiled will be embedded, and characters that aren't embedded won't render correctly.
Alternatively (instead of embedding), you can select "use device fonts" from the dropdown in the properties panel (if you have created the textfield from within Flash Pro rather than programatically), and that will fix it - literally just experienced this problem with an app I just completed and that was my fix.
If the above doesn't work, then I'm sure that it's something to do with the size of the textfield as mentioned above.
Use alternate fonts when prompted. Embed the fonts you chose, save and close your application and restart.
It solved my problem, its more likely that cs6 has this bug.
Changing CLASSIC TEXT to TLF TEXT solved the problem.

Is it possible to reset the style of content only for copying?

I've been asked to fix a few bugs on a website, and one of them is throwing me for a loop. Due to the style layout of this particular site, when a user selects and copies text from a specified area, they copy rich text data which if pasted into a rich text editor, results in a large black text on black-background blob.
Ideally, I would like to strip all style data, or somehow enable plain text copying on a particular set of data.
Is this possible? Or would I have to resort to something like a a Flash applet like what GitHub uses for Git URLs?
If you're happy with using JavaScript to solve the problem you can capture the "oncopy" events (credit to #FirstZero) on the elements you wish to restyle, and then restyle the element using JavaScript and style it back again after a timeout.
If you are okay using jQuery you can use JavaScript similar to the following:
$('p').bind(
'copy',
function(e) {
var copyElem= $(e.target);
var defaultColor = copyElem.css('color');
copyElem.css('color', 'pink'); // Change the color to pink for copy
window.setTimeout(
function() {copyElem.css('color', defaultColor);}, // Change it back
1
);
}
);
(Try it out in jsFiddle)
Note that this would be neater if there existed an onaftercopy event, but unfortunately there doesn't seem to.
I've only tested the above solution in Chrome, but it should work in Firefox (since 3.0), latest versions of Chrome and Safari, and in Internet Explorer. It will probably not work in Opera.
Many many years ago, I made a custom form that replicated the look of a menu on a video game. At the time, Firefox didn't allow many form UI widgets (Firefox 2.something?) to be styled with CSS. Apparently in the last few years that has changed.
What I wound up doing to resolve this problem was creating a very large input text-box with the content passed in via the value="" attribute. (<input type="text", not <textarea)
Despite the ability to style input boxes and their content, this information is not retained when copying the text itself. So I completely side-stepped the issue, and the fixes are live!
It was quite a bit simpler too, absolutely no-JS required.

Flash CS4: Font Disappearing

I have an odd issue while using FlashCS4.
I have a textfield that, when set to
STATIC TEXT works absolutely fine, in
the correct font.
If I set it to DYNAMIC TEXT, the text
shows up as Arial or some other
default on systems where the selected
font isn't available. It shows up in
the proper font on systems that have
the font installed.
If I set it to EMBED CHARACTERS the
text doesn't show up at all on ANY
system, whether the font is installed
or not.
I have tried embedding the font using the [EMBED] tag in my accompanying AS3 code, and I have the font added to the Library in CS4 as well.
In CS4 I've tried selecting the font for the textfield as both the standard OS Font, as well as the one with the Asterisk next to it, but get the same results both ways.
The library font is set to "export for actionscript" and "on frame 1". The font contains no bold/italic/etc. data, and I'm not using any special styling (other than centering the text).
I don't think it's an issue with the font not being available, otherwise it wouldn't show up when it is set to Dynamic without any embedded characters. It's also strange that it wouldn't show up on the computer that has the font installed.
Help?
Did you click on "Character Embedding" and selected Uppercase, lowercase, numerals and punctuation.
I've found that his problem occours when only a set amount is selected. This should work without any other embedding code, and should not need any library.
Try having just the dynamic textfield on a new flash file and try that only, it should work.
A good way of seeing if they embedded properly is when you rotate the text field, as un-embedded will not show up.
Also try this: Under publish settings -> Flash tab, set Generate size report, and it will show you the fonts and the characters that have been embedded.
if they're showing up there, there's something else you're doing or not doing that's causing this
Turns out the particular font I was using was broken somehow. I started using a different version of the font downloaded from a different site, and everything worked normally. I could not detect any errors or corruption in the original font's download. :/