Commit b70aaabc authored by fallenstardust's avatar fallenstardust

fix对空卡组分享、删除、重命名闪退

parent 207576ef
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
3.未分类下无卡组时选择卡组闪退的问题; 3.未分类下无卡组时选择卡组闪退的问题;
4.提取录像卡组无法保存卡组的问题; 4.提取录像卡组无法保存卡组的问题;
5.卡组重命名不保存到原路径的问题; 5.卡组重命名不保存到原路径的问题;
6.对空卡组操作闪退的问题;
</pre> </pre>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -602,6 +602,10 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView ...@@ -602,6 +602,10 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
showResult(true); showResult(true);
break; break;
case R.id.action_share_deck: case R.id.action_share_deck:
if (mDeckAdapater.getYdkFile() == null) {
Toast.makeText(this, R.string.unable_to_edit_empty_deck, Toast.LENGTH_SHORT).show();
return true;
}
shareDeck(); shareDeck();
break; break;
case R.id.action_save: case R.id.action_save:
...@@ -620,14 +624,11 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView ...@@ -620,14 +624,11 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
} }
} }
break; break;
// case R.id.action_save_as:
// if (mYdkFile == null) {
// inputDeckName(null);
// } else {
// inputDeckName(mYdkFile.getName());
// }
// break;
case R.id.action_rename: case R.id.action_rename:
if (mDeckAdapater.getYdkFile() == null) {
Toast.makeText(this, R.string.unable_to_edit_empty_deck, Toast.LENGTH_SHORT).show();
return true;
}
if (mDeckAdapater.getYdkFile().getParent().equals(mSettings.getAiDeckDir())) { if (mDeckAdapater.getYdkFile().getParent().equals(mSettings.getAiDeckDir())) {
Toast.makeText(this, R.string.donot_editor_bot_Deck, Toast.LENGTH_SHORT).show(); Toast.makeText(this, R.string.donot_editor_bot_Deck, Toast.LENGTH_SHORT).show();
} else { } else {
...@@ -652,10 +653,11 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView ...@@ -652,10 +653,11 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
} }
break; break;
case R.id.action_delete_deck: { case R.id.action_delete_deck: {
File ydk = mDeckAdapater.getYdkFile(); if (mDeckAdapater.getYdkFile() == null) {
if (ydk == null) Toast.makeText(this, R.string.unable_to_edit_empty_deck, Toast.LENGTH_SHORT).show();
return true; return true;
if (ydk.getParent().equals(mSettings.getAiDeckDir())) { }
if (mDeckAdapater.getYdkFile().getParent().equals(mSettings.getAiDeckDir())) {
Toast.makeText(this, R.string.donot_editor_bot_Deck, Toast.LENGTH_SHORT).show(); Toast.makeText(this, R.string.donot_editor_bot_Deck, Toast.LENGTH_SHORT).show();
} else { } else {
DialogPlus builder = new DialogPlus(this); DialogPlus builder = new DialogPlus(this);
...@@ -664,8 +666,8 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView ...@@ -664,8 +666,8 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
builder.setMessageGravity(Gravity.CENTER_HORIZONTAL); builder.setMessageGravity(Gravity.CENTER_HORIZONTAL);
builder.setLeftButtonListener((dlg, rs) -> { builder.setLeftButtonListener((dlg, rs) -> {
if (ydk != null) { if (mDeckAdapater.getYdkFile() != null) {
FileUtils.deleteFile(ydk); FileUtils.deleteFile(mDeckAdapater.getYdkFile());
dlg.dismiss(); dlg.dismiss();
File file = getFirstYdk(); File file = getFirstYdk();
initDecksListSpinners(mDeckSpinner, file); initDecksListSpinners(mDeckSpinner, file);
...@@ -685,9 +687,6 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView ...@@ -685,9 +687,6 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
case R.id.action_sort: case R.id.action_sort:
mDeckAdapater.sort(); mDeckAdapater.sort();
break; break;
// case R.id.action_share_deck:
// shareDeck();
// break;
default: default:
return false; return false;
} }
......
...@@ -268,4 +268,5 @@ ...@@ -268,4 +268,5 @@
<string name="screenshoot">사진공유</string> <string name="screenshoot">사진공유</string>
<string name="code_share">덱 코드 공유</string> <string name="code_share">덱 코드 공유</string>
<string name="donot_editor_bot_Deck">덱을 변경하지 말아 주세요. 그러면 프로그램이 제대로 작동하지 않을 수 있습니다.</string> <string name="donot_editor_bot_Deck">덱을 변경하지 말아 주세요. 그러면 프로그램이 제대로 작동하지 않을 수 있습니다.</string>
<string name="unable_to_edit_empty_deck">수정 금지 빈 덱</string>
</resources> </resources>
...@@ -267,4 +267,5 @@ ...@@ -267,4 +267,5 @@
<string name="no_deck_is_selected">未选中卡组</string> <string name="no_deck_is_selected">未选中卡组</string>
<string name="done">完成!</string> <string name="done">完成!</string>
<string name="donot_editor_bot_Deck">请不要更改/删除AI卡组否则会导致人机模式无法正常使用</string> <string name="donot_editor_bot_Deck">请不要更改/删除AI卡组否则会导致人机模式无法正常使用</string>
<string name="unable_to_edit_empty_deck">不可操作空卡组</string>
</resources> </resources>
...@@ -270,4 +270,5 @@ ...@@ -270,4 +270,5 @@
<string name="donot_editor_bot_Deck">Pls Donot edit/remove AI Deck, if you do\nAI mode wont work properly</string> <string name="donot_editor_bot_Deck">Pls Donot edit/remove AI Deck, if you do\nAI mode wont work properly</string>
<string name="code_share">Code Share</string> <string name="code_share">Code Share</string>
<string name="screenshoot">Screenshoot</string> <string name="screenshoot">Screenshoot</string>
<string name="unable_to_edit_empty_deck">unable to edit empty deck</string>
</resources> </resources>
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