resolved conflicts for e78e3d73 to ub-launcher3-master

Change-Id: Idc119a57e21cf6016ee0fd91866839301db072d6
This commit is contained in:
Sunny Goyal
2015-09-25 11:50:16 -07:00
14 changed files with 207 additions and 70 deletions

View File

@@ -47,7 +47,10 @@ import android.graphics.drawable.PaintDrawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Process;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.TtsSpan;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Pair;
@@ -729,7 +732,6 @@ public final class Utilities {
return String.format(Locale.ENGLISH, "%s IN (%s)", columnName, TextUtils.join(", ", values));
}
@SuppressWarnings({"unchecked", "rawtypes"})
public static boolean isBootCompleted() {
try {
Class clazz = Class.forName("android.os.SystemProperties");
@@ -751,4 +753,22 @@ public final class Utilities {
public static int boundInRange(int value, int lowerBound, int upperBound) {
return Math.max(lowerBound, Math.min(value, upperBound));
}
/**
* Wraps a message with a TTS span, so that a different message is spoken than
* what is getting displayed.
* @param msg original message
* @param ttsMsg message to be spoken
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static CharSequence wrapForTts(CharSequence msg, String ttsMsg) {
if (Utilities.ATLEAST_LOLLIPOP) {
SpannableString spanned = new SpannableString(msg);
spanned.setSpan(new TtsSpan.TextBuilder(ttsMsg).build(),
0, spanned.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
return spanned;
} else {
return msg;
}
}
}