Java Code Examples for android.widget.PopupWindow#setSplitTouchEnabled()

The following examples show how to use android.widget.PopupWindow#setSplitTouchEnabled() . 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: InsertionHandleController.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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();
}
 
Example 2
Source File: InsertionHandleController.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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();
}
 
Example 3
Source File: TextSelectionHandlePopup.java    From revolution-irc with GNU General Public License v3.0 5 votes vote down vote up
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);
}
 
Example 4
Source File: LegacyPastePopupMenu.java    From 365browser with Apache License 2.0 5 votes vote down vote up
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);
    }
}
 
Example 5
Source File: HandleView.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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;
}
 
Example 6
Source File: HandleView.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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;
}