This repository was archived by the owner on Mar 12, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
src/main/java/org/qp/android Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments