TwiftUtil.java :  » Blog-Twitter » twift » com » twift » control » Android Open Source

Android Open Source » Blog Twitter » twift 
twift » com » twift » control » TwiftUtil.java
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;
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.