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();
}
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);
}
}
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);
}
}
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);
}
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;
}
Aggregations