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