开发者

How do I detect the FIXED keyboard on Droid Pro?

开发者 https://www.devze.com 2023-01-28 10:37 出处:网络
I use getResources().getConfiguration().hardKeyboardHidden t开发者_高级运维o detect if a device has a sliding keyboard drawer open (like on the G1).

I use getResources().getConfiguration().hardKeyboardHidden t开发者_高级运维o detect if a device has a sliding keyboard drawer open (like on the G1).

Now I have a Droid Pro, and it returns 1 always, so my app thinks it has a slider open.

Is there a way I can tell the device has a keyboard, and that it's ALWAYS open ?

TIA


I'm facing a similar issue, in CM, Phone application.

To date the Phone app behave like that:

  • If keyboard is Open, the screen will stay On even during a call. Proximity sensor won't be used to query if the device is on the hear or not:

    mIsHardKeyboardOpen being true leads to screenOnImmediately being set to true also:

               boolean screenOnImmediately = (isHeadsetPlugged()
                        || PhoneUtils.isSpeakerOn(this)
                        || ((mBtHandsfree != null) && mBtHandsfree.isAudioOn())
                        || mIsHardKeyboardOpen);
    

In the case of a fixed physical keyboard, it is always open (not slidding, and in the open position).

If I keep the actual code, the Phone app will never off the screen using proximity sensor.

If there's no way of guessing if the keyboard is fixed or slidding, I'll define a new system property ro.product.has_fixed_keyboard, and set it to 1 in my device, then change the code of Phone app to bypass the KeyboardOpen checking in case ro.product.has_fixed_keyboard is 1.

EDIT (11/23/2012): here is the implementation, merged into CM7: http://review.cyanogenmod.org/#/c/11926/


The result you are given is accurate, so I see no problem with the result that it is giving you.

Just have your application listen for configuration changes, and if it never receives a keyboard hidden status then assume it is always open.

Your application should react identically if the device is a slider and the keyboard is exposed and if the device always has the keyboard shown so I am not sure what you want to accomplish.

If you really need to tell if the keyboard is always open just add code to determine the device has a always shown keyboard by just identifying the device the use is using. If you want to support any device that has a hardware always shown keyboard then you could be lazy and ask the user and save the result. Or you could keep updating your app as you discover more devices that fit this criteria.

0

精彩评论

暂无评论...
验证码 换一张
取 消