android.widget.PopupWindow#setSplitTouchEnabled ( )源码实例Demo

下面列出了android.widget.PopupWindow#setSplitTouchEnabled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

public PastePopupMenu() {
    mContainer = new PopupWindow(mContext, null,
            android.R.attr.textSelectHandleWindowStyle);
    mContainer.setSplitTouchEnabled(true);
    mContainer.setClippingEnabled(false);

    mContainer.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
    mContainer.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);

    final int[] POPUP_LAYOUT_ATTRS = {
        android.R.attr.textEditPasteWindowLayout,
        android.R.attr.textEditNoPasteWindowLayout,
        android.R.attr.textEditSidePasteWindowLayout,
        android.R.attr.textEditSideNoPasteWindowLayout,
    };

    mPasteViews = new View[POPUP_LAYOUT_ATTRS.length];
    mPasteViewLayouts = new int[POPUP_LAYOUT_ATTRS.length];

    TypedArray attrs = mContext.obtainStyledAttributes(POPUP_LAYOUT_ATTRS);
    for (int i = 0; i < attrs.length(); ++i) {
        mPasteViewLayouts[i] = attrs.getResourceId(attrs.getIndex(i), 0);
    }
    attrs.recycle();
}
 
public PastePopupMenu() {
    mContainer = new PopupWindow(mContext, null,
            android.R.attr.textSelectHandleWindowStyle);
    mContainer.setSplitTouchEnabled(true);
    mContainer.setClippingEnabled(false);

    mContainer.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
    mContainer.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);

    final int[] POPUP_LAYOUT_ATTRS = {
        android.R.attr.textEditPasteWindowLayout,
        android.R.attr.textEditNoPasteWindowLayout,
        android.R.attr.textEditSidePasteWindowLayout,
        android.R.attr.textEditSideNoPasteWindowLayout,
    };

    mPasteViews = new View[POPUP_LAYOUT_ATTRS.length];
    mPasteViewLayouts = new int[POPUP_LAYOUT_ATTRS.length];

    TypedArray attrs = mContext.obtainStyledAttributes(POPUP_LAYOUT_ATTRS);
    for (int i = 0; i < attrs.length(); ++i) {
        mPasteViewLayouts[i] = attrs.getResourceId(attrs.getIndex(i), 0);
    }
    attrs.recycle();
}
 
源代码3 项目: revolution-irc   文件: TextSelectionHandlePopup.java
public TextSelectionHandlePopup(Context ctx, boolean rightHandle) {
    mView = new TextSelectionHandleView(ctx, rightHandle);
    mWindow = new PopupWindow(mView.getContext(), null, android.R.attr.textSelectHandleWindowStyle);
    mWindow.setSplitTouchEnabled(true);
    mWindow.setClippingEnabled(false);
    mWindow.setContentView(mView);
    mWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
    mWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
    mView.measure(0, 0);
}
 
源代码4 项目: 365browser   文件: LegacyPastePopupMenu.java
public LegacyPastePopupMenu(
        Context context, View parent, final PastePopupMenuDelegate delegate) {
    mParent = parent;
    mDelegate = delegate;
    mContext = context;
    mContainer = new PopupWindow(mContext, null, android.R.attr.textSelectHandleWindowStyle);
    mContainer.setSplitTouchEnabled(true);
    mContainer.setClippingEnabled(false);
    mContainer.setAnimationStyle(0);

    mContainer.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
    mContainer.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);

    final int[] popupLayoutAttrs = {
            android.R.attr.textEditPasteWindowLayout,
    };

    TypedArray attrs = mContext.getTheme().obtainStyledAttributes(popupLayoutAttrs);
    mPasteViewLayout = attrs.getResourceId(attrs.getIndex(0), 0);

    attrs.recycle();

    // Convert line offset dips to pixels.
    mLineOffsetY = (int) TypedValue.applyDimension(
            TypedValue.COMPLEX_UNIT_DIP, 5.0f, mContext.getResources().getDisplayMetrics());
    mWidthOffsetX = (int) TypedValue.applyDimension(
            TypedValue.COMPLEX_UNIT_DIP, 30.0f, mContext.getResources().getDisplayMetrics());

    final int statusBarHeightResourceId =
            mContext.getResources().getIdentifier("status_bar_height", "dimen", "android");
    if (statusBarHeightResourceId > 0) {
        mStatusBarHeight =
                mContext.getResources().getDimensionPixelSize(statusBarHeightResourceId);
    }
}
 
源代码5 项目: android-chromium   文件: HandleView.java
HandleView(CursorController controller, int pos, View parent,
        PositionObserver parentPositionObserver) {
    super(parent.getContext());
    Context context = parent.getContext();
    mParent = parent;
    mController = controller;
    mContainer = new PopupWindow(context, null, android.R.attr.textSelectHandleWindowStyle);
    mContainer.setSplitTouchEnabled(true);
    mContainer.setClippingEnabled(false);

    TypedArray a = context.obtainStyledAttributes(TEXT_VIEW_HANDLE_ATTRS);
    mTextSelectHandleLeftRes = a.getResourceId(a.getIndex(LEFT), 0);
    mTextSelectHandleRes = a.getResourceId(a.getIndex(CENTER), 0);
    mTextSelectHandleRightRes = a.getResourceId(a.getIndex(RIGHT), 0);
    a.recycle();

    setOrientation(pos);

    // Convert line offset dips to pixels.
    mLineOffsetY = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
            LINE_OFFSET_Y_DIP, context.getResources().getDisplayMetrics());

    mAlpha = 1.f;

    mParentPositionListener = new PositionObserver.Listener() {
        @Override
        public void onPositionChanged(int x, int y) {
            updateParentPosition(x, y);
        }
    };
    mParentPositionObserver = parentPositionObserver;
}
 
源代码6 项目: android-chromium   文件: HandleView.java
HandleView(CursorController controller, int pos, View parent,
        PositionObserver parentPositionObserver) {
    super(parent.getContext());
    Context context = parent.getContext();
    mParent = parent;
    mController = controller;
    mContainer = new PopupWindow(context, null, android.R.attr.textSelectHandleWindowStyle);
    mContainer.setSplitTouchEnabled(true);
    mContainer.setClippingEnabled(false);

    TypedArray a = context.obtainStyledAttributes(TEXT_VIEW_HANDLE_ATTRS);
    mTextSelectHandleLeftRes = a.getResourceId(a.getIndex(LEFT), 0);
    mTextSelectHandleRes = a.getResourceId(a.getIndex(CENTER), 0);
    mTextSelectHandleRightRes = a.getResourceId(a.getIndex(RIGHT), 0);
    a.recycle();

    setOrientation(pos);

    // Convert line offset dips to pixels.
    mLineOffsetY = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
            LINE_OFFSET_Y_DIP, context.getResources().getDisplayMetrics());

    mAlpha = 1.f;

    mParentPositionListener = new PositionObserver.Listener() {
        @Override
        public void onPositionChanged(int x, int y) {
            updateParentPosition(x, y);
        }
    };
    mParentPositionObserver = parentPositionObserver;
}