129 static final int EVENT_SET_CURRENT = 29; |
129 static final int EVENT_SET_CURRENT = 29; |
130 static final int EVENT_SERIAL = 30; |
130 static final int EVENT_SERIAL = 30; |
131 |
131 |
132 static final int EVET_CANVAS_GRAPHICS_ITEM_REPAINT = 31; |
132 static final int EVET_CANVAS_GRAPHICS_ITEM_REPAINT = 31; |
133 static final int EVENT_M3G_DRAW = 32 ; |
133 static final int EVENT_M3G_DRAW = 32 ; |
|
134 static final int EVENT_FORCED_PAINT = 33; |
|
135 static final int EVENT_FREE_GPU_MEMORY = 34; |
|
136 |
134 // IMPLICIT EVENT TYPES |
137 // IMPLICIT EVENT TYPES |
135 static final int EVENT_DISMISS = 0; // ALERT |
138 static final int EVENT_DISMISS = 0; // ALERT |
136 static final int EVENT_ITEM_CHANGED = 0; // ITEM(S) |
139 static final int EVENT_ITEM_CHANGED = 0; // ITEM(S) |
137 static final int EVENT_SELECT = 0; // LIST |
140 static final int EVENT_SELECT = 0; // LIST |
138 |
141 |
552 case EVENT_START_REQUESTED: |
555 case EVENT_START_REQUESTED: |
553 ApplicationUtils.getInstance().resumeApplication(); |
556 ApplicationUtils.getInstance().resumeApplication(); |
554 break; |
557 break; |
555 case EVENT_FOREGROUND: |
558 case EVENT_FOREGROUND: |
556 iDisplay.handleForeground(true); |
559 iDisplay.handleForeground(true); |
557 notifyForeground(true); |
|
558 break; |
560 break; |
559 case EVENT_BACKGROUND: |
561 case EVENT_BACKGROUND: |
560 iDisplay.handleForeground(false); |
562 iDisplay.handleForeground(false); |
561 notifyForeground(false); |
563 notifyFreeGraphicsMemory(); |
562 break; |
564 break; |
563 case EVENT_SET_CURRENT: |
565 case EVENT_SET_CURRENT: |
564 iDisplay.switchCurrent(); |
566 iDisplay.switchCurrent(); |
565 break; |
567 break; |
566 case EVENT_SERIAL: |
568 case EVENT_SERIAL: |
567 iDisplay.processSerialEvents(); |
569 iDisplay.processSerialEvents(); |
|
570 break; |
|
571 case EVENT_FREE_GPU_MEMORY: |
|
572 notifyFreeGraphicsMemory(); |
568 break; |
573 break; |
569 default: |
574 default: |
570 throw new IllegalArgumentException(); |
575 throw new IllegalArgumentException(); |
571 } |
576 } |
572 } |
577 } |
573 } |
578 } |
574 } |
579 } |
575 |
580 |
576 private synchronized void notifyForeground(boolean foreground) |
581 private synchronized void notifyFreeGraphicsMemory() |
577 { |
582 { |
578 if (null != iObservers) |
583 if (null != iObservers) |
579 { |
584 { |
580 final int lastIndex = iObservers.size() - 1; |
585 final int lastIndex = iObservers.size() - 1; |
581 for (int ii=lastIndex; ii>=0; ii--) |
586 for (int ii=lastIndex; ii>=0; ii--) |
582 { |
587 { |
583 if (iObservers.elementAt(ii) instanceof ToolkitObserverNGAExtension) |
588 if (iObservers.elementAt(ii) instanceof ToolkitObserverNGAExtension) |
584 { |
589 { |
585 final ToolkitObserverNGAExtension observer = |
590 final ToolkitObserverNGAExtension observer = |
586 (ToolkitObserverNGAExtension)iObservers.elementAt(ii); |
591 (ToolkitObserverNGAExtension)iObservers.elementAt(ii); |
587 observer.foregroundEvent(foreground); |
592 observer.freeGraphicsMemory(); |
588 } |
593 } |
589 } |
594 } |
590 } |
595 } |
591 } |
596 } |
592 |
597 |