Merge pull request #202 from danielchristopher1/master

Small refactoring
This commit is contained in:
Moez Bhatti
2015-09-18 18:02:09 -04:00
5 changed files with 31 additions and 27 deletions
@@ -38,7 +38,8 @@ public class EmojiRegistry {
public static String parseEmojis(String body) { public static String parseEmojis(String body) {
if (TextUtils.isEmpty(body)) { if (TextUtils.isEmpty(body)) {
return body; return body;
} else { }
// whitespace and punctuation characters // whitespace and punctuation characters
String ACCEPTED_CHARS = "[\\s.,?:;'\"!]"; String ACCEPTED_CHARS = "[\\s.,?:;'\"!]";
@@ -59,7 +60,7 @@ public class EmojiRegistry {
// * - or beginning / end of text // * - or beginning / end of text
body = body.replaceAll(regex, "$1:" + entry.getValue() + ":$2"); body = body.replaceAll(regex, "$1:" + entry.getValue() + ":$2");
} }
return EmojiParser.parseToUnicode(body); return EmojiParser.parseToUnicode(body);
} }
}
} }
@@ -1,5 +1,8 @@
package com.moez.QKSMS.common.emoji; package com.moez.QKSMS.common.emoji;
/**
* Defines all supported emojis
*/
public class Emojis { public class Emojis {
public static final String SMILE = "smile"; public static final String SMILE = "smile";
public static final String SMILEY = "smiley"; public static final String SMILEY = "smiley";
@@ -122,6 +122,7 @@ public class Contact {
mIsStale = true; mIsStale = true;
mSendToVoicemail = false; mSendToVoicemail = false;
} }
@Override @Override
public String toString() { public String toString() {
return String.format("{ number=%s, name=%s, nameAndNumber=%s, label=%s, person_id=%d, hash=%d method_id=%d }", return String.format("{ number=%s, name=%s, nameAndNumber=%s, label=%s, person_id=%d, hash=%d method_id=%d }",
@@ -189,7 +189,6 @@ public class ContactHelper {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
return bitmap; return bitmap;
} }
@@ -82,12 +82,12 @@ public class Message {
} }
public boolean isMms() { public boolean isMms() {
boolean bool = false; boolean isMms = false;
Cursor cursor = null; Cursor cursor = null;
try { try {
cursor = context.getContentResolver().query(MMS_SMS_CONTENT_PROVIDER, new String[]{SmsHelper.COLUMN_MMS}, "_id=" + id, null, null); cursor = context.getContentResolver().query(MMS_SMS_CONTENT_PROVIDER, new String[]{SmsHelper.COLUMN_MMS}, "_id=" + id, null, null);
cursor.moveToFirst(); cursor.moveToFirst();
bool = "application/vnd.wap.multipart.related".equals(cursor.getString(cursor.getColumnIndex(SmsHelper.COLUMN_MMS))); isMms = "application/vnd.wap.multipart.related".equals(cursor.getString(cursor.getColumnIndex(SmsHelper.COLUMN_MMS)));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
@@ -95,7 +95,7 @@ public class Message {
cursor.close(); cursor.close();
} }
} }
return bool; return isMms;
} }
public String getAddress() { public String getAddress() {