/** * 加载完毕,显示加载结果。注意:加载完成后一定要调用这个方法 * * @param isSuccess true成功,false代表失败 */ public void loadMoreFinish(boolean isSuccess) { if (loadingBar == null || loadHintText == null) return; loadingBar.clearAnimation(); loadingBar.setVisibility(View.GONE); if (showRefreshResultEnable) { if (isSuccess) { // 加载更多成功 loadHintText.setText(R.string.load_succeed); Drawable drawable = getResources().getDrawable(R.mipmap.icon_load_succeed); loadHintText.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null); loadHintText.setCompoundDrawablePadding(dp2px(10)); } else { // 加载更多失败 loadHintText.setText(R.string.load_fail); Drawable drawable = getResources().getDrawable(R.mipmap.icon_load_failed); loadHintText.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null); loadHintText.setCompoundDrawablePadding(dp2px(10)); } } if (pullUpY < 0) { postDelayed( new Runnable() { @Override public void run() { changeStage(DONE); hide(); } }, showRefreshResultEnable ? 1000 : 0); // 判断刷新结果停留1秒 } else { changeStage(DONE); hide(); } }
@SuppressLint("NewApi") public void startDownloadSchedule() { // Start by displaying indeterminate progress, determinate will come later progressBar.clearAnimation(); progressBar.setIndeterminate(true); progressBar.setVisibility(View.VISIBLE); new DownloadScheduleAsyncTask(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }
void hideActivityCircle() { if (activityCircle != null) { // We use an animation to dim the activity circle; need to clear this or it will remain // visible. activityCircle.clearAnimation(); activityCircle.setVisibility(View.INVISIBLE); } }
/** * 加载完毕,显示加载结果。注意:加载完成后一定要调用这个方法 * * @param isSuccess true成功,false代表失败 */ public void loadMoreFinish(boolean isSuccess) { if (loadingBar == null || loadHintText == null) { return; } loadingBar.clearAnimation(); loadingBar.setVisibility(View.INVISIBLE); if (showRefreshResultEnable) { if (isSuccess) { // 加载更多成功 loadHintText.setText(mResourceConfig.getTextResIds()[8]); Drawable drawable = ContextCompat.getDrawable(getContext(), mResourceConfig.getImageResIds()[3]); loadHintText.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null); loadHintText.setCompoundDrawablePadding(dp2px(10)); } else { // 加载更多失败 loadHintText.setText(mResourceConfig.getTextResIds()[9]); Drawable drawable = ContextCompat.getDrawable(getContext(), mResourceConfig.getImageResIds()[4]); loadHintText.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null); loadHintText.setCompoundDrawablePadding(dp2px(10)); } } if (pullUpY < 0) { postDelayed( new Runnable() { @Override public void run() { changeStage(DONE); hide(); } }, showRefreshResultEnable ? 1000 : 0); // 判断刷新结果停留1秒 } else { changeStage(DONE); hide(); } }