/*
 * Derived from com.android.mms.ui.MessageUtils
 * (tag android-4.4.4_r2.0.1)
 */

package ca.bmaupin.merge.sms.ui;

import android.content.Context;
import android.text.format.DateUtils;
import android.text.format.Time;

public class MessageUtils {
    public static String formatTimeStampString(Context context, long when) {
        return formatTimeStampString(context, when, false);
    }
	
    public static String formatTimeStampString(Context context, long when, boolean fullFormat) {
        Time then = new Time();
        then.set(when);
        Time now = new Time();
        now.setToNow();

        // Basic settings for formatDateTime() we want for all cases.
        int format_flags = DateUtils.FORMAT_NO_NOON_MIDNIGHT |
                           DateUtils.FORMAT_ABBREV_ALL |
                           DateUtils.FORMAT_CAP_AMPM;

        // If the message is from a different year, show the date and year.
        if (then.year != now.year) {
            format_flags |= DateUtils.FORMAT_SHOW_YEAR | DateUtils.FORMAT_SHOW_DATE;
        } else if (then.yearDay != now.yearDay) {
            // If it is from a different day than today, show only the date.
            format_flags |= DateUtils.FORMAT_SHOW_DATE;
        } else {
            // Otherwise, if the message is from today, show the time.
            format_flags |= DateUtils.FORMAT_SHOW_TIME;
        }

        // If the caller has asked for full details, make sure to show the date
        // and time no matter what we've determined above (but still make showing
        // the year only happen if it is a different year from today).
        if (fullFormat) {
            format_flags |= (DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME);
        }

        return DateUtils.formatDateTime(context, when, format_flags);
    }
}

@@ -113,16 +113,51 @@
 ms.ui;%0A%0A
+import com.android.mms.MmsConfig;%0A%0A
 import a
@@ -1848,10 +1848,845 @@
 ;%0A    %7D%0A
+    %0A    // An alias (or commonly called %22nickname%22) is:%0A    // Nickname must begin with a letter.%0A    // Only letters a-z, numbers 0-9, or . are allowed in Nickname field.%0A    public static boolean isAlias(String string) %7B%0A        if (!MmsConfig.isAliasEnabled()) %7B%0A            return false;%0A        %7D%0A%0A        int len = string == null ? 0 : string.length();%0A%0A        if (len %3C MmsConfig.getAliasMinChars() %7C%7C len %3E MmsConfig.getAliasMaxChars()) %7B%0A            return false;%0A        %7D%0A%0A        if (!Character.isLetter(string.charAt(0))) %7B    // Nickname begins with a letter%0A            return false;%0A        %7D%0A        for (int i = 1; i %3C len; i++) %7B%0A            char c = string.charAt(i);%0A            if (!(Character.isLetterOrDigit(c) %7C%7C c == '.')) %7B%0A                return false;%0A            %7D%0A        %7D%0A%0A        return true;%0A    %7D%0A
 %7D%0A

Add dependency for Contact