Drawable getMinimumWidth - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Drawable getMinimumWidth method.

This code example shows how to use the following methods:draw, getMinimumHeight, getMinimumWidth, getPadding, setBounds
        boolean drawBackground = background != null;
        boolean drawText = (text != null) && (textPaint != null);
 
        Rect padding = new Rect();
        if (drawBackground) {
            background.getPadding(padding);
            minWidth = Math.max(minWidth, background.getMinimumWidth());
            minHeight = Math.max(minHeight, background.getMinimumHeight());
        } 
 
        int ascent = 0;
        int descent = 0;
        int measuredTextWidth = 0;
        if (drawText) {
            // Paint.ascent is negative, so negate it. 
            ascent = (int) Math.ceil(-textPaint.ascent());
            descent = (int) Math.ceil(textPaint.descent());
            measuredTextWidth = (int) Math.ceil(textPaint.measureText(text));
        } 
        int textHeight = ascent + descent;

7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:draw, getMinimumHeight, getMinimumWidth, setBounds
		 
		if(!isTextCalculated && this.isInflated){
			isTextCalculated = true;
			//Get the maximum allowed width of the text to use on the map 
			int layoutPadding = (int)(30 * density);
			this.arrowWidth = arrowMore.getMinimumWidth();
			this.arrowHeight = arrowMore.getMinimumHeight();
			int maxWidth = this.mapView.getWidth()-this.imageWidth-2*VFOverlayItem.paddingX - layoutPadding - arrowWidth;
			int breakTextIndexTop = 1000;
			int breakTextIndexSub = 1000;
			 
			int maxLength = Math.max(this.topTextBoxRect.width(), this.subTextBoxRect.width());
			if(maxLength > maxWidth){
				breakTextIndexTop = topTextPaint.breakText(this.itemName, true, maxWidth, null);
				if(this.itemDesc != null){
					breakTextIndexSub = subTextPaint.breakText(this.itemDesc, true, maxWidth, null);
				} 
			} 
			 
			if(breakTextIndexTop < this.itemName.length()-1){ //-1 becouse we don't what to remove one char to set .. 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:draw, getMinimumHeight, getMinimumWidth
This code example shows how to use the following methods:getMinimumWidth
        return mDrawable.getIntrinsicHeight();
    } 
 
    @Override 
    public int getMinimumWidth() { 
        return mDrawable.getMinimumWidth();
    } 
 
    @Override 
    public int getMinimumHeight() { 
        return mDrawable.getMinimumHeight();
    } 
 
    @Override 
    public boolean getPadding(Rect padding) {
        return mDrawable.getPadding(padding);
    } 
 
    /** {@inheritDoc} */ 
    public void invalidateDrawable(Drawable who) {
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:draw, getMinimumHeight, getMinimumWidth, getPadding, setBounds
        boolean drawBackground = background != null;
        boolean drawText = (text != null) && (textPaint != null);
 
        Rect padding = new Rect();
        if (drawBackground) {
            background.getPadding(padding);
            minWidth = Math.max(minWidth, background.getMinimumWidth());
            minHeight = Math.max(minHeight, background.getMinimumHeight());
        } 
 
        int ascent = 0;
        int descent = 0;
        int measuredTextWidth = 0;
        if (drawText) {
            // Paint.ascent is negative, so negate it. 
            ascent = (int) Math.ceil(-textPaint.ascent());
            descent = (int) Math.ceil(textPaint.descent());
            measuredTextWidth = (int) Math.ceil(textPaint.measureText(text));
        } 
        int textHeight = ascent + descent;

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMinimumHeight, getMinimumWidth
This code example shows how to use the following methods:getMinimumHeight, getMinimumWidth
        assertNotNull(mAbsoluteLayout);
    } 
     
    public void doMinimumSizeTest(View view) throws Exception {
        assertTrue(view.getClass().getSimpleName() + " should respect the background Drawable's minimum width",
                view.getWidth() >= mBackgroundDrawable.getMinimumWidth());
        assertTrue(view.getClass().getSimpleName() + " should respect the background Drawable's minimum height",
                view.getHeight() >= mBackgroundDrawable.getMinimumHeight());
    } 
 
    @MediumTest 
    public void testTextViewMinimumSize() throws Exception { 
        doMinimumSizeTest(mTextView);
    } 
     
    @MediumTest 
    public void testLinearLayoutMinimumSize() throws Exception { 
        doMinimumSizeTest(mLinearLayout);
    } 
     
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMinimumWidth
		return mDrawable.getMinimumHeight();
	} 
 
	@Override 
	public int getMinimumWidth() { 
		return mDrawable.getMinimumWidth();
	} 
 
	@Override 
	public boolean getPadding( Rect padding ) {
		return mDrawable.getPadding( padding );
	} 
 
	@Override 
	public void setBounds( int left, int top, int right, int bottom ) {
		mDrawable.setBounds( left, top, right, bottom );
		super.setBounds( left, top, right, bottom );
	} 
 
	@Override 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMinimumWidth
            return mWrapped.getIntrinsicHeight();
        } 
 
        @Override 
        public int getMinimumWidth() { 
            return mWrapped.getMinimumWidth();
        } 
 
        @Override 
        public int getMinimumHeight() { 
            return mWrapped.getMinimumHeight();
        } 
 
        @Override 
        public boolean getPadding(Rect padding) {
            return mWrapped.getPadding(padding);
        } 
 
        @Override 
        public ConstantState getConstantState() {
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMinimumWidth
            return mWrapped.getIntrinsicHeight();
        } 
 
        @Override 
        public int getMinimumWidth() { 
            return mWrapped.getMinimumWidth();
        } 
 
        @Override 
        public int getMinimumHeight() { 
            return mWrapped.getMinimumHeight();
        } 
 
        @Override 
        public boolean getPadding(Rect padding) {
            return mWrapped.getPadding(padding);
        } 
 
        @Override 
        public ConstantState getConstantState() {
5
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Drawable getMinimumWidth Questions & Answers:

getMinimumWidth Method Overview
Returns the minimum width suggested by this Drawable.
See Code Examples for other Android Drawable Methods: