Code example for BitmapDrawable

0
    } 
 
    @SuppressWarnings("RedundantCast") //For some reason this is needed because of a compile error without it 
    @Test 
    public void testBackgroundDrawable() { 
      BitmapDrawable bitmapDrawable = new BitmapDrawable();
      popupWindow.setBackgroundDrawable(bitmapDrawable);
 
      assertThat((BitmapDrawable) popupWindow.getBackground()).isSameAs(bitmapDrawable);
    } 
 
    @Test 
    public void testTouchInterceptor() { 
      popupWindow.setTouchInterceptor(new View.OnTouchListener() {
        @Override 
        public boolean onTouch(View v, MotionEvent event) {
          return event.getAction() == ACTION_DOWN;
        } 
      }); 
 
      assertTrue(shadowOf(popupWindow).dispatchTouchEvent(obtain(1, 1, ACTION_DOWN, 1f, 1f, 0)));