gpt4 book ai didi

com.koolearn.klibrary.ui.android.view.ZLAndroidWidget类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 11:33:15 24 4
gpt4 key购买 nike

本文整理了Java中com.koolearn.klibrary.ui.android.view.ZLAndroidWidget类的一些代码示例,展示了ZLAndroidWidget类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZLAndroidWidget类的具体详情如下:
包路径:com.koolearn.klibrary.ui.android.view.ZLAndroidWidget
类名称:ZLAndroidWidget

ZLAndroidWidget介绍

暂无

代码示例

代码示例来源:origin: Jiangzqts/EpubRead

@Override
public void onDraw(final Canvas canvas) {
  final Context context = getContext();
  if (context instanceof KooReader) {
    ((KooReader) context).createWakeLock();
  } else {
    System.err.println("A surprise: view's context is not an KooReader");
  }
  myBitmapManager.setSize(getWidth(), getHeight());
  if (getAnimationProvider().inProgress()) {
    onDrawInScrolling(canvas); // 翻页过程中调用
  } else {
    onDrawStatic(canvas); // 首次/页面跳转时调用,防止黑屏
    ZLApplication.Instance().onRepaintFinished();
  }
}

代码示例来源:origin: ydcx/KooReader

public ZLAndroidWidget(Context context, AttributeSet attrs) {
  super(context, attrs);
  mySystemInfo = Paths.systemInfo(context);
  init();
}

代码示例来源:origin: ydcx/KooReader

@Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    return (myMainView != null && myMainView.onKeyDown(keyCode, event)) || super.onKeyDown(keyCode, event);
//        return (myCurlView != null && myCurlView.onKeyDown(keyCode, event)) || super.onKeyDown(keyCode, event);
  }

代码示例来源:origin: ydcx/KooReader

@Override
public void startManualScrolling(int x, int y, ZLView.Direction direction) {
  final AnimationProvider animator = getAnimationProvider();
  animator.setup(direction, getWidth(), getHeight(), myColorLevel);
  animator.startManualScrolling(x, y); // PreManualScrolling 先pre 然后判断是ManualScrolling还是NoScrolling
}

代码示例来源:origin: ydcx/KooReader

@Override
public void startAnimatedScrolling(ZLView.PageIndex pageIndex, int x, int y, ZLView.Direction direction, int speed) {
  final ZLView view = ZLApplication.Instance().getCurrentView();
  if (pageIndex == ZLView.PageIndex.current || !view.canScroll(pageIndex)) {
    return;
  }
  final AnimationProvider animator = getAnimationProvider();
  animator.setup(direction, getWidth(), getHeight(), myColorLevel);
  animator.startAnimatedScrolling(pageIndex, x, y, speed);
  if (animator.getMode().Auto) {
    postInvalidate();
  }
}

代码示例来源:origin: ydcx/KooReader

myLongClickPerformed = false;
  if (myPendingShortClickRunnable != null) {
    removeCallbacks(myPendingShortClickRunnable);
    myPendingShortClickRunnable = null;
    removeCallbacks(myPendingLongClickRunnable);
    myPendingLongClickRunnable = null;
  } else {
    if (myPendingLongClickRunnable != null) {
      removeCallbacks(myPendingLongClickRunnable);
      myPendingLongClickRunnable = null;
        postDelayed(myPendingShortClickRunnable, ViewConfiguration.getDoubleTapTimeout());
      } else {
        view.onFingerSingleTap(x, y);
case MotionEvent.ACTION_DOWN:
  if (myPendingShortClickRunnable != null) {
    removeCallbacks(myPendingShortClickRunnable);
    myPendingShortClickRunnable = null;
    myPendingDoubleTap = true;
  } else {
    postLongClickRunnable();
    myPendingPress = true;
  break;
case MotionEvent.ACTION_MOVE: {
  final int slop = ViewConfiguration.get(getContext()).getScaledTouchSlop();

代码示例来源:origin: ydcx/KooReader

public final void setScreenBrightness(int percent) { // 禁止子类覆盖
  if (percent < 1) {
    percent = 1;
  } else if (percent > 100) {
    percent = 100;
  }
  final Context context = getContext();
  if (!(context instanceof KooReaderMainActivity)) {
    return;
  }
  final float level;
  final Integer oldColorLevel = myColorLevel;
  if (percent >= 25) {
    // 100 => 1f; 25 => .01f
    level = .01f + (percent - 25) * .99f / 75;
    myColorLevel = null;
  } else {
    level = .01f;
    myColorLevel = 0x60 + (0xFF - 0x60) * Math.max(percent, 0) / 25;
  }
  final KooReaderMainActivity activity = (KooReaderMainActivity) context;
  activity.getZLibrary().ScreenBrightnessLevelOption.setValue(percent);
  activity.setScreenBrightnessSystem(level);
  if (oldColorLevel != myColorLevel) {
    updateColorLevel();
    postInvalidate();
  }
}

代码示例来源:origin: Jiangzqts/EpubRead

private void onDrawInScrolling(Canvas canvas) {
  final ZLView view = ZLApplication.Instance().getCurrentView();
  final AnimationProvider animator = getAnimationProvider();
  final AnimationProvider.Mode oldMode = animator.getMode();
  animator.doStep();
  if (animator.inProgress()) { // 动画过程中执行
    animator.draw(canvas); // 动画绘制
    if (animator.getMode().Auto) { // 松手后完成后续绘制
      postInvalidate();
    }
  } else {                     // 动画结束后执行, 无动画情况只会调用这个
    switch (oldMode) {
      case AnimatedScrollingForward: { // 当翻到 下一页/上一页 时调用
        final ZLView.PageIndex index = animator.getPageToScrollTo(); // 得到翻页后的KooView 向左翻->next 向右翻->previous
        // 若为next     -> next->current,current->previous
        // 若为previous -> current->next,previous->current
        myBitmapManager.shift(index == ZLView.PageIndex.next);
        view.onScrollingFinished(index);
        ZLApplication.Instance().onRepaintFinished();
        break;
      }
      case AnimatedScrollingBackward: // 没有翻到 下一页/上一页 则还在当前页
        view.onScrollingFinished(ZLView.PageIndex.current);
        break;
    }
    onDrawStatic(canvas);
  }
}

代码示例来源:origin: ydcx/KooReader

@Override
public void scrollManuallyTo(int x, int y) {
  final ZLView view = ZLApplication.Instance().getCurrentView();
  final AnimationProvider animator = getAnimationProvider();
  if (view.canScroll(animator.getPageToScrollTo(x, y))) { // 判断是否可以翻(是否有上/下一页)
    animator.scrollTo(x, y); // 一直在改变Mode的状态
    postInvalidate();
  }
}

代码示例来源:origin: ydcx/KooReader

public boolean isCurlAnimation(){
  if(getAnimationProvider() instanceof CurlPageProviderImpl){
    return true;
  }else{
    return false;
  }
}

代码示例来源:origin: Jiangzqts/EpubRead

void drawOnBitmap(Bitmap bitmap, ZLView.PageIndex index) {
  final ZLView view = ZLApplication.Instance().getCurrentView();
  if (view == null) {
    return;
  }
  final ZLAndroidPaintContext context = new ZLAndroidPaintContext(
      mySystemInfo,
      new Canvas(bitmap),
      new ZLAndroidPaintContext.Geometry(
          getWidth(),
          getHeight(),
          getWidth(),
          getHeight(),
          0,
          0
      ), 0);
  view.paint(context, index);
}

代码示例来源:origin: ydcx/KooReader

public final int getScreenBrightness() {
    if (myColorLevel != null) {
      return (myColorLevel - 0x60) * 25 / (0xFF - 0x60);
    }

    final Context context = getContext();
    if (!(context instanceof KooReaderMainActivity)) {
      return 50;
    }
    final float level = ((KooReaderMainActivity) context).getScreenBrightnessSystem();
    // level = .01f + (percent - 25) * .99f / 75;
    return 25 + (int) ((level - .01f) * 75 / .99f);
  }
}

代码示例来源:origin: ydcx/KooReader

myWidget.drawOnBitmap(myBitmaps[iIndex], index);
//        /**

代码示例来源:origin: ydcx/KooReader

@Override
public void startAnimatedScrolling(ZLView.PageIndex pageIndex, ZLView.Direction direction, int speed) {
  final ZLView view = ZLApplication.Instance().getCurrentView();
  if (pageIndex == ZLView.PageIndex.current || !view.canScroll(pageIndex)) {
    return;
  }
  final AnimationProvider animator = getAnimationProvider();
  animator.setup(direction, getWidth(), getHeight(), myColorLevel);
  animator.startAnimatedScrolling(pageIndex, null, null, speed);
  if (animator.getMode().Auto) {
    postInvalidate();
  }
}

代码示例来源:origin: Jiangzqts/EpubRead

myLongClickPerformed = false;
  if (myPendingShortClickRunnable != null) {
    removeCallbacks(myPendingShortClickRunnable);
    myPendingShortClickRunnable = null;
    removeCallbacks(myPendingLongClickRunnable);
    myPendingLongClickRunnable = null;
  } else {
    if (myPendingLongClickRunnable != null) {
      removeCallbacks(myPendingLongClickRunnable);
      myPendingLongClickRunnable = null;
        postDelayed(myPendingShortClickRunnable, ViewConfiguration.getDoubleTapTimeout());
      } else {
        view.onFingerSingleTap(x, y);
case MotionEvent.ACTION_DOWN:
  if (myPendingShortClickRunnable != null) {
    removeCallbacks(myPendingShortClickRunnable);
    myPendingShortClickRunnable = null;
    myPendingDoubleTap = true;
  } else {
    postLongClickRunnable();
    myPendingPress = true;
  break;
case MotionEvent.ACTION_MOVE: {
  final int slop = ViewConfiguration.get(getContext()).getScaledTouchSlop();

代码示例来源:origin: Jiangzqts/EpubRead

@Override
public void startManualScrolling(int x, int y, ZLView.Direction direction) {
  final AnimationProvider animator = getAnimationProvider();
  animator.setup(direction, getWidth(), getHeight(), myColorLevel);
  animator.startManualScrolling(x, y); // PreManualScrolling 先pre 然后判断是ManualScrolling还是NoScrolling
}

代码示例来源:origin: Jiangzqts/EpubRead

public final void setScreenBrightness(int percent) { // 禁止子类覆盖
  if (percent < 1) {
    percent = 1;
  } else if (percent > 100) {
    percent = 100;
  }
  final Context context = getContext();
  if (!(context instanceof KooReaderMainActivity)) {
    return;
  }
  final float level;
  final Integer oldColorLevel = myColorLevel;
  if (percent >= 25) {
    // 100 => 1f; 25 => .01f
    level = .01f + (percent - 25) * .99f / 75;
    myColorLevel = null;
  } else {
    level = .01f;
    myColorLevel = 0x60 + (0xFF - 0x60) * Math.max(percent, 0) / 25;
  }
  final KooReaderMainActivity activity = (KooReaderMainActivity) context;
  activity.getZLibrary().ScreenBrightnessLevelOption.setValue(percent);
  activity.setScreenBrightnessSystem(level);
  if (oldColorLevel != myColorLevel) {
    updateColorLevel();
    postInvalidate();
  }
}

代码示例来源:origin: ydcx/KooReader

private void onDrawInScrolling(Canvas canvas) {
  final ZLView view = ZLApplication.Instance().getCurrentView();
  final AnimationProvider animator = getAnimationProvider();
  final AnimationProvider.Mode oldMode = animator.getMode();
  animator.doStep();
  if (animator.inProgress()) { // 动画过程中执行
    animator.draw(canvas); // 动画绘制
    if (animator.getMode().Auto) { // 松手后完成后续绘制
      postInvalidate();
    }
  } else {                     // 动画结束后执行, 无动画情况只会调用这个
    switch (oldMode) {
      case AnimatedScrollingForward: { // 当翻到 下一页/上一页 时调用
        final ZLView.PageIndex index = animator.getPageToScrollTo(); // 得到翻页后的KooView 向左翻->next 向右翻->previous
        // 若为next     -> next->current,current->previous
        // 若为previous -> current->next,previous->current
        myBitmapManager.shift(index == ZLView.PageIndex.next);
        view.onScrollingFinished(index);
        ZLApplication.Instance().onRepaintFinished();
        break;
      }
      case AnimatedScrollingBackward: // 没有翻到 下一页/上一页 则还在当前页
        view.onScrollingFinished(ZLView.PageIndex.current);
        break;
    }
    onDrawStatic(canvas);
  }
}

代码示例来源:origin: ydcx/KooReader

@Override
public void startAnimatedScrolling(int x, int y, int speed) { // 翻页滑动
  final ZLView view = ZLApplication.Instance().getCurrentView();
  final AnimationProvider animator = getAnimationProvider();
  if (!view.canScroll(animator.getPageToScrollTo(x, y))) {
    animator.terminate();
    return;
  }
  animator.startAnimatedScrolling(x, y, speed);
  postInvalidate(); // 更新视图
}

代码示例来源:origin: Jiangzqts/EpubRead

public boolean isCurlAnimation(){
  return getAnimationProvider() instanceof CurlPageProviderImpl;
}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com