[DEV] basic wallpaper will work

This commit is contained in:
Edouard DUPIN 2013-08-26 22:07:12 +02:00
parent 010586a0fa
commit 7cb1648d6e
8 changed files with 565 additions and 523 deletions

2
build

@ -1 +1 @@
Subproject commit d1fe3fe6c3a3e128dc5aa5515980f0367a8c5ab4 Subproject commit 6db445d6ee504d00c63955b33ca5137296052cc1

View File

@ -26,7 +26,7 @@ public class Ewol {
} }
public static native <T extends Activity & EwolCallback> void setJavaVirtualMachineStart(T activityInstance); public static native <T extends Activity & EwolCallback> void setJavaVirtualMachineStart(T activityInstance);
public static native <T extends Engine & EwolCallback> void setJavaVirtualMachineStartWallpaperEngine(T serviceInstance); public static native <T extends WallpaperService & EwolCallback> void setJavaVirtualMachineStartWallpaperEngine(T serviceInstance);
public static native void setJavaVirtualMachineStop(); public static native void setJavaVirtualMachineStop();
public static native void paramSetArchiveDir(int mode, String myString); public static native void paramSetArchiveDir(int mode, String myString);

View File

@ -104,7 +104,7 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
// create bsurface system // create bsurface system
mGLView = new EwolSurfaceViewGL(this, 2); mGLView = new EwolSurfaceViewGL(this);
// create element audio ... // create element audio ...
mStreams = new EwolAudioTask(); mStreams = new EwolAudioTask();

View File

@ -9,19 +9,18 @@
package org.ewol; package org.ewol;
public interface EwolConstants { public interface EwolConstants {
public static final int NATIVE_AUDIO_BUFFER_SIZE = 512; public static final int NATIVE_AUDIO_BUFFER_SIZE = 512;
public static final int EWOL_SYSTEM_KEY_VOLUME_UP = 1; public static final int EWOL_SYSTEM_KEY_VOLUME_UP = 1;
public static final int EWOL_SYSTEM_KEY_VOLUME_DOWN = 2; public static final int EWOL_SYSTEM_KEY_VOLUME_DOWN = 2;
public static final int EWOL_SYSTEM_KEY_MENU = 3; public static final int EWOL_SYSTEM_KEY_MENU = 3;
public static final int EWOL_SYSTEM_KEY_CAMERA = 4; public static final int EWOL_SYSTEM_KEY_CAMERA = 4;
public static final int EWOL_SYSTEM_KEY_HOME = 5; public static final int EWOL_SYSTEM_KEY_HOME = 5;
public static final int EWOL_SYSTEM_KEY_POWER = 6; public static final int EWOL_SYSTEM_KEY_POWER = 6;
// the back key is wrapped in the <esc> key to simplify PC validation ... // the back key is wrapped in the <esc> key to simplify PC validation ...
public static final int EWOL_SYSTEM_KEY_BACK = 0x1B; public static final int EWOL_SYSTEM_KEY_BACK = 0x1B;
public static final int EWOL_SYSTEM_KEY_DEL = 0x08; public static final int EWOL_SYSTEM_KEY_DEL = 0x08;
public static final int EWOL_ORIENTATION_AUTO = 0;
public static final int EWOL_ORIENTATION_LANDSCAPE = 1;
public static final int EWOL_ORIENTATION_PORTRAIT = 2;
public static final int EWOL_ORIENTATION_AUTO = 0;
public static final int EWOL_ORIENTATION_LANDSCAPE = 1;
public static final int EWOL_ORIENTATION_PORTRAIT = 2;
} }

View File

@ -27,275 +27,272 @@ import static org.ewol.Ewol.EWOL;
* *
*/ */
public class EwolSurfaceViewGL extends GLSurfaceView implements EwolConstants { public class EwolSurfaceViewGL extends GLSurfaceView implements EwolConstants {
public static final int SDK_VERSION = android.os.Build.VERSION.SDK_INT; public static final int SDK_VERSION = android.os.Build.VERSION.SDK_INT;
private EwolRendererGL m_ewolDrawer = null; private EwolRendererGL m_ewolDrawer = null;
private boolean inputDown1 = false; private boolean inputDown1 = false;
private boolean inputDown2 = false; private boolean inputDown2 = false;
private boolean inputDown3 = false; private boolean inputDown3 = false;
public EwolSurfaceViewGL(Context context, int openGlVersion) { public EwolSurfaceViewGL(Context context) {
// super must be first statement in constructor // super must be first statement in constructor
super(context); super(context);
/* /*
List of the Android API : List of the Android API :
Android 4.1, 4.1.1 16 JELLY_BEAN Platform Highlights Android 4.1, 4.1.1 16 JELLY_BEAN Platform Highlights
Android 4.0.3, 4.0.4 15 ICE_CREAM_SANDWICH_MR1 Platform Highlights Android 4.0.3, 4.0.4 15 ICE_CREAM_SANDWICH_MR1 Platform Highlights
Android 4.0, 4.0.1, 4.0.2 14 ICE_CREAM_SANDWICH Android 4.0, 4.0.1, 4.0.2 14 ICE_CREAM_SANDWICH
Android 3.2 13 HONEYCOMB_MR2 Android 3.2 13 HONEYCOMB_MR2
Android 3.1.x 12 HONEYCOMB_MR1 Platform Highlights Android 3.1.x 12 HONEYCOMB_MR1 Platform Highlights
Android 3.0.x 11 HONEYCOMB Platform Highlights Android 3.0.x 11 HONEYCOMB Platform Highlights
Android 2.3.4 Android 2.3.4
Android 2.3.3 10 GINGERBREAD_MR1 Platform Highlights Android 2.3.3 10 GINGERBREAD_MR1 Platform Highlights
Android 2.3.2 Android 2.3.2
Android 2.3.1 Android 2.3.1
Android 2.3 9 GINGERBREAD Android 2.3 9 GINGERBREAD
Android 2.2.x 8 FROYO Platform Highlights Android 2.2.x 8 FROYO Platform Highlights
Android 2.1.x 7 ECLAIR_MR1 Platform Highlights Android 2.1.x 7 ECLAIR_MR1 Platform Highlights
Android 2.0.1 6 ECLAIR_0_1 Android 2.0.1 6 ECLAIR_0_1
Android 2.0 5 ECLAIR Android 2.0 5 ECLAIR
Android 1.6 4 DONUT Platform Highlights Android 1.6 4 DONUT Platform Highlights
Android 1.5 3 CUPCAKE Platform Highlights Android 1.5 3 CUPCAKE Platform Highlights
Android 1.1 2 BASE_1_1 Android 1.1 2 BASE_1_1
Android 1.0 1 BASE Android 1.0 1 BASE
*/ */
// Create an OpenGL ES 2.0 context // Create an OpenGL ES 2.0 context
if (openGlVersion == 2) { setEGLContextClientVersion(2);
setEGLContextClientVersion(2);
// je n'ai pas compris ...
m_ewolDrawer = new EwolRendererGL();
setRenderer(m_ewolDrawer);
// Can get the focus ==> get keyboard from JAVA :
setFocusable(true);
setFocusableInTouchMode(true);
} }
// je n'ai pas compris ... public boolean onTouchEvent(final MotionEvent event) {
m_ewolDrawer = new EwolRendererGL(); // Wrapper on input events :
setRenderer(m_ewolDrawer);
// Can get the focus ==> get keyboard from JAVA : int tmpActionType = event.getAction();
setFocusable(true);
setFocusableInTouchMode(true);
}
public boolean onTouchEvent(final MotionEvent event) { if (tmpActionType == MotionEvent.ACTION_MOVE) {
// Wrapper on input events : final int pointerCount = event.getPointerCount();
for (int p = 0; p < pointerCount; p++) {
int tmpActionType = event.getAction(); if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(p);
if (tmpActionType == MotionEvent.ACTION_MOVE) { if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
final int pointerCount = event.getPointerCount(); || typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
for (int p = 0; p < pointerCount; p++) { EWOL.inputEventMotion(event.getPointerId(p), (float)event.getX(p), (float)event.getY(p));
if (SDK_VERSION>=14) { } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
final int typeOfPointer = event.getToolType(p); EWOL.mouseEventMotion(event.getPointerId(p), (float)event.getX(p), (float)event.getY(p));
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER }
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) { } else {
EWOL.inputEventMotion(event.getPointerId(p), (float)event.getX(p), (float)event.getY(p)); EWOL.inputEventMotion(event.getPointerId(p), (float)event.getX(p), (float)event.getY(p));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { }
EWOL.mouseEventMotion(event.getPointerId(p), (float)event.getX(p), (float)event.getY(p)); }
} } else if( tmpActionType == MotionEvent.ACTION_POINTER_1_DOWN
} else { || tmpActionType == MotionEvent.ACTION_DOWN) {
EWOL.inputEventMotion(event.getPointerId(p), (float)event.getX(p), (float)event.getY(p)); if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(0), true, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(0), true, (float)event.getX(0), (float)event.getY(0));
}
} else {
EWOL.inputEventState(event.getPointerId(0), true, (float)event.getX(0), (float)event.getY(0));
}
inputDown1 = true;
} else if(tmpActionType == MotionEvent.ACTION_POINTER_1_UP) {
if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
} else {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
inputDown1 = false;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_2_DOWN) {
if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(1);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(1), true, (float)event.getX(1), (float)event.getY(1));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(1), true, (float)event.getX(1), (float)event.getY(1));
}
} else {
EWOL.inputEventState(event.getPointerId(1), true, (float)event.getX(1), (float)event.getY(1));
}
inputDown2 = true;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_2_UP) {
if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(1);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(1), false, (float)event.getX(1), (float)event.getY(1));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(1), false, (float)event.getX(1), (float)event.getY(1));
}
} else {
EWOL.inputEventState(event.getPointerId(1), false, (float)event.getX(1), (float)event.getY(1));
}
inputDown2 = false;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_3_DOWN) {
if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(2);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(2), true, (float)event.getX(2), (float)event.getY(2));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(2), true, (float)event.getX(2), (float)event.getY(2));
}
} else {
EWOL.inputEventState(event.getPointerId(2), true, (float)event.getX(2), (float)event.getY(2));
}
inputDown3 = true;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_3_UP) {
if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(2);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(2), false, (float)event.getX(2), (float)event.getY(2));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(2), false, (float)event.getX(2), (float)event.getY(2));
}
} else {
EWOL.inputEventState(event.getPointerId(2), false, (float)event.getX(2), (float)event.getY(2));
}
inputDown3 = false;
} else if(tmpActionType == MotionEvent.ACTION_UP){
if (inputDown1) {
if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
} else {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
inputDown1 = false;
} else if (inputDown2) {
if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
} else {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
inputDown2 = false;
} else {
if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
} else {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
inputDown3 = false;
}
} }
} return true;
} else if( tmpActionType == MotionEvent.ACTION_POINTER_1_DOWN
|| tmpActionType == MotionEvent.ACTION_DOWN) {
if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(0), true, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(0), true, (float)event.getX(0), (float)event.getY(0));
}
} else {
EWOL.inputEventState(event.getPointerId(0), true, (float)event.getX(0), (float)event.getY(0));
}
inputDown1 = true;
} else if(tmpActionType == MotionEvent.ACTION_POINTER_1_UP) {
if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
} else {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
inputDown1 = false;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_2_DOWN) {
if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(1);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(1), true, (float)event.getX(1), (float)event.getY(1));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(1), true, (float)event.getX(1), (float)event.getY(1));
}
} else {
EWOL.inputEventState(event.getPointerId(1), true, (float)event.getX(1), (float)event.getY(1));
}
inputDown2 = true;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_2_UP) {
if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(1);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(1), false, (float)event.getX(1), (float)event.getY(1));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(1), false, (float)event.getX(1), (float)event.getY(1));
}
} else {
EWOL.inputEventState(event.getPointerId(1), false, (float)event.getX(1), (float)event.getY(1));
}
inputDown2 = false;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_3_DOWN) {
if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(2);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(2), true, (float)event.getX(2), (float)event.getY(2));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(2), true, (float)event.getX(2), (float)event.getY(2));
}
} else {
EWOL.inputEventState(event.getPointerId(2), true, (float)event.getX(2), (float)event.getY(2));
}
inputDown3 = true;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_3_UP) {
if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(2);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(2), false, (float)event.getX(2), (float)event.getY(2));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(2), false, (float)event.getX(2), (float)event.getY(2));
}
} else {
EWOL.inputEventState(event.getPointerId(2), false, (float)event.getX(2), (float)event.getY(2));
}
inputDown3 = false;
} else if(tmpActionType == MotionEvent.ACTION_UP){
if (inputDown1) {
if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
} else {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
inputDown1 = false;
} else if (inputDown2) {
if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
} else {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
inputDown2 = false;
} else {
if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
} else {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
inputDown3 = false;
}
} }
return true;
}
private boolean keyboardEvent(int keyCode, KeyEvent event, boolean isDown) private boolean keyboardEvent(int keyCode, KeyEvent event, boolean isDown)
{ {
int actionDone = event.getAction(); int actionDone = event.getAction();
switch(keyCode) switch(keyCode)
{ {
case KeyEvent.KEYCODE_VOLUME_DOWN: case KeyEvent.KEYCODE_VOLUME_DOWN:
EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_VOLUME_DOWN, isDown); EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_VOLUME_DOWN, isDown);
return false;
case KeyEvent.KEYCODE_VOLUME_UP:
EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_VOLUME_UP, isDown);
return false;
case KeyEvent.KEYCODE_MENU:
EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_MENU, isDown);
return false;
case KeyEvent.KEYCODE_CAMERA:
EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_CAMERA, isDown);
return false;
case KeyEvent.KEYCODE_HOME:
EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_HOME, isDown);
return false;
case KeyEvent.KEYCODE_POWER:
EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_POWER, isDown);
return false;
case KeyEvent.KEYCODE_BACK:
// the back key is wrapped in the <esc> key to simplify PC validation ...
EWOL.keyboardEventKey(EWOL_SYSTEM_KEY_BACK, isDown);
return false;
case KeyEvent.KEYCODE_DEL:
EWOL.keyboardEventKey(EWOL_SYSTEM_KEY_DEL, isDown);
return true;
case KeyEvent.KEYCODE_ALT_LEFT:
// TODO : ...
break;
case KeyEvent.KEYCODE_SHIFT_LEFT:
// TODO : ...
break;
case KeyEvent.KEYCODE_ENTER:
// TODO : ...
break;
// Joystick event :
case KeyEvent.KEYCODE_DPAD_UP:
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
break;
case KeyEvent.KEYCODE_DPAD_LEFT:
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
break;
case KeyEvent.KEYCODE_DPAD_CENTER:
break;
default:
break;
}
// key wrapping :
if( (actionDone == KeyEvent.ACTION_DOWN)
|| (actionDone == KeyEvent.ACTION_MULTIPLE)
|| (actionDone == KeyEvent.ACTION_UP))
{
// convert the key in UniChar to prevent errors ...
int uchar = event.getUnicodeChar();
// pb on the return methode ... in java it is like windows ...
if (uchar == '\r') {
uchar = '\n';
}
// send it to ewol ...
EWOL.keyboardEventKey(uchar, isDown);
return true;
}
return false; return false;
case KeyEvent.KEYCODE_VOLUME_UP: }
EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_VOLUME_UP, isDown);
return false;
case KeyEvent.KEYCODE_MENU:
EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_MENU, isDown);
return false;
case KeyEvent.KEYCODE_CAMERA:
EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_CAMERA, isDown);
return false;
case KeyEvent.KEYCODE_HOME:
EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_HOME, isDown);
return false;
case KeyEvent.KEYCODE_POWER:
EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_POWER, isDown);
return false;
case KeyEvent.KEYCODE_BACK:
// the back key is wrapped in the <esc> key to simplify PC validation ...
EWOL.keyboardEventKey(EWOL_SYSTEM_KEY_BACK, isDown);
return false;
case KeyEvent.KEYCODE_DEL:
EWOL.keyboardEventKey(EWOL_SYSTEM_KEY_DEL, isDown);
return true;
case KeyEvent.KEYCODE_ALT_LEFT:
// TODO : ...
break;
case KeyEvent.KEYCODE_SHIFT_LEFT:
// TODO : ...
break;
case KeyEvent.KEYCODE_ENTER:
// TODO : ...
break;
// Joystick event :
case KeyEvent.KEYCODE_DPAD_UP:
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
break;
case KeyEvent.KEYCODE_DPAD_LEFT:
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
break;
case KeyEvent.KEYCODE_DPAD_CENTER:
break;
default:
break;
}
// key wrapping :
if( (actionDone == KeyEvent.ACTION_DOWN)
|| (actionDone == KeyEvent.ACTION_MULTIPLE)
|| (actionDone == KeyEvent.ACTION_UP))
{
// convert the key in UniChar to prevent errors ...
int uchar = event.getUnicodeChar();
// pb on the return methode ... in java it is like windows ...
if (uchar == '\r') {
uchar = '\n';
}
// send it to ewol ...
EWOL.keyboardEventKey(uchar, isDown);
return true;
}
return false;
}
public boolean onKeyDown(int keyCode, KeyEvent event) public boolean onKeyDown(int keyCode, KeyEvent event)
{ {
return keyboardEvent(keyCode, event, true); return keyboardEvent(keyCode, event, true);
} }
public boolean onKeyUp(int keyCode, KeyEvent event) public boolean onKeyUp(int keyCode, KeyEvent event)
{ {
return keyboardEvent(keyCode, event, false); return keyboardEvent(keyCode, event, false);
} }
} }

View File

@ -1,231 +1,192 @@
/** /**
* @author Edouard DUPIN, Kevin BILLONNEAU * @author Edouard DUPIN
* *
* @copyright 2011, Edouard DUPIN, all right reserved * @copyright 2011, Edouard DUPIN, all right reserved
* *
* @license BSD v3 (see license file) * @license BSD v3 (see license file)
*/ */
package org.ewol; package org.ewol;
import android.service.wallpaper.WallpaperService; import android.app.ActivityManager;
//import android.app.Activity;
import android.content.Context;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
// For No Title :
import android.view.Window;
// For the full screen :
import android.view.WindowManager;
// for the keyboard event :
import android.view.inputmethod.InputMethodManager;
import java.io.File;
import android.content.Context;
import android.content.res.Configuration;
// For the getting apk name :
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.content.pm.ConfigurationInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.AssetFileDescriptor; import android.content.Context;
import android.content.res.AssetManager; import android.opengl.GLSurfaceView;
import android.util.DisplayMetrics; import android.opengl.GLSurfaceView.Renderer;
import android.os.Build;
import android.service.wallpaper.WallpaperService;
import android.util.Log;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import org.ewol.EwolSurfaceViewGL;
import android.view.MotionEvent;
import java.io.IOException;
import static org.ewol.Ewol.EWOL; import static org.ewol.Ewol.EWOL;
/** public abstract class EwolWallpaper extends WallpaperService implements EwolCallback, EwolConstants
* @brief Class :
*
*/
public abstract class EwolWallpaper extends WallpaperService
{ {
private TestPatternEngine tmpEngine; private GLEngine mGLView;
static { static {
System.loadLibrary("ewol"); System.loadLibrary("ewol");
} }
@Override public void onCreate() protected void initApkPath(String org, String vendor, String project) {
{ StringBuilder sb = new StringBuilder();
super.onCreate(); sb.append(org).append(".");
} sb.append(vendor).append(".");
sb.append(project);
@Override public void onDestroy() String apkFilePath = null;
{ ApplicationInfo appInfo = null;
super.onDestroy(); PackageManager packMgmr = getPackageManager();
} try {
appInfo = packMgmr.getApplicationInfo(sb.toString(), 0);
@Override public Engine onCreateEngine() } catch (NameNotFoundException e) {
{ e.printStackTrace();
tmpEngine = new TestPatternEngine(); throw new RuntimeException("Unable to locate assets, aborting...");
return tmpEngine;
}
protected void initApkPath(String org, String vendor, String project)
{
tmpEngine.initApkPath(org, vendor, project);
}
class TestPatternEngine extends Engine implements EwolCallback, EwolConstants // implements SharedPreferences.OnSharedPreferenceChangeListener
{
private EwolSurfaceViewGL mGLView;
public void initApkPath(String org, String vendor, String project) {
StringBuilder sb = new StringBuilder();
sb.append(org).append(".");
sb.append(vendor).append(".");
sb.append(project);
String apkFilePath = null;
ApplicationInfo appInfo = null;
PackageManager packMgmr = getPackageManager();
try {
appInfo = packMgmr.getApplicationInfo(sb.toString(), 0);
} catch (NameNotFoundException e) {
e.printStackTrace();
throw new RuntimeException("Unable to locate assets, aborting...");
}
apkFilePath = appInfo.sourceDir;
Ewol.paramSetArchiveDir(0, apkFilePath);
} }
apkFilePath = appInfo.sourceDir;
Ewol.paramSetArchiveDir(0, apkFilePath);
}
@Override public Engine onCreateEngine() {
// set the java evironement in the C sources :
Ewol.setJavaVirtualMachineStartWallpaperEngine(this);
// Load the application directory
Ewol.paramSetArchiveDir(1, getFilesDir().toString());
Ewol.paramSetArchiveDir(2, getCacheDir().toString());
// to enable extarnal storage: add in the manifest the restriction needed ...
//packageManager.checkPermission("android.permission.READ_SMS", myPackage) == PERMISSION_GRANTED;
//Ewol.paramSetArchiveDir(3, getExternalCacheDir().toString());
//! DisplayMetrics metrics = new DisplayMetrics();
//! getWindowManager().getDefaultDisplay().getMetrics(metrics);
//! EWOL.displayPropertyMetrics(metrics.xdpi, metrics.ydpi);
// call C init ...
EWOL.onCreate();
// create bsurface system
mGLView = new GLEngine();
return mGLView;
}
public class GLEngine extends Engine
{
class WallpaperGLSurfaceView extends EwolSurfaceViewGL
{
private static final String TAG = "WallpaperGLSurfaceView";
WallpaperGLSurfaceView(Context context)
{
super(context);
Log.d(TAG, "WallpaperGLSurfaceView(" + context + ")");
}
@Override
public SurfaceHolder getHolder()
{
Log.d(TAG, "getHolder(): returning " + getSurfaceHolder());
return getSurfaceHolder();
}
public void onDestroy()
{
Log.d(TAG, "onDestroy()");
super.onDetachedFromWindow();
}
}
private static final String TAG = "GLEngine";
private WallpaperGLSurfaceView glSurfaceView;
@Override public void onCreate(SurfaceHolder surfaceHolder) @Override public void onCreate(SurfaceHolder surfaceHolder)
{ {
Log.d(TAG, "onCreate(" + surfaceHolder + ")");
super.onCreate(surfaceHolder); super.onCreate(surfaceHolder);
// set the java evironement in the C sources : glSurfaceView = new WallpaperGLSurfaceView(EwolWallpaper.this);
Ewol.setJavaVirtualMachineStartWallpaperEngine(this);
// Load the application directory // Check if the system supports OpenGL ES 2.0.
Ewol.paramSetArchiveDir(1, getFilesDir().toString()); final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
Ewol.paramSetArchiveDir(2, getCacheDir().toString()); final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
// to enable extarnal storage: add in the manifest the restriction needed ... final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
//packageManager.checkPermission("android.permission.READ_SMS", myPackage) == PERMISSION_GRANTED;
//Ewol.paramSetArchiveDir(3, getExternalCacheDir().toString());
DisplayMetrics metrics = new DisplayMetrics(); if (false==supportsEs2) {
//!getWindowManager().getDefaultDisplay().getMetrics(metrics); Log.d("LiveWallpaper", "does not support board with only open GL ES 1");
//!EWOL.displayPropertyMetrics(metrics.xdpi, metrics.ydpi); return;
}
// Request an OpenGL ES 2.0 compatible context.
//setEGLContextClientVersion(2);
// call C init ... // On Honeycomb+ devices, this improves the performance when
EWOL.onCreate(); // leaving and resuming the live wallpaper.
setPreserveEGLContextOnPause(true);
// Remove the title of the current display :
//!requestWindowFeature(Window.FEATURE_NO_TITLE);
// set full screen Mode :
//!getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
// display keyboard:
//getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
// hide keyboard :
//!getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
// create bsurface system
mGLView = new EwolSurfaceViewGL(this, 2);
setContentView(mGLView);
} }
@Override public void onStart() @Override public void onTouchEvent(MotionEvent event)
{ {
super.onStart(); glSurfaceView.onTouchEvent(event);
// call C
EWOL.onStart();
} }
@Override public void onRestart() @Override public void onVisibilityChanged(boolean visible)
{ {
super.onRestart(); Log.d(TAG, "onVisibilityChanged(" + visible + ")");
// call C super.onVisibilityChanged(visible);
EWOL.onReStart(); if (true==visible) {
glSurfaceView.onResume();
// call C
EWOL.onResume();
} else {
glSurfaceView.onPause();
// call C
EWOL.onPause();
}
} }
@Override public void onResume()
{
super.onResume();
mGLView.onResume();
// call C
EWOL.onResume();
}
@Override public void onPause()
{
super.onPause();
mGLView.onPause();
// call C
EWOL.onPause();
}
@Override public void onStop()
{
super.onStop();
// call C
EWOL.onStop();
}
@Override public void onDestroy() @Override public void onDestroy()
{ {
Log.d(TAG, "onDestroy()");
super.onDestroy(); super.onDestroy();
// call C // call C
EWOL.onStop();
EWOL.onDestroy(); EWOL.onDestroy();
// Remove the java Virtual machine pointer form the C code glSurfaceView.onDestroy();
Ewol.setJavaVirtualMachineStop();
} }
@Override protected void finalize() throws Throwable protected void setPreserveEGLContextOnPause(boolean preserve)
{ {
super.finalize(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// cleanup your object here Log.d(TAG, "setPreserveEGLContextOnPause(" + preserve + ")");
} glSurfaceView.setPreserveEGLContextOnPause(preserve);
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
}
public void keyboardUpdate(boolean show)
{
final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if(show) {
//EWOL.touchEvent();
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
} else {
imm.toggleSoftInput(0 ,InputMethodManager.HIDE_IMPLICIT_ONLY + InputMethodManager.HIDE_NOT_ALWAYS);
//imm.hideSoftInputFromWindow(view.getWindowToken(),0);
} }
} }
public void eventNotifier(String[] args) protected void setEGLContextClientVersion(int version)
{ {
// just for the test ... Log.d(TAG, "setEGLContextClientVersion(" + version + ")");
EWOL.touchEvent(); glSurfaceView.setEGLContextClientVersion(version);
} }
}
public void keyboardUpdate(boolean show)
{
// never display keyboard on wallpaer...
}
public void eventNotifier(String[] args)
{
// just for the test ...
EWOL.touchEvent();
}
public void orientationUpdate(int screenMode)
{
public void orientationUpdate(int screenMode)
{
/*
if (screenMode == EWOL_ORIENTATION_LANDSCAPE) {
//Force landscape
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else if (screenMode == EWOL_ORIENTATION_PORTRAIT) {
//Force portrait
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} else {
//Force auto Rotation
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
}
*/
}
} }
} }

View File

@ -1,7 +1,17 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
package org.ewol; package org.ewol;
import android.app.ActivityManager;
import android.content.pm.ApplicationInfo;
import android.content.pm.ConfigurationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.Context; import android.content.Context;
import android.opengl.GLSurfaceView; import android.opengl.GLSurfaceView;
import android.opengl.GLSurfaceView.Renderer; import android.opengl.GLSurfaceView.Renderer;
@ -9,20 +19,13 @@ import android.os.Build;
import android.service.wallpaper.WallpaperService; import android.service.wallpaper.WallpaperService;
import android.util.Log; import android.util.Log;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import org.ewol.EwolSurfaceViewGL;
//import com.learnopengles.android.util.LoggerConfig; import static org.ewol.Ewol.EWOL;
public abstract class EwolWallpaperService extends WallpaperService public abstract class EwolWallpaperService extends WallpaperService implements EwolCallback, EwolConstants
{ {
private EwolSurfaceViewGL mGLView; private GLEngine mGLView;
/*
// moi ...
@Override
public abstract Engine onCreateEngine(Context context) {
return new GLEngine(Context context);
}
*/
/*
static { static {
System.loadLibrary("ewol"); System.loadLibrary("ewol");
} }
@ -44,11 +47,38 @@ public abstract class EwolWallpaperService extends WallpaperService
apkFilePath = appInfo.sourceDir; apkFilePath = appInfo.sourceDir;
Ewol.paramSetArchiveDir(0, apkFilePath); Ewol.paramSetArchiveDir(0, apkFilePath);
} }
*/
@Override public Engine onCreateEngine() {
// set the java evironement in the C sources :
Ewol.setJavaVirtualMachineStartWallpaperEngine(this);
// Load the application directory
Ewol.paramSetArchiveDir(1, getFilesDir().toString());
Ewol.paramSetArchiveDir(2, getCacheDir().toString());
// to enable extarnal storage: add in the manifest the restriction needed ...
//packageManager.checkPermission("android.permission.READ_SMS", myPackage) == PERMISSION_GRANTED;
//Ewol.paramSetArchiveDir(3, getExternalCacheDir().toString());
//! DisplayMetrics metrics = new DisplayMetrics();
//! getWindowManager().getDefaultDisplay().getMetrics(metrics);
//! EWOL.displayPropertyMetrics(metrics.xdpi, metrics.ydpi);
// call C init ...
EWOL.onCreate();
// create bsurface system
mGLView = new GLEngine();
return mGLView;
}
public class GLEngine extends Engine public class GLEngine extends Engine
{ {
class WallpaperGLSurfaceView extends GLSurfaceView class WallpaperGLSurfaceView extends EwolSurfaceViewGL
{ {
private static final String TAG = "WallpaperGLSurfaceView"; private static final String TAG = "WallpaperGLSurfaceView";
WallpaperGLSurfaceView(Context context) WallpaperGLSurfaceView(Context context)
@ -73,15 +103,32 @@ public abstract class EwolWallpaperService extends WallpaperService
private WallpaperGLSurfaceView glSurfaceView; private WallpaperGLSurfaceView glSurfaceView;
private boolean rendererHasBeenSet; private boolean rendererHasBeenSet;
@Override @Override public void onCreate(SurfaceHolder surfaceHolder)
public void onCreate(SurfaceHolder surfaceHolder)
{ {
Log.d(TAG, "onCreate(" + surfaceHolder + ")"); Log.d(TAG, "onCreate(" + surfaceHolder + ")");
super.onCreate(surfaceHolder); super.onCreate(surfaceHolder);
glSurfaceView = new WallpaperGLSurfaceView(EwolWallpaperService.this); glSurfaceView = new WallpaperGLSurfaceView(EwolWallpaperService.this);
// Check if the system supports OpenGL ES 2.0.
final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
if (false==supportsEs2) {
Log.d("LiveWallpaper", "does not support board with only open GL ES 1");
return;
}
// Request an OpenGL ES 2.0 compatible context.
//setEGLContextClientVersion(2);
// On Honeycomb+ devices, this improves the performance when
// leaving and resuming the live wallpaper.
setPreserveEGLContextOnPause(true);
} }
@Override
public void onVisibilityChanged(boolean visible) @Override public void onVisibilityChanged(boolean visible)
{ {
Log.d(TAG, "onVisibilityChanged(" + visible + ")"); Log.d(TAG, "onVisibilityChanged(" + visible + ")");
super.onVisibilityChanged(visible); super.onVisibilityChanged(visible);
@ -93,19 +140,21 @@ public abstract class EwolWallpaperService extends WallpaperService
} }
} }
} }
@Override
public void onDestroy() @Override public void onDestroy()
{ {
Log.d(TAG, "onDestroy()"); Log.d(TAG, "onDestroy()");
super.onDestroy(); super.onDestroy();
glSurfaceView.onDestroy(); glSurfaceView.onDestroy();
} }
protected void setRenderer(Renderer renderer) protected void setRenderer(Renderer renderer)
{ {
Log.d(TAG, "setRenderer(" + renderer + ")"); Log.d(TAG, "setRenderer(" + renderer + ")");
glSurfaceView.setRenderer(renderer); glSurfaceView.setRenderer(renderer);
rendererHasBeenSet = true; rendererHasBeenSet = true;
} }
protected void setPreserveEGLContextOnPause(boolean preserve) protected void setPreserveEGLContextOnPause(boolean preserve)
{ {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
@ -113,11 +162,28 @@ public abstract class EwolWallpaperService extends WallpaperService
glSurfaceView.setPreserveEGLContextOnPause(preserve); glSurfaceView.setPreserveEGLContextOnPause(preserve);
} }
} }
protected void setEGLContextClientVersion(int version) protected void setEGLContextClientVersion(int version)
{ {
Log.d(TAG, "setEGLContextClientVersion(" + version + ")"); Log.d(TAG, "setEGLContextClientVersion(" + version + ")");
glSurfaceView.setEGLContextClientVersion(version); glSurfaceView.setEGLContextClientVersion(version);
} }
} }
public void keyboardUpdate(boolean show)
{
// never display keyboard on wallpaer...
}
public void eventNotifier(String[] args)
{
// just for the test ...
EWOL.touchEvent();
}
public void orientationUpdate(int screenMode)
{
}
} }

View File

@ -19,6 +19,13 @@
/* include auto generated file */ /* include auto generated file */
#include <ewol/renderer/os/org_ewol_EwolConstants.h> #include <ewol/renderer/os/org_ewol_EwolConstants.h>
typedef enum {
appl_unknow,
appl_application,
appl_wallpaper
} application_te;
static application_te javaApplicationType = appl_unknow;
// get a resources from the java environement : // get a resources from the java environement :
static JNIEnv* JavaVirtualMachinePointer = NULL; // the JVM static JNIEnv* JavaVirtualMachinePointer = NULL; // the JVM
static jclass javaClassEwol = 0; // main activity class (android ...) static jclass javaClassEwol = 0; // main activity class (android ...)
@ -127,23 +134,27 @@ void SendJavaOrientationUpdate(int32_t mode)
void SendJavaSetTitle(const char * dataString) void SendJavaSetTitle(const char * dataString)
{ {
EWOL_DEBUG("C->java : send message to the java : \"" << dataString << "\""); EWOL_DEBUG("C->java : send message to the java : \"" << dataString << "\"");
int status; if (javaApplicationType == appl_application) {
if(!java_attach_current_thread(&status)) { int status;
return; if(!java_attach_current_thread(&status)) {
} return;
EWOL_DEBUG("C->java : 222"); }
if (NULL == dataString) { EWOL_DEBUG("C->java : 222");
EWOL_ERROR("C->java : No data to send ..."); if (NULL == dataString) {
return; EWOL_ERROR("C->java : No data to send ...");
} return;
}
//Call java ... //Call java ...
jstring title = JavaVirtualMachinePointer->NewStringUTF(dataString); jstring title = JavaVirtualMachinePointer->NewStringUTF(dataString);
JavaVirtualMachinePointer->CallVoidMethod(javaObjectEwolCallbackAndActivity, javaMethodEwolActivitySetTitle, title); JavaVirtualMachinePointer->CallVoidMethod(javaObjectEwolCallbackAndActivity, javaMethodEwolActivitySetTitle, title);
JavaVirtualMachinePointer->DeleteLocalRef(title); JavaVirtualMachinePointer->DeleteLocalRef(title);
// manage execption : // manage execption :
java_check_exception(JavaVirtualMachinePointer); java_check_exception(JavaVirtualMachinePointer);
java_detach_current_thread(status); java_detach_current_thread(status);
} else {
EWOL_ERROR("C->java : can not set title on appliation that is not real application");
}
} }
@ -223,7 +234,11 @@ extern "C"
static void setJavaVirtualMachineStart(JNIEnv* env, jclass classBase, jobject objCallback) static void setJavaVirtualMachineStart(JNIEnv* env, jclass classBase, jobject objCallback)
{ {
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
EWOL_DEBUG("** Set JVM Pointer **"); if (javaApplicationType == appl_application) {
EWOL_DEBUG("** Set JVM Pointer (application) **");
} else {
EWOL_DEBUG("** Set JVM Pointer (LiveWallpaper) **");
}
EWOL_DEBUG("*******************************************"); EWOL_DEBUG("*******************************************");
JavaVirtualMachinePointer = env; JavaVirtualMachinePointer = env;
// get default needed all time elements : // get default needed all time elements :
@ -245,25 +260,27 @@ extern "C"
return; return;
} }
__jni_safe_init_method_id( if (javaApplicationType == appl_application) {
javaMethodEwolActivitySetTitle, __jni_safe_init_method_id(javaMethodEwolActivitySetTitle,
javaClassEwolCallbackAndActivity, javaClassEwolCallbackAndActivity,
"setTitle", "(Ljava/lang/CharSequence;)V"); "setTitle",
"(Ljava/lang/CharSequence;)V");
}
__jni_safe_init_method_id( __jni_safe_init_method_id(javaMethodEwolCallbackEventNotifier,
javaMethodEwolCallbackEventNotifier, javaClassEwolCallbackAndActivity,
javaClassEwolCallbackAndActivity, "eventNotifier",
"eventNotifier", "([Ljava/lang/String;)V"); "([Ljava/lang/String;)V");
__jni_safe_init_method_id( __jni_safe_init_method_id(javaMethodEwolCallbackKeyboardUpdate,
javaMethodEwolCallbackKeyboardUpdate, javaClassEwolCallbackAndActivity,
javaClassEwolCallbackAndActivity, "keyboardUpdate",
"keyboardUpdate", "(Z)V"); "(Z)V");
__jni_safe_init_method_id( __jni_safe_init_method_id(javaMethodEwolCallbackOrientationUpdate,
javaMethodEwolCallbackOrientationUpdate, javaClassEwolCallbackAndActivity,
javaClassEwolCallbackAndActivity, "orientationUpdate",
"orientationUpdate", "(I)V"); "(I)V");
javaObjectEwolCallbackAndActivity = env->NewGlobalRef(objCallback); javaObjectEwolCallbackAndActivity = env->NewGlobalRef(objCallback);
//javaObjectEwolCallbackAndActivity = objCallback; //javaObjectEwolCallbackAndActivity = objCallback;
@ -280,11 +297,13 @@ extern "C"
void Java_org_ewol_Ewol_setJavaVirtualMachineStart(JNIEnv* _env, jclass _classBase, jobject _objCallback) void Java_org_ewol_Ewol_setJavaVirtualMachineStart(JNIEnv* _env, jclass _classBase, jobject _objCallback)
{ {
javaApplicationType = appl_application;
setJavaVirtualMachineStart(_env, _classBase, _objCallback); setJavaVirtualMachineStart(_env, _classBase, _objCallback);
} }
void Java_org_ewol_Ewol_setJavaVirtualMachineStartWallpaperEngine(JNIEnv* _env, jclass _classBase, jobject _objCallback) void Java_org_ewol_Ewol_setJavaVirtualMachineStartWallpaperEngine(JNIEnv* _env, jclass _classBase, jobject _objCallback)
{ {
javaApplicationType = appl_wallpaper;
setJavaVirtualMachineStart(_env, _classBase, _objCallback); setJavaVirtualMachineStart(_env, _classBase, _objCallback);
} }