类android.widget.AbsoluteLayout源码实例Demo

下面列出了怎么用android.widget.AbsoluteLayout的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: MHViewer   文件: Slider.java
private void updateBubbleSize() {
    int oldWidth = mBubbleWidth;
    int oldHeight = mBubbleHeight;
    mBubbleWidth = (int) Math.max(mBubbleMinWidth,
            Integer.toString(mEnd).length() * mCharWidth + LayoutUtils.dp2pix(mContext, 8));
    mBubbleHeight = (int) Math.max(mBubbleMinHeight,
            mCharHeight + LayoutUtils.dp2pix(mContext, 8));

    if (oldWidth != mBubbleWidth && oldHeight != mBubbleHeight) {
        //noinspection deprecation
        AbsoluteLayout.LayoutParams lp = (AbsoluteLayout.LayoutParams) mBubble.getLayoutParams();
        lp.width = mBubbleWidth;
        lp.height = mBubbleHeight;
        mBubble.setLayoutParams(lp);
    }
}
 
源代码2 项目: oversec   文件: NodeGroupLayout.java
private boolean calcLayoutParams(AbsoluteLayout.LayoutParams params, Tree.TreeNode node, Rect parentBoundsInScreen) {
    Rect boundsInScreen = node.getBoundsInScreen();
    Rect boundsInParent = new Rect(boundsInScreen); //TODO pool
    if (!mIsRoot) {
        boundsInParent.offset(-parentBoundsInScreen.left, -parentBoundsInScreen.top); //calculate the real bounds in parent.
    }


    boolean changed = false;

    if (params.x != boundsInParent.left || params.y != boundsInParent.top || params.width != boundsInParent.width() || params.height != boundsInParent.height()) {
        params.x = boundsInParent.left;
        params.y = boundsInParent.top;
        params.width = boundsInParent.width();
        params.height = boundsInParent.height();
        changed = true;
    }

    return changed;


}
 
源代码3 项目: oversec   文件: NodeTextView.java
@Override
public void update(Tree.TreeNode node, Rect parentBoundsInScreen) {
    mUnused = false;
    mNode.recycle(false);
    mNode = node;


    //--------------------- update layout / dimensions

    AbsoluteLayout.LayoutParams params = (AbsoluteLayout.LayoutParams) getLayoutParams();
    boolean changed = calcLayoutParams(params, node, parentBoundsInScreen);
    if (changed) {
        setLayoutParams(params);
    }


    //----------------------- update contents

    readNodeInfo(false);
}
 
源代码4 项目: fuckView   文件: FullScreenPopupWindow.java
/**
 * 上层View点击后会使下层接收不到事件,这里用了一种极其愚蠢的方法...
 *
 * @param x x axis
 * @param y y axis
 * @return
 */

private View getTouchView(int x, int y) {
    View v = null;
    AbsoluteLayout.LayoutParams minParam = null;
    for (int i = 0; i < absoluteLayout.getChildCount(); i++) {
        View view = absoluteLayout.getChildAt(i);

        AbsoluteLayout.LayoutParams param = (AbsoluteLayout.LayoutParams) view.getLayoutParams();
        if (x >= param.x && x <= (param.x + param.width)) {
            if (y >= param.y && y <= (param.y + param.height)) {
                if (v == null || (minParam.height * minParam.width > param.width * param.height)) {
                    v = view;
                    minParam = param;
                }
            }
        }
    }
    return v;
}
 
源代码5 项目: Nimingban   文件: Slider.java
private void updateBubbleSize() {
    int oldWidth = mBubbleWidth;
    int oldHeight = mBubbleHeight;
    mBubbleWidth = (int) Math.max(mBubbleMinWidth,
            Integer.toString(mEnd).length() * mCharWidth + LayoutUtils.dp2pix(mContext, 8));
    mBubbleHeight = (int) Math.max(mBubbleMinHeight,
            mCharHeight + LayoutUtils.dp2pix(mContext, 8));

    if (oldWidth != mBubbleWidth && oldHeight != mBubbleHeight) {
        //noinspection deprecation
        AbsoluteLayout.LayoutParams lp = (AbsoluteLayout.LayoutParams) mBubble.getLayoutParams();
        lp.width = mBubbleWidth;
        lp.height = mBubbleHeight;
        mBubble.setLayoutParams(lp);
    }
}
 
源代码6 项目: EhViewer   文件: Slider.java
private void updateBubbleSize() {
    int oldWidth = mBubbleWidth;
    int oldHeight = mBubbleHeight;
    mBubbleWidth = (int) Math.max(mBubbleMinWidth,
            Integer.toString(mEnd).length() * mCharWidth + LayoutUtils.dp2pix(mContext, 8));
    mBubbleHeight = (int) Math.max(mBubbleMinHeight,
            mCharHeight + LayoutUtils.dp2pix(mContext, 8));

    if (oldWidth != mBubbleWidth && oldHeight != mBubbleHeight) {
        //noinspection deprecation
        AbsoluteLayout.LayoutParams lp = (AbsoluteLayout.LayoutParams) mBubble.getLayoutParams();
        lp.width = mBubbleWidth;
        lp.height = mBubbleHeight;
        mBubble.setLayoutParams(lp);
    }
}
 
源代码7 项目: RePlugin-GameSdk   文件: HWWebView.java
@SuppressLint("SetJavaScriptEnabled")
@SuppressWarnings("deprecation")
public HWWebView(Context context) {
	super(context);
	mMebView=this;
	this.mContext = context;

	int screenWidth = ((Activity) context).getWindowManager()
			.getDefaultDisplay().getWidth(); // 屏幕宽(像素,如:480px)
	int screenHeight = ((Activity) context).getWindowManager()
			.getDefaultDisplay().getHeight(); // 屏幕高(像素,如:800p)

	progressBar = new ProgressBar(context, null,
			android.R.attr.progressBarStyle);
	progressBar.setVisibility(View.GONE);

	AbsoluteLayout.LayoutParams progressBarParams = new AbsoluteLayout.LayoutParams(
			60, 60, (screenWidth - 60) / 2, (screenHeight - 60) / 2);

	this.addView(progressBar, progressBarParams);

	WebSettings set = this.getSettings();
	set.setSavePassword(false);
	set.setSaveFormData(false);
	set.setJavaScriptEnabled(true);
	set.setJavaScriptCanOpenWindowsAutomatically(true);

	this.setWebViewClient(new HWWebViewClient());
}
 
源代码8 项目: oversec   文件: NodeGroupLayout.java
public NodeGroupLayout(boolean isRoot, Core core, Tree.TreeNode node, Rect parentBoundsInScreen, OverlayDecryptView overlayDecryptView, CryptoHandlerFacade cryptoHandlerFacade) {
    super(core.getCtx());
    mIsRoot = isRoot;
    mCore = core;
    mNode = node;
    mOverlayDecryptView = overlayDecryptView;
    mCryptoHandlerFacade = cryptoHandlerFacade;

    //--------------------- update layout / dimensions

    AbsoluteLayout.LayoutParams params = new AbsoluteLayout.LayoutParams(0, 0, 0, 0);
    calcLayoutParams(params, node, parentBoundsInScreen);
    setLayoutParams(params);


    //----------------------- update contents
    // setBackgroundColor(Color.parseColor("#3300FF00"));

    int cc = node.getChildCount();
    for (int i = 0; i < cc; i++) {
        View childView = null;
        if (node.getChildAt(i).isTextNode()) {
            childView = new NodeTextView(mCore, node.getChildAt(i), node.getBoundsInScreen(), overlayDecryptView, cryptoHandlerFacade);
        } else {
            childView = new NodeGroupLayout(mCore, node.getChildAt(i), node.getBoundsInScreen(), overlayDecryptView, cryptoHandlerFacade);
        }
        addView(childView);
    }


}
 
源代码9 项目: oversec   文件: NodeGroupLayout.java
public void makeSpaceAbove(int px) {
    AbsoluteLayout.LayoutParams lp = (LayoutParams) getLayoutParams();
    lp.y = lp.y - px;
    if (lp.y < 0) {
        ViewParent vp = getParent();
        if (vp != null && vp instanceof NodeGroupLayout) {
            NodeGroupLayout parent = (NodeGroupLayout) vp;
            parent.makeSpaceAbove(-lp.y);
            lp.y = 0;
        }
    }
    lp.height = lp.height + px;
    setLayoutParams(lp);
}
 
源代码10 项目: oversec   文件: OverlayInfoButtonView.java
public OverlayInfoButtonView(Core core, String encryptedText, Rect boundsInScreen, String packageName) {
    super(core, packageName);
    mEncryptedText = encryptedText;
    mBoundsInScreen = new Rect(boundsInScreen);

    mHeight = core.dipToPixels(HEIGHT_DP);
    //noinspection SuspiciousNameCombination
    mWidth = mHeight;

    updateLayoutParams();

    ContextThemeWrapper ctw = new ContextThemeWrapper(core.getCtx(), R.style.AppTheme);
    mView = (ImageButton) LayoutInflater.from(ctw)
            .inflate(R.layout.overlay_info_button, null);

    //noinspection deprecation
    addView(mView, new AbsoluteLayout.LayoutParams(mWidth, mHeight, 0, 0));

    calcPosition();

    mView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            mCore.removeOverlayDecrypt(false);
            EncryptionInfoActivity.Companion.show(getContext(), mPackageName, mEncryptedText, mView);
        }
    });
}
 
源代码11 项目: oversec   文件: NodeTextView.java
public void setRightDrawableWidthChecked(int width) {
    if (mRightDrawableWidth != width) {

        AbsoluteLayout.LayoutParams params = (AbsoluteLayout.LayoutParams) getLayoutParams();
        params.width = params.width - mRightDrawableWidth + width;
        setLayoutParams(params);
        mRightDrawableWidth = width;
    }


}
 
源代码12 项目: fuckView   文件: FullScreenPopupWindow.java
private void init(final Context context) {


        for (ViewDumper.ViewItem item : list) {
            TextView tv = new TextView(context);
            tv.setTag(item);
            //红框
            GradientDrawable redBounds = new GradientDrawable();
            redBounds.setStroke(2, Color.RED);
            redBounds.setColor(Color.TRANSPARENT);
            tv.setBackgroundDrawable(redBounds);
            AbsoluteLayout.LayoutParams layoutParams = new AbsoluteLayout.LayoutParams(item.wh.x, item.wh.y, item.bounds.x, item.bounds.y - getStatusBarHeight());
            absoluteLayout.addView(tv, layoutParams);
        }
    }
 
源代码13 项目: fuckView   文件: RedBoundPopupWindow.java
@Override
protected View onCreateView(Context context) {
    AbsoluteLayout absoluteLayout = new AbsoluteLayout(context);
    GradientDrawable gd = new GradientDrawable();
    gd.setStroke(4, Color.RED);
    absoluteLayout.setBackgroundDrawable(gd);
    return absoluteLayout;
}
 
源代码14 项目: Jreader   文件: MainActivity.java
public void closeBookAnimation() {

        if (mIsOpen && wmRootView!=null) {
            //因为书本打开后会移动到第一位置,所以要设置新的位置参数
            contentAnimation.setmPivotXValue(bookShelf.getFirstLocation()[0]);
            contentAnimation.setmPivotYValue(bookShelf.getFirstLocation()[1]);
            coverAnimation.setmPivotXValue(bookShelf.getFirstLocation()[0]);
            coverAnimation.setmPivotYValue(bookShelf.getFirstLocation()[1]);

            AbsoluteLayout.LayoutParams params = new AbsoluteLayout.LayoutParams(
                    itemTextView.getLayoutParams());
            params.x = bookShelf.getFirstLocation()[0];
            params.y = bookShelf.getFirstLocation()[1];//firstLocation[1]在滑动的时候回改变,所以要在dispatchDraw的时候获取该位置值
            wmRootView.updateViewLayout(cover,params);
            wmRootView.updateViewLayout(content,params);
            //动画逆向运行
            if (!contentAnimation.getMReverse()) {
                contentAnimation.reverse();
            }
            if (!coverAnimation.getMReverse()) {
                coverAnimation.reverse();
            }
            //清除动画再开始动画
            content.clearAnimation();
            content.startAnimation(contentAnimation);
            cover.clearAnimation();
            cover.startAnimation(coverAnimation);
        }
    }
 
源代码15 项目: callmeter   文件: AmbilWarnaDialog.java
@SuppressWarnings("deprecation")
protected void letakkanPanah() {
    float y = this.ukuranUiPx - (this.hue * this.ukuranUiPx / 360.f);
    if (y == this.ukuranUiPx) {
        y = 0.f;
    }

    AbsoluteLayout.LayoutParams layoutParams = (AbsoluteLayout.LayoutParams) this.panah
            .getLayoutParams();
    layoutParams.y = (int) (y + 4);
    this.panah.setLayoutParams(layoutParams);
}
 
源代码16 项目: callmeter   文件: AmbilWarnaDialog.java
@SuppressWarnings("deprecation")
protected void letakkanKeker() {
    float x = this.sat * this.ukuranUiPx;
    float y = (1.f - this.val) * this.ukuranUiPx;

    AbsoluteLayout.LayoutParams layoutParams = (AbsoluteLayout.LayoutParams) this.viewKeker
            .getLayoutParams();
    layoutParams.x = (int) (x + 3);
    layoutParams.y = (int) (y + 3);
    this.viewKeker.setLayoutParams(layoutParams);
}
 
源代码17 项目: ans-android-sdk   文件: ViewSnapshot.java
@SuppressWarnings("deprecation")
private void addProperties(JsonWriter j, View v) throws IOException {
    final Class<?> viewClass = v.getClass();
    boolean processable = true;
    for (final PropertyDescription desc : mProperties) {
        if (desc.targetClass.isAssignableFrom(viewClass) && null != desc.accessor) {
            final Object value = desc.accessor.applyMethod(v);

            if (processable) {
                if (!TextUtils.isEmpty(desc.name)) {
                    if ("clickable".equals(desc.name)) {
                        boolean isClickable = (Boolean) value;
                        if (!isClickable || v instanceof AbsListView || v instanceof AbsoluteLayout) {
                            processable = false;
                        }
                    } else if ("alpha".equals(desc.name)) {
                        float alpha = (Float) value;
                        // 透明度是0则不可见
                        if (alpha == 0) {
                            processable = false;
                        }
                    } else if ("hidden".equals(desc.name)) {
                        int hide = (Integer) value;
                        // hidden是0则隐藏
                        if (hide != 0) {
                            processable = false;
                        }
                    }
                }
            }
            j.name("processable").value(processable ? "1" : "0");
            if (null == value) {
                // Don't produce anything in this case
            } else if (value instanceof Number) {
                j.name(desc.name).value((Number) value);
            } else if (value instanceof Boolean) {
                j.name(desc.name).value((Boolean) value);
            } else if (value instanceof ColorStateList) {
                j.name(desc.name).value((Integer) ((ColorStateList) value).getDefaultColor());
            } else if (value instanceof Drawable) {
                final Drawable drawable = (Drawable) value;
                final Rect bounds = drawable.getBounds();
                j.name(desc.name);
                j.beginObject();
                j.name("classes");
                j.beginArray();
                Class<?> klass = drawable.getClass();
                while (klass != Object.class) {
                    j.value(klass.getCanonicalName());
                    klass = klass.getSuperclass();
                }
                j.endArray();
                j.name("dimensions");
                j.beginObject();
                j.name("left").value(bounds.left);
                j.name("right").value(bounds.right);
                j.name("top").value(bounds.top);
                j.name("bottom").value(bounds.bottom);
                j.endObject();
                if (drawable instanceof ColorDrawable) {
                    final ColorDrawable colorDrawable = (ColorDrawable) drawable;
                    j.name("color").value(colorDrawable.getColor());
                }
                j.endObject();
            } else {
                j.name(desc.name).value(value.toString());
            }
        }
    }
}
 
源代码18 项目: oversec   文件: NodeGroupLayout.java
@Override
    public void update(Tree.TreeNode node, Rect parentBoundsInScreen) {
        mUnused = false;
        mNode.recycle(false);
        mNode = node;

        //--------------------- update layout / dimensions

        ViewGroup.LayoutParams pp = getLayoutParams();

        if (pp instanceof AbsoluteLayout.LayoutParams) {
            AbsoluteLayout.LayoutParams params = (AbsoluteLayout.LayoutParams) pp;
            boolean changed = calcLayoutParams(params, node, parentBoundsInScreen);
            if (changed) {
                setLayoutParams(params);
            }
        } else {
            Ln.w("Hoooh?  LayoutParams are not from AbsoluteLayout??");
//            //how can this happen?
//            boolean changed = calcLayoutParamsRoot(pp, node, parentBoundsInScreen);
//            if (changed) {
//                setLayoutParams(pp);
//            }
        }
        //--------------------- update child views

        //mark alle existing vchild views as dirty
        int viewChildChount = getChildCount();
        for (int i = 0; i < viewChildChount; i++) {
            ((NodeView) getChildAt(i)).setUnused();
        }

        int cc = node.getChildCount();
        for (int i = 0; i < cc; i++) {
            boolean foundExisting = false;
            Tree.TreeNode nodeChild = node.getChildAt(i);

            for (int k = 0; k < getChildCount(); k++) {
                NodeView viewChild = ((NodeView) getChildAt(k));

                if (viewChild != null && viewChild.getNodeKey() == nodeChild.getKey() && viewChild.matchesNodeType(nodeChild)) {
                    viewChild.update(nodeChild, node.getBoundsInScreen());
                    foundExisting = true;
                    break;
                }
            }

            if (!foundExisting) {

                View childView = null;
                if (nodeChild.isTextNode()) {
                    childView = new NodeTextView(mCore, nodeChild, node.getBoundsInScreen(), mOverlayDecryptView, mCryptoHandlerFacade);
                } else {
                    childView = new NodeGroupLayout(mCore, nodeChild, node.getBoundsInScreen(), mOverlayDecryptView, mCryptoHandlerFacade);
                }
                addView(childView);
            }
        }

        //remove all dirty views
        for (int i = viewChildChount - 1; i >= 0; i--) {
            NodeView child = ((NodeView) getChildAt(i));
            if (child.isUnused()) {
                child.recycle();
                removeViewAt(i);
            }
        }
    }
 
源代码19 项目: oversec   文件: NodeTextView.java
@SuppressWarnings("deprecation")
public NodeTextView(Core core, Tree.TreeNode node, Rect parentBoundsInScreen, OverlayDecryptView overlayDecryptView, CryptoHandlerFacade cryptoHandlerFacade) {
    super(core.getCtx());
    mCore = core;
    mNode = node;
    mCryptoHandlerFacade = cryptoHandlerFacade;
    mOverlayDecryptView = overlayDecryptView;

    //--------------------- update layout / dimensions

    AbsoluteLayout.LayoutParams params = new AbsoluteLayout.LayoutParams(0, 0, 0, 0);
    calcLayoutParams(params, node, parentBoundsInScreen);
    setLayoutParams(params);


    //----------------------- update contents


    mBgShape = new GradientDrawable();
    setBackground(mBgShape);

    overlayDecryptView.applyDesign(this);

    readNodeInfo(true);
}
 
源代码20 项目: oversec   文件: NodeTextView.java
private boolean calcLayoutParams(AbsoluteLayout.LayoutParams in, Tree.TreeNode node, Rect parentBoundsInScreen) {
    //render the overlay right ABOVE the edit text so that we can clearly see what is actualy being sent!
    boolean above = isFocusedEditableText() && mCore.getDb().isOverlayAboveInput(mNode.getPackageNameS());

    //ensure z-order
    if (getParent() != null) {
        ViewGroup vg = (ViewGroup) getParent();
        if (vg.indexOfChild(this) < vg.getChildCount() - 1) {
            vg.removeView(this);
            vg.addView(this);
        }
    }

    //bounds in parent reported by the node are only good for getting the nodes dimensions, top/left are alyways 0!
    int nodeWidth = node.getBoundsInParent().width() + mRightDrawableWidth;
    int nodeHeight = node.getBoundsInParent().height();

    Rect boundsInScreen = node.getBoundsInScreen();
    Rect boundsInParent = new Rect(boundsInScreen); //TODO pool
    boundsInParent.offset(-parentBoundsInScreen.left, -parentBoundsInScreen.top); //calculate the real bounds in parent.

    mVisibleHeight = boundsInScreen.height();

    if (boundsInScreen.height() < node.getBoundsInParent().height()) {
        //node seems to be cut off
        if (boundsInParent.top == 0) {
            //cut off at the top
            boundsInParent.offset(0, -(node.getBoundsInParent().height() - boundsInScreen.height()));
        }

    }
    boolean changed = false;
    changed = changed | (in.x != boundsInParent.left);
    in.x = boundsInParent.left;


    if (!above) {
        changed = changed | (in.y != boundsInParent.top);
        in.y = boundsInParent.top;
    } else {
        changed = changed | (in.y != boundsInParent.top - nodeHeight);
        in.y = boundsInParent.top - getHeight();

        if (in.y < 0) {
            //parent doesn't have enough space, try to increase size of parent
            ViewParent vp = getParent();
            if (vp != null && vp instanceof NodeGroupLayout) {
                NodeGroupLayout parent = (NodeGroupLayout) vp;
                parent.makeSpaceAbove(-in.y);
                in.y = 0;
            }
        }

    }

    changed = changed | (in.width != nodeWidth);
    in.width = nodeWidth;

    changed = changed | (in.height != nodeHeight);
    in.height = nodeHeight;

    if (above || mCore.getDb().isVoverflow(mNode.getPackageNameS())) {
        in.height = AbsoluteLayout.LayoutParams.WRAP_CONTENT;
    }

    return changed;
}
 
源代码21 项目: CanDialog   文件: TileAnimation.java
private static AbsoluteLayout createAnimLayout(FrameLayout rootLayout, Activity act) {


        AbsoluteLayout animLayout = new AbsoluteLayout(act);

        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);


        animLayout.setLayoutParams(params);

        animLayout.setBackgroundResource(android.R.color.transparent);


        rootLayout.addView(animLayout);
        return animLayout;
    }
 
源代码22 项目: anvil   文件: DSL.java
public static BaseDSL.ViewClassResult absoluteLayout() {
  return BaseDSL.v(AbsoluteLayout.class);
}
 
源代码23 项目: anvil   文件: DSL.java
public static Void absoluteLayout(Anvil.Renderable r) {
  return BaseDSL.v(AbsoluteLayout.class, r);
}
 
源代码24 项目: anvil   文件: DSL.java
public static BaseDSL.ViewClassResult absoluteLayout() {
  return BaseDSL.v(AbsoluteLayout.class);
}
 
源代码25 项目: anvil   文件: DSL.java
public static Void absoluteLayout(Anvil.Renderable r) {
  return BaseDSL.v(AbsoluteLayout.class, r);
}
 
源代码26 项目: assertj-android   文件: AbsoluteLayoutAssert.java
public AbsoluteLayoutAssert(AbsoluteLayout actual) {
  super(actual, AbsoluteLayoutAssert.class);
}
 
 类所在包
 类方法
 同包方法