mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-12 04:25:08 -05:00
Replace tabs with spaces
This commit is contained in:
parent
bd3bd861c5
commit
9a385146c4
@ -128,7 +128,7 @@ public class ContactPictureLoader {
|
|||||||
* @see #calculateFallbackBitmap(Address)
|
* @see #calculateFallbackBitmap(Address)
|
||||||
*/
|
*/
|
||||||
public void loadContactPicture(Address address, QuickContactBadge badge) {
|
public void loadContactPicture(Address address, QuickContactBadge badge) {
|
||||||
String email = address.getAddress();
|
String email = address.getAddress();
|
||||||
Bitmap bitmap = getBitmapFromCache(email);
|
Bitmap bitmap = getBitmapFromCache(email);
|
||||||
if (bitmap != null) {
|
if (bitmap != null) {
|
||||||
// The picture was found in the bitmap cache
|
// The picture was found in the bitmap cache
|
||||||
@ -156,12 +156,12 @@ public class ContactPictureLoader {
|
|||||||
|
|
||||||
int val = address.getAddress().toLowerCase().hashCode();
|
int val = address.getAddress().toLowerCase().hashCode();
|
||||||
int rgb = CONTACT_DUMMY_COLORS_ARGB[Math.abs(val) % CONTACT_DUMMY_COLORS_ARGB.length];
|
int rgb = CONTACT_DUMMY_COLORS_ARGB[Math.abs(val) % CONTACT_DUMMY_COLORS_ARGB.length];
|
||||||
return rgb;
|
return rgb;
|
||||||
}
|
}
|
||||||
|
|
||||||
private char calcUnknownContactLetter(Address address) {
|
private char calcUnknownContactLetter(Address address) {
|
||||||
String letter = "";
|
String letter = "";
|
||||||
String str = address.getPersonal() != null ? address.getPersonal() : address.getAddress();
|
String str = address.getPersonal() != null ? address.getPersonal() : address.getAddress();
|
||||||
|
|
||||||
Matcher m = EXTRACT_LETTER_PATTERN.matcher(str);
|
Matcher m = EXTRACT_LETTER_PATTERN.matcher(str);
|
||||||
if (m.find()) {
|
if (m.find()) {
|
||||||
@ -175,29 +175,29 @@ public class ContactPictureLoader {
|
|||||||
* Calculates a bitmap with a color and a capital letter for contacts without picture.
|
* Calculates a bitmap with a color and a capital letter for contacts without picture.
|
||||||
*/
|
*/
|
||||||
private Bitmap calculateFallbackBitmap(Address address) {
|
private Bitmap calculateFallbackBitmap(Address address) {
|
||||||
Bitmap result = Bitmap.createBitmap(mPictureSizeInPx, mPictureSizeInPx,
|
Bitmap result = Bitmap.createBitmap(mPictureSizeInPx, mPictureSizeInPx,
|
||||||
Bitmap.Config.ARGB_8888);
|
Bitmap.Config.ARGB_8888);
|
||||||
|
|
||||||
Canvas canvas = new Canvas(result);
|
Canvas canvas = new Canvas(result);
|
||||||
|
|
||||||
int rgb = calcUnknownContactColor(address);
|
int rgb = calcUnknownContactColor(address);
|
||||||
result.eraseColor(rgb);
|
result.eraseColor(rgb);
|
||||||
|
|
||||||
String letter = Character.toString(calcUnknownContactLetter(address));
|
String letter = Character.toString(calcUnknownContactLetter(address));
|
||||||
|
|
||||||
Paint paint = new Paint();
|
Paint paint = new Paint();
|
||||||
paint.setAntiAlias(true);
|
paint.setAntiAlias(true);
|
||||||
paint.setStyle(Paint.Style.FILL);
|
paint.setStyle(Paint.Style.FILL);
|
||||||
paint.setARGB(255, 255, 255, 255);
|
paint.setARGB(255, 255, 255, 255);
|
||||||
paint.setTextSize(mPictureSizeInPx * 3 / 4); // just scale this down a bit
|
paint.setTextSize(mPictureSizeInPx * 3 / 4); // just scale this down a bit
|
||||||
Rect rect = new Rect();
|
Rect rect = new Rect();
|
||||||
paint.getTextBounds(letter, 0, 1, rect);
|
paint.getTextBounds(letter, 0, 1, rect);
|
||||||
float width = paint.measureText(letter);
|
float width = paint.measureText(letter);
|
||||||
canvas.drawText(letter,
|
canvas.drawText(letter,
|
||||||
mPictureSizeInPx/2f-width/2f,
|
mPictureSizeInPx/2f-width/2f,
|
||||||
mPictureSizeInPx/2f+rect.height()/2f, paint);
|
mPictureSizeInPx/2f+rect.height()/2f, paint);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addBitmapToCache(String key, Bitmap bitmap) {
|
private void addBitmapToCache(String key, Bitmap bitmap) {
|
||||||
@ -307,7 +307,7 @@ public class ContactPictureLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bitmap == null) {
|
if (bitmap == null) {
|
||||||
bitmap = calculateFallbackBitmap(mAddress);
|
bitmap = calculateFallbackBitmap(mAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the picture of the contact with that email address in the bitmap cache
|
// Save the picture of the contact with that email address in the bitmap cache
|
||||||
|
@ -321,14 +321,14 @@ public class TitleBarWebView extends WebView implements TitleBarDelegate {
|
|||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
if (checkedForNativeGetVisibleTitleHeightMethod == false) {
|
if (checkedForNativeGetVisibleTitleHeightMethod == false) {
|
||||||
try {
|
try {
|
||||||
nativeGetVisibleTitleHeightMethod = WebView.class
|
nativeGetVisibleTitleHeightMethod = WebView.class
|
||||||
.getDeclaredMethod("getVisibleTitleHeight");
|
.getDeclaredMethod("getVisibleTitleHeight");
|
||||||
} catch(NoSuchMethodException e) {
|
} catch(NoSuchMethodException e) {
|
||||||
Log.w(TAG,
|
Log.w(TAG,
|
||||||
"Could not retrieve native hidden getVisibleTitleHeight method");
|
"Could not retrieve native hidden getVisibleTitleHeight method");
|
||||||
}
|
}
|
||||||
checkedForNativeGetVisibleTitleHeightMethod = true;
|
checkedForNativeGetVisibleTitleHeightMethod = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user