Re: [android-developers] Re: Confused by @Override

2011-03-22 Thread trans
My app is based on the SoftKeyboard example. Problem is the way the 
KeyboardView class is designed in the Android API, as far as I can see it 
only allows for one key background for all keys.

As of yet the only way around it I can see is to create a IME from the 
ground up and dump the Keyboard classes the Andorid API provides out of the 
box.



-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Confused by @Override

2011-03-22 Thread Justin Anderson
* Problem is the way the KeyboardView class is designed in the Android API,
as far as I can see it only allows for one key background for all keys.*

Ahh Now we get to the real problem.  If you had been more specific about
the problem in the first place then better help could have been provided (as
opposed to lectures about standard OOP principles).

* As of yet the only way around it I can see is to create a IME from the
ground up and dump the Keyboard classes the Andorid API provides out of the
box.
*
So it seems that is the case.  That's unfortunate; I can see why it might be
useful to have some keys with different backgrounds.

One thing you could try doing (but I admit this would be cludgy and ugly
code) is to set the background for the keyboard and then calling
invalidateKey() on a specific key.  Then, change the background to what you
want for the next key and calling invalidateKey() again... Probably won't
work, but it may be worth a shot.

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Tue, Mar 22, 2011 at 12:26 AM, trans transf...@gmail.com wrote:

 My app is based on the SoftKeyboard example. Problem is the way the
 KeyboardView class is designed in the Android API, as far as I can see it
 only allows for one key background for all keys.

 As of yet the only way around it I can see is to create a IME from the
 ground up and dump the Keyboard classes the Andorid API provides out of the
 box.



  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Confused by @Override

2011-03-21 Thread Jonathan Foley

If you absolutely need to access those fields/methods you CAN use Java
reflection, but it's a very fragile solution in that those fields
could change across Android iterations. Using reflection you can
change the visibility of the private fields/methods and invoke them/
change their values. Here's an example, which also discusses the
dangers:

http://radio.javaranch.com/val/2004/05/18/1084891793000.html


The alternative would be to copy the code from that class and create
your own, making those fields protected or providing methods to mutate
them.

Jonathan

On Mar 21, 1:46 pm, Justin Anderson magouyaw...@gmail.com wrote:
 You can only change the behavior of public or protected
 methods/variables...  Private scope means private to everybody... including
 sub-classes.

 Standard OOP design...

 Thanks,
 Justin Anderson
 MagouyaWare Developerhttp://sites.google.com/site/magouyaware







 On Mon, Mar 21, 2011 at 2:30 PM, trans transf...@gmail.com wrote:
  non-sense? I need to change it's behavior. How else am I going to do it?

   --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Confused by @Override

2011-03-21 Thread Justin Anderson
YIKES!  I wouldn't touch that with a 10-foot pole!

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Mon, Mar 21, 2011 at 2:54 PM, Jonathan Foley jonefo...@gmail.com wrote:


 If you absolutely need to access those fields/methods you CAN use Java
 reflection, but it's a very fragile solution in that those fields
 could change across Android iterations. Using reflection you can
 change the visibility of the private fields/methods and invoke them/
 change their values. Here's an example, which also discusses the
 dangers:

 http://radio.javaranch.com/val/2004/05/18/1084891793000.html


 The alternative would be to copy the code from that class and create
 your own, making those fields protected or providing methods to mutate
 them.

 Jonathan

 On Mar 21, 1:46 pm, Justin Anderson magouyaw...@gmail.com wrote:
  You can only change the behavior of public or protected
  methods/variables...  Private scope means private to everybody...
 including
  sub-classes.
 
  Standard OOP design...
 
  Thanks,
  Justin Anderson
  MagouyaWare Developerhttp://sites.google.com/site/magouyaware
 
 
 
 
 
 
 
  On Mon, Mar 21, 2011 at 2:30 PM, trans transf...@gmail.com wrote:
   non-sense? I need to change it's behavior. How else am I going to do
 it?
 
--
   You received this message because you are subscribed to the Google
   Groups Android Developers group.
   To post to this group, send email to
 android-developers@googlegroups.com
   To unsubscribe from this group, send email to
   android-developers+unsubscr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Confused by @Override

2011-03-21 Thread trans
The alternative would be to copy the code from that class and create your 
own, making those fields protected or providing methods to mutate them.

That's what I've started to conclude myself and attempted to do so, but ran 
into the problem of accessing `com.android.internal.R`. Which means that 
I'll have to provide a replacement for each value, e.g.

  com.android.internal.R.styleable.KeyboardView_keyBackground
  com.android.internal.R.styleable.KeyboardView_verticalCorrection
  com.android.internal.R.styleable.KeyboardView_keyPreviewLayout
  com.android.internal.R.styleable.KeyboardView_keyPreviewOffset
  com.android.internal.R.styleable.KeyboardView_keyPreviewHeight
  com.android.internal.R.styleable.KeyboardView_keyTextSize
  com.android.internal.R.styleable.KeyboardView_keyTextColor
  com.android.internal.R.styleable.KeyboardView_labelTextSize
  com.android.internal.R.styleable.KeyboardView_popupLayout
  com.android.internal.R.styleable.KeyboardView_shadowColor
  com.android.internal.R.styleable.KeyboardView_shadowRadius 

and more. Deeper and deeper. And I just want to change the background image 
of the spacebar.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Confused by @Override

2011-03-21 Thread Jonathan Foley
Hmm...having not developed an IME I don't know what the best course
is, but there are APIs for deploying a custom IME. Within those there
must be ways fo specifying the drawables. I gather that what you want
to do is to change the spacebar of the default android keyboard?
That's going to be ugly as you have discovered. Those resources are of
course going to be private as who wants dev changing the keyboard just
for their app? I'd consider something else. Do you really need to
change the spacebar drawable? Its just a spacebar.


Jonathan


On Mon, Mar 21, 2011 at 3:12 PM, trans transf...@gmail.com wrote:
 The alternative would be to copy the code from that class and create your
 own, making those fields protected or providing methods to mutate them.
 That's what I've started to conclude myself and attempted to do so, but ran
 into the problem of accessing `com.android.internal.R`. Which means that
 I'll have to provide a replacement for each value, e.g.

   com.android.internal.R.styleable.KeyboardView_keyBackground
   com.android.internal.R.styleable.KeyboardView_verticalCorrection
   com.android.internal.R.styleable.KeyboardView_keyPreviewLayout
   com.android.internal.R.styleable.KeyboardView_keyPreviewOffset
   com.android.internal.R.styleable.KeyboardView_keyPreviewHeight
   com.android.internal.R.styleable.KeyboardView_keyTextSize
   com.android.internal.R.styleable.KeyboardView_keyTextColor
   com.android.internal.R.styleable.KeyboardView_labelTextSize
   com.android.internal.R.styleable.KeyboardView_popupLayout
   com.android.internal.R.styleable.KeyboardView_shadowColor
   com.android.internal.R.styleable.KeyboardView_shadowRadius

 and more. Deeper and deeper. And I just want to change the background image
 of the spacebar.


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Confused by @Override

2011-03-21 Thread Kostya Vasilyev
I haven't written a keyboard either, but there is a sample implementation
here:

http://developer.android.com/resources/samples/SoftKeyboard/index.html

Hopefully this sample code doesn't suffer from any compile problems. There
is a drawable for the space bar in there, too.
22.03.2011 1:41 пользователь Jonathan Foley jonefo...@gmail.com написал:
 Hmm...having not developed an IME I don't know what the best course
 is, but there are APIs for deploying a custom IME. Within those there
 must be ways fo specifying the drawables. I gather that what you want
 to do is to change the spacebar of the default android keyboard?
 That's going to be ugly as you have discovered. Those resources are of
 course going to be private as who wants dev changing the keyboard just
 for their app? I'd consider something else. Do you really need to
 change the spacebar drawable? Its just a spacebar.


 Jonathan


 On Mon, Mar 21, 2011 at 3:12 PM, trans transf...@gmail.com wrote:
 The alternative would be to copy the code from that class and create
your
 own, making those fields protected or providing methods to mutate them.
 That's what I've started to conclude myself and attempted to do so, but
ran
 into the problem of accessing `com.android.internal.R`. Which means that
 I'll have to provide a replacement for each value, e.g.

   com.android.internal.R.styleable.KeyboardView_keyBackground
   com.android.internal.R.styleable.KeyboardView_verticalCorrection
   com.android.internal.R.styleable.KeyboardView_keyPreviewLayout
   com.android.internal.R.styleable.KeyboardView_keyPreviewOffset
   com.android.internal.R.styleable.KeyboardView_keyPreviewHeight
   com.android.internal.R.styleable.KeyboardView_keyTextSize
   com.android.internal.R.styleable.KeyboardView_keyTextColor
   com.android.internal.R.styleable.KeyboardView_labelTextSize
   com.android.internal.R.styleable.KeyboardView_popupLayout
   com.android.internal.R.styleable.KeyboardView_shadowColor
   com.android.internal.R.styleable.KeyboardView_shadowRadius

 and more. Deeper and deeper. And I just want to change the background
image
 of the spacebar.


 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Confused by @Override

2011-03-21 Thread Justin Anderson
If you are trying to change the color of the spacebar for the default
Android Keyboard, then it isn't possible.  If you are simply wanting to
write your own IME, follow the tutorial posted by the others...

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Mon, Mar 21, 2011 at 4:40 PM, Jonathan Foley jonefo...@gmail.com wrote:

 Hmm...having not developed an IME I don't know what the best course
 is, but there are APIs for deploying a custom IME. Within those there
 must be ways fo specifying the drawables. I gather that what you want
 to do is to change the spacebar of the default android keyboard?
 That's going to be ugly as you have discovered. Those resources are of
 course going to be private as who wants dev changing the keyboard just
 for their app? I'd consider something else. Do you really need to
 change the spacebar drawable? Its just a spacebar.


 Jonathan


 On Mon, Mar 21, 2011 at 3:12 PM, trans transf...@gmail.com wrote:
  The alternative would be to copy the code from that class and create
 your
  own, making those fields protected or providing methods to mutate them.
  That's what I've started to conclude myself and attempted to do so, but
 ran
  into the problem of accessing `com.android.internal.R`. Which means that
  I'll have to provide a replacement for each value, e.g.
 
com.android.internal.R.styleable.KeyboardView_keyBackground
com.android.internal.R.styleable.KeyboardView_verticalCorrection
com.android.internal.R.styleable.KeyboardView_keyPreviewLayout
com.android.internal.R.styleable.KeyboardView_keyPreviewOffset
com.android.internal.R.styleable.KeyboardView_keyPreviewHeight
com.android.internal.R.styleable.KeyboardView_keyTextSize
com.android.internal.R.styleable.KeyboardView_keyTextColor
com.android.internal.R.styleable.KeyboardView_labelTextSize
com.android.internal.R.styleable.KeyboardView_popupLayout
com.android.internal.R.styleable.KeyboardView_shadowColor
com.android.internal.R.styleable.KeyboardView_shadowRadius
 
  and more. Deeper and deeper. And I just want to change the background
 image
  of the spacebar.
 

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en