Codota Logo
ProgressLayout
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
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

  • Reading from database using SQL prepared statement
  • requestLocationUpdates (LocationManager)
  • addToBackStack (FragmentTransaction)
  • onCreateOptionsMenu (Activity)
  • ObjectMapper (com.fasterxml.jackson.databind)
    This mapper (or, data binder, or codec) provides functionality for converting between Java objects (
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now