1
0
Fork 0
forked from len0rd/rockbox

Code style changes in the java part (whitespaces and braces) to match Rockbox coding style.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28065 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2010-09-12 19:56:13 +00:00
parent 54c838d2ae
commit 282adacb54
5 changed files with 549 additions and 528 deletions

View file

@ -33,93 +33,92 @@ import android.view.View;
public class RockboxFramebuffer extends View
{
private Bitmap btm;
private Bitmap btm;
private ByteBuffer native_buf;
public RockboxFramebuffer(Context c)
{
super(c);
btm = null;
public RockboxFramebuffer(Context c)
{
super(c);
btm = null;
/* Needed so we can catch KeyEvents */
setFocusable(true);
requestFocus();
}
/* Needed so we can catch KeyEvents */
setFocusable(true);
requestFocus();
}
public void onDraw(Canvas c)
{
if (btm != null)
c.drawBitmap(btm, 0.0f, 0.0f, null);
}
public void java_lcd_init(int lcd_width, int lcd_height, ByteBuffer native_fb)
{
btm = Bitmap.createBitmap(lcd_width, lcd_height, Bitmap.Config.RGB_565);
native_buf = native_fb;
}
public void java_lcd_update()
{
btm.copyPixelsFromBuffer(native_buf);
postInvalidate();
}
public void java_lcd_update_rect(int x, int y, int w, int h)
{
/* can't copy a partial buffer */
btm.copyPixelsFromBuffer(native_buf);
public void onDraw(Canvas c)
{
if (btm != null)
c.drawBitmap(btm, 0.0f, 0.0f, null);
}
public void java_lcd_init(int lcd_width, int lcd_height, ByteBuffer native_fb)
{
btm = Bitmap.createBitmap(lcd_width, lcd_height, Bitmap.Config.RGB_565);
native_buf = native_fb;
}
public void java_lcd_update()
{
btm.copyPixelsFromBuffer(native_buf);
postInvalidate();
}
public void java_lcd_update_rect(int x, int y, int w, int h)
{
/* can't copy a partial buffer */
btm.copyPixelsFromBuffer(native_buf);
postInvalidate(x, y, x+w, y+h);
}
postInvalidate(x, y, x+w, y+h);
}
@SuppressWarnings("unused")
private void LOG(CharSequence text)
{
Log.d("Rockbox", (String) text);
}
@SuppressWarnings("unused")
private void LOG(CharSequence text)
{
Log.d("Rockbox", (String) text);
}
public boolean onTouchEvent(MotionEvent me)
{
public boolean onTouchEvent(MotionEvent me)
{
int x = (int) me.getX();
int y = (int) me.getY();
switch (me.getAction())
{
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
touchHandler(false, x, y);
return true;
case MotionEvent.ACTION_MOVE:
case MotionEvent.ACTION_DOWN:
touchHandler(true, x, y);
return true;
}
switch (me.getAction())
{
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
touchHandler(false, x, y);
return true;
case MotionEvent.ACTION_MOVE:
case MotionEvent.ACTION_DOWN:
touchHandler(true, x, y);
return true;
}
return false;
}
return false;
}
public boolean onKeyDown(int keyCode, KeyEvent event)
{
return buttonHandler(keyCode, true);
}
public boolean onKeyDown(int keyCode, KeyEvent event)
{
return buttonHandler(keyCode, true);
}
public boolean onKeyUp(int keyCode, KeyEvent event)
{
return buttonHandler(keyCode, false);
}
public boolean onKeyUp(int keyCode, KeyEvent event)
{
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 */
set_lcd_active(0);
}
public void resume()
{ /* make updates again, the underlying function will
* send an event */
set_lcd_active(1);
}
/* the two below should only be called from the activity thread */
public void suspend()
{ /* suspend, Rockbox will not make any lcd updates */
set_lcd_active(0);
}
public void resume()
{ /* make updates again, the underlying function will
* send an event */
set_lcd_active(1);
}
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);
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);
}