if (StyleSheet.currentScreen != null) { if (StyleSheet.currentScreen.animate()) {
Screen screen = StyleSheet.currentScreen; if (screen != null ) { if (screen.animate()) {
	public void run() {		long sleeptime = ANIMATION_INTERVAL;		int animationCounter = 0;		while ( true ) {			try {				Thread.sleep(sleeptime);				if (StyleSheet.currentScreen != null) {					if (StyleSheet.currentScreen.animate()) {						sleeptime = ANIMATION_INTERVAL;						animationCounter = 0;					} else {						animationCounter++;						if (animationCounter > 10) {							sleeptime = 1000;							animationCounter = 0;						}					}				}				if (StyleSheet.gauge != null) {					//TODO rob double check if the StyleSheet.gauge is still visible					if (StyleSheet.gauge.animate()) {						sleeptime = ANIMATION_INTERVAL;						animationCounter = 0;						if (StyleSheet.currentScreen != null) {							StyleSheet.currentScreen.repaint();						}					} else {						StyleSheet.gauge = null;					}				}			} catch (InterruptedException e) {				// ignore			} catch (Exception e) {				//#debug error				Debug.debug("unable to animate: " + e.getMessage(), e );			}		}	}