Live formatting editText with markups/markdown - android

I have a slight issue. I wanna do something like we have here where we put in format markers such as this and this but I want it to appear in the edit text but not remove the marks for it. At the moment I'm achieving this with a preview button which displays an AlertDialog to show the previewed text.
I'm not sure which code to show as I have no idea how to do this at all. I also have no idea where to start on something like this. I've tried doing tons of research and it formats one word and then completely removes the markup/down for it.
Any help will be appreciated and I'm happy to supply any code whatsoever :)

I achieved this using a third-party library RichEditor and took the ones that I needed. It works really well for what I needed so I would recommend it for people to use.
It uses a webview for the EditText and then converts the text into a WYSIWYG formatting.

Related

Create a textfield which only supports copy-option

Is there a way to make a textfield (EditText, TextView) on Android which displays copyable text (no edit options)? Something like Swing's JTextField().setEditable(false) on Windows?
Edit: It seems that my question was a little bit unclear, so I'm going to give it some real-world context. I am working on a checksum calculator which lets you pick a file and prints the results of the calculation into 4 different textfields. I want the user to be able to copy those hashes from the textfield, but to disable all edit options.
I believe what you are asking is very straightforward and simple, if I am reading your question wrong, please correct me!
Are the four text fields that hold the results required to be EditText 's?
otherwise - >
Question:
How to make TextView only copyable, not editable
Answer:
Well using a TextView solves the not editable part
and if you take a look
at my android studio. I have a simple TextView with an attribute of
textIsSelectable="true"
allowing users to copy and paste!
Hope this helped!
-Stephen

Autocomplete/Autofill Edit Text Android

I am looking to achieve the functionality of an AutocompleteTextView but slightly different. Instead of getting a drop-down list with suggestions i want it to complete the sentence for me.
For example: i type abc and i get completed, with the rest of the text in grey: abc1#etc.etc and then click a button to keep this text or keep writing to filter this even further.
Do you think is is achievable somehow?
I have looked my problem up so far but all the answers i found involved a drop-down list, perhaps i haven't looked deep enough.
Why don't you try to implement a custom view?
Basically, you need to the same things that the AutoCompleteTextView does but instead of displaying N elements into the drop down list you have to add the first option to your EditText.
Have a look at:
TextWatcher in order to see how detect the user input and progress
You can then play with indexes and spannables in order to keep track of the data input by the user and the data that you are suggesting.
One thing that I don't like about this idea is the fact that if you have got:
Germans
Germany
...
You need to type a lot of letters without the possibility to choose something different from the solution that you are providing.
use below example ... i think help you...
http://teamandroid4u.blogspot.in/2012/06/autocompletetextview-example.html

How to make a custom EditText tool bar?

I am currently trying to make a Writing program. I would like the functionality of an Edit tool bar that contains things such as BOLD, ITALIC, UNDERLINE, etc. I see that it is under Typeface but I'm struggling to figure out how to make it function on just selected text or just for formatting text. I already have the GUI and button listeners in place. Thanks.
There is nothing really built into Android for this, except at a fairly low level. I have the beginnings of a RichEditText custom widget, as a drop-in EditText replacement, but it needs a fair bit of work, which I will get to later in June (I hope I hope I hope).
In a nutshell, you will need to get a Spannable object from your EditText via getText(), then call methods like setSpan() on it to apply your formatting.
Two words my friend, "creative commons". In my experience, mundane pieces of code like date/time pickers, RTF text boxes, etc.. they've all been coded and thought through more thoroughly than you'll ever have the time for. For something like this, don't reinvent the wheel, check out someone else's code, build on it, and check it back in.

How to create layout for listing tags, with the ability to click on specific ones and delete

I am looking to create something very similar to what Google has done in the Google+ app.
Its hard to describe but please take a look at this screenshot
Google+ app
I am looking to create something similar, of note is that the tags move to the proper line as they fit.
Is this a completely custom solution that Google wrote or is there a library for this somewhere.
It looks like they are decorating the text in the edit text by using spans. They probably have a listener on the edit text listening for modifications at which point they check to see if the most recently added word matches one of your circles. If it does, the create a span over the text and decorate it with a background drawable, font color change, and by adding an image next to it.
Its probably a pretty significant effort depending on how you want to function, but all that functionality is out there in the sdk.

Looking for Android number picker (10-key style)

I am looking around for a number picker in a 10-key style, ideally as a dialog... but called as an activity is fine too. I want to offer the user an interface that is a little more directed toward entering $ for an invoice amount field. I have seen adjustments to the date and time pickers but they looked awkward for this application. I have also seem someone call the built-in calculator, which would be fine, but I don't know how they were capturing a returned value (if they were). Any ideas? Yes, I can fall back to a regular edit field and the standard android keyboard... I was just hoping for something a little more slick. Thanks!
Have you tried setting the attribute android:numeric on the TextView?
TextView documentation

Categories

Resources