From 03db326c64b246974d9cfaba02406d7bd77d8c37 Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Wed, 5 Feb 2014 08:02:06 -0600 Subject: Expansion of vibrate options Improve location / timing of vibration Split out vibrate settings for buttons, keyboard, and long actions Change-Id: I282825cc5f3e44ed6dcabe65dc1f4cb21b407b67 --- data.cpp | 4 ++- gui/action.cpp | 2 +- gui/button.cpp | 2 +- gui/devices/1024x600/res/ui.xml | 67 ++++++++++++++++++++++++++++++++++++---- gui/devices/1024x768/res/ui.xml | 67 ++++++++++++++++++++++++++++++++++++---- gui/devices/1080x1920/res/ui.xml | 20 ++++++++++-- gui/devices/1200x1920/res/ui.xml | 57 +++++++++++++++++++++++++++++++++- gui/devices/1280x800/res/ui.xml | 67 ++++++++++++++++++++++++++++++++++++---- gui/devices/1920x1200/res/ui.xml | 67 ++++++++++++++++++++++++++++++++++++---- gui/devices/2560x1600/res/ui.xml | 67 ++++++++++++++++++++++++++++++++++++---- gui/devices/320x480/res/ui.xml | 57 +++++++++++++++++++++++++++++++++- gui/devices/480x800/res/ui.xml | 57 +++++++++++++++++++++++++++++++++- gui/devices/480x854/res/ui.xml | 57 +++++++++++++++++++++++++++++++++- gui/devices/540x960/res/ui.xml | 57 +++++++++++++++++++++++++++++++++- gui/devices/720x1280/res/ui.xml | 57 +++++++++++++++++++++++++++++++++- gui/devices/800x1280/res/ui.xml | 57 +++++++++++++++++++++++++++++++++- gui/devices/800x480/res/ui.xml | 67 ++++++++++++++++++++++++++++++++++++---- gui/keyboard.cpp | 4 +-- gui/slider.cpp | 5 +-- 19 files changed, 786 insertions(+), 52 deletions(-) diff --git a/data.cpp b/data.cpp index 0d490a978..230ac73e6 100644 --- a/data.cpp +++ b/data.cpp @@ -583,7 +583,9 @@ void DataManager::SetDefaultValues() mConstValues.insert(make_pair(TW_VERSION_VAR, TW_VERSION_STR)); mValues.insert(make_pair("tw_storage_path", make_pair("/", 1))); - mValues.insert(make_pair("tw_vibrate", make_pair("80", 1))); + mValues.insert(make_pair("tw_button_vibrate", make_pair("80", 1))); + mValues.insert(make_pair("tw_keyboard_vibrate", make_pair("40", 1))); + mValues.insert(make_pair("tw_action_vibrate", make_pair("160", 1))); #ifdef TW_FORCE_CPUINFO_FOR_DEVICE_ID printf("TW_FORCE_CPUINFO_FOR_DEVICE_ID := true\n"); diff --git a/gui/action.cpp b/gui/action.cpp index 8539386a0..9c785d169 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -348,7 +348,7 @@ void GUIAction::operation_end(const int operation_status, const int simulate) #endif time(&Stop); if ((int) difftime(Stop, Start) > 10) - DataManager::Vibrate("tw_vibrate"); + DataManager::Vibrate("tw_action_vibrate"); } int GUIAction::doAction(Action action, int isThreaded /* = 0 */) diff --git a/gui/button.cpp b/gui/button.cpp index ca386beed..b14e6754c 100644 --- a/gui/button.cpp +++ b/gui/button.cpp @@ -281,7 +281,7 @@ int GUIButton::NotifyTouch(TOUCH_STATE state, int x, int y) } else { if (last_state == 0) { last_state = 1; - DataManager::Vibrate("tw_vibrate"); + DataManager::Vibrate("tw_button_vibrate"); if (mButtonLabel != NULL) mButtonLabel->isHighlighted = true; if (mButtonImg != NULL) diff --git a/gui/devices/1024x600/res/ui.xml b/gui/devices/1024x600/res/ui.xml index 569a5bd1f..f1ec1443e 100755 --- a/gui/devices/1024x600/res/ui.xml +++ b/gui/devices/1024x600/res/ui.xml @@ -2430,20 +2430,29 @@ - + - Screen + Restore Defaults - screen + - + - Restore Defaults + Vibration Duration - + Vibrate + + + + + + + Screen + + screen @@ -2652,6 +2661,52 @@ + + + + + + + Vibration Settings : + + + + + + Button Vibration: + + + + + + + + Keyboard Vibration: + + + + + + + + Action Vibration: + + + + + + + main + + + + + settings + + + + + diff --git a/gui/devices/1024x768/res/ui.xml b/gui/devices/1024x768/res/ui.xml index 6f8797a74..73b531b4e 100644 --- a/gui/devices/1024x768/res/ui.xml +++ b/gui/devices/1024x768/res/ui.xml @@ -2430,20 +2430,29 @@ - + - Screen + Restore Defaults - screen + - + - Restore Defaults + Vibration Duration - + Vibrate + + + + + + + Screen + + screen @@ -2652,6 +2661,52 @@ + + + + + + + Vibration Settings : + + + + + + Button Vibration: + + + + + + + + Keyboard Vibration: + + + + + + + + Action Vibration: + + + + + + + main + + + + + settings + + + + + diff --git a/gui/devices/1080x1920/res/ui.xml b/gui/devices/1080x1920/res/ui.xml index 0f61faca7..15b98787b 100644 --- a/gui/devices/1080x1920/res/ui.xml +++ b/gui/devices/1080x1920/res/ui.xml @@ -2684,8 +2684,24 @@ - Vibration Value : - + Button Vibration: + + + + + + + + Keyboard Vibration: + + + + + + + + Action Vibration: + diff --git a/gui/devices/1200x1920/res/ui.xml b/gui/devices/1200x1920/res/ui.xml index a83c30bb7..c77c3414d 100644 --- a/gui/devices/1200x1920/res/ui.xml +++ b/gui/devices/1200x1920/res/ui.xml @@ -2459,7 +2459,16 @@ - + + + + Vibration Duration + + Vibrate + + + + Restore Defaults @@ -2666,6 +2675,52 @@ + + + + + + + Vibration Settings : + + + + + + Button Vibration: + + + + + + + + Keyboard Vibration: + + + + + + + + Action Vibration: + + + + + + + main + + + + + settings + + + + + diff --git a/gui/devices/1280x800/res/ui.xml b/gui/devices/1280x800/res/ui.xml index 115a391eb..dbfcd60ca 100644 --- a/gui/devices/1280x800/res/ui.xml +++ b/gui/devices/1280x800/res/ui.xml @@ -2430,20 +2430,29 @@ - + - Screen + Restore Defaults - screen + - + - Restore Defaults + Vibration Duration - + Vibrate + + + + + + + Screen + + screen @@ -2652,6 +2661,52 @@ + + + + + + + Vibration Settings : + + + + + + Button Vibration: + + + + + + + + Keyboard Vibration: + + + + + + + + Action Vibration: + + + + + + + main + + + + + settings + + + + + diff --git a/gui/devices/1920x1200/res/ui.xml b/gui/devices/1920x1200/res/ui.xml index fb615c135..e4bfd6928 100644 --- a/gui/devices/1920x1200/res/ui.xml +++ b/gui/devices/1920x1200/res/ui.xml @@ -2430,20 +2430,29 @@ - + - Screen + Restore Defaults - screen + - + - Restore Defaults + Vibration Duration - + Vibrate + + + + + + + Screen + + screen @@ -2652,6 +2661,52 @@ + + + + + + + Vibration Settings : + + + + + + Button Vibration: + + + + + + + + Keyboard Vibration: + + + + + + + + Action Vibration: + + + + + + + main + + + + + settings + + + + + diff --git a/gui/devices/2560x1600/res/ui.xml b/gui/devices/2560x1600/res/ui.xml index 9ce330a44..f53f7b412 100644 --- a/gui/devices/2560x1600/res/ui.xml +++ b/gui/devices/2560x1600/res/ui.xml @@ -2430,20 +2430,29 @@ - + - Screen + Restore Defaults - screen + - + - Restore Defaults + Vibration Duration - + Vibrate + + + + + + + Screen + + screen @@ -2652,6 +2661,52 @@ + + + + + + + Vibration Settings : + + + + + + Button Vibration: + + + + + + + + Keyboard Vibration: + + + + + + + + Action Vibration: + + + + + + + main + + + + + settings + + + + + diff --git a/gui/devices/320x480/res/ui.xml b/gui/devices/320x480/res/ui.xml index dbee885a7..9f0d5a391 100644 --- a/gui/devices/320x480/res/ui.xml +++ b/gui/devices/320x480/res/ui.xml @@ -2443,7 +2443,16 @@ - + + + + Vibration Duration + + Vibrate + + + + Restore Defaults @@ -2650,6 +2659,52 @@ + + + + + + + Vibration Settings : + + + + + + Button Vibration: + + + + + + + + Keyboard Vibration: + + + + + + + + Action Vibration: + + + + + + + main + + + + + settings + + + + + diff --git a/gui/devices/480x800/res/ui.xml b/gui/devices/480x800/res/ui.xml index bb90e70b4..416f6b941 100644 --- a/gui/devices/480x800/res/ui.xml +++ b/gui/devices/480x800/res/ui.xml @@ -2443,7 +2443,16 @@ - + + + + Vibration Duration + + Vibrate + + + + Restore Defaults @@ -2650,6 +2659,52 @@ + + + + + + + Vibration Settings : + + + + + + Button Vibration: + + + + + + + + Keyboard Vibration: + + + + + + + + Action Vibration: + + + + + + + main + + + + + settings + + + + + diff --git a/gui/devices/480x854/res/ui.xml b/gui/devices/480x854/res/ui.xml index 08c3ddcfe..687300ab2 100644 --- a/gui/devices/480x854/res/ui.xml +++ b/gui/devices/480x854/res/ui.xml @@ -2442,7 +2442,16 @@ - + + + + Vibration Duration + + Vibrate + + + + Restore Defaults @@ -2649,6 +2658,52 @@ + + + + + + + Vibration Settings : + + + + + + Button Vibration: + + + + + + + + Keyboard Vibration: + + + + + + + + Action Vibration: + + + + + + + main + + + + + settings + + + + + diff --git a/gui/devices/540x960/res/ui.xml b/gui/devices/540x960/res/ui.xml index e03704eef..b11c3dc13 100644 --- a/gui/devices/540x960/res/ui.xml +++ b/gui/devices/540x960/res/ui.xml @@ -2443,7 +2443,16 @@ - + + + + Vibration Duration + + Vibrate + + + + Restore Defaults @@ -2650,6 +2659,52 @@ + + + + + + + Vibration Settings : + + + + + + Button Vibration: + + + + + + + + Keyboard Vibration: + + + + + + + + Action Vibration: + + + + + + + main + + + + + settings + + + + + diff --git a/gui/devices/720x1280/res/ui.xml b/gui/devices/720x1280/res/ui.xml index c9a4c0a69..573bebde6 100644 --- a/gui/devices/720x1280/res/ui.xml +++ b/gui/devices/720x1280/res/ui.xml @@ -2456,7 +2456,16 @@ - + + + + Vibration Duration + + Vibrate + + + + Restore Defaults @@ -2663,6 +2672,52 @@ + + + + + + + Vibration Settings : + + + + + + Button Vibration: + + + + + + + + Keyboard Vibration: + + + + + + + + Action Vibration: + + + + + + + main + + + + + settings + + + + + diff --git a/gui/devices/800x1280/res/ui.xml b/gui/devices/800x1280/res/ui.xml index 9b7a06315..fd63d9015 100755 --- a/gui/devices/800x1280/res/ui.xml +++ b/gui/devices/800x1280/res/ui.xml @@ -2444,7 +2444,16 @@ - + + + + Vibration Duration + + Vibrate + + + + Restore Defaults @@ -2651,6 +2660,52 @@ + + + + + + + Vibration Settings : + + + + + + Button Vibration: + + + + + + + + Keyboard Vibration: + + + + + + + + Action Vibration: + + + + + + + main + + + + + settings + + + + + diff --git a/gui/devices/800x480/res/ui.xml b/gui/devices/800x480/res/ui.xml index 9c391b33e..87a354389 100755 --- a/gui/devices/800x480/res/ui.xml +++ b/gui/devices/800x480/res/ui.xml @@ -2438,20 +2438,29 @@ - + - Screen + Restore Defaults - screen + - + - Restore Defaults + Vibration Duration - + Vibrate + + + + + + + Screen + + screen @@ -2660,6 +2669,52 @@ + + + + + + + Vibration Settings : + + + + + + Button Vibration: + + + + + + + + Keyboard Vibration: + + + + + + + + Action Vibration: + + + + + + + main + + + + + settings + + + + + diff --git a/gui/keyboard.cpp b/gui/keyboard.cpp index 97a980a4e..36106c7c1 100644 --- a/gui/keyboard.cpp +++ b/gui/keyboard.cpp @@ -389,7 +389,6 @@ int GUIKeyboard::NotifyTouch(TOUCH_STATE state, int x, int y) switch (state) { case TOUCH_START: - DataManager::Vibrate("tw_vibrate"); if (GetSelection(x, y) == 0) { startSelection = -1; was_held = 0; @@ -421,7 +420,6 @@ int GUIKeyboard::NotifyTouch(TOUCH_STATE state, int x, int y) if (highlightRenderCount != 0) mRendered = false; highlightRenderCount = 0; - DataManager::Vibrate("tw_vibrate"); startSelection = 0; } break; @@ -478,6 +476,7 @@ int GUIKeyboard::NotifyTouch(TOUCH_STATE state, int x, int y) startSelection = 0; break; } else if (state == TOUCH_RELEASE && was_held == 0) { + DataManager::Vibrate("tw_keyboard_vibrate"); if ((int)keyboard_keys[currentLayout - 1][rowIndex][indexx].key < KEYBOARD_SPECIAL_KEYS && (int)keyboard_keys[currentLayout - 1][rowIndex][indexx].key > 0) { // Regular key PageManager::NotifyKeyboard(keyboard_keys[currentLayout - 1][rowIndex][indexx].key); @@ -503,6 +502,7 @@ int GUIKeyboard::NotifyTouch(TOUCH_STATE state, int x, int y) PageManager::NotifyKeyboard(keyboard_keys[currentLayout - 1][rowIndex][indexx].key); } else if ((int)keyboard_keys[currentLayout - 1][rowIndex][indexx].longpresskey < KEYBOARD_SPECIAL_KEYS && (int)keyboard_keys[currentLayout - 1][rowIndex][indexx].longpresskey > 0) { // Long Press Key + DataManager::Vibrate("tw_keyboard_vibrate"); PageManager::NotifyKeyboard(keyboard_keys[currentLayout - 1][rowIndex][indexx].longpresskey); } } else if (state == TOUCH_REPEAT) { diff --git a/gui/slider.cpp b/gui/slider.cpp index 3908b82ab..af0c542de 100644 --- a/gui/slider.cpp +++ b/gui/slider.cpp @@ -154,12 +154,13 @@ int GUISlider::NotifyTouch(TOUCH_STATE state, int x, int y) break; case TOUCH_RELEASE: - DataManager::Vibrate("tw_button_vibrate"); if (!dragging) return 0; - if (sCurTouchX >= mRenderX + mRenderW - sTouchW) + if (sCurTouchX >= mRenderX + mRenderW - sTouchW) { + DataManager::Vibrate("tw_button_vibrate"); sAction->doActions(); + } sCurTouchX = mRenderX; dragging = false; -- cgit v1.2.3