@Override protected void loadData() { String thread_key = getIntent().getStringExtra(DATA_THREAD_KEY); String thread_id = getIntent().getStringExtra(DATA_THREAD_ID); isFromFreshNews = getIntent().getBooleanExtra(DATA_IS_FROM_FRESH_NEWS, false); if (isFromFreshNews) { mAdapter = new CommentAdapter(this, thread_id, true, this); if (TextUtils.isEmpty(thread_id) || thread_id.equals("0")) { ToastHelper.Short(FORBID_COMMENTS); finish(); } } else { mAdapter = new CommentAdapter(this, thread_key, false, this); if (TextUtils.isEmpty(thread_key) || thread_key.equals("0")) { ToastHelper.Short(FORBID_COMMENTS); finish(); } } mRecyclerView.setAdapter(mAdapter); if (isFromFreshNews) { mAdapter.loadData4FreshNews(); } else { mAdapter.loadData(); } loading.start(); }
@Override public void onSuccess(int result, Object object) { if (result == LoadResultCallBack.SUCCESS_NONE) { ToastHelper.Short(NO_COMMENTS); } loading.stop(); mSwipeRefreshLayout.setRefreshing(false); }
@Override public void onError(int code) { mSwipeRefreshLayout.setRefreshing(false); loading.stop(); ToastHelper.Short(LOAD_FAILED); }