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