Keylabel and keyOutputText issue - android

Ok I have noticed in the android softkeyboard when the user wants to send a smiley when the user prompts to a insert smiley a list of andriod smileys appear for the user to choose from Ive noticed that beside the smiley is a :) ( it varies depending on mood of smiley) Im thinking the code for that would read
<Key
android:keylabel:=":)"
android:keyOutputText="#drawable/image...." />
Im believing ( correct me if im wrong) if the uses manually types in a :) the drawable image will still appear?? Am I correct or No... Secondly If I add my own emoticons and instead of using the :) I use "*" as the Keylabel and my own image as the drawable outputtext would the user be able to use my emoticon?
Lastly, what if I only want for them to be able to select one of my emoticons to use without seeing the "*"..can I just use the android:KeyoutputText to produce the image or is the android:keylabel acting as a sort of prompt??

First, keyOutputText cannot refer to a drawable. It has to be text, a string.
Your emoticon will not appear in the text box (SMS box, or wherever you are typing) unless it is one of the built in smileys for that app. Otherwise, they'll only see something like this: "=)". To test it, try sending ":-)" in SMS (depending on your SMS app it may or may not show up as an icon) and in a Google search box. I guarantee you that you won't see an icon in the search box.
Note: you'll probably want to have defined android:keyIcon for your keys so they show the icon of the smiley rather than the output text (i.e. "=)", see android:keyOutputText).
To answer your question, if the user manually types in ":)" this is identical to the user pressing a key that has android:keyOutputText=":)".
For the second question, your "emoticon" will actually just end up being a key that sends multiple characters in a row. It saves people from having to type ':','-',')'. Instead they just hit one key and the three characters for their smiley appear.
For the last question, keyOutputText can't produce an image. Only the app that is displaying the text can convert the text to an image. In short, the keyboard is meant for sending and editing text, not icons and images.
Send me an email if you have any more questions: I've been writing a soft keyboard for Android for almost half a year now so I'm pretty familiar with how touch input works.

Related

How to open Android keyboard show only custom digits in Android

I want to show digits "0123456789/" on keyboard if open on click of SearchViewbut I don't know how it can be done. I am able to set InputType to a searchview like this
searchView.setInputType(InputType.TYPE_CLASS_NUMBER);
but not able to set custom digit to show on a keyboard.
from input type InputType.TYPE_CLASS_NUMBER numeric keyboard is opening but i also want to show "/" also with numeric digits 0123456789.
I searched a lot on SO but didn't find any solution for this.
There is no easy solution for this. You have two options depending on what you can work with and what exactly you want.
If it is exactly as you say in your question, that is, to SHOW
just the Characters that you specify, then the way to go about doing
that would be to create a Custom SoftKeyboard. This will allow you
to take only the desired inputs and will show only those characters
that you have specified.
Otherwise you can disable taking other
characters input (that are not to be available), by working with
[onQueryTextChanged]1 where you manipulate to resend only the
values that you can take in as input. Here the default
softKeyboard is used, but the input taken in by the SearchView are
as per specification.
Note : my knowledge is mainly based on working with EditText rather than SearchView, so not able to provide exact codes for the above

What's the best way to highlight a telephone number in an Android App?

[Question about android style]
I was wondering what is a good way to make clear that you can click on a telephone number and immediately call someone without copying & pasting the phone number.
How can I persuade a user to click on a phone number ?
ps: my question is not about how to call someone when clicking on a phone number, but about how to style the phone number to show that it is clickable.
Maybe putting small phone icon beside number would be clear for user.
Usually when the number is underlined like a HTML link, they understand right away.
TextView numberText = (TextView) findViewById(R.id.event_number);
numberText.setText("123-456-7890");
Linkify.addLinks(numberText, Linkify.PHONE_NUMBERS);
Checked the official documentation but there is no such standard defined for the same. So it is now upto you.
Underlining the number is fine but does not go well with text blocks.
Using a different font color for the number will suit well. Using Blue is the trend;-)
But in the end it is about the design and color scheme of your app too. Seeing a number in different text color is enough a indicator that you can use it as a link

How to make an edit text start out numeric but accept text also

In my application I have an EditText (Actually it's an implementation of MultiAutoCompleteTextView, but I don't think that matters) in which the user can enter a formula to be calculated, although generally they will want to just enter an integer.
What I would really like is for the keyboard to open with the numeric keyboard showing, but allow them to change to text if they want.
As standard of course it shows the letters and allwos them to change to numbers, which is OK, but 90% of the time they will want the numbers.
I tried doing:
operandEditText.setInputType(InputType.TYPE_CLASS_NUMBER|
InputType.TYPE_NUMBER_FLAG_SIGNED|InputType.TYPE_CLASS_TEXT);
But the result was a numeric keypad with letters written on the number keys (like a phone keypad), and it didn't write letters anyway.
I'm also aware that I could add a button, spinner or something that changed the input mode of the widget, but the aim of this is to make the interface easier to use, and I'm not sure adding another control will achieve that.
Is there a way to make it do what I want?

Emoticon keyboard

I'm developing a simple emoticon keyboard on android,
I want to use this keyboard on any application. when the user click on any displayed emoticon it must appear on the screan
My question what is the best way to post emoticons images between two mobiles .. It doesn't make sense to send them as image. I tried to send them as font .. but the problem was that it is only appeared in black color ,,, so, what is the solution?
Consider two phones:
A & B
Install the images for these emoticons in the phones and each image would have an id. When the user at phone A presses the key for say ":-)" .. pass the id that refers to that particular emoticon to phone B and use it to refer to the exact emoticon. Hope it helped

In Email compose, I want design inputs for yahoo like feature in android

In Email compose, when user types/selects email ids in to/cc/bcc.
Suppose there are 7-8 email ids and now user want to delete 3rd one.
It is very difficult for user to go to 3rd one and delete that one. So I think solution for this is,
User enters email id and hits SPACE or COMMA.
then one rectangular box should appear on background.
I want an cross mark on right corner of that rectangular box.
If user want to delete that 3rd email id,then he will just tap on cross mark of 3rd rectangle which contains that email id.
(please refer figure below from Yahoo email composer)
I need similar functionality. How can I achieve in android? Is there any standard component I can use? Currently I am using auto complete text view for To, Cc, Bcc. Please help. Thank you in advance.
I don't have time to write up working code, but I will point you in the right direction. The key for doing funky things with text in standard components like EditText are called "spans".
Suggested plan of attack:
Add a TextWatcher to your EditText so you know when the text changes.
Each time the text changes, scan the contents for anything matching an email address (suggest you use regex for this).
For each matched email address, generate a Bitmap equivalent using standard drawing APIs (i.e. create Canvas, measure text, draw background, draw text).
Instantiate an ImageSpan (this is kinda the key to the whole thing) using your bitmap as the constructor argument.
Replace the email address in the text with a single space character (say) and call setSpan() on that single character to have your ImageSpan replace it's appearance.

Categories

Resources