@Override public boolean handleMessage(Message msg) { switch (msg.what) { case Requester2.RESPONSE_TYPE_GET_DIARY_FORWORD: ZDialog.dismiss(); GsonResponse2.getDiaryForwardUsersResponse gdpResponse = (GsonResponse2.getDiaryForwardUsersResponse) msg.obj; dpList = new ArrayList<GsonResponse2.getDiaryForwardUsers>(); if (gdpResponse != null && gdpResponse.status.equals("0") && gdpResponse.forwords.length > 0) { for (int j = 0; j < gdpResponse.forwords.length; j++) { dpList.add(gdpResponse.forwords[j]); } } else { isShowAllPraise = true; } dpAdapter = new DiaryPraiseAdapter(dpList); lv.setAdapter(dpAdapter); lv.setOnItemClickListener(this); listView.onRefreshComplete(); break; default: break; } return false; }
@Override public void onRefresh() { if (!isShowAllPraise) { if (otherUserID != null) { Requester2.getDiaryForwardUsers(getHandler(), diaryID, null, "1"); } else { Requester2.getDiaryForwardUsers(getHandler(), diaryID, null, "2"); } } else { listView.onRefreshComplete(); Toast.makeText(DiaryPraiseActivity.this, "没有更多", Toast.LENGTH_SHORT).show(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_diary_praise); diaryID = getIntent().getStringExtra("diaryID"); userID = ActiveAccount.getInstance(ZApplication.getInstance()).getUID(); ai = AccountInfo.getInstance(userID); ZDialog.show(R.layout.progressdialog, true, true, this); Requester2.getDiaryForwardUsers(getHandler(), diaryID, null, null); otherUserID = getIntent().getStringExtra(INTENT_ACTION_USERID); isShowAllPraise = false; inflater = LayoutInflater.from(this); findViewById(R.id.iv_back).setOnClickListener(this); listView = (PullToRefreshListView) findViewById(R.id.lv_activity_diary_praise); listView.setOnRefreshListener(this); dpList = new ArrayList<GsonResponse2.getDiaryForwardUsers>(); lv = listView.getRefreshableView(); }