Search in sources :

Example 36 with MarginLayoutParams

use of android.view.ViewGroup.MarginLayoutParams in project ABPlayer by winkstu.

the class VideoViewActivity method loadVPlayerPrefs.

private void loadVPlayerPrefs() {
    if (!isInitialized())
        return;
    vPlayer.setBuffer(VP.DEFAULT_BUF_SIZE);
    vPlayer.setVideoQuality(VP.DEFAULT_VIDEO_QUALITY);
    vPlayer.setDeinterlace(VP.DEFAULT_DEINTERLACE);
    vPlayer.setVolume(VP.DEFAULT_STEREO_VOLUME, VP.DEFAULT_STEREO_VOLUME);
    vPlayer.setSubEncoding(VP.DEFAULT_SUB_ENCODING);
    MarginLayoutParams lp = (MarginLayoutParams) mSubtitleContainer.getLayoutParams();
    lp.bottomMargin = (int) VP.DEFAULT_SUB_POS;
    mSubtitleContainer.setLayoutParams(lp);
    vPlayer.setSubShown(mSubShown);
    setTextViewStyle(mSubtitleText);
    if (!TextUtils.isEmpty(mSubPath))
        vPlayer.setSubPath(mSubPath);
    if (mVideoView != null && isInitialized())
        setVideoLayout();
}
Also used : MarginLayoutParams(android.view.ViewGroup.MarginLayoutParams)

Example 37 with MarginLayoutParams

use of android.view.ViewGroup.MarginLayoutParams in project android_frameworks_base by DirtyUnicorns.

the class VolumeDialog method updateDialogBottomMarginH.

private void updateDialogBottomMarginH() {
    final long diff = System.currentTimeMillis() - mCollapseTime;
    final boolean collapsing = mCollapseTime != 0 && diff < getConservativeCollapseDuration();
    final ViewGroup.MarginLayoutParams mlp = (MarginLayoutParams) mDialogView.getLayoutParams();
    final int bottomMargin = collapsing ? mDialogContentView.getHeight() : mContext.getResources().getDimensionPixelSize(R.dimen.volume_dialog_margin_bottom);
    if (bottomMargin != mlp.bottomMargin) {
        if (D.BUG)
            Log.d(TAG, "bottomMargin " + mlp.bottomMargin + " -> " + bottomMargin);
        mlp.bottomMargin = bottomMargin;
        mDialogView.setLayoutParams(mlp);
    }
}
Also used : MarginLayoutParams(android.view.ViewGroup.MarginLayoutParams) ViewGroup(android.view.ViewGroup) MarginLayoutParams(android.view.ViewGroup.MarginLayoutParams) SuppressLint(android.annotation.SuppressLint)

Example 38 with MarginLayoutParams

use of android.view.ViewGroup.MarginLayoutParams in project android_frameworks_base by ResurrectionRemix.

the class VolumeDialog method updateDialogBottomMarginH.

private void updateDialogBottomMarginH() {
    final long diff = System.currentTimeMillis() - mCollapseTime;
    final boolean collapsing = mCollapseTime != 0 && diff < getConservativeCollapseDuration();
    final ViewGroup.MarginLayoutParams mlp = (MarginLayoutParams) mDialogView.getLayoutParams();
    final int bottomMargin = collapsing ? mDialogContentView.getHeight() : mContext.getResources().getDimensionPixelSize(R.dimen.volume_dialog_margin_bottom);
    if (bottomMargin != mlp.bottomMargin) {
        if (D.BUG)
            Log.d(TAG, "bottomMargin " + mlp.bottomMargin + " -> " + bottomMargin);
        mlp.bottomMargin = bottomMargin;
        mDialogView.setLayoutParams(mlp);
    }
}
Also used : MarginLayoutParams(android.view.ViewGroup.MarginLayoutParams) ViewGroup(android.view.ViewGroup) MarginLayoutParams(android.view.ViewGroup.MarginLayoutParams) SuppressLint(android.annotation.SuppressLint)

Example 39 with MarginLayoutParams

use of android.view.ViewGroup.MarginLayoutParams in project JustAndroid by chinaltz.

the class AbViewUtil method setAbsListViewHeight.

/**
     * 重置AbsListView的高度. item 的最外层布局要用
     * RelativeLayout,如果计算的不准,就为RelativeLayout指定一个高度
     * @param absListView
     * @param column
     * @param lineHeight
     * @param verticalSpace
     */
public static void setAbsListViewHeight(AbsListView absListView, int column, int lineHeight, int verticalSpace) {
    int totalHeight = getAbsListViewHeight(absListView, column, lineHeight, verticalSpace);
    ViewGroup.LayoutParams params = absListView.getLayoutParams();
    params.height = totalHeight;
    ((MarginLayoutParams) params).setMargins(0, 0, 0, 0);
    absListView.setLayoutParams(params);
}
Also used : ViewGroup(android.view.ViewGroup) MarginLayoutParams(android.view.ViewGroup.MarginLayoutParams) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint)

Example 40 with MarginLayoutParams

use of android.view.ViewGroup.MarginLayoutParams in project android_frameworks_base by crdroidandroid.

the class RenderSessionImpl method createViewInfo.

/**
     * Creates a {@link ViewInfo} for the view. The {@code ViewInfo} corresponding to the children
     * of the {@code view} are not created. Consequently, the children of {@code ViewInfo} is not
     * set.
     * @param offset an offset for the view bounds. Used only if view is part of the content frame.
     */
private ViewInfo createViewInfo(View view, int offset, boolean setExtendedInfo, boolean isContentFrame) {
    if (view == null) {
        return null;
    }
    ViewParent parent = view.getParent();
    ViewInfo result;
    if (isContentFrame) {
        // Account for parent scroll values when calculating the bounding box
        int scrollX = parent != null ? ((View) parent).getScrollX() : 0;
        int scrollY = parent != null ? ((View) parent).getScrollY() : 0;
        // The view is part of the layout added by the user. Hence,
        // the ViewCookie may be obtained only through the Context.
        result = new ViewInfo(view.getClass().getName(), getContext().getViewKey(view), -scrollX + view.getLeft(), -scrollY + view.getTop() + offset, -scrollX + view.getRight(), -scrollY + view.getBottom() + offset, view, view.getLayoutParams());
    } else {
        // We are part of the system decor.
        SystemViewInfo r = new SystemViewInfo(view.getClass().getName(), getViewKey(view), view.getLeft(), view.getTop(), view.getRight(), view.getBottom(), view, view.getLayoutParams());
        result = r;
        // 3. The overflow popup button.
        if (view instanceof ListMenuItemView) {
            // Mark 2.
            // All menus in the popup are of type ListMenuItemView.
            r.setViewType(ViewType.ACTION_BAR_OVERFLOW_MENU);
        } else {
            // Mark 3.
            ViewGroup.LayoutParams lp = view.getLayoutParams();
            if (lp instanceof ActionMenuView.LayoutParams && ((ActionMenuView.LayoutParams) lp).isOverflowButton) {
                r.setViewType(ViewType.ACTION_BAR_OVERFLOW);
            } else {
                // actionProviderClass.
                while (parent != mViewRoot && parent instanceof ViewGroup) {
                    if (parent instanceof ActionMenuView) {
                        r.setViewType(ViewType.ACTION_BAR_MENU);
                        break;
                    }
                    parent = parent.getParent();
                }
            }
        }
    }
    if (setExtendedInfo) {
        MarginLayoutParams marginParams = null;
        LayoutParams params = view.getLayoutParams();
        if (params instanceof MarginLayoutParams) {
            marginParams = (MarginLayoutParams) params;
        }
        result.setExtendedInfo(view.getBaseline(), marginParams != null ? marginParams.leftMargin : 0, marginParams != null ? marginParams.topMargin : 0, marginParams != null ? marginParams.rightMargin : 0, marginParams != null ? marginParams.bottomMargin : 0);
    }
    return result;
}
Also used : ListMenuItemView(com.android.internal.view.menu.ListMenuItemView) MarginLayoutParams(android.view.ViewGroup.MarginLayoutParams) LayoutParams(android.view.ViewGroup.LayoutParams) ViewParent(android.view.ViewParent) ViewGroup(android.view.ViewGroup) LayoutParams(android.view.ViewGroup.LayoutParams) ActionMenuView(android.widget.ActionMenuView) MarginLayoutParams(android.view.ViewGroup.MarginLayoutParams) ViewInfo(com.android.ide.common.rendering.api.ViewInfo)

Aggregations

MarginLayoutParams (android.view.ViewGroup.MarginLayoutParams)40 ViewGroup (android.view.ViewGroup)15 LayoutParams (android.view.ViewGroup.LayoutParams)10 SuppressLint (android.annotation.SuppressLint)8 Paint (android.graphics.Paint)6 ViewInfo (com.android.ide.common.rendering.api.ViewInfo)6 Point (android.graphics.Point)5 ViewParent (android.view.ViewParent)5 ActionMenuView (android.widget.ActionMenuView)5 ListMenuItemView (com.android.internal.view.menu.ListMenuItemView)5 Context (android.content.Context)4 View (android.view.View)4 TextView (android.widget.TextView)4 TextPaint (android.text.TextPaint)3 IntentFilter (android.content.IntentFilter)2 RemoteException (android.os.RemoteException)2 RecyclerView (android.support.v7.widget.RecyclerView)2 LayoutParams (android.support.v7.widget.RecyclerView.LayoutParams)2 MotionEvent (android.view.MotionEvent)2 ImageView (android.widget.ImageView)2