[DEV] correct all android errors

This commit is contained in:
Edouard DUPIN 2015-06-26 22:07:50 +02:00
parent c2733cadb6
commit 471d51eddb
6 changed files with 66 additions and 53 deletions

View File

@ -112,11 +112,11 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
// Remove the title of the current display :
requestWindowFeature(Window.FEATURE_NO_TITLE);
// set full screen Mode :
// 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 :
// hide keyboard:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
// create bsurface system
@ -126,38 +126,50 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
}
@Override protected void onStart() {
Log.w("EwolActivity", "onStart (START)");
super.onStart();
EWOL.onStart();
Log.w("EwolActivity", "onStart (STOP)");
}
@Override protected void onRestart() {
Log.w("EwolActivity", "onRestart (START)");
super.onRestart();
EWOL.onReStart();
Log.w("EwolActivity", "onRestart (STOP)");
}
@Override protected void onResume() {
Log.w("EwolActivity", "onResume (START)");
super.onResume();
mGLView.onResume();
EWOL.onResume();
Log.w("EwolActivity", "onResume (STOP)");
}
@Override protected void onPause() {
Log.w("EwolActivity", "onPause (START)");
super.onPause();
mGLView.onPause();
EWOL.onPause();
Log.w("EwolActivity", "onPause (STOP)");
}
@Override protected void onStop() {
Log.w("EwolActivity", "onStop (START)");
super.onStop();
// call C
EWOL.onStop();
Log.w("EwolActivity", "onStop (STOP)");
}
@Override protected void onDestroy() {
Log.w("EwolActivity", "onDestroy (START)");
super.onDestroy();
// call C
EWOL.onDestroy();
// Remove the java Virtual machine pointer form the C code
EWOL.setJavaVirtualMachineStop();
Log.w("EwolActivity", "onDestroy (STOP)");
}
@Override protected void finalize() throws Throwable {
@ -252,8 +264,10 @@ public abstract class EwolActivity extends Activity implements EwolCallback, Ewo
}
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

View File

@ -271,26 +271,24 @@ public class EwolSurfaceViewGL extends GLSurfaceView implements EwolConstants {
case KeyEvent.KEYCODE_META_RIGHT: EWOL.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_RIGHT: EWOL.keyboardEventMove(EWOL_MOVE_KEY_ALT_GR, isDown); return true;
//case KeyEvent.KEYCODE_MENU: EWOL.keyboardEventMove(EWOL_MOVE_KEY_CONTEXT_MENU, isDown); return true;
case KeyEvent.KEYCODE_NUM_LOCK: EWOL.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 ...
EWOL.keyboardEventKey(uchar, isDown);
return true;
if ( (actionDone == KeyEvent.ACTION_DOWN)
|| (actionDone == KeyEvent.ACTION_MULTIPLE)
|| (actionDone == KeyEvent.ACTION_UP)) {
// convert the key in UniChar to prevent errors ...
int uchar = event.getUnicodeChar();
// pb on the return methode ... in java it is like windows ...
if (uchar == '\r') {
uchar = '\n';
}
// send it to ewol ...
EWOL.keyboardEventKey(uchar, isDown);
return true;
}
return false;
}

View File

@ -302,30 +302,6 @@ namespace ewol {
* @return The curent time of the process
*/
static int64_t getTime();
#if defined(__TARGET_OS__Android)
public:
typedef void (*AndroidAudioCallback)(void* _data,
int32_t _size,
void* _userData);
// Android specific audio interface :
virtual int32_t audioGetDeviceCount() {
return 0;
}
virtual std::string audioGetDeviceProperty(int32_t _idDevice) {
return "";
}
virtual bool audioOpenDevice(int32_t _idDevice,
int32_t _freq,
int32_t _nbChannel,
int32_t _format,
AndroidAudioCallback _callback,
void* _userData) {
return false;
}
virtual bool audioCloseDevice(int32_t _idDevice) {
return false;
}
#endif
private:
// TODO : set user argument here ....

View File

@ -295,6 +295,5 @@ void ewol::widget::Windows::sysOnKill() {
if (onKill() == true) {
getContext().stop();
}
}

View File

@ -42,7 +42,8 @@ namespace ewol {
virtual void onShow() { };
virtual void onHide() { };
virtual bool onKill() {
return true;
// TODO : Check this in speck for android ...
return false;
};
virtual void onReduce() { };
virtual void onStateBackground() {};

View File

@ -317,12 +317,12 @@ def tool_generate_main_java_class(target, module, package_name):
tmpFile.write( " return tmpEngine;\n")
tmpFile.write( " }\n")
tmpFile.write( " public " + application_name + "() {\n")
if "GENERATE_SECTION__CONSTRUCTOR" in module.package_prop:
tmpFile.write( " public " + application_name + "() {\n")
for elem in module.package_prop["GENERATE_SECTION__CONSTRUCTOR"]:
for line in elem:
tmpFile.write( " " + line + "\n")
tmpFile.write( " }\n")
tmpFile.write( " }\n")
tmpFile.write( " public void onCreate(android.os.Bundle savedInstanceState) {\n")
tmpFile.write( " super.onCreate(savedInstanceState);\n")
@ -334,29 +334,54 @@ def tool_generate_main_java_class(target, module, package_name):
tmpFile.write( " " + line + "\n")
tmpFile.write( " }\n")
tmpFile.write( " @Override protected void onResume() {\n")
tmpFile.write( " super.onResume();\n")
if "GENERATE_SECTION__ON_START" in module.package_prop:
tmpFile.write( " @Override protected void onStart() {\n")
for elem in module.package_prop["GENERATE_SECTION__ON_START"]:
for line in elem:
tmpFile.write( " " + line + "\n")
tmpFile.write( " super.onStart();\n")
tmpFile.write( " }\n")
if "GENERATE_SECTION__ON_RESTART" in module.package_prop:
tmpFile.write( " @Override protected void onRestart() {\n")
for elem in module.package_prop["GENERATE_SECTION__ON_RESTART"]:
for line in elem:
tmpFile.write( " " + line + "\n")
tmpFile.write( " super.onRestart();\n")
tmpFile.write( " }\n")
if "GENERATE_SECTION__ON_RESUME" in module.package_prop:
tmpFile.write( " @Override protected void onResume() {\n")
tmpFile.write( " super.onResume();\n")
for elem in module.package_prop["GENERATE_SECTION__ON_RESUME"]:
for line in elem:
tmpFile.write( " " + line + "\n")
tmpFile.write( " }\n")
tmpFile.write( " }\n")
tmpFile.write( " @Override protected void onPause() {\n")
if "GENERATE_SECTION__ON_PAUSE" in module.package_prop:
tmpFile.write( " @Override protected void onPause() {\n")
for elem in module.package_prop["GENERATE_SECTION__ON_PAUSE"]:
for line in elem:
tmpFile.write( " " + line + "\n")
tmpFile.write( " super.onPause();\n")
tmpFile.write( " }\n")
tmpFile.write( " super.onPause();\n")
tmpFile.write( " }\n")
if "GENERATE_SECTION__ON_STOP" in module.package_prop:
tmpFile.write( " @Override protected void onStop() {\n")
for elem in module.package_prop["GENERATE_SECTION__ON_STOP"]:
for line in elem:
tmpFile.write( " " + line + "\n")
tmpFile.write( " super.onStop();\n")
tmpFile.write( " }\n")
tmpFile.write( " @Override protected void onDestroy() {\n")
if "GENERATE_SECTION__ON_DESTROY" in module.package_prop:
tmpFile.write( " @Override protected void onDestroy() {\n")
for elem in module.package_prop["GENERATE_SECTION__ON_DESTROY"]:
for line in elem:
tmpFile.write( " " + line + "\n")
tmpFile.write( " super.onDestroy();\n")
tmpFile.write( " }\n")
tmpFile.write( " super.onDestroy();\n")
tmpFile.write( " }\n")
tmpFile.write( "}\n")
tmpFile.flush()
tmpFile.close()