Commit 1533b106 authored by qq247321453's avatar qq247321453

优化搜索

parent 5365b989
...@@ -93,19 +93,24 @@ void ImageManager::SetDevice(irr::IrrlichtDevice* dev) { ...@@ -93,19 +93,24 @@ void ImageManager::SetDevice(irr::IrrlichtDevice* dev) {
driver = dev->getVideoDriver(); driver = dev->getVideoDriver();
} }
void ImageManager::ClearTexture() { void ImageManager::ClearTexture() {
for(auto tit = tMap.begin(); tit != tMap.end(); ++tit) { for(auto & tit : tMap) {
if(tit->second) if(tit.second)
driver->removeTexture(tit->second); driver->removeTexture(tit.second);
} }
for(auto tit = tThumb.begin(); tit != tThumb.end(); ++tit) { for(auto & tit : tThumb) {
if(tit->second) if(tit.second)
driver->removeTexture(tit->second); driver->removeTexture(tit.second);
}
for(auto & field : tFields) {
if(field.second)
driver->removeTexture(field.second);
} }
tMap.clear(); tMap.clear();
tThumb.clear(); tThumb.clear();
if(tBigPicture != NULL) { tFields.clear();
if(tBigPicture != nullptr) {
driver->removeTexture(tBigPicture); driver->removeTexture(tBigPicture);
tBigPicture = NULL; tBigPicture = nullptr;
} }
} }
void ImageManager::RemoveTexture(int code) { void ImageManager::RemoveTexture(int code) {
......
...@@ -9,8 +9,8 @@ android { ...@@ -9,8 +9,8 @@ android {
minSdkVersion 21 minSdkVersion 21
//noinspection ExpiredTargetSdkVersion //noinspection ExpiredTargetSdkVersion
targetSdkVersion 29 targetSdkVersion 29
versionCode 380700801 versionCode 390901604
versionName "3.8.7" versionName "3.9.9"
flavorDimensions "versionCode" flavorDimensions "versionCode"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
ndk { ndk {
......
...@@ -114,7 +114,11 @@ class CardSearchInfo { ...@@ -114,7 +114,11 @@ class CardSearchInfo {
} }
if (ot > CardOt.ALL.getId()) { if (ot > CardOt.ALL.getId()) {
if(ot == CardOt.NO_EXCLUSIVE.getId()){ if(ot == CardOt.NO_EXCLUSIVE.getId()){
if(card.Ot == CardOt.OCG.getId() || card.Ot == CardOt.TCG.getId()){ if (card.Ot == CardOt.OCG.getId() || card.Ot == CardOt.TCG.getId()) {
return false;
}
} else if (ot == CardOt.OCG.getId() || ot == CardOt.TCG.getId()) {
if (card.Ot != ot) {
return false; return false;
} }
} else if ((card.Ot & ot) == 0) { } else if ((card.Ot & ot) == 0) {
......
...@@ -24,6 +24,7 @@ import cn.garymb.ygomobile.loader.ICardSearcher; ...@@ -24,6 +24,7 @@ import cn.garymb.ygomobile.loader.ICardSearcher;
import cn.garymb.ygomobile.ui.adapters.SimpleSpinnerAdapter; import cn.garymb.ygomobile.ui.adapters.SimpleSpinnerAdapter;
import cn.garymb.ygomobile.ui.adapters.SimpleSpinnerItem; import cn.garymb.ygomobile.ui.adapters.SimpleSpinnerItem;
import cn.garymb.ygomobile.ui.plus.DialogPlus; import cn.garymb.ygomobile.ui.plus.DialogPlus;
import cn.garymb.ygomobile.ui.plus.VUiKit;
import ocgcore.DataManager; import ocgcore.DataManager;
import ocgcore.LimitManager; import ocgcore.LimitManager;
import ocgcore.StringManager; import ocgcore.StringManager;
...@@ -135,7 +136,7 @@ public class CardSearcher implements View.OnClickListener { ...@@ -135,7 +136,7 @@ public class CardSearcher implements View.OnClickListener {
myFavButton.setOnClickListener(v -> { myFavButton.setOnClickListener(v -> {
if(isShowFavorite()){ if(isShowFavorite()){
hideFavorites(); hideFavorites(true);
} else { } else {
showFavorites(true); showFavorites(true);
} }
...@@ -278,16 +279,30 @@ public class CardSearcher implements View.OnClickListener { ...@@ -278,16 +279,30 @@ public class CardSearcher implements View.OnClickListener {
myFavButton.setSelected(true); myFavButton.setSelected(true);
if (mCallBack != null) { if (mCallBack != null) {
mCallBack.onSearchStart(); mCallBack.onSearchStart();
mCallBack.onSearchResult(CardFavorites.get().getCards(mCardLoader), !showList); }
if (mCallBack != null) {
VUiKit.post(() -> {
mCallBack.onSearchResult(CardFavorites.get().getCards(mCardLoader), !showList);
});
} }
} }
public void hideFavorites(){ public void hideFavorites(boolean reload){
mShowFavorite = true; mShowFavorite = false;
myFavButton.setSelected(false); myFavButton.setSelected(false);
if (mCallBack != null) { if (mCallBack != null) {
mCallBack.onSearchStart(); mCallBack.onSearchStart();
mCallBack.onSearchResult(Collections.emptyList(), true); }
if (reload) {
VUiKit.post(() -> {
search();
});
} else {
if (mCallBack != null) {
VUiKit.post(() -> {
mCallBack.onSearchResult(Collections.emptyList(), true);
});
}
} }
} }
...@@ -529,8 +544,7 @@ public class CardSearcher implements View.OnClickListener { ...@@ -529,8 +544,7 @@ public class CardSearcher implements View.OnClickListener {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (v.getId() == R.id.btn_search) { if (v.getId() == R.id.btn_search) {
hideFavorites(); hideFavorites(true);
search();
} else if (v.getId() == R.id.btn_reset) { } else if (v.getId() == R.id.btn_reset) {
resetAll(); resetAll();
} }
......
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