Example #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_chatting);
    //		dbUtiles = new DBUtils(this);
    dbUtiles = new DBUtils(this, dbName);

    initView();
    addPop = new AddPopWindow(this);
    addPop.setOnDeleteListener(this);
  }
Example #2
0
  @SuppressWarnings("static-access")
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (event.getKeyCode() == KeyEvent.KEYCODE_MENU) {
      if (addPop.popFirst) {
        addPop.showAsDropDown(iv, iv.getLayoutParams().width / 2, 18);
      }

      return true;
    }
    if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
      if (System.currentTimeMillis() - exitTime > 2000) {
        Toast.makeText(this, "再按一次退出程序", 0).show();
        exitTime = System.currentTimeMillis();
      } else {
        finish();
      }
      return true;
    }
    return super.onKeyDown(keyCode, event);
  }