private void refreshUI(@DownloadInfo.DownloadState int state, float progress) { this.currentState = state; this.progress = progress; switch (state) { case DownloadManager.STATE_NONE: btnDownload.setVisibility(View.VISIBLE); btnDownload.setText(UIUtil.getString(R.string.app_state_download)); progressHorizontal.setVisibility(View.GONE); break; case DownloadManager.STATE_DOWNLOADING: btnDownload.setVisibility(View.GONE); progressHorizontal.setVisibility(View.VISIBLE); progressHorizontal.setProgress(progress); progressHorizontal.setCenterText(""); break; case DownloadManager.STATE_PAUSE: btnDownload.setVisibility(View.GONE); progressHorizontal.setVisibility(View.VISIBLE); progressHorizontal.setProgress(progress); progressHorizontal.setCenterText(UIUtil.getString(R.string.app_state_paused)); break; case DownloadManager.STATE_ERROR: btnDownload.setVisibility(View.VISIBLE); btnDownload.setText(UIUtil.getString(R.string.app_state_error)); progressHorizontal.setVisibility(View.GONE); break; case DownloadManager.STATE_WAITING: btnDownload.setVisibility(View.VISIBLE); btnDownload.setText(UIUtil.getString(R.string.app_state_waiting)); progressHorizontal.setVisibility(View.GONE); break; case DownloadManager.STATE_DOWNLOADED: btnDownload.setVisibility(View.VISIBLE); btnDownload.setText(UIUtil.getString(R.string.app_state_downloaded)); progressHorizontal.setVisibility(View.GONE); break; default: break; } }