[GUIDE] The right Soft Keyboard (+adding a CustomKeyboard) - Java for Android App Development

Hi devs,
During development of my app (see my signature), I researched a bit and finally found a quite nice way to implement a custom keyboard which is only shown in your app easily.
Much of this is taken from Maarten Pennings' awesome guide here, thanks to him and feel free to read it as well.
So I thought I'd extend his work with this guide which also takes a look at why you'd want to use one or the other keyboard. Enjoy! :victory:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Limits of the Android IME
Any kind of text input (password, number, address, etc.) is usually handled very nicely using the android:inputType attribute (or the corresponding setter in java) on the EditText field.
But as soon as you have to deny some characters, for instance you want the user to insert a file name, it gets more complicated since there is no inputType for that.
The way to achieve that would be to implement your own KeyListener like this:
Java:
import android.text.method.NumberKeyListener;
//...
// set a new KeyListener onto your desired EditText, overriding the default one:
EditText edit = findViewById(R.id.edittext);
edit.setKeyListener(new NumberKeyListener(){
@Override
public int getInputType() {
// should be the same as android:inputType, for all numbers including decimal and negative:
return (InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED);
}
@Override
protected char[] getAcceptedChars() {
// declare your desired chars here, ONLY those will be accepted!
// for instance numbers:
char [] res = {'1', '2', '3',
'4', '5', '6',
'7', '8', '9',
'0', '+', '-', '*', '/',
'(', ')', '.', ',', ' ', '^', '!',
// alphabet:
'a', 'b', 'c', 'd', 'e',
'f', 'g', 'h', 'i', 'j',
'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y',
'z'
};
return res;
}
});
The problem is that the keys are still present and therefore distracting and irritating to the user, because nothing happens on click.
And also, there might be a much easier and better accessible layout for your set of keys. In the following I will tell you how to integrate such a custom layout using the KeyboardView class, but first let's take a look at the advantages of both keyboards:
Android IME or KeyboardView???
The answer to this question is tightly depending on the task you want the user to fulfil, and also on how much freedom you want to give him. The high customizablility and its theming options are a strong point for the KeyboardView, but be warned that since this View was added in API level 3 (and never updated I think) there are a couple of bugs which you have to workaround.
A standard keyboard is more familiar to the user and is often also a third-party keyboard and therefore more customizable. But this also has its downsides since there is no guarantee that the IME will display the characters you need.
Note that you will not be able to get a working cursor image easily with the KeyboardView (though the cursor works as it should, just the blue arrow below it won't be displayed).
For simple tasks where just a few buttons will be useless, such as when asking for a filename the normal IME is recommended. But for various operations you'll find the KeyboardView to be much cleaner.
If you decided to try the KeyboardView, here's how it works:
Adding a CustomKeyboard
NOTE: I will only cover how to implement such a Keyboard, if you want to know how it works in detail check out the third chapter in Maarten Pennings' guide.
First, since it is a view, you will need to manually insert the following to the xml layout file of all activities where you want to use it:
Code:
<android.inputmethodservice.KeyboardView
android:id="@+id/keyboardview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:visibility="gone" />
Put it in a relative layout container, though it should also work in other ones. Most important is that it is the topmost container in the view hierarchy.
Second, you need an xml file where all the keys and their layout are stored for the KeyboardView to inflate. For a start, you can take the one Maarten Pennings has posted or download mine here: View attachment keyboard_layout.txt (xda doesn't support .xml files, so just rename it to keyboard_layout.xml!)
Move that file to your res/xml/ folder, you can create other layouts for landscape using res/xml-land/
You have to play around with that file a bit to get your desired layout, here are some tips:
Start by designing it on paper, then write it as a comment (ASCII-Art‎?) so you have it properly lined up and always at your hand while coding
Including gaps of half a key or so to separate different areas works nicely
Highlight important keys either with a different android:keyBackground or by making them larger than the others.
Leave the android:horizontalGap attribute untouched on Keyboard level, this will probably break the key lineup
Calculate the key width like so: width = 100/(keysPerRow + numberOfGaps)
Set the android:keyHeight on Keyboard level to something that rows*keyHeight is about 40%-50%.
For every key label which is longer a single character, use the corresponding ASCII-integer as key code (android:codes), otherwise pick a negative number or one that's higher than 256
Use android:isRepeatable="true" for keys to press and hold for multiple clicks like the delete key
If you want to display a popup keyboard on hold, you should rather make a popup window yourself or use a dialog rather than using the androidopupKeyboard attribute.
For inserting more than one char on click, use the android:keyOutputText on key level or override the specific keycode in the onKey() method in CustomKeyboard.java
As I said, you will need some patience doing this since there is neither help nor documentation on the xml namespaces.
Third, there are a couple of icons required for some keys like the delete key. You can either use the ones provided in the guide, but I suggest downloading the original holo android icons from the different drawable folders here.
Take the sym_keyboard_... files that you think you'll need and place them in the respective res/drawable-ydpi folder. Set the android:keyIcon attribute to @drawable/sym_keyboard_... for those special keys.
Fourth, we need a java class to process the clicks and provide the methods for showing and hiding the keyboard. Luckily, you take mine here: View attachment CustomKeyboard.txt (again, rename it to CustomKeyboard.java)
Copy that file into your src/com/package/name and change the package to your app.
This class is heavily based of the one Maarten Pennings has come up with, but with an actually working cursor, so that you can tap or drag to move the cursor. I included haptic feedback (set it using enableHapticFeedback(true)) and an easy way to add chooser dialogs if you want to have multiple insertions in one key (see the onClick(...) method); This looks like this:
If you are using any special keys or dialogs as popups, you will need to edit the onKey() or the onClick() method like I did.
Fifth, in your onCreate() method after setContentView(...) you just need to register every EditText that you want to use the keyboard on like so:
Java:
// initialize the instance variable customKeyboard
customKeyboard = new CustomKeyboard(this, R.id.keyboardview, R.xml.keyboard_layout);
// register the edittext
customKeyboard.registerEditText(R.id.edittext);
For a hiding keyboard if you press the Back key, add the following to your activity:
Java:
@Override
public void onBackPressed() {
if(customKeyboard!=null && customKeyboard.isCustomKeyboardVisible() ) customKeyboard.hideCustomKeyboard(); else super.onBackPressed();
}
Click to expand...
Click to collapse
Congrats, you have finished adding a CustomKeyboard and can now test and further improve it :good:
Read on if you want to theme it further (let's face it, the default theme is still from the first versions of android).

Theming your Keyboard
Theming the KeyboardView
To make your newly created keyboard fit more to the overall style of your app, it is crucial to theme it.
Here are some attributes which you'll want to customize:
Code:
<!-- on KeyboardView level: (in android.inputmethodservice.KeyboardView in your activity) -->
android:keyBackground
android:keyTextColor
android:keyTextSize
android:background
<!-- on Key level: -->
android:isSticky
<!-- for toggle keys like shift or ALT only -->
android:isModifier
These are all pretty self-explanatory, the most important one being the keyBackground.
You will need different drawables for each of the keys states including normal, pressed, active, popup and either light or dark theme.
As an example, here's how I made the holo style: Basically I took the holo drawables from source and added android:keyBackground="@drawable/btn_keyboard_key_ics" in our KeyboardView (not Keyboard!).
Download those icons from here.
Specifically, you need the btn_keyboard_key_ics.xml file in the drawable folder and all the btn_keyboard_key_... from the xhdpi, hdpi and mdpi folder that you need, at least btn_keyboard_key_dark_normal_holo and btn_keyboard_key_dark_pressed_holo.
The btn_keyboard_key_ics.xml goes into your res/drawable folder and all the others should be dumped into their respective res/drawable-ydpi folder.
From the key_ics file delete all items where you didn't download the .9.pngs so they don't give compilation errors.
Click to expand...
Click to collapse
I hope you found this helpful and I could save you a bit of work. If you have any questions or suggestions, feel free to post them here!
This guide was featured on the portal on 26th October (thanks Will Verduzco!)

Wow. Really cool guide. :good:

Can we edit the third party stock keyboards....
SimplicityApks said:
Theming the KeyboardView
To make your newly created keyboard fit more to the overall style of your app, it is crucial to theme it.
I hope you found this helpful and I could save you a bit of work. If you have any questions or suggestions, feel free to post them here!
This guide was featured on the portal on 26th October (thanks Will Verduzco!)
Click to expand...
Click to collapse
Since i like the stock keyboard of htc one ... just wanted to know if i replace the resources of stock keyboard of AOSP with that of keyboard from
htc one will it work or do i nedd to do some modding....

anurag.dev1512 said:
Since i like the stock keyboard of htc one ... just wanted to know if i replace the resources of stock keyboard of AOSP with that of keyboard from
htc one will it work or do i nedd to do some modding....
Click to expand...
Click to collapse
You mean you want to have a KeyboardView in your app with the layout files from the HTC keyboard? Sure, that'll work, you only need to get the resources (decompile keyboard app?). Some layout adjustments might be needed of course...

reply
SimplicityApks said:
You mean you want to have a KeyboardView in your app with the layout files from the HTC keyboard? Sure, that'll work, you only need to get the resources (decompile keyboard app?). Some layout adjustments might be needed of course...
Click to expand...
Click to collapse
no bro i m saying to mod the stock keyboard of jellybean with that of stock keyboard of htc one...

anurag.dev1512 said:
no bro i m saying to mod the stock keyboard of jellybean with that of stock keyboard of htc one...
Click to expand...
Click to collapse
OK, sorry, I didn't read the title of your post...
That should be possible, although I have no idea about decompiling and modding. From what I understand, you could try making an XPosed module, that should work and is better since it can be applied at runtime.

SimplicityApks said:
Hi devs,
During development of my app (see my signature), I researched a bit and finally found a quite nice way to implement a custom keyboard which is only shown in your app easily.
Much of this is taken from Maarten Pennings' awesome guide here, thanks to him and feel free to read it as well.
So I thought I'd extend his work with this guide which also takes a look at why you'd want to use one or the other keyboard. Enjoy! :victory:
View attachment 2347941
Congrats, you have finished adding a CustomKeyboard and can now test and further improve it :good:
Read on if you want to theme it further (let's face it, the default theme is still from the first versions of android).
Click to expand...
Click to collapse
Nice

FunctionCapture
I just released my app to the Play Store, so if you want to see how the CustomKeyboard feels in action, download it here:
FunctionCapture
You might want to leave a review or +1 as well, that helps a lot, thanks!

SimplicityApks said:
Theming the KeyboardView
To make your newly created keyboard fit more to the overall style of your app, it is crucial to theme it.
I hope you found this helpful and I could save you a bit of work. If you have any questions or suggestions, feel free to post them here!
This guide was featured on the portal on 26th October (thanks Will Verduzco!)
Click to expand...
Click to collapse
hi... I am not able to download resources for custom keyboard... please help me

tejal said:
hi... I am not able to download resources for custom keyboard... please help me
Click to expand...
Click to collapse
Well I can still download it, might be a problem with either your browser or xda where you live...

Thanks for the tutorial, really helped me with my project as I need a custom keyboard. But I would like to ask, how do I add a second page to the keyboard as I need more entries to it. Is there a way to add like a small button in the keyboard 1/2 and when you press it, it'll go to the 2nd page of it.

misleading93 said:
Thanks for the tutorial, really helped me with my project as I need a custom keyboard. But I would like to ask, how do I add a second page to the keyboard as I need more entries to it. Is there a way to add like a small button in the keyboard 1/2 and when you press it, it'll go to the 2nd page of it.
Click to expand...
Click to collapse
Mmmmh didn't think about that so far... Have you tried wrapping 2 keyboardviews in a viewpager?

SimplicityApks said:
Mmmmh didn't think about that so far... Have you tried wrapping 2 keyboardviews in a viewpager?
Click to expand...
Click to collapse
I think I got it somehow.
I made a small key in the current keyboard. An example maybe like SYM which represents Symbol, so if you press it, it'll go to the view on keyboard full of symbols. Just had to repeat actually.
Edit: It seems like I can't post the code or part of it. Says that my post was flagged by the system and was blocked from submitting. I want to show how, but it seems it doesn't allow me haha.

misleading93 said:
I think I got it somehow.
I made a small key in the current keyboard. An example maybe like SYM which represents Symbol, so if you press it, it'll go to the view on keyboard full of symbols. Just had to repeat actually.
Edit: It seems like I can't post the code or part of it. Says that my post was flagged by the system and was blocked from submitting. I want to show how, but it seems it doesn't allow me haha.
Click to expand...
Click to collapse
Lol sometimes the system is against us..., well nice you figured it out

I am lost/stuck
First off I would like to thank Simplicity for such a simple guide and tutorial on how to set the custom keyboard up. Secondly even if it was very simple I obviously cannot follow directions and have done something wrong and even though my custom keyboard pops up and I am able to press the button, I am not able to get the edittext field to register the onclicks of the keys thus resulting in the buttons doing nothing. I have pmed Simplicity and was requested by him to post this question in the thread for others in case anyone else runs into this issue.
I have attached both the xml and java file to the post.
Hope someone can help and also hope this problem I ran into will help others if they are stuck at the same place.
Once again a big big big Thanks to SimplicityApks.

kva123 said:
First off I would like to thank Simplicity for such a simple guide and tutorial on how to set the custom keyboard up. Secondly even if it was very simple I obviously cannot follow directions and have done something wrong and even though my custom keyboard pops up and I am able to press the button, I am not able to get the edittext field to register the onclicks of the keys thus resulting in the buttons doing nothing. I have pmed Simplicity and was requested by him to post this question in the thread for others in case anyone else runs into this issue.
I have attached both the xml and java file to the post.
Hope someone can help and also hope this problem I ran into will help others if they are stuck at the same place.
Once again a big big big Thanks to SimplicityApks.
Click to expand...
Click to collapse
Had a look at your class and the xml keyboard layout again and everything seems fine to me so far... Question is how you implemented the keyboard in your activity layout and what happens when you register your text field in the onCreate(). It would be helpful if you could show us these parts of your code.
Other than that, does your onKey() method in the CustomKeyboard get called when you press a key? (Put a Log.d(..) statement or debug stopped in there to find out)

SimplicityApks said:
Had a look at your class and the xml keyboard layout again and everything seems fine to me so far... Question is how you implemented the keyboard in your activity layout and what happens when you register your text field in the onCreate(). It would be helpful if you could show us these parts of your code.
Other than that, does your onKey() method in the CustomKeyboard get called when you press a key? (Put a Log.d(..) statement or debug stopped in there to find out)
Click to expand...
Click to collapse
Hey sorry for the late response I just figured out what the problem was but now I have no idea how to fix it. The problem is here
Code:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="10dp"
android:padding="10dp"
android:descendantFocusability="beforeDescendants"
[COLOR="Red"]android:focusableInTouchMode="true" //This Right here is the problem[/COLOR]
android:weightSum="6" >
<TextView
android:id="@+id/billtotalTV"
android:layout_width="0dp"
android:paddingLeft="25dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="Bill Amount:"
android:textColor="#B34F6675"
android:textSize="25sp" />
<EditText
android:id="@+id/et"
android:layout_width="0dp"
android:paddingRight="25dp"
android:layout_height="wrap_content"
android:hint="Enter Total"
android:gravity="center_horizontal"
android:textColor="#049C7A"
android:textColorHint="#B3049C7A"
android:inputType="numberDecimal"
android:imeOptions="actionDone"
android:maxLength="7"
android:textSize="30sp"
android:layout_weight="3"/>
</LinearLayout>
The Reason I have that is because I am trying to avoid my app from setting my EditText as a focus as soon as the activity starts. As far as I am aware I do not know of any other methods that can work around that. Let me know what you think I should do.

kva123 said:
Hey sorry for the late response I just figured out what the problem was but now I have no idea how to fix it. The problem is here
Code:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="10dp"
android:padding="10dp"
android:descendantFocusability="beforeDescendants"
[COLOR="Red"]android:focusableInTouchMode="true" //This Right here is the problem[/COLOR]
android:weightSum="6" >
<TextView
android:id="@+id/billtotalTV"
android:layout_width="0dp"
android:paddingLeft="25dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="Bill Amount:"
android:textColor="#B34F6675"
android:textSize="25sp" />
<EditText
android:id="@+id/et"
android:layout_width="0dp"
android:paddingRight="25dp"
android:layout_height="wrap_content"
android:hint="Enter Total"
android:gravity="center_horizontal"
android:textColor="#049C7A"
android:textColorHint="#B3049C7A"
android:inputType="numberDecimal"
android:imeOptions="actionDone"
android:maxLength="7"
android:textSize="30sp"
android:layout_weight="3"/>
</LinearLayout>
The Reason I have that is because I am trying to avoid my app from setting my EditText as a focus as soon as the activity starts. As far as I am aware I do not know of any other methods that can work around that. Let me know what you think I should do.
Click to expand...
Click to collapse
So you mean it works perfectly without the focusableInTouchMode="true"? Strange... Then just leave the focus there and hide the softkeyboard in your onCreate() or is there any other reason you don't to have it in focus except for the soft keyboard popping up? (Then set the focus to another view might be the easiest ).

SimplicityApks said:
So you mean it works perfectly without the focusableInTouchMode="true"? Strange... Then just leave the focus there and hide the softkeyboard in your onCreate() or is there any other reason you don't to have it in focus except for the soft keyboard popping up? (Then set the focus to another view might be the easiest ).
Click to expand...
Click to collapse
I tried hiding the softkeyboard but for some reason it wont hide it just keeps popping up. And he main reason I do not want a focus is because I have a drawerlayout on the app and it contains 3 edit texts so everytime I open the drawer layout it invokes the keyboard to pop up and it selects the edit text which I do not want because its a feature where users may customize the value which they dont need to if they dont want too. As of setting focus to another view I believe I tried that but the edit text still receives the focus for some reason. Mind giving me an example of setting focus on something else? So i can make sure I am doing it right. Maybe a Linear or Relative Layout .
I just tried to hide the keyboard and just realized I am already hiding the keyboard but I am only hiding the default keyboard not the custom keyboard. So my question for you would be how would I hide the Custom Keyboard from showing oncreate?(tried this but no luck customKeyboard.hideCustomKeyboard(); ) it still shows but it does work because i tried it with an onlclick just not working on start. Not sure if you need to edit the customkeyboard java file. If you want I can post the test code im working with right now if you dont mind looking at it.

Related

[App] VJSipSwitch II

Guys,
The very first app I wrote for xda devs was SipSwitch, to allow one to change the SIP (software keyboard, transcriber etc) from a shortcut.
I was recently asked to support a particular feature in VJBrisk, which seemed to show a bug in SipSwitch. I couldn't find my old source code SipSwitch, so stupidly I re-wrote the whole thing from scratch. And it turned out that the bug wasn't in SipSwitch, but in the OS. Sigh.
Anyway, please take pleasure from my pain, and enjoy VJSipSwitch II.
This is entirely re-written, and probably buggy, so let me know.
VJSipSwitch II works like SipSwitch:
Make a shortcut to VJSipSwitchII, and specify command line parameters which match the name of the SIP you want to switch to.
Launch the shortcut and your phone will switch to that SIP.
This is useful if you want to, for example, always use SPB Keyboard as your default SIP.
eg:
PHP:
"\Program Files\Vijay555\VJSipSwitchII\VJSipSwitchII.exe" spb keyboard
will switch to SPB Keyboard.
Bonus Feature:
If you launch VJSipSwitch II without a command line parameter it will now pop up a menu asking you which SIP to switch to. This is good for one handed use.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
​
V
Download from here:
http://vijay555.com/vj/releases/vjsipswitchII/vjsipswitchii.cab
For help on making command lines
http://www.vijay555.com/?Help:Command_Lines
DOWNLOADING NOW ....
thanx ....
what is that at the bottom of the screen shot ( two squars and the d-pad in the middle) thanks
@irus:
It's an app I've developed for the Blackstone, VJVirtualMouseWinFX(code name only, for now!). A clearer screenshot is here.
It's a virtual mouse pad (left square), which acts like the optical mouse on the Samsung Omnia, an emulated dpad in the middle, and a zoomed in "preview" zone showing what's under the mouse pointer, on the right. This square also acts as the "left click" for the mouse.
V​
Thanks vijay555
I´ll try it!
thank you for sharing!
It works on my phone. But one question, it seems a bit slow to pop up the muen, can it be a little faster?
Thank you!
I don't think it can really - the slowest part, enumerating the SIPs, takes approx 350ms on my system, and that part can't really be made faster.
I'll have another look over the code to see if I can streamline it a bit further, but the slow bit can't be made much faster as it's OS dependent
V
vijay555 said:
I don't think it can really - the slowest part, enumerating the SIPs, takes approx 350ms on my system, and that part can't really be made faster.
I'll have another look over the code to see if I can streamline it a bit further, but the slow bit can't be made much faster as it's OS dependent
V
Click to expand...
Click to collapse
Sorry and thank you! Maybe it's the problem of my phone, it's always slow to switch the input keyboard. It takes more than 1s to show up the muen
i like whatever you make.
semi-unrelated question:
could you write sipicon window( on softkeybar etc) hider?
some soft seem to have problem with sipicon space, goddamn rectangle - it pops up not exactly where and when it should(sipicon is seen as window in taskman 3.x which can hide that thing, but it's not exactly pleasant/automated way..).
sipicon is annoying with wad, today replacements, softkeybar removal(sometimes), other soft..
your tool may be sipicon hider helper.
Thanks a lot, included the bonus.
And I am waiting your dpad too.
May I ask for three bonus?
- instead to have only one sip in the command line, alow more than one, and switch between them.
- add in your command line the capability to activate, deactivate, or switch between both status.
- have an exclusion list in your enumaration screen (this one is less, less useful, but useful)
Concerning enumeration of sips, may I propose you that you to not do it each time but use a cache (in memory if the application is resident, or in a file if not). And a command line to update the cache.
thanks a lot VJ
@nothin: I'll try to write something like this. Although easy to do achieve, a neat solution will be fairly messy to write I think (if anyone wants to, make a dll with a dummy wndproc for WM_WINDOWPOSCHANGED, then inject this into the OS and subclass MS_SIPBUTTON's wndproc to point at the dll wndproc; this will save a process slot and resources).
@thierryb: caching the menu is probably a good idea; I will try it at some point, but I'm thinking that for the chance of a cache clash (ie the cache being invalid), and the extra code required to find, load and parse the cache, it probably won't be a great deal faster than enumerating from scratch. As I said, the OS SIP enumerator takes around 350ms. Registry enumeration takes around 400ms so I use the OS enumerator.
On my Blackstone, showing the menu takes less than 1second - it's not instant, but hopefully not a massive inconvenience. How long does it for the menu to come up on your devices?
- instead to have only one sip in the command line, alow more than one, and switch between them.
Click to expand...
Click to collapse
This one is probably possible. I'll try to add this
- the capability to activate, deactivate, or switch between both status.
Click to expand...
Click to collapse
This one is easy, but I'll have to add proper command line switches, eg
PHP:
VJSipSwitchII.exe -sip "keyboard" -toggle
etc, and this will take more time.
an exclusion list
Click to expand...
Click to collapse
again possible, but if this is for the sake of saving time, again, I will have to enumerate all sips merely to exclude one, so it'll be marginally slower, not faster! If it's for the sake of a neater menu, then it's a good idea.
I'm prioritising work on VJVirtualMouseWinFX for now, but if I find myself with some time I'll consider adding some of the above.
V
Guys,
An alternative for switching keyboard for the SIP menu selection is available in the FingerMenu app (on this forum).
Basically it's a big button finger friendly method of changing all of the WM menu's to be more Manilla-ish. There is an option for taking over the SIP menu in the Options.
Just an alternative you could use for the Menu side of things...
Cheers
This is useful if you want to, for example, always use SPB Keyboard as your default SIP.eg:
PHP:
"\Program Files\Vijay555\VJSipSwitchII\VJSipSwitchII.exe" spb keyboard
will switch to SPB Keyboard.
Maybe stupid question but where should we typpe that and how?
I searched in your forum but found nothing about VJSipSwitch there.
Thanks in advance.
make a dll with a dummy wndproc for WM_WINDOWPOSCHANGED, then inject this into the OS and subclass MS_SIPBUTTON's wndproc to point at the dll wndproc; this will save a process slot and resources).
Click to expand...
Click to collapse
it would be just PERFECT method...hm.
but i'll take any method for sipicon hide, actually.
Again: Maybe stupid question but where should we typpe that and how?
I searched in your forum but found nothing about VJSipSwitch there.
Thanks in advance.
sergutel said:
Again: Maybe stupid question but where should we typpe that and how?
I searched in your forum but found nothing about VJSipSwitch there.
Thanks in advance.
Click to expand...
Click to collapse
...just make shortcut with that text...jesus plzz.
make txt file, paste this
"\Program Files\Vijay555\VJSipSwitchII\VJSipSwitchII.exe" spb keyboard
there, change txt to lnk, that's all..
Making a shortcut
Guys,
Read here to find out how to make a shortcut with a command line
http://www.vijay555.com/?Help:Command_Lines
@nothin: although that works, it's best to write
69#"path\to\exe.exe" my command line
The 69 should be the length of the .lnk file, although it is ignored by the OS, so can be any number.
However, VJBrisk 0.4 onwards uses the # to identify the .lnk, so if you're using VJBrisk with VJSipSwitch II (which was the start of the development of VJSipSwitch II), then it's best to make a proper .lnk file.
V
Welcome back bro... been a long time since you disappeared.
Cheers
vijay, it takes about 0.nothing seconds to load on my polaris. really, i click it and it's there. wonderful work. thanks
impressive!
Strangely, this is speedier than the usual approach of clicking the SIP arrow!
Naturally, I have no complaints - great job

[APP][19/12/2010] TRITaniumWeather 5.9.2 (In Development)

Thread has moved to here since it's not just for the diamond!
First, the thanks. To all at XDA, cos we rock To Showaco for the base code, to nosedive for the mods done on it and anyone else who worked on TitaniumWeather in the past. Also to Sleuth for his myLocation service.
TRITaniumWeather Really Isn't TitaniumWeather:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Never Heard of it! - TitaniumWeather was an application for WM6.5's Titanium homescreen (WM6.1 Users, read on) which displays weather location using Accuweather. It provides much more detailed weather information than HTC Sense.
Yeah, I remember that! - Maybe you remember some common experiences with it:
You might have had to modify it as often as Accuweather disabled/re-enabled their APIs...
You might not have been able to find out what your location code was, despite help in the forums...
You might have never managed to get the panel to show in Titanium...
When it did work, every now and then you'd get a pretty cryptic error message and weather wouldn't update
You could only ever have one location
You could never tell what went wrong with it
There were too many options (subjective, yeah...)
What I have done
Almost a total rewrite. If you diff'ed the files you'd see the sheer volume of code change that's went down and I still don't think that'd be much of a testament to this huge work. So what have I done? The major changes are:
Internet connection not so good? No problem, I wrote a download script. If it crashes, who cares? You certainly won't notice it.
No code, no problem: Weather database so you can search for your location, by code, city or country.
The codes in there don't work, no problem: MYLOCATION weather works. And well! (Requires Sleuth's myLocation service or HTCGeoService; if you've got HTC Sense, you most definitely have this.)
Automatic history of successful locations, which you can go to later.
The program will check 8 Accuweather API's, when it finds the best one, it'll stick with that for any future updates and if that fails, it'll try them all again.
Implemented a whole extra feed: WorldWeatherOnline.
Grabbed the biggest Titanium *.plg file I could find, so it should work on any resolution and implemented panel installation from the configuration application.
Multiple Location Support!
Released under the GPL. Feedback, suggestions, code modifications welcome!
So What?! I don't use WM6.5
Although TRITaniumWether started out as only for Titanium, I've expanded it's functionality so that each loation's Weather is formatted in HTML for easy viewing from the configuration application (found in the start menu after installation) Like I said, TRITaniumWeather Really Isn't TitaniumWeather!
What's this GPL thingy?
The GPL can be viewed here. It makes sure your rights as a user are protected to distribute/change/use this Free software as you wish. A copy is included with the program.
Version and Release Info
The main release will be the cabinet installer file. Updates will usually be produced as zip files, to use the updates just unzip the files into your existing TRITaniumWeather folder, overwriting any existing files. Versions are numbered just like any good Open Source project:
The first number is the major version-features and compatibility generally won't change in a major version.
The second is the minor version-odd numbers are development for the next stable even number.
The third number is the release number.
If there is a fourth, it's a bugfix release number.
E.g. This program starts at 5.9.0 which means it's preparation for the stable release 6.0.0.
So, without any further ado I give you TRITaniumWeather 5.9.2.
Enjoy!
Appreciate my work?
Changelog
Code:
Changelog 5.9.2:
- Project renamed to: TRITaniumWeather
- Location services standardised:
> Easily add new service compatibility where possible
> Implemented start/stop functionality with myLocation
> Stub for HTC Geo Service, can read location. Don't know
how to start/stop
- Updated HTML Message writing to always occur, in the background
- Multiple locations now supported
> Currently named as per what their feed reports
> MYLOCATION is dealt with seperately
- Included FoddLib.mscr for:
> File version routines
> Future language/translation support
- Included 240x240 stanza in TRITaniumWeather.plg (thanks to gmorris)
Changelog 5.9.1:
- Now outputs HTML following a GUI triggered update
- Status Messages shown during a GUI triggered update
Changelog 5.9.0: Initial Release
ToDo
YOU! Yes, I mean you. Help me out by doing one of the following jobs:
Icon, I tried one of the HTC ones from the theme, but the CAB wouldn't install. For now, just the mortscript icon. If anyone can inject an icon into the exe files that'd be gravy!
More Feeds? Anyone want Yahoo weather, PM me, and if lots of you want it then I'll try and add it.
Full database control; add is done, needs delete/replace, possibly import?
It would be cool to add the radar page again.
HTCGeoService support (Can get location data: Only state switching/sensing to do!)
Configurable Panel/HTMLView layouts.
Wherever you see a "Stub!" statement would be a good place to help, it'll tell you which file and which sub function to look at. Some stuff is just low priority at the moment...
Update the documentation.
Looks AWESOME. Looking forward to trying it out. Thanks!
Went through the install great...
(removed all previous versions first)
Opened the TitaniumWeather from Start Menu...
It went through all the options...
Said "installing Panel"...
Said "installing Registry" ...
Selected Accuweather...
Selected Typed in Zip Code...
Displayed current Locations...
... ... But Panel still never showed up on Home Screen ...
Any ideas? I was so excited to get this working. LOL
Did the "BigMessage" show up with the weather information after you tried to update?
It would have taken maybe 3-4 mins on the very first run. If not, try running the configuration app again and select "run weather update and exit" and after a few mins you should see that, which will atleast confirm the script itself is working...
Shame about the panel, but probably just a few registry settings I had hoped that TICS would have taken care of for us:
Under "HKEY_LOCAL_MACHINE\Software\Microsoft\CHome" you should have "ExtensibilityXML" and "Plugins", as you can see the plugins are named between semi-colons (";" <== That symbol), could you check if TitaniumWeather is listed in both of those? Also, are there values called "CPRFile" and "DisplayStyle" under that same key? If not to the latter, try adding those keys, "ExtensibilityXML" should have the values you need to set them to mentioned at the very end, it's usually "Titanium".
Btw, what's your device resolution? I'm running a DIAM100 (VGA) which you can see in my sig with my own rom-I had the titanium plg injected beforehand but it's the same plg file so the only difference I can think of is the two registry values above. I'll try and reproduce the problem myself but some more info would help too. If you could post the "\tempTitanium*Cpr.txt" files too that'd be super!
In the meantime, what do you think of this? It's the replacement for that big ugly message box with the weather info in (if you saw it...)
EDIT: Ok, some updated files at the end of post #1. Anyone having difficulty getting the panel to show will like this!
arealityfarbetween said:
Did the "BigMessage" show up with the weather information after you tried to update?
It would have taken maybe 3-4 mins on the very first run. If not, try running the configuration app again and select "run weather update and exit" and after a few mins you should see that, which will atleast confirm the script itself is working...
Shame about the panel, but probably just a few registry settings I had hoped that TICS would have taken care of for us:
Under "HKEY_LOCAL_MACHINE\Software\Microsoft\CHome" you should have "ExtensibilityXML" and "Plugins", as you can see the plugins are named between semi-colons (";" <== That symbol), could you check if TitaniumWeather is listed in both of those? Also, are there values called "CPRFile" and "DisplayStyle" under that same key? If not to the latter, try adding those keys, "ExtensibilityXML" should have the values you need to set them to mentioned at the very end, it's usually "Titanium".
Btw, what's your device resolution? I'm running a DIAM100 (VGA) which you can see in my sig with my own rom-I had the titanium plg injected beforehand but it's the same plg file so the only difference I can think of is the two registry values above. I'll try and reproduce the problem myself but some more info would help too. If you could post the "\tempTitanium*Cpr.txt" files too that'd be super!
In the meantime, what do you think of this? It's the replacement for that big ugly message box with the weather info in (if you saw it...)
EDIT: Ok, some updated files at the end of post #1. Anyone having difficulty getting the panel to show will like this!
Click to expand...
Click to collapse
Yes, after a few mins I did see the big messagewith current weather details.
I am looking throught he registry now and will post what I find and the temp text file you asked for soon. Thank You!
Oh and the updated pic looked great!
I couldn't locate the temp file you referred to...
I have attached a screenshot of the registry.
The TitaniumWeather entries were not in the "ExtensibilityXML" or "Plugins", But I added them manually. Panel Still didn't show up though .
I attached a second screenshot of the TitaniumWeather subkey.
It only had one DWord named "wizard" with a value of "1".
My device is a Palm Treo 750 QVGA.
Windows Mobile 6.5.
The scripts are all working great.
I installed the 5.9.1 update you posted.
The HTML Weather View came up just fine.
Looked GREAT too!
Thanks!
Hmm, very weird.
The plg file definitely contains entries for QVGA. (240x320)
I had a brief look and they seem to be similar to the VGA one.
The registry is a worry though. You should have a set of keys in there in addition to some other stuff. That looks like the default registry installed by the cab file (there's some other for mortscript but only one for TitaniumWeather)
Can you try running "Install Registry", and then "Install Panel" (in that order!) from the advanced menu and see if there's any change in the registry/panel state?
I think i might need to re-order those two options in the setup wizard, as the registry keys are all present on my ROM that might be why TICS can install it for me but not for you...
Cheers, glad you like the new BigMessage
arealityfarbetween said:
Hmm, very weird.
The plg file definitely contains entries for QVGA. (240x320)
I had a brief look and they seem to be similar to the VGA one.
The registry is a worry though. You should have a set of keys in there in addition to some other stuff. That looks like the default registry installed by the cab file (there's some other for mortscript but only one for TitaniumWeather)
Can you try running "Install Registry", and then "Install Panel" from the advanced menu and see if there's any change in the registry/panel state?
I think i might need to re-order those two options in the setup wizard, as the registry keys are all present on my ROM when the panel's being installed that may be why it shows up for me but not for you...
Cheers, glad you like the new BigMessage
Click to expand...
Click to collapse
Yippee! That got the panel to display ... But it is displaying oddly large LOL.
I attached another screenshot. Have a look.
Thanks!
Woop woop!
Ok, so it's down to the plg file now. Unfortunately I can't sort that myself because I dont have a QVGA device to test on. I will try with some guesswork to make an updated plg but it'll be much easier to do yourself:
The good news: It's real easy!
Open up the TitaniumWeather.plg from the program directory in your favourite text editor (notepad 2 is good, it has colour coding and is tiny), making a copy and storing it elsewhere beforehand of course!
Then search for your resolution's entry. I'd only modify the portrait version first. By the looks of things you'll need to reduce font sizes and image sizes. All the fields are labelled.
I'd start with the images first, and then move onto the text fields.
Here's a sample image entry:
<Image ID="CurrentIcon" Left="12" Top="-2" Width="60" Height="60"/>
You'll probably want to reduce the Width and Height to, say, 20 on your device.
And here's a text entry:
<Text ID="CurrentTemp2" Left="0" Top="-4" Width="88" Height="25" FontFamily="Segoe UI" FontSize="18" FontStyle="Regular" Wrap="False" HorizontalAlignment="Right" Trimming="EllipsisCharacter">
For those, you'll most definitely want to modify the height and the font size, possibly the width aswell.
Once you've made some modifications to the plg file, drop it back in the directory, overwriting the original: Run "Install Panel" again and see if there's any change.
Cheers!
BTW: How big are the images in the iexplore window when the BigMessage comes up? If you think they're too big I'm sure I can do some scaling for the different screen sizes, on the fly, as it were...
I have been messing with the plg file for a while...
After every change, I save it and copy over the one in the program files\titaniumweather folder, and then do another "install panel"...
... But nothing is changing ...
I am even rebooting my phone to see if something in the registry wasn't reloading correctly.
It stays exactly the same as the first screenshot of the panel I posted...
What should I try next?
UPDATE: I removed all layouts except the QVGA from the PLG file and tried that. Still no change. I attached the PLG file in a zip. Thank You!
Sorry, forgot about that...
Sounds, like a job for FoddTweak. I wrote this a little while back. How handy is that?! Unzip the three files anywhere you like, as long as they're together.
Open it up, you'll see various things. Ignore them apart from "Titanium/WM6.5 Tweaks"
Go in there and select Titanium Plugin Remover. Be careful, it doesn't confirm that you want to go ahead. But don't worry, because it backs up lots of important stuff on the first time you run the script anyway (That includes your Titanium Config)
Anyhoo, once the plugin is removed you can either use that to install the new plg file or TitaniumWeather's own plg installer, it's the same mechanism. Again, don't expect any kind of confirmation that it worked, I wrote it a little while ago and I have absolute trust in my work, hehe
EDIT: Just took another look at those screenshots. I reckon it might be only the images that need to be resized...
SUCCESS!! ...
Used foddtweak to remove plugin...
... Used foddtweak to reinject the PLG file.
* But there was something else I had to do...
After messing with the PLG file forEVER lol, I decided to do a little research.
The Treo 750 was listed as a QVGA device...
... But it is in fact a 240x240 device (not 320x240).
So I had to add a section to the PLG file for that resolution...
<layout screenWidth="240" screenHeight="240">
and I just copied the entire section for
<layout screenWidth="240" screenHeight="320">
And changed a couple settings from 320 to 240 and presto...
Also, after I reinjected the PLG file with foddtweak, I had to rerun the "install Panel" before it would activate the new settings.
Thank You for all Your help!
This App ROCKS!
And I can tell You put a LOT of time into it!
You Rock!
Nice work my friend!
Could you post the plg file-or just the new stanza for 240x240 resolutions?
Also, I had an idea-do you remember what actual changes you needed to make to get it to display nicely? was it just icon sizes or was there font sizes that needed changing aswell?
Could you run this little mortscript. It's one line that should display the resolution of your screen. So the idea is: check if the plg file contains the users device resolution. It'd be real nice to know why the heck the panel didn't show if you install the app, no?
A better idea-If you remember what you needed to change, and the numbers you used to make it work I can look at the other stanza's and see if there's a common factor associated with the elements. Which will allow, using placeholders in a template file, on the fly plg generation. What do you think?
That is a sweet idea!
I have attached the PLG file.
I removed all the other resolutions from my PLG (after I got it working).
(Made a backup of the original of course).
Figured it would be easier for me if I needed to make an adjustment in the future.
All I did was find the section that was already in the PLG for the 240x320 (not 320x240) resolution, copied and pasted it at the top of the <layouts>,
then I changed this line...
<layout screenWidth="240" screenHeight="320">
to this...
<layout screenWidth="240" screenHeight="240">
I figured since the screen was the same width, and most screens resolutions used the same height setting in this PLG, it would work. And it did
No other editing was needed.
And the panel looks absolutely awesome!
Other than that, I just used the foddtweak utility and the TitaniumWeather ap to rerun the "Install Panel" again.
No reboot was needed
I ran your screenProp utility.
It worked great.
The message shows 240x240 on my device.
Thanks!
New Release TRITaniumWeather 5.9.2
There's a new release on the front page. I hope you like it. The biggest change, we now have multiple location support
Other changes: The gui has changed structure and form. Location Options is now all of your locations-it tells you which you're looking at at the top bar, it's got a default which is the one that shows in titanium if you're wm6.5. Basically anywhere else, you're dealing with global program options.
The HTMLWrite() function got a makeover. It's pretty cool. If anyone wants to look at their registry and write a nice function to grab sections of the reg after an update-we can format the weather information there. As you can see from the updated screenshot there's a bit of duplication in the information.
There's a few more "Stub!" statements. I've updated them to tell you what file and what subroutine it is so that it's easy for you all to dive in and help out in a meaningful way! You know you want to!
What's coming? Well, the plan for WM6.5 users is multiple Weather panels for each of the locations, but I've got to work out some problems with that atm.
EDIT: Provisional Users Manual available now on post #1.
EDIT2: Thread moved to here since it's not just for the diamond!
(removed, posted in the other thread)
installed on my htc touch pro (1) w/ WM6.5
i see my location + temps on my main home screen.
i cannot change the temp from displaying C to F, i get an error when i launch the setting #3.
when i update, i get this error. SUB MY LOCATION NOT FOUND. LINE 153.... ect
@twenty4f: You're lucky I even saw this (notification still on for this thread)
Did you see the first post mentioning the change of thread? Not to worry, the issues you mention have already been fixed ready for 5.9.3-in the meantime you can fix the sub not found error by re-running the setup wizard.
If you'd RTFM you'd know that's the first stop
Wath comma???
Help please. When trying getting current condition, this message apears:
Comma expected
Line 124 (\Archivos de Programa\TRITaniumWeather\TRITaniumWeatherFeeds.mscr):
Call("PanelUpdate",location"GetForecast", daynum)
Any idea wath can it be????
Thanks in advance...

Keyboard does not appear in my EditText fields

Hi, this is my first post so a big hello and I am hoping somebody might be able to help. I have just started Android development on the Galaxy Tab and have hit a major problem. I have created a basic view with various controls but I cannot get the virtual keyboard to come up. I have an EditText box and and AutoCompletingText box but neither work. If I select the EditText box (using my finger) you see a red line appear around the edge which I assume is indicating focus. However, the keyboard does not appear and the focus appears to disappear when I remove my finger from the box. I am using the official Galaxy sdk stuff with Eclipse.
Thanks for any assistance.
hztm said:
Hi, this is my first post so a big hello and I am hoping somebody might be able to help. I have just started Android development on the Galaxy Tab and have hit a major problem. I have created a basic view with various controls but I cannot get the virtual keyboard to come up. I have an EditText box and and AutoCompletingText box but neither work. If I select the EditText box (using my finger) you see a red line appear around the edge which I assume is indicating focus. However, the keyboard does not appear and the focus appears to disappear when I remove my finger from the box. I am using the official Galaxy sdk stuff with Eclipse.
Thanks for any assistance.
Click to expand...
Click to collapse
Maybe you can post the relevant part of your xml layout file in which you define the edit views and a part of the onCreate() method where you initiate those views.
BTW is there a specific SDK for the Galaxy? Or do you mean the Android SDK.
Hi, I am using the android sdk download from Samsung for the Galaxy tab and I am directing the program directly to the device rather than an emulator
I have the following in my main.xml file:
<EditText
android:id="@+id/EditText01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="30px"
android:layout_y="700px"
android:text="Hello"
android:inputType="text"
/>
I have the following onCreate.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
factoids();
}
The field is displayed on the screen fine. If I select it with my finger then it is surrounded in blue as if it has got the focus. As soon as I remove my finger the blue focus disappears and the keyboard is never displayed. I normally program on PC and am slowly learning android / java so I expect I have something wrong but really not sure where to look now. Thanks for your assistance.
Yes, nothing wrong with this piece of code. Where do you instantiate the EditText? Maybe something is going wrong there.
Normally one instantiates a widget in the onCreate method; bind it to a variable so one can actually do something with it. In your case this would be:
Code:
EditText txtBox; (Define it in your class so it has full scope)
txtBox = (EditText) findViewById(R.id.EditText01);
Have you tried your own piece of code? Try it. Temporarily remove the factoids() call and it should run perfectly with a keyboard poping up in the editext box. If not there's something wrong with the sdk.
Hi,
Thank you very much indeed for your assistance and I have just managed to get it working. All I have done is copied the program to a new project with a new name and it is working. I have been programming VB.NET and C for years and always assume that it is me that has got it wrong so I must have damaged something in the original program.
Anyway, thanks again for your assistance.

[Q] Making a new Screen?

Hi, is this the common way of making a new Screen or not? Because I can't belive that i have to do a new *.java File and *xml File for every new Screen and then have to edit the manifest file.
So tell me, are there other possibilities?
Thanks Spazzt
Spazzt said:
Hi, is this the common way of making a new Screen or not? Because I can't belive that i have to do a new *.java File and *xml File for every new Screen and then have to edit the manifest file.
So tell me, are there other possibilities?
Thanks Spazzt
Click to expand...
Click to collapse
What do you mean by "a new Screen"?
Well I have a screen with a button, and wehen i press this button a new screen should come up with a bit of text and a few other buttons etc.
I followed this tutorial, but i think it's just wrong...
Code:
h*t*t*p*://learnandroid.blogspot.c*o*m/2008/01/opening-new-screen-in-android.html
Sorry not allowed to post Links with my 3 Posts...
Spazzt said:
Well I have a screen with a button, and wehen i press this button a new screen should come up with a bit of text and a few other buttons etc.
I followed this tutorial, but i think it's just wrong...
Code:
h*t*t*p*://learnandroid.blogspot.c*o*m/2008/01/opening-new-screen-in-android.html
Sorry not allowed to post Links with my 3 Posts...
Click to expand...
Click to collapse
Sorry, I can't help you here. But you should explain better what you are talking about in your first post, because i.e. I understood how to make a new homescreen :S
Well read the Link i have posted so it is clear what i mean.
Nothing wrong with the java in that link, that's exactly how you would open a new intent (with a few variations maybe).
What exactly is wrong with it?
edit: Is it because you don't want to have a new .java/.xml for each screen? It would get pretty messy and hard to read otherwise
Ok, when you say thats the right way, it's ok.
I'm new to this andoid/java stuff.
But isn't there an easyer way to do this "new screen", some thing of automation in the sdk or eclipse?
I think it's really uncomfortable to do all these stepps by hand only for just one new screen. An app with many screen will grow really fast in that way, therefore i thought that this wasn't right though...
Yes, the proper way to create a new screen is to switch to a new activity, which has its own layout associated with it.
Its possible to have the sort of setup you're talking about... but it would be a workaround:
(pseudo-code)
<LinearLayout
...<LinearLayout id="page1"
......<Button
......<Button
......<Button
...</LinearLayout
...<LinearLayout id="page2"
......<Button
......<Button
......<Button
...</LinearLayout
</LinearLayout
If you wanted to, you could do something like...
RelativeLayout p1 = (RelativeLayout) findViewById(R.id.page1);
p1.setVisibility(View.GONE);
RelativeLayout p2 = (RelativeLayout) findViewById(R.id.page2);
p2.setVisibility(View.VISIBLE);
But again... thats kind of silly, and as your app becomes more complicated im not sure if thats the ideal approach

[WIDGET][YotaPhone2]Yota Toolbelt 1.0.4

Introduction
What is it?
Yota Toolbelt is my stab at developing something useful for the Yotaphone 2. It's a functional widget for the back screen, combined with a simple front screen widget. It has been tested on the latest Lollipop firmware (1.44).
What it does?
- The front screen widget allows you to toggle mirroring mode with a single click.
- The back screen widget allows you to toggle mirroring, wifi, Bluetooth, wifi tethering, ringer mode and YotaEnergy. Additionally you can place shortcuts to URLs to open your favorite websites quickly.
- The new "Contact list" action allows you to browse your contact list, make calls and send SMS's from it.
Click to expand...
Click to collapse
Images
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Check the screenshots tab for more
Click to expand...
Click to collapse
Installation instructions
I'm not going to bother putting this on Google Play because of the extra work with little benefit, so you have to install the apk manually. Here's how:
1. Check "allow installation of apps from unkown sources" from Settings - Security so that you can install the file.
2. Download the apk file and put it on your phone, or download it to your phone directly.
3. Open the apk file with some file manager and install it.
After this you can add the front screen widget like you would add any widget, by long pressing your home screen, selecting widgets, and then dragging the "Yota Toolbelt" on your home screen.
The back screen widget can be added from Yotahub.
Click to expand...
Click to collapse
Download
Download here (1.0.4)
Click to expand...
Click to collapse
Changelog
Code:
Current changelog: 2015-07-11
Version 1.0.4
- [NEW] Toggle for Wifi tethering.
- [NEW] Toggle for ringer mode: Normal/Vibrate (Toggling silent mode is simply not possible on Lollipop - Thanks Google!)
- [CHANGE] Added shortcuts to related system settings on long press to all but the Mirror widget in the config utility.
Old change logs:
Code:
Version 1.0.3
- [NEW] General settings for Contact list. These settings affect ALL INSTANCES of contact lists.
---- Choose the sort order
---- Choose name format
---- Choose dialer (EPD / mirrored). This should be changed only if you are having trouble making calls from the Contact list.
---- Lock EPD automatically when calling from Contact list to prevent accidental presses.
- [NEW] Added fast scroll support for the Contact list
- [FIX] Fixed Contact list not always closing after sending SMS or making a call
- [FIX] Fixed Mirror widget starting in incorrect state when mirrored.
Version 1.0.2
- [NEW] Contact list
- [FIX] Fixed a bug where widgets would not react after a while
Version 1.0.1
- [NEW] More advanced configuration utility
- [NEW] Battery level monitor / YotaEnergy toggle
- [NEW] Support for bookmark shortcuts that can be opened in EPD browser
or the default system browser in mirrored mode
- [NEW] Support for all widget sizes
- [NEW] Support for white theme
- [CHANGE] Changed the graphics to follow Yota's icons more closely.
Click to expand...
Click to collapse
Known issues
- This Widget requires Lollipop to work. No backwards compatibility.
- The battery widget doesn't have push effect. Also, toggling YotaEnergy on takes surprisingly long time. There's nothing I can do about that.
Click to expand...
Click to collapse
FAQ
The graphics.. They look.. ehrm..
- Awesome, right!? I'm a programmer, not an artist. If someone wants to create new graphics for the widget, I am very willing to change them. Each button should be the same size, at least 140x140px.
What are all these permissions?
- Bluetooth/Wifi/Network permissions are required for toggling wifi and Bluetooth directly without the system's dialogs.
- The vibration permission allows the buttons to vibrate on click.
- The READ_CONTACTS permission is for the new contact list portion, allowing it to list your contacts.
- The PHONE_CALL permission is for making a call using the front screen's dialer.
- The READ_PHONE_STATE is used for making the "lock EPD on dial" function work
Click to expand...
Click to collapse
For developers
I had to do some serious reverse engineering to figure out how to activate and deactivate the mirroring and YotaEnergy, so to save everyone's time, here's how to do it:
Activate mirroring from front screen:
Code:
Intent i = new Intent("yotaphone.intent.action.MIRRORING_START");
context.sendBroadcast(i);
i = new Intent("yotaphone.intent.action.MIRRORING_START_MANUAL");
context.sendBroadcast(i);
Activate mirroring from back screen:
Code:
Intent i = new Intent("yotaphone.intent.action.MIRRORING_START_FROM_BS");
context.sendBroadcast(i);
Deactivate mirroring:
Code:
Intent i = new Intent("yotaphone.intent.action.MIRRORING_STOP");
context.sendBroadcast(i);
To check is mirroring on right now, and to lock the EPD (asynchronous):
Code:
ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
IFrameworkService mService = IFrameworkService.Stub.asInterface(service);
boolean isMirroringOn = mService.isMirroringOn();
mService.lockBackScreen();
}
public void onServiceDisconnected(ComponentName className) {}
};
Intent i = new Intent("yotaphone.intent.action.GET_SERVICE_BINDER").setPackage("com.yotadevices.yotaphone2.bsmanager");
context.getApplicationContext().bindService(i, mConnection, Context.BIND_AUTO_CREATE);
//Remember to unbind when you don't need the service anymore
To detect when mirroring is started, listen for the following broadcast:
Code:
yotaphone.intent.action.MIRRORING_START
To detect when mirroring ends, listen for both of these broadcasts:
Code:
yotaphone.intent.action.MIRRORING_STOP_MANUAL
yotaphone.intent.action.MIRRORING_STOP
To turn YotaEnergy on:
Code:
final Intent i = new Intent("yotaphone.intent.action.POWERSAVE_START");
context.sendBroadcast(i);
To turn YotaEnergy off:
Code:
final Intent i = new Intent("yotaphone.intent.action.POWERSAVE_STOP");
context.sendBroadcast(i);
To open Yota's EPD browser:
Code:
Intent i = new Intent();
i.setComponent(new ComponentName("com.yotadevices.yotaphone.yd_browser", "com.yotadevices.yotaphone.yd_browser.BSBrowser"));
i.putExtra("URL_TO_OPEN", "http://www.google.com");
context.startService(i);
Click to expand...
Click to collapse
XDA:DevDB Information
Yota Toolbelt, Device Specific App for the YotaPhone
Contributors
Jeopardy
Version Information
Status: Stable
Current Stable Version: 1.0.4
Stable Release Date: 2015-07-11
Created 2015-06-28
Last Updated 2015-07-11
Suggest features
I am open to suggestions for functions to add. Functions I've considered:
Flashlight - this one's doable, but it seems a little pointless. How are you going to turn the flashlight on in the dark when there's no backlight on the EPD?
Volume/Vibrate/Silent toggle - Probably doable, but requires some work so that it's easy to use.
Rotation lock - Not sure about this, but pointless anyway. The rear screen doesn't support horizontal view in the first place, unless you're mirroring, and then you might as well use widgets on your front screen.
Airplane mode - This one requires root access, and is quite hacky to implement.
NFC toggle - Cannot be done without root.
GPS toggle - Cannot be done without root.
Any ideas?
Thanks for doing this.
You might want to add Hotspot and data network
Would you be able to add Shortcuts? That would be very useful and its a shame the stock app does not allow this.
All Day On XDA said:
Thanks for doing this.
You might want to add Hotspot and data network
Would you be able to add Shortcuts? That would be very useful and its a shame the stock app does not allow this.
Click to expand...
Click to collapse
I'll look into your suggestions. I think the hotspot function required root access, and that is not very user friendly.
About the shortcuts - Isn't the stock Apps Launcher widget exactly what you're looking for?
Jeopardy said:
I'll look into your suggestions. I think the hotspot function required root access, and that is not very user friendly.
About the shortcuts - Isn't the stock Apps Launcher widget exactly what you're looking for?
Click to expand...
Click to collapse
the stock app allows links to apps only. Shortcuts are a subset of apps that can be added to the desktop. Eg in Google Maps you can create a shortcut on your homescreen that starts directions to a pre set destination. Or eg Chrome allows shortcuts to websites to be placed on the homescreen.
Edit: This may be beyond the scope of this widget. Apologies
All Day On XDA said:
the stock app allows links to apps only. Shortcuts are a subset of apps that can be added to the desktop. Eg in Google Maps you can create a shortcut on your homescreen that starts directions to a pre set destination. Or eg Chrome allows shortcuts to websites to be placed on the homescreen.
Edit: This may be beyond the scope of this widget. Apologies
Click to expand...
Click to collapse
Ah, I see. I've never used these before.
It is possible yes, but the biggest issue here is how you create and associate them to the widget. By default the shortcuts are created by the applications, like Chrome and Google Maps, and those applications send the shortcut Intent to the Launcher application. There is no way of telling the system that the shortcut should show up on this widget.
It probably could be possible to create these shortcuts manually for supported applications, like Chrome, but that would require quite a lot of work.
Nice work @Jeopardy! Thanks for sharing some dev notes too, might be useful for future widgets/apps.
PS You could officially kick off the "YotaPhone Original Android Development" device subforum with your widget (0 threads there now).
SteadyQuad said:
Nice work @Jeopardy! Thanks for sharing some dev notes too, might be useful for future widgets/apps.
PS You could officially kick off the "YotaPhone Original Android Development" device subforum with your widget (0 threads there now).
Click to expand...
Click to collapse
Thank you. Yeah I was wondering for the right place to put this. Now that you mentioned it, I guess the proper place would be the Original Android Development, but to put it there now would require a moderator.
Jeopardy said:
I am open to suggestions for functions to add. Functions I've considered:
Flashlight - this one's doable, but it seems a little pointless. How are you going to turn the flashlight on in the dark when there's no backlight on the EPD?
Volume/Vibrate/Silent toggle - Probably doable, but requires some work so that it's easy to use.
Rotation lock - Not sure about this, but pointless anyway. The rear screen doesn't support horizontal view in the first place, unless you're mirroring, and then you might as well use widgets on your front screen.
Airplane mode - This one requires root access, and is quite hacky to implement.
NFC toggle - Cannot be done without root.
GPS toggle - Cannot be done without root.
Any ideas?
Click to expand...
Click to collapse
Since I am using the "default" black theme I would prefer to have an option to switch between "black" and "white" version. I already created the changed images to basically switch your images to "all transparent" with white icons and a white circle around them for "pressed status". Since I am a new user I can't attach them to the post yet. Can you tell me a way to share them with you?
Besides that: can you share the sources of your widget to allow us to build upon it ourselves?
Thanks for your work on this!
crazy-ivanovic said:
Since I am using the "default" black theme I would prefer to have an option to switch between "black" and "white" version. I already created the changed images to basically switch your images to "all transparent" with white icons and a white circle around them for "pressed status". Since I am a new user I can't attach them to the post yet. Can you tell me a way to share them with you?
Besides that: can you share the sources of your widget to allow us to build upon it ourselves?
Thanks for your work on this!
Click to expand...
Click to collapse
I just sent you a private message about those images.
I'll consider sharing the source later. At the moment it is rather messy and very much hardcoded. I am currently rewriting the configuration Activity to allow rearranging of the icons and adding some new functions. It will take some time for me to finish this to a level I'm satisfied with.
Jeopardy said:
I just sent you a private message about those images.
I'll consider sharing the source later. At the moment it is rather messy and very much hardcoded. I am currently rewriting the configuration Activity to allow rearranging of the icons and adding some new functions. It will take some time for me to finish this to a level I'm satisfied with.
Click to expand...
Click to collapse
Mail sent.
Thanks for the info. Looking forward to see updates to this useful tool (and the first widget posted in here!).
All Day On XDA said:
the stock app allows links to apps only. Shortcuts are a subset of apps that can be added to the desktop. Eg in Google Maps you can create a shortcut on your homescreen that starts directions to a pre set destination. Or eg Chrome allows shortcuts to websites to be placed on the homescreen.
Edit: This may be beyond the scope of this widget. Apologies
Click to expand...
Click to collapse
I just released an update which addresses your idea of shortcuts for system's default browser (Chrome) and EPD's browser. Now the widget's framework is so flexible that it is very easy to add new shortcut targets. The only problem (still) is that the shortcuts have to be created manually from the widget, which means relatively complex dialogs. Shortcuts for browser is extremely handy, but can you think of some other app whose shortcuts would be as useful?
i have try it on my Yota 2 4.4.3 apk not work !
9100_it said:
i have try it on my Yota 2 4.4.3 apk not work !
Click to expand...
Click to collapse
That was to be expected. I don't think they included the SDK library until Lollipop. Sorry.
Major update
Okay, here's a new update for you guys.
First off, the minor (but important fixes) include fixing nonresponsive buttons if the device has been inactive for a long time, and some minor optimizations.
The big new function is a fully functional contacts list! I had been working on this for a while, waiting for Yota to update their caller app so I wouldn't have to do it. But it seems they are busy doing something else. So I became impatient and decided to include it here, as it needs an EPD widget anyway to launch it. So just add the contact list widget to the toolbelt from options, open it from the back screen, and you can browse all your contacts (with phone numbers) and then call them directly from the EPD. It also supports sending SMS's, but the catch is that it uses the front screen SMS editor via mirroring, not Yota's sleek EPD editor. The reason for this is there's no way to hook up to Yota's editor.
While I was building this update I also noticed quite serious security flaw in Yota's EPD dialer app. By default if you want to make a phone call from your app you need to add android.permission.CALL_PHONE to your manifest. However, I found out that Yota has left their EPD dialer app completely open for any app to ask for immediate phone call (like mine does), without any permissions what-so-ever. What were they thinking?
It also became frustratingly clear how bad the SDK is at the moment. The documentation is nonexistent, and you cannot even create dialogs. So many workarounds had to be made to make this work nicely.
But anyways, let me hear your opinions and experiences. There's bound to be some bugs somewhere and there's plenty of room to expand the contact list portion, provided I have the time.
Looking forward to trying the newest version. Thanks for building this!
You might want to consider contacting the Indiegogo campaign folks, as it looks like you've earned yourself a free phone. I can't post the link because I guess I'm too new a user on here, but if you look at the updates and scroll down to "25 days ago":
FYI: If anyone successfully develops an application or service to work natively for the "always on" display I will reward them with a YotaPhone 2 for FREE at the end of the campaign!
Click to expand...
Click to collapse
MichaelA said:
Looking forward to trying the newest version. Thanks for building this!
You might want to consider contacting the Indiegogo campaign folks, as it looks like you've earned yourself a free phone. I can't post the link because I guess I'm too new a user on here, but if you look at the updates and scroll down to "25 days ago":
Click to expand...
Click to collapse
Wow, might as well try it. Thanks for the info!
Hi thanks for standing in where yota appear to lack
just downloaded and installed but although the contacts list works well the phone dialer doesnt but i do have a call confirm slider app (used to stop wrongly dialed numbers) which could block this (it does the same with yota dialer)
only way i have managed to work around this is to mirror the android dialer app but would be nice if you could? do anything?
like your commitment to develop - think you should look at a donate function somewhere..would buy you a coffee or two for your efforts
regards
kam1962 said:
Hi thanks for standing in where yota appear to lack
just downloaded and installed but although the contacts list works well the phone dialer doesnt but i do have a call confirm slider app (used to stop wrongly dialed numbers) which could block this (it does the same with yota dialer)
only way i have managed to work around this is to mirror the android dialer app but would be nice if you could? do anything?
like your commitment to develop - think you should look at a donate function somewhere..would buy you a coffee or two for your efforts
regards
Click to expand...
Click to collapse
Basically what I do, is ask the official EPD dialer to make the phone call for me. If your call confirm slider app blocks the yota dialer, it will also block this. I guess you cannot add exceptions to the caller app? (Probably not, knowing Android's telephony API...)
An ugly workaround for your specific case would be for me to turn mirroring on when you press the call-button from my contacts list, and then ask the system's default dialer to make the call. Then your call confirm slider app would show up normally in the mirrored mode and you could finish the call. I might consider adding this later on as a setting somewhere, but no promises. It would be a lot cleaner if the mirroring mode would not be needed to finish the call, because turning it on takes quite a while and is a hassle to deal with when trying to do simple actions.
What is the name of the app you are using? I'll take a look.
call confirm
Jeopardy said:
Basically what I do, is ask the official EPD dialer to make the phone call for me. If your call confirm slider app blocks the yota dialer, it will also block this. I guess you cannot add exceptions to the caller app? (Probably not, knowing Android's telephony API...)
An ugly workaround for your specific case would be for me to turn mirroring on when you press the call-button from my contacts list, and then ask the system's default dialer to make the call. Then your call confirm slider app would show up normally in the mirrored mode and you could finish the call. I might consider adding this later on as a setting somewhere, but no promises. It would be a lot cleaner if the mirroring mode would not be needed to finish the call, because turning it on takes quite a while and is a hassle to deal with when trying to do simple actions.
What is the name of the app you are using? I'll take a look.
Click to expand...
Click to collapse
thanks for reply been searching for it but cannot find it anywhere on app store!!! so guessing its gone
must have transferred from old phone or it just been removed from market this year? cannot remember
its called call confirm slider version 0.9.1 icon is black circle with telephone handset inside but dont have any other details.
had it for a few years now and has been stable / reliable
very similar to this
https://play.google.com/store/apps/details?id=com.callconfirmer.free
regards

Categories

Resources