Version 1.2beta5 (2019-11-28)

Improve overlapping LCD screen
This commit is contained in:
dgis 2019-11-29 08:41:40 +01:00
parent fccb189b24
commit 3e8ea1aa78
6 changed files with 75 additions and 57 deletions

View file

@ -54,12 +54,12 @@ NOT WORKING YET
CHANGES
Version 1.7beta3 (2019-11-24)
Version 1.7beta3 (2019-11-28)
- Updated source code from Eric Rechlin's Emu48 version 1.61+ that was merged from Christoph Gießelink's Emu48 version 1.62.
- Allow to take a screenshot of the fullscreen including the skin.
- Add the KML Icon if present in the navigation menu header (only support PNG or 32bits BMP in the ICO file).
- Add an optional overlapping LCD part stuck to the screen when swiping the 2 calc parts (Experimental).
- Add an optional overlapping LCD part stuck to the screen when swiping the 2 calc parts.
- Improve loading speed by caching the KML folder.
- Support the transparency in the KML Global Color.

View file

@ -33,7 +33,7 @@ android {
applicationId "org.emulator.forty.eight"
minSdkVersion 19
targetSdkVersion 28
versionCode 9
versionCode 10
versionName "1.7"
setProperty("archivesBaseName", "Emu48-v$versionName")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View file

@ -54,12 +54,12 @@ NOT WORKING YET
CHANGES
Version 1.7beta3 (2019-11-24)
Version 1.7beta3 (2019-11-28)
- Updated source code from Eric Rechlin's Emu48 version 1.61+ that was merged from Christoph Gießelink's Emu48 version 1.62.
- Allow to take a screenshot of the fullscreen including the skin.
- Add the KML Icon if present in the navigation menu header (only support PNG or 32bits BMP in the ICO file).
- Add an optional overlapping LCD part stuck to the screen when swiping the 2 calc parts (Experimental).
- Add an optional overlapping LCD part stuck to the screen when swiping the 2 calc parts.
- Improve loading speed by caching the KML folder.
- Support the transparency in the KML Global Color.

View file

@ -1,3 +1,17 @@
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
package org.emulator.calculator;
import android.app.Activity;
@ -221,8 +235,7 @@ public class LCDOverlappingView extends View {
return;
switch (type) {
case NativeLib.CALLBACK_TYPE_INVALIDATE:
//if(debug) Log.d(TAG, "PAINT updateCallback() postInvalidate()");
if(debug) Log.d(TAG, "updateCallback() CALLBACK_TYPE_INVALIDATE");
//if(debug) Log.d(TAG, "updateCallback() CALLBACK_TYPE_INVALIDATE");
if(bitmapLCD.getWidth() > 1)
postInvalidate();
break;
@ -265,32 +278,22 @@ public class LCDOverlappingView extends View {
int lcdHeight = Math.max(1, NativeLib.getScreenHeight());
if(this.overlappingLCDMode == OVERLAPPING_LCD_MODE_AUTO) {
float viewPanOffsetX = this.mainScreenView.viewPanOffsetX;
float viewPanOffsetY = this.mainScreenView.viewPanOffsetY;
float viewScaleFactorX = this.mainScreenView.viewScaleFactorX;
float viewScaleFactorY = this.mainScreenView.viewScaleFactorY;
int finalViewWidth = (int) (lcdWidth * viewScaleFactorX);
int finalViewHeight = (int) (lcdHeight * viewScaleFactorY);
post(() -> {
FrameLayout.LayoutParams viewFlowLayout = new FrameLayout.LayoutParams(finalViewWidth, finalViewHeight);
if(viewPanOffsetX > 0)
viewFlowLayout.leftMargin = (int)(viewScaleFactorX * NativeLib.getScreenPositionX() + viewPanOffsetX);
else
viewFlowLayout.leftMargin = this.mainScreenView.getWidth() - (int)(viewScaleFactorX * (this.mainScreenView.virtualSizeWidth - NativeLib.getScreenPositionX()));
if(viewPanOffsetY >= 0)
viewFlowLayout.topMargin = (int)(viewScaleFactorY * NativeLib.getScreenPositionY() + viewPanOffsetY);
else
viewFlowLayout.topMargin = (int)(viewScaleFactorY * NativeLib.getScreenPositionY());
int tolerance = 80;
if (viewFlowLayout.leftMargin + finalViewWidth < tolerance)
int viewLCDWidth = (int) (lcdWidth * this.mainScreenView.defaultViewScaleFactorX);
int viewLCDHeight = (int) (lcdHeight * this.mainScreenView.defaultViewScaleFactorY);
FrameLayout.LayoutParams viewFlowLayout = new FrameLayout.LayoutParams(viewLCDWidth, viewLCDHeight);
viewFlowLayout.leftMargin = (int)(this.mainScreenView.defaultViewScaleFactorX * (float)NativeLib.getScreenPositionX() + this.mainScreenView.defaultViewPanOffsetX);
viewFlowLayout.topMargin = (int)(this.mainScreenView.defaultViewScaleFactorY * (float)NativeLib.getScreenPositionY() + this.mainScreenView.defaultViewPanOffsetY);
int tolerance = 80; // In case of miscalculation
if (viewFlowLayout.leftMargin + viewLCDWidth < tolerance)
viewFlowLayout.leftMargin = 0;
if (viewFlowLayout.leftMargin + tolerance > this.mainScreenView.getWidth())
viewFlowLayout.leftMargin = this.mainScreenView.getWidth() - finalViewWidth;
if (viewFlowLayout.topMargin + finalViewHeight < tolerance)
viewFlowLayout.leftMargin = this.mainScreenView.getWidth() - viewLCDWidth;
if (viewFlowLayout.topMargin + viewLCDHeight < tolerance)
viewFlowLayout.topMargin = 0;
if (viewFlowLayout.topMargin + tolerance > this.mainScreenView.getHeight())
viewFlowLayout.topMargin = this.mainScreenView.getHeight() - finalViewHeight;
viewFlowLayout.topMargin = this.mainScreenView.getHeight() - viewLCDHeight;
if(debug) Log.d(TAG, "updateLayout() leftMargin: " + viewFlowLayout.leftMargin + ", topMargin: " + viewFlowLayout.topMargin
+ ", width: " + viewFlowLayout.width + ", height: " + viewFlowLayout.height);
setLayoutParams(viewFlowLayout);
@ -299,6 +302,7 @@ public class LCDOverlappingView extends View {
} else if(this.overlappingLCDMode == OVERLAPPING_LCD_MODE_MANUAL) {
if(firstTime) {
firstTime = false;
post(() -> {
float scale = sharedPreferences.getFloat("settings_lcd_overlapping_scale", 1.0f);
if (scale < 0.01f)
scale = 0.01f;
@ -319,19 +323,16 @@ public class LCDOverlappingView extends View {
}
}
int finalViewWidth = viewWidth;
int finalViewHeight = viewHeight;
post(() -> {
FrameLayout.LayoutParams viewFlowLayout = new FrameLayout.LayoutParams(finalViewWidth, finalViewHeight);
FrameLayout.LayoutParams viewFlowLayout = new FrameLayout.LayoutParams(viewWidth, viewHeight);
viewFlowLayout.leftMargin = sharedPreferences.getInt("settings_lcd_overlapping_x", 20);
viewFlowLayout.topMargin = sharedPreferences.getInt("settings_lcd_overlapping_y", 80);
int tolerance = 80;
if (viewFlowLayout.leftMargin + finalViewWidth < tolerance)
viewFlowLayout.leftMargin = tolerance - finalViewWidth;
if (viewFlowLayout.leftMargin + viewWidth < tolerance)
viewFlowLayout.leftMargin = tolerance - viewWidth;
if (viewFlowLayout.leftMargin + tolerance > this.mainScreenView.getWidth())
viewFlowLayout.leftMargin = this.mainScreenView.getWidth() - tolerance;
if (viewFlowLayout.topMargin + finalViewHeight < tolerance)
viewFlowLayout.topMargin = tolerance - finalViewHeight;
if (viewFlowLayout.topMargin + viewHeight < tolerance)
viewFlowLayout.topMargin = tolerance - viewHeight;
if (viewFlowLayout.topMargin + tolerance > this.mainScreenView.getHeight())
viewFlowLayout.topMargin = this.mainScreenView.getHeight() - tolerance;
if(debug) Log.d(TAG, "updateLayout() leftMargin: " + viewFlowLayout.leftMargin + ", topMargin: " + viewFlowLayout.topMargin

View file

@ -50,6 +50,12 @@ public class MainScreenView extends PanAndScaleView {
private boolean autoRotation = false;
private boolean autoZoom = false;
public float defaultViewScaleFactorX = 1.0f;
public float defaultViewScaleFactorY = 1.0f;
public float defaultViewPanOffsetX = 0.0f;
public float defaultViewPanOffsetY = 0.0f;
public MainScreenView(Context context) {
super(context);
@ -294,6 +300,12 @@ public class MainScreenView extends PanAndScaleView {
viewPanOffsetY = translateY;
constrainPan();
defaultViewScaleFactorX = viewScaleFactorX;
defaultViewScaleFactorY = viewScaleFactorY;
defaultViewPanOffsetX = viewPanOffsetX;
defaultViewPanOffsetY = viewPanOffsetY;
if(this.onUpdateLayoutListener != null)
this.onUpdateLayoutListener.run();
return;
@ -304,6 +316,11 @@ public class MainScreenView extends PanAndScaleView {
// Else, the screens orientations are the same, so we set the calculator in fullscreen
resetViewport();
defaultViewScaleFactorX = viewScaleFactorX;
defaultViewScaleFactorY = viewScaleFactorY;
defaultViewPanOffsetX = viewPanOffsetX;
defaultViewPanOffsetY = viewPanOffsetY;
if(this.onUpdateLayoutListener != null)
this.onUpdateLayoutListener.run();
}

View file

@ -38,8 +38,8 @@
<string-array name="settings_lcd_overlapping_mode_item">
<item>No Overlapping LCD</item>
<item>Auto</item>
<item>Manual</item>
<item>Auto (Double touch)</item>
<item>Manual (Zoom or pan)</item>
</string-array>
<string-array name="settings_lcd_overlapping_mode_value">
<item>0</item>