-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2. Removed descriptions of Android R 3. Updated readme
- Loading branch information
Showing
10 changed files
with
44 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,32 @@ | ||
# AndroidHapticFeedbackTest | ||
An app to test haptic feedback on Android. If you need to compose haptics feedbacks or vibration effects, this app is a good start. | ||
An app to test haptic feedbacks on Android. If you need to compose haptic feedbacks or vibration effects, this app is a good start. | ||
|
||
Note that haptics feedbacks and vibration effects behave dramatically differently on devices from different vendors with Pixel series showing the best behaviors. Be sure to test on the devices that your products will support and this is the main reason why I started this app. | ||
Note that haptic feedbacks and vibration effects behave dramatically differently on devices from different vendors with Pixel series showing the best behaviors. Be sure to test on the devices that your products will support and this is the main reason why I started this app. | ||
|
||
## Read First | ||
There are official Android documents talking about haptics in detail: [Haptics](https://source.android.com/devices/input/haptics). You should read them first to know the basics about haptics and what you can do with those APIs, before using this app to get hands on the actual feeling of the haptics. | ||
|
||
There are three ways to orchestrate haptic patterns: | ||
- **Haptic Feedback**: suitable for input events (like long press, or swipe), or UI elements (like keyboard). | ||
- **OneShot & Waveform**: suitable for more refined vibration patterns that last over time. | ||
- **Composition**: According to the documents, compositions enable stringing together sequences of more nuanced haptics or vibarations. However, none of the devices I tested supports this feature including Pixel 5, so in this app you can only try the primitive haptics instead of composing them. | ||
|
||
## Haptics | ||
- Uses [View#performHapticFeedback](https://developer.android.com/reference/android/view/View#performHapticFeedback(int)). | ||
- You can test each one of [HapticFeedbackConstants](https://developer.android.com/reference/android/view/HapticFeedbackConstants). | ||
- You can test hidden haptics using HapticFeedback ID (can be found in the HapticFeedbackConstants.java, such as [this one](https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/view/HapticFeedbackConstants.java)). | ||
|
||
1. Uses [View#performHapticFeedback](https://developer.android.com/reference/android/view/View#performHapticFeedback(int)) | ||
2. You can test each one of [HapticFeedbackConstants](https://developer.android.com/reference/android/view/HapticFeedbackConstants) | ||
3. You can test hidden haptics using HapticFeedback ID (can be found in the HapticFeedbackConstants.java, such as [this one](https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/view/HapticFeedbackConstants.java)) | ||
## OneShot & Waveform | ||
- Uses [VibrationEffect](https://developer.android.com/reference/android/os/VibrationEffect). | ||
- Supports OneShot, Predefined and Waveform effects. | ||
|
||
## Vibrator | ||
1. Uses [Vibrator](https://developer.android.com/reference/android/os/Vibrator) | ||
2. Supports OneShot, Predefined and Waveform [vibration effects](https://developer.android.com/reference/android/os/VibrationEffect). | ||
## Composition | ||
- Uses [VibrationEffect.Composition](https://developer.android.com/reference/kotlin/android/os/VibrationEffect.Composition). | ||
- You can test all haptic primitives *which I failed to feel on all the devices available to me*. | ||
- If your devices support any haptic primitives, feel free to contact me. | ||
|
||
## Some Notes | ||
This app doesn't have any data validation, so the app just crashes if the data can't be parsed. I'm very new to Android development and Kotlin, and this app is just for testing purposes, so this won't be optimized in the near future. | ||
|
||
This app doesn't have any data validation, so the app just crashes if the data can't be parsed. And the code is really a mess as a result of my unfamiliarity with Android development and Kotlin. | ||
|
||
## Screenshots | ||
<img src="https://raw.githubusercontent.com/PBBB/AndroidHapticFeedbackTest/master/readme/Haptics.png" width="360"> <img src="https://raw.githubusercontent.com/PBBB/AndroidHapticFeedbackTest/master/readme/Vibrator.png" width="360"> | ||
<img src="https://raw.githubusercontent.com/PBBB/AndroidHapticFeedbackTest/master/readme/Haptics.png" width="360"> <img src="https://raw.githubusercontent.com/PBBB/AndroidHapticFeedbackTest/master/readme/OneShotWaveform.png" width="360"> <img src="https://raw.githubusercontent.com/PBBB/AndroidHapticFeedbackTest/master/readme/Composition.png" width="360"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.