summaryrefslogtreecommitdiff
path: root/android/src/org/rockbox/RockboxFramebuffer.java
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2010-11-05 23:39:53 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2010-11-05 23:39:53 +0000
commita83043274bdbf56935f8b38f5b940b672413f261 (patch)
tree825b506c01c31fe47479c9ae4a54e02516eb3b4b /android/src/org/rockbox/RockboxFramebuffer.java
parent540dd9c2d0510636536684a4c0b88fabd5326a9b (diff)
Android port:
* decouple RockboxFramebuffer resume/suspend behaviour from RockboxActivity * make RockboxFramebuffer native methods private * refactor attaching the RockboxFramebuffer view to RockboxActivity git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28505 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'android/src/org/rockbox/RockboxFramebuffer.java')
-rw-r--r--android/src/org/rockbox/RockboxFramebuffer.java41
1 files changed, 20 insertions, 21 deletions
diff --git a/android/src/org/rockbox/RockboxFramebuffer.java b/android/src/org/rockbox/RockboxFramebuffer.java
index 84974d627a..0a60182502 100644
--- a/android/src/org/rockbox/RockboxFramebuffer.java
+++ b/android/src/org/rockbox/RockboxFramebuffer.java
@@ -49,7 +49,6 @@ public class RockboxFramebuffer extends View
setClickable(true);
btm = Bitmap.createBitmap(lcd_width, lcd_height, Bitmap.Config.RGB_565);
native_buf = native_fb;
- requestFocus();
media_monitor = new MediaButtonReceiver(c);
media_monitor.register();
/* the service needs to know the about us */
@@ -60,7 +59,7 @@ public class RockboxFramebuffer extends View
{
c.drawBitmap(btm, 0.0f, 0.0f, null);
}
-
+
@SuppressWarnings("unused")
private void java_lcd_update()
{
@@ -112,29 +111,29 @@ public class RockboxFramebuffer extends View
return buttonHandler(keyCode, false);
}
- /* the two below should only be called from the activity thread */
- public void suspend()
- { /* suspend, Rockbox will not make any lcd updates */
+ public void destroy()
+ {
set_lcd_active(0);
- }
- public void resume()
- {
- /* Needed so we can catch KeyEvents */
- setFocusable(true);
- setFocusableInTouchMode(true);
- setClickable(true);
- requestFocus();
- set_lcd_active(1);
+ media_monitor.unregister();
}
- public void destroy()
+ @Override
+ protected void onWindowVisibilityChanged(int visibility)
{
- suspend();
- media_monitor.unregister();
+ super.onWindowVisibilityChanged(visibility);
+
+ switch (visibility) {
+ case VISIBLE:
+ set_lcd_active(1);
+ break;
+ case GONE:
+ case INVISIBLE:
+ set_lcd_active(0);
+ break;
+ }
}
- public native void set_lcd_active(int active);
- public native void touchHandler(boolean down, int x, int y);
- public native boolean buttonHandler(int keycode, boolean state);
-
+ private native void set_lcd_active(int active);
+ private native void touchHandler(boolean down, int x, int y);
+ private native boolean buttonHandler(int keycode, boolean state);
}