[DEV]@ update naming of android interface

This commit is contained in:
Edouard DUPIN 2015-07-01 21:30:27 +02:00
parent 471d51eddb
commit 210d090e23
11 changed files with 318 additions and 307 deletions

View File

@ -14,115 +14,129 @@ import android.service.wallpaper.WallpaperService.Engine;
import android.util.Log; import android.util.Log;
public class Ewol { public class Ewol {
private int instanceID = -1; // local and private instance ID private int m_instanceID = -1; // local and private instance ID
private boolean m_hardKeyboardHidden = true; private boolean m_hardKeyboardHidden = true;
public <T extends EwolCallback> Ewol(T activityInstance, int typeApplication) { public <T extends EwolCallback> Ewol(T _activityInstance, int _typeApplication) {
instanceID = -1; m_instanceID = -1;
m_hardKeyboardHidden = true; m_hardKeyboardHidden = true;
instanceID = EWsetJavaVirtualMachineStart(activityInstance, typeApplication); m_instanceID = EWsetJavaVirtualMachineStart(_activityInstance, _typeApplication);
Log.d("Ewol", "new : " + instanceID); Log.d("Ewol", "new : " + m_instanceID);
} }
public void setJavaVirtualMachineStop() { public void setJavaVirtualMachineStop() {
EWsetJavaVirtualMachineStop(instanceID); EWsetJavaVirtualMachineStop(m_instanceID);
} }
public void paramSetArchiveDir(int mode, String myString) { public void paramSetArchiveDir(int _mode, String _myString) {
EWparamSetArchiveDir(instanceID, mode, myString); EWparamSetArchiveDir(m_instanceID, _mode, _myString);
} }
public boolean getHardKeyboardHidden() { public boolean getHardKeyboardHidden() {
return m_hardKeyboardHidden; return m_hardKeyboardHidden;
} }
public void setHardKeyboardHidden(boolean val) { public void setHardKeyboardHidden(boolean _val) {
m_hardKeyboardHidden = val; m_hardKeyboardHidden = _val;
} }
// activity status // activity status
public void onCreate() { EWonCreate(instanceID); } public void onCreate() {
public void onStart() { EWonStart(instanceID); } EWonCreate(m_instanceID);
public void onReStart() { EWonReStart(instanceID); } }
public void onResume() { EWonResume(instanceID); } public void onStart() {
public void onPause() { EWonPause(instanceID); } EWonStart(m_instanceID);
public void onStop() { EWonStop(instanceID); } }
public void onDestroy() { EWonDestroy(instanceID); } public void onReStart() {
EWonReStart(m_instanceID);
}
public void onResume() {
EWonResume(m_instanceID);
}
public void onPause() {
EWonPause(m_instanceID);
}
public void onStop() {
EWonStop(m_instanceID);
}
public void onDestroy() {
EWonDestroy(m_instanceID);
}
// set display properties : // set display properties :
public void displayPropertyMetrics(float ratioX, float ratioY) { public void displayPropertyMetrics(float _ratioX, float _ratioY) {
EWdisplayPropertyMetrics(instanceID, ratioX, ratioY); EWdisplayPropertyMetrics(m_instanceID, _ratioX, _ratioY);
} }
// IO native function : // IO native function :
// Specific for the type of input : TOOL_TYPE_FINGER and TOOL_TYPE_STYLUS (work as the same) // Specific for the type of input : TOOL_TYPE_FINGER and TOOL_TYPE_STYLUS (work as the same)
public void inputEventMotion(int pointerID, float x, float y) { public void inputEventMotion(int _pointerID, float _x, float _y) {
EWinputEventMotion(instanceID, pointerID, x, y); EWinputEventMotion(m_instanceID, _pointerID, _x, _y);
} }
public void inputEventState(int pointerID, boolean isDown, float x, float y) { public void inputEventState(int _pointerID, boolean _isDown, float _x, float _y) {
EWinputEventState(instanceID, pointerID, isDown, x, y); EWinputEventState(m_instanceID, _pointerID, _isDown, _x, _y);
} }
// Specific for the type of input : TOOL_TYPE_MOUSE // Specific for the type of input : TOOL_TYPE_MOUSE
public void mouseEventMotion(int pointerID, float x, float y) { public void mouseEventMotion(int _pointerID, float _x, float _y) {
EWmouseEventMotion(instanceID, pointerID, x, y); EWmouseEventMotion(m_instanceID, _pointerID, _x, _y);
} }
public void mouseEventState(int pointerID, boolean isDown, float x, float y) { public void mouseEventState(int _pointerID, boolean _isDown, float _x, float _y) {
EWmouseEventState(instanceID, pointerID, isDown, x, y); EWmouseEventState(m_instanceID, _pointerID, _isDown, _x, _y);
} }
// other unknow event ... // other unknow event ...
public void unknowEvent(int eventID) { public void unknowEvent(int _eventID) {
EWunknowEvent(instanceID, eventID); EWunknowEvent(m_instanceID, _eventID);
} }
public void keyboardEventMove(int type, boolean isDown) { public void keyboardEventMove(int _type, boolean _isDown) {
EWkeyboardEventMove(instanceID, type, isDown); EWkeyboardEventMove(m_instanceID, _type, _isDown);
} }
public void keyboardEventKey(int uniChar, boolean isDown) { public void keyboardEventKey(int _uniChar, boolean _isDown) {
EWkeyboardEventKey(instanceID, uniChar, isDown); EWkeyboardEventKey(m_instanceID, _uniChar, _isDown);
} }
public boolean keyboardEventKeySystem(int keyVal, boolean isDown) { public boolean keyboardEventKeySystem(int _keyVal, boolean _isDown) {
return EWkeyboardEventKeySystem(instanceID, keyVal, isDown); return EWkeyboardEventKeySystem(m_instanceID, _keyVal, _isDown);
} }
// renderer Event : // renderer Event :
public void renderInit() { public void renderInit() {
EWrenderInit(instanceID); EWrenderInit(m_instanceID);
} }
public void renderResize(int w, int h) { public void renderResize(int _w, int _h) {
EWrenderResize(instanceID, w, h); EWrenderResize(m_instanceID, _w, _h);
} }
public void renderDraw() { public void renderDraw() {
EWrenderDraw(instanceID); EWrenderDraw(m_instanceID);
} }
private native <T extends EwolCallback> int EWsetJavaVirtualMachineStart(T activityInstance, int typeApplication); private native <T extends EwolCallback> int EWsetJavaVirtualMachineStart(T _activityInstance, int _typeApplication);
private native void EWsetJavaVirtualMachineStop(int instanceId); private native void EWsetJavaVirtualMachineStop(int _instanceId);
private native void EWparamSetArchiveDir(int instanceId, int mode, String myString); private native void EWparamSetArchiveDir(int _instanceId, int _mode, String _myString);
// activity status // activity status
private native void EWonCreate(int instanceId); private native void EWonCreate(int _instanceId);
private native void EWonStart(int instanceId); private native void EWonStart(int _instanceId);
private native void EWonReStart(int instanceId); private native void EWonReStart(int _instanceId);
private native void EWonResume(int instanceId); private native void EWonResume(int _instanceId);
private native void EWonPause(int instanceId); private native void EWonPause(int _instanceId);
private native void EWonStop(int instanceId); private native void EWonStop(int _instanceId);
private native void EWonDestroy(int instanceId); private native void EWonDestroy(int _instanceId);
// set display properties : // set display properties :
private native void EWdisplayPropertyMetrics(int instanceId, float ratioX, float ratioY); private native void EWdisplayPropertyMetrics(int _instanceId, float _ratioX, float _ratioY);
// IO native function : // IO native function :
// Specific for the type of input : TOOL_TYPE_FINGER and TOOL_TYPE_STYLUS (work as the same) // Specific for the type of input : TOOL_TYPE_FINGER and TOOL_TYPE_STYLUS (work as the same)
private native void EWinputEventMotion(int instanceId, int pointerID, float x, float y); private native void EWinputEventMotion(int _instanceId, int _pointerID, float _x, float _y);
private native void EWinputEventState(int instanceId, int pointerID, boolean isDown, float x, float y); private native void EWinputEventState(int _instanceId, int _pointerID, boolean _isDown, float _x, float _y);
// Specific for the type of input : TOOL_TYPE_MOUSE // Specific for the type of input : TOOL_TYPE_MOUSE
private native void EWmouseEventMotion(int instanceId, int pointerID, float x, float y); private native void EWmouseEventMotion(int _instanceId, int _pointerID, float _x, float _y);
private native void EWmouseEventState(int instanceId, int pointerID, boolean isDown, float x, float y); private native void EWmouseEventState(int _instanceId, int _pointerID, boolean _isDown, float _x, float _y);
// other unknow event ... // other unknow event ...
private native void EWunknowEvent(int instanceId, int eventID); private native void EWunknowEvent(int _instanceId, int _eventID);
private native void EWkeyboardEventMove(int instanceId, int type, boolean isDown); private native void EWkeyboardEventMove(int _instanceId, int _type, boolean _isDown);
private native void EWkeyboardEventKey(int instanceId, int uniChar, boolean isDown); private native void EWkeyboardEventKey(int _instanceId, int _uniChar, boolean _isDown);
private native boolean EWkeyboardEventKeySystem(int instanceId, int keyVal, boolean isDown); private native boolean EWkeyboardEventKeySystem(int _instanceId, int _keyVal, boolean _isDown);
// renderer Event : // renderer Event :
private native void EWrenderInit(int instanceId); private native void EWrenderInit(int _instanceId);
private native void EWrenderResize(int instanceId, int w, int h); private native void EWrenderResize(int _instanceId, int _w, int _h);
private native void EWrenderDraw(int instanceId); private native void EWrenderDraw(int _instanceId);
} }

View File

@ -57,27 +57,27 @@ import org.ewol.Ewol;
* *
*/ */
public abstract class EwolActivity extends Activity implements EwolCallback, EwolConstants { public abstract class EwolActivity extends Activity implements EwolCallback, EwolConstants {
private static Context mContext; private static Context m_context;
protected EwolSurfaceViewGL mGLView = null; protected EwolSurfaceViewGL m_glView = null;
private Ewol EWOL; private Ewol m_ewolNative;
// clipboard section // clipboard section
private String tmpClipBoard; // TODO : Remove this ==> clipboard acces does not work private String tmpClipBoard; // TODO : Remove this ==> clipboard acces does not work
public static Context getAppContext() { public static Context getAppContext() {
return EwolActivity.mContext; return EwolActivity.m_context;
} }
public EwolActivity() { public EwolActivity() {
// set the java evironement in the C sources : // set the java evironement in the C sources :
EWOL = new Ewol(this, EWOL_APPL_TYPE_ACTIVITY); m_ewolNative = new Ewol(this, EWOL_APPL_TYPE_ACTIVITY);
tmpClipBoard = ""; tmpClipBoard = "";
} }
protected void initApkPath(String org, String vendor, String project) { protected void initApkPath(String _org, String _vendor, String _project) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(org).append("."); sb.append(_org).append(".");
sb.append(vendor).append("."); sb.append(_vendor).append(".");
sb.append(project); sb.append(_project);
String apkFilePath = null; String apkFilePath = null;
ApplicationInfo appInfo = null; ApplicationInfo appInfo = null;
PackageManager packMgmr = getPackageManager(); PackageManager packMgmr = getPackageManager();
@ -88,27 +88,27 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
throw new RuntimeException("Unable to locate assets, aborting..."); throw new RuntimeException("Unable to locate assets, aborting...");
} }
apkFilePath = appInfo.sourceDir; apkFilePath = appInfo.sourceDir;
EWOL.paramSetArchiveDir(0, apkFilePath); m_ewolNative.paramSetArchiveDir(0, apkFilePath);
} }
@Override protected void onCreate(Bundle savedInstanceState) { @Override protected void onCreate(Bundle _savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(_savedInstanceState);
//setListnerToRootView(); //setListnerToRootView();
EwolActivity.mContext = getApplicationContext(); EwolActivity.m_context = getApplicationContext();
// Load the application directory // Load the application directory
EWOL.paramSetArchiveDir(1, getFilesDir().toString()); m_ewolNative.paramSetArchiveDir(1, getFilesDir().toString());
EWOL.paramSetArchiveDir(2, getCacheDir().toString()); m_ewolNative.paramSetArchiveDir(2, getCacheDir().toString());
// to enable extarnal storage: add in the manifest the restriction needed ... // to enable extarnal storage: add in the manifest the restriction needed ...
//packageManager.checkPermission("android.permission.READ_SMS", myPackage) == PERMISSION_GRANTED; //packageManager.checkPermission("android.permission.READ_SMS", myPackage) == PERMISSION_GRANTED;
//Ewol.paramSetArchiveDir(3, getExternalCacheDir().toString()); //Ewol.paramSetArchiveDir(3, getExternalCacheDir().toString());
DisplayMetrics metrics = new DisplayMetrics(); DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics); getWindowManager().getDefaultDisplay().getMetrics(metrics);
EWOL.displayPropertyMetrics(metrics.xdpi, metrics.ydpi); m_ewolNative.displayPropertyMetrics(metrics.xdpi, metrics.ydpi);
// call C init ... // call C init ...
EWOL.onCreate(); m_ewolNative.onCreate();
// Remove the title of the current display : // Remove the title of the current display :
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
@ -120,38 +120,38 @@ 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, EWOL); m_glView = new EwolSurfaceViewGL(this, m_ewolNative);
setContentView(mGLView); setContentView(m_glView);
} }
@Override protected void onStart() { @Override protected void onStart() {
Log.w("EwolActivity", "onStart (START)"); Log.w("EwolActivity", "onStart (START)");
super.onStart(); super.onStart();
EWOL.onStart(); m_ewolNative.onStart();
Log.w("EwolActivity", "onStart (STOP)"); Log.w("EwolActivity", "onStart (STOP)");
} }
@Override protected void onRestart() { @Override protected void onRestart() {
Log.w("EwolActivity", "onRestart (START)"); Log.w("EwolActivity", "onRestart (START)");
super.onRestart(); super.onRestart();
EWOL.onReStart(); m_ewolNative.onReStart();
Log.w("EwolActivity", "onRestart (STOP)"); Log.w("EwolActivity", "onRestart (STOP)");
} }
@Override protected void onResume() { @Override protected void onResume() {
Log.w("EwolActivity", "onResume (START)"); Log.w("EwolActivity", "onResume (START)");
super.onResume(); super.onResume();
mGLView.onResume(); m_glView.onResume();
EWOL.onResume(); m_ewolNative.onResume();
Log.w("EwolActivity", "onResume (STOP)"); Log.w("EwolActivity", "onResume (STOP)");
} }
@Override protected void onPause() { @Override protected void onPause() {
Log.w("EwolActivity", "onPause (START)"); Log.w("EwolActivity", "onPause (START)");
super.onPause(); super.onPause();
mGLView.onPause(); m_glView.onPause();
EWOL.onPause(); m_ewolNative.onPause();
Log.w("EwolActivity", "onPause (STOP)"); Log.w("EwolActivity", "onPause (STOP)");
} }
@ -159,16 +159,16 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
Log.w("EwolActivity", "onStop (START)"); Log.w("EwolActivity", "onStop (START)");
super.onStop(); super.onStop();
// call C // call C
EWOL.onStop(); m_ewolNative.onStop();
Log.w("EwolActivity", "onStop (STOP)"); Log.w("EwolActivity", "onStop (STOP)");
} }
@Override protected void onDestroy() { @Override protected void onDestroy() {
Log.w("EwolActivity", "onDestroy (START)"); Log.w("EwolActivity", "onDestroy (START)");
super.onDestroy(); super.onDestroy();
// call C // call C
EWOL.onDestroy(); m_ewolNative.onDestroy();
// Remove the java Virtual machine pointer form the C code // Remove the java Virtual machine pointer form the C code
EWOL.setJavaVirtualMachineStop(); m_ewolNative.setJavaVirtualMachineStop();
Log.w("EwolActivity", "onDestroy (STOP)"); Log.w("EwolActivity", "onDestroy (STOP)");
} }
@ -178,21 +178,21 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
} }
@Override @Override
public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration _newConfig) {
Log.e("EwolActivity", "Receive event ... "); Log.e("EwolActivity", "Receive event ... ");
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(_newConfig);
// Checks whether a hardware keyboard is available // Checks whether a hardware keyboard is available
if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) { if (_newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) {
EWOL.setHardKeyboardHidden(false); m_ewolNative.setHardKeyboardHidden(false);
Log.e("EwolActivity", "HARD Keyboard active = " + !EWOL.getHardKeyboardHidden() + " (visible)"); Log.e("EwolActivity", "HARD Keyboard active = " + !m_ewolNative.getHardKeyboardHidden() + " (visible)");
} else if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES) { } else if (_newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES) {
EWOL.setHardKeyboardHidden(true); m_ewolNative.setHardKeyboardHidden(true);
Log.e("EwolActivity", "HARD Keyboard active = " + !EWOL.getHardKeyboardHidden() + " (hidden)"); Log.e("EwolActivity", "HARD Keyboard active = " + !m_ewolNative.getHardKeyboardHidden() + " (hidden)");
} }
} }
public void keyboardUpdate(boolean show) { public void keyboardUpdate(boolean _show) {
Log.i("EwolActivity", "set keyboard status visibility :" + show); Log.i("EwolActivity", "set keyboard status visibility :" + _show);
final InputMethodManager imm; final InputMethodManager imm;
try { try {
imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
@ -201,9 +201,9 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
return; return;
} }
Log.i("EwolActivity", "Get input manager done"); Log.i("EwolActivity", "Get input manager done");
if(show == true) { if(_show == true) {
try { try {
imm.showSoftInput(mGLView, InputMethodManager.SHOW_IMPLICIT); imm.showSoftInput(m_glView, InputMethodManager.SHOW_IMPLICIT);
} catch(Exception e) { } catch(Exception e) {
Log.e("EwolActivity", "Can not set keyboard state ... (exeption !!!!)"); Log.e("EwolActivity", "Can not set keyboard state ... (exeption !!!!)");
} }
@ -211,7 +211,7 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
} else { } else {
// this is a little sutid this ==> display keyboard to be sure that it toggle in the hide state ... // this is a little sutid this ==> display keyboard to be sure that it toggle in the hide state ...
try { try {
imm.showSoftInput(mGLView, InputMethodManager.SHOW_IMPLICIT); imm.showSoftInput(m_glView, InputMethodManager.SHOW_IMPLICIT);
} catch(Exception e) { } catch(Exception e) {
Log.e("EwolActivity", "Can not set keyboard state ... (exeption !!!!)"); Log.e("EwolActivity", "Can not set keyboard state ... (exeption !!!!)");
} }
@ -225,19 +225,19 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
} }
} }
public void eventNotifier(String[] args) { public void eventNotifier(String[] _args) {
// TODO : ... // TODO : ...
} }
public void orientationUpdate(int screenMode) { public void orientationUpdate(int _screenMode) {
Context localContext = getAppContext(); Context localContext = getAppContext();
int result = localContext.checkCallingOrSelfPermission(Manifest.permission.SET_ORIENTATION); int result = localContext.checkCallingOrSelfPermission(Manifest.permission.SET_ORIENTATION);
if (result != PackageManager.PERMISSION_GRANTED) { if (result != PackageManager.PERMISSION_GRANTED) {
if (screenMode == EWOL_ORIENTATION_LANDSCAPE) { if (_screenMode == EWOL_ORIENTATION_LANDSCAPE) {
//Force landscape //Force landscape
//setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); //setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
} else if (screenMode == EWOL_ORIENTATION_PORTRAIT) { } else if (_screenMode == EWOL_ORIENTATION_PORTRAIT) {
//Force portrait //Force portrait
//setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); //setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
@ -250,13 +250,13 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
} }
} }
public void titleSet(String value) { public void titleSet(String _value) {
setTitle(value); setTitle(_value);
} }
public void openURI(String uri) { public void openURI(String _uri) {
try { try {
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(_uri));
startActivity(myIntent); startActivity(myIntent);
} catch (ActivityNotFoundException e) { } catch (ActivityNotFoundException e) {
Log.e("EwolActivity", "Can not request an URL"); Log.e("EwolActivity", "Can not request an URL");
@ -298,8 +298,8 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
*/ */
} }
public void setClipBoardString(String data) { public void setClipBoardString(String _data) {
tmpClipBoard = data; tmpClipBoard = _data;
return; return;
// TODO : Rework this it does not work // TODO : Rework this it does not work
/* /*

View File

@ -10,10 +10,10 @@ package org.ewol;
import android.util.Log; import android.util.Log;
public interface EwolCallback { public interface EwolCallback {
public void openURI(String uri); public void openURI(String _uri);
public void keyboardUpdate(boolean show); public void keyboardUpdate(boolean _show);
public void eventNotifier(String[] args); public void eventNotifier(String[] _args);
public void orientationUpdate(int screenMode); public void orientationUpdate(int _screenMode);
public void titleSet(String value); public void titleSet(String _value);
public void stop(); public void stop();
} }

View File

@ -25,20 +25,20 @@ import org.ewol.Ewol;
*/ */
public class EwolRendererGL implements GLSurfaceView.Renderer public class EwolRendererGL implements GLSurfaceView.Renderer
{ {
private Ewol EWOL; private Ewol m_ewolNative;
public EwolRendererGL(Ewol ewolInstance) { public EwolRendererGL(Ewol _ewolInstance) {
EWOL = ewolInstance; m_ewolNative = _ewolInstance;
} }
public void onSurfaceCreated(GL10 gl, EGLConfig config) { public void onSurfaceCreated(GL10 _gl, EGLConfig _config) {
EWOL.renderInit(); m_ewolNative.renderInit();
} }
public void onSurfaceChanged(GL10 gl, int w, int h) { public void onSurfaceChanged(GL10 _gl, int _w, int _h) {
EWOL.renderResize(w, h); m_ewolNative.renderResize(_w, _h);
} }
public void onDrawFrame(GL10 gl) { public void onDrawFrame(GL10 _gl) {
EWOL.renderDraw(); m_ewolNative.renderDraw();
} }
} }

View File

@ -27,12 +27,12 @@ public class EwolSurfaceViewGL extends GLSurfaceView implements EwolConstants {
private boolean inputDown1 = false; private boolean inputDown1 = false;
private boolean inputDown2 = false; private boolean inputDown2 = false;
private boolean inputDown3 = false; private boolean inputDown3 = false;
private Ewol EWOL; private Ewol m_ewolNative;
public EwolSurfaceViewGL(Context context, Ewol ewolInstance) { public EwolSurfaceViewGL(Context _context, Ewol _ewolInstance) {
// super must be first statement in constructor // super must be first statement in constructor
super(context); super(_context);
EWOL = ewolInstance; m_ewolNative = _ewolInstance;
/* /*
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
@ -59,7 +59,7 @@ public class EwolSurfaceViewGL extends GLSurfaceView implements EwolConstants {
setEGLContextClientVersion(2); setEGLContextClientVersion(2);
// je n'ai pas compris ... // je n'ai pas compris ...
m_ewolDrawer = new EwolRendererGL(EWOL); m_ewolDrawer = new EwolRendererGL(m_ewolNative);
setRenderer(m_ewolDrawer); setRenderer(m_ewolDrawer);
// Can get the focus ==> get keyboard from JAVA : // Can get the focus ==> get keyboard from JAVA :
@ -67,143 +67,143 @@ public class EwolSurfaceViewGL extends GLSurfaceView implements EwolConstants {
setFocusableInTouchMode(true); setFocusableInTouchMode(true);
} }
public boolean onTouchEvent(final MotionEvent event) { public boolean onTouchEvent(final MotionEvent _event) {
// Wrapper on input events : // Wrapper on input events :
int tmpActionType = event.getAction(); int tmpActionType = _event.getAction();
if (tmpActionType == MotionEvent.ACTION_MOVE) { if (tmpActionType == MotionEvent.ACTION_MOVE) {
final int pointerCount = event.getPointerCount(); final int pointerCount = _event.getPointerCount();
for (int p = 0; p < pointerCount; p++) { for (int p = 0; p < pointerCount; p++) {
if (SDK_VERSION>=14) { if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(p); final int typeOfPointer = _event.getToolType(p);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) { || typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventMotion(event.getPointerId(p), (float)event.getX(p), (float)event.getY(p)); m_ewolNative.inputEventMotion(_event.getPointerId(p), (float)_event.getX(p), (float)_event.getY(p));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventMotion(event.getPointerId(p), (float)event.getX(p), (float)event.getY(p)); m_ewolNative.mouseEventMotion(_event.getPointerId(p), (float)_event.getX(p), (float)_event.getY(p));
} }
} else { } else {
EWOL.inputEventMotion(event.getPointerId(p), (float)event.getX(p), (float)event.getY(p)); m_ewolNative.inputEventMotion(_event.getPointerId(p), (float)_event.getX(p), (float)_event.getY(p));
} }
} }
} else if( tmpActionType == MotionEvent.ACTION_POINTER_1_DOWN } else if( tmpActionType == MotionEvent.ACTION_POINTER_1_DOWN
|| tmpActionType == MotionEvent.ACTION_DOWN) { || tmpActionType == MotionEvent.ACTION_DOWN) {
if (SDK_VERSION>=14) { if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(0); final int typeOfPointer = _event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) { || typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(0), true, (float)event.getX(0), (float)event.getY(0)); m_ewolNative.inputEventState(_event.getPointerId(0), true, (float)_event.getX(0), (float)_event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(0), true, (float)event.getX(0), (float)event.getY(0)); m_ewolNative.mouseEventState(_event.getPointerId(0), true, (float)_event.getX(0), (float)_event.getY(0));
} }
} else { } else {
EWOL.inputEventState(event.getPointerId(0), true, (float)event.getX(0), (float)event.getY(0)); m_ewolNative.inputEventState(_event.getPointerId(0), true, (float)_event.getX(0), (float)_event.getY(0));
} }
inputDown1 = true; inputDown1 = true;
} else if(tmpActionType == MotionEvent.ACTION_POINTER_1_UP) { } else if(tmpActionType == MotionEvent.ACTION_POINTER_1_UP) {
if (SDK_VERSION>=14) { if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(0); final int typeOfPointer = _event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) { || typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0)); m_ewolNative.inputEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0)); m_ewolNative.mouseEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
} }
} else { } else {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0)); m_ewolNative.inputEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
} }
inputDown1 = false; inputDown1 = false;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_2_DOWN) { } else if (tmpActionType == MotionEvent.ACTION_POINTER_2_DOWN) {
if (SDK_VERSION>=14) { if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(1); final int typeOfPointer = _event.getToolType(1);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) { || typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(1), true, (float)event.getX(1), (float)event.getY(1)); m_ewolNative.inputEventState(_event.getPointerId(1), true, (float)_event.getX(1), (float)_event.getY(1));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(1), true, (float)event.getX(1), (float)event.getY(1)); m_ewolNative.mouseEventState(_event.getPointerId(1), true, (float)_event.getX(1), (float)_event.getY(1));
} }
} else { } else {
EWOL.inputEventState(event.getPointerId(1), true, (float)event.getX(1), (float)event.getY(1)); m_ewolNative.inputEventState(_event.getPointerId(1), true, (float)_event.getX(1), (float)_event.getY(1));
} }
inputDown2 = true; inputDown2 = true;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_2_UP) { } else if (tmpActionType == MotionEvent.ACTION_POINTER_2_UP) {
if (SDK_VERSION>=14) { if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(1); final int typeOfPointer = _event.getToolType(1);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) { || typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(1), false, (float)event.getX(1), (float)event.getY(1)); m_ewolNative.inputEventState(_event.getPointerId(1), false, (float)_event.getX(1), (float)_event.getY(1));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(1), false, (float)event.getX(1), (float)event.getY(1)); m_ewolNative.mouseEventState(_event.getPointerId(1), false, (float)_event.getX(1), (float)_event.getY(1));
} }
} else { } else {
EWOL.inputEventState(event.getPointerId(1), false, (float)event.getX(1), (float)event.getY(1)); m_ewolNative.inputEventState(_event.getPointerId(1), false, (float)_event.getX(1), (float)_event.getY(1));
} }
inputDown2 = false; inputDown2 = false;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_3_DOWN) { } else if (tmpActionType == MotionEvent.ACTION_POINTER_3_DOWN) {
if (SDK_VERSION>=14) { if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(2); final int typeOfPointer = _event.getToolType(2);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) { || typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(2), true, (float)event.getX(2), (float)event.getY(2)); m_ewolNative.inputEventState(_event.getPointerId(2), true, (float)_event.getX(2), (float)_event.getY(2));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(2), true, (float)event.getX(2), (float)event.getY(2)); m_ewolNative.mouseEventState(_event.getPointerId(2), true, (float)_event.getX(2), (float)_event.getY(2));
} }
} else { } else {
EWOL.inputEventState(event.getPointerId(2), true, (float)event.getX(2), (float)event.getY(2)); m_ewolNative.inputEventState(_event.getPointerId(2), true, (float)_event.getX(2), (float)_event.getY(2));
} }
inputDown3 = true; inputDown3 = true;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_3_UP) { } else if (tmpActionType == MotionEvent.ACTION_POINTER_3_UP) {
if (SDK_VERSION>=14) { if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(2); final int typeOfPointer = _event.getToolType(2);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) { || typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(2), false, (float)event.getX(2), (float)event.getY(2)); m_ewolNative.inputEventState(_event.getPointerId(2), false, (float)_event.getX(2), (float)_event.getY(2));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(2), false, (float)event.getX(2), (float)event.getY(2)); m_ewolNative.mouseEventState(_event.getPointerId(2), false, (float)_event.getX(2), (float)_event.getY(2));
} }
} else { } else {
EWOL.inputEventState(event.getPointerId(2), false, (float)event.getX(2), (float)event.getY(2)); m_ewolNative.inputEventState(_event.getPointerId(2), false, (float)_event.getX(2), (float)_event.getY(2));
} }
inputDown3 = false; inputDown3 = false;
} else if(tmpActionType == MotionEvent.ACTION_UP){ } else if(tmpActionType == MotionEvent.ACTION_UP){
if (inputDown1) { if (inputDown1) {
if (SDK_VERSION>=14) { if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(0); final int typeOfPointer = _event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) { || typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0)); m_ewolNative.inputEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0)); m_ewolNative.mouseEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
} }
} else { } else {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0)); m_ewolNative.inputEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
} }
inputDown1 = false; inputDown1 = false;
} else if (inputDown2) { } else if (inputDown2) {
if (SDK_VERSION>=14) { if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(0); final int typeOfPointer = _event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) { || typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0)); m_ewolNative.inputEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0)); m_ewolNative.mouseEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
} }
} else { } else {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0)); m_ewolNative.inputEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
} }
inputDown2 = false; inputDown2 = false;
} else { } else {
if (SDK_VERSION>=14) { if (SDK_VERSION>=14) {
final int typeOfPointer = event.getToolType(0); final int typeOfPointer = _event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) { || typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0)); m_ewolNative.inputEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
EWOL.mouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0)); m_ewolNative.mouseEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
} }
} else { } else {
EWOL.inputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0)); m_ewolNative.inputEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
} }
inputDown3 = false; inputDown3 = false;
} }
@ -211,67 +211,67 @@ public class EwolSurfaceViewGL extends GLSurfaceView implements EwolConstants {
return true; 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();
Log.i("Surface GL", "get event : " + keyCode + " is down : " + isDown); Log.i("Surface GL", "get event : " + keyCode + " is down : " + _isDown);
switch(keyCode) { switch(keyCode) {
case KeyEvent.KEYCODE_VOLUME_DOWN: case KeyEvent.KEYCODE_VOLUME_DOWN:
return EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_VOLUME_DOWN, isDown); return m_ewolNative.keyboardEventKeySystem(EWOL_SYSTEM_KEY_VOLUME_DOWN, _isDown);
case KeyEvent.KEYCODE_VOLUME_UP: case KeyEvent.KEYCODE_VOLUME_UP:
return EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_VOLUME_UP, isDown); return m_ewolNative.keyboardEventKeySystem(EWOL_SYSTEM_KEY_VOLUME_UP, _isDown);
case KeyEvent.KEYCODE_MENU: case KeyEvent.KEYCODE_MENU:
return EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_MENU, isDown); return m_ewolNative.keyboardEventKeySystem(EWOL_SYSTEM_KEY_MENU, _isDown);
case KeyEvent.KEYCODE_CAMERA: case KeyEvent.KEYCODE_CAMERA:
return EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_CAMERA, isDown); return m_ewolNative.keyboardEventKeySystem(EWOL_SYSTEM_KEY_CAMERA, _isDown);
case KeyEvent.KEYCODE_HOME: case KeyEvent.KEYCODE_HOME:
return EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_HOME, isDown); return m_ewolNative.keyboardEventKeySystem(EWOL_SYSTEM_KEY_HOME, _isDown);
case KeyEvent.KEYCODE_POWER: case KeyEvent.KEYCODE_POWER:
return EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_POWER, isDown); return m_ewolNative.keyboardEventKeySystem(EWOL_SYSTEM_KEY_POWER, _isDown);
case KeyEvent.KEYCODE_BACK: case KeyEvent.KEYCODE_BACK:
// 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 ...
return EWOL.keyboardEventKeySystem(EWOL_SYSTEM_KEY_BACK, isDown); return m_ewolNative.keyboardEventKeySystem(EWOL_SYSTEM_KEY_BACK, _isDown);
/* /*
EWOL.keyboardEventKey(EWOL_SYSTEM_KEY_BACK, isDown); m_ewolNative.keyboardEventKey(EWOL_SYSTEM_KEY_BACK, _isDown);
return false; return false;
*/ */
case KeyEvent.KEYCODE_DEL: case KeyEvent.KEYCODE_DEL:
EWOL.keyboardEventKey(EWOL_SYSTEM_KEY_DEL, isDown); m_ewolNative.keyboardEventKey(EWOL_SYSTEM_KEY_DEL, _isDown);
return true; return true;
// Joystick event : // Joystick event :
case KeyEvent.KEYCODE_DPAD_UP: EWOL.keyboardEventMove(EWOL_MOVE_KEY_UP, isDown); return true; case KeyEvent.KEYCODE_DPAD_UP: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_UP, _isDown); return true;
case KeyEvent.KEYCODE_DPAD_DOWN: EWOL.keyboardEventMove(EWOL_MOVE_KEY_DOWN, isDown); return true; case KeyEvent.KEYCODE_DPAD_DOWN: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_DOWN, _isDown); return true;
case KeyEvent.KEYCODE_DPAD_LEFT: EWOL.keyboardEventMove(EWOL_MOVE_KEY_LEFT, isDown); return true; case KeyEvent.KEYCODE_DPAD_LEFT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_LEFT, _isDown); return true;
case KeyEvent.KEYCODE_DPAD_RIGHT: EWOL.keyboardEventMove(EWOL_MOVE_KEY_RIGHT, isDown); return true; case KeyEvent.KEYCODE_DPAD_RIGHT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_RIGHT, _isDown); return true;
case KeyEvent.KEYCODE_PAGE_UP: EWOL.keyboardEventMove(EWOL_MOVE_KEY_PAGE_UP, isDown); return true; case KeyEvent.KEYCODE_PAGE_UP: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_PAGE_UP, _isDown); return true;
case KeyEvent.KEYCODE_PAGE_DOWN: EWOL.keyboardEventMove(EWOL_MOVE_KEY_PAGE_DOWN, isDown); return true; case KeyEvent.KEYCODE_PAGE_DOWN: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_PAGE_DOWN, _isDown); return true;
case KeyEvent.KEYCODE_MOVE_HOME: EWOL.keyboardEventMove(EWOL_MOVE_KEY_START, isDown); return true; case KeyEvent.KEYCODE_MOVE_HOME: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_START, _isDown); return true;
case KeyEvent.KEYCODE_MOVE_END: EWOL.keyboardEventMove(EWOL_MOVE_KEY_END, isDown); return true; case KeyEvent.KEYCODE_MOVE_END: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_END, _isDown); return true;
case KeyEvent.KEYCODE_SYSRQ: EWOL.keyboardEventMove(EWOL_MOVE_KEY_PRINT, isDown); return true; case KeyEvent.KEYCODE_SYSRQ: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_PRINT, _isDown); return true;
//case KeyEvent.: EWOL.keyboardEventMove(EWOL_MOVE_KEY_STOP_DEFIL, isDown); return true; //case KeyEvent.: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_STOP_DEFIL, _isDown); return true;
case KeyEvent.KEYCODE_BREAK: EWOL.keyboardEventMove(EWOL_MOVE_KEY_WAIT, isDown); return true; case KeyEvent.KEYCODE_BREAK: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_WAIT, _isDown); return true;
case KeyEvent.KEYCODE_INSERT: EWOL.keyboardEventMove(EWOL_MOVE_KEY_INSERT, isDown); return true; case KeyEvent.KEYCODE_INSERT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_INSERT, _isDown); return true;
case KeyEvent.KEYCODE_F1: EWOL.keyboardEventMove(EWOL_MOVE_KEY_F1, isDown); return true; case KeyEvent.KEYCODE_F1: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F1, _isDown); return true;
case KeyEvent.KEYCODE_F2: EWOL.keyboardEventMove(EWOL_MOVE_KEY_F2, isDown); return true; case KeyEvent.KEYCODE_F2: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F2, _isDown); return true;
case KeyEvent.KEYCODE_F3: EWOL.keyboardEventMove(EWOL_MOVE_KEY_F3, isDown); return true; case KeyEvent.KEYCODE_F3: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F3, _isDown); return true;
case KeyEvent.KEYCODE_F4: EWOL.keyboardEventMove(EWOL_MOVE_KEY_F4, isDown); return true; case KeyEvent.KEYCODE_F4: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F4, _isDown); return true;
case KeyEvent.KEYCODE_F5: EWOL.keyboardEventMove(EWOL_MOVE_KEY_F5, isDown); return true; case KeyEvent.KEYCODE_F5: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F5, _isDown); return true;
case KeyEvent.KEYCODE_F6: EWOL.keyboardEventMove(EWOL_MOVE_KEY_F6, isDown); return true; case KeyEvent.KEYCODE_F6: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F6, _isDown); return true;
case KeyEvent.KEYCODE_F7: EWOL.keyboardEventMove(EWOL_MOVE_KEY_F7, isDown); return true; case KeyEvent.KEYCODE_F7: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F7, _isDown); return true;
case KeyEvent.KEYCODE_F8: EWOL.keyboardEventMove(EWOL_MOVE_KEY_F8, isDown); return true; case KeyEvent.KEYCODE_F8: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F8, _isDown); return true;
case KeyEvent.KEYCODE_F9: EWOL.keyboardEventMove(EWOL_MOVE_KEY_F9, isDown); return true; case KeyEvent.KEYCODE_F9: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F9, _isDown); return true;
case KeyEvent.KEYCODE_F10: EWOL.keyboardEventMove(EWOL_MOVE_KEY_F10, isDown); return true; case KeyEvent.KEYCODE_F10: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F10, _isDown); return true;
case KeyEvent.KEYCODE_F11: EWOL.keyboardEventMove(EWOL_MOVE_KEY_F11, isDown); return true; case KeyEvent.KEYCODE_F11: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F11, _isDown); return true;
case KeyEvent.KEYCODE_F12: EWOL.keyboardEventMove(EWOL_MOVE_KEY_F12, isDown); return true; case KeyEvent.KEYCODE_F12: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F12, _isDown); return true;
case KeyEvent.KEYCODE_CAPS_LOCK: EWOL.keyboardEventMove(EWOL_MOVE_KEY_CAP_LOCK, isDown); return true; case KeyEvent.KEYCODE_CAPS_LOCK: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_CAP_LOCK, _isDown); return true;
case KeyEvent.KEYCODE_SHIFT_LEFT: EWOL.keyboardEventMove(EWOL_MOVE_KEY_SHIFT_LEFT, isDown); return true; case KeyEvent.KEYCODE_SHIFT_LEFT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_SHIFT_LEFT, _isDown); return true;
case KeyEvent.KEYCODE_SHIFT_RIGHT: EWOL.keyboardEventMove(EWOL_MOVE_KEY_SHIFT_RIGHT, isDown); return true; case KeyEvent.KEYCODE_SHIFT_RIGHT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_SHIFT_RIGHT, _isDown); return true;
case KeyEvent.KEYCODE_CTRL_LEFT: EWOL.keyboardEventMove(EWOL_MOVE_KEY_CTRL_LEFT, isDown); return true; case KeyEvent.KEYCODE_CTRL_LEFT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_CTRL_LEFT, _isDown); return true;
case KeyEvent.KEYCODE_CTRL_RIGHT: EWOL.keyboardEventMove(EWOL_MOVE_KEY_CTRL_RIGHT, isDown); return true; case KeyEvent.KEYCODE_CTRL_RIGHT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_CTRL_RIGHT, _isDown); return true;
case KeyEvent.KEYCODE_META_LEFT: EWOL.keyboardEventMove(EWOL_MOVE_KEY_META_LEFT, isDown); return true; case KeyEvent.KEYCODE_META_LEFT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_META_LEFT, _isDown); return true;
case KeyEvent.KEYCODE_META_RIGHT: EWOL.keyboardEventMove(EWOL_MOVE_KEY_META_RIGHT, isDown); return true; case KeyEvent.KEYCODE_META_RIGHT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_META_RIGHT, _isDown); return true;
case KeyEvent.KEYCODE_ALT_LEFT: EWOL.keyboardEventMove(EWOL_MOVE_KEY_ALT, isDown); return true; case KeyEvent.KEYCODE_ALT_LEFT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_ALT, _isDown); return true;
case KeyEvent.KEYCODE_ALT_RIGHT: EWOL.keyboardEventMove(EWOL_MOVE_KEY_ALT_GR, isDown); return true; case KeyEvent.KEYCODE_ALT_RIGHT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_ALT_GR, _isDown); return true;
case KeyEvent.KEYCODE_NUM_LOCK: EWOL.keyboardEventMove(EWOL_MOVE_KEY_NUM_LOCK, isDown); return true; case KeyEvent.KEYCODE_NUM_LOCK: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_NUM_LOCK, _isDown); return true;
default: default:
break; break;
} }
@ -280,23 +280,23 @@ public class EwolSurfaceViewGL extends GLSurfaceView implements EwolConstants {
|| (actionDone == KeyEvent.ACTION_MULTIPLE) || (actionDone == KeyEvent.ACTION_MULTIPLE)
|| (actionDone == KeyEvent.ACTION_UP)) { || (actionDone == KeyEvent.ACTION_UP)) {
// convert the key in UniChar to prevent errors ... // convert the key in UniChar to prevent errors ...
int uchar = event.getUnicodeChar(); int uchar = _event.getUnicodeChar();
// pb on the return methode ... in java it is like windows ... // pb on the return methode ... in java it is like windows ...
if (uchar == '\r') { if (uchar == '\r') {
uchar = '\n'; uchar = '\n';
} }
// send it to ewol ... // send it to ewol ...
EWOL.keyboardEventKey(uchar, isDown); m_ewolNative.keyboardEventKey(uchar, _isDown);
return true; return true;
} }
return false; 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

@ -32,13 +32,13 @@ import org.ewol.Ewol;
public abstract class EwolWallpaper extends WallpaperService implements EwolCallback, EwolConstants public abstract class EwolWallpaper extends WallpaperService implements EwolCallback, EwolConstants
{ {
private GLEngine mGLView; private GLEngine mGLView;
private Ewol EWOL; private Ewol m_ewolNative;
protected void initApkPath(String org, String vendor, String project) { protected void initApkPath(String _org, String _vendor, String _project) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(org).append("."); sb.append(_org).append(".");
sb.append(vendor).append("."); sb.append(_vendor).append(".");
sb.append(project); sb.append(_project);
String apkFilePath = null; String apkFilePath = null;
ApplicationInfo appInfo = null; ApplicationInfo appInfo = null;
PackageManager packMgmr = getPackageManager(); PackageManager packMgmr = getPackageManager();
@ -49,16 +49,16 @@ public abstract class EwolWallpaper extends WallpaperService implements EwolCall
throw new RuntimeException("Unable to locate assets, aborting..."); throw new RuntimeException("Unable to locate assets, aborting...");
} }
apkFilePath = appInfo.sourceDir; apkFilePath = appInfo.sourceDir;
EWOL.paramSetArchiveDir(0, apkFilePath); m_ewolNative.paramSetArchiveDir(0, apkFilePath);
} }
@Override public Engine onCreateEngine() { @Override public Engine onCreateEngine() {
// set the java evironement in the C sources : // set the java evironement in the C sources :
EWOL = new Ewol(this, EWOL_APPL_TYPE_WALLPAPER); m_ewolNative = new Ewol(this, EWOL_APPL_TYPE_WALLPAPER);
// Load the application directory // Load the application directory
EWOL.paramSetArchiveDir(1, getFilesDir().toString()); m_ewolNative.paramSetArchiveDir(1, getFilesDir().toString());
EWOL.paramSetArchiveDir(2, getCacheDir().toString()); m_ewolNative.paramSetArchiveDir(2, getCacheDir().toString());
// to enable extarnal storage: add in the manifest the restriction needed ... // to enable extarnal storage: add in the manifest the restriction needed ...
//packageManager.checkPermission("android.permission.READ_SMS", myPackage) == PERMISSION_GRANTED; //packageManager.checkPermission("android.permission.READ_SMS", myPackage) == PERMISSION_GRANTED;
//Ewol.paramSetArchiveDir(3, getExternalCacheDir().toString()); //Ewol.paramSetArchiveDir(3, getExternalCacheDir().toString());
@ -66,29 +66,28 @@ public abstract class EwolWallpaper extends WallpaperService implements EwolCall
//! DisplayMetrics metrics = new DisplayMetrics(); //! DisplayMetrics metrics = new DisplayMetrics();
//! getWindowManager().getDefaultDisplay().getMetrics(metrics); //! getWindowManager().getDefaultDisplay().getMetrics(metrics);
//! EWOL.displayPropertyMetrics(metrics.xdpi, metrics.ydpi); //! m_ewolNative.displayPropertyMetrics(metrics.xdpi, metrics.ydpi);
// call C init ... // call C init ...
EWOL.onCreate(); m_ewolNative.onCreate();
// create bsurface system // create bsurface system
mGLView = new GLEngine(EWOL); mGLView = new GLEngine(m_ewolNative);
return mGLView; return mGLView;
} }
public class GLEngine extends Engine { public class GLEngine extends Engine {
private Ewol EWOL; private Ewol m_ewolNative;
public GLEngine(Ewol ewolInstance) { public GLEngine(Ewol _ewolInstance) {
EWOL = ewolInstance; m_ewolNative = _ewolInstance;
} }
class WallpaperGLSurfaceView extends EwolSurfaceViewGL class WallpaperGLSurfaceView extends EwolSurfaceViewGL {
{
private static final String TAG = "WallpaperGLSurfaceView"; private static final String TAG = "WallpaperGLSurfaceView";
WallpaperGLSurfaceView(Context context, Ewol ewolInstance) { WallpaperGLSurfaceView(Context _context, Ewol _ewolInstance) {
super(context, ewolInstance); super(_context, _ewolInstance);
Log.d(TAG, "WallpaperGLSurfaceView(" + context + ")"); Log.d(TAG, "WallpaperGLSurfaceView(" + _context + ")");
} }
@Override public SurfaceHolder getHolder() { @Override public SurfaceHolder getHolder() {
Log.d(TAG, "getHolder(): returning " + getSurfaceHolder()); Log.d(TAG, "getHolder(): returning " + getSurfaceHolder());
@ -103,18 +102,18 @@ public abstract class EwolWallpaper extends WallpaperService implements EwolCall
private static final String TAG = "GLEngine"; private static final String TAG = "GLEngine";
private WallpaperGLSurfaceView glSurfaceView; private WallpaperGLSurfaceView glSurfaceView;
@Override public void onCreate(SurfaceHolder surfaceHolder) { @Override public void onCreate(SurfaceHolder _surfaceHolder) {
Log.d(TAG, "onCreate(" + surfaceHolder + ")"); Log.d(TAG, "onCreate(" + _surfaceHolder + ")");
super.onCreate(surfaceHolder); super.onCreate(_surfaceHolder);
glSurfaceView = new WallpaperGLSurfaceView(EwolWallpaper.this, EWOL); glSurfaceView = new WallpaperGLSurfaceView(EwolWallpaper.this, m_ewolNative);
// Check if the system supports OpenGL ES 2.0. // Check if the system supports OpenGL ES 2.0.
final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000; final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
if (false==supportsEs2) { if (supportsEs2 == false) {
Log.d("LiveWallpaper", "does not support board with only open GL ES 1"); Log.d("LiveWallpaper", "does not support board with only open GL ES 1");
return; return;
} }
@ -127,21 +126,21 @@ public abstract class EwolWallpaper extends WallpaperService implements EwolCall
} }
@Override public void onTouchEvent(MotionEvent event) { @Override public void onTouchEvent(MotionEvent _event) {
glSurfaceView.onTouchEvent(event); glSurfaceView.onTouchEvent(_event);
} }
@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);
if (true==visible) { if (_visible == true) {
glSurfaceView.onResume(); glSurfaceView.onResume();
// call C // call C
EWOL.onResume(); m_ewolNative.onResume();
} else { } else {
glSurfaceView.onPause(); glSurfaceView.onPause();
// call C // call C
EWOL.onPause(); m_ewolNative.onPause();
} }
} }
@ -149,47 +148,47 @@ public abstract class EwolWallpaper extends WallpaperService implements EwolCall
Log.d(TAG, "onDestroy()"); Log.d(TAG, "onDestroy()");
super.onDestroy(); super.onDestroy();
// call C // call C
EWOL.onStop(); m_ewolNative.onStop();
EWOL.onDestroy(); m_ewolNative.onDestroy();
glSurfaceView.onDestroy(); glSurfaceView.onDestroy();
} }
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) {
Log.d(TAG, "setPreserveEGLContextOnPause(" + preserve + ")"); Log.d(TAG, "setPreserveEGLContextOnPause(" + _preserve + ")");
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) { public void keyboardUpdate(boolean _show) {
// never display keyboard on wallpaer... // never display keyboard on wallpaer...
Log.d("EwolCallback", "KEABOARD UPDATE is not implemented ..."); Log.d("EwolCallback", "KEABOARD UPDATE is not implemented ...");
} }
public void eventNotifier(String[] args) { public void eventNotifier(String[] _args) {
// just for the test ... // just for the test ...
Log.d("EwolCallback", "EVENT NOTIFIER is not implemented ..."); Log.d("EwolCallback", "EVENT NOTIFIER is not implemented ...");
} }
public void orientationUpdate(int screenMode) { public void orientationUpdate(int _screenMode) {
Log.d("EwolCallback", "SET ORIENTATION is not implemented ..."); Log.d("EwolCallback", "SET ORIENTATION is not implemented ...");
} }
public void titleSet(String value) { public void titleSet(String _value) {
// no title in the wallpaper ... // no title in the wallpaper ...
Log.d("EwolCallback", "SET TITLE is not implemented ..."); Log.d("EwolCallback", "SET TITLE is not implemented ...");
} }
public void openURI(String uri) { public void openURI(String _uri) {
try { try {
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(_uri));
startActivity(myIntent); startActivity(myIntent);
} catch (ActivityNotFoundException e) { } catch (ActivityNotFoundException e) {
Log.e("EwolActivity", "Can not request an URL"); Log.e("EwolActivity", "Can not request an URL");
@ -199,26 +198,6 @@ public abstract class EwolWallpaper extends WallpaperService implements EwolCall
public void stop() { public void stop() {
Log.d("EwolCallback", "STOP is not implemented ..."); Log.d("EwolCallback", "STOP is not implemented ...");
} }
public int audioGetDeviceCount() {
Log.e("EwolActivity", "Get device List");
return 0;
}
public String audioGetDeviceProperty(int idDevice) {
Log.e("EwolActivity", "Get device property");
return "";
}
public boolean audioOpenDevice(int idDevice, int freq, int nbChannel, int format) {
Log.e("EwolActivity", "Open device");
return false;
}
public boolean audioCloseDevice(int idDevice) {
Log.e("EwolActivity", "Close device");
return false;
}
} }

View File

@ -17,6 +17,9 @@ ewol::context::ConfigFont::ConfigFont() :
m_name("Arial;Helvetica"), m_name("Arial;Helvetica"),
m_size(10), m_size(10),
m_useExternal(false) { m_useExternal(false) {
#ifdef __TARGET_OS__Android
m_name = "Roboto;DroidSans";
#endif
ewol::resource::freeTypeInit(); ewol::resource::freeTypeInit();
} }
@ -28,7 +31,16 @@ ewol::context::ConfigFont::~ConfigFont() {
void ewol::context::ConfigFont::set(const std::string& _fontName, int32_t _size) { void ewol::context::ConfigFont::set(const std::string& _fontName, int32_t _size) {
m_name = _fontName; m_name = _fontName;
m_size = _size; m_size = _size;
EWOL_INFO("Set default Font : '" << _fontName << "' size=" << _size); EWOL_INFO("Set default Font : '" << m_name << "' size=" << m_size);
} }
void ewol::context::ConfigFont::setSize(int32_t _size) {
m_size = _size;
EWOL_INFO("Set default Font : '" << m_name << "' size=" << m_size << " (change size only)");
}
void ewol::context::ConfigFont::setName(const std::string& _fontName) {
m_name = _fontName;
EWOL_INFO("Set default Font : '" << m_name << "' size=" << m_size << " (change name only)");
}

View File

@ -54,6 +54,11 @@ namespace ewol {
const std::string& getName() { const std::string& getName() {
return m_name; return m_name;
}; };
/**
* @brief Set the current default font name
* @param[in] _fontName The font name requested (not case sensitive) ex "Arial" or multiple separate by ';' ex : "Arial;Helvetica".
*/
void setName(const std::string& _fontName);
/** /**
* @brief get the default font size. * @brief get the default font size.
* @return the font size. * @return the font size.
@ -61,6 +66,11 @@ namespace ewol {
int32_t getSize() { int32_t getSize() {
return m_size; return m_size;
}; };
/**
* @brief Set the default font size.
* @param[in] _size new font size.
*/
void setSize(int32_t _size);
private: private:
bool m_useExternal; bool m_useExternal;
public: public:

View File

@ -41,7 +41,7 @@ ewol::widget::Windows::~Windows() {
} }
void ewol::widget::Windows::calculateSize(const vec2& _availlable) { void ewol::widget::Windows::calculateSize(const vec2& _availlable) {
//EWOL_DEBUG(" _availlable : " << _availlable); EWOL_DEBUG(" _availlable : " << _availlable);
m_size = _availlable; m_size = _availlable;
if (m_subWidget != nullptr) { if (m_subWidget != nullptr) {
m_subWidget->calculateMinMaxSize(); m_subWidget->calculateMinMaxSize();

View File

@ -1,9 +1,7 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* * @copyright 2011, Edouard DUPIN, all right reserved
* @copyright 2010, Edouard DUPIN, all right reserved * @license APACHE v2.0 (see license file)
*
* @license BSD 3 clauses (see license file)
*/ */
#include <appl/debug.h> #include <appl/debug.h>

View File

@ -1,9 +1,7 @@
/** /** @file
* @author Edouard DUPIN * @author Edouard DUPIN
* * @copyright 2011, Edouard DUPIN, all right reserved
* @copyright 2010, Edouard DUPIN, all right reserved * @license APACHE v2.0 (see license file)
*
* @license BSD 3 clauses (see license file)
*/ */
#ifndef __APPL_WIDGET_VECTOR_DISPLAY_H__ #ifndef __APPL_WIDGET_VECTOR_DISPLAY_H__