diff --git a/.travis.yml b/.travis.yml index e1db4dd6..f1c80fcf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,10 +3,6 @@ language: sudo: false -compiler: - - clang - - gcc - os: - linux - osx @@ -26,8 +22,18 @@ addons: install: - pip install --user lutin +env: + - CONF=debug BOARD=Linux BUILDER=clang GCOV= + - CONF=release BOARD=Linux BUILDER=clang GCOV= + - CONF=debug BOARD=Linux BUILDER=gcc GCOV= + - CONF=release BOARD=Linux BUILDER=gcc GCOV= + - CONF=debug BOARD=Linux BUILDER=gcc GCOV=--gcov + before_script: - cd .. + - wget http://atria-soft.com/ci/coverage_send.py + - wget http://atria-soft.com/ci/test_send.py + - wget http://atria-soft.com/ci/warning_send.py - mkdir bin - curl https://storage.googleapis.com/git-repo-downloads/repo > bin/repo - chmod a+x bin/repo @@ -43,14 +49,12 @@ before_script: - cd .. - pwd - ls -l - - if [ "$CXX" == "clang++" ]; then BUILDER=clang; else BUILDER=gcc; fi - - if [ "$CXX" == "g++" ]; then COMPILATOR_OPTION="--compilator-version=4.9"; else COMPILATOR_OPTION=""; fi + - if [ "$BUILDER" == "gcc" ]; then COMPILATOR_OPTION="--compilator-version=4.9"; else COMPILATOR_OPTION=""; fi script: - - lutin -C -P -c$BUILDER $COMPILATOR_OPTION -mdebug -p ewol etk-test exml-test ejson-test enet-test 0XX_customwidget 001_HelloWord - - ./out/Linux_x86_64/debug/staging/$BUILDER/etk-test/usr/bin/etk-test - - ./out/Linux_x86_64/debug/staging/$BUILDER/ejson-test/usr/bin/ejson-test - - ./out/Linux_x86_64/debug/staging/$BUILDER/exml-test/usr/bin/exml-test + - lutin -w -j4 -C -P -c $BUILDER $COMPILATOR_OPTION -m $CONF $GCOV -p ewol-test 0XX_customwidget 001_HelloWord + + notifications: email: diff --git a/android/src/org/ewol/Ewol.java b/android/src/org/ewol/Ewol.java deleted file mode 100644 index 4e9c31a0..00000000 --- a/android/src/org/ewol/Ewol.java +++ /dev/null @@ -1,142 +0,0 @@ -/** - * @author Edouard DUPIN, Kevin BILLONNEAU - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -package org.ewol; - -import android.app.Activity; -import android.service.wallpaper.WallpaperService; -import android.service.wallpaper.WallpaperService.Engine; -import android.util.Log; - -public class Ewol { - private int m_instanceID = -1; // local and private instance ID - private boolean m_hardKeyboardHidden = true; - - public Ewol(T _activityInstance, int _typeApplication) { - m_instanceID = -1; - m_hardKeyboardHidden = true; - m_instanceID = EWsetJavaVirtualMachineStart(_activityInstance, _typeApplication); - Log.d("Ewol", "new : " + m_instanceID); - } - - public void setJavaVirtualMachineStop() { - EWsetJavaVirtualMachineStop(m_instanceID); - } - public void paramSetArchiveDir(int _mode, String _myString) { - EWparamSetArchiveDir(m_instanceID, _mode, _myString); - } - - public boolean getHardKeyboardHidden() { - return m_hardKeyboardHidden; - } - public void setHardKeyboardHidden(boolean _val) { - m_hardKeyboardHidden = _val; - } - - // activity status - public void onCreate() { - EWonCreate(m_instanceID); - } - public void onStart() { - EWonStart(m_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 : - public void displayPropertyMetrics(float _ratioX, float _ratioY) { - EWdisplayPropertyMetrics(m_instanceID, _ratioX, _ratioY); - } - // IO native function : - // 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) { - EWinputEventMotion(m_instanceID, _pointerID, _x, _y); - } - public void inputEventState(int _pointerID, boolean _isDown, float _x, float _y) { - EWinputEventState(m_instanceID, _pointerID, _isDown, _x, _y); - } - // Specific for the type of input : TOOL_TYPE_MOUSE - public void mouseEventMotion(int _pointerID, float _x, float _y) { - EWmouseEventMotion(m_instanceID, _pointerID, _x, _y); - } - public void mouseEventState(int _pointerID, boolean _isDown, float _x, float _y) { - EWmouseEventState(m_instanceID, _pointerID, _isDown, _x, _y); - } - // other unknow event ... - public void unknowEvent(int _eventID) { - EWunknowEvent(m_instanceID, _eventID); - } - - public void keyboardEventMove(int _type, boolean _isDown) { - EWkeyboardEventMove(m_instanceID, _type, _isDown); - } - public void keyboardEventKey(int _uniChar, boolean _isDown) { - EWkeyboardEventKey(m_instanceID, _uniChar, _isDown); - } - - public boolean keyboardEventKeySystem(int _keyVal, boolean _isDown) { - return EWkeyboardEventKeySystem(m_instanceID, _keyVal, _isDown); - } - // renderer Event : - public void renderInit() { - EWrenderInit(m_instanceID); - } - public void renderResize(int _w, int _h) { - EWrenderResize(m_instanceID, _w, _h); - } - public void renderDraw() { - EWrenderDraw(m_instanceID); - } - - - private native int EWsetJavaVirtualMachineStart(T _activityInstance, int _typeApplication); - private native void EWsetJavaVirtualMachineStop(int _instanceId); - private native void EWparamSetArchiveDir(int _instanceId, int _mode, String _myString); - - // activity status - private native void EWonCreate(int _instanceId); - private native void EWonStart(int _instanceId); - private native void EWonReStart(int _instanceId); - private native void EWonResume(int _instanceId); - private native void EWonPause(int _instanceId); - private native void EWonStop(int _instanceId); - private native void EWonDestroy(int _instanceId); - // set display properties : - private native void EWdisplayPropertyMetrics(int _instanceId, float _ratioX, float _ratioY); - // IO native function : - // 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 EWinputEventState(int _instanceId, int _pointerID, boolean _isDown, float _x, float _y); - // Specific for the type of input : TOOL_TYPE_MOUSE - 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); - // other unknow event ... - private native void EWunknowEvent(int _instanceId, int _eventID); - - private native void EWkeyboardEventMove(int _instanceId, int _type, boolean _isDown); - private native void EWkeyboardEventKey(int _instanceId, int _uniChar, boolean _isDown); - - private native boolean EWkeyboardEventKeySystem(int _instanceId, int _keyVal, boolean _isDown); - // renderer Event : - private native void EWrenderInit(int _instanceId); - private native void EWrenderResize(int _instanceId, int _w, int _h); - private native void EWrenderDraw(int _instanceId); -} - diff --git a/android/src/org/ewol/EwolActivity.java b/android/src/org/ewol/EwolActivity.java deleted file mode 100644 index 0e281dd5..00000000 --- a/android/src/org/ewol/EwolActivity.java +++ /dev/null @@ -1,317 +0,0 @@ -/** - * @author Edouard DUPIN, Kevin BILLONNEAU - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - - -package org.ewol; - -import android.app.Activity; -import android.content.Context; -import android.Manifest; -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 android.Manifest; - -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.PackageManager; -import android.content.pm.PackageManager.NameNotFoundException; -import android.content.res.AssetFileDescriptor; -import android.content.res.AssetManager; -import android.util.DisplayMetrics; -import android.util.Log; -// copy past events : -import android.content.ClipboardManager; -import android.content.ClipData; - -import android.net.Uri; -import android.content.Intent; -import android.content.ActivityNotFoundException; - -import java.io.IOException; -//import activityRootView - -import org.ewol.Ewol; - - -/** - * @brief Class : - * - */ -public abstract class EwolActivity extends Activity implements EwolCallback, EwolConstants { - private static Context m_context; - protected EwolSurfaceViewGL m_glView = null; - private Ewol m_ewolNative; - // clipboard section - private String tmpClipBoard; // TODO : Remove this ==> clipboard acces does not work - - public static Context getAppContext() { - return EwolActivity.m_context; - } - - public EwolActivity() { - // set the java evironement in the C sources : - m_ewolNative = new Ewol(this, EWOL_APPL_TYPE_ACTIVITY); - tmpClipBoard = ""; - } - - protected 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; - m_ewolNative.paramSetArchiveDir(0, apkFilePath); - } - - @Override protected void onCreate(Bundle _savedInstanceState) { - super.onCreate(_savedInstanceState); - //setListnerToRootView(); - EwolActivity.m_context = getApplicationContext(); - - // Load the application directory - m_ewolNative.paramSetArchiveDir(1, getFilesDir().toString()); - m_ewolNative.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); - m_ewolNative.displayPropertyMetrics(metrics.xdpi, metrics.ydpi); - - // call C init ... - m_ewolNative.onCreate(); - - // 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 - m_glView = new EwolSurfaceViewGL(this, m_ewolNative); - - setContentView(m_glView); - } - - @Override protected void onStart() { - Log.w("EwolActivity", "onStart (START)"); - super.onStart(); - m_ewolNative.onStart(); - Log.w("EwolActivity", "onStart (STOP)"); - } - - @Override protected void onRestart() { - Log.w("EwolActivity", "onRestart (START)"); - super.onRestart(); - m_ewolNative.onReStart(); - Log.w("EwolActivity", "onRestart (STOP)"); - } - - @Override protected void onResume() { - Log.w("EwolActivity", "onResume (START)"); - super.onResume(); - m_glView.onResume(); - m_ewolNative.onResume(); - Log.w("EwolActivity", "onResume (STOP)"); - } - - @Override protected void onPause() { - Log.w("EwolActivity", "onPause (START)"); - super.onPause(); - m_glView.onPause(); - m_ewolNative.onPause(); - Log.w("EwolActivity", "onPause (STOP)"); - } - - @Override protected void onStop() { - Log.w("EwolActivity", "onStop (START)"); - super.onStop(); - // call C - m_ewolNative.onStop(); - Log.w("EwolActivity", "onStop (STOP)"); - } - @Override protected void onDestroy() { - Log.w("EwolActivity", "onDestroy (START)"); - super.onDestroy(); - // call C - m_ewolNative.onDestroy(); - // Remove the java Virtual machine pointer form the C code - m_ewolNative.setJavaVirtualMachineStop(); - Log.w("EwolActivity", "onDestroy (STOP)"); - } - - @Override protected void finalize() throws Throwable { - super.finalize(); - // cleanup your object here - } - - @Override - public void onConfigurationChanged(Configuration _newConfig) { - Log.e("EwolActivity", "Receive event ... "); - super.onConfigurationChanged(_newConfig); - // Checks whether a hardware keyboard is available - if (_newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) { - m_ewolNative.setHardKeyboardHidden(false); - Log.e("EwolActivity", "HARD Keyboard active = " + !m_ewolNative.getHardKeyboardHidden() + " (visible)"); - } else if (_newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES) { - m_ewolNative.setHardKeyboardHidden(true); - Log.e("EwolActivity", "HARD Keyboard active = " + !m_ewolNative.getHardKeyboardHidden() + " (hidden)"); - } - } - - public void keyboardUpdate(boolean _show) { - Log.i("EwolActivity", "set keyboard status visibility :" + _show); - final InputMethodManager imm; - try { - imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); - } catch(Exception e) { - Log.e("EwolActivity", "Can not get keyboard manager ..."); - return; - } - Log.i("EwolActivity", "Get input manager done"); - if(_show == true) { - try { - imm.showSoftInput(m_glView, InputMethodManager.SHOW_IMPLICIT); - } catch(Exception e) { - Log.e("EwolActivity", "Can not set keyboard state ... (exeption !!!!)"); - } - Log.i("EwolActivity", "Display it Done"); - } else { - // this is a little sutid this ==> display keyboard to be sure that it toggle in the hide state ... - try { - imm.showSoftInput(m_glView, InputMethodManager.SHOW_IMPLICIT); - } catch(Exception e) { - Log.e("EwolActivity", "Can not set keyboard state ... (exeption !!!!)"); - } - Log.i("EwolActivity", "Display it Done"); - try { - imm.toggleSoftInput(0 ,InputMethodManager.HIDE_IMPLICIT_ONLY + InputMethodManager.HIDE_NOT_ALWAYS); - } catch(Exception e) { - Log.e("EwolActivity", "Can not set keyboard state ... (exeption !!!!)"); - } - Log.i("EwolActivity", "Toggle it Done"); - } - } - - public void eventNotifier(String[] _args) { - // TODO : ... - } - - public void orientationUpdate(int _screenMode) { - Context localContext = getAppContext(); - int result = localContext.checkCallingOrSelfPermission(Manifest.permission.SET_ORIENTATION); - if (result != PackageManager.PERMISSION_GRANTED) { - if (_screenMode == EWOL_ORIENTATION_LANDSCAPE) { - //Force landscape - //setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); - setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); - } else if (_screenMode == EWOL_ORIENTATION_PORTRAIT) { - //Force portrait - //setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); - setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); - } else { - //Force auto Rotation - setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); - } - } else { - Log.e("EwolActivity", "Not the right 'SET_ORIENTATION' to access on the screen orientation..."); - } - } - - public void titleSet(String _value) { - setTitle(_value); - } - - public void openURI(String _uri) { - try { - Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(_uri)); - startActivity(myIntent); - } catch (ActivityNotFoundException e) { - Log.e("EwolActivity", "Can not request an URL"); - } - } - - public void stop() { - Log.w("EwolActivity", "Application stop requested (START)"); - // end application is requested ... - finish(); - Log.w("EwolActivity", "Application stop requested (STOP)"); - } - - //http://developer.android.com/guide/topics/text/copy-paste.html - public String getClipBoardString() { - return tmpClipBoard; - // TODO : Rework this it does not work - /* - // Gets a handle to the clipboard service. - ClipboardManager clipboard = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE); - // If the clipboard doesn't contain data, disable the paste menu item. - // If it does contain data, decide if you can handle the data. - if (!(clipboard.hasPrimaryClip())) { - return ""; - } - // Examines the item on the clipboard. If getText() does not return null, the clip item contains the - // text. Assumes that this application can only handle one item at a time. - ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0); - if (item == null) { - return ""; - } - // Gets the clipboard as text. - String pasteData = item.getText().toString();; - // If the string contains data, then the paste operation is done - if (pasteData != null) { - return pasteData; - } - return ""; - */ - } - - public void setClipBoardString(String _data) { - tmpClipBoard = _data; - return; - // TODO : Rework this it does not work - /* - // Gets a handle to the clipboard service. - ClipboardManager clipboard = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE); - // Creates a new text clip to put on the clipboard - ClipData clip = ClipData.newPlainText("simple text", data); - // Set the clipboard's primary clip. - clipboard.setPrimaryClip(clip); - */ - } -} - - - diff --git a/android/src/org/ewol/EwolCallback.java b/android/src/org/ewol/EwolCallback.java deleted file mode 100644 index 14973d2c..00000000 --- a/android/src/org/ewol/EwolCallback.java +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @author Edouard DUPIN, Kevin BILLONNEAU - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -package org.ewol; -import android.util.Log; - -public interface EwolCallback { - public void openURI(String _uri); - public void keyboardUpdate(boolean _show); - public void eventNotifier(String[] _args); - public void orientationUpdate(int _screenMode); - public void titleSet(String _value); - public void stop(); -} diff --git a/android/src/org/ewol/EwolConstants.java b/android/src/org/ewol/EwolConstants.java deleted file mode 100644 index 3e42d53e..00000000 --- a/android/src/org/ewol/EwolConstants.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @author Edouard DUPIN, Kevin BILLONNEAU - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -package org.ewol; - -public interface EwolConstants { - 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_MENU = 3; - 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_POWER = 6; - // the back key is wrapped in the key to simplify PC validation ... - public static final int EWOL_SYSTEM_KEY_BACK = 0x1B; - 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_APPL_TYPE_ACTIVITY = 0; - public static final int EWOL_APPL_TYPE_WALLPAPER = 1; - - // Key binding of the element ewol::key::keyboard : - public static final int EWOL_MOVE_KEY_LEFT = 2; - public static final int EWOL_MOVE_KEY_RIGHT = 3; - public static final int EWOL_MOVE_KEY_UP = 4; - public static final int EWOL_MOVE_KEY_DOWN = 5; - public static final int EWOL_MOVE_KEY_PAGE_UP = 6; - public static final int EWOL_MOVE_KEY_PAGE_DOWN = 7; - public static final int EWOL_MOVE_KEY_START = 8; - public static final int EWOL_MOVE_KEY_END = 9; - public static final int EWOL_MOVE_KEY_PRINT = 10; - public static final int EWOL_MOVE_KEY_STOP_DEFIL = 11; - public static final int EWOL_MOVE_KEY_WAIT = 12; - public static final int EWOL_MOVE_KEY_INSERT = 13; - public static final int EWOL_MOVE_KEY_F1 = 14; - public static final int EWOL_MOVE_KEY_F2 = 15; - public static final int EWOL_MOVE_KEY_F3 = 16; - public static final int EWOL_MOVE_KEY_F4 = 17; - public static final int EWOL_MOVE_KEY_F5 = 18; - public static final int EWOL_MOVE_KEY_F6 = 19; - public static final int EWOL_MOVE_KEY_F7 = 20; - public static final int EWOL_MOVE_KEY_F8 = 21; - public static final int EWOL_MOVE_KEY_F9 = 22; - public static final int EWOL_MOVE_KEY_F10 = 23; - public static final int EWOL_MOVE_KEY_F11 = 24; - public static final int EWOL_MOVE_KEY_F12 = 25; - public static final int EWOL_MOVE_KEY_CAP_LOCK = 26; - public static final int EWOL_MOVE_KEY_SHIFT_LEFT = 27; - public static final int EWOL_MOVE_KEY_SHIFT_RIGHT = 28; - public static final int EWOL_MOVE_KEY_CTRL_LEFT = 29; - public static final int EWOL_MOVE_KEY_CTRL_RIGHT = 30; - public static final int EWOL_MOVE_KEY_META_LEFT = 31; - public static final int EWOL_MOVE_KEY_META_RIGHT = 32; - public static final int EWOL_MOVE_KEY_ALT = 33; - public static final int EWOL_MOVE_KEY_ALT_GR = 34; - public static final int EWOL_MOVE_KEY_CONTEXT_MENU = 35; - public static final int EWOL_MOVE_KEY_NUM_LOCK = 36; - -} diff --git a/android/src/org/ewol/EwolRendererGL.java b/android/src/org/ewol/EwolRendererGL.java deleted file mode 100644 index 63a08204..00000000 --- a/android/src/org/ewol/EwolRendererGL.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @author Edouard DUPIN, Kevin BILLONNEAU - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -package org.ewol; - -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.opengles.GL10; -import android.opengl.GLES20; -import android.opengl.GLSurfaceView; - -// import the ewol package : -/* no need in same package... */ -//import org.ewol.Ewol; - -import org.ewol.Ewol; - -/** - * @brief Class : - * - */ -public class EwolRendererGL implements GLSurfaceView.Renderer -{ - private Ewol m_ewolNative; - - public EwolRendererGL(Ewol _ewolInstance) { - m_ewolNative = _ewolInstance; - } - public void onSurfaceCreated(GL10 _gl, EGLConfig _config) { - m_ewolNative.renderInit(); - } - - public void onSurfaceChanged(GL10 _gl, int _w, int _h) { - m_ewolNative.renderResize(_w, _h); - } - - public void onDrawFrame(GL10 _gl) { - m_ewolNative.renderDraw(); - } -} diff --git a/android/src/org/ewol/EwolSurfaceViewGL.java b/android/src/org/ewol/EwolSurfaceViewGL.java deleted file mode 100644 index c3f1f904..00000000 --- a/android/src/org/ewol/EwolSurfaceViewGL.java +++ /dev/null @@ -1,302 +0,0 @@ -/** - * @author Edouard DUPIN, Kevin BILLONNEAU - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -package org.ewol; - -import android.content.Context; -import android.opengl.GLSurfaceView; -import android.os.Bundle; -import android.view.MotionEvent; -import android.view.KeyEvent; -import android.util.Log; - -import org.ewol.Ewol; - -/** - * @brief Class : - * - */ -public class EwolSurfaceViewGL extends GLSurfaceView implements EwolConstants { - public static final int SDK_VERSION = android.os.Build.VERSION.SDK_INT; - private EwolRendererGL m_ewolDrawer = null; - private boolean inputDown1 = false; - private boolean inputDown2 = false; - private boolean inputDown3 = false; - private Ewol m_ewolNative; - - public EwolSurfaceViewGL(Context _context, Ewol _ewolInstance) { - // super must be first statement in constructor - super(_context); - m_ewolNative = _ewolInstance; - /* - List of the Android API : - 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, 4.0.1, 4.0.2 14 ICE_CREAM_SANDWICH - Android 3.2 13 HONEYCOMB_MR2 - Android 3.1.x 12 HONEYCOMB_MR1 Platform Highlights - Android 3.0.x 11 HONEYCOMB Platform Highlights - Android 2.3.4 - Android 2.3.3 10 GINGERBREAD_MR1 Platform Highlights - Android 2.3.2 - Android 2.3.1 - Android 2.3 9 GINGERBREAD - Android 2.2.x 8 FROYO Platform Highlights - Android 2.1.x 7 ECLAIR_MR1 Platform Highlights - Android 2.0.1 6 ECLAIR_0_1 - Android 2.0 5 ECLAIR - Android 1.6 4 DONUT Platform Highlights - Android 1.5 3 CUPCAKE Platform Highlights - Android 1.1 2 BASE_1_1 - Android 1.0 1 BASE - */ - // Create an OpenGL ES 2.0 context - setEGLContextClientVersion(2); - - // je n'ai pas compris ... - m_ewolDrawer = new EwolRendererGL(m_ewolNative); - setRenderer(m_ewolDrawer); - - // Can get the focus ==> get keyboard from JAVA : - setFocusable(true); - setFocusableInTouchMode(true); - } - - public boolean onTouchEvent(final MotionEvent _event) { - // Wrapper on input events : - - int tmpActionType = _event.getAction(); - - if (tmpActionType == MotionEvent.ACTION_MOVE) { - final int pointerCount = _event.getPointerCount(); - for (int p = 0; p < pointerCount; p++) { - if (SDK_VERSION>=14) { - final int typeOfPointer = _event.getToolType(p); - if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER - || typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) { - m_ewolNative.inputEventMotion(_event.getPointerId(p), (float)_event.getX(p), (float)_event.getY(p)); - } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { - m_ewolNative.mouseEventMotion(_event.getPointerId(p), (float)_event.getX(p), (float)_event.getY(p)); - } - } else { - m_ewolNative.inputEventMotion(_event.getPointerId(p), (float)_event.getX(p), (float)_event.getY(p)); - } - } - } 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) { - m_ewolNative.inputEventState(_event.getPointerId(0), true, (float)_event.getX(0), (float)_event.getY(0)); - } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { - m_ewolNative.mouseEventState(_event.getPointerId(0), true, (float)_event.getX(0), (float)_event.getY(0)); - } - } else { - m_ewolNative.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) { - m_ewolNative.inputEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0)); - } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { - m_ewolNative.mouseEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0)); - } - } else { - m_ewolNative.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) { - m_ewolNative.inputEventState(_event.getPointerId(1), true, (float)_event.getX(1), (float)_event.getY(1)); - } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { - m_ewolNative.mouseEventState(_event.getPointerId(1), true, (float)_event.getX(1), (float)_event.getY(1)); - } - } else { - m_ewolNative.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) { - m_ewolNative.inputEventState(_event.getPointerId(1), false, (float)_event.getX(1), (float)_event.getY(1)); - } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { - m_ewolNative.mouseEventState(_event.getPointerId(1), false, (float)_event.getX(1), (float)_event.getY(1)); - } - } else { - m_ewolNative.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) { - m_ewolNative.inputEventState(_event.getPointerId(2), true, (float)_event.getX(2), (float)_event.getY(2)); - } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { - m_ewolNative.mouseEventState(_event.getPointerId(2), true, (float)_event.getX(2), (float)_event.getY(2)); - } - } else { - m_ewolNative.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) { - m_ewolNative.inputEventState(_event.getPointerId(2), false, (float)_event.getX(2), (float)_event.getY(2)); - } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { - m_ewolNative.mouseEventState(_event.getPointerId(2), false, (float)_event.getX(2), (float)_event.getY(2)); - } - } else { - m_ewolNative.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) { - m_ewolNative.inputEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0)); - } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { - m_ewolNative.mouseEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0)); - } - } else { - m_ewolNative.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) { - m_ewolNative.inputEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0)); - } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { - m_ewolNative.mouseEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0)); - } - } else { - m_ewolNative.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) { - m_ewolNative.inputEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0)); - } else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) { - m_ewolNative.mouseEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0)); - } - } else { - m_ewolNative.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) { - int actionDone = _event.getAction(); - Log.i("Surface GL", "get event : " + keyCode + " is down : " + _isDown); - switch(keyCode) { - case KeyEvent.KEYCODE_VOLUME_DOWN: - return m_ewolNative.keyboardEventKeySystem(EWOL_SYSTEM_KEY_VOLUME_DOWN, _isDown); - case KeyEvent.KEYCODE_VOLUME_UP: - return m_ewolNative.keyboardEventKeySystem(EWOL_SYSTEM_KEY_VOLUME_UP, _isDown); - case KeyEvent.KEYCODE_MENU: - return m_ewolNative.keyboardEventKeySystem(EWOL_SYSTEM_KEY_MENU, _isDown); - case KeyEvent.KEYCODE_CAMERA: - return m_ewolNative.keyboardEventKeySystem(EWOL_SYSTEM_KEY_CAMERA, _isDown); - case KeyEvent.KEYCODE_HOME: - return m_ewolNative.keyboardEventKeySystem(EWOL_SYSTEM_KEY_HOME, _isDown); - case KeyEvent.KEYCODE_POWER: - return m_ewolNative.keyboardEventKeySystem(EWOL_SYSTEM_KEY_POWER, _isDown); - case KeyEvent.KEYCODE_BACK: - // the back key is wrapped in the key to simplify PC validation ... - return m_ewolNative.keyboardEventKeySystem(EWOL_SYSTEM_KEY_BACK, _isDown); - /* - m_ewolNative.keyboardEventKey(EWOL_SYSTEM_KEY_BACK, _isDown); - return false; - */ - case KeyEvent.KEYCODE_DEL: - m_ewolNative.keyboardEventKey(EWOL_SYSTEM_KEY_DEL, _isDown); - return true; - // Joystick event : - case KeyEvent.KEYCODE_DPAD_UP: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_UP, _isDown); return true; - case KeyEvent.KEYCODE_DPAD_DOWN: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_DOWN, _isDown); return true; - case KeyEvent.KEYCODE_DPAD_LEFT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_LEFT, _isDown); return true; - case KeyEvent.KEYCODE_DPAD_RIGHT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_RIGHT, _isDown); return true; - case KeyEvent.KEYCODE_PAGE_UP: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_PAGE_UP, _isDown); return true; - case KeyEvent.KEYCODE_PAGE_DOWN: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_PAGE_DOWN, _isDown); return true; - case KeyEvent.KEYCODE_MOVE_HOME: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_START, _isDown); return true; - case KeyEvent.KEYCODE_MOVE_END: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_END, _isDown); return true; - case KeyEvent.KEYCODE_SYSRQ: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_PRINT, _isDown); return true; - //case KeyEvent.: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_STOP_DEFIL, _isDown); return true; - case KeyEvent.KEYCODE_BREAK: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_WAIT, _isDown); return true; - case KeyEvent.KEYCODE_INSERT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_INSERT, _isDown); return true; - case KeyEvent.KEYCODE_F1: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F1, _isDown); return true; - case KeyEvent.KEYCODE_F2: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F2, _isDown); return true; - case KeyEvent.KEYCODE_F3: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F3, _isDown); return true; - case KeyEvent.KEYCODE_F4: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F4, _isDown); return true; - case KeyEvent.KEYCODE_F5: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F5, _isDown); return true; - case KeyEvent.KEYCODE_F6: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F6, _isDown); return true; - case KeyEvent.KEYCODE_F7: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F7, _isDown); return true; - case KeyEvent.KEYCODE_F8: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F8, _isDown); return true; - case KeyEvent.KEYCODE_F9: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F9, _isDown); return true; - case KeyEvent.KEYCODE_F10: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F10, _isDown); return true; - case KeyEvent.KEYCODE_F11: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F11, _isDown); return true; - case KeyEvent.KEYCODE_F12: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_F12, _isDown); return true; - case KeyEvent.KEYCODE_CAPS_LOCK: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_CAP_LOCK, _isDown); return true; - case KeyEvent.KEYCODE_SHIFT_LEFT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_SHIFT_LEFT, _isDown); return true; - case KeyEvent.KEYCODE_SHIFT_RIGHT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_SHIFT_RIGHT, _isDown); return true; - case KeyEvent.KEYCODE_CTRL_LEFT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_CTRL_LEFT, _isDown); return true; - case KeyEvent.KEYCODE_CTRL_RIGHT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_CTRL_RIGHT, _isDown); return true; - case KeyEvent.KEYCODE_META_LEFT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_META_LEFT, _isDown); return true; - case KeyEvent.KEYCODE_META_RIGHT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_META_RIGHT, _isDown); return true; - case KeyEvent.KEYCODE_ALT_LEFT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_ALT, _isDown); return true; - case KeyEvent.KEYCODE_ALT_RIGHT: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_ALT_GR, _isDown); return true; - case KeyEvent.KEYCODE_NUM_LOCK: m_ewolNative.keyboardEventMove(EWOL_MOVE_KEY_NUM_LOCK, _isDown); return true; - 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 ... - m_ewolNative.keyboardEventKey(uchar, _isDown); - return true; - } - return false; - } - - public boolean onKeyDown(int _keyCode, KeyEvent _event) { - return keyboardEvent(_keyCode, _event, true); - } - - public boolean onKeyUp(int _keyCode, KeyEvent _event) { - return keyboardEvent(_keyCode, _event, false); - } -} diff --git a/android/src/org/ewol/EwolWallpaper.java b/android/src/org/ewol/EwolWallpaper.java deleted file mode 100644 index a4855ede..00000000 --- a/android/src/org/ewol/EwolWallpaper.java +++ /dev/null @@ -1,203 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license APACHE v2.0 (see license file) - */ - -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.opengl.GLSurfaceView; -import android.opengl.GLSurfaceView.Renderer; -import android.os.Build; -import android.service.wallpaper.WallpaperService; -import android.util.Log; -import android.view.SurfaceHolder; -import org.ewol.EwolSurfaceViewGL; -import android.view.MotionEvent; - -import android.net.Uri; -import android.content.Intent; -import android.content.ActivityNotFoundException; - -import org.ewol.Ewol; - -public abstract class EwolWallpaper extends WallpaperService implements EwolCallback, EwolConstants -{ - private GLEngine mGLView; - private Ewol m_ewolNative; - - protected 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; - m_ewolNative.paramSetArchiveDir(0, apkFilePath); - } - - @Override public Engine onCreateEngine() { - // set the java evironement in the C sources : - m_ewolNative = new Ewol(this, EWOL_APPL_TYPE_WALLPAPER); - - // Load the application directory - m_ewolNative.paramSetArchiveDir(1, getFilesDir().toString()); - m_ewolNative.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); - //! m_ewolNative.displayPropertyMetrics(metrics.xdpi, metrics.ydpi); - - // call C init ... - m_ewolNative.onCreate(); - - // create bsurface system - mGLView = new GLEngine(m_ewolNative); - - return mGLView; - } - - public class GLEngine extends Engine { - private Ewol m_ewolNative; - public GLEngine(Ewol _ewolInstance) { - m_ewolNative = _ewolInstance; - } - - class WallpaperGLSurfaceView extends EwolSurfaceViewGL { - private static final String TAG = "WallpaperGLSurfaceView"; - WallpaperGLSurfaceView(Context _context, Ewol _ewolInstance) { - super(_context, _ewolInstance); - 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) { - Log.d(TAG, "onCreate(" + _surfaceHolder + ")"); - super.onCreate(_surfaceHolder); - - glSurfaceView = new WallpaperGLSurfaceView(EwolWallpaper.this, m_ewolNative); - - // 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 (supportsEs2 == false) { - 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 onTouchEvent(MotionEvent _event) { - glSurfaceView.onTouchEvent(_event); - } - - @Override public void onVisibilityChanged(boolean _visible) { - Log.d(TAG, "onVisibilityChanged(" + _visible + ")"); - super.onVisibilityChanged(_visible); - if (_visible == true) { - glSurfaceView.onResume(); - // call C - m_ewolNative.onResume(); - } else { - glSurfaceView.onPause(); - // call C - m_ewolNative.onPause(); - } - } - - @Override public void onDestroy() { - Log.d(TAG, "onDestroy()"); - super.onDestroy(); - // call C - m_ewolNative.onStop(); - m_ewolNative.onDestroy(); - glSurfaceView.onDestroy(); - } - - protected void setPreserveEGLContextOnPause(boolean _preserve) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - Log.d(TAG, "setPreserveEGLContextOnPause(" + _preserve + ")"); - glSurfaceView.setPreserveEGLContextOnPause(_preserve); - } - } - - protected void setEGLContextClientVersion(int _version) { - Log.d(TAG, "setEGLContextClientVersion(" + _version + ")"); - glSurfaceView.setEGLContextClientVersion(_version); - } - } - - public void keyboardUpdate(boolean _show) { - // never display keyboard on wallpaer... - Log.d("EwolCallback", "KEABOARD UPDATE is not implemented ..."); - } - - public void eventNotifier(String[] _args) { - // just for the test ... - Log.d("EwolCallback", "EVENT NOTIFIER is not implemented ..."); - - } - - public void orientationUpdate(int _screenMode) { - Log.d("EwolCallback", "SET ORIENTATION is not implemented ..."); - } - - public void titleSet(String _value) { - // no title in the wallpaper ... - Log.d("EwolCallback", "SET TITLE is not implemented ..."); - } - - public void openURI(String _uri) { - try { - Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(_uri)); - startActivity(myIntent); - } catch (ActivityNotFoundException e) { - Log.e("EwolActivity", "Can not request an URL"); - } - } - - public void stop() { - Log.d("EwolCallback", "STOP is not implemented ..."); - } -} - - diff --git a/ewol/context/Application.h b/ewol/context/Application.h index 6d137c21..04ddc12d 100644 --- a/ewol/context/Application.h +++ b/ewol/context/Application.h @@ -13,19 +13,40 @@ namespace ewol { class Context; namespace context { class Application { - protected: - size_t m_nbStepInit; public: - size_t getNbStepInit() { - return m_nbStepInit; - } - public: - Application() : - m_nbStepInit(1) {}; + Application() {}; virtual ~Application() {}; public: - virtual bool init(ewol::Context& _context, size_t _initId) = 0; - virtual void unInit(ewol::Context& _context) = 0; + /** + * @brief The application is created. + * @param[in] _context Current ewol context. + */ + virtual void onCreate(ewol::Context& _context) {}; + /** + * @brief The application is started. + * @param[in] _context Current ewol context. + */ + virtual void onStart(ewol::Context& _context) {}; + /** + * @brief The application is resumed (now visible). + * @param[in] _context Current ewol context. + */ + virtual void onResume(ewol::Context& _context) {}; + /** + * @brief The application is Hide / not visible. + * @param[in] _context Current ewol context. + */ + virtual void onPause(ewol::Context& _context) {}; + /** + * @brief The application is stopped. + * @param[in] _context Current ewol context. + */ + virtual void onStop(ewol::Context& _context) {}; + /** + * @brief The application is remoed (call destructor just adter it.). + * @param[in] _context Current ewol context. + */ + virtual void onDestroy(ewol::Context& _context) {}; }; }; }; diff --git a/ewol/context/Context.cpp b/ewol/context/Context.cpp index 35999c3f..a0f22136 100644 --- a/ewol/context/Context.cpp +++ b/ewol/context/Context.cpp @@ -106,6 +106,10 @@ void ewol::Context::onCreate(gale::Context& _context) { #endif */ EWOL_INFO(" == > Ewol system init (END)"); + if (m_application == nullptr) { + return; + } + m_application->onCreate(*this); } void ewol::Context::onStart(gale::Context& _context) { @@ -113,13 +117,11 @@ void ewol::Context::onStart(gale::Context& _context) { // TODO : Request exit of the application .... with error ... return; } - for (int32_t iii=0; iiigetNbStepInit(); ++iii) { - m_application->init(*this, iii); - } + m_application->onStart(*this); } void ewol::Context::onResume(gale::Context& _context) { - + m_application->onResume(*this); } void ewol::Context::onRegenerateDisplay(gale::Context& _context) { @@ -149,10 +151,11 @@ void ewol::Context::onDraw(gale::Context& _context) { } void ewol::Context::onPause(gale::Context& _context) { + m_application->onPause(*this); } void ewol::Context::onStop(gale::Context& _context) { - m_application->unInit(*this); + m_application->onStop(*this); } void ewol::Context::onDestroy(gale::Context& _context) { @@ -162,11 +165,10 @@ void ewol::Context::onDestroy(gale::Context& _context) { // clean all widget and sub widget with their resources: m_objectManager.cleanInternalRemoved(); // call application to uninit - m_application->unInit(*this); + m_application->onDestroy(*this); m_application.reset(); // internal clean elements m_objectManager.cleanInternalRemoved(); - EWOL_INFO("List of all widget of this context must be equal at 0 ==> otherwise some remove is missing"); m_objectManager.displayListObject(); // now All must be removed !!!