package com.wangbb.naruto.app.view; import android.view.View; import android.widget.ProgressBar; import android.widget.TextView; import com.wangbb.naruto.R; import com.wangbb.naruto.utils.Utility; /** * Created by wangbinbin on 15/5/8. */ public class LoadingViewHelper { private View loadingView; private TextView loadingText; private ProgressBar loadingProgress; public LoadingViewHelper(View rootView) { this.loadingView = rootView; loadingText = (TextView) loadingView.findViewById(R.id.loading_text); loadingProgress = (ProgressBar) loadingView.findViewById(R.id.loading_progress); loadingView.setVisibility(View.GONE); } public void startLoading() { loadingView.setVisibility(View.VISIBLE); loadingProgress.setVisibility(View.VISIBLE); loadingText.setVisibility(View.GONE); } public void loadingSuccess() { loadingView.setVisibility(View.GONE); loadingProgress.setVisibility(View.GONE); loadingView.setVisibility(View.GONE); } public void loadingFailure(String showInfo) { loadingView.setVisibility(View.VISIBLE); loadingProgress.setVisibility(View.GONE); loadingText.setVisibility(View.VISIBLE); loadingText.setText(Utility.isEmpty(showInfo) ? "����ʧ��" : showInfo); } }