Git Product home page Git Product logo

Comments (6)

cwjfeifei avatar cwjfeifei commented on June 16, 2024

我这边也是这样,点击响应明显比其他没有置顶悬浮的响应慢,你这边有解决方案吗

from pinnedsectionitemdecoration.

oubowu avatar oubowu commented on June 16, 2024

你们普通的item是直接设置点击事件的?还是通过itemtouchhelper

from pinnedsectionitemdecoration.

fuguiniao avatar fuguiniao commented on June 16, 2024

普通的直接设置点击事件 setOnClickListener 悬浮的是下面的
setHeaderClickListener(new OnHeaderClickListener() {
@OverRide
public void onHeaderClick(View view, int id, int position) {
}

from pinnedsectionitemdecoration.

oubowu avatar oubowu commented on June 16, 2024

` @OverRide
public boolean onSingleTapUp(MotionEvent e) {
Log.e(TAG, "GestureListener-81行-onSingleTapUp(): ");
shouldIntercept(e);

        return mIntercept;
    }

    @Override
    public boolean onSingleTapConfirmed(MotionEvent e) {
        Log.e(TAG, "GestureListener-113行-onSingleTapConfirmed(): ");

        if (!mDisableHeaderClick && mIntercept && mHeaderClickListener != null && mAdapter != null && mPosition <= mAdapter.getItemCount() - 1) {
            // 自己处理点击标签事件
            try {
                mHeaderClickListener.onHeaderClick(mTmpView, mTmpClickId, mPosition);
            } catch (IndexOutOfBoundsException e1) {
                e1.printStackTrace();
                // Log.e("TAG", "GestureListener-183行-onSingleTapConfirmed(): " + e1);
            }
        }

        return super.onSingleTapConfirmed(e);
    }`

原因在这里,头部事件处理使用GestureDetector来处理,双击和单击都会触发onSingleTapUp,所有单击的处理放到onSingleTapConfirmed处理,要不然放在onSingleTapUp做双击事件会触发单击的冲突了,所以会慢一点,我看下怎么优化吧

from pinnedsectionitemdecoration.

fuguiniao avatar fuguiniao commented on June 16, 2024

好的,辛苦了!

from pinnedsectionitemdecoration.

oubowu avatar oubowu commented on June 16, 2024

更新到1.3.0版本 我去掉了双击的头部监听了 单击事件速度跟普通item的点击事件一样了 以后双击的处理就是由宿主自己在头部单击回调那里自己处理连续点击的逻辑了 @fuguiniao @cwjfeifei

from pinnedsectionitemdecoration.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.