GesturedListView.java 文件源码

java
阅读 18 收藏 0 点赞 0 评论 0

项目:orgzly-android 作者:
private void init(AttributeSet attrs) {
    maxFlingVelocity = ViewConfiguration.get(getContext()).getScaledMaximumFlingVelocity();
    minFlingVelocity = ViewConfiguration.get(getContext()).getScaledMinimumFlingVelocity();
    // touchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
    gestureDetector = new GestureDetector(getContext(), this);
    selector = getSelector();

    int menuContainerId = 0;
    HashMap<Gesture, Integer> gestureMenuMap = new HashMap<>();

    /* Get attributes from XML. */
    if (attrs != null) {
        TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.GesturedListView);

        menuContainerId = typedArray.getResourceId(R.styleable.GesturedListView_menu_container, 0);

        int child;

        child = typedArray.getInt(R.styleable.GesturedListView_menu_for_fling_left, -1);
        if (child != -1) {
            gestureMenuMap.put(Gesture.FLING_LEFT, child);
        }

        child = typedArray.getInt(R.styleable.GesturedListView_menu_for_fling_right, -1);
        if (child != -1) {
            gestureMenuMap.put(Gesture.FLING_RIGHT, child);
        }

        typedArray.recycle();
    }


    /* Disable selector. */
    // setSelector(android.R.color.transparent);

    itemMenus = new GesturedListViewItemMenus(this, gestureMenuMap, menuContainerId);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号