mirror of
https://github.com/dgis/emu48android
synced 2024-12-28 09:58:32 +01:00
Version 1.2beta5 (2019-11-28)
Improve overlapping LCD screen
This commit is contained in:
parent
fccb189b24
commit
3e8ea1aa78
6 changed files with 75 additions and 57 deletions
|
@ -54,12 +54,12 @@ NOT WORKING YET
|
||||||
|
|
||||||
CHANGES
|
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.
|
- 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.
|
- 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 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.
|
- Improve loading speed by caching the KML folder.
|
||||||
- Support the transparency in the KML Global Color.
|
- Support the transparency in the KML Global Color.
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ android {
|
||||||
applicationId "org.emulator.forty.eight"
|
applicationId "org.emulator.forty.eight"
|
||||||
minSdkVersion 19
|
minSdkVersion 19
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 9
|
versionCode 10
|
||||||
versionName "1.7"
|
versionName "1.7"
|
||||||
setProperty("archivesBaseName", "Emu48-v$versionName")
|
setProperty("archivesBaseName", "Emu48-v$versionName")
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
|
@ -54,12 +54,12 @@ NOT WORKING YET
|
||||||
|
|
||||||
CHANGES
|
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.
|
- 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.
|
- 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 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.
|
- Improve loading speed by caching the KML folder.
|
||||||
- Support the transparency in the KML Global Color.
|
- Support the transparency in the KML Global Color.
|
||||||
|
|
||||||
|
|
|
@ -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;
|
package org.emulator.calculator;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -221,8 +235,7 @@ public class LCDOverlappingView extends View {
|
||||||
return;
|
return;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case NativeLib.CALLBACK_TYPE_INVALIDATE:
|
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)
|
if(bitmapLCD.getWidth() > 1)
|
||||||
postInvalidate();
|
postInvalidate();
|
||||||
break;
|
break;
|
||||||
|
@ -265,32 +278,22 @@ public class LCDOverlappingView extends View {
|
||||||
int lcdHeight = Math.max(1, NativeLib.getScreenHeight());
|
int lcdHeight = Math.max(1, NativeLib.getScreenHeight());
|
||||||
|
|
||||||
if(this.overlappingLCDMode == OVERLAPPING_LCD_MODE_AUTO) {
|
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(() -> {
|
post(() -> {
|
||||||
FrameLayout.LayoutParams viewFlowLayout = new FrameLayout.LayoutParams(finalViewWidth, finalViewHeight);
|
int viewLCDWidth = (int) (lcdWidth * this.mainScreenView.defaultViewScaleFactorX);
|
||||||
if(viewPanOffsetX > 0)
|
int viewLCDHeight = (int) (lcdHeight * this.mainScreenView.defaultViewScaleFactorY);
|
||||||
viewFlowLayout.leftMargin = (int)(viewScaleFactorX * NativeLib.getScreenPositionX() + viewPanOffsetX);
|
FrameLayout.LayoutParams viewFlowLayout = new FrameLayout.LayoutParams(viewLCDWidth, viewLCDHeight);
|
||||||
else
|
viewFlowLayout.leftMargin = (int)(this.mainScreenView.defaultViewScaleFactorX * (float)NativeLib.getScreenPositionX() + this.mainScreenView.defaultViewPanOffsetX);
|
||||||
viewFlowLayout.leftMargin = this.mainScreenView.getWidth() - (int)(viewScaleFactorX * (this.mainScreenView.virtualSizeWidth - NativeLib.getScreenPositionX()));
|
viewFlowLayout.topMargin = (int)(this.mainScreenView.defaultViewScaleFactorY * (float)NativeLib.getScreenPositionY() + this.mainScreenView.defaultViewPanOffsetY);
|
||||||
if(viewPanOffsetY >= 0)
|
|
||||||
viewFlowLayout.topMargin = (int)(viewScaleFactorY * NativeLib.getScreenPositionY() + viewPanOffsetY);
|
int tolerance = 80; // In case of miscalculation
|
||||||
else
|
if (viewFlowLayout.leftMargin + viewLCDWidth < tolerance)
|
||||||
viewFlowLayout.topMargin = (int)(viewScaleFactorY * NativeLib.getScreenPositionY());
|
|
||||||
int tolerance = 80;
|
|
||||||
if (viewFlowLayout.leftMargin + finalViewWidth < tolerance)
|
|
||||||
viewFlowLayout.leftMargin = 0;
|
viewFlowLayout.leftMargin = 0;
|
||||||
if (viewFlowLayout.leftMargin + tolerance > this.mainScreenView.getWidth())
|
if (viewFlowLayout.leftMargin + tolerance > this.mainScreenView.getWidth())
|
||||||
viewFlowLayout.leftMargin = this.mainScreenView.getWidth() - finalViewWidth;
|
viewFlowLayout.leftMargin = this.mainScreenView.getWidth() - viewLCDWidth;
|
||||||
if (viewFlowLayout.topMargin + finalViewHeight < tolerance)
|
if (viewFlowLayout.topMargin + viewLCDHeight < tolerance)
|
||||||
viewFlowLayout.topMargin = 0;
|
viewFlowLayout.topMargin = 0;
|
||||||
if (viewFlowLayout.topMargin + tolerance > this.mainScreenView.getHeight())
|
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
|
if(debug) Log.d(TAG, "updateLayout() leftMargin: " + viewFlowLayout.leftMargin + ", topMargin: " + viewFlowLayout.topMargin
|
||||||
+ ", width: " + viewFlowLayout.width + ", height: " + viewFlowLayout.height);
|
+ ", width: " + viewFlowLayout.width + ", height: " + viewFlowLayout.height);
|
||||||
setLayoutParams(viewFlowLayout);
|
setLayoutParams(viewFlowLayout);
|
||||||
|
@ -299,39 +302,37 @@ public class LCDOverlappingView extends View {
|
||||||
} else if(this.overlappingLCDMode == OVERLAPPING_LCD_MODE_MANUAL) {
|
} else if(this.overlappingLCDMode == OVERLAPPING_LCD_MODE_MANUAL) {
|
||||||
if(firstTime) {
|
if(firstTime) {
|
||||||
firstTime = false;
|
firstTime = false;
|
||||||
float scale = sharedPreferences.getFloat("settings_lcd_overlapping_scale", 1.0f);
|
|
||||||
if (scale < 0.01f)
|
|
||||||
scale = 0.01f;
|
|
||||||
int viewWidth = (int) (lcdWidth * scale);
|
|
||||||
int viewHeight = (int) (lcdHeight * scale);
|
|
||||||
if (viewWidth < minViewSize && viewHeight < minViewSize) {
|
|
||||||
if (bitmapRatio > 0.0f) {
|
|
||||||
if (bitmapRatio < 1.0f) {
|
|
||||||
viewWidth = (int) minViewSize;
|
|
||||||
viewHeight = (int) (viewWidth * bitmapRatio);
|
|
||||||
} else {
|
|
||||||
viewHeight = (int) minViewSize;
|
|
||||||
viewWidth = (int) (viewHeight / bitmapRatio);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
viewWidth = (int) minViewSize;
|
|
||||||
viewHeight = (int) minViewSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int finalViewWidth = viewWidth;
|
|
||||||
int finalViewHeight = viewHeight;
|
|
||||||
post(() -> {
|
post(() -> {
|
||||||
FrameLayout.LayoutParams viewFlowLayout = new FrameLayout.LayoutParams(finalViewWidth, finalViewHeight);
|
float scale = sharedPreferences.getFloat("settings_lcd_overlapping_scale", 1.0f);
|
||||||
|
if (scale < 0.01f)
|
||||||
|
scale = 0.01f;
|
||||||
|
int viewWidth = (int) (lcdWidth * scale);
|
||||||
|
int viewHeight = (int) (lcdHeight * scale);
|
||||||
|
if (viewWidth < minViewSize && viewHeight < minViewSize) {
|
||||||
|
if (bitmapRatio > 0.0f) {
|
||||||
|
if (bitmapRatio < 1.0f) {
|
||||||
|
viewWidth = (int) minViewSize;
|
||||||
|
viewHeight = (int) (viewWidth * bitmapRatio);
|
||||||
|
} else {
|
||||||
|
viewHeight = (int) minViewSize;
|
||||||
|
viewWidth = (int) (viewHeight / bitmapRatio);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
viewWidth = (int) minViewSize;
|
||||||
|
viewHeight = (int) minViewSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FrameLayout.LayoutParams viewFlowLayout = new FrameLayout.LayoutParams(viewWidth, viewHeight);
|
||||||
viewFlowLayout.leftMargin = sharedPreferences.getInt("settings_lcd_overlapping_x", 20);
|
viewFlowLayout.leftMargin = sharedPreferences.getInt("settings_lcd_overlapping_x", 20);
|
||||||
viewFlowLayout.topMargin = sharedPreferences.getInt("settings_lcd_overlapping_y", 80);
|
viewFlowLayout.topMargin = sharedPreferences.getInt("settings_lcd_overlapping_y", 80);
|
||||||
int tolerance = 80;
|
int tolerance = 80;
|
||||||
if (viewFlowLayout.leftMargin + finalViewWidth < tolerance)
|
if (viewFlowLayout.leftMargin + viewWidth < tolerance)
|
||||||
viewFlowLayout.leftMargin = tolerance - finalViewWidth;
|
viewFlowLayout.leftMargin = tolerance - viewWidth;
|
||||||
if (viewFlowLayout.leftMargin + tolerance > this.mainScreenView.getWidth())
|
if (viewFlowLayout.leftMargin + tolerance > this.mainScreenView.getWidth())
|
||||||
viewFlowLayout.leftMargin = this.mainScreenView.getWidth() - tolerance;
|
viewFlowLayout.leftMargin = this.mainScreenView.getWidth() - tolerance;
|
||||||
if (viewFlowLayout.topMargin + finalViewHeight < tolerance)
|
if (viewFlowLayout.topMargin + viewHeight < tolerance)
|
||||||
viewFlowLayout.topMargin = tolerance - finalViewHeight;
|
viewFlowLayout.topMargin = tolerance - viewHeight;
|
||||||
if (viewFlowLayout.topMargin + tolerance > this.mainScreenView.getHeight())
|
if (viewFlowLayout.topMargin + tolerance > this.mainScreenView.getHeight())
|
||||||
viewFlowLayout.topMargin = this.mainScreenView.getHeight() - tolerance;
|
viewFlowLayout.topMargin = this.mainScreenView.getHeight() - tolerance;
|
||||||
if(debug) Log.d(TAG, "updateLayout() leftMargin: " + viewFlowLayout.leftMargin + ", topMargin: " + viewFlowLayout.topMargin
|
if(debug) Log.d(TAG, "updateLayout() leftMargin: " + viewFlowLayout.leftMargin + ", topMargin: " + viewFlowLayout.topMargin
|
||||||
|
|
|
@ -50,6 +50,12 @@ public class MainScreenView extends PanAndScaleView {
|
||||||
private boolean autoRotation = false;
|
private boolean autoRotation = false;
|
||||||
private boolean autoZoom = 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) {
|
public MainScreenView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
|
@ -294,6 +300,12 @@ public class MainScreenView extends PanAndScaleView {
|
||||||
viewPanOffsetY = translateY;
|
viewPanOffsetY = translateY;
|
||||||
|
|
||||||
constrainPan();
|
constrainPan();
|
||||||
|
|
||||||
|
defaultViewScaleFactorX = viewScaleFactorX;
|
||||||
|
defaultViewScaleFactorY = viewScaleFactorY;
|
||||||
|
defaultViewPanOffsetX = viewPanOffsetX;
|
||||||
|
defaultViewPanOffsetY = viewPanOffsetY;
|
||||||
|
|
||||||
if(this.onUpdateLayoutListener != null)
|
if(this.onUpdateLayoutListener != null)
|
||||||
this.onUpdateLayoutListener.run();
|
this.onUpdateLayoutListener.run();
|
||||||
return;
|
return;
|
||||||
|
@ -304,6 +316,11 @@ public class MainScreenView extends PanAndScaleView {
|
||||||
// Else, the screens orientations are the same, so we set the calculator in fullscreen
|
// Else, the screens orientations are the same, so we set the calculator in fullscreen
|
||||||
resetViewport();
|
resetViewport();
|
||||||
|
|
||||||
|
defaultViewScaleFactorX = viewScaleFactorX;
|
||||||
|
defaultViewScaleFactorY = viewScaleFactorY;
|
||||||
|
defaultViewPanOffsetX = viewPanOffsetX;
|
||||||
|
defaultViewPanOffsetY = viewPanOffsetY;
|
||||||
|
|
||||||
if(this.onUpdateLayoutListener != null)
|
if(this.onUpdateLayoutListener != null)
|
||||||
this.onUpdateLayoutListener.run();
|
this.onUpdateLayoutListener.run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,8 @@
|
||||||
|
|
||||||
<string-array name="settings_lcd_overlapping_mode_item">
|
<string-array name="settings_lcd_overlapping_mode_item">
|
||||||
<item>No Overlapping LCD</item>
|
<item>No Overlapping LCD</item>
|
||||||
<item>Auto</item>
|
<item>Auto (Double touch)</item>
|
||||||
<item>Manual</item>
|
<item>Manual (Zoom or pan)</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="settings_lcd_overlapping_mode_value">
|
<string-array name="settings_lcd_overlapping_mode_value">
|
||||||
<item>0</item>
|
<item>0</item>
|
||||||
|
|
Loading…
Reference in a new issue