use of android.view.ViewGroup.LayoutParams in project GreenDroid by cyrilmottier.
the class QuickActionGrid method onMeasureAndLayout.
@Override
protected void onMeasureAndLayout(Rect anchorRect, View contentView) {
contentView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
contentView.measure(MeasureSpec.makeMeasureSpec(getScreenWidth(), MeasureSpec.EXACTLY), LayoutParams.WRAP_CONTENT);
int rootHeight = contentView.getMeasuredHeight();
int offsetY = getArrowOffsetY();
int dyTop = anchorRect.top;
int dyBottom = getScreenHeight() - anchorRect.bottom;
boolean onTop = (dyTop > dyBottom);
int popupY = (onTop) ? anchorRect.top - rootHeight + offsetY : anchorRect.bottom - offsetY;
setWidgetSpecs(popupY, onTop);
}
use of android.view.ViewGroup.LayoutParams in project android_frameworks_base by ParanoidAndroid.
the class Activity method dispatchPopulateAccessibilityEvent.
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
event.setClassName(getClass().getName());
event.setPackageName(getPackageName());
LayoutParams params = getWindow().getAttributes();
boolean isFullScreen = (params.width == LayoutParams.MATCH_PARENT) && (params.height == LayoutParams.MATCH_PARENT);
event.setFullScreen(isFullScreen);
CharSequence title = getTitle();
if (!TextUtils.isEmpty(title)) {
event.getText().add(title);
}
return true;
}
use of android.view.ViewGroup.LayoutParams in project android_frameworks_base by ParanoidAndroid.
the class Dialog method dispatchPopulateAccessibilityEvent.
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
event.setClassName(getClass().getName());
event.setPackageName(mContext.getPackageName());
LayoutParams params = getWindow().getAttributes();
boolean isFullScreen = (params.width == LayoutParams.MATCH_PARENT) && (params.height == LayoutParams.MATCH_PARENT);
event.setFullScreen(isFullScreen);
return false;
}
use of android.view.ViewGroup.LayoutParams in project android_frameworks_base by ParanoidAndroid.
the class AlertController method setupView.
private void setupView() {
LinearLayout contentPanel = (LinearLayout) mWindow.findViewById(R.id.contentPanel);
setupContent(contentPanel);
boolean hasButtons = setupButtons();
LinearLayout topPanel = (LinearLayout) mWindow.findViewById(R.id.topPanel);
TypedArray a = mContext.obtainStyledAttributes(null, com.android.internal.R.styleable.AlertDialog, com.android.internal.R.attr.alertDialogStyle, 0);
boolean hasTitle = setupTitle(topPanel);
View buttonPanel = mWindow.findViewById(R.id.buttonPanel);
if (!hasButtons) {
buttonPanel.setVisibility(View.GONE);
mWindow.setCloseOnTouchOutsideIfNotSet(true);
}
FrameLayout customPanel = null;
if (mView != null) {
customPanel = (FrameLayout) mWindow.findViewById(R.id.customPanel);
FrameLayout custom = (FrameLayout) mWindow.findViewById(R.id.custom);
custom.addView(mView, new LayoutParams(MATCH_PARENT, MATCH_PARENT));
if (mViewSpacingSpecified) {
custom.setPadding(mViewSpacingLeft, mViewSpacingTop, mViewSpacingRight, mViewSpacingBottom);
}
if (mListView != null) {
((LinearLayout.LayoutParams) customPanel.getLayoutParams()).weight = 0;
}
} else {
mWindow.findViewById(R.id.customPanel).setVisibility(View.GONE);
}
/* Only display the divider if we have a title and a
* custom view or a message.
*/
if (hasTitle) {
View divider = null;
if (mMessage != null || mView != null || mListView != null) {
divider = mWindow.findViewById(R.id.titleDivider);
} else {
divider = mWindow.findViewById(R.id.titleDividerTop);
}
if (divider != null) {
divider.setVisibility(View.VISIBLE);
}
}
setBackground(topPanel, contentPanel, customPanel, hasButtons, a, hasTitle, buttonPanel);
a.recycle();
}
use of android.view.ViewGroup.LayoutParams in project android_frameworks_base by ParanoidAndroid.
the class Editor method getTextThumbnailBuilder.
private DragShadowBuilder getTextThumbnailBuilder(CharSequence text) {
TextView shadowView = (TextView) View.inflate(mTextView.getContext(), com.android.internal.R.layout.text_drag_thumbnail, null);
if (shadowView == null) {
throw new IllegalArgumentException("Unable to inflate text drag thumbnail");
}
if (text.length() > DRAG_SHADOW_MAX_TEXT_LENGTH) {
text = text.subSequence(0, DRAG_SHADOW_MAX_TEXT_LENGTH);
}
shadowView.setText(text);
shadowView.setTextColor(mTextView.getTextColors());
shadowView.setTextAppearance(mTextView.getContext(), R.styleable.Theme_textAppearanceLarge);
shadowView.setGravity(Gravity.CENTER);
shadowView.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
final int size = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
shadowView.measure(size, size);
shadowView.layout(0, 0, shadowView.getMeasuredWidth(), shadowView.getMeasuredHeight());
shadowView.invalidate();
return new DragShadowBuilder(shadowView);
}
Aggregations