Created
March 29, 2018 16:43
-
-
Save ataulm/36268a62b6a358dd8bd212c2f68bde83 to your computer and use it in GitHub Desktop.
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
/** | |
* Handles the splitting of {@link URLSpan}s into multiple | |
* {@link FeedbackFragment}s. | |
* | |
* @param fragment The fragment containing the spannable text to process. | |
* @param span The individual {@link StyleSpan} that represents the span | |
*/ | |
private static void handleStyleSpan(FeedbackFragment fragment, StyleSpan span) { | |
final int style = span.getStyle(); | |
final int earconId; | |
final float voicePitch; | |
switch (style) { | |
case Typeface.BOLD: | |
case Typeface.BOLD_ITALIC: | |
voicePitch = PITCH_CHANGE_BOLD; | |
earconId = R.raw.bold; | |
break; | |
case Typeface.ITALIC: | |
voicePitch = PITCH_CHANGE_ITALIC; | |
earconId = R.raw.italic; | |
break; | |
default: | |
return; | |
} | |
final Bundle speechParams = new Bundle(Bundle.EMPTY); | |
speechParams.putFloat(SpeechController.SpeechParam.PITCH, voicePitch); | |
fragment.setSpeechParams(speechParams); | |
fragment.addEarcon(earconId); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment