Java Code Examples for android.view.ViewGroup#getRight()

The following examples show how to use android.view.ViewGroup#getRight() . 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: SwipeLayout.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public boolean onDoubleTap(MotionEvent e) {
    if (mDoubleClickListener != null) {
        View target;
        ViewGroup bottom = getBottomView();
        ViewGroup surface = getSurfaceView();
        if (e.getX() > bottom.getLeft() && e.getX() < bottom.getRight()
                && e.getY() > bottom.getTop()
                && e.getY() < bottom.getBottom()) {
            target = bottom;
        } else {
            target = surface;
        }
        mDoubleClickListener.onDoubleClick(SwipeLayout.this,
                target == surface);
    }
    return true;
}
 
Example 2
Source File: SwipeLayoutConv.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public boolean onDoubleTap(MotionEvent e) {
    if (mDoubleClickListener != null) {
        View target;
        ViewGroup bottom = getBottomView();
        ViewGroup surface = getSurfaceView();
        if (e.getX() > bottom.getLeft() && e.getX() < bottom.getRight()
                && e.getY() > bottom.getTop()
                && e.getY() < bottom.getBottom()) {
            target = bottom;
        } else {
            target = surface;
        }
        mDoubleClickListener.onDoubleClick(SwipeLayoutConv.this,
                target == surface);
    }
    return true;
}
 
Example 3
Source File: HintCaseView.java    From hintcase with Apache License 2.0 6 votes vote down vote up
private void calculateHintBlockPosition(ViewGroup parent, Shape shape) {
    if (targetView == NO_TARGETVIEW) {
        hintBlockPosition = HintCase.HINT_BLOCK_POSITION_CENTER;
    } else {
        int[] areas = new int[4];
        areas[HintCase.HINT_BLOCK_POSITION_LEFT] = shape.getLeft() - parent.getLeft();
        areas[HintCase.HINT_BLOCK_POSITION_TOP] = shape.getTop() - parent.getTop();
        areas[HintCase.HINT_BLOCK_POSITION_RIGHT] = parent.getRight() - shape.getRight();
        areas[HintCase.HINT_BLOCK_POSITION_BOTTOM] = parent.getBottom() - shape.getBottom();
        hintBlockPosition = HintCase.HINT_BLOCK_POSITION_LEFT;
        for(int i = 1; i < areas.length; i++) {
            if(areas[i] >= areas[hintBlockPosition]) {
                hintBlockPosition = i;
            }
        }
    }
}
 
Example 4
Source File: SwipeLayout.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onDoubleTap(MotionEvent e) {
    if(mDoubleClickListener != null){
        View target;
        ViewGroup bottom = getBottomView();
        ViewGroup surface = getSurfaceView();
        if(e.getX() > bottom.getLeft() && e.getX() < bottom.getRight()
                && e.getY() > bottom.getTop() && e.getY() < bottom.getBottom()){
            target = bottom;
        }else{
            target = surface;
        }
        mDoubleClickListener.onDoubleClick(SwipeLayout.this, target == surface);
    }
    return true;
}
 
Example 5
Source File: PictureGridAdapter.java    From PicturePicker with Apache License 2.0 5 votes vote down vote up
@Override
public ItemPictureGridHolder onCreateViewHolder(ViewGroup parent, int viewType) {

    View itemView = LayoutInflater.from(activity).inflate(R.layout.item_picture_grid, parent, false);
    int itemViewWidth = (parent.getRight() - parent.getLeft()) / PictureGridActivity.RECYCLER_VIEW_COLUMN;
    //设置宽高 使其为正方形
    itemView.setLayoutParams(new RecyclerView.LayoutParams(itemViewWidth, itemViewWidth));
    return new ItemPictureGridHolder(itemView);
}
 
Example 6
Source File: MainActivity.java    From PicturePicker with Apache License 2.0 5 votes vote down vote up
@Override
public SampleHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    ImageView imageView = new ImageView(MainActivity.this);
    int w = (parent.getRight() - parent.getLeft()) / 3;
    imageView.setLayoutParams(new LinearLayout.LayoutParams(w, w));
    imageView.setPadding(1, 1, 1, 1);
    return new SampleHolder(imageView);
}