diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2018-06-23 10:06:04 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2018-06-23 10:06:04 +0000 |
| commit | f827a9eaf3dbde8c773c6703c43bb0f7b1f41598 (patch) | |
| tree | 03bb363c30b3dc229faf7de41c5104f0229f7c16 /src/drivers | |
| parent | 1690585b49f0e047627f04f2c7ffc4a077254f39 (diff) | |
Android: fixed fl_beep to plat different sound for differen beep types, testing Doxygen to generate driver developer documentation
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12965 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/Android/Fl_Android_Screen_Driver.cxx | 68 |
1 files changed, 53 insertions, 15 deletions
diff --git a/src/drivers/Android/Fl_Android_Screen_Driver.cxx b/src/drivers/Android/Fl_Android_Screen_Driver.cxx index a7476c94e..c2e4f7192 100644 --- a/src/drivers/Android/Fl_Android_Screen_Driver.cxx +++ b/src/drivers/Android/Fl_Android_Screen_Driver.cxx @@ -31,6 +31,22 @@ #include <math.h> +/** + * \cond AndroidDev + * \defgroup AndroidDeveloper Android Develoer Documentation + * @{ + */ + + +/** + * \class Fl_Android_Screen_Driver + * + * Handle Android screen devices. + * + * \todo This calss is in an early development stage + */ + + static void nothing() {} void (*fl_unlock_function)() = nothing; void (*fl_lock_function)() = nothing; @@ -147,16 +163,16 @@ int Fl_Android_Screen_Driver::handle_mouse_event(AInputQueue *queue, AInputEvent if (AMotionEvent_getAction(event) == AMOTION_EVENT_ACTION_DOWN) { AInputQueue_finishEvent(queue, event, 1); Fl::e_is_click = 1; - Fl_Android_Application::log_i("Mouse push %x %d at %d, %d", win, Fl::event_button(), Fl::event_x(), Fl::event_y()); +// Fl_Android_Application::log_i("Mouse push %x %d at %d, %d", win, Fl::event_button(), Fl::event_x(), Fl::event_y()); if (win) Fl::handle(FL_PUSH, win); // do NOT send a push event into the "Desktop" } else if (AMotionEvent_getAction(event) == AMOTION_EVENT_ACTION_MOVE) { AInputQueue_finishEvent(queue, event, 1); - Fl_Android_Application::log_i("Mouse drag %x %d at %d, %d", win, Fl::event_button(), Fl::event_x(), Fl::event_y()); +// Fl_Android_Application::log_i("Mouse drag %x %d at %d, %d", win, Fl::event_button(), Fl::event_x(), Fl::event_y()); if (win) Fl::handle(FL_DRAG, win); } else if (AMotionEvent_getAction(event) == AMOTION_EVENT_ACTION_UP) { AInputQueue_finishEvent(queue, event, 1); Fl::e_state = 0; - Fl_Android_Application::log_i("Mouse release %x %d at %d, %d", win, Fl::event_button(), Fl::event_x(), Fl::event_y()); +// Fl_Android_Application::log_i("Mouse release %x %d at %d, %d", win, Fl::event_button(), Fl::event_x(), Fl::event_y()); if (win) Fl::handle(FL_RELEASE, win); } else { AInputQueue_finishEvent(queue, event, 0); @@ -283,9 +299,12 @@ double Fl_Android_Screen_Driver::wait(double time_to_wait) return 0.0; } + /** * On Android, we currently write into a memory buffer and copy * the content to the screen. + * + * @see Fl_Screen_Driver::flush() */ void Fl_Android_Screen_Driver::flush() { @@ -297,6 +316,7 @@ void Fl_Android_Screen_Driver::flush() } } + // ---- timers ----------------------------------------------------------------- @@ -383,7 +403,7 @@ void Fl_Android_Screen_Driver::repeat_timeout(double time, Fl_Timeout_Handler cb timerIndex = nTimerData++; } - // if that didn;t work either, we ran out of timers + // if that didn't work either, we ran out of timers if (timerIndex==-1) { Fl::error("FLTK ran out of timer slots."); return; @@ -444,17 +464,26 @@ void Fl_Android_Screen_Driver::remove_timeout(Fl_Timeout_Handler cb, void *data) } +/** + * Play some system sound. + * + * This function plays some rather arbitrary system sounds. + * + * @param type + * + * @see Fl_Screen_Driver::beep(int) + * @see fl_beep(int) + */ void Fl_Android_Screen_Driver::beep(int type) { - // TODO: map FLTK sounds to Android sounds at https://developer.android.com/reference/android/media/ToneGenerator - int androidSoundID = 93; // TONE_CDMA_ALERT_CALL_GUARD + int androidSoundID = 93; // default to TONE_CDMA_ALERT_CALL_GUARD switch (type) { - case FL_BEEP_DEFAULT: - case FL_BEEP_MESSAGE: - case FL_BEEP_ERROR: - case FL_BEEP_QUESTION: - case FL_BEEP_PASSWORD: - case FL_BEEP_NOTIFICATION: androidSoundID = 93; break; + case FL_BEEP_DEFAULT: androidSoundID = 92; break; + case FL_BEEP_MESSAGE: androidSoundID = 86; break; + case FL_BEEP_ERROR: androidSoundID = 87; break; + case FL_BEEP_QUESTION: androidSoundID = 91; break; + case FL_BEEP_PASSWORD: androidSoundID = 95; break; + case FL_BEEP_NOTIFICATION: androidSoundID = 93; break; } Fl_Android_Java java; if (java.is_attached()) { @@ -473,11 +502,12 @@ void Fl_Android_Screen_Driver::beep(int type) jmethodID method_start_tone = java.env()->GetMethodID( class_tone_generator, "startTone", - "(I)Z"); + "(II)Z"); java.env()->CallBooleanMethod( toneGeneratorObj, method_start_tone, - androidSoundID); + androidSoundID, + 1000); java.env()->DeleteLocalRef(class_tone_generator); java.env()->DeleteLocalRef(toneGeneratorObj); @@ -485,6 +515,7 @@ void Fl_Android_Screen_Driver::beep(int type) } + /** * Get the current mouse coordinates. * @@ -493,7 +524,8 @@ void Fl_Android_Screen_Driver::beep(int type) * touch screen, this makes no sense at all, which is why we return the center * of the screen for now. * - * TODO: rethink the dialog positioning scheme for touch devices. + * \todo rethink the dialog positioning scheme for touch devices. + * \fixme this method assumes a fixed screen resolution * * @param [out] x * @param [out] y @@ -522,6 +554,12 @@ void Fl_Android_Screen_Driver::grab(Fl_Window* win) } +/** + * \} + * \endcond AndroidDev + */ + + // // End of "$Id$". // |
