Example #1
0
 public MessageDBManager(String mid) {
   super(HSApplication.getContext(), DATABASE_NAME, null, DATABASE_VERION);
   mMid = mid;
   {
     mMessageColumns = new HashMap<String, String>();
     mMessageColumns.put(COLUMN_SID, TYPE_TEXT);
     mMessageColumns.put(COLUMN_CID, TYPE_TEXT);
     mMessageColumns.put(COLUMN_TYPE, TYPE_TEXT);
     mMessageColumns.put(COLUMN_PUSH_TAG, TYPE_TEXT);
     mMessageColumns.put(COLUMN_SCENARIO, TYPE_TEXT);
     mMessageColumns.put(COLUMN_MO, TYPE_INTEGER);
     mMessageColumns.put(COLUMN_FROM, TYPE_TEXT);
     mMessageColumns.put(COLUMN_TO, TYPE_TEXT);
     mMessageColumns.put(COLUMN_CONTENT, TYPE_TEXT);
     mMessageColumns.put(COLUMN_TIMESTAMP, TYPE_LONG);
     mMessageColumns.put(COLUMN_STATUS, TYPE_INTEGER);
     mMessageColumns.put(COLUMN_MEDIA_STATUS, TYPE_INTEGER);
     mMessageColumns.put(COLUMN_LOCAL_FILE_INFO, TYPE_TEXT);
     mMessageColumns.put(COLUMN_IS_MEDIA_READ, TYPE_INTEGER);
     mMessageColumns.put(COLUMN_REJECTED, TYPE_INTEGER);
     mMessageColumns.put(COLUMN_P1, TYPE_TEXT);
     mMessageColumns.put(COLUMN_P2, TYPE_TEXT);
     mMessageColumns.put(COLUMN_P3, TYPE_TEXT);
     mMessageColumns.put(COLUMN_P4, TYPE_TEXT);
   }
   {
     mReceiptColumns = new HashMap<String, String>();
     mReceiptColumns.put(RECEIPT_COLUMN_MID, TYPE_TEXT);
     mReceiptColumns.put(RECEIPT_COLUMN_CID, TYPE_TEXT);
     mReceiptColumns.put(RECEIPT_COLUMN_TYPE, TYPE_TEXT);
     mReceiptColumns.put(RECEIPT_COLUMN_P1, TYPE_TEXT);
     mReceiptColumns.put(RECEIPT_COLUMN_P2, TYPE_TEXT);
     mReceiptColumns.put(RECEIPT_COLUMN_P3, TYPE_TEXT);
   }
 }
  @Override
  public void onCreate() {
    super.onCreate();

    HSAccountManager.getInstance();

    doInit();

    initImageLoader(this);

    // 初始化百度地图 SDK
    SDKInitializer.initialize(getApplicationContext());

    // 初始化通讯录管理类,同步通讯录,用于生成好友列表
    HSPhoneContactMgr.init();
    HSPhoneContactMgr.enableAutoUpload(true);
    HSPhoneContactMgr.startSync();

    // 初始化好友列表管理类,同步好友列表
    HSContactFriendsMgr.init(this, null, URL_SYNC, URL_ACK);
    HSContactFriendsMgr.startSync(true);

    // 将本类添加为 HSMessageManager 的监听者,监听各类消息变化事件
    // 参见 HSMessageManager 类与 HSMessageChangeListener 接口
    HSMessageManager.getInstance().addListener(this, new Handler());

    // 为 HSGlobalNotificationCenter 功能设定监听接口
    INotificationObserver observer = this;
    HSGlobalNotificationCenter.addObserver(
        SampleFragment.SAMPLE_NOTIFICATION_NAME,
        observer); // 演示HSGlobalNotificationCenter功能:增加名为 SAMPLE_NOTIFICATION_NAME 的观察者
  }
 @Override
 public void onConfigurationChanged(Configuration newConfig) {
   super.onConfigurationChanged(newConfig);
 }