Search in sources :

Example 16 with LayoutParams

use of android.support.v7.widget.RecyclerView.LayoutParams in project Carbon by ZieIony.

the class Toolbar method setChildVisibilityForExpandedActionView.

/**
     * @ hide
     */
/*public DecorToolbar getWrapper() {
        if (mWrapper == null) {
            mWrapper = new ToolbarWidgetWrapper(this, true);
        }
        return mWrapper;
    }*/
private void setChildVisibilityForExpandedActionView(boolean expand) {
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = getChildAt(i);
        final LayoutParams lp = (LayoutParams) child.getLayoutParams();
        if (lp.mViewType != LayoutParams.EXPANDED && child != mMenuView) {
            child.setVisibility(expand ? GONE : VISIBLE);
        }
    }
}
Also used : CollapsibleActionView(android.support.v7.view.CollapsibleActionView) MenuView(android.support.v7.view.menu.MenuView) View(android.view.View) ImageView(carbon.widget.ImageView) TextView(carbon.widget.TextView) ActionMenuView(android.support.v7.widget.ActionMenuView)

Example 17 with LayoutParams

use of android.support.v7.widget.RecyclerView.LayoutParams in project actor-platform by actorapp.

the class BaseContactFragment method addFooterOrHeaderAction.

protected void addFooterOrHeaderAction(int color, int icon, int text, boolean isLast, final Runnable action, boolean isHeader) {
    FrameLayout container = new FrameLayout(getActivity());
    container.setBackgroundColor(ActorSDK.sharedActor().style.getMainBackgroundColor());
    {
        container.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    }
    FrameLayout invitePanel = new FrameLayout(getActivity());
    invitePanel.setBackgroundResource(R.drawable.selector_fill);
    invitePanel.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            action.run();
        }
    });
    {
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Screen.dp(64));
        params.leftMargin = Screen.dp(40);
        invitePanel.setLayoutParams(params);
        container.addView(invitePanel);
    }
    TintImageView inviteIcon = new TintImageView(getActivity());
    inviteIcon.setTint(color);
    inviteIcon.setResource(icon);
    {
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(Screen.dp(52), Screen.dp(52));
        layoutParams.leftMargin = Screen.dp(6);
        layoutParams.topMargin = Screen.dp(6);
        layoutParams.bottomMargin = Screen.dp(6);
        layoutParams.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
        invitePanel.addView(inviteIcon, layoutParams);
    }
    TextView inviteText = new TextView(getActivity());
    inviteText.setText(getString(text).replace("{appName}", ActorSDK.sharedActor().getAppName()));
    inviteText.setTextColor(color);
    inviteText.setPadding(Screen.dp(72), 0, Screen.dp(8), 0);
    inviteText.setTextSize(16);
    inviteText.setSingleLine(true);
    inviteText.setEllipsize(TextUtils.TruncateAt.END);
    inviteText.setTypeface(Fonts.medium());
    {
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        layoutParams.gravity = Gravity.CENTER_VERTICAL;
        layoutParams.topMargin = Screen.dp(16);
        layoutParams.bottomMargin = Screen.dp(16);
        invitePanel.addView(inviteText, layoutParams);
    }
    if (!isLast) {
        View div = new View(getActivity());
        div.setBackgroundColor(ActorSDK.sharedActor().style.getContactDividerColor());
        {
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, getResources().getDimensionPixelSize(R.dimen.div_size));
            layoutParams.gravity = Gravity.BOTTOM;
            layoutParams.leftMargin = Screen.dp(72);
            invitePanel.addView(div, layoutParams);
        }
    }
    if (isHeader) {
        addHeaderView(container);
    } else {
        addFooterView(container);
    }
}
Also used : FrameLayout(android.widget.FrameLayout) TintImageView(im.actor.sdk.view.TintImageView) TextView(android.widget.TextView) SearchView(android.support.v7.widget.SearchView) TintImageView(im.actor.sdk.view.TintImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView)

Example 18 with LayoutParams

use of android.support.v7.widget.RecyclerView.LayoutParams in project FastDev4Android by jiangqqlmj.

the class AdvanceDecoration method drawHDeraction.

/**
     * 绘制水平方向的分割线
     * @param c
     * @param parent
     */
private void drawHDeraction(Canvas c, RecyclerView parent) {
    int left = parent.getPaddingLeft();
    int right = parent.getWidth() - parent.getPaddingRight();
    int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = parent.getChildAt(i);
        RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) child.getLayoutParams();
        int top = child.getBottom() + layoutParams.bottomMargin;
        int bottom = top + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 19 with LayoutParams

use of android.support.v7.widget.RecyclerView.LayoutParams in project ToolBarLib by jjhesk.

the class ToolbarHelper method renewView.

public static View renewView(Context activity, Toolbar toolbar, LayoutAsset layoutId) {
    toolbar.removeAllViews();
    Toolbar.LayoutParams layoutParams = new Toolbar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.gravity = Gravity.TOP;
    final View t = ToolbarHelper.generateView(layoutId.getResourceId(), activity);
    toolbar.addView(t, layoutParams);
    return t;
}
Also used : TextView(android.widget.TextView) View(android.view.View) Toolbar(android.support.v7.widget.Toolbar)

Example 20 with LayoutParams

use of android.support.v7.widget.RecyclerView.LayoutParams in project platform_frameworks_base by android.

the class NavBarTuner method inflatePreview.

private void inflatePreview(ViewGroup view) {
    Display display = getActivity().getWindowManager().getDefaultDisplay();
    boolean isRotated = display.getRotation() == Surface.ROTATION_90 || display.getRotation() == Surface.ROTATION_270;
    Configuration config = new Configuration(getContext().getResources().getConfiguration());
    boolean isPhoneLandscape = isRotated && (config.smallestScreenWidthDp < 600);
    final float scale = isPhoneLandscape ? PREVIEW_SCALE_LANDSCAPE : PREVIEW_SCALE;
    config.densityDpi = (int) (config.densityDpi * scale);
    mPreview = (PreviewNavInflater) LayoutInflater.from(getContext().createConfigurationContext(config)).inflate(R.layout.nav_bar_tuner_inflater, view, false);
    final ViewGroup.LayoutParams layoutParams = mPreview.getLayoutParams();
    layoutParams.width = (int) ((isPhoneLandscape ? display.getHeight() : display.getWidth()) * scale);
    // Not sure why, but the height dimen is not being scaled with the dp, set it manually
    // for now.
    layoutParams.height = (int) (layoutParams.height * scale);
    if (isPhoneLandscape) {
        int width = layoutParams.width;
        layoutParams.width = layoutParams.height;
        layoutParams.height = width;
    }
    view.addView(mPreview);
    if (isRotated) {
        mPreview.findViewById(R.id.rot0).setVisibility(View.GONE);
        final View rot90 = mPreview.findViewById(R.id.rot90);
    } else {
        mPreview.findViewById(R.id.rot90).setVisibility(View.GONE);
        final View rot0 = mPreview.findViewById(R.id.rot0);
    }
}
Also used : Configuration(android.content.res.Configuration) ViewGroup(android.view.ViewGroup) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) Display(android.view.Display)

Aggregations

View (android.view.View)77 RecyclerView (android.support.v7.widget.RecyclerView)67 ViewGroup (android.view.ViewGroup)21 TextView (android.widget.TextView)21 ImageView (android.widget.ImageView)13 LayoutParams (android.support.v7.widget.RecyclerView.LayoutParams)12 Toolbar (android.support.v7.widget.Toolbar)9 FrameLayout (android.widget.FrameLayout)9 Rect (android.graphics.Rect)8 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)8 BindView (butterknife.BindView)8 ActionMenuView (android.support.v7.widget.ActionMenuView)7 MarginLayoutParams (android.view.ViewGroup.MarginLayoutParams)6 LinearLayout (android.widget.LinearLayout)6 CollapsibleActionView (android.support.v7.view.CollapsibleActionView)5 MenuView (android.support.v7.view.menu.MenuView)5 EditText (android.widget.EditText)5 ImageView (carbon.widget.ImageView)5 TextView (carbon.widget.TextView)5 VirtualLayoutManager (com.alibaba.android.vlayout.VirtualLayoutManager)5