Exemplo n.º 1
0
        @Override
        public void run() {

          if (mViewGroup != null) {

            mViewGroup.postInvalidate();
          }
        }
  public void onRefreshViewPulled(float distance) {
    stopClosingAnimation();

    if (refreshable && refreshViewParent != null) {
      refreshViewParent.setVisibility(View.VISIBLE);
      refreshViewParent.getLayoutParams().height = (int) distance;
      refreshViewParent.setLayoutParams(refreshViewParent.getLayoutParams());
      refreshViewParent.postInvalidate();

      refreshImageView.onRefreshViewPulled(distance / refreshThreshold);
    }

    if (layoutEventListener != null) layoutEventListener.onOpenedDistanceChanged(distance);
  }
  /**
   * Call this method when asynchronous refresh has completed to reset the state of the Pull to
   * Refresh view
   */
  public void onRefreshCompleted() {
    pullToRefreshState = PullToRefreshState.NONE;
    this.refreshable = true;
    disableLoadingView();

    if (refreshViewParent != null) {
      refreshViewParent.getLayoutParams().height =
          (int) refreshViewParent.getResources().getDimension(R.dimen.cu__ptr_loading_image_height);
      refreshViewParent.setLayoutParams(refreshViewParent.getLayoutParams());
      refreshViewParent.postInvalidate();

      if (layoutEventListener != null)
        layoutEventListener.onOpenedDistanceChanged(refreshViewParent.getLayoutParams().height);

      onReleasedPullToRefreshViewBeforeThreshold();
    }
  }
  public void onRefreshViewClosed(boolean thresholdReached) {
    stopClosingAnimation();

    refreshViewParent.getLayoutParams().height = 0;
    refreshViewParent.setLayoutParams(refreshViewParent.getLayoutParams());
    refreshViewParent.setVisibility(View.GONE);
    refreshViewParent.postInvalidate();

    if (thresholdReached && refreshEventListener != null) {
      pullToRefreshState = PullToRefreshState.REFRESHING;
      enableLoadingView();
      refreshable = false;
      refreshEventListener.onRefresh();
    }

    if (layoutEventListener != null) layoutEventListener.onOpenedDistanceChanged(0);
  }
Exemplo n.º 5
0
  private void initEvent() {

    commonLabelArea.setVisibility(View.VISIBLE);

    mImageView.setOnDrawableEventListener(wpEditListener);
    mImageView.setSingleTapListener(
        () -> {
          EditTextActivity.openTextEdit(
              PhotoProcessActivity.this,
              new TagItem(mImageView.getmLastMotionScrollX(), mImageView.getmLastMotionScrollY()),
              AppConstants.ACTION_EDIT_LABEL);
          drawArea.postInvalidate();
        });

    titleBar.setRightBtnOnclickListener(
        v -> {
          savePicture();
        });
  }