StatusType.java :  » UnTagged » androidgin » person » bangbang » im » Androidgin » Framework » Android Open Source

Android Open Source » UnTagged » androidgin 
androidgin » person » bangbang » im » Androidgin » Framework » StatusType.java
package person.bangbang.im.Androidgin.Framework;

import person.bangbang.im.Androidgin.R;

/*
 * type definition
 */
public final class StatusType{
  /* 
   * ALL protocol have defined these status
   * So u id must other number except for these two.
   */
  public static final int UNKNOW = -1;
  public static final int OFFLINE = 0;
  public static final int ONLINE = 1;
  public static final int AWAY = 2;
  public static final int BUSY = 3;
  public static final int INVISABLE = 0;
  
  /* no res */
  public static int RES_NONE = -1;  // NONE_RES is worse than RES_NONE
  // res come from pidgin.
  public static int RES_ONLINE = R.drawable.status_available;
  public static int RES_OFFLINE = R.drawable.status_offline;
  public static int RES_AWAY = R.drawable.status_away;  
  public static int RES_BUSY = R.drawable.status_busy;
  public static int RES_INVISABLE = R.drawable.status_invisible;
  
  /*
   * identify this StatusType.
   * when we login protocol will set the status 
   * according to this. 
   */
  private int id;
  
  /*
   * a human readable name,
   */
  private String name;
  
  /* 
   * optional attr.
   * 
   * a res id which can be user an a icon
   * which indicate the status.
   */
  private int resId;
  
  public StatusType(int id, String name){
    this.id = id;
    this.name = name;
    this.resId = RES_NONE;
  }
  public StatusType(int id, String name, int resId){
    this.id = id;
    this.name = name;
    this.resId = resId;
  }

  public int getId() {
    return id;
  }
  public String getName() {
    return name;
  }
  public int getResId() {
    return resId;
  }
  
  /** for arrayAdapter only */
  public String toString() {
    // TODO Auto-generated method stub
    return name;
  }
  
}
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.