Android BitmapDrawable - 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 BitmapDrawable class.

This code example shows how to use the following methods: getIntrinsicHeight, getIntrinsicWidth, getPaint, setBounds
 
    public DrawableHolder(BitmapDrawable drawable, float x, float y) {
        mDrawable = drawable;
        mX = x;
        mY = y;
        mDrawable.getPaint().setAntiAlias(true); // Force AA
        mDrawable.setBounds(0, 0, mDrawable.getIntrinsicWidth(), mDrawable.getIntrinsicHeight());
    } 
 
    /** 
     * 
     * Adds an animation that interpolates given property from its current value 
     * to the given value. 
     * 
     * @param duration the duration, in ms. 
     * @param delay the delay to start the animation, in ms. 
     * @param property the property to animate 
     * @param toValue the target value 
     * @param replace if true, replace the current animation with this one. 
     */ 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getIntrinsicHeight, getIntrinsicWidth, setTargetDensity
This code example shows how to use the following methods: draw, setAlpha
        if (placeholder != null) {
          placeholder.draw(canvas);
        } 
 
        int alpha = (int) (0xFF * normalized);
        image.setAlpha(alpha);
        image.draw(canvas);
        image.setAlpha(0xFF);
        invalidateSelf();
      } 
    } 
 
    if (debugging) {
      drawDebugIndicator(canvas);
    } 
  } 
 
  @Override public int getIntrinsicWidth() { 
    return image.getIntrinsicWidth();
  } 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
 
  @Test 
  public void queryActivityIcons__Match() throws Exception { 
    Intent i = new Intent();
    i.setComponent(new ComponentName(TEST_PACKAGE_NAME, ""));
    Drawable d = new BitmapDrawable();
 
    rpm.addActivityIcon(i, d);
 
    assertThat(rpm.getActivityIcon(i)).isSameAs(d);
    assertThat(rpm.getActivityIcon(i.getComponent())).isSameAs(d);
  } 
 
  @Test 
  public void hasSystemFeature() throws Exception { 
    // uninitialized 
    assertThat(rpm.hasSystemFeature(PackageManager.FEATURE_CAMERA)).isFalse();
 
    // positive 
    rpm.setSystemFeature(PackageManager.FEATURE_CAMERA, true);
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getIntrinsicHeight, getIntrinsicWidth
    } 
 
    @Test 
    public void constructor_shouldSetTheIntrinsicWidthAndHeightToTheWidthAndHeightOfTheBitmap() throws Exception { 
        Bitmap bitmap = Bitmap.createBitmap(5, 10, Bitmap.Config.ARGB_8888);
        BitmapDrawable drawable = new BitmapDrawable(Robolectric.application.getResources(), bitmap);
        assertEquals(5, drawable.getIntrinsicWidth());
        assertEquals(10, drawable.getIntrinsicHeight());
    } 
 
    @Test 
    public void constructor_shouldAcceptNullBitmap() throws Exception { 
        BitmapDrawable drawable = new BitmapDrawable(Robolectric.application.getResources(), (Bitmap) null);
        assertNotNull(drawable);
    } 
} 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android BitmapDrawable Questions & Answers:

See Code Examples for Android BitmapDrawable Methods: