make a toggle button "greyed out" - Android Software Development

Hey guys,
Is there anyway to disable a toggle button and make it "greyed out"? I could just make it invisible but I think it would make more sense to the user if they could see that the button was not available rather than just having it disappear. I figured this would be pretty standard but I don't see it anywhere. Any help would be greatly appreciated.
Thanks,
Samuel Maskell

What's the purpose of the button?
You could just leave it there and not process based on code in the Listener.

Yeah, I was thinking of just making it display a toast message or something
but it would really be nice if I could change the appearance of the button
maybe I can play around with changing the background a bit..

Why not just setEnabled(false); ?

so I tried just using setBackgroundColor(Color.DKGRAY) but that failed miserably..
I can use getBackground() to get a Drawable object
so I should be able to take that object and make it darker
and then use setBackgroundDrawable, right?
I'm just not too sure how to go about making that drawable darker..

Gene Poole said:
Why not just setEnabled(false); ?
Click to expand...
Click to collapse
Didn't see your post last time. I am using setEnabled(false), but this does not change the appearance of the button. How are users supposed to know that the button is disabled? They'll just press it and think that the application froze or something because nothing will happen. If I could make the button darker and disable it, I think people would get the idea that it is disabled and not just broken.
Thanks,
Sam

apparently the background isn't what I want to change. Not sure what I should be doing exactly..

have you tried toggle.setColorFilter(0xAARRGGBB, Mode.SRC_ATOP); ?
you'd need to find the correct #AARRGGBB code for a greyish color, but it should work.
EDIT: Ok, so after playing around with the settings a bit I found that this works pretty nicely for greying something out toggle.setColorFilter(0xA6A6A6A6, Mode.SRC_ATOP);

ToggleButton doesn't seem to have a setColorFilter() class
did you do toggle.getBackground.setColorFilter() or something like that?

Actually, I was using setColorFilter on an ImageButton, that's probably why... sorry

smaskell said:
Didn't see your post last time. I am using setEnabled(false), but this does not change the appearance of the button. How are users supposed to know that the button is disabled? They'll just press it and think that the application froze or something because nothing will happen. If I could make the button darker and disable it, I think people would get the idea that it is disabled and not just broken.
Thanks,
Sam
Click to expand...
Click to collapse
Are you doing some custom painting or something weird? I've not tried this with a toggle button specifically, but other controls like check boxes and regular buttons show a grayed-out appearance when I've used this method.

EDIT: sorry, double post

alright, that was stupid..
for some reason I was using setClickable instead of setEnabled
I think I accidentally clicked in eclipse's autocomplete menu..
setEnabled(false) works perfectly
thank you so much

Are you doing some custom painting or something weird? I've not tried this with a toggle button specifically, but other controls like check boxes and regular buttons show a grayed-out appearance when I've used this method.
Click to expand...
Click to collapse
Yeah you're right, I just tried it out in one of my apps and the whole button faded out and is see-through

The correct way to do what youre doing is to make an xml file for your buttons:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE selector>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_enabled="false"
android:drawable="@drawable/bar_gray_disabled" />
<item
android:state_pressed="true"
android:state_enabled="true"
android:drawable="@drawable/bar_gray_clicked" />
<item
android:state_focused="true"
android:state_enabled="true"
android:drawable="@drawable/bar_gray" />
<item
android:state_enabled="true"
android:drawable="@drawable/bar_gray" />
</selector>
You can pretty much just copy and paste that into an xml file and put it in your drawable folder.
If you create "myCustomButton.xml", then you'll set your buttons background to be "@drawable/myCustomButton"
To make this work you need to also get the 3 drawables for your different button states:
Normal (Mine is called bar_gray
Clicked (Mine is called bar_gray_clicked)
Disabled (Mine is called bar_gray_disabled)
Android will handle the switching of the images as you click the button or when you do setEnabled(false)

Down and dirty, like you said before:
Toast.makeText(this, "Button disabled", Toast.LENGTH_SHORT).show();

Related

[TF3D APP][14.09.08]Calendar v.0.75 with Active Icon

All right, boys and girls, please welcome first custom tf3d/manila application ever!
It's a simple calendar, but it's just a test of manila coding/modding and someone might find it useful, also.
PLEASE NOTE, that development is still in beta state - much things to be fixed/added. Feedback/bugreports are welcome, of course.
Installation instructions:
1. Backup all *_manila files in \windows\ folder! You can skip this step, but don't complain afterwards
2. Copy all files from \windows\ in archive to \windows\ folder on device
3. Add new tab entry to 26948339_manila (it can be found in \windows\ dir):
Code:
<Page Order="10" Name="calendar.page" PackageName="HTC" Title="Calendar">
<ComponentReference Name="page" Mode9Path="HTC\calendar.mode9" Component="GizmoRoot" SmartComponent="true" />
<ComponentReference Name="icon_normal" Mode9Path="HTC\Calendar.mode9" Component="ActiveCalendarIconTray" />
<ComponentReference Name="icon_selected" Mode9Path="HTC\Calendar.mode9" Component="ActiveCalendarIconOn" />
<ComponentReference Name="icon_preview" Mode9Path="HTC\Calendar.mode9" Component="ActiveCalendarIconPreview" />
</Page>
Put your language title for calendar instead of Title="Calendar"
Also, you can still use old "static" icons (or combine them with active by replacing strings partly):
Code:
<ComponentReference Name="icon_normal" Mode9Path="HTC\calendar.mode9" Component="Calendar_Off" />
<ComponentReference Name="icon_selected" Mode9Path="HTC\calendar.mode9" Component="Calendar_On" />
<ComponentReference Name="icon_preview" Mode9Path="HTC\calendar.mode9" Component="Calendar_Preview" />
4. Restart manila
5. ???
6. PROFIT
PS Feel free to edit application icon
Updates
Version 0.6:
- Added localization support. Package contains only en-us and ru-ru locales. If you need your language added, please fill in any of locales included with your language and send back to me - i will add it to pkg.
- Removed red textbox - app looks nice now
- Minor bugfixes
Version 0.7:
- New locale IDS! Be aware when creating new language packs!
- Finger flick control (oh yeah, baby)
- Hardware button control (up/down)
Version 0.75:
- Active Icon (shows real date in tray/preview)
How to make your own locale file:
http://forum.xda-developers.com/showthread.php?p=3129893#post3129893
Have fun
Looks awsome, I'll try it soon and let you know.
Thanks.
I dont find 26948339_manila? Which version of manila did you have?
Atze001 said:
I dont find 26948339_manila? Which version of manila did you have?
Click to expand...
Click to collapse
Standard Manila from 1.93 ROM
Very weird that you don't have this file, coz it's manila.xml indeed
You can try searching for file, that contains "<PreloadImage".
Nice one ! Thank you !
WOW Just tested it and its working fine without any problem. Love the animation. Wish flicking finger up and down would change the months as well instead of using the arrow (Like in messages tab). One question, what are these numbers near the top left corner?
Flick control will be added in the next version.
As for red textbox, it's just a debug info - will be removed in later versions
Cool app!!!!
We hope you'll be able to manage Appointments on TF3d Today Screen........
D-MAN666 said:
Flick control will be added in the next version.
As for red textbox, it's just a debug info - will be removed in later versions
Click to expand...
Click to collapse
Got it. Will be looking forward.
Not sure if this is a bug, the 'Today' softkey on the calendar tab does nothing for me.
AF241 said:
Not sure if this is a bug, the 'Today' softkey on the calendar tab does nothing for me.
Click to expand...
Click to collapse
Today softkey returns you to current month (when you're out of it)
Also, guys, please test automatic day/month change (via system clock manipulations, of course )
Silly me. the Today key works just as you mentioned.
I tested automatic day/month change by changing the system date and it worked. The date on the calendar tab changed within a second or two after pressing the ok button.
Looks awesome - will defo have a go with this
Are the iphone icons included? I use iphone icons but dont have the calender manilla file.
What I really want is a custom application which previews the threaded text messages as the current one is pointless.
Awesome!!!
The first step to get new tabs in manila.
GREAT WORK!!!
iPhone icons are included in the package! If you don't see em, you either didn't copy the into windows dir, or incorrectly edited manila.xml file... or something else happened
Please note that it refers to calendar.mode9, not icons.mode9 (that may be the case):
<ComponentReference Name="icon_normal" Mode9Path="HTC\calendar.mode9" Component="Calendar_Off" />
Click to expand...
Click to collapse
A LiveMessenger Tab would be great.
Great idea, next highly anticip[ated features for this specific app would be:
1. Clicking the date opens the Calendar app to create new appointment (Default calendar/PI/Papyrus ... an option feature to choose)
2. Flicking down - show all your today appointments/tasks + for next 7 days (this one I guess i very much in demand, as the default manilla only show for today on main screen)
BTW, how about creating a .cab file?
AF241 said:
WOW Just tested it and its working fine without any problem.
Click to expand...
Click to collapse
could you post here your tab icon like on the screenshot?
Mkevin said:
could you post here your tab icon like on the screenshot?
Click to expand...
Click to collapse
This is "default" icon (for situations when icon is missing). I dunno why some people gets that icon instead of iPhone one (included). Anyone has iPhone icon?
PS Mkevin, нашел куда вставлять?
EazyVG said:
BTW, how about creating a .cab file?
Click to expand...
Click to collapse
The problem is in icon of that tab - for all it will be only one... so after .cab installing you must take file 112dc2ce_manila and 1479c303_manila from you Windows folder and change them to your view
And WARNING it works correctly only if you don't change any thing in manila (like change a place of tab in Advanced config or add call history tab) in another way code that you have to add to file must be different
Cab file not include icons from original
Nice finding It doesn't work for me. I have a blank new page with some numbers on the bottom and some other on the top of it an they keep rotating pressing on the two little arrows on the right. I have a skinned manila with a white theme and a 1.93 based rom.
Your findings on how to add new pages to manila will surely produce a lot of nice customizations. I think we will have a very hard time to arrange themes and new tabs tough

ProfileTimer - App for controlling ring & other hardware functions

pt is no longer supported, thanks, dan.
Any screen shots !!?
Haven't tried it yet. Sounds like a nifty program.
dody said:
Any screen shots !!?
Click to expand...
Click to collapse
here dude ;-)
http://rapidshare.com/files/188907011/profileTimer.png
hey i'd really like to use this app but it doesnt start on my blackstone .
dt_matthews said:
here dude ;-)
http://rapidshare.com/files/188907011/profileTimer.png
Click to expand...
Click to collapse
Thanks ! it is great
l tried so many apps for automatic changing of profiles with no success! This is the only one that works with weekly profile management!wll done! Only two suggestions-issues: a.make a tool to change the .hml file faster and easy b.sometimes when changing profile there is a notification error don't know why!
I tried CommManagerPro and woah! That was a complicated app! It had too many functions for me to figure out what to do and normally I'm the tech whiz. I think the dev tried to do too many things with one app >.> It ended up bad. It will take time to set that up. This is an easy to setup app that is fine for my needs Now I just need to find the one that supported tower ids.
I have edited the config.xml file and have it in my profile timer folder..
I can launch profile timer and see the schedule, but how do I keep the program running?
I see schedule.exe and have clicked it, and it turn my vibrate on, etc.
So I assume that the scheduler.exe file has to be in the startup
folder in order for the profiletimer program to start up
and run after reset? To manually start it, it looks like you just
need to run the scheduler.exe.
Am i correct about where put the scheduler.exe to run the program
and start the sched?
cj
(also, in the config.xml, what happens if you want a schedule
to go from 7am-12pm (ringer off), then 12pm-5 (ringer on)
do you have to input 7:01-12:00, then start the next one at 12:01-17:00?
or can you put in 12:00-17:00 (didnt know if the program would
accept the overlap from 12:00 or if it needed 12:01.
I assume that if you dont put anything in for 12:00-17:00 then the
program will run the Default setup and turn the ringer on , etc..
does that mean from 12:00-12:01 it would default to the default
of the phone as setup in config.xml?
cejay said:
I have edited the config.xml file and have it in my profile timer folder..
I can launch profile timer and see the schedule, but how do I keep the program running?
I see schedule.exe and have clicked it, and it turn my vibrate on, etc.
So I assume that the scheduler.exe file has to be in the startup
folder in order for the profiletimer program to start up
and run after reset? To manually start it, it looks like you just
need to run the scheduler.exe.
Am i correct about where put the scheduler.exe to run the program
and start the sched?
cj
(also, in the config.xml, what happens if you want a schedule
to go from 7am-12pm (ringer off), then 12pm-5 (ringer on)
do you have to input 7:01-12:00, then start the next one at 12:01-17:00?
or can you put in 12:00-17:00 (didnt know if the program would
accept the overlap from 12:00 or if it needed 12:01.
I assume that if you dont put anything in for 12:00-17:00 then the
program will run the Default setup and turn the ringer on , etc..
does that mean from 12:00-12:01 it would default to the default
of the phone as setup in config.xml?
Click to expand...
Click to collapse
Some more notes to clarify;
1. Extract ALL the files to the SAME folder on your device
2. Edit the config.xml to your timing requirements
3. Run ProfileTimer.exe
4. *DONT* run scheduler.exe diretcly (main app calls it as a console app)
5. If you want it to run after Soft-reset put a shortcut in Startup folder
6. The icons are (left to right):
a. Ringer on - Green shield
b. Vibrate - Amber shield
c. Red - silent
d. Sunglasses dude - light off
7. The program - like most other WM apps runs in the bacground (just hit your normal ok button to 'minimise' it
8. If you want to actually shut the app there is a Kill PT menu item
9. Volume setting is WIP, it should set ringer volume but I am still playign with this!
With regards to schedules with overlapping days, to be hones give it a go - as per my original post, I havent actually tried that. if it doesnt work, just split the schedule in to its seperate days so to speak.
hth
and sorry for slow reply, notification thread setting was wrong!
ttherapon said:
l tried so many apps for automatic changing of profiles with no success! This is the only one that works with weekly profile management!wll done! Only two suggestions-issues: a.make a tool to change the .hml file faster and easy b.sometimes when changing profile there is a notification error don't know why!
Click to expand...
Click to collapse
'Notification error' - could you give me any more detail - the View Log menu item should give you a bit more info so if you could post that...
pitchbend said:
hey i'd really like to use this app but it doesnt start on my blackstone .
Click to expand...
Click to collapse
what happens, happy to try and help - if you read my recent post with the bullet points that *might* get you running ! let me know if i can help ;-0
This is what I was looking for, but I have some problems:
the profile changes to vibrate but it dosen't go back to normal!!
Here the config file:
Code:
<dayProfile day="Wednesday">
<session activate="09:00" deactivate="09:02" vibrate="on" ring="off" volume="0" />
</dayProfile>
The default settings are:
Code:
<default vibrate="on" ring="on" volume="3" />
Tnx!
This is great, and so simple
Just a question,
what happens after the "deactivation" will the default be selected?
(what TheMorpheus is mentioning)
also look at my screen shot, there is something wrong with the calculation,
the phone should be burning a hole in my pocket by now ;-)
could it be you forgot a comma? (I think this is also valid for the voltage)
Lat question, the volume, are they points or steps?
e.g. in the FMOD lib you can set the volume to 255 (full) is that the same case here or is 5 the highest?
(1 = 20%, 2 = 40%, .. > 5 = 100% )
thanks
Great and simple application
Great and simple application.
Here is some functions make it more perfect.
Can it have some exception on some calendar events?
Such as mobile should have exception ring/vibration when I'm on Holiday or Public holiday.
Also, if it can execute some commands, it can provide more flexibility.
I changed the code:
Code:
<dayProfile day="Wednesday">
<session activate="08:00" vibrate="on" ring="off" volume="0" />
<session deactivate="12:10"/>
<session activate="14:00" vibrate="on" ring="off" volume="0" />
<session deactivate="18:10"/>
</dayProfile>
Now it seems working!!
If I want it to run after Soft-reset, what shortcut do I have to put in startup folder?
TheMorpheus said:
This is what I was looking for, but I have some problems:
the profile changes to vibrate but it dosen't go back to normal!!
Here the config file:
Code:
<dayProfile day="Wednesday">
<session activate="09:00" deactivate="09:02" vibrate="on" ring="off" volume="0" />
</dayProfile>
The default settings are:
Code:
<default vibrate="on" ring="on" volume="3" />
Tnx!
Click to expand...
Click to collapse
Hi,
It's not working because you have the default vibrate="on", therefore, once your session finishes, it is setting it to vibrate not ring!!
regards,
dan
TheMorpheus said:
I changed the code:
Code:
<dayProfile day="Wednesday">
<session activate="08:00" vibrate="on" ring="off" volume="0" />
<session deactivate="12:10"/>
<session activate="14:00" vibrate="on" ring="off" volume="0" />
<session deactivate="18:10"/>
</dayProfile>
Now it seems working!!
If I want it to run after Soft-reset, what shortcut do I have to put in startup folder?
Click to expand...
Click to collapse
You have added tags ( <session deactivate="18:10"/> ) which the app has no awareness of and will (at best) be ignored, and possibly confuse it. I advise you remove them! I assume its now working as you amended the default tag to make sense? (see my previous post).
Regards auto-start, put a shortcut to the ProfileTimer.exe and that will do what you want....
cheers
aaauto said:
Great and simple application.
Here is some functions make it more perfect.
Can it have some exception on some calendar events?
Such as mobile should have exception ring/vibration when I'm on Holiday or Public holiday.
Also, if it can execute some commands, it can provide more flexibility.
Click to expand...
Click to collapse
thanks for the feedback.
Mr_Gee said:
This is great, and so simple
Just a question,
what happens after the "deactivation" will the default be selected?
(what TheMorpheus is mentioning)
also look at my screen shot, there is something wrong with the calculation,
the phone should be burning a hole in my pocket by now ;-)
could it be you forgot a comma? (I think this is also valid for the voltage)
Lat question, the volume, are they points or steps?
e.g. in the FMOD lib you can set the volume to 255 (full) is that the same case here or is 5 the highest?
(1 = 20%, 2 = 40%, .. > 5 = 100% )
thanks
Click to expand...
Click to collapse
thanks for your feedback.
re the temp and voltage, they are the *battery* levels, not the device! that is the reported internal temp of battery and the voltage (in milliamps as per symbol). hth.
the volume setting is still WIP, I will do some more research and get back to you!
cheers,
dan

[WM6.5] isMToday: DISCONTINUED

DISCONTINUED
At least for now...
I have moved to a new device and started using HTC Sense instead of the 6.5 homescreen.
If i get chance I will finish the C++ version up over christmas, otherwise this can be considered dead.
Introduction
This project is simply a CHome/Titanium plugin which displays your Alarms (G-Alarm or Klaxon) and your Profiles (G-Profile).
Download
Attached to this post.
Installation Instructions
If you have v0.02 or v0.01 (CGAlarm) installed, uninstall that first.
Install the cab file - as far as i know it should not matter where but I have only tested to the main memory.
Wait for the settings program to load.
Notes
The settings program is quite slow, but the plugin itself is fine.
If anything goes wrong, backups of your .cpr files are kept in \Program Files\isMToday
I had to try to figure out the different alarm types. Everyday, weekend, monday, etc type alarms should be supported. One time alarms should be supported. Other types are a bit hit and miss. This does not affect the alarm functioning, but does mean the time to next alarm may be wrong.
Alarm/Profile logos taken from iREFLECT by bluemetalaxe
Requires .NET Compact Framework 3.5
Changelog
v0.06 2009/08/06
- Hopefully reduced memory footprint
[*]v0.03 2009/07/29
- Changed name to isMToday (Previously CGAlarm)
- Added support for Klaxon
- Reduced cpu usage
- Should play nicer with WM6.5 themes
[*]v0.02_NoG 2009/07/15
- Changed home screen text from galarm/gprofile to alarm/profile.
- Otherwise exactly the same as v0.02
[*]v0.02 2009/07/14
- Added G-Profile support
- Added pages for each alarm and profile
- Other improvements all over
- More reliable code
[*]v0.01 2009/07/11
- Initial release.
Screenshots
It works without any problems(so far ca. 5min.).
But it would be cool to have a titanium plugin for G-Profile where you can access your profiles and Wifi, Blurtooth, Phone like the normal today plugin.
PS: I use the old free 1.5.1 Version
I am interested. But it needs more functions.
can't download the cab, the link is broken. also upload a screenshot!
Raudi1 said:
It works without any problems(so far ca. 5min.).
But it would be cool to have a titanium plugin for G-Profile where you can access your profiles and Wifi, Blurtooth, Phone like the normal today plugin.
PS: I use the old free 1.5.1 Version
Click to expand...
Click to collapse
Thanks for trying. I had not actually considered users of the free version (which may never get an official titanium plugin).
I dont use G-Profile myself but had a quick look. Like G-Alarm it appears most information is available in the registry. At the very least I could add a button to this plugin which would launch the G-Profile quick select app, and perhaps display the currently active profile. It looks like thats all the built in today plugin does anyway. Im not sure about the wifi/bluetooth/phone buttons - I dont think there is a way to get G-Profile to toggle those for me so I would have to impliment it myself which may be too much work when you can access them from the quick select anyway.
Is this the kind of thing you had in mind or were you thinking of a separate plugin?
I will certainly add this to my todo list, but my next task is to try and have pages for all the alarms (so they can be enabled and disabled from the plugin).
ebsbow said:
I am interested. But it needs more functions.
Click to expand...
Click to collapse
Can you elaborate on what you want from it?
fixxxer2008 said:
can't download the cab, the link is broken. also upload a screenshot!
Click to expand...
Click to collapse
Oops, I moved my webspace around to put this up but its obviously not ready yet. I have attached them to the post for now.
I had a separate plugin in mind but a button to open the quick switch would already be a big help.
Updated to v0.02
Very nice. I was wondering if there was a way to slightly reduce the panel name so the "g" in galarm isn't cut off at the bottom?
Thanks for the sweet program.
Your welcome!
Good idea - I will add some sort of size option to the next version.
isangelous said:
Your welcome!
Good idea - I will add some sort of size option to the next version.[/QUO
You could just change the plugin name to "alarms". That would also fix the problem.
Click to expand...
Click to collapse
ptfdmedic said:
You could just change the plugin name to "alarms". That would also fix the problem.
Click to expand...
Click to collapse
Uploaded v0.02_NoG with this change.
Thanks for the new version!
Installed it and works perfectly and now I don't have any reasons to switch back to the standard today page(considered doing it a couple of times) and I definitely won't use Manila anymore(looks good but it takes too much time to reach what you want and it lacks many features like G-Alarm/Profile).You just have to disable titanium when updating from the old version or otherwise the installation fails.
But I'd like to be able to activate the profiles by clicking on them instead of using the softkey. But you already said it will be in your next version so I don't have any complains.
Im glad you are happy.
If all goes well I will release the next version in about one week - and this will be the last major update. It should include:
- Setting for enabling the clickable pages
- Setting for either font size or "galarm"/"alarm"
- Fix any update/uninstall issues
- Try to get full compatability with different alarm types
- Try to improve the layout a bit, possibly including logos for alarms/profiles and current time/date - This will require further investigation and may not change at all
- Try to make the config app a bit smoother (or at least better indicate when its busy).
If anyone has any other suggestions please let me know as soon as possible. After this update I will focus on other projects and plan to only release further updates to match G-Alarm updates and fix bugs.
isangelous said:
Im glad you are happy.
If all goes well I will release the next version in about one week - and this will be the last major update. It should include:
- Setting for enabling the clickable pages
- Setting for either font size or "galarm"/"alarm"
- Fix any update/uninstall issues
- Try to get full compatability with different alarm types
- Try to improve the layout a bit, possibly including logos for alarms/profiles and current time/date - This will require further investigation and may not change at all
- Try to make the config app a bit smoother (or at least better indicate when its busy).
If anyone has any other suggestions please let me know as soon as possible. After this update I will focus on other projects and plan to only release further updates to match G-Alarm updates and fix bugs.
Click to expand...
Click to collapse
Thanks for fixing that plugin name. One last thing I noticed is that when you scroll to the the panel "No upcomming alarms" is not centered in the panel like the other panels. I mean up and down centered. Left to right is good. That is the only thing I can find. Very nice app. Thanks for taking care of these cosmetic items.
Ah, I had not considered the middle "No missed calls" etc of the other panels. Matching that should be straightforward so will be included in the next release.
Thanks for the input.
isangelous said:
Ah, I had not considered the middle "No missed calls" etc of the other panels. Matching that should be straightforward so will be included in the next release.
Thanks for the input.
Click to expand...
Click to collapse
Any pdaton t nextld. Can'twait!!!!!!!
I have change the condensed view on my Omnia to the following -
Code:
<Layer ID="CGAlarmCondensed" Visible="False" Width="240" Height="34">
<Image ID="ImageFixed" Source="\My Documents\Themes\Bliss\bliss_iconbgclear_portrait.png" Left="10" Top="4" Width="220" Height="29" ScaleStyle="Fit" />
<Layer ID="Page">
<!-- Icon -->
<Image ID="ImageFixed" Source="\My Documents\Themes\Bliss\bliss_clock.png" Left="11" Top="7" Width="23" Height="23" ScaleStyle="Fit" />
<Text ID="PluginLabel" Left="40" Top="6" Width="220" Height="34" FontFamily="segoe ui" FontSize="15" FontStyle="regular" Wrap="False" VerticalAlignment="Middle" Trimming="EllipsisCharacter">
My issue is that i am unable to see the bliss_clock.png image in the condensed view.
Am i missing something silly? like a registry entry thats required?
You just need to put the images outside the Page layer:
Code:
<Layer ID="CGAlarmCondensed" Visible="False" Width="240" Height="34">
<Image ID="ImageFixed" Source="\My Documents\Themes\Bliss\bliss_iconbgclear_portrait.png" Left="10" Top="4" Width="220" Height="29" ScaleStyle="Fit" />
<Image ID="ImageFixed" Source="\My Documents\Themes\Bliss\bliss_clock.png" Left="11" Top="7" Width="23" Height="23" ScaleStyle="Fit" />
<Layer ID="Page">
Your example did not work because the Bliss theme is replacing the images already included in the clock panel. Its hard to tell exactly because the clock is built into CHome, but it must define ImageFixed somehow. As ours is not built in, we would need a definition like this:
HKEY_LOCAL_MACHINE\Software\Microsoft\CHome\CGAlarm\CondensedPage\ImageFixed
for it to work within the Page layer, and I think it would ignore the Source="..." bit then anyway.
Dont forget, if you make changes like and run the cgalarm settings application again it will undo them. But as it backs your cpr to \Program Files\CGAlarm you can just copy it back again.
Nice panel, thanks!
About G-profiles (I use Klaxon, no g-alarm)... you could use the same icons for every profile as they are installed! In Program Files\ageye\G-Profile\skins\default you can find all the original icons. Maybe you could even add a G-Profile icon in the condensed view? And do you know Klaxon maybe? And maybier, are you going to roll out any Klaxon panel? Would be similar to G-Profile's, simply read the alarms set (and maybe some option/setting? don't know...) and create panel page...
1. Why in the startup file cgalarm.exe? This is due to update in real time? It loads the processor, resulting ooze battery ...
2. I changed the name of the plugin across CHomeEditor. After rebooting restores title by default. How can I avoid this?

[Q] Disabling Landscape send keyboard Window

Is there any way to disable the send window when the user enters text to an EditText in landscape orientation in my app? I mean this:
View attachment 2101779
It is quite annoying because the user cannot see the app anymore. I searched and played around with setInputType but didn't find anything that worked and I don't want to disable landscape orientation totally.
Thanks in advance.
No ideas?
I thought maybe the WindowManager. LayoutParams.softInputMode could do the trick when set to one of the SOFT_INPUT_ADJUST... methods here.
Will this work or is it a totally wrong way or even not possible at all?
are you trying to hide the "senden" button, or the whole edit text window(everything between the keyboard and the status bar)?
out of ideas said:
are you trying to hide the "senden" button, or the whole edit text window(everything between the keyboard and the status bar)?
Click to expand...
Click to collapse
The whole window. I want to be able to see the the other buttons my app has there.
Not sure if this is what you want but add the following line to your editbox XML:
Code:
android:imeOptions="flagNoExtractUi"
zalez said:
Not sure if this is what you want but add the following line to your editbox XML:
Code:
android:imeOptions="flagNoExtractUi"
Click to expand...
Click to collapse
Thanks, sounds good and I will try that
Edit: Worked!! Thanks again

[GUIDE] The right Soft Keyboard (+adding a CustomKeyboard)

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.

Categories

Resources