Search in sources :

Example 1 with LayoutParams

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);
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams)

Example 2 with LayoutParams

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;
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams)

Example 3 with LayoutParams

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;
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams)

Example 4 with LayoutParams

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();
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) TypedArray(android.content.res.TypedArray) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) CheckedTextView(android.widget.CheckedTextView) ListView(android.widget.ListView) LinearLayout(android.widget.LinearLayout)

Example 5 with LayoutParams

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);
}
Also used : DragShadowBuilder(android.view.View.DragShadowBuilder) LayoutParams(android.view.ViewGroup.LayoutParams) Paint(android.graphics.Paint)

Aggregations

LayoutParams (android.view.ViewGroup.LayoutParams)263 TextView (android.widget.TextView)54 View (android.view.View)50 ViewGroup (android.view.ViewGroup)50 FrameLayout (android.widget.FrameLayout)35 LinearLayout (android.widget.LinearLayout)32 ImageView (android.widget.ImageView)30 Test (org.junit.Test)26 ListView (android.widget.ListView)22 ScrollView (android.widget.ScrollView)22 Paint (android.graphics.Paint)21 MarginLayoutParams (android.view.ViewGroup.MarginLayoutParams)19 Context (android.content.Context)18 AdapterView (android.widget.AdapterView)17 RelativeLayout (android.widget.RelativeLayout)14 DisplayMetrics (android.util.DisplayMetrics)12 CheckedTextView (android.widget.CheckedTextView)12 Rect (android.graphics.Rect)9 ViewParent (android.view.ViewParent)9 TypedArray (android.content.res.TypedArray)8