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

The following examples show how to use android.view.View#setMinimumHeight() . 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 check out the related API usage on the sidebar.
Example 1
Source File: PostsAdapter.java    From Dashchan with 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 File: RefreshLayout.java    From SimpleProject with 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
Source File: TopicListFragment.java    From android-viewer-for-khan-academy with GNU General Public License v3.0 6 votes vote down vote up
@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
Source File: FragmentTabHost.java    From CodenameOne with GNU General Public License v2.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 5
Source File: MinHeightAttr.java    From AndroidAutoLayout with 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 6
Source File: OpenTabHost.java    From Android-tv-widget with 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 7
Source File: FragmentTabHost.java    From NetEasyNews with GNU General Public License v3.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 8
Source File: CachedFilesAdapter.java    From Readily with 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 9
Source File: FragmentTabHost.java    From AndroidBase with 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 10
Source File: PropertiesDialog.java    From RedReader with GNU General Public License v3.0 5 votes vote down vote up
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 11
Source File: FloatingToolbar.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
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 12
Source File: FragmentTabHost.java    From android-recipes-app with 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 File: FloatingToolbar.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
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 14
Source File: BaseFragmentTabHost.java    From FragmentMixViewPager with 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 15
Source File: ISwipeRefreshLayout.java    From AndroidUiKit with Apache License 2.0 5 votes vote down vote up
/**
 * @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 16
Source File: FragmentTabHost.java    From ImitateTaobaoApp with 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 17
Source File: UIActionSheetDialog.java    From UIWidget with 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;
}
 
Example 18
Source File: PlaybackActivity.java    From android-vlc-remote with GNU General Public License v3.0 4 votes vote down vote up
public View createTabContent(String tag) {
    View v = new View(mContext);
    v.setMinimumWidth(0);
    v.setMinimumHeight(0);
    return v;
}
 
Example 19
Source File: FragmentTabHost.java    From letv with 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 20
Source File: CommentListingFragment.java    From RedReader with GNU General Public License v3.0 4 votes vote down vote up
@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());
	}
}