package com.twift.control;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
/**
*
* @author Ksk
*
*/
public class TwiftUtil {
/**
*
* @param date
* @return
*/
public static String getDateText(Date date){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm", Locale.JAPANESE);
String dateText = sdf.format(date);
return dateText;
}
/**
* Returns the title of an Activity. Use it in conjunction with Activity.setTitle(String)
*
* @param user_name - the current logged-in user name
* @param app_name - the application name (usually "twift")
* @param activity - the title of the current Activity (eg Home timeline)
* @param tail - anything else you might want to add (eg last updated time)
* @return A String containing the forged Activity title
*
* @author Yoshiyuki Kakihara
*/
public static String getTitleText(
String user_name, String app_name, String activity, String tail) {
if (app_name == null) app_name = "twift";
app_name += "::";
if (user_name == null) user_name = "";
else user_name += "@";
if (activity == null) activity = "";
else activity += " ";
if (tail == null) tail = "";
return app_name + user_name + activity + tail;
}
}
|