1
0
Fork 0
forked from len0rd/rockbox

Add support multimedia keys/buttons to the core, and adapt Rockbox on android for it (multimedia buttons are found on wired headsets and the lock screen in cyanogenmod).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28421 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2010-10-31 15:32:57 +00:00
parent dbe2ac1ec6
commit 49f1ec8e8a
13 changed files with 300 additions and 17 deletions

View file

@ -23,6 +23,8 @@ package org.rockbox;
import java.nio.ByteBuffer;
import org.rockbox.Helper.MediaButtonReceiver;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@ -35,6 +37,7 @@ public class RockboxFramebuffer extends View
{
private Bitmap btm;
private ByteBuffer native_buf;
private MediaButtonReceiver media_monitor;
public RockboxFramebuffer(Context c, int lcd_width,
int lcd_height, ByteBuffer native_fb)
@ -47,6 +50,8 @@ public class RockboxFramebuffer extends View
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 */
((RockboxService)c).set_fb(this);
}
@ -122,6 +127,12 @@ public class RockboxFramebuffer extends View
set_lcd_active(1);
}
public void destroy()
{
suspend();
media_monitor.unregister();
}
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);