Skip to content

Commit

Permalink
Initial Emulator view change
Browse files Browse the repository at this point in the history
  • Loading branch information
dvhh committed Apr 21, 2015
1 parent 8989011 commit b1ca1dc
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
Expand Down Expand Up @@ -120,6 +121,9 @@ public class EmulatorView extends View implements GestureDetector.OnGestureListe
*/
private Typeface mTypeface = Typeface.MONOSPACE;

private Drawable mBackgroundDrawable = null;
private int mBackgroundAlpha=50;

private Paint mForegroundPaint;

private Paint mBackgroundPaint;
Expand Down Expand Up @@ -642,6 +646,10 @@ public void setmTypeface(Typeface typeface) {
updateText();
}

public void setmBackgroundDrawable(Drawable backgroundDrawable) {
this.mBackgroundDrawable=backgroundDrawable;
}

@Override
public boolean onCheckIsTextEditor() {
return true;
Expand Down Expand Up @@ -1122,7 +1130,7 @@ private void sendMouseEventCode(MotionEvent e, int button_code) {
x > 255-32 || y > 255-32;
//Log.d(TAG, "mouse button "+x+","+y+","+button_code+",oob="+out_of_bounds);
if(button_code < 0 || button_code > 255-32) {
Log.e(TAG, "mouse button_code out of range: "+button_code);
Log.e(TAG, "mouse button_code out of range: " + button_code);
return;
}
if(!out_of_bounds) {
Expand Down Expand Up @@ -1552,7 +1560,13 @@ protected void onDraw(Canvas canvas) {

Paint backgroundPaint =
reverseVideo ? mForegroundPaint : mBackgroundPaint;
canvas.drawRect(0, 0, w, h, backgroundPaint);
if(mBackgroundDrawable==null) {
canvas.drawRect(0, 0, w, h, backgroundPaint);
}else{
mBackgroundDrawable.draw(canvas);
backgroundPaint.setAlpha(255-mBackgroundAlpha);
canvas.drawRect(0, 0, w, h, backgroundPaint);
}
float x = -mLeftColumn * mCharacterWidth;
float y = mCharacterHeight + mTopOfScreenMargin;
int endLine = mTopRow + mRows;
Expand Down

1 comment on commit b1ca1dc

@dvhh
Copy link
Owner Author

@dvhh dvhh commented on b1ca1dc Apr 21, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to #2 implementation,

Next step is the preference screen implementation

Please sign in to comment.