@Override public void onDraw(Canvas canvas,Rect bounds){
  int width=bounds.width();
  int height=bounds.height();
  calendar.setTimeInMillis(System.currentTimeMillis());
  wfBitmap=Bitmap.createScaledBitmap(wfBitmap,width,height,true);
  wfAmbientBitmap=Bitmap.createScaledBitmap(wfAmbientBitmap,width,height,true);
  if (height < ORIGINAL_SIZE) {
    k=(float)height / ORIGINAL_SIZE;
    secScaledBitmap=scaleBitmap(secBitmap);
    minScaledBitmap=scaleBitmap(minBitmap);
    hrScaledBitmap=scaleBitmap(hrBitmap);
    hrAmbientScaledBitmap=scaleBitmap(hrAmbientBitmap);
    minAmbientScaledBitmap=scaleBitmap(minAmbientBitmap);
  }
 else {
    secScaledBitmap=secBitmap;
    minScaledBitmap=minBitmap;
    hrScaledBitmap=hrBitmap;
    hrAmbientScaledBitmap=hrAmbientBitmap;
    minAmbientScaledBitmap=minAmbientBitmap;
  }
  centerX=width / 2f;
  centerY=height / 2f;
  float seconds=calendar.get(Calendar.SECOND) + calendar.get(Calendar.MILLISECOND) / 1000f;
  float minutes=calendar.get(Calendar.MINUTE) + seconds / 60f;
  float hours=calendar.get(Calendar.HOUR) + minutes / 60f;
  float minutesRotation=minutes * MINUTES_TO_DEGREES + 360f;
  float hoursRotation=hours * HOURS_TO_DEGREES + 360f;
  boolean isInteractive=!isInAmbientMode();
  Paint mFilterPaint=new Paint();
  mFilterPaint.setFilterBitmap(true);
  if (isInteractive) {
    canvas.drawColor(Color.BLACK);
    canvas.drawBitmap(wfBitmap,0,0,mFilterPaint);
    drawBaseTicks(canvas,minutesRotation,hoursRotation,seconds);
  }
 else {
    canvas.drawBitmap(wfAmbientBitmap,0,0,mFilterPaint);
    drawAmbientTicks(canvas,minutesRotation,hoursRotation);
  }
}

@ Override public void onDraw ( Canvas canvas , Rect bounds ) { int width = bounds . width ( ) ; int height = bounds . height ( ) ; calendar . setTimeInMillis ( System . currentTimeMillis ( ) ) ; wfBitmap = Bitmap . createScaledBitmap ( wfBitmap , width , height , true ) ; wfAmbientBitmap = Bitmap . createScaledBitmap ( wfAmbientBitmap , width , height , true ) ; if ( height < ORIGINAL_SIZE ) { k = ( float ) height / ORIGINAL_SIZE ; secScaledBitmap = scaleBitmap ( secBitmap ) ; minScaledBitmap = scaleBitmap ( minBitmap ) ; hrScaledBitmap = scaleBitmap ( hrBitmap ) ; hrAmbientScaledBitmap = scaleBitmap ( hrAmbientBitmap ) ; minAmbientScaledBitmap = scaleBitmap ( minAmbientBitmap ) ; } else { secScaledBitmap = secBitmap ; minScaledBitmap = minBitmap ; hrScaledBitmap = hrBitmap ; hrAmbientScaledBitmap = hrAmbientBitmap ; minAmbientScaledBitmap = minAmbientBitmap ; } centerX = width / 2f ; centerY = height / 2f ; float seconds = calendar . get ( Calendar . SECOND ) + calendar . get ( Calendar . MILLISECOND ) / 1000f ; float minutes = calendar . get ( Calendar . MINUTE ) + seconds / 60f ; float hours = calendar . get ( Calendar . HOUR ) + minutes / 60f ; float minutesRotation = minutes * MINUTES_TO_DEGREES + 360f ; float hoursRotation = hours * HOURS_TO_DEGREES + 360f ; boolean isInteractive = ! isInAmbientMode ( ) ; Paint mFilterPaint = new Paint ( ) ; mFilterPaint . setFilterBitmap ( true ) ; if ( isInteractive ) { canvas . drawColor ( Color . BLACK ) ; canvas . drawBitmap ( wfBitmap , 0 , 0 , mFilterPaint ) ; drawBaseTicks ( canvas , minutesRotation , hoursRotation , seconds ) ; } else { canvas . drawBitmap ( wfAmbientBitmap , 0 , 0 , mFilterPaint ) ; drawAmbientTicks ( canvas , minutesRotation , hoursRotation ) ; } }
called within invalidate ( ) to update ( redraw ) screen .
