Skip to content
This repository was archived by the owner on Mar 12, 2026. It is now read-only.

Commit 7eacc71

Browse files
authored
Merge pull request #42 from l3ger0j/patch-4
`FixMe!` Third package of fixes
2 parents d577180 + 1a3710b commit 7eacc71

4 files changed

Lines changed: 22 additions & 6 deletions

File tree

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ android {
1212
applicationId "org.qp.android"
1313
minSdkVersion 26
1414
targetSdkVersion 34
15-
versionCode 202203
16-
versionName "3.22.3"
15+
versionCode 202204
16+
versionName "3.22.4"
1717
resourceConfigurations += ['en', 'ru']
1818
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1919
}

app/src/main/java/org/qp/android/model/libQP/LibQpProxyImpl.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,11 @@ private ArrayList<QpListItem> getObjects() {
217217

218218
public synchronized void start() {
219219
libQspThread = new Thread(() -> {
220+
exitLoopIfExist();
220221
while (!Thread.currentThread().isInterrupted()) {
221222
try {
222223
nativeMethods.QSPInit();
223-
if (Looper.myLooper() == null) {
224-
Looper.prepare();
225-
}
224+
Looper.prepare();
226225
libQspHandler = new Handler();
227226
libQspThreadInit = true;
228227
Looper.loop();
@@ -251,6 +250,18 @@ public void stop() {
251250
libQspThread.interrupt();
252251
}
253252

253+
private void exitLoopIfExist() {
254+
var handler = libQspHandler;
255+
if (handler != null) {
256+
handler.getLooper().quitSafely();
257+
} else {
258+
var mLooper = Looper.myLooper();
259+
if (mLooper != null) {
260+
mLooper.quitSafely();
261+
}
262+
}
263+
}
264+
254265
public void enableDebugMode (boolean isDebug) {
255266
runOnQspThread(() -> nativeMethods.QSPEnableDebugMode(isDebug));
256267
}

app/src/main/java/org/qp/android/model/service/HtmlProcessor.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ public String removeHTMLTags(String html) {
195195
result.append(html, fromIdx, idx);
196196
var endIdx = html.indexOf('>', idx + 1);
197197
if (endIdx == -1) {
198-
Log.w(TAG,"Invalid HTML: element at " + idx + " is not closed");
198+
var message = "Invalid HTML:"
199+
+ "\n source HTML:" + html
200+
+ "\n element at " + idx
201+
+ " is not closed";
202+
Log.w(TAG , message);
199203
result.append(html.substring(idx));
200204
break;
201205
}

app/src/main/java/org/qp/android/ui/game/GameActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ public void showSavePopup() {
418418
public void showSimpleDialog(@NonNull String inputString ,
419419
@NonNull GameDialogType dialogType ,
420420
@Nullable ErrorType errorType) {
421+
if (isFinishing()) return;
421422
if (!isMainThread()) {
422423
runOnUiThread(() -> showSimpleDialog(inputString , dialogType , errorType));
423424
} else {

0 commit comments

Comments
 (0)