com.taobao.weex.ui.view.WXCircleIndicator Java Examples

The following examples show how to use com.taobao.weex.ui.view.WXCircleIndicator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WXSlider.java    From ucar-weex-core with Apache License 2.0 6 votes vote down vote up
@Override
protected void addSubView(View view, int index) {
  if (view == null || mAdapter == null) {
    return;
  }

  if (view instanceof WXCircleIndicator) {
    return;
  }
  mAdapter.addPageView(view);
  hackTwoItemsInfiniteScroll();
  if (initIndex != -1 && mAdapter.getRealCount() > initIndex) {
    mViewPager.setCurrentItem(initIndex);
    initIndex = -1;
  } else {
    mViewPager.setCurrentItem(0);
  }
  if (mIndicator != null) {
    mIndicator.getHostView().forceLayout();
    mIndicator.getHostView().requestLayout();
  }
}
 
Example #2
Source File: WXSlider.java    From weex-uikit with MIT License 6 votes vote down vote up
@Override
protected void addSubView(View view, int index) {
  if (view == null || mAdapter == null) {
    return;
  }

  if (view instanceof WXCircleIndicator) {
    return;
  }
  mAdapter.addPageView(view);
  mViewPager.setCurrentItem(0);
  if (mIndicator != null) {
    mIndicator.getHostView().forceLayout();
    mIndicator.getHostView().requestLayout();
  }
}
 
Example #3
Source File: WXSlider.java    From weex with Apache License 2.0 6 votes vote down vote up
@Override
protected void addSubView(View view, int index) {
  if (view == null || mAdapter == null) {
    return;
  }

  if (view instanceof WXCircleIndicator) {
    return;
  }
  mAdapter.addPageView(view);
  mAdapter.notifyDataSetChanged();
  if (mIndicator != null) {
    mIndicator.getView().forceLayout();
    mIndicator.getView().requestLayout();
  }
}
 
Example #4
Source File: WXSlider.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
public void addIndicator(WXIndicator indicator) {
  FrameLayout root = getHostView();
  if (root == null) {
    return;
  }
  mIndicator = indicator;
  WXCircleIndicator indicatorView = indicator.getHostView();
  if (indicatorView != null) {
    indicatorView.setCircleViewPager(mViewPager);
    // indicatorView.setOnPageChangeListener(mPageChangeListener);  // commented for twice onChange() called when do slide.
    root.addView(indicatorView);
  }

}
 
Example #5
Source File: WXIndicator.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
@Override
protected WXCircleIndicator initComponentHostView(@NonNull Context context) {
  WXCircleIndicator view = new WXCircleIndicator(context);
  if (getParent() instanceof WXSlider) {
    return view;
  } else {
    if (WXEnvironment.isApkDebugable()) {
      throw new WXRuntimeException("WXIndicator initView error.");
    }
  }
  return null;
}
 
Example #6
Source File: WXIndicator.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
@Override
protected void onHostViewInitialized(WXCircleIndicator host) {
  super.onHostViewInitialized(host);
  if (getParent() instanceof WXSlider) {
    ((WXSlider) getParent()).addIndicator(this);
  }
}
 
Example #7
Source File: WXSlider.java    From weex-uikit with MIT License 5 votes vote down vote up
public void addIndicator(WXIndicator indicator) {
  FrameLayout root = getHostView();
  if (root == null) {
    return;
  }
  mIndicator = indicator;
  WXCircleIndicator indicatorView = indicator.getHostView();
  if (indicatorView != null) {
    indicatorView.setCircleViewPager(mViewPager);
    // indicatorView.setOnPageChangeListener(mPageChangeListener);  // commented for twice onChange() called when do slide.
    root.addView(indicatorView);
  }

}
 
Example #8
Source File: WXIndicator.java    From weex-uikit with MIT License 5 votes vote down vote up
@Override
protected WXCircleIndicator initComponentHostView(@NonNull Context context) {
  WXCircleIndicator view = new WXCircleIndicator(context);
  if (getParent() instanceof WXSlider) {
    return view;
  } else {
    if (WXEnvironment.isApkDebugable()) {
      throw new WXRuntimeException("WXIndicator initView error.");
    }
  }
  return null;
}
 
Example #9
Source File: WXIndicator.java    From weex-uikit with MIT License 5 votes vote down vote up
@Override
protected void onHostViewInitialized(WXCircleIndicator host) {
  super.onHostViewInitialized(host);
  if (getParent() instanceof WXSlider) {
    ((WXSlider) getParent()).addIndicator(this);
  }
}
 
Example #10
Source File: WXSliderNeighbor.java    From weex-uikit with MIT License 5 votes vote down vote up
@Override
protected void addSubView(View view, int index) {
    if (view == null || mAdapter == null) {
        return;
    }

    if (view instanceof WXCircleIndicator) {
        return;
    }

    FrameLayout wrapper = new FrameLayout(getContext());
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.gravity = Gravity.CENTER;
    view.setLayoutParams(params);
    wrapper.addView(view);
    super.addSubView(wrapper,index);
    updateAdapterScaleAndAlpha(mNeighborAlpha, mNeighborScale); // we need to set neighbor view status when added.

    view.postDelayed(WXThread.secure(new Runnable() {
        @Override
        public void run() {
            int childCountByDomTree = getNeighborChildrenCount();
            if(mAdapter.getRealCount() == childCountByDomTree || childCountByDomTree == -1) { // -1 mean failed at get child count by travel the dom tree.
                mViewPager.setPageTransformer(false, createTransformer());
            }
        }
    }), 100); // we need to set the PageTransformer when all children has been rendered.

}
 
Example #11
Source File: WXIndicator.java    From weex with Apache License 2.0 5 votes vote down vote up
@Override
protected void initView() {
  mHost = new WXCircleIndicator(mContext);
  if (mParent instanceof WXSlider) {
    ((WXSlider) mParent).addIndicator(this);
  } else {
    if (WXEnvironment.isApkDebugable()) {
      throw new WXRuntimeException("WXIndicator initView error.");
    }
  }
}
 
Example #12
Source File: WXIndicator.java    From ucar-weex-core with Apache License 2.0 4 votes vote down vote up
@Override
protected void setHostLayoutParams(WXCircleIndicator host, int width, int height, int left, int right, int top, int bottom) {
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(width, height);
    params.setMargins(left, top, right, bottom);
    host.setLayoutParams(params);
}
 
Example #13
Source File: WXIndicator.java    From weex-uikit with MIT License 4 votes vote down vote up
@Override
protected void setHostLayoutParams(WXCircleIndicator host, int width, int height, int left, int right, int top, int bottom) {
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(width, height);
    params.setMargins(left, top, right, bottom);
    host.setLayoutParams(params);
}
 
Example #14
Source File: WXIndicator.java    From weex with Apache License 2.0 4 votes vote down vote up
@Override
public WXCircleIndicator getView() {
  return (WXCircleIndicator) super.getView();
}