@Override protected void onStart() { // TODO Auto-generated method stub super.onStart(); HashMap hm = new HashMap(); hm.put("uid", OAuthReadUtil.readToken(this).getUserId()); // 获取用户资料 MainService.newTask(new Task(Task.TASK_GET_USER_INFO, hm)); // 获取用户首页信息 hm.put("accessToken", OAuthReadUtil.readToken(this)); MainService.newTask(new Task(Task.TASK_GET_USER_HOMETIMEINLINE, hm)); Log.d("HomeActivity", "--------------------onStart"); }
public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub if (keyCode == KeyEvent.KEYCODE_BACK) { MainService.promptExit(this); } return true; }
@Override public void refresh(Object... param) { // TODO Auto-generated method stub switch (((Integer) param[0]).intValue()) { case UI_REFRESH_STATUS: // 更新微博 mProcessBar.setVisibility(View.GONE); List<Status> alls = (List<Status>) param[1]; WeiboStatuAdapter wsa = new WeiboStatuAdapter(this, alls); mAllStatusLV.setAdapter(wsa); wsa.notifyDataSetChanged(); // 刷新完成列表 // 发送任务获取所有微博发送者的头像 for (Status status : alls) { HashMap hm = new HashMap(); hm.put("user", status.getUser()); // 获取用户资料 MainService.newTask(new Task(Task.TASK_GET_USER_IMAGE_ICON, hm)); } break; case UI_REFRESH_TITLE: // 更新标题 mTitletv.setText((String) param[1]); break; case UI_REFRESH_STATUS_USER_ICON: // 更新用户图标 ((WeiboStatuAdapter) mAllStatusLV.getAdapter()).notifyDataSetChanged(); // 刷新listView break; case UI_REFRESH_STATUS_MORE: // 获取到更多微博信息 ((WeiboStatuAdapter) mAllStatusLV.getAdapter()).addMoreData((List<Status>) param[1]); } }