Android LayerDrawable - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android LayerDrawable class.

This code example shows how to use the following methods:setLayerInset
	 
	private Drawable getWheelBackground()
	{ 
		Drawable item0 = makeGradientDrawable(Orientation.BOTTOM_TOP, Color.parseColor("#333333"), Color.parseColor("#DDDDDD"), Color.parseColor("#333333"), 1f, Color.parseColor("#FF333333"));
		Drawable item1 = makeGradientDrawable(Orientation.BOTTOM_TOP, Color.parseColor("#AAAAAA"), Color.parseColor("#FFFFFF"), Color.parseColor("#AAAAAA"));
		LayerDrawable ld = new LayerDrawable(new Drawable[]{item0, item1});
		ld.setLayerInset(1, dipToInt(4f), dipToInt(1f), dipToInt(4f), dipToInt(1f));
		return ld;
	} 
 
	/** 
	 * Calculates desired height for layout 
	 *  
	 * @param layout 
	 *            the source layout 
	 * @return the desired layout height 
	 */ 
	private int getDesiredHeight(Layout layout) {
		if (layout == null) {
			return 0; 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setLayerInset
        if (icon == null) {
            array[2] = mGenericFavicon;
        } else { 
            array[2] = new BitmapDrawable(icon);
        } 
        LayerDrawable d = new LayerDrawable(array);
        d.setLayerInset(1, 1, 1, 1, 1);
        d.setLayerInset(2, 2, 2, 2, 2);
        return d;
    } 
 
    public boolean isLoading() { 
        return mActiveTab != null ? mActiveTab.inPageLoad() : false;
    } 
 
    /** 
     * Suggest to the UI that the title bar can be hidden. The UI will then 
     * decide whether or not to hide based off a number of factors, such 
     * as if the user is editing the URL bar or if the page is loading 
     */ 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setLayerInset
        if (icon == null) {
            array[2] = mGenericFavicon;
        } else { 
            array[2] = new BitmapDrawable(icon);
        } 
        LayerDrawable d = new LayerDrawable(array);
        d.setLayerInset(1, 1, 1, 1, 1);
        d.setLayerInset(2, 2, 2, 2, 2);
        mFavicon.setImageDrawable(d);
    } 
 
    /** 
     * Set the Drawable for the lock icon, or null to hide it. 
     */ 
    /* package */ void setLock(Drawable d) {
        if (null == d) {
            mLockIcon.setVisibility(View.GONE);
        } else { 
            mLockIcon.setImageDrawable(d);
            mLockIcon.setVisibility(View.VISIBLE);
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setId
 
    //Setup LayerDrawable and assign to progressBar 
    Drawable[] progressDrawables = {bgclip, fg2clip, fg1clip};
    LayerDrawable progressLayerDrawable = new LayerDrawable(progressDrawables);     
    progressLayerDrawable.setId(0, android.R.id.background);
    progressLayerDrawable.setId(1, android.R.id.secondaryProgress);
    progressLayerDrawable.setId(2, android.R.id.progress);
 
    //Copy the existing ProgressDrawable bounds to the new one. 
    Rect bounds = progressBar.getProgressDrawable().getBounds();
    progressBar.setProgressDrawable(progressLayerDrawable);     
    progressBar.getProgressDrawable().setBounds(bounds);
 
    // setProgress() ignores a change to the same value, so: 
    if (value1 == 0)
        progressBar.setProgress(1);
    else 
        progressBar.setProgress(0);
    progressBar.setProgress(value1);
 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setBounds, getIntrinsicHeight, getIntrinsicWidth, setId
        int h = drawable.getIntrinsicHeight();
        drawable.setBounds(0, 0, w, h);
    } 
 
    private static LayerDrawable createLayerDrawable(Drawable... layers) {
        return new LayerDrawable(layers);
    } 
 
    static { 
        sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
        sUriMatcher.addURI("www.youtube.com", "v/*", EMBED_YOUTUBE);
    } 
 
    /** 
     * Cache of recently used images. 
     */ 
    private static final Map<String, SoftReference<Bitmap>> sImageCache = new HashMap<String, SoftReference<Bitmap>>();
 
    /** 
     * Keeps track of pending tasks. 

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
		this.addView(titleText);
	} 
	 
	// So we can mock 
	protected LayerDrawable newLayerDrawable(Drawable[] layers) {
		return new LayerDrawable(layers);
	} 
 
	public String getHeaderText() {
		return headerText;
	} 
 
	public void setHeaderTextKey(String headerTextKey) {
		this.headerTextKey = headerTextKey;
	} 
 
	public void setLocalizationService(LocalizationService localizationService) {
		this.localizationService = localizationService;
	} 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setLayerInset
This code example shows how to use the following methods:
    	Document xmlDoc = documents.get( resourceExtractor.getResourceName( resId ) );
    	NodeList nodes = xmlDoc.getElementsByTagName("selector");
    	if( nodes != null && nodes.getLength() > 0 ) { return buildStateListDrawable( xmlDoc ); } 
 
    	nodes = xmlDoc.getElementsByTagName("layer-list");
    	if( nodes != null && nodes.getLength() > 0 ) { return new LayerDrawable( null ); }    	
 
    	return null; 
    } 
     
    /** 
     * Store document locally keyed by resource name. 
     *  
     * @param xmlFile 
     *            Xml file 
     * @param document 
     *            Document 
     * @param isSystem 
     *            System resource 
     * @throws Exception 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setCallback, scheduleDrawable
    } 
 
    public void fadeToDrawable(Drawable newImage) {
        Drawable old = super.getDrawable();
        newImage.setAlpha(0);
        LayerDrawable ld = new LayerDrawable(new Drawable[] {
                old, newImage
        }); 
        super.setImageDrawable(ld);
        ld.setCallback(new Callback() {
 
            @Override 
            public void unscheduleDrawable(Drawable who, Runnable what) {
            } 
 
            @Override 
            public void scheduleDrawable(Drawable who, Runnable what, long when) {
 
            } 
 

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getBounds, findDrawableByLayerId

Related Android LayerDrawable Questions & Answers:

See Code Examples for Android LayerDrawable Methods: