/** 登录 */ public void checkLogin(User user) { // 查询本地数据 AbStorageQuery mAbStorageQuery = new AbStorageQuery(); mAbStorageQuery.equals("user_name", user.getUserName()); mAbStorageQuery.equals("password", user.getPassword()); mAbStorageQuery.equals("is_login_user", true); mAbSqliteStorage.findData( mAbStorageQuery, mUserDao, new AbDataSelectListener() { @Override public void onFailure(int errorCode, String errorMessage) { AbToastUtil.showToast(MainActivity.this, errorMessage); } @Override public void onSuccess(List<?> paramList) { if (paramList != null && paramList.size() > 0) { // 登录IM loginIMTask((User) paramList.get(0)); } else { AbToastUtil.showToast(MainActivity.this, "IM信息缺失"); } } }); }
public void queryData(final int query) { // 查询数据 AbStorageQuery mAbStorageQuery = new AbStorageQuery(); mAbStorageQuery.equals("message_type", IMMessage.SYS_MSG); mAbStorageQuery.setLimit(pageSize); mAbStorageQuery.setOffset((pageNum - 1) * pageSize); // 无sql存储的查询 mAbSqliteStorage.findData( mAbStorageQuery, mIMMsgDao, new AbDataSelectListener() { @Override public void onFailure(int errorCode, String errorMessage) { AbToastUtil.showToast(MessageActivity.this, errorMessage); } @Override public void onSuccess(List<?> paramList) { if (query == 0) { if (paramList != null && paramList.size() > 0) { list.addAll((List<IMMessage>) paramList); myListViewAdapter.notifyDataSetChanged(); } mAbPullToRefreshView.onHeaderRefreshFinish(); } else { if (paramList != null) { list.addAll((List<IMMessage>) paramList); myListViewAdapter.notifyDataSetChanged(); } mAbPullToRefreshView.onFooterLoadFinish(); } } }); }