mirror of
https://github.com/dgis/emu48android
synced 2025-01-13 08:01:25 +01:00
Fix the Overlapping windows not refreshed correctly at the very start (new file).
This commit is contained in:
parent
30310af532
commit
7860e68d5c
3 changed files with 26 additions and 16 deletions
|
@ -191,7 +191,6 @@ The Eric's Real scripts ("real*.kml" and "real*.bmp/png") are embedded in this a
|
||||||
TODO
|
TODO
|
||||||
|
|
||||||
- Anyway that the layout settings (zoom mode, fill screen...) be part of the saved state, rather than being global to the app (Vincent Weber).
|
- Anyway that the layout settings (zoom mode, fill screen...) be part of the saved state, rather than being global to the app (Vincent Weber).
|
||||||
- Overlapping windows not refresh correctly at the very start (new file).
|
|
||||||
- Add the name of the file in the toast "State saved".
|
- Add the name of the file in the toast "State saved".
|
||||||
- The clock seems unsynchronized sometimes.
|
- The clock seems unsynchronized sometimes.
|
||||||
- Retain a key by right clicking if it is from a mouse.
|
- Retain a key by right clicking if it is from a mouse.
|
||||||
|
|
|
@ -17,9 +17,7 @@ package org.emulator.calculator;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
@ -34,7 +32,7 @@ import static org.emulator.calculator.MainScreenView.drawPixelBorder;
|
||||||
public class LCDOverlappingView extends View {
|
public class LCDOverlappingView extends View {
|
||||||
|
|
||||||
protected static final String TAG = "LCDOverlappingView";
|
protected static final String TAG = "LCDOverlappingView";
|
||||||
protected final boolean debug = false;
|
protected final boolean debug = true;
|
||||||
|
|
||||||
private SharedPreferences sharedPreferences;
|
private SharedPreferences sharedPreferences;
|
||||||
private Paint paint = new Paint();
|
private Paint paint = new Paint();
|
||||||
|
@ -55,14 +53,14 @@ public class LCDOverlappingView extends View {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
this.mainScreenView = mainScreenView;
|
this.mainScreenView = mainScreenView;
|
||||||
this.mainScreenView.setOnUpdateLayoutListener(this::updateLayout);
|
this.mainScreenView.setOnUpdateLayoutListener(this::updateLayout);
|
||||||
|
this.mainScreenView.setOnUpdateDisplayListener(this::postInvalidate);
|
||||||
|
|
||||||
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
|
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
|
||||||
|
|
||||||
//paint.setFilterBitmap(true);
|
|
||||||
paint.setStyle(Paint.Style.STROKE);
|
paint.setStyle(Paint.Style.STROKE);
|
||||||
paint.setStrokeWidth(1.0f);
|
paint.setStrokeWidth(1.0f);
|
||||||
paint.setAntiAlias(false); //true);
|
paint.setAntiAlias(false);
|
||||||
|
|
||||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||||
((Activity)context).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
((Activity)context).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||||
|
@ -219,7 +217,8 @@ public class LCDOverlappingView extends View {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDraw(Canvas canvas) {
|
protected void onDraw(Canvas canvas) {
|
||||||
//if(debug) Log.d(TAG, "onDraw()");
|
if(debug)
|
||||||
|
Log.d(TAG, "onDraw()");
|
||||||
|
|
||||||
if(this.overlappingLCDMode != OVERLAPPING_LCD_MODE_NONE) {
|
if(this.overlappingLCDMode != OVERLAPPING_LCD_MODE_NONE) {
|
||||||
int lcdPositionX = NativeLib.getScreenPositionX();
|
int lcdPositionX = NativeLib.getScreenPositionX();
|
||||||
|
|
|
@ -37,7 +37,7 @@ import java.util.Set;
|
||||||
public class MainScreenView extends PanAndScaleView {
|
public class MainScreenView extends PanAndScaleView {
|
||||||
|
|
||||||
protected static final String TAG = "MainScreenView";
|
protected static final String TAG = "MainScreenView";
|
||||||
protected final boolean debug = false;
|
protected final boolean debug = true;
|
||||||
|
|
||||||
private Paint paintFullCalc = new Paint();
|
private Paint paintFullCalc = new Paint();
|
||||||
private Paint paintLCD = new Paint();
|
private Paint paintLCD = new Paint();
|
||||||
|
@ -338,15 +338,21 @@ public class MainScreenView extends PanAndScaleView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Runnable onUpdateLayoutListener = null;
|
private Runnable onUpdateLayoutListener = null;
|
||||||
|
|
||||||
public void setOnUpdateLayoutListener(Runnable onUpdateLayoutListener) {
|
public void setOnUpdateLayoutListener(Runnable onUpdateLayoutListener) {
|
||||||
this.onUpdateLayoutListener = onUpdateLayoutListener;
|
this.onUpdateLayoutListener = onUpdateLayoutListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Runnable onUpdateDisplayListener = null;
|
||||||
|
|
||||||
|
public void setOnUpdateDisplayListener(Runnable onUpdateDisplayListener) {
|
||||||
|
this.onUpdateDisplayListener = onUpdateDisplayListener;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCustomDraw(Canvas canvas) {
|
protected void onCustomDraw(Canvas canvas) {
|
||||||
//Log.d(TAG, "onCustomDraw()");
|
if (debug) Log.d(TAG, "onCustomDraw()");
|
||||||
|
|
||||||
canvas.drawColor(getBackgroundColor());
|
canvas.drawColor(getBackgroundColor());
|
||||||
|
|
||||||
|
@ -364,6 +370,9 @@ public class MainScreenView extends PanAndScaleView {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDraw(Canvas canvas) {
|
public void onDraw(Canvas canvas) {
|
||||||
|
if (debug)
|
||||||
|
Log.d(TAG, "onDraw()");
|
||||||
|
|
||||||
super.onDraw(canvas);
|
super.onDraw(canvas);
|
||||||
|
|
||||||
if(usePixelBorders) {
|
if(usePixelBorders) {
|
||||||
|
@ -403,10 +412,13 @@ public class MainScreenView extends PanAndScaleView {
|
||||||
public void updateCallback(int type, int param1, int param2, String param3, String param4) {
|
public void updateCallback(int type, int param1, int param2, String param3, String param4) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case NativeLib.CALLBACK_TYPE_INVALIDATE:
|
case NativeLib.CALLBACK_TYPE_INVALIDATE:
|
||||||
//Log.d(TAG, "PAINT updateCallback() postInvalidate()");
|
if (debug) Log.d(TAG, "updateCallback() CALLBACK_TYPE_INVALIDATE postInvalidate()");
|
||||||
postInvalidate();
|
postInvalidate();
|
||||||
break;
|
if(this.onUpdateDisplayListener != null)
|
||||||
|
this.onUpdateDisplayListener.run();
|
||||||
|
break;
|
||||||
case NativeLib.CALLBACK_TYPE_WINDOW_RESIZE:
|
case NativeLib.CALLBACK_TYPE_WINDOW_RESIZE:
|
||||||
|
if (debug) Log.d(TAG, "updateCallback() CALLBACK_TYPE_WINDOW_RESIZE()");
|
||||||
// New Bitmap size
|
// New Bitmap size
|
||||||
if(bitmapMainScreen == null || bitmapMainScreen.getWidth() != param1 || bitmapMainScreen.getHeight() != param2) {
|
if(bitmapMainScreen == null || bitmapMainScreen.getWidth() != param1 || bitmapMainScreen.getHeight() != param2) {
|
||||||
if(debug) Log.d(TAG, "updateCallback() Bitmap.createBitmap(x: " + Math.max(1, param1) + ", y: " + Math.max(1, param2) + ")");
|
if(debug) Log.d(TAG, "updateCallback() Bitmap.createBitmap(x: " + Math.max(1, param1) + ", y: " + Math.max(1, param2) + ")");
|
||||||
|
|
Loading…
Reference in a new issue