Tabnine Logo
ProgressLayout
Code IndexAdd Tabnine to your IDE (free)

How to use
ProgressLayout
in
com.nguyenhoanglam.progresslayout

Best Java code snippets using com.nguyenhoanglam.progresslayout.ProgressLayout (Showing top 10 results out of 315)

origin: nguyenhoanglam/ProgressLayout

public ProgressLayout(Context context, AttributeSet attrs, int defStyleAttr) {
  super(context, attrs, defStyleAttr);
  init(attrs);
}
origin: nguyenhoanglam/ProgressLayout

private void hideEmptyView() {
  if (emptyStateRelativeLayout != null) {
    emptyStateRelativeLayout.setVisibility(GONE);
    //Restore the background color if not TRANSPARENT
    if (emptyStateBackgroundColor != Color.TRANSPARENT) {
      this.setBackgroundDrawable(currentBackground);
    }
  }
}
origin: nguyenhoanglam/ProgressLayout

  hideLoadingView();
  hideEmptyView();
  hideErrorView();
  setContentVisibility(true, skipIds);
  break;
case LOADING:
  hideEmptyView();
  hideErrorView();
  setLoadingView();
  setContentVisibility(false, skipIds);
  break;
case EMPTY:
  hideLoadingView();
  hideErrorView();
  setEmptyView();
  if (drawable != null) {
    emptyStateImageView.setImageDrawable(drawable);
  setContentVisibility(false, skipIds);
  break;
case ERROR:
  hideLoadingView();
  hideEmptyView();
  setErrorView();
origin: nguyenhoanglam/ProgressLayout

private void init(AttributeSet attrs) {
  inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.ProgressLayout);
  Resources res = getResources();
  float scaleRatio = res.getDisplayMetrics().density;
  emptyStateImageHeight = (int) (typedArray.getDimension(R.styleable.ProgressLayout_emptyImageHeight, emptyStateImageHeight) / scaleRatio);
  emptyStateContentTextSize = (int) (typedArray.getDimension(R.styleable.ProgressLayout_emptyContentTextSize, emptyStateContentTextSize) / scaleRatio);
  emptyStateContentTextColor = typedArray.getColor(R.styleable.ProgressLayout_emptyContentTextColor, ContextCompat.getColor(getContext(), R.color.grey));
  emptyStateBackgroundColor = typedArray.getColor(R.styleable.ProgressLayout_emptyBackgroundColor, Color.TRANSPARENT);
  errorStateContentTextSize = (int) (typedArray.getDimension(R.styleable.ProgressLayout_errorContentTextSize, errorStateContentTextSize) / scaleRatio);
  errorStateButtonTextSize = (int) (typedArray.getDimension(R.styleable.ProgressLayout_errorButtonTextSize, errorStateButtonTextSize) / scaleRatio);
  errorStateContentTextColor = typedArray.getColor(R.styleable.ProgressLayout_errorContentTextColor, ContextCompat.getColor(getContext(), R.color.grey));
  errorStateButtonTextColor = typedArray.getColor(R.styleable.ProgressLayout_errorButtonTextColor, ContextCompat.getColor(getContext(), R.color.teal));
  errorStateBackgroundColor = typedArray.getColor(R.styleable.ProgressLayout_errorBackgroundColor, Color.TRANSPARENT);
  currentBackground = this.getBackground();
origin: nguyenhoanglam/ProgressLayout

private void setEmptyView() {
  if (emptyStateRelativeLayout == null) {
    view = inflater.inflate(R.layout.progress_empty_view, null);
    emptyStateRelativeLayout = (RelativeLayout) view.findViewById(R.id.emptyStateRelativeLayout);
    emptyStateRelativeLayout.setTag(TAG_EMPTY);
    emptyStateImageView = (ImageView) view.findViewById(R.id.emptyStateImageView);
    emptyStateContentTextView = (TextView) view.findViewById(R.id.emptyStateContentTextView);
    //Set empty state image width and height
    emptyStateImageView.getLayoutParams().width = emptyStateImageWidth;
    emptyStateImageView.getLayoutParams().height = emptyStateImageHeight;
    emptyStateImageView.requestLayout();
    emptyStateContentTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, emptyStateContentTextSize);
    emptyStateContentTextView.setTextColor(emptyStateContentTextColor);
    //Set background color if not TRANSPARENT
    if (emptyStateBackgroundColor != Color.TRANSPARENT) {
      this.setBackgroundColor(emptyStateBackgroundColor);
    }
    layoutParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
        ViewGroup.LayoutParams.MATCH_PARENT);
    layoutParams.addRule(CENTER_IN_PARENT);
    addView(emptyStateRelativeLayout, layoutParams);
  } else {
    emptyStateRelativeLayout.setVisibility(VISIBLE);
  }
}
origin: nguyenhoanglam/ProgressLayout

private void setErrorView() {
  if (errorStateRelativeLayout == null) {
    view = inflater.inflate(R.layout.progress_error_view, null);
    errorStateRelativeLayout = (RelativeLayout) view.findViewById(R.id.errorStateRelativeLayout);
    errorStateRelativeLayout.setTag(TAG_ERROR);
    errorStateImageView = (ImageView) view.findViewById(R.id.errorStateImageView);
    errorStateContentTextView = (TextView) view.findViewById(R.id.errorStateContentTextView);
    errorStateButton = (Button) view.findViewById(R.id.errorStateButton);
    //Set error state image width and height
    errorStateImageView.getLayoutParams().width = errorStateImageWidth;
    errorStateImageView.getLayoutParams().height = errorStateImageHeight;
    errorStateImageView.requestLayout();
    errorStateContentTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, errorStateContentTextSize);
    errorStateContentTextView.setTextColor(errorStateContentTextColor);
    errorStateButton.setTextSize(TypedValue.COMPLEX_UNIT_SP, errorStateButtonTextSize);
    errorStateButton.setTextColor(errorStateButtonTextColor);
    //Set background color if not TRANSPARENT
    if (errorStateBackgroundColor != Color.TRANSPARENT) {
      this.setBackgroundColor(errorStateBackgroundColor);
    }
    layoutParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
        ViewGroup.LayoutParams.MATCH_PARENT);
    layoutParams.addRule(CENTER_IN_PARENT);
    addView(errorStateRelativeLayout, layoutParams);
  } else {
    errorStateRelativeLayout.setVisibility(VISIBLE);
  }
}
origin: nguyenhoanglam/ProgressLayout

private void setLoadingView() {
  if (loadingStateRelativeLayout == null) {
    view = inflater.inflate(R.layout.progress_loading_view, null);
    loadingStateRelativeLayout = (RelativeLayout) view.findViewById(R.id.loadingStateRelativeLayout);
    loadingStateRelativeLayout.setTag(TAG_LOADING);
    loadingStateProgressBar = (ProgressWheel) view.findViewById(R.id.loadingStateProgressBar);
    loadingStateProgressBar.getLayoutParams().width = loadingStateProgressBarRadius;
    loadingStateProgressBar.getLayoutParams().height = loadingStateProgressBarRadius;
    loadingStateProgressBar.setBarWidth(loadingStateProgressBarSpinWidth);
    if (loadingStateProgressBarColor != Color.TRANSPARENT) {
      loadingStateProgressBar.setBarColor(loadingStateProgressBarColor);
    }
    loadingStateProgressBar.requestLayout();
    //Set background color if not TRANSPARENT
    if (loadingStateBackgroundColor != Color.TRANSPARENT) {
      this.setBackgroundColor(loadingStateBackgroundColor);
    }
    layoutParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
        ViewGroup.LayoutParams.MATCH_PARENT);
    layoutParams.addRule(CENTER_IN_PARENT);
    addView(loadingStateRelativeLayout, layoutParams);
  } else {
    loadingStateRelativeLayout.setVisibility(VISIBLE);
  }
}
origin: nguyenhoanglam/ProgressLayout

private void hideErrorView() {
  if (errorStateRelativeLayout != null) {
    errorStateRelativeLayout.setVisibility(GONE);
    //Restore the background color if not TRANSPARENT
    if (errorStateBackgroundColor != Color.TRANSPARENT) {
      this.setBackgroundDrawable(currentBackground);
    }
  }
}
origin: nguyenhoanglam/ProgressLayout

public ProgressLayout(Context context, AttributeSet attrs) {
  super(context, attrs);
  init(attrs);
}
origin: nguyenhoanglam/ProgressLayout

private void hideLoadingView() {
  if (loadingStateRelativeLayout != null) {
    loadingStateRelativeLayout.setVisibility(GONE);
    //Restore the background color if not TRANSPARENT
    if (loadingStateBackgroundColor != Color.TRANSPARENT) {
      this.setBackgroundDrawable(currentBackground);
    }
  }
}
com.nguyenhoanglam.progresslayoutProgressLayout

Most used methods

  • addView
  • getBackground
  • getContext
  • getResources
  • hideEmptyView
  • hideErrorView
  • hideLoadingView
  • init
  • setBackgroundColor
  • setBackgroundDrawable
  • setContentVisibility
  • setEmptyView
  • setContentVisibility,
  • setEmptyView,
  • setErrorView,
  • setLoadingView,
  • showEmpty,
  • showError,
  • showLoading,
  • switchState

Popular in Java

  • Running tasks concurrently on multiple threads
  • runOnUiThread (Activity)
  • requestLocationUpdates (LocationManager)
  • setRequestProperty (URLConnection)
  • String (java.lang)
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Runner (org.openjdk.jmh.runner)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now