change capacities of the button image && simplify java
This commit is contained in:
parent
8fcd8369cd
commit
67c039f8d6
@ -148,7 +148,7 @@ public class __PROJECT_NAME__ extends Activity {
|
||||
super.onResume();
|
||||
mGLView.onResume();
|
||||
mAudioThread = new Thread(mStreams);
|
||||
if (mAudioThread ~= NULL) {
|
||||
if (mAudioThread != null) {
|
||||
mAudioThread.start();
|
||||
}
|
||||
// call C
|
||||
@ -159,11 +159,13 @@ public class __PROJECT_NAME__ extends Activity {
|
||||
{
|
||||
super.onPause();
|
||||
mGLView.onPause();
|
||||
if (mAudioThread ~= NULL) {
|
||||
if (mAudioThread != null) {
|
||||
// request audio stop
|
||||
mAudioThread.AutoStop();
|
||||
mStreams.AutoStop();
|
||||
// wait the thread ended ...
|
||||
mAudioThread.join();
|
||||
try {
|
||||
mAudioThread.join();
|
||||
} catch(InterruptedException e) { }
|
||||
}
|
||||
// call C
|
||||
interfaceJNI.ActivityOnPause();
|
||||
|
@ -50,12 +50,12 @@ public class interfaceJNI {
|
||||
// Audio section ...
|
||||
public static native void IOAudioPlayback(short[] bufferData, int frames, int nbChannels);
|
||||
|
||||
public static int EWOL_SYSTEM_KEY__VOLUME_UP = 1;
|
||||
public static int EWOL_SYSTEM_KEY__VOLUME_DOWN = 2;
|
||||
public static int EWOL_SYSTEM_KEY__MENU = 3;
|
||||
public static int EWOL_SYSTEM_KEY__CAMERA = 4;
|
||||
public static int EWOL_SYSTEM_KEY__HOME = 5;
|
||||
public static int EWOL_SYSTEM_KEY__POWER = 6;
|
||||
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;
|
||||
public static native void IOKeyboardEventKeySystem(int keyVal, boolean isDown);
|
||||
// renderer Event :
|
||||
public static native void RenderInit();
|
||||
|
@ -73,7 +73,11 @@ void TOOLS_DisplayTime(void)
|
||||
}
|
||||
|
||||
|
||||
#ifdef __PLATFORM__Android
|
||||
etk::logLevel_te g_requestedLevel = etk::LOG_LEVEL_VERBOSE;
|
||||
#else
|
||||
etk::logLevel_te g_requestedLevel = etk::LOG_LEVEL_ERROR;
|
||||
#endif
|
||||
void GeneralDebugSetLevel(etk::logLevel_te ccc) {
|
||||
g_requestedLevel = etk::LOG_LEVEL_VERBOSE;
|
||||
g_requestedLevel = ccc;
|
||||
}
|
@ -41,7 +41,7 @@ void ewol::WIDGET_ButtonImageInit(void)
|
||||
#undef __class__
|
||||
#define __class__ "ButtonImage"
|
||||
|
||||
ewol::ButtonImage::ButtonImage(etk::UString newLabel)
|
||||
ewol::ButtonImage::ButtonImage(etk::UString imageName)
|
||||
{
|
||||
AddEventId(ewolEventButtonPressed);
|
||||
AddEventId(ewolEventButtonDown);
|
||||
@ -53,12 +53,14 @@ ewol::ButtonImage::ButtonImage(etk::UString newLabel)
|
||||
m_over = false;
|
||||
m_down = false;
|
||||
m_value = false;
|
||||
m_image = imageName;
|
||||
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
||||
m_OOImage[iii] = NULL;
|
||||
m_OOImageBg1[iii] = NULL;
|
||||
m_OOImageBG2[iii] = NULL;
|
||||
m_resetNeeded[iii] = false;
|
||||
}
|
||||
m_toggleMode = false;
|
||||
}
|
||||
|
||||
|
||||
@ -134,12 +136,29 @@ const char * const ewol::ButtonImage::GetObjectType(void)
|
||||
|
||||
void ewol::ButtonImage::SetValue(bool val)
|
||||
{
|
||||
|
||||
if (true == m_toggleMode) {
|
||||
m_value = val;
|
||||
MarkToReedraw();
|
||||
}
|
||||
}
|
||||
|
||||
bool ewol::ButtonImage::GetValue(void)
|
||||
{
|
||||
return false;
|
||||
return m_value;
|
||||
}
|
||||
|
||||
void ewol::ButtonImage::SetToggleMode(bool val)
|
||||
{
|
||||
m_toggleMode = val;
|
||||
if (m_toggleMode == false) {
|
||||
m_value = false;
|
||||
}
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
bool ewol::ButtonImage::GetToggleMode(void)
|
||||
{
|
||||
return m_toggleMode;
|
||||
}
|
||||
|
||||
|
||||
@ -222,21 +241,29 @@ bool ewol::ButtonImage::OnEventInput(ewol::inputType_te type, int32_t IdInput, e
|
||||
//EWOL_DEBUG("Event on BT ...");
|
||||
if (1 == IdInput) {
|
||||
if(ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {
|
||||
GenerateEventId(ewolEventButtonDown);
|
||||
m_down = true;
|
||||
m_value = true;
|
||||
if (false == m_toggleMode) {
|
||||
m_value = true;
|
||||
}
|
||||
|
||||
GenerateEventId(ewolEventButtonDown, (m_value)?"true":"false");
|
||||
MarkToReedraw();
|
||||
}
|
||||
if(ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
GenerateEventId(ewolEventButtonUp);
|
||||
m_down = false;
|
||||
m_value = false;
|
||||
if (false == m_toggleMode) {
|
||||
m_value = false;
|
||||
}
|
||||
GenerateEventId(ewolEventButtonUp, (m_value)?"true":"false");
|
||||
MarkToReedraw();
|
||||
}
|
||||
if( ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent
|
||||
|| ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent
|
||||
|| ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) {
|
||||
GenerateEventId(ewolEventButtonPressed);
|
||||
if (true == m_toggleMode) {
|
||||
m_value = (true==m_value) ? false : true;
|
||||
}
|
||||
GenerateEventId(ewolEventButtonPressed, (m_value)?"true":"false");
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
@ -281,9 +308,23 @@ bool ewol::ButtonImage::OnEventInput(ewol::inputType_te type, int32_t IdInput, e
|
||||
bool ewol::ButtonImage::OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData)
|
||||
{
|
||||
//EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data));
|
||||
if( typeEvent == ewol::EVENT_KB_TYPE_DOWN
|
||||
&& unicodeData == '\r') {
|
||||
GenerateEventId(ewolEventButtonEnter);
|
||||
if (unicodeData == '\r') {
|
||||
if(typeEvent == ewol::EVENT_KB_TYPE_DOWN) {
|
||||
m_down = true;
|
||||
if (false == m_toggleMode) {
|
||||
m_value = true;
|
||||
GenerateEventId(ewolEventButtonEnter, (m_value)?"true":"false");
|
||||
}
|
||||
} else if(typeEvent == ewol::EVENT_KB_TYPE_UP) {
|
||||
m_down = false;
|
||||
if (false == m_toggleMode) {
|
||||
m_value = false;
|
||||
GenerateEventId(ewolEventButtonEnter, (m_value)?"true":"false");
|
||||
} else {
|
||||
m_value = (true==m_value) ? false : true;
|
||||
GenerateEventId(ewolEventButtonEnter, (m_value)?"true":"false");
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -57,6 +57,8 @@ namespace ewol {
|
||||
void SetImageSelected(etk::UString imageName);
|
||||
void SetValue(bool val);
|
||||
bool GetValue(void);
|
||||
void SetToggleMode(bool val);
|
||||
bool GetToggleMode(void);
|
||||
private:
|
||||
etk::UString m_image;
|
||||
bool m_resetNeeded[NB_BOUBLE_BUFFER];
|
||||
@ -68,6 +70,7 @@ namespace ewol {
|
||||
bool m_over;
|
||||
bool m_down;
|
||||
bool m_value;
|
||||
bool m_toggleMode;
|
||||
public:
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user