- Cleanup code.

- Auto-scroll down the textual printer.
- Fix the printer icon in the Eric's script "real49gp-lc.kml" and "real50g-lc.kml".
- Improve the swipe gesture.
This commit is contained in:
dgis 2019-07-07 17:15:14 +02:00
parent 90d2cb40b9
commit 26425625dd
17 changed files with 923 additions and 942 deletions

View file

@ -66,6 +66,8 @@ Version 1.5 (2019-06-xx)
- Prevent the ESC key from leaving the application (Github Fix: #6).
- Map the keyboard DELETE key like it should (Github Fix: #6).
- Map the +, -, * and / keys catching the typed character instead of the virtual key (Github Fix: #6).
- Fix the printer icon in the Eric's script "real49gp-lc.kml" and "real50g-lc.kml".
- Improve the swipe gesture.
Version 1.4 (2019-06-08)
@ -146,12 +148,20 @@ Note: some included files are not covered by the GPL; these include ROM image fi
The Eric's Real scripts ("real*.kml" and "real*.bmp/png") are embedded in this application with the kind permission of Eric Rechlin.
DONE
- Cleanup code.
- Auto-scroll down the textual printer.
- Fix the printer icon in the Eric's script "real49gp-lc.kml" and "real50g-lc.kml".
- Improve the swipe gesture.
TODO
- With HP49, On+D does not work even with version 2.10 (2.15 should not work)!
- In Chrome OS:
- The timezone seems to be GMT (localtime_r not right?)!
- sometimes there is no OK button in the KML Script Compilation Result.
- Improve the swipe gesture.
- The clock seems unsynchronized sometimes.
- Add KML script loading dependencies fallback to the inner ROM (and may be KML include?).
- Add a separation between the pixels (Suggestion from Jaime Meza).

View file

@ -1 +0,0 @@
This folder contains several files usefull for emu48 mor the mac. It contains kml, kmi, bitmaps, rom files for 48SX, 48GX, 49G, 38G, 39G, 40G The roms are copyrighted Hewlett-Packard Other files are property of their respective authors.

View file

@ -83,37 +83,37 @@ End
Annunciator 1
Size 24 18
Offset 84 2
Offset 40 2
Down 443 927
End
Annunciator 2
Size 24 18
Offset 147 2
Offset 103 2
Down 467 927
End
Annunciator 3
Size 24 18
Offset 220 2
Offset 176 2
Down 491 927
End
Annunciator 4
Size 24 18
Offset 290 2
Offset 246 2
Down 515 927
End
Annunciator 5
Size 24 18
Offset 355 2
Offset 311 2
Down 539 927
End
Annunciator 6
Size 24 18
Offset 424 2
Offset 380 2
Down 564 927
End

View file

@ -115,7 +115,7 @@ End
Annunciator 6
Size 24 17
Offset 377 3
Down 457 923
Down 557 923
End
Button 11

View file

@ -932,8 +932,6 @@ JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onViewScript(JNIEn
ResetDocument(); // close document
SetWindowTitle(NULL);
}
// mainViewResizeCallback(nBackgroundW, nBackgroundH);
//draw(); //TODO CRASH
return result;
}

View file

@ -575,24 +575,11 @@ typedef struct _HANDLE * HANDLE;
typedef HANDLE HMENU;
typedef HANDLE HINSTANCE;
//typedef HANDLE HWND;
typedef HANDLE HCURSOR;
typedef HANDLE HLOCAL; //TODO
typedef struct _OVERLAPPED {
/*
ULONG_PTR Internal;
ULONG_PTR InternalHigh;
union {
struct {
DWORD Offset;
DWORD OffsetHigh;
} DUMMYSTRUCTNAME;
PVOID Pointer;
} DUMMYUNIONNAME;
*/
HANDLE hEvent;
} OVERLAPPED, *LPOVERLAPPED;

View file

@ -14,6 +14,7 @@
package org.emulator.calculator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.pm.ActivityInfo;
@ -23,6 +24,7 @@ import android.graphics.Color;
import android.graphics.Paint;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.SparseIntArray;
import android.view.KeyEvent;
import android.view.MotionEvent;
@ -37,7 +39,7 @@ public class MainScreenView extends PanAndScaleView {
private Paint paint = new Paint();
private Bitmap bitmapMainScreen;
private HashMap<Integer, Integer> vkmap;
private SparseIntArray vkmap;
private HashMap<Character, Integer> charmap;
private int kmlBackgroundColor = Color.BLACK;
private boolean useKmlBackgroundColor = false;
@ -69,7 +71,7 @@ public class MainScreenView extends PanAndScaleView {
charmap.put('*', 0x6A); // VK_MULTIPLY
charmap.put('/', 0x6F); // VK_DIVIDE
vkmap = new HashMap<>();
vkmap = new SparseIntArray();
//vkmap.put(KeyEvent.KEYCODE_BACK, 0x08); // VK_BACK
vkmap.put(KeyEvent.KEYCODE_TAB, 0x09); // VK_TAB
vkmap.put(KeyEvent.KEYCODE_ENTER, 0x0D); // VK_RETURN
@ -87,16 +89,6 @@ public class MainScreenView extends PanAndScaleView {
vkmap.put(KeyEvent.KEYCODE_DPAD_UP, 0x26); // VK_UP
vkmap.put(KeyEvent.KEYCODE_DPAD_RIGHT, 0x27); // VK_RIGHT
vkmap.put(KeyEvent.KEYCODE_DPAD_DOWN, 0x28); // VK_DOWN
// vkmap.put(KeyEvent.KEYCODE_0, 0x30); // 0
// vkmap.put(KeyEvent.KEYCODE_1, 0x31); // 1
// vkmap.put(KeyEvent.KEYCODE_2, 0x32); // 2
// vkmap.put(KeyEvent.KEYCODE_3, 0x33); // 3
// vkmap.put(KeyEvent.KEYCODE_4, 0x34); // 4
// vkmap.put(KeyEvent.KEYCODE_5, 0x35); // 5
// vkmap.put(KeyEvent.KEYCODE_6, 0x36); // 6
// vkmap.put(KeyEvent.KEYCODE_7, 0x37); // 7
// vkmap.put(KeyEvent.KEYCODE_8, 0x38); // 8
// vkmap.put(KeyEvent.KEYCODE_9, 0x39); // 9
vkmap.put(KeyEvent.KEYCODE_A, 0x41); // A
vkmap.put(KeyEvent.KEYCODE_B, 0x42); // B
vkmap.put(KeyEvent.KEYCODE_C, 0x43); // C
@ -165,39 +157,17 @@ public class MainScreenView extends PanAndScaleView {
// This call is necessary, or else the
// draw method will not be called.
setWillNotDraw(false);
// scroller.setFriction(0.00001f); // ViewConfiguration.getScrollFriction(); // ViewConfiguration.SCROLL_FRICTION = 0.015f;
// setOnTapDownListener(new OnTapListener() {
// @Override
// public boolean onTap(View v, float x, float y) {
// if(NativeLib.buttonDown((int)x, (int)y)) {
// if(debug) Log.d(TAG, "onTapDown() true");
// return true;
// }
// if(debug) Log.d(TAG, "onTapDown() false");
// return false;
// }
// });
// setOnTapUpListener(new OnTapListener() {
// @Override
// public boolean onTap(View v, float x, float y) {
// if(debug) Log.d(TAG, "onTapUp()");
// NativeLib.buttonUp((int)x, (int)y);
// return false;
// }
// });
}
protected Set<Integer> currentButtonTouched = new HashSet<Integer>();
// Prevent accidental scroll when taping a calc button
protected Set<Integer> currentButtonTouched = new HashSet<>();
@SuppressLint("ClickableViewAccessibility")
public boolean onTouchEvent(MotionEvent event) {
int actionIndex = event.getActionIndex();
int action = event.getActionMasked();
switch (action) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_POINTER_DOWN:
//Log.d(TAG, "ACTION_DOWN/ACTION_POINTER_DOWN count: " + touchCount + ", actionIndex: " + actionIndex);
//NativeLib.buttonDown((int)((event.getX(actionIndex) - screenOffsetX) / screenScaleX), (int)((event.getY(actionIndex) - screenOffsetY) / screenScaleY));
currentButtonTouched.remove(actionIndex);
if(actionIndex == 0 && event.getPointerCount() == 1)
currentButtonTouched.clear();
@ -205,8 +175,6 @@ public class MainScreenView extends PanAndScaleView {
(int) ((event.getY(actionIndex) - viewPanOffsetY) / viewScaleFactorY))) {
currentButtonTouched.add(actionIndex);
preventToScroll = true;
// if (debug) Log.d(TAG, "onTouchEvent() ACTION_DOWN true, actionIndex: " + actionIndex + ", currentButtonTouched: " + currentButtonTouched.size());
// return true;
}
if (debug) Log.d(TAG, "onTouchEvent() ACTION_DOWN false, actionIndex: " + actionIndex
+ ", currentButtonTouched: " + currentButtonTouched.size()
@ -214,8 +182,6 @@ public class MainScreenView extends PanAndScaleView {
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_POINTER_UP:
//Log.d(TAG, "ACTION_UP/ACTION_POINTER_UP count: " + touchCount + ", actionIndex: " + actionIndex);
//NativeLib.buttonUp((int)((event.getX(actionIndex) - screenOffsetX) / screenScaleX), (int)((event.getY(actionIndex) - screenOffsetY) / screenScaleY));
NativeLib.buttonUp((int) ((event.getX(actionIndex) - viewPanOffsetX) / viewScaleFactorX), (int) ((event.getY(actionIndex) - viewPanOffsetY) / viewScaleFactorY));
currentButtonTouched.remove(actionIndex);
preventToScroll = currentButtonTouched.size() > 0;
@ -236,14 +202,13 @@ public class MainScreenView extends PanAndScaleView {
public boolean onKeyDown(int keyCode, KeyEvent event) {
if((event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) == 0) {
char pressedKey = (char) event.getUnicodeChar();
//Log.d(TAG, "onKeyDown is: " + pressedKey);
if(debug) Log.d(TAG, "onKeyDown is: " + pressedKey);
Integer windowsKeycode = charmap.get(pressedKey);
if(windowsKeycode == null)
windowsKeycode = vkmap.get(keyCode);
if (windowsKeycode != null)
if (windowsKeycode != 0)
NativeLib.keyDown(windowsKeycode);
else
Log.e(TAG, String.format("Unknown keyCode: %d", keyCode));
else if(debug) Log.e(TAG, String.format("Unknown keyCode: %d", keyCode));
}
if(keyCode == KeyEvent.KEYCODE_BACK)
return true;
@ -254,14 +219,13 @@ public class MainScreenView extends PanAndScaleView {
public boolean onKeyUp(int keyCode, KeyEvent event) {
if((event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) == 0) {
char pressedKey = (char) event.getUnicodeChar();
//Log.d(TAG, "onKeyUp is: " + pressedKey);
if(debug) Log.d(TAG, "onKeyUp is: " + pressedKey);
Integer windowsKeycode = charmap.get(pressedKey);
if(windowsKeycode == null)
windowsKeycode = vkmap.get(keyCode);
if (windowsKeycode != null)
if (windowsKeycode != 0)
NativeLib.keyUp(windowsKeycode);
else
Log.e(TAG, String.format("Unknown keyCode: %d", keyCode));
else if(debug) Log.e(TAG, String.format("Unknown keyCode: %d", keyCode));
}
if(keyCode == KeyEvent.KEYCODE_BACK)
return true;
@ -270,8 +234,6 @@ public class MainScreenView extends PanAndScaleView {
@Override
protected void onSizeChanged(int viewWidth, int viewHeight, int oldViewWidth, int oldViewHeight) {
// super.onSizeChanged(viewWidth, viewHeight, oldViewWidth, oldViewHeight);
viewSizeWidth = viewWidth;
viewSizeHeight = viewHeight;
@ -325,8 +287,6 @@ public class MainScreenView extends PanAndScaleView {
constrainPan();
return;
}
} else {
//((Activity) getContext()).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}
}
}
@ -350,7 +310,8 @@ public class MainScreenView extends PanAndScaleView {
final int CALLBACK_TYPE_INVALIDATE = 0;
final int CALLBACK_TYPE_WINDOW_RESIZE = 1;
int updateCallback(int type, int param1, int param2, String param3, String param4) {
@SuppressWarnings("unused")
public int updateCallback(int type, int param1, int param2, String param3, String param4) {
switch (type) {
case CALLBACK_TYPE_INVALIDATE:
//Log.d(TAG, "PAINT updateCallback() postInvalidate()");

View file

@ -14,6 +14,7 @@
package org.emulator.calculator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
@ -85,7 +86,13 @@ public class PanAndScaleView extends View {
protected boolean firstTime = false;
protected boolean viewHasChanged() {
if(viewPanOffsetX != previousViewPanOffsetX || viewPanOffsetY != previousViewPanOffsetY || viewScaleFactorX != previousViewScaleFactorX || viewScaleFactorY != previousViewScaleFactorY) {
if((int)viewPanOffsetX != (int)previousViewPanOffsetX || (int)viewPanOffsetY != (int)previousViewPanOffsetY
|| (int)viewScaleFactorX != (int)previousViewScaleFactorX || (int)viewScaleFactorY != (int)previousViewScaleFactorY) {
if(debug) Log.d(TAG, "viewHasChanged() previousViewPanOffsetX: " + previousViewPanOffsetX + ", viewPanOffsetX: " + viewPanOffsetX
+ ", previousViewPanOffsetY: " + previousViewPanOffsetY + ", viewPanOffsetY: " + viewPanOffsetY
+ ", previousViewScaleFactorX: " + previousViewScaleFactorX + ", previousViewScaleFactorY: " + previousViewScaleFactorY
+ ", previousViewScaleFactorY: " + previousViewScaleFactorY + ", viewScaleFactorY: " + viewScaleFactorY);
previousViewPanOffsetX = viewPanOffsetX;
previousViewPanOffsetY = viewPanOffsetY;
previousViewScaleFactorX = viewScaleFactorX;
@ -126,6 +133,7 @@ public class PanAndScaleView extends View {
* Register a callback to be invoked when this view is tapped down.
* @param onTapDownListener The callback that will run
*/
@SuppressWarnings("unused")
public void setOnTapDownListener(OnTapListener onTapDownListener) {
this.onTapDownListener = onTapDownListener;
}
@ -134,30 +142,37 @@ public class PanAndScaleView extends View {
* Register a callback to be invoked when this view is tapped up.
* @param onTapUpListener The callback that will run
*/
@SuppressWarnings("unused")
public void setOnTapUpListener(OnTapListener onTapUpListener) {
this.onTapUpListener = onTapUpListener;
}
@SuppressWarnings("unused")
public float getMaxZoom() {
return maxZoom;
}
@SuppressWarnings("unused")
public void setMaxZoom(float maxZoom) {
this.maxZoom = maxZoom;
}
@SuppressWarnings("unused")
public boolean getShowCursor() {
return showCursor;
}
@SuppressWarnings("unused")
public void setShowCursor(boolean showCursor) {
this.showCursor = showCursor;
}
@SuppressWarnings("unused")
public PointF getCursorLocation() {
return cursorLocation;
}
@SuppressWarnings("unused")
public void setCursorLocation(float x, float y) {
cursorLocation.set(x, y);
}
@ -165,6 +180,7 @@ public class PanAndScaleView extends View {
/**
* @return true to show a small scale thumbnail in the bottom right; false otherwise.
*/
@SuppressWarnings("unused")
public boolean getShowScaleThumbnail() {
return showScaleThumbnail;
}
@ -172,6 +188,7 @@ public class PanAndScaleView extends View {
/**
* @param showScaleThumbnail true to show a small scale thumbnail in the bottom right; false otherwise.
*/
@SuppressWarnings("unused")
public void setShowScaleThumbnail(boolean showScaleThumbnail) {
this.showScaleThumbnail = showScaleThumbnail;
}
@ -179,6 +196,7 @@ public class PanAndScaleView extends View {
/**
* @return true to allow to zoom when double tapping; false otherwise.
*/
@SuppressWarnings("unused")
public boolean getAllowDoubleTapZoom() {
return allowDoubleTapZoom;
}
@ -186,6 +204,7 @@ public class PanAndScaleView extends View {
/**
* @param allowDoubleTapZoom true to allow to zoom when double tapping; false otherwise.
*/
@SuppressWarnings("unused")
public void setAllowDoubleTapZoom(boolean allowDoubleTapZoom) {
this.allowDoubleTapZoom = allowDoubleTapZoom;
}
@ -194,6 +213,7 @@ public class PanAndScaleView extends View {
/**
* @return true to allow the virtual space to fill view bounds the ; false otherwise.
*/
@SuppressWarnings("unused")
public boolean getFillBounds() {
return fillBounds;
}
@ -201,6 +221,7 @@ public class PanAndScaleView extends View {
/**
* @param fillBounds true to allow the virtual space to fill the view bounds; false otherwise.
*/
@SuppressWarnings("unused")
public void setFillBounds(boolean fillBounds) {
this.fillBounds = fillBounds;
}
@ -208,6 +229,7 @@ public class PanAndScaleView extends View {
/**
* @return true to allow to pan and scale; false otherwise.
*/
@SuppressWarnings("unused")
public boolean getEnablePanAndScale() {
return enablePanAndScale;
}
@ -276,7 +298,7 @@ public class PanAndScaleView extends View {
@Override
public boolean onDown(MotionEvent e) {
if(debug) Log.d(TAG, "onDown() actionIndex: " + e.getActionIndex());
if(debug) Log.d(TAG, "onDown() actionIndex: " + e.getActionIndex() + ", X: " + e.getX() + ", Y: " + e.getY());
scroller.forceFinished(true);
ViewCompat.postInvalidateOnAnimation(PanAndScaleView.this);
if(onTapDownListener != null) {
@ -288,14 +310,9 @@ public class PanAndScaleView extends View {
return super.onDown(e);
}
// @Override
// public void onShowPress(MotionEvent e) {
// super.onShowPress(e);
// }
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
if(debug) Log.d(TAG, "onSingleTapConfirmed() actionIndex: " + e.getActionIndex());
if(debug) Log.d(TAG, "onSingleTapConfirmed() actionIndex: " + e.getActionIndex() + ", X: " + e.getX() + ", Y: " + e.getY());
if(onTapUpListener != null) {
float scaleAndPanX = (e.getX() - viewPanOffsetX) / viewScaleFactorX;
float scaleAndPanY = (e.getY() - viewPanOffsetY) / viewScaleFactorY;
@ -308,7 +325,7 @@ public class PanAndScaleView extends View {
@Override
public boolean onDoubleTap(MotionEvent e) {
if(debug) Log.d(TAG, "onDoubleTap() actionIndex: " + e.getActionIndex());
if(debug) Log.d(TAG, "onDoubleTap() actionIndex: " + e.getActionIndex() + ", X: " + e.getX() + ", Y: " + e.getY());
if(!allowDoubleTapZoom || fillBounds)
return false;
float scaleFactorPreviousX = viewScaleFactorX;
@ -328,7 +345,11 @@ public class PanAndScaleView extends View {
@Override
public boolean onScroll(MotionEvent downEvent, MotionEvent moveEvent, float distanceX, float distanceY) {
if(debug) Log.d(TAG, "onScroll() downEvent.actionIndex: " + (downEvent != null ? downEvent.getActionIndex() : "null") + ", moveEvent.actionIndex: " + (downEvent != null ? moveEvent.getActionIndex() : "null"));
if(debug)
Log.d(TAG, "onScroll() downEvent.actionIndex: " + (downEvent != null ? downEvent.getActionIndex() : "null")
+ ", moveEvent.actionIndex: " + (downEvent != null ? moveEvent.getActionIndex() : "null")
+ ", distanceX: " + distanceX + ", distanceY: " + distanceY
);
if(fillBounds || preventToScroll)
return false;
@ -355,10 +376,10 @@ public class PanAndScaleView extends View {
+ ", minX: " + viewPanMinX + ", maxX: " + 0
+ ", minY: " + viewPanMinY + ", maxY: " + 0
+ ")");
scroller.fling((int) viewPanOffsetX, (int) viewPanOffsetY,
scroller.fling(-(int)viewPanOffsetX, -(int)viewPanOffsetY,
(int)(velocityFactor * velocityX), (int)(velocityFactor * velocityY),
(int)viewPanMinX, 0,
(int)viewPanMinY, 0);
0, -(int)viewPanMinX,
0, -(int)viewPanMinY);
ViewCompat.postInvalidateOnAnimation(PanAndScaleView.this);
return true;
}
@ -367,8 +388,7 @@ public class PanAndScaleView extends View {
this.setFocusable(true);
this.setFocusableInTouchMode(true);
// This call is necessary, or else the
// draw method will not be called.
// This call is necessary, or else the draw method will not be called.
setWillNotDraw(false);
}
@ -412,6 +432,7 @@ public class PanAndScaleView extends View {
invalidate();
}
@SuppressWarnings("unused")
public void postDoScroll(float deltaX, float deltaY, boolean center) {
if(fillBounds)
return;
@ -423,9 +444,11 @@ public class PanAndScaleView extends View {
postInvalidate();
}
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouchEvent(MotionEvent event) {
if(enablePanAndScale) {
// The order of operations is important
boolean result = scaleDetector.onTouchEvent(event);
result = gestureDetector.onTouchEvent(event) || result;
return result || super.onTouchEvent(event);
@ -436,14 +459,12 @@ public class PanAndScaleView extends View {
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
if (enablePanAndScale && !fillBounds && (event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
//if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) {
switch (event.getAction()) {
case MotionEvent.ACTION_SCROLL:
if (event.getAction() == MotionEvent.ACTION_SCROLL) {
float wheelDelta = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
if(wheelDelta > 0f)
scaleByStep(scaleStep, event.getX(), event.getY());
else if(wheelDelta < 0f)
scaleByStep(1.0f / scaleStep, event.getX(), event.getY());
if (wheelDelta > 0f)
scaleByStep(scaleStep, event.getX(), event.getY());
else if (wheelDelta < 0f)
scaleByStep(1.0f / scaleStep, event.getX(), event.getY());
return true;
}
@ -466,12 +487,7 @@ public class PanAndScaleView extends View {
return super.onKeyUp(keyCode, event);
}
/**
* Scale the view step by step following the mouse/touch position
* @param scaleFactor
* @param x
* @param y
*/
// Scale the view step by step following the mouse/touch position
private void scaleByStep(float scaleFactor, float x, float y) {
float scaleFactorPreviousX = viewScaleFactorX;
float scaleFactorPreviousY = viewScaleFactorY;
@ -490,9 +506,6 @@ public class PanAndScaleView extends View {
}
private void scaleWithFocus(float focusX, float focusY, float scaleFactorPreviousX, float scaleFactorPreviousY) {
//float centeredScaleFactor = 1f - viewScaleFactor / scaleFactorPrevious;
//viewPanOffsetX += (focusX - viewPanOffsetX) * centeredScaleFactor;
//viewPanOffsetY += (focusY - viewPanOffsetY) * centeredScaleFactor;
viewPanOffsetX = viewPanOffsetX + (focusX - viewPanOffsetX) - (focusX - viewPanOffsetX) * viewScaleFactorX / scaleFactorPreviousX;
viewPanOffsetY = viewPanOffsetY + (focusY - viewPanOffsetY) - (focusY - viewPanOffsetY) * viewScaleFactorY / scaleFactorPreviousY;
}
@ -616,6 +629,7 @@ public class PanAndScaleView extends View {
@Override
protected void onSizeChanged(int viewWidth, int viewHeight, int oldViewWidth, int oldViewHeight) {
if(debug) Log.d(TAG, "onSizeChanged(viewWidth: " + viewWidth + ", viewHeight: " + viewHeight + ", oldViewWidth: " + oldViewWidth + ", oldViewHeight: " + oldViewHeight + ")");
super.onSizeChanged(viewWidth, viewHeight, oldViewWidth, oldViewHeight);
viewSizeWidth = viewWidth;
@ -674,9 +688,6 @@ public class PanAndScaleView extends View {
viewSizeHeight - marginY
);
canvas.drawRect(rectScaleImage, paint);
// rectBitmapSource.set(0, 0, (int) virtualSizeWidth, (int) virtualSizeHeight);
// if(mBitmap != null)
// canvas.drawBitmap(mBitmap, rectBitmapSource, rectScaleImage, paint);
rectScaleView.set(rectScaleImage.left + scale * (-viewPanOffsetX / viewScaleFactorX),
rectScaleImage.top + scale * (-viewPanOffsetY / viewScaleFactorY),
rectScaleImage.left + scale * (viewSizeWidth - viewPanOffsetX) / viewScaleFactorX,

File diff suppressed because it is too large Load diff

View file

@ -14,7 +14,6 @@
package org.emulator.calculator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
@ -22,7 +21,6 @@ import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Bundle;
@ -33,6 +31,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ScrollView;
import android.widget.TextView;
import androidx.annotation.NonNull;
@ -54,19 +53,11 @@ public class PrinterSimulatorFragment extends AppCompatDialogFragment {
private static final String TAG = "PrinterSimulator";
private boolean debug = false;
private PrinterSimulator printerSimulator;
private Toolbar toolbar;
private TextView textViewPrinterText;
private ScrollView scrollViewPrinterText;
private PrinterGraphView printerGraphView;
// ColorMatrixColorFilter colorFilterAlpha8ToRGB = new ColorMatrixColorFilter(new float[]{
// 0, 0, 0, 1, 0,
// 0, 0, 0, 1, 0,
// 0, 0, 0, 1, 0,
// 0, 0, 0, 0, 255
// });
public PrinterSimulatorFragment() {
}
@Override
@ -92,20 +83,25 @@ public class PrinterSimulatorFragment extends AppCompatDialogFragment {
// getDialog().getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);
// }
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = super.onCreateDialog(savedInstanceState);
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
Window window = dialog.getWindow();
if(window != null)
window.requestFeature(Window.FEATURE_NO_TITLE);
return dialog;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
String title = getString(Utils.resId(this, "string", "dialog_printer_simulator_title"));
if(printerSimulator != null)
title = printerSimulator.getTitle();
getDialog().setTitle(title);
Dialog dialog = getDialog();
if(dialog != null)
dialog.setTitle(title);
// Inflate the layout for this fragment
@ -113,10 +109,8 @@ public class PrinterSimulatorFragment extends AppCompatDialogFragment {
// Toolbar
toolbar = view.findViewById(Utils.resId(this, "id", "my_toolbar"));
Toolbar toolbar = view.findViewById(Utils.resId(this, "id", "my_toolbar"));
toolbar.setTitle(title);
//toolbar.setOverflowIcon(ContextCompat.getDrawable(getActivity(), Utils.resId(this, "drawable", "ic_more_vert_white_24dp")));
//toolbar.setLogo(R.drawable.ic_launcher);
toolbar.setNavigationIcon(Utils.resId(this, "drawable", "ic_keyboard_backspace_white_24dp"));
toolbar.setNavigationOnClickListener(
new View.OnClickListener() {
@ -143,22 +137,24 @@ public class PrinterSimulatorFragment extends AppCompatDialogFragment {
Bitmap croppedPaperBitmap = Bitmap.createBitmap(paperBitmap.getWidth(), printerSimulator.getPaperHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(croppedPaperBitmap);
Paint paint = new Paint();
//paint.setColorFilter(colorFilterAlpha8ToRGB);
canvas.drawBitmap(paperBitmap, 0, 0, paint);
File storagePath = new File(getActivity().getExternalCacheDir(), "");
File imageFile = File.createTempFile(imageFilename, ".png", storagePath);
FileOutputStream fileOutputStream = new FileOutputStream(imageFile);
croppedPaperBitmap.compress(Bitmap.CompressFormat.PNG, 90, fileOutputStream);
fileOutputStream.close();
String mimeType = "application/png";
Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setType(mimeType);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Intent.EXTRA_SUBJECT, Utils.resId(PrinterSimulatorFragment.this, "string", "message_printer_share_graphic"));
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(getActivity(),getActivity().getPackageName() + ".provider", imageFile));
startActivity(Intent.createChooser(intent, getString(Utils.resId(PrinterSimulatorFragment.this, "string", "message_printer_share_graphic"))));
Activity activity = getActivity();
if(activity != null) {
File storagePath = new File(activity.getExternalCacheDir(), "");
File imageFile = File.createTempFile(imageFilename, ".png", storagePath);
FileOutputStream fileOutputStream = new FileOutputStream(imageFile);
croppedPaperBitmap.compress(Bitmap.CompressFormat.PNG, 90, fileOutputStream);
fileOutputStream.close();
String mimeType = "application/png";
Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setType(mimeType);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Intent.EXTRA_SUBJECT, Utils.resId(PrinterSimulatorFragment.this, "string", "message_printer_share_graphic"));
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(getActivity(), getActivity().getPackageName() + ".provider", imageFile));
startActivity(Intent.createChooser(intent, getString(Utils.resId(PrinterSimulatorFragment.this, "string", "message_printer_share_graphic"))));
}
} catch (Exception e) {
e.printStackTrace();
Utils.showAlert(getActivity(), e.getMessage());
@ -182,25 +178,22 @@ public class PrinterSimulatorFragment extends AppCompatDialogFragment {
ViewPager pager = view.findViewById(Utils.resId(this, "id", "viewPagerPrinter"));
pager.setAdapter(new PagerAdapter() {
@SuppressLint("ClickableViewAccessibility")
public Object instantiateItem(ViewGroup container, int position) {
switch (position) {
case 0: {
ViewGroup layoutPagePrinterText = container.findViewById(Utils.resId(PrinterSimulatorFragment.this, "id", "page_printer_text"));
textViewPrinterText = container.findViewById(Utils.resId(PrinterSimulatorFragment.this, "id", "printer_text"));
updatePaper(printerSimulator.getText());
return layoutPagePrinterText;
}
case 1: {
ViewGroup layoutPagePrinterGraphic = container.findViewById(Utils.resId(PrinterSimulatorFragment.this, "id", "page_printer_graphic"));
ViewGroup pagePrinterGraphicContainer = container.findViewById(Utils.resId(PrinterSimulatorFragment.this, "id", "printer_graphic_container"));
printerGraphView = new PrinterGraphView(getActivity());
printerGraphView.setBitmap(printerSimulator.getImage());
pagePrinterGraphicContainer.addView(printerGraphView);
return layoutPagePrinterGraphic;
}
@NonNull
public Object instantiateItem(@NonNull ViewGroup container, int position) {
if (position == 0) {
ViewGroup layoutPagePrinterText = container.findViewById(Utils.resId(PrinterSimulatorFragment.this, "id", "page_printer_text"));
textViewPrinterText = container.findViewById(Utils.resId(PrinterSimulatorFragment.this, "id", "printer_text"));
scrollViewPrinterText = container.findViewById(Utils.resId(PrinterSimulatorFragment.this, "id", "printer_text_scroll"));
updatePaper(printerSimulator.getText());
return layoutPagePrinterText;
} else {
ViewGroup layoutPagePrinterGraphic = container.findViewById(Utils.resId(PrinterSimulatorFragment.this, "id", "page_printer_graphic"));
ViewGroup pagePrinterGraphicContainer = container.findViewById(Utils.resId(PrinterSimulatorFragment.this, "id", "printer_graphic_container"));
printerGraphView = new PrinterGraphView(getActivity());
printerGraphView.setBitmap(printerSimulator.getImage());
pagePrinterGraphicContainer.addView(printerGraphView);
return layoutPagePrinterGraphic;
}
return null;
}
@Override
@ -234,6 +227,7 @@ public class PrinterSimulatorFragment extends AppCompatDialogFragment {
if(debug) Log.d(TAG, "updatePaper(" + textAppended + ")");
if(textViewPrinterText != null) {
textViewPrinterText.append(textAppended);
scrollViewPrinterText.fullScroll(View.FOCUS_DOWN);
}
if(printerGraphView != null) {
printerGraphView.updatePaperLayout();
@ -370,8 +364,7 @@ public class PrinterSimulatorFragment extends AppCompatDialogFragment {
@Override
protected void onCustomDraw(Canvas canvas) {
//paintBitmap.setColorFilter(colorFilterAlpha8ToRGB);
canvas.drawColor(Color.BLACK); // LTGRAY);
canvas.drawColor(Color.BLACK);
Rect paperclip = new Rect(0, 0, bitmap.getWidth(), printerSimulator.getPaperHeight());
canvas.drawBitmap(this.bitmap, paperclip, paperclip, paintBitmap);
}

View file

@ -37,7 +37,7 @@ public class Utils {
toast.show();
}
public static int resId(Context context, String resourcename, String variableName)
static int resId(Context context, String resourcename, String variableName)
{
try {
return context.getResources().getIdentifier(variableName, resourcename, context.getApplicationContext().getPackageName());
@ -47,14 +47,16 @@ public class Utils {
}
}
public static int resId(Fragment context, String resourcename, String variableName)
static int resId(Fragment fragment, String resourcename, String variableName)
{
try {
return context.getResources().getIdentifier(variableName, resourcename, context.getContext().getApplicationContext().getPackageName());
Context context = fragment.getContext();
if(context != null)
return fragment.getResources().getIdentifier(variableName, resourcename, context.getApplicationContext().getPackageName());
} catch (Exception e) {
e.printStackTrace();
return -1;
}
return -1;
}
public static String getFileName(Context context, String url) {
@ -92,7 +94,7 @@ public class Utils {
}
// https://community.khronos.org/t/get-maximum-texture-size/67795
public static int getMaximumTextureSize() {
static int getMaximumTextureSize() {
EGL10 egl = (EGL10) EGLContext.getEGL();
EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
@ -128,7 +130,7 @@ public class Utils {
// Release
egl.eglTerminate(display);
Log.i("GLHelper", "Maximum GL texture size: " + Integer.toString(maximumTextureSize));
Log.i("GLHelper", "Maximum GL texture size: " + maximumTextureSize);
return maximumTextureSize;
}

View file

@ -14,6 +14,7 @@
package org.emulator.calculator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
@ -26,6 +27,7 @@ public class ViewPagerNoSwipe extends ViewPager {
super(context, attrs);
}
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouchEvent(MotionEvent event) {
return false;

View file

@ -30,6 +30,7 @@ import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.preference.PreferenceManager;
import android.util.Log;
import android.util.SparseArray;
import android.view.HapticFeedbackConstants;
import android.view.Menu;
import android.view.MenuItem;
@ -40,6 +41,7 @@ import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AlertDialog;
@ -334,9 +336,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
}
@Override
public boolean onNavigationItemSelected(MenuItem item) {
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
// Handle navigation view item clicks here.
int id = item != null ? item.getItemId() : -1;
int id = item.getItemId();
if (id == R.id.nav_new) {
OnFileNew();
} else if (id == R.id.nav_open) {
@ -544,40 +546,42 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
if(documentFile != null) {
Uri fileUri = documentFile.getUri();
InputStream inputStream = getContentResolver().openInputStream(fileUri);
reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
// do reading, usually loop until end of file reading
String mLine;
boolean inGlobal = false;
String title = null;
String model = null;
while ((mLine = reader.readLine()) != null) {
//process line
if (mLine.indexOf("Global") == 0) {
inGlobal = true;
title = null;
model = null;
continue;
}
if (inGlobal) {
if (mLine.indexOf("End") == 0) {
KMLScriptItem newKMLScriptItem = new KMLScriptItem();
newKMLScriptItem.filename = kmlFolderUseDefault ? calculatorFilename : "document:" + kmlFolderURL + "|" + calculatorFilename;
newKMLScriptItem.title = title;
newKMLScriptItem.model = model;
kmlScripts.add(newKMLScriptItem);
break;
}
m = patternGlobalTitle.matcher(mLine);
if (m.find()) {
title = m.group(1);
}
m = patternGlobalModel.matcher(mLine);
if (m.find()) {
model = m.group(1);
}
}
}
if(inputStream != null) {
reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
// do reading, usually loop until end of file reading
String mLine;
boolean inGlobal = false;
String title = null;
String model = null;
while ((mLine = reader.readLine()) != null) {
//process line
if (mLine.indexOf("Global") == 0) {
inGlobal = true;
title = null;
model = null;
continue;
}
if (inGlobal) {
if (mLine.indexOf("End") == 0) {
KMLScriptItem newKMLScriptItem = new KMLScriptItem();
newKMLScriptItem.filename = kmlFolderUseDefault ? calculatorFilename : "document:" + kmlFolderURL + "|" + calculatorFilename;
newKMLScriptItem.title = title;
newKMLScriptItem.model = model;
kmlScripts.add(newKMLScriptItem);
break;
}
m = patternGlobalTitle.matcher(mLine);
if (m.find()) {
title = m.group(1);
}
m = patternGlobalModel.matcher(mLine);
if (m.find()) {
model = m.group(1);
}
}
}
}
}
} catch (IOException e) {
//log the exception
@ -624,7 +628,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
if (continueCallback != null)
continueCallback.run();
} else {
//TODO SaveAs...
fileSaveAsCallback = continueCallback;
OnFileSaveAs();
}
@ -1257,7 +1260,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
final int GENERIC_READ = 1;
final int GENERIC_WRITE = 2;
Map<Integer, ParcelFileDescriptor> parcelFileDescriptorPerFd = null;
SparseArray<ParcelFileDescriptor> parcelFileDescriptorPerFd = null;
public int openFileFromContentResolver(String fileURL, int writeAccess) {
//https://stackoverflow.com/a/31677287
Uri uri = Uri.parse(fileURL);
@ -1278,11 +1281,13 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
}
int fd = filePfd != null ? filePfd.getFd() : 0;
if(parcelFileDescriptorPerFd == null) {
parcelFileDescriptorPerFd = new HashMap<>();
parcelFileDescriptorPerFd = new SparseArray<>();
}
parcelFileDescriptorPerFd.put(fd, filePfd);
return fd;
}
@SuppressWarnings("unused")
public int openFileInFolderFromContentResolver(String filename, String folderURL, int writeAccess) {
Uri folderURI = Uri.parse(folderURL);
DocumentFile folderDocumentFile = DocumentFile.fromTreeUri(this, folderURI);
@ -1298,6 +1303,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
}
return -1;
}
@SuppressWarnings("unused")
public int closeFileFromContentResolver(int fd) {
if(parcelFileDescriptorPerFd != null) {
ParcelFileDescriptor filePfd = parcelFileDescriptorPerFd.get(fd);
@ -1318,6 +1325,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
Utils.showAlert(this, text);
}
@SuppressWarnings("unused")
public void sendMenuItemCommand(int menuItem) {
switch (menuItem) {
case 1: // FILE_NEW
@ -1396,6 +1404,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
}
}
@SuppressWarnings("unused")
public String getFirstKMLFilenameForType(char chipsetType) {
extractKMLScripts();
@ -1422,6 +1431,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
return null;
}
@SuppressWarnings("unused")
public void clipboardCopyText(String text) {
// Gets a handle to the clipboard service.
ClipboardManager clipboard = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);
@ -1431,6 +1441,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
clipboard.setPrimaryClip(clip);
}
}
@SuppressWarnings("unused")
public String clipboardPasteText() {
ClipboardManager clipboard = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);
if (clipboard != null && clipboard.hasPrimaryClip()) {
@ -1446,11 +1457,13 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
return "";
}
@SuppressWarnings("unused")
public void performHapticFeedback() {
if(sharedPreferences.getBoolean("settings_haptic_feedback", true))
mainScreenView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
@SuppressWarnings("unused")
public void sendByteUdp(int byteSent) {
printerSimulator.write(byteSent);
}
@ -1487,9 +1500,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
case "settings_rotation":
int rotationMode = 0;
try {
String rotationModeValue = sharedPreferences.getString("settings_rotation", "0");
if(rotationModeValue != null)
rotationMode = Integer.parseInt(rotationModeValue);
rotationMode = Integer.parseInt(sharedPreferences.getString("settings_rotation", "0"));
} catch (NumberFormatException ex) {
// Catch bad number format
}
@ -1498,9 +1509,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
case "settings_auto_layout":
int autoLayoutMode = 1;
try {
String autoLayoutModeValue = sharedPreferences.getString("settings_auto_layout", "1");
if(autoLayoutModeValue != null)
autoLayoutMode = Integer.parseInt(autoLayoutModeValue);
autoLayoutMode = Integer.parseInt(sharedPreferences.getString("settings_auto_layout", "1"));
} catch (NumberFormatException ex) {
// Catch bad number format
}
@ -1532,19 +1541,15 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
mainScreenView.setBackgroundKmlColor(sharedPreferences.getBoolean("settings_background_kml_color", false));
break;
case "settings_background_fallback_color":
String fallbackColor = sharedPreferences.getString("settings_background_fallback_color", "0");
try {
if(fallbackColor != null)
mainScreenView.setBackgroundFallbackColor(Integer.parseInt(fallbackColor));
mainScreenView.setBackgroundFallbackColor(Integer.parseInt(sharedPreferences.getString("settings_background_fallback_color", "0")));
} catch (NumberFormatException ex) {
// Catch bad number format
}
break;
case "settings_printer_model":
String printerModel = sharedPreferences.getString("settings_printer_model", "1");
try {
if(printerModel != null)
printerSimulator.setPrinterModel82240A(Integer.parseInt(printerModel) == 0);
printerSimulator.setPrinterModel82240A(Integer.parseInt(sharedPreferences.getString("settings_printer_model", "1")) == 0);
} catch (NumberFormatException ex) {
// Catch bad number format
}

View file

@ -130,7 +130,7 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
int backgroundFallbackColor = -1;
try {
backgroundFallbackColor = Integer.parseInt(stringValue);
} catch (NumberFormatException ex) {}
} catch (NumberFormatException ignored) {}
if(backgroundFallbackColor >= 0 && backgroundFallbackColor < stringArrayBackgroundFallbackColor.length)
preference.setSummary(stringArrayBackgroundFallbackColor[backgroundFallbackColor]);
// preferenceBackgroundCustomColor.setEnabled(backgroundFallbackColor == 2);
@ -216,13 +216,15 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
intent.putExtra(Intent.EXTRA_TITLE, "shared.bin");
getActivity().startActivityForResult(intent, MainActivity.INTENT_PORT2LOAD);
Activity activity = getActivity();
if(activity != null)
activity.startActivityForResult(intent, MainActivity.INTENT_PORT2LOAD);
return true;
}
});
}
public void updatePort2LoadFilename(String port2Filename) {
void updatePort2LoadFilename(String port2Filename) {
if(preferencePort2load != null) {
String displayName = port2Filename;
try {

View file

@ -7,6 +7,7 @@
android:id="@+id/textViewInfo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp" />
android:padding="5dp"
android:textIsSelectable="true" />
</ScrollView>

View file

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/page_printer_graphic"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="20dp"
android:layout_margin="10dp">
<androidx.constraintlayout.widget.ConstraintLayout
@ -19,7 +18,7 @@
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/printer_graphic_container"
android:id="@+id/printer_graphic_margin"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="1dp"
@ -29,6 +28,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/printer_graphic_container"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/page_printer_text"
android:layout_width="match_parent"
@ -19,7 +18,7 @@
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/printer_text_container"
android:id="@+id/printer_text_margin"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="1dp"
@ -29,20 +28,26 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/printer_text"
<ScrollView
android:id="@+id/printer_text_scroll"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="2dp"
android:background="#FFFFFFFF"
android:text=""
android:typeface="monospace"
android:textIsSelectable="true"
android:textSize="20sp"
android:layout_margin="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent" >
<TextView
android:id="@+id/printer_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:typeface="monospace"
/>
<!--android:textSize="20sp"-->
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>