Java Code Examples for android.view.View#setMinimumHeight()

The following examples show how to use android.view.View#setMinimumHeight() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: Dashchan   File: PostsAdapter.java    License: Apache License 2.0 6 votes vote down vote up
public PostsAdapter(Context context, String chanName, String boardName, UiManager uiManager,
		Replyable replyable, HidePerformer hidePerformer, HashSet<String> userPostNumbers, ListView listView) {
	this.uiManager = uiManager;
	configurationSet = new UiManager.ConfigurationSet(replyable, this, hidePerformer,
			new GalleryItem.GallerySet(true), this, userPostNumbers, true, false, true, true, true, null);
	listSelectionKeeper = new CommentTextView.ListSelectionKeeper(listView);
	float density = ResourceUtils.obtainDensity(context);
	FrameLayout frameLayout = new FrameLayout(context);
	frameLayout.setPadding((int) (12f * density), 0, (int) (12f * density), 0);
	View view = new View(context);
	view.setMinimumHeight((int) (2f * density));
	view.setBackgroundColor(ResourceUtils.getColor(context, R.attr.colorTextError));
	frameLayout.addView(view, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
	bumpLimitDivider = frameLayout;
	bumpLimit = ChanConfiguration.get(chanName).getBumpLimitWithMode(boardName);
}
 
Example 2
Source Project: SimpleProject   File: RefreshLayout.java    License: MIT License 6 votes vote down vote up
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
	int width = MeasureSpec.getSize(widthMeasureSpec);
	int height = 0;
	for (int i = 0; i < getChildCount(); i++) {
		View childView = getChildAt(i);
		measureChild(childView, widthMeasureSpec, heightMeasureSpec);
		height += getChildAt(i).getMeasuredHeight();
		if (mRefreshStatus == REFRESH_STATUS_NONE && childView.getMeasuredHeight() != 0
				&& i == 1 && childView.getBottom() < mScreenHeight) {
			if (mMode == Mode.MODE_REFRESH || mMode == Mode.MODE_BOTH) {
				childView.setMinimumHeight(mScreenHeight - childView.getTop() + mHeaderViewHeight);
			} else {
				childView.setMinimumHeight(mScreenHeight - childView.getTop());
			}
		}
	}
	setMeasuredDimension(width, height);
}
 
Example 3
@Override
public void bindView(View view, Context context, Cursor cursor) {
	super.bindView(view, context, cursor);
	
	// Stretch list item height if there are too few to fill the content area.
	ListView listView = getListView();
	int listViewHeight = listView.getMeasuredHeight();
	int itemCount = cursor.getCount();
	int itemHeight = view.getMeasuredHeight();
	int dividerHeight = listView.getDividerHeight();
	int totalDividerHeight = (itemCount - 1) * dividerHeight;
	int targetTotalItemHeight = listViewHeight - totalDividerHeight;
	int totalItemHeight = itemCount * itemHeight;
	boolean weNeedToUpsize = totalItemHeight < targetTotalItemHeight;
	
	if (weNeedToUpsize) {
		int targetItemHeight = targetTotalItemHeight / itemCount;
		view.setMinimumHeight(targetItemHeight);
	}
}
 
Example 4
private void setSize(View view, int width, int height) {
    view.setMinimumWidth(width);
    view.setMinimumHeight(height);
    ViewGroup.LayoutParams params = view.getLayoutParams();
    params = (params == null) ? new ViewGroup.LayoutParams(0, 0) : params;
    params.width = width;
    params.height = height;
    view.setLayoutParams(params);
}
 
Example 5
@Override
public View createTabContent(String tag) {
    View v = new View(mContext);
    v.setMinimumWidth(0);
    v.setMinimumHeight(0);
    return v;
}
 
Example 6
/**
 * @param view
 */
public void setRefreshHeaderView(View view) {
    if(view == null){
        return;
    }
    removeView(mRefreshView);
    this.mRefreshView = view;
    view.setMinimumHeight(HEADER_VIEW_MIN_HEIGHT);
    addView(view);
    getRefreshTrigger().init();
}
 
Example 7
@Override
public View createTabContent(String tag) {
	View v = new View(mContext);
	v.setMinimumWidth(0);
	v.setMinimumHeight(0);
	return v;
}
 
Example 8
@Override
public View createTabContent(String tag) {
    View v = new View(mContext);
    v.setMinimumWidth(0);
    v.setMinimumHeight(0);
    return v;
}
 
Example 9
@Override
public View createTabContent(String tag) {
    View v = new View(mContext);
    v.setMinimumWidth(0);
    v.setMinimumHeight(0);
    return v;
}
 
Example 10
private void setSize(View view, int width, int height) {
    view.setMinimumWidth(width);
    view.setMinimumHeight(height);
    ViewGroup.LayoutParams params = view.getLayoutParams();
    params = (params == null) ? new ViewGroup.LayoutParams(0, 0) : params;
    params.width = width;
    params.height = height;
    view.setLayoutParams(params);
}
 
Example 11
protected final LinearLayout propView(final Context context, final String title, final CharSequence text, final boolean firstInList) {

		final int paddingPixels = General.dpToPixels(context, 12);

		final LinearLayout prop = new LinearLayout(context);
		prop.setOrientation(LinearLayout.VERTICAL);

		if(!firstInList) {
			final View divider = new View(context);
			divider.setMinimumHeight(General.dpToPixels(context, 1));
			divider.setBackgroundColor(rrListDividerCol);
			prop.addView(divider);
		}

		final TextView titleView = new TextView(context);
		titleView.setText(title.toUpperCase(Locale.getDefault()));
		titleView.setTextColor(rrListHeaderTextCol);
		titleView.setTextSize(12.0f);
		titleView.setPadding(paddingPixels, paddingPixels, paddingPixels, 0);
		prop.addView(titleView);

		final TextView textView = new TextView(context);
		textView.setText(text);
		textView.setTextColor(rrCommentBodyCol);
		textView.setTextSize(15.0f);
		textView.setPadding(paddingPixels, 0, paddingPixels, paddingPixels);
		textView.setTextIsSelectable(true);
		prop.addView(textView);

		return prop;
	}
 
Example 12
Source Project: AndroidBase   File: FragmentTabHost.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public View createTabContent(String tag) {
    View v = new View(mContext);
    v.setMinimumWidth(0);
    v.setMinimumHeight(0);
    return v;
}
 
Example 13
Source Project: Readily   File: CachedFilesAdapter.java    License: MIT License 5 votes vote down vote up
private void inflateActionMenu(View v){
	View actionView = v.findViewById(R.id.action_view);
	View mainView = v.findViewById(R.id.main_view);

	actionView.setMinimumHeight(mainView.getHeight());

	YoYo.with(Techniques.SlideOutRight).
			duration(DURATION).
			playOn(mainView);

	actionView.setVisibility(View.VISIBLE);
	YoYo.with(Techniques.FadeIn).
			duration(DURATION).
			playOn(actionView);
}
 
Example 14
@Override
public View createTabContent(String tag) {
    View v = new View(mContext);
    v.setMinimumWidth(0);
    v.setMinimumHeight(0);
    return v;
}
 
Example 15
Source Project: Android-tv-widget   File: OpenTabHost.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 创建一个空的Content.
 */
@Override
public View createTabContent(String tag) {
	View v = new View(mContext);
	v.setMinimumWidth(0);
	v.setMinimumHeight(0);
	return v;
}
 
Example 16
Source Project: AndroidAutoLayout   File: MinHeightAttr.java    License: Apache License 2.0 5 votes vote down vote up
@Override
    protected void execute(View view, int val)
    {
        try
        {
            view.setMinimumHeight(val);
//            Method setMaxWidthMethod = view.getClass().getMethod("setMinHeight", int.class);
//            setMaxWidthMethod.invoke(view, val);
        } catch (Exception ignore)
        {
        }
    }
 
Example 17
@Override
public void onCommentListingRequestAllItemsDownloaded(final ArrayList<RedditCommentListItem> items) {

	mCommentListingManager.addComments(items);

	if(mFloatingToolbar != null && mFloatingToolbar.getVisibility() != View.VISIBLE) {
		mFloatingToolbar.setVisibility(View.VISIBLE);
		final Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.slide_in_from_bottom);
		animation.setInterpolator(new OvershootInterpolator());
		mFloatingToolbar.startAnimation(animation);
	}

	mUrlsToDownload.removeFirst();

	final LinearLayoutManager layoutManager = (LinearLayoutManager)mRecyclerView.getLayoutManager();

	if(mPreviousFirstVisibleItemPosition != null
			&& layoutManager.getItemCount() > mPreviousFirstVisibleItemPosition) {

		layoutManager.scrollToPositionWithOffset(
				mPreviousFirstVisibleItemPosition,
				0);

		mPreviousFirstVisibleItemPosition = null;
	}

	if(mUrlsToDownload.isEmpty()) {

		if(mCommentListingManager.getCommentCount() == 0) {

			final View emptyView = LayoutInflater.from(getContext()).inflate(
					R.layout.no_comments_yet,
					mRecyclerView,
					false);

			if (mCommentListingManager.isSearchListing()) {
				((TextView) emptyView.findViewById(R.id.empty_view_text)).setText(R.string.no_search_results);
			}

			mCommentListingManager.addViewToItems(emptyView);

		} else {

			final View blankView = new View(getContext());
			blankView.setMinimumWidth(1);
			blankView.setMinimumHeight(General.dpToPixels(getContext(), 96));
			mCommentListingManager.addViewToItems(blankView);
		}

		mCommentListingManager.setLoadingVisible(false);

	} else {
		makeNextRequest(getActivity());
	}
}
 
Example 18
Source Project: letv   File: FragmentTabHost.java    License: Apache License 2.0 4 votes vote down vote up
public View createTabContent(String tag) {
    View v = new View(this.mContext);
    v.setMinimumWidth(0);
    v.setMinimumHeight(0);
    return v;
}
 
Example 19
public View createTabContent(String tag) {
    View v = new View(mContext);
    v.setMinimumWidth(0);
    v.setMinimumHeight(0);
    return v;
}
 
Example 20
Source Project: UIWidget   File: UIActionSheetDialog.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public View getView(final int i, View convertView, ViewGroup parent) {
    final SheetItem data = getItem(i);
    final ViewHolder holder;
    Drawable background;
    if (convertView == null) {
        convertView = View.inflate(mContext, R.layout.item_action_sheet_list, null);
        holder = new ViewHolder();
        holder.imageView = convertView.findViewById(R.id.iv_iconActionSheetList);
        holder.textView = convertView.findViewById(R.id.tv_msgActionSheetList);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    if (data.drawable != null) {
        holder.imageView.setVisibility(View.VISIBLE);
        holder.imageView.setImageDrawable(data.drawable);
        ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) holder.imageView.getLayoutParams();
        params.height = mItemsImageHeight;
        params.width = mItemsImageWidth;
        params.rightMargin = mTextDrawablePadding;
        holder.imageView.setLayoutParams(params);
    } else {
        holder.imageView.setVisibility(View.GONE);
    }
    setTextView(holder, data, i);

    ((LinearLayout) convertView).setGravity(mItemsGravity);
    convertView.setMinimumHeight(mItemsMinHeight);
    convertView.setPadding(mItemsTextPaddingLeft, mItemsTextPaddingTop, mItemsTextPaddingRight, mItemsTextPaddingBottom);

    int size = getCount();
    int sizeHeader = mListHeaderViews != null ? mListHeaderViews.size() : 0;
    boolean hasTitle = !TextUtils.isEmpty(mTitleStr);
    boolean hasMargin = mCancelMarginTop > 0 || TextUtils.isEmpty(mCancelStr);
    if (size == 1) {
        if (hasTitle || sizeHeader > 0) {
            background = hasMargin ? mStateDrawableBottom : mStateDrawableCenter;
        } else {
            background = hasMargin ? mStateDrawableSingle : mStateDrawableTop;
        }
    } else {
        if (hasTitle || sizeHeader > 0) {
            if (i >= 0 && i < size - 1) {
                background = mStateDrawableCenter;
            } else {
                background = hasMargin ? mStateDrawableBottom : mStateDrawableCenter;
            }
        } else {
            if (i == 0) {
                background = mStateDrawableTop;
            } else if (i < size - 1) {
                background = mStateDrawableCenter;
            } else {
                background = hasMargin ? mStateDrawableBottom : mStateDrawableCenter;
            }
        }
    }
    background = DrawableUtil.getNewDrawable(background);
    setViewBackground(convertView, background);
    convertView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mItemsClickDismissEnable) {
                mDialog.dismiss();
            }
            if (mOnItemClickListener != null) {
                mOnItemClickListener.onClick(mDialog, view, i);
            }
        }
    });
    return convertView;
}