Commit cdf179da authored by feihuaduo's avatar feihuaduo

修复开启决斗助手后普通卡密重复检测的问题

去除决斗助手悬浮窗、通知
优化决斗助手检测效率
parent 0a71b503
{
"version": 2,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "cn.garymb.ygomobile",
"variantName": "cnRelease",
"elements": [
{
"type": "SINGLE",
"filters": [],
"versionCode": 380800907,
"versionName": "3.8.8",
"outputFile": "mobile-cn-release.apk"
}
]
}
\ No newline at end of file
......@@ -39,6 +39,7 @@ import com.nightonke.boommenu.BoomButtons.BoomButton;
import com.nightonke.boommenu.BoomButtons.TextOutsideCircleButton;
import com.nightonke.boommenu.BoomMenuButton;
import com.ourygo.assistant.service.DuelAssistantService;
import com.ourygo.assistant.util.DuelAssistantManagement;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
......@@ -801,17 +802,18 @@ public class DeckManagerActivity extends BaseCardsActivity implements RecyclerVi
ImageView iv_image = viewDialog.findViewById(R.id.iv_image);
Button bt_image_share = viewDialog.findViewById(R.id.bt_image_share);
Button bt_code_share = viewDialog.findViewById(R.id.bt_code_share);
EditText et_code = viewDialog.findViewById(R.id.et_code);
et_code.setText(mDeckAdapater.getDeckInfo().toDeck().toAppUri().toString());
TextView tv_code = viewDialog.findViewById(R.id.et_code);
tv_code.setText(mDeckAdapater.getDeckInfo().toDeck().toAppUri().toString());
ImageUtil.setImage(this, savePath, iv_image);
bt_code_share.setOnClickListener(v -> {
du.dis();
stopService(new Intent(this, DuelAssistantService.class));
YGOUtil.copyMessage(this, et_code.getText().toString().trim());
// stopService(new Intent(this, DuelAssistantService.class));
YGOUtil.copyMessage(this, tv_code.getText().toString().trim());
DuelAssistantManagement.getInstance().setLastMessage(tv_code.getText().toString().trim());
showToast(getString(R.string.deck_text_copyed));
//复制完毕开启决斗助手
YGOUtil.startDuelService(this);
// YGOUtil.startDuelService(this);
});
......
......@@ -161,6 +161,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
protected void onResume() {
super.onResume();
BacktoDuel();
duelAssistantCheck();
}
@Override
......@@ -172,24 +173,22 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
private void duelAssistantCheck() {
if (AppsSettings.get().isServiceDuelAssistant()) {
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
handler.postDelayed(() -> {
try {
FileLogUtil.writeAndTime("主页决斗助手检查");
} catch (IOException e) {
e.printStackTrace();
}
duelAssistantManagement.checkClip(ID_MAINACTIVITY);
}
}, 500);
}
}
@Override
protected void onStart() {
super.onStart();
duelAssistantCheck();
}
@Override
......@@ -225,7 +224,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
duelAssistantManagement = DuelAssistantManagement.getInstance();
duelAssistantManagement.init(getApplicationContext());
duelAssistantManagement.addDuelAssistantListener(this);
YGOUtil.startDuelService(this);
// YGOUtil.startDuelService(this);
}
//检查是否有刘海
......
......@@ -135,11 +135,9 @@ public class MainActivity extends HomeActivity {
}
}
});*/
dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
if (AppsSettings.get().isServiceDuelAssistant() && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q)
YGOUtil.isServicePermission(MainActivity.this, true);
dialog.setOnDismissListener(dialogInterface -> {
// if (AppsSettings.get().isServiceDuelAssistant() && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q)
// YGOUtil.isServicePermission(MainActivity.this, true);
File oriDeckFiles = new File(ORI_DECK);
File deckFiles = new File(AppsSettings.get().getDeckDir());
if (oriDeckFiles.exists() && deckFiles.list().length <= 1) {
......@@ -158,13 +156,12 @@ public class MainActivity extends HomeActivity {
dlgpls.show();
}
}
});
dialog.show();
}
} else {
if (AppsSettings.get().isServiceDuelAssistant() && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q)
YGOUtil.isServicePermission(MainActivity.this, true);
// if (AppsSettings.get().isServiceDuelAssistant() && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q)
// YGOUtil.isServicePermission(MainActivity.this, true);
getGameUriManager().doIntent(getIntent());
}
......
......@@ -192,11 +192,11 @@ public class SettingFragment extends PreferenceFragmentPlus {
}
//开关决斗助手
if (preference.getKey().equals(PREF_START_SERVICEDUELASSISTANT)) {
if (checkBoxPreference.isChecked()) {
getActivity().startService(new Intent(getActivity(), DuelAssistantService.class));
} else {
getActivity().stopService(new Intent(getActivity(), DuelAssistantService.class));
}
// if (checkBoxPreference.isChecked()) {
// getActivity().startService(new Intent(getActivity(), DuelAssistantService.class));
// } else {
// getActivity().stopService(new Intent(getActivity(), DuelAssistantService.class));
// }
}
return true;
}
......
......@@ -69,11 +69,11 @@ public class YGOUtil {
}
public static void startDuelService(Context context) {
if (AppsSettings.get().isServiceDuelAssistant()) {
if (!Util.startDuelService(context)) {
getNotificationPermissionDialog(context).show();
}
}
// if (AppsSettings.get().isServiceDuelAssistant()) {
// if (!Util.startDuelService(context)) {
// getNotificationPermissionDialog(context).show();
// }
// }
}
......
......@@ -72,8 +72,8 @@ public class ClipManagement implements ClipboardManager.OnPrimaryClipChangedList
if (TextUtils.isEmpty(clipMessage)) {
return;
}
if (onClipChangedListener != null)
onClipChangedListener.onClipChanged(clipMessage, false, ID_CLIP_LISTENER);
// if (onClipChangedListener != null)
// onClipChangedListener.onClipChanged(clipMessage, false, ID_CLIP_LISTENER);
}
public void onPrimaryClipChanged(boolean isCheck, int id) {
......
......@@ -4,6 +4,7 @@ package com.ourygo.assistant.util;
import android.content.Context;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
import com.ourygo.assistant.base.listener.OnClipChangedListener;
import com.ourygo.assistant.base.listener.OnDuelAssistantListener;
......@@ -143,6 +144,7 @@ public class DuelAssistantManagement implements OnClipChangedListener {
return false;
}
onJoinRoom(null, 0, message.substring(start, end), id);
return true;
}
return false;
}
......@@ -226,8 +228,13 @@ public class DuelAssistantManagement implements OnClipChangedListener {
lastMessage = clipMessage;
} else if (roomCheck(clipMessage, id)) {
lastMessage = clipMessage;
} else if (cardSearchCheck(clipMessage, id))
lastMessage = clipMessage;
}
// else if (cardSearchCheck(clipMessage, id))
// lastMessage = clipMessage;
}
public void setLastMessage(String lastMessage) {
this.lastMessage = lastMessage;
}
public void checkClip(int id) {
......
......@@ -46,7 +46,7 @@ public class Record {
public static final String ARG_PASSWORD_ALL = "password";
public static final String ARG_YGO_TYPE="ygotype";
public static final String ARG_DECK="deck";
public static final String ARG_ROOM="deck";
public static final String ARG_ROOM="room";
}
......@@ -52,7 +52,7 @@
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatEditText
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/et_code"
android:layout_width="match_parent"
android:layout_height="280dp"
......
......@@ -250,7 +250,6 @@
<string name="return_to_duel">듀얼로 돌아가십시오</string>
<string name="Start_ServiceDuelAssistant">듀얼 어시스턴트 시작</string>
<string name="about_DuelAssistant">방 비밀번호를 통한 방 입장
\n“?”을 이용한 카드 검색
\n덱 코드를 이용한 덱 공유</string>
<string name="find_deck_text">덱 공유 코드가 감지 되었습니다. 덱을 저장하겠습니까?</string>
<string name="save_failed_bcos">다음 이유로 인해 저장에 실패했습니다:</string>
......
......@@ -256,7 +256,6 @@
<string name="return_to_duel">点此返回决斗</string>
<string name="Start_ServiceDuelAssistant">开启决斗助手</string>
<string name="about_DuelAssistant">复制约战房间号直接加房
\n复制“?”+关键词直接查询卡片
\n复制卡组文本直接保存为卡组并在卡组编辑打开它</string>
<string name="find_deck_text">检测到卡组文本,是否保存?</string>
<string name="save_failed_bcos">保存失败,原因为</string>
......
......@@ -257,7 +257,6 @@
<string name="return_to_duel">Return to Duel☞</string>
<string name="Start_ServiceDuelAssistant">DuelAssistant</string>
<string name="about_DuelAssistant">Copy PSW to Quick Join Game.
\nCopy Keywords to Search Cards.
\nCopy Deck Text to Save as YDK and Open in Deck Editor</string>
<string name="find_deck_text">Find your copyed Deck Text, Save or Not?</string>
<string name="save_failed_bcos">save failed bcos of</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment