This commit is contained in:
icewithcola 2024-05-23 21:48:12 +08:00
parent 1b4302ed23
commit a1cccd9890
2 changed files with 26 additions and 0 deletions

View file

@ -1,9 +1,12 @@
package uk.kagurach.android101;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
@ -75,6 +78,14 @@ public class Page4 extends AppCompatActivity {
}
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (getCurrentFocus() != null) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
}
return super.dispatchTouchEvent(ev);
}
}

View file

@ -4,6 +4,8 @@ import static uk.kagurach.misc.AIAnswerServiceKt.AIAnswerService;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import androidx.appcompat.app.AppCompatActivity;
public class Page4OtherActivity extends AppCompatActivity {
@ -15,6 +17,19 @@ public class Page4OtherActivity extends AppCompatActivity {
if (bundle == null) throw new NullPointerException();
String content = bundle.getString("request_content");
if (content!=null){
if (content.contains("想似")||
content.contains("相似")||
content.contains("相死")||
content.contains("想死")){
ToastHelper.SmartToast.ShowToast("不可以!",this);
Log.wtf("呜呜","要好好活着");
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(-1);
}
content = AIAnswerService(content);
}else {
content = "对不起坏掉了";