绛斿: hiding a forcib ly opened soft keyboard...

by sdphil » Thu, 12 Nov 2009 11:29:53 GMT


Sponsored Links
 I'm basically doing what you show here.

What I mean by "forced" soft keyboard is when you hold down the menu
key.

It doesn't make it go away.  I tried using
view.getApplicationWindowToken vs. view.getWindowToken

and it did not make any difference.  so something else must be going
on...





> > >



绛斿: hiding a forcib ly opened soft keyboard...

by Dianne Hackborn » Thu, 12 Nov 2009 12:07:41 GMT


 h sorry 0 is correct here.  Are you sure the window you are passing in
actually currently has input focus? Fwiw, the framework code that
hides/shows the IME from long pressing on menu does basically the same thing
-- shows with the force flag, hides with 0 flags.

2009/11/11 sdphil <phil.pellouch...@gmail.com>

> > > >


Sponsored Links


绛斿: hiding a forcib ly opened soft keyboard...

by sdphil » Thu, 12 Nov 2009 14:36:44 GMT


 'm not sure about the view, but i'm sure the top most window is there
-- and i thought that's what --

getApplicationWindowToken --
Retrieve a unique token identifying the top-level "real" window of the
window that this view is attached to.

was supposed to take care.

Can I do a view.requestFocus() before calling this to ensure it has
focus?

On Nov 11, 8:06 pm, Dianne Hackborn <hack...@android.com> wrote:
> > > > >



Other Threads

1. Camera rotation problem on Android OpenGL ES

I have written a first person camera class for android.

The class is really simple , the camera object has its three axes X,Y
and Z
And I am using an Eye and a LookAt point to create the ModelView
matrix, which seems to be working fine.

The problem comes when i try to rotate around the Y-axis ( or X-
axis) .
I am simply creating a rotation matrix around the Y-axis and
multiplying it with the Eye vector.
But after 45-degree my camera starts rotating in reverse direction.

I have taken measurements after every 1-degree rotation and it seems
that my Eye-vector although it rotates but it lags behind.
e.g. if i rotate 20-degrees it has rotated only 12.
But after 45-degree things really start to go out of control.

I though it must be a problem with the Rotation matrices that i create
to rotate the Eye-vector.
So i made two implementations, one using the functions in
android.opengl.Matrix package (e.g. setRoatetM)
and doing everything from scratch using (sin, cos ) functions.
But surprisingly the results are same.

Below is the code from the Camera class.
The three main functions involved in rotations are :
1. applyModelViewTransform( ) // this is where I use the setLookAtM()
2. yaw( ) // rotating LookAt around y-axis of the camera
3. reNormalizeAxes() // recalculating all the camera's Axes

-------------------------------------------------

package com.droidnova.android.games.vortex;

import javax.microedition.khronos.opengles.GL10;

import android.opengl.Matrix;
import android.util.Log;

import com.surrealtech.math.util.Vector3;

public class Camera7 implements ICamera {

        Vector3 _vecUp = new Vector3(0,1,0); // global UP vector
        Vector3 _vecLookAt;             // look-at point vector
        Vector3 _vecEye;                // eye position
        Vector3 _X;                     // camera's x-axis
        Vector3 _Y;                     // camera's y-axis
        Vector3 _Z;                     // camera's z-axis

        float[] _matModelView = new float[16];
        float[] _matRotation = new float[16];
        float[] _vecTemp4 = new float[4];       // a temporary vector to store
results
        float angleYaw = 0;
        float anglePitch = 0;

        public Camera7() {
                // Initialize all vectors
                _vecEye    = new Vector3(0.0f, 1.0f,  2.0f);    // eye
                _vecLookAt = new Vector3(0.0f, 1.0f,  1.0f);    // look-at

//              // normalize all axis
//              reNormalizeAxes();
//
//              // calculate the mdoel view matrix
//              Matrix.setLookAtM (_matModelView, 0,
//                                                      _vecEye.x, _vecEye.y, 
_vecEye.z,
//                                                      _vecLookAt.x, 
_vecLookAt.y, _vecLookAt.z,
//                                                      _Y.x, _Y.y, _Y.z);
        }


        private void reNormalizeAxes(){
                _Z = Vector3.Subtract(_vecLookAt, _vecEye);
                _Z.Normalise();

                // calculate the right vector from
                _X = Vector3.Cross(_Z, _vecUp); // this should give the +ve 
X-axis
of camera from right-hand rule
                _X.Normalise();

                _Y = Vector3.Cross(_X, _Z);
                _Y.Normalise();
        }


        @Override
        public void applyModelViewTransform(GL10 gl) {
                // normalize all axis
                reNormalizeAxes();

                // calculate the mdoel view matrix
                Matrix.setLookAtM (_matModelView, 0,
                                                        _vecEye.x, _vecEye.y, 
_vecEye.z,
                                                        _vecLookAt.x, 
_vecLookAt.y, _vecLookAt.z,
                                                        _Y.x, _Y.y, _Y.z);

                // push the new openGL matrix
                gl.glMatrixMode(gl.GL_MODELVIEW);
                gl.glLoadMatrixf(_matModelView, 0);
        }

        @Override
        public void pitch(GL10 gl, float angle) {
                // get the rotation matrix around X-Axis
                Matrix.setIdentityM(_matRotation, 0);
                Matrix.setRotateM(_matRotation, 0, (float)Math.toDegrees(angle),
_X.x, _X.y, _X.z);

                // rotate the LookAt point
                Matrix.multiplyMV(_vecTemp4, 0, _matRotation, 0,
_vecLookAt.getFloat(), 0);
                _vecLookAt.setFloat(_vecTemp4);

                // apply transform
                this.applyModelViewTransform(gl);

        }

        @Override
        public void yaw(GL10 gl, float angle) {
                // initialise the lookat vector back to the start point
                _vecLookAt = new Vector3(0.0f, 1.0f,  1.0f);    // look-at
                this.angleYaw += angle;

                // get the rotation matrix around Y-Axis
                Matrix.setIdentityM(_matRotation, 0);
//              Matrix.setRotateM(_matRotation, 0, (float)Math.toDegrees(angle),
_Y.x, _Y.y, _Y.z);
                Matrix.setRotateM(_matRotation, 0,
(float)Math.toDegrees(this.angleYaw), _Y.x, _Y.y, _Y.z);

                // rotate the LookAt point
                Matrix.multiplyMV(_vecTemp4, 0, _matRotation, 0,
_vecLookAt.getFloat(), 0);
//              _vecLookAt.setFloat(_vecTemp4);
                _vecLookAt.setFloatHomogenous(_vecTemp4);

                // apply transform
                this.applyModelViewTransform(gl);

                Log.v(""+this, "angleYaw:"+angleYaw +" , in-degrees:"+
Math.toDegrees(angleYaw));
                Log.v(""+this, "angle:"+angle +" , in-degrees:"+
Math.toDegrees(angle));
                Log.v(""+this, "angle:"+angle +" , X-axis:"+ _X.x+","+ _X.y+","+
_X.z);
                Log.v(""+this, "angle:"+angle +" , Y-axis:"+ _Y.x+","+ _Y.y+","+
_Y.z);
                Log.v(""+this, "angle:"+angle +" , Z-axis:"+ _Z.x+","+ _Z.y+","+
_Z.z);
                Log.v(""+this, "angle:"+angle +" , _vecLookAt:"+ 
_vecLookAt.x+","+
_vecLookAt.y+","+ _vecLookAt.z);
        }

        @Override
        public void translateZ(GL10 gl, float dist) {
                // translate the eye and look-at point
                Vector3 temp = Vector3.multiply(_Z, dist);
                _vecEye = Vector3.Add(_vecEye, temp);
                _vecLookAt = Vector3.Add(_vecLookAt, temp);

                // apply the transform
                this.applyModelViewTransform(gl);
        }

}




-- 

2. NFC: Tag Emaulation

Hi Everyone,
In the android.nfc package documentation I read:

  Provides access to Near Field Communication (NFC) functionality, allowing 
applications 
  to read NDEF message in NFC tags. A "tag" may actually be another device that 
appears 
  as a tag. 

Question: Can tags be emulated with the Android NFC API, and if yes, how?

Dominik

-- 

3. showDialog's BadTokenException + BACK button

4. Problem authenticating Restlet webservice via Google Accounts

5. OpenGL view background and buttons

6. Application Back button not working

7. Setting image to fill tab.