Refactor the code for easier code sharing between Emu48, Emu42 and Emu71.

This commit is contained in:
dgis 2019-06-23 23:51:19 +02:00
parent 3e9d0fb564
commit 8ebe008438
43 changed files with 606 additions and 430 deletions

View file

@ -52,7 +52,6 @@ NOT WORKING YET
- Disassembler
- Debugger
- Macro
- Infrared Printer
- Serial Ports (Wire or Ir)
@ -60,9 +59,10 @@ CHANGES
Version 1.5 (2019-06-xx)
- Add Change Paper (clean) action in the printer simulator.
- Fix: Selecting an empty KML folder prevent to select the default embedded KML folder (Github Fix: #5)!
- Add the printer simulator.
- Refactor the code for easier code sharing between Emu48, Emu42 and Emu71.
- Fix: Bad text characters when copy/paste the stack.
- Fix: Selecting an empty KML folder prevent to select the default embedded KML folder (Github Fix: #5)!
Version 1.4 (2019-06-08)

View file

@ -27,12 +27,6 @@ if (keystorePropertiesFile.exists()) {
""")
}
//allprojects {
// tasks.withType(JavaCompile) {
// options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
// }
//}
android {
compileSdkVersion 28
defaultConfig {

View file

@ -55,7 +55,7 @@
android:value="org.emulator.forty.eight.MainActivity"/>
</activity>
<activity
android:name=".InfoWebActivity"
android:name="org.emulator.calculator.InfoWebActivity"
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout"
android:label="@string/title_web_activity_info">
<meta-data
@ -63,7 +63,7 @@
android:value="org.emulator.forty.eight.MainActivity" />
</activity>
<activity
android:name=".InfoActivity"
android:name="org.emulator.calculator.InfoActivity"
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout"
android:label="@string/title_activity_info">
<meta-data

View file

@ -1,6 +1,20 @@
// 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.
#include "core/pch.h"
#include "core/resource.h"
#include "core/Emu48.h"
#include "emu.h"
#include "core/io.h"
#include "core/kml.h"
#include "core/debugger.h"

View file

@ -1,5 +1,19 @@
// 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.
#include "core/pch.h"
#include "core/Emu48.h"
#include "emu.h"
// Serial.c
BOOL CommOpen(LPTSTR strWirePort,LPTSTR strIrPort) {

View file

@ -1,6 +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.
//
// Created by cosnier on 12/11/2018.
// 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.
#include <jni.h>
#include <stdio.h>
#include <android/asset_manager.h>
@ -8,7 +19,7 @@
#include <android/bitmap.h>
#include "core/pch.h"
#include "core/Emu48.h"
#include "emu.h"
#include "core/io.h"
#include "core/kml.h"
#include "win32-layer.h"
@ -272,7 +283,7 @@ void sendByteUdp(unsigned char byteSent) {
}
}
JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_start(JNIEnv *env, jobject thisz, jobject assetMgr, jobject bitmapMainScreen0, jobject activity, jobject view) {
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_start(JNIEnv *env, jobject thisz, jobject assetMgr, jobject bitmapMainScreen0, jobject activity, jobject view) {
chooseCurrentKmlMode = ChooseKmlMode_UNKNOWN;
szChosenCurrentKml[0] = '\0';
@ -359,7 +370,7 @@ JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_start(JNIEnv *env
while (nState!=nNextState) Sleep(0); // wait for thread initialized
}
JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_stop(JNIEnv *env, jobject thisz) {
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_stop(JNIEnv *env, jobject thisz) {
if (hThread)
SwitchToState(SM_RETURN); // exit emulation thread
@ -394,7 +405,7 @@ JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_stop(JNIEnv *env,
}
JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_changeBitmap(JNIEnv *env, jobject thisz, jobject bitmapMainScreen0) {
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_changeBitmap(JNIEnv *env, jobject thisz, jobject bitmapMainScreen0) {
if(bitmapMainScreen) {
(*env)->DeleteGlobalRef(env, bitmapMainScreen);
@ -409,68 +420,68 @@ JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_changeBitmap(JNIE
}
JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_draw(JNIEnv *env, jobject thisz) {
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_draw(JNIEnv *env, jobject thisz) {
draw();
}
JNIEXPORT jboolean JNICALL Java_org_emulator_forty_eight_NativeLib_buttonDown(JNIEnv *env, jobject thisz, jint x, jint y) {
JNIEXPORT jboolean JNICALL Java_org_emulator_calculator_NativeLib_buttonDown(JNIEnv *env, jobject thisz, jint x, jint y) {
return buttonDown(x, y) ? JNI_TRUE : JNI_FALSE;
}
JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_buttonUp(JNIEnv *env, jobject thisz, jint x, jint y) {
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_buttonUp(JNIEnv *env, jobject thisz, jint x, jint y) {
buttonUp(x, y);
}
JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_keyDown(JNIEnv *env, jobject thisz, jint virtKey) {
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_keyDown(JNIEnv *env, jobject thisz, jint virtKey) {
keyDown(virtKey);
}
JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_keyUp(JNIEnv *env, jobject thisz, jint virtKey) {
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_keyUp(JNIEnv *env, jobject thisz, jint virtKey) {
keyUp(virtKey);
}
JNIEXPORT jboolean JNICALL Java_org_emulator_forty_eight_NativeLib_isDocumentAvailable(JNIEnv *env, jobject thisz) {
JNIEXPORT jboolean JNICALL Java_org_emulator_calculator_NativeLib_isDocumentAvailable(JNIEnv *env, jobject thisz) {
return bDocumentAvail ? JNI_TRUE : JNI_FALSE;
}
JNIEXPORT jstring JNICALL Java_org_emulator_forty_eight_NativeLib_getCurrentFilename(JNIEnv *env, jobject thisz) {
JNIEXPORT jstring JNICALL Java_org_emulator_calculator_NativeLib_getCurrentFilename(JNIEnv *env, jobject thisz) {
jstring result = (*env)->NewStringUTF(env, szCurrentFilename);
return result;
}
JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_getCurrentModel(JNIEnv *env, jobject thisz) {
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_getCurrentModel(JNIEnv *env, jobject thisz) {
return cCurrentRomType;
}
JNIEXPORT jboolean JNICALL Java_org_emulator_forty_eight_NativeLib_isBackup(JNIEnv *env, jobject thisz) {
JNIEXPORT jboolean JNICALL Java_org_emulator_calculator_NativeLib_isBackup(JNIEnv *env, jobject thisz) {
return (jboolean) (bBackup ? JNI_TRUE : JNI_FALSE);
}
JNIEXPORT jstring JNICALL Java_org_emulator_forty_eight_NativeLib_getKMLLog(JNIEnv *env, jobject thisz) {
JNIEXPORT jstring JNICALL Java_org_emulator_calculator_NativeLib_getKMLLog(JNIEnv *env, jobject thisz) {
jstring result = (*env)->NewStringUTF(env, szKmlLog);
return result;
}
JNIEXPORT jstring JNICALL Java_org_emulator_forty_eight_NativeLib_getKMLTitle(JNIEnv *env, jobject thisz) {
JNIEXPORT jstring JNICALL Java_org_emulator_calculator_NativeLib_getKMLTitle(JNIEnv *env, jobject thisz) {
jstring result = (*env)->NewStringUTF(env, szKmlTitle);
return result;
}
JNIEXPORT jboolean JNICALL Java_org_emulator_forty_eight_NativeLib_getPort1Plugged(JNIEnv *env, jobject thisz) {
JNIEXPORT jboolean JNICALL Java_org_emulator_calculator_NativeLib_getPort1Plugged(JNIEnv *env, jobject thisz) {
return (jboolean) ((Chipset.cards_status & PORT1_PRESENT) != 0);
}
JNIEXPORT jboolean JNICALL Java_org_emulator_forty_eight_NativeLib_getPort1Writable(JNIEnv *env, jobject thisz) {
JNIEXPORT jboolean JNICALL Java_org_emulator_calculator_NativeLib_getPort1Writable(JNIEnv *env, jobject thisz) {
return (jboolean) ((Chipset.cards_status & PORT1_WRITE) != 0);
}
JNIEXPORT jboolean JNICALL Java_org_emulator_forty_eight_NativeLib_getSoundEnabled(JNIEnv *env, jobject thisz) {
JNIEXPORT jboolean JNICALL Java_org_emulator_calculator_NativeLib_getSoundEnabled(JNIEnv *env, jobject thisz) {
return (jboolean) soundAvailable;
}
JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_getGlobalColor(JNIEnv *env, jobject thisz) {
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_getGlobalColor(JNIEnv *env, jobject thisz) {
return (jint) dwTColor;
}
JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_onFileNew(JNIEnv *env, jobject thisz, jstring kmlFilename) {
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onFileNew(JNIEnv *env, jobject thisz, jstring kmlFilename) {
if (bDocumentAvail)
{
SwitchToState(SM_INVALID);
@ -516,7 +527,7 @@ JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_onFileNew(JNIEnv
}
return result;
}
JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_onFileOpen(JNIEnv *env, jobject thisz, jstring stateFilename) {
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onFileOpen(JNIEnv *env, jobject thisz, jstring stateFilename) {
if (bDocumentAvail)
{
SwitchToState(SM_INVALID);
@ -550,7 +561,7 @@ JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_onFileOpen(JNIEnv
}
return result;
}
JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_onFileSave(JNIEnv *env, jobject thisz) {
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onFileSave(JNIEnv *env, jobject thisz) {
// szBufferFilename must be set before calling that!!!
BOOL result = FALSE;
if (bDocumentAvail)
@ -562,7 +573,7 @@ JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_onFileSave(JNIEnv
}
return result;
}
JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_onFileSaveAs(JNIEnv *env, jobject thisz, jstring newStateFilename) {
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onFileSaveAs(JNIEnv *env, jobject thisz, jstring newStateFilename) {
const char *newStateFilenameUTF8 = (*env)->GetStringUTFChars(env, newStateFilename , NULL) ;
BOOL result = FALSE;
@ -579,7 +590,7 @@ JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_onFileSaveAs(JNIE
return result;
}
JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_onFileClose(JNIEnv *env, jobject thisz) {
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onFileClose(JNIEnv *env, jobject thisz) {
if (bDocumentAvail)
{
SwitchToState(SM_INVALID);
@ -595,7 +606,7 @@ JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_onFileClose(JNIEn
return FALSE;
}
JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_onObjectLoad(JNIEnv *env, jobject thisz, jstring filename) {
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onObjectLoad(JNIEnv *env, jobject thisz, jstring filename) {
const char *filenameUTF8 = (*env)->GetStringUTFChars(env, filename , NULL) ;
SuspendDebugger(); // suspend debugger
@ -675,7 +686,12 @@ JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_onObjectLoad(JNIE
return TRUE;
}
JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_onObjectSave(JNIEnv *env, jobject thisz, jstring filename) {
JNIEXPORT jobjectArray JNICALL Java_org_emulator_calculator_NativeLib_getObjectsToSave(JNIEnv *env, jobject thisz) {
return 0;
}
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onObjectSave(JNIEnv *env, jobject thisz, jstring filename, jbooleanArray objectsToSaveItemChecked) {
const char *filenameUTF8 = (*env)->GetStringUTFChars(env, filename , NULL) ;
//OnObjectSave();
@ -705,7 +721,7 @@ JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_onObjectSave(JNIE
return TRUE;
}
JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_onViewCopy(JNIEnv *env, jobject thisz, jobject bitmapScreen) {
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_onViewCopy(JNIEnv *env, jobject thisz, jobject bitmapScreen) {
//jobject bitmapScreen = (*env)->NewGlobalRef(env, bitmapScreen0);
@ -810,16 +826,16 @@ JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_onViewCopy(JNIEnv
AndroidBitmap_unlockPixels(env, bitmapScreen);
}
JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_onStackCopy(JNIEnv *env, jobject thisz) {
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_onStackCopy(JNIEnv *env, jobject thisz) {
OnStackCopy();
}
JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_onStackPaste(JNIEnv *env, jobject thisz) {
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_onStackPaste(JNIEnv *env, jobject thisz) {
//TODO Memory leak -> No GlobalFree of the paste data!!!!
OnStackPaste();
}
JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_onViewReset(JNIEnv *env, jobject thisz) {
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_onViewReset(JNIEnv *env, jobject thisz) {
if (nState != SM_RUN)
return;
SwitchToState(SM_SLEEP);
@ -827,7 +843,7 @@ JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_onViewReset(JNIEn
SwitchToState(SM_RUN);
}
JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_onViewScript(JNIEnv *env, jobject thisz, jstring kmlFilename) {
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onViewScript(JNIEnv *env, jobject thisz, jstring kmlFilename) {
TCHAR szKmlFile[MAX_PATH];
// BOOL bKMLChanged,bSucc;
@ -918,7 +934,7 @@ JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_onViewScript(JNIE
return result;
}
JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_onBackupSave(JNIEnv *env, jobject thisz) {
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_onBackupSave(JNIEnv *env, jobject thisz) {
UINT nOldState;
if (pbyRom == NULL) return;
nOldState = SwitchToState(SM_INVALID);
@ -926,7 +942,7 @@ JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_onBackupSave(JNIE
SwitchToState(nOldState);
}
JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_onBackupRestore(JNIEnv *env, jobject thisz) {
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_onBackupRestore(JNIEnv *env, jobject thisz) {
SwitchToState(SM_INVALID);
RestoreBackup();
if(hLcdDC && hLcdDC->selectedBitmap) {
@ -935,11 +951,11 @@ JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_onBackupRestore(J
if (pbyRom) SwitchToState(SM_RUN);
}
JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_onBackupDelete(JNIEnv *env, jobject thisz) {
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_onBackupDelete(JNIEnv *env, jobject thisz) {
ResetBackup();
}
JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_setConfiguration(JNIEnv *env, jobject thisz, jstring key, jint isDynamic, jint intValue1, jint intValue2, jstring stringValue) {
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_setConfiguration(JNIEnv *env, jobject thisz, jstring key, jint isDynamic, jint intValue1, jint intValue2, jstring stringValue) {
const char *configKey = (*env)->GetStringUTFChars(env, key, NULL) ;
const char *configStringValue = stringValue ? (*env)->GetStringUTFChars(env, stringValue, NULL) : NULL;
@ -1063,17 +1079,17 @@ JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_setConfiguration(
(*env)->ReleaseStringUTFChars(env, stringValue, configStringValue);
}
JNIEXPORT jboolean JNICALL Java_org_emulator_forty_eight_NativeLib_isPortExtensionPossible(JNIEnv *env, jobject thisz) {
JNIEXPORT jboolean JNICALL Java_org_emulator_calculator_NativeLib_isPortExtensionPossible(JNIEnv *env, jobject thisz) {
return (cCurrentRomType=='S' || cCurrentRomType=='G' || cCurrentRomType==0 ? JNI_TRUE : JNI_FALSE);
}
JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_getState(JNIEnv *env, jobject thisz) {
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_getState(JNIEnv *env, jobject thisz) {
return nState;
}
JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_getScreenWidth(JNIEnv *env, jobject thisz) {
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_getScreenWidth(JNIEnv *env, jobject thisz) {
return 131*nLcdZoom*nGdiXZoom;
}
JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_getScreenHeight(JNIEnv *env, jobject thisz) {
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_getScreenHeight(JNIEnv *env, jobject thisz) {
return SCREENHEIGHT*nLcdZoom*nGdiYZoom;
}

15
app/src/main/cpp/emu.h Normal file
View file

@ -0,0 +1,15 @@
// 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.
#include "core/Emu48.h"

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.
#include "core/pch.h"
#include <fcntl.h>
#include <unistd.h>
@ -8,7 +22,7 @@
#include <android/bitmap.h>
#include "core/resource.h"
#include "win32-layer.h"
#include "core/Emu48.h"
#include "emu.h"
extern JavaVM *java_machine;
extern jobject bitmapMainScreen;

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.
#pragma once
#include <stdint.h>

View file

@ -1,7 +1,3 @@
//
// Created by Dgis on 01/15/2019.
//
#ifndef TRUNK_COMMCTRL_H
#define TRUNK_COMMCTRL_H

View file

@ -1,7 +1,3 @@
//
// Created by Dgis on 01/15/2019.
//
#ifndef TRUNK_CONIO_H
#define TRUNK_CONIO_H

View file

@ -1,7 +1,3 @@
//
// Created by Dgis on 01/15/2019.
//
#ifndef TRUNK_CRTDBG_H
#define TRUNK_CRTDBG_H

View file

@ -1,7 +1,3 @@
//
// Created by Dgis on 01/15/2019.
//
#ifndef TRUNK_DIRECT_H
#define TRUNK_DIRECT_H

View file

@ -1,7 +1,3 @@
//
// Created by Dgis on 01/15/2019.
//
#ifndef TRUNK_SHELLAPI_H
#define TRUNK_SHELLAPI_H

View file

@ -1,7 +1,3 @@
//
// Created by Dgis on 01/15/2019.
//
#ifndef TRUNK_SHLOBJ_H
#define TRUNK_SHLOBJ_H

View file

@ -1,7 +1,3 @@
//
// Created by Dgis on 01/15/2019.
//
#ifndef TRUNK_TCHAR_H
#define TRUNK_TCHAR_H

View file

@ -1,7 +1,3 @@
//
// Created by Dgis on 01/15/2019.
//
#ifndef TRUNK_WINDOWS_H
#define TRUNK_WINDOWS_H

View file

@ -1,7 +1,3 @@
//
// Created by Dgis on 01/15/2019.
//
#ifndef TRUNK_WINSOCK2_H
#define TRUNK_WINSOCK2_H

View file

@ -1,9 +1,22 @@
package org.emulator.forty.eight;
// 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.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.text.util.Linkify;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
@ -14,36 +27,39 @@ import androidx.appcompat.app.AppCompatActivity;
public class InfoActivity extends AppCompatActivity {
private int homeId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_info);
String filepath = getString(R.string.info_readme);
setContentView(Utils.resId(this, "layout", "activity_info"));
String filepath = getString(Utils.resId(this, "string", "info_readme"));
homeId = Utils.resId(this, "id", "home");
// Programmatically load text from an asset and place it into the
// text view. Note that the text we are loading is ASCII, so we
// need to convert it to UTF-16.
try {
InputStream is = getAssets().open(filepath);
// We guarantee that the available method returns the total
// size of the asset... of course, this does mean that a single
// asset can't be more than 2 gigs.
int size = is.available();
// Read the entire asset into a local byte buffer.
byte[] buffer = new byte[size];
//noinspection ResultOfMethodCallIgnored
is.read(buffer);
is.close();
// Convert the buffer into a string.
String text = new String(buffer);
// Finally stick the string into the text view.
TextView textViewInfo = findViewById(R.id.textViewInfo);
textViewInfo.setMovementMethod(new ScrollingMovementMethod());
TextView textViewInfo = findViewById(Utils.resId(this, "id", "textViewInfo"));
textViewInfo.setMovementMethod(new ScrollingMovementMethod());
textViewInfo.setText(text);
Linkify.addLinks(textViewInfo, Linkify.ALL);
} catch (IOException e) {
@ -52,17 +68,9 @@ public class InfoActivity extends AppCompatActivity {
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
//getMenuInflater().inflate(R.menu.activity_info, menu);
return false; //true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
if(item.getItemId() == homeId) {
finish();
return true;
}

View file

@ -0,0 +1,47 @@
// 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.os.Bundle;
import android.view.MenuItem;
import android.webkit.WebView;
import androidx.appcompat.app.AppCompatActivity;
public class InfoWebActivity extends AppCompatActivity {
private int homeId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(Utils.resId(this, "layout", "activity_web_info"));
homeId = Utils.resId(this, "id", "home");
WebView webView = findViewById(Utils.resId(this, "id", "webViewInfo"));
String url = getString(Utils.resId(this, "string", "help_url"));
webView.loadUrl(url);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId() == homeId) {
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}

View file

@ -1,4 +1,18 @@
package org.emulator.forty.eight;
// 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;
import android.content.Context;

View file

@ -1,5 +1,20 @@
package org.emulator.forty.eight;
// 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;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
@ -9,7 +24,7 @@ public class NativeLib {
System.loadLibrary("native-lib");
}
public static native void start(AssetManager mgr, Bitmap bitmapMainScreen, MainActivity activity, MainScreenView view);
public static native void start(AssetManager mgr, Bitmap bitmapMainScreen, Activity activity, MainScreenView view);
public static native void stop();
public static native void changeBitmap(Bitmap bitmapMainScreen);
public static native void draw();
@ -36,7 +51,9 @@ public class NativeLib {
public static native int onFileSaveAs(String newFilename);
public static native int onFileClose();
public static native int onObjectLoad(String filename);
public static native int onObjectSave(String filename);
public static native String[] getObjectsToSave();
public static native int onObjectSave(String filename, boolean[] objectsToSaveItemChecked);
public static native void onViewCopy(Bitmap bitmapScreen);
public static native void onStackCopy();
public static native void onStackPaste();

View file

@ -1,4 +1,18 @@
package org.emulator.forty.eight;
// 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.content.Context;
import android.graphics.Canvas;

View file

@ -12,14 +12,14 @@
// 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.forty.eight;
package org.emulator.calculator;
import android.graphics.Bitmap;
import android.util.Log;
import java.util.ArrayList;
/*
/**
* Based on the free HP82240B Printer Simulator by Christoph Giesselink
*/
public class PrinterSimulator {
@ -27,6 +27,7 @@ public class PrinterSimulator {
private static final String TAG = "PrinterSimulator";
private ArrayList<Integer> data = new ArrayList<>();
private StringBuilder m_Text = new StringBuilder();
private StringBuilder textUpdate = new StringBuilder();
private final int ESC = 27; // ESC
@ -96,7 +97,7 @@ public class PrinterSimulator {
/**
* Called when the printer just has print something.
*/
void onPrinterUpdate();
void onPrinterUpdate(String textAppended);
}
private OnPrinterUpdateListener onPrinterUpdateListener;
@ -161,6 +162,9 @@ public class PrinterSimulator {
* @param byData
*/
public synchronized void write(int byData) {
textUpdate.setLength(0);
data.add(byData);
do {
@ -223,7 +227,7 @@ public class PrinterSimulator {
} while (false);
if(this.onPrinterUpdateListener != null)
this.onPrinterUpdateListener.onPrinterUpdate();
this.onPrinterUpdateListener.onPrinterUpdate(textUpdate.toString());
}
// Text Printer
@ -278,27 +282,29 @@ public class PrinterSimulator {
do {
// special LF and LF characters
if (byData == 0x04 || byData == 0x0A) {
m_Text.append('\r');
m_Text.append('\n');
textUpdate.append('\r');
textUpdate.append('\n');
break;
}
// unprintable control codes
if (byData < ' ')
return; // no print
break; // no print
// normal 7bit ASCII character
if (byData < 128)
m_Text.append((char)byData);
textUpdate.append((char)byData);
else {
byData -= 128; // index to table
if (m_bEcma94 == false)
m_Text.append((char)wcRoman8[byData]);
textUpdate.append((char)wcRoman8[byData]);
else
m_Text.append((char)wcEcma94[byData]);
textUpdate.append((char)wcEcma94[byData]);
}
} while (false);
m_Text.append(textUpdate);
}
/**

View file

@ -1,4 +1,18 @@
package org.emulator.forty.eight;
// 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.annotation.SuppressLint;
import android.app.Activity;
@ -11,14 +25,18 @@ import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Bundle;
import android.text.Layout;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import androidx.annotation.NonNull;
@ -39,6 +57,7 @@ import java.util.Locale;
public class PrinterSimulatorFragment extends AppCompatDialogFragment {
private static final String TAG = "PrinterSimulator";
private boolean debug = false;
private PrinterSimulator printerSimulator;
private Toolbar toolbar;
private TextView textViewPrinterText;
@ -59,23 +78,25 @@ public class PrinterSimulatorFragment extends AppCompatDialogFragment {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(AppCompatDialogFragment.STYLE_NO_FRAME, android.R.style.Theme_Holo_Light);
//setStyle(STYLE_NO_FRAME, android.R.style.Theme_Holo_Light);
//setStyle(STYLE_NO_TITLE, android.R.style.Theme_Holo_Light);
//setStyle(STYLE_NO_TITLE, android.R.style.Theme_Material_Light_Dialog_Alert);
//setStyle(STYLE_NO_FRAME, 0);
//setStyle(STYLE_NO_TITLE, android.R.style.Theme_Material_Light_Dialog_Alert); //Theme_Holo_Light);
setStyle(STYLE_NO_TITLE, android.R.style.Theme_Holo_Light);
//setStyle(STYLE_NO_TITLE, 0);
}
// @Override
// public void onResume() {
// ViewGroup.LayoutParams params = getDialog().getWindow().getAttributes();
// params.width = WindowManager.LayoutParams.MATCH_PARENT;
// params.height = ViewGroup.LayoutParams.MATCH_PARENT;
// getDialog().getWindow().setAttributes((WindowManager.LayoutParams) params);
// //getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
// super.onResume();
// ViewGroup.LayoutParams params = getDialog().getWindow().getAttributes();
// params.width = ViewGroup.LayoutParams.MATCH_PARENT;
// params.height = ViewGroup.LayoutParams.MATCH_PARENT;
// getDialog().getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);
// }
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = super.onCreateDialog(savedInstanceState);
@ -86,22 +107,22 @@ public class PrinterSimulatorFragment extends AppCompatDialogFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
String title = getString(R.string.dialog_printer_simulator_title);
String title = getString(Utils.resId(this, "string", "dialog_printer_simulator_title"));
if(printerSimulator != null)
title = printerSimulator.getTitle();
getDialog().setTitle(title);
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_printer_simulator, container, false);
View view = inflater.inflate(Utils.resId(this, "layout", "fragment_printer_simulator"), container, false);
// Toolbar
toolbar = view.findViewById(R.id.my_toolbar);
toolbar = view.findViewById(Utils.resId(this, "id", "my_toolbar"));
toolbar.setTitle(title);
toolbar.setOverflowIcon(ContextCompat.getDrawable(getActivity(), R.drawable.ic_more_vert_white_24dp));
//toolbar.setOverflowIcon(ContextCompat.getDrawable(getActivity(), Utils.resId(this, "drawable", "ic_more_vert_white_24dp")));
//toolbar.setLogo(R.drawable.ic_launcher);
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_white_24dp);
toolbar.setNavigationIcon(Utils.resId(this, "drawable", "ic_keyboard_backspace_white_24dp"));
toolbar.setNavigationOnClickListener(
new View.OnClickListener() {
@Override
@ -110,20 +131,20 @@ public class PrinterSimulatorFragment extends AppCompatDialogFragment {
}
}
);
toolbar.inflateMenu(R.menu.fragment_printer_simulator);
toolbar.inflateMenu(Utils.resId(this, "menu", "fragment_printer_simulator"));
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
if(item.getItemId() == R.id.menu_printer_simulator_share_text) {
if(item.getItemId() == Utils.resId(PrinterSimulatorFragment.this, "id", "menu_printer_simulator_share_text")) {
Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setType("text/plain");
//intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Intent.EXTRA_SUBJECT, R.string.message_printer_share_text);
intent.putExtra(Intent.EXTRA_SUBJECT, Utils.resId(PrinterSimulatorFragment.this, "string", "message_printer_share_text"));
intent.putExtra(Intent.EXTRA_TEXT, printerSimulator.getText());
// 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(R.string.message_printer_share_text)));
} else if(item.getItemId() == R.id.menu_printer_simulator_share_graphic) {
startActivity(Intent.createChooser(intent, getString(Utils.resId(PrinterSimulatorFragment.this, "string", "message_printer_share_text"))));
} else if(item.getItemId() == Utils.resId(PrinterSimulatorFragment.this, "id", "menu_printer_simulator_share_graphic")) {
String imageFilename = "HPPrinter-" + new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss", Locale.US).format(new Date());
try {
Bitmap paperBitmap = printerSimulator.getImage();
@ -143,18 +164,18 @@ public class PrinterSimulatorFragment extends AppCompatDialogFragment {
Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setType(mimeType);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Intent.EXTRA_SUBJECT, R.string.message_printer_share_graphic);
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(R.string.message_printer_share_graphic)));
startActivity(Intent.createChooser(intent, getString(Utils.resId(PrinterSimulatorFragment.this, "string", "message_printer_share_graphic"))));
} catch (Exception e) {
e.printStackTrace();
((MainActivity)getActivity()).showAlert(e.getMessage());
Utils.showAlert(getActivity(), e.getMessage());
}
} else if(item.getItemId() == R.id.menu_printer_simulator_change_paper) {
} else if(item.getItemId() == Utils.resId(PrinterSimulatorFragment.this, "id", "menu_printer_simulator_change_paper")) {
printerSimulator.changePaper();
printerGraphView.updatePaper();
updatePaper();
printerGraphView.updatePaperLayout();
updatePaper(null);
}
return true;
}
@ -164,7 +185,6 @@ public class PrinterSimulatorFragment extends AppCompatDialogFragment {
if(context != null) {
Resources.Theme theme = context.getTheme();
if (theme != null) {
//theme.resolveAttribute(android.R.attr.actionBarSize, tv, true);
theme.resolveAttribute(androidx.appcompat.R.attr.actionBarSize, tv, true);
int actionBarHeight = getResources().getDimensionPixelSize(tv.resourceId);
toolbar.setMinimumHeight(actionBarHeight);
@ -174,21 +194,21 @@ public class PrinterSimulatorFragment extends AppCompatDialogFragment {
// ViewPager with Text and Graph
ViewPager pager = view.findViewById(R.id.viewPagerPrinter);
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(R.id.page_printer_text);
textViewPrinterText = container.findViewById(R.id.printer_text);
addToPrinterText(printerSimulator.getText());
ViewGroup layoutPagePrinterText = container.findViewById(Utils.resId(PrinterSimulatorFragment.this, "id", "page_printer_text"));
textViewPrinterText = container.findViewById(Utils.resId(PrinterSimulatorFragment.this, "id", "printer_text"));
updatePaper(null);
return layoutPagePrinterText;
}
case 1: {
ViewGroup layoutPagePrinterGraphic = container.findViewById(R.id.page_printer_graphic);
ViewGroup pagePrinterGraphicContainer = container.findViewById(R.id.printer_graphic_container);
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);
@ -203,9 +223,9 @@ public class PrinterSimulatorFragment extends AppCompatDialogFragment {
// Generate title based on item position
switch (position) {
case 0:
return getString(R.string.tab_printer_textual);
return getString(Utils.resId(PrinterSimulatorFragment.this, "string", "tab_printer_textual"));
case 1:
return getString(R.string.tab_printer_graphical);
return getString(Utils.resId(PrinterSimulatorFragment.this, "string", "tab_printer_graphical"));
default:
return null;
}
@ -225,62 +245,42 @@ public class PrinterSimulatorFragment extends AppCompatDialogFragment {
return view;
}
// @Override
// public void onAttach(Context context) {
// super.onAttach(context);
// }
//
// @Override
// public void onDetach() {
// super.onDetach();
// }
private void appendTextToPrinter(String text) {
if(textViewPrinterText != null && text != null && text.length() > 0) {
// @Override
// public void onResume() {
// super.onResume();
// ViewGroup.LayoutParams params = getDialog().getWindow().getAttributes();
// params.width = ViewGroup.LayoutParams.MATCH_PARENT;
// params.height = ViewGroup.LayoutParams.MATCH_PARENT;
// getDialog().getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);
// }
private void addToPrinterText(String text) {
if(textViewPrinterText != null) {
// Log.d(TAG, "addToPrinterText() getScrollY: " + textViewPrinterText.getScrollY() + ", getHeight: " + textViewPrinterText.getHeight());
// boolean needToScroll = false;
// boolean isAtMaxScrollPosition;
// int currentScrollPosition = textViewPrinterText.getScrollY(); // SP
// int viewHeight = textViewPrinterText.getHeight(); // VH
// if(debug) Log.d(TAG, "appendTextToPrinter() getScrollY: " + currentScrollPosition + ", getHeight: " + viewHeight + ", text: " + text);
// Layout layout = textViewPrinterText.getLayout();
// if(layout != null) {
// int currentScrollPosition = textViewPrinterText.getScrollY();
// int maxScrollPosition = layout.getLineTop(textViewPrinterText.getLineCount()) - textViewPrinterText.getHeight();
// needToScroll = currentScrollPosition == maxScrollPosition;
// }
textViewPrinterText.setText(text);
// layout = textViewPrinterText.getLayout();
// if(layout != null) {
// int virtualHeight = layout.getLineTop(textViewPrinterText.getLineCount());
// int newScrollPosition = virtualHeight - textViewPrinterText.getHeight();
// if (needToScroll && newScrollPosition > 0) {
// Log.d(TAG, "addToPrinterText() NEED to scroll to: " + newScrollPosition);
// textViewPrinterText.scrollTo(0, newScrollPosition);
// int virtualHeight1 = layout.getLineTop(textViewPrinterText.getLineCount()); // IH
// int maxScrollPosition1 = virtualHeight1 - viewHeight;
// isAtMaxScrollPosition = (maxScrollPosition1 < 0 || currentScrollPosition == maxScrollPosition1);
// textViewPrinterText.append(text);
// if(isAtMaxScrollPosition) {
// int virtualHeight2 = layout.getLineTop(textViewPrinterText.getLineCount());
// int maxScrollPosition2 = virtualHeight2 - viewHeight;
// if (maxScrollPosition2 > 0) {
// if(debug) Log.d(TAG, "appendTextToPrinter() NEED to scroll to: " + maxScrollPosition2);
// textViewPrinterText.scrollTo(0, maxScrollPosition2);
// }
// } else {
// if(debug) Log.d(TAG, "appendTextToPrinter() NEED to scroll BACK to old position: " + currentScrollPosition);
// textViewPrinterText.scrollTo(0, currentScrollPosition);
// }
// }
// } else
textViewPrinterText.append(text);
}
}
Runnable onPrinterUpdate = new Runnable() {
@Override
public void run() {
updatePaper();
}
};
private void updatePaper() {
private void updatePaper(String textAppended) {
if(debug) Log.d(TAG, "updatePaper(" + textAppended + ")");
if(textViewPrinterText != null) {
addToPrinterText(printerSimulator.getText());
appendTextToPrinter(textAppended == null ? printerSimulator.getText() : textAppended);
}
if(printerGraphView != null) {
printerGraphView.updatePaper();
printerGraphView.updatePaperLayout();
printerGraphView.invalidate();
}
}
@ -289,10 +289,16 @@ public class PrinterSimulatorFragment extends AppCompatDialogFragment {
this.printerSimulator = printerSimulator;
this.printerSimulator.setOnPrinterUpdateListener(new PrinterSimulator.OnPrinterUpdateListener() {
@Override
public void onPrinterUpdate() {
public void onPrinterUpdate(final String textAppended) {
Activity activity = getActivity();
if(activity != null)
activity.runOnUiThread(onPrinterUpdate);
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if(debug) Log.d(TAG, "onPrinterUpdate(" + textAppended + ")");
updatePaper(textAppended);
}
});
}
});
}
@ -339,34 +345,85 @@ public class PrinterSimulatorFragment extends AppCompatDialogFragment {
viewPanOffsetX = translateX;
viewPanOffsetY = translateY;
constrainPan();
//constrainPan(false);
return;
}
// Else, the screens orientations are the same, so we set the calculator in fullscreen
resetViewport();
//resetViewport();
}
}
public void updatePaper() {
protected void constrainPan(boolean center) {
// Keep the panning limits and the image centered.
float viewWidth = viewSizeWidth;
float viewHeight = viewSizeHeight;
if(viewWidth == 0.0f){
viewWidth = 1.0f;
viewHeight = 1.0f;
}
float virtualWidth = virtualSizeWidth;
float virtualHeight = virtualSizeHeight;
if(virtualWidth == 0.0f){
virtualWidth = 1.0f;
virtualHeight = 1.0f;
}
float viewRatio = viewHeight / viewWidth;
float imageRatio = virtualHeight / virtualWidth;
float viewPanMinX = viewSizeWidth - virtualWidth * viewScaleFactorX;
float viewPanMinY = viewSizeHeight - virtualHeight * viewScaleFactorY;
if(viewRatio > imageRatio) {
// Keep the panning X limits.
if(viewPanOffsetX < viewPanMinX)
viewPanOffsetX = viewPanMinX;
else if(viewPanOffsetX > 0f)
viewPanOffsetX = 0f;
if(/*center &&*/ viewPanMinY > 0f)
// Keep the image at the bottom of the view.
viewPanOffsetY = viewPanMinY; // / 2.0f;
else {
if(viewPanOffsetY > 0f)
viewPanOffsetY = 0f;
else if(viewPanOffsetY < viewPanMinY)
viewPanOffsetY = viewPanMinY;
}
} else {
// Keep the panning Y limits.
if(viewPanOffsetY < viewPanMinY)
viewPanOffsetY = viewPanMinY;
else if(viewPanOffsetY > 0f)
viewPanOffsetY = 0f;
// Keep the image centered horizontally.
if(center && viewPanMinX > 0f)
viewPanOffsetX = viewPanMinX / 2.0f;
else {
if(viewPanOffsetX > 0f)
viewPanOffsetX = 0f;
else if(viewPanOffsetX < viewPanMinX)
viewPanOffsetX = viewPanMinX;
}
}
}
public void updatePaperLayout() {
setVirtualSize(bitmap.getWidth(), printerSimulator.getPaperHeight());
updateLayoutView();
}
@Override
protected void onSizeChanged(int viewWidth, int viewHeight, int oldViewWidth, int oldViewHeight) {
//super.onSizeChanged(viewWidth, viewHeight, oldViewWidth, oldViewHeight);
viewSizeWidth = viewWidth;
viewSizeHeight = viewHeight;
updatePaper();
updatePaperLayout();
}
@Override
protected void onCustomDraw(Canvas canvas) {
paintBitmap.setColorFilter(colorFilterAlpha8ToRGB);
canvas.drawColor(Color.BLACK); // LTGRAY);
canvas.drawBitmap(this.bitmap, 0, 0, paintBitmap);
Rect paperclip = new Rect(0, 0, bitmap.getWidth(), printerSimulator.getPaperHeight());
canvas.drawBitmap(this.bitmap, paperclip, paperclip, paintBitmap);
}
}
}

View file

@ -1,10 +1,27 @@
package org.emulator.forty.eight;
// 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.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.OpenableColumns;
import android.util.Log;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
@ -12,7 +29,35 @@ import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
public class Utils {
static String getFileName(Context context, String url) {
public static void showAlert(Context context, String text) {
Toast toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
//View view = toast.getView();
//view.setBackgroundColor(0x80000000);
toast.show();
}
public static int resId(Context context, String resourcename, String variableName)
{
try {
return context.getResources().getIdentifier(variableName, resourcename, context.getApplicationContext().getPackageName());
} catch (Exception e) {
e.printStackTrace();
return -1;
}
}
public static int resId(Fragment context, String resourcename, String variableName)
{
try {
return context.getResources().getIdentifier(variableName, resourcename, context.getContext().getApplicationContext().getPackageName());
} catch (Exception e) {
e.printStackTrace();
return -1;
}
}
public static String getFileName(Context context, String url) {
String result = null;
try {
Uri uri = Uri.parse(url);
@ -47,7 +92,7 @@ public class Utils {
}
// https://community.khronos.org/t/get-maximum-texture-size/67795
static int getMaximumTextureSize() {
public static int getMaximumTextureSize() {
EGL10 egl = (EGL10) EGLContext.getEGL();
EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

View file

@ -0,0 +1,38 @@
// 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.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import androidx.viewpager.widget.ViewPager;
public class ViewPagerNoSwipe extends ViewPager {
public ViewPagerNoSwipe(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
return false;
}
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
return false;
}
}

View file

@ -1,42 +0,0 @@
package org.emulator.forty.eight;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebView;
import androidx.appcompat.app.AppCompatActivity;
public class InfoWebActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web_info);
WebView webView = findViewById(R.id.webViewInfo);
// webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
// webView.setBackgroundColor(Color.LTGRAY);
String url = getString(R.string.help_url);
webView.loadUrl(url);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
//getMenuInflater().inflate(R.menu.activity_info, menu);
//return true;
return false;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}

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.forty.eight;
import android.app.Activity;
@ -38,6 +52,14 @@ import androidx.drawerlayout.widget.DrawerLayout;
import com.google.android.material.navigation.NavigationView;
import org.emulator.calculator.InfoActivity;
import org.emulator.calculator.InfoWebActivity;
import org.emulator.calculator.MainScreenView;
import org.emulator.calculator.NativeLib;
import org.emulator.calculator.PrinterSimulator;
import org.emulator.calculator.PrinterSimulatorFragment;
import org.emulator.calculator.Utils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
@ -90,6 +112,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private boolean kmFolderChange = true;
private int selectedRAMSize = -1;
private boolean[] objectsToSaveItemChecked = null;
private int MRU_ID_START = 10000;
private int MAX_MRU = 5;
@ -792,15 +815,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private void OnViewPrinter() {
fragmentPrinterSimulator.show(getSupportFragmentManager(), "Hello Fragment");
// String printerText = printer.getText();
// new AlertDialog.Builder(this)
// .setTitle(getString(R.string.message_printer))
// .setMessage(printerText)
// .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
// public void onClick(DialogInterface dialog, int which) {
// }
// }).show();
}
private void showKMLPicker(final boolean changeKML) {
@ -1000,7 +1014,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
}
case INTENT_OBJECT_SAVE: {
//Log.d(TAG, "onActivityResult INTENT_OBJECT_SAVE " + url);
NativeLib.onObjectSave(url);
NativeLib.onObjectSave(url, null);
break;
}
case INTENT_PICK_KML_FOLDER_FOR_NEW_FILE:
@ -1209,11 +1223,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
return -1;
}
void showAlert(String text) {
Toast toast = Toast.makeText(this, text, Toast.LENGTH_SHORT);
//View view = toast.getView();
//view.setBackgroundColor(0x80000000);
toast.show();
public void showAlert(String text) {
Utils.showAlert(this, text);
}
void sendMenuItemCommand(int menuItem) {

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.forty.eight;
import android.app.Activity;
@ -17,7 +31,8 @@ import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;
import java.util.HashSet;
import org.emulator.calculator.NativeLib;
import org.emulator.calculator.Utils;
public class SettingsActivity extends AppCompatActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
@ -75,33 +90,6 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
settingsKeyChanged.add(key);
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
if(resultCode == Activity.RESULT_OK && data != null) {
if(requestCode == MainActivity.INTENT_PORT2LOAD) {
Uri uri = data.getData();
//Log.d(TAG, "onActivityResult INTENT_PORT2LOAD " + uri.toString());
String url;
if (uri != null) {
url = uri.toString();
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("settings_port2load", url);
editor.apply();
makeUriPersistable(data, uri);
if(generalPreferenceFragment != null)
generalPreferenceFragment.updatePort2LoadFilename(url);
}
}
}
super.onActivityResult(requestCode, resultCode, data);
}
private void makeUriPersistable(Intent data, Uri uri) {
final int takeFlags = data.getFlags() & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
getContentResolver().takePersistableUriPermission(uri, takeFlags);
}
/**
* This fragment shows general preferences only. It is used when the
* activity is showing a two-pane settings UI.
@ -111,9 +99,7 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
Preference preferencePort2load = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.pref_general);
setHasOptionsMenu(true);
@ -219,11 +205,6 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
});
}
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
}
public void updatePort2LoadFilename(String port2Filename) {
if(preferencePort2load != null) {
String displayName = port2Filename;
@ -236,4 +217,31 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
}
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
if(resultCode == Activity.RESULT_OK && data != null) {
if(requestCode == MainActivity.INTENT_PORT2LOAD) {
Uri uri = data.getData();
//Log.d(TAG, "onActivityResult INTENT_PORT2LOAD " + uri.toString());
String url;
if (uri != null) {
url = uri.toString();
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("settings_port2load", url);
editor.apply();
makeUriPersistable(data, uri);
if(generalPreferenceFragment != null)
generalPreferenceFragment.updatePort2LoadFilename(url);
}
}
}
super.onActivityResult(requestCode, resultCode, data);
}
private void makeUriPersistable(Intent data, Uri uri) {
final int takeFlags = data.getFlags() & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
getContentResolver().takePersistableUriPermission(uri, takeFlags);
}
}

View file

@ -1,24 +0,0 @@
package org.emulator.forty.eight;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import androidx.viewpager.widget.ViewPager;
public class ViewPagerNoSwipe extends ViewPager {
public ViewPagerNoSwipe(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
return false;
}
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
return false;
}
}

View file

@ -1,34 +1,7 @@
<!--
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".InfoActivity" >
-->
<!--
<TextView
android:id="@+id/textViewInfo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:padding="5dp"
android:scrollbars="vertical" />
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context="org.emulator.forty.eight.InfoActivity" >
<!--
android:id="@+id/scrollViewInfo"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
-->
android:layout_height="fill_parent" >
<TextView
android:id="@+id/textViewInfo"
@ -37,5 +10,3 @@
android:padding="5dp" />
</ScrollView>
<!-- </RelativeLayout> -->

View file

@ -5,9 +5,7 @@
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.emulator.forty.eight.MainActivity"
tools:openDrawer="start">
<!--android:fitsSystemWindows="true"-->
<include
layout="@layout/app_bar_main"

View file

@ -3,8 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.emulator.forty.eight.InfoWebActivity">
android:layout_height="match_parent" >
<WebView
android:id="@+id/webViewInfo"

View file

@ -5,8 +5,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.emulator.forty.eight.MainActivity">
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"

View file

@ -6,7 +6,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="org.emulator.forty.eight.MainActivity"
tools:showIn="@layout/activity_main">

View file

@ -1,34 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".PrinterSimulatorFragment">
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:theme="?attr/actionBarTheme"
android:minHeight="?attr/actionBarSize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navigationIcon="?android:attr/homeAsUpIndicator"
/>
android:theme="?attr/actionBarTheme"
app:navigationIcon="?android:attr/homeAsUpIndicator" />
<org.emulator.forty.eight.ViewPagerNoSwipe
<org.emulator.calculator.ViewPagerNoSwipe
android:id="@+id/viewPagerPrinter"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/my_toolbar">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/my_toolbar"
android:layout_marginTop="0dp">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
@ -51,6 +43,6 @@
<include layout="@layout/tab_content_page_printer_graphic" />
</org.emulator.forty.eight.ViewPagerNoSwipe>
</org.emulator.calculator.ViewPagerNoSwipe>
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout >

View file

@ -1,31 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--<LinearLayout-->
<!--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"-->
<!--android:layout_height="match_parent">-->
<!--<TextView-->
<!--android:id="@+id/printer_text"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:layout_margin="2dp"-->
<!--android:background="#FFFFFFFF"-->
<!--android:textSize="20sp"-->
<!--android:gravity="bottom"-->
<!--android:enabled="true"-->
<!--android:focusable="true"-->
<!--android:longClickable="true"-->
<!--android:text="Hello les amis"-->
<!--android:textIsSelectable="true"-->
<!--android:typeface="monospace"-->
<!--app:layout_constraintBottom_toBottomOf="parent"-->
<!--app:layout_constraintEnd_toEndOf="parent"-->
<!--app:layout_constraintStart_toStartOf="parent"-->
<!--app:layout_constraintTop_toTopOf="parent" />-->
<!--</LinearLayout>-->
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
@ -71,10 +44,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--android:enabled="true"-->
<!--android:focusable="true"-->
<!--android:longClickable="true"-->
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,7 +1,6 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="org.emulator.forty.eight.MainActivity">
xmlns:tools="http://schemas.android.com/tools">
<item
android:id="@+id/action_settings"

View file

@ -19,9 +19,6 @@
<string name="action_settings">Settings</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
<!--<string name="nav_header_title">Emu48</string>-->
<!--<string name="nav_header_subtitle">android.studio@android.com</string>-->
<!--<string name="nav_header_desc">Navigation header</string>-->
<string name="nav_new">New...</string>
<string name="nav_open">Open...</string>
<string name="nav_save">Save</string>
@ -68,6 +65,7 @@
<string name="message_yes">Yes</string>
<string name="message_no">No</string>
<string name="message_object_load">Warning: Trying to load an object while the emulator is busy will certainly result in a memory lost. Before loading an object you should be sure that the calculator is in idle state. Do you want to see this warning next time you try to load an object?</string>
<string name="message_object_save_program">Select Program</string>
<string name="message_screenshot">Emu48 screenshot</string>
<string name="message_share_screenshot">Share Emu48 screenshot</string>
<string name="message_press_reset">Are you sure you want to press the Reset Button?</string>
@ -96,7 +94,6 @@
<string name="settings_hide_bar_status">Hide the status bar</string>
<string name="settings_hide_bar_nav">Hide the navigation bar</string>
<string name="settings_hide_button_menu">Hide the button menu</string>
<!--<string name="settings_allow_sound_title">Allow sounds</string>-->
<string name="settings_sound_volume_title">Sound Volume</string>
<string name="settings_haptic_feedback_title">Allow haptic feedback</string>
@ -115,5 +112,4 @@
<string name="settings_port2wr_title">Port 2 is Writable</string>
<string name="settings_port2load_title">Port 2 File</string>
</resources>

View file

@ -6,6 +6,8 @@
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="actionOverflowButtonStyle">@style/MyOverflowButtonStyle</item>
</style>
<style name="AppTheme.NoActionBar">
@ -13,6 +15,10 @@
<item name="windowNoTitle">true</item>
</style>
<style name="MyOverflowButtonStyle" parent="Widget.AppCompat.ActionButton.Overflow">
<item name="android:tint">#FFFFFF</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

View file

@ -88,7 +88,7 @@
android:entryValues="@array/settings_background_fallback_color_value"
android:defaultValue="0"
/>
<!--<org.emulator.forty.eight.helpers.colorpicker.ColorPickerPreferenceCompat-->
<!--<org.emulator.calculator.helpers.colorpicker.ColorPickerPreferenceCompat-->
<!--android:key="settings_background_custom_color"-->
<!--android:title="@string/settings_background_custom_color_title"-->
<!--android:summary="@string/settings_background_custom_color_summary"-->

View file

@ -20,6 +20,10 @@ allprojects {
google()
jcenter()
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
task clean(type: Delete) {