Commit a35f00d1 authored by kenan's avatar kenan

搜索

parent 92aae885
...@@ -3,6 +3,8 @@ package cn.garymb.ygomobile.loader; ...@@ -3,6 +3,8 @@ package cn.garymb.ygomobile.loader;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import androidx.annotation.NonNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -18,10 +20,10 @@ public class CardKeyWord { ...@@ -18,10 +20,10 @@ public class CardKeyWord {
public CardKeyWord(String word) { public CardKeyWord(String word) {
this.word = word; this.word = word;
if (!TextUtils.isEmpty(word)) { if (!TextUtils.isEmpty(word)) {
if (TextUtils.isDigitsOnly(word)) { if (TextUtils.isDigitsOnly(word) && word.length() > 5) {
//搜索卡密 //搜索卡密
filterList.add(new CodeFilter(Long.parseLong(word))); filterList.add(new CodeFilter(Long.parseLong(word)));
} else { }
String[] ws = word.split(" "); String[] ws = word.split(" ");
for (String w : ws) { for (String w : ws) {
if (TextUtils.isEmpty(w)) { if (TextUtils.isEmpty(w)) {
...@@ -46,7 +48,6 @@ public class CardKeyWord { ...@@ -46,7 +48,6 @@ public class CardKeyWord {
filterList.add(new NameFilter(w, exclude, onlyText)); filterList.add(new NameFilter(w, exclude, onlyText));
} }
} }
}
empty = filterList.size() == 0; empty = filterList.size() == 0;
} }
...@@ -72,10 +73,10 @@ public class CardKeyWord { ...@@ -72,10 +73,10 @@ public class CardKeyWord {
private final long setcode; private final long setcode;
//包含系列,或者包含名字、描述 //包含系列,或者包含名字、描述
public NameFilter(String word, boolean exclude, boolean onlyText) { public NameFilter(@NonNull String word, boolean exclude, boolean onlyText) {
this.setcode = onlyText ? 0 : DataManager.get().getStringManager().getSetCode(word); this.setcode = onlyText ? 0 : DataManager.get().getStringManager().getSetCode(word);
this.exclude = exclude; this.exclude = exclude;
this.word = word; this.word = word.toLowerCase();
if(this.setcode > 0){ if(this.setcode > 0){
Log.d(TAG, "filter:setcode=" + setcode + ", exclude=" + exclude + ", word=" + word); Log.d(TAG, "filter:setcode=" + setcode + ", exclude=" + exclude + ", word=" + word);
} }
......
...@@ -29,7 +29,6 @@ import ocgcore.enums.LimitType; ...@@ -29,7 +29,6 @@ import ocgcore.enums.LimitType;
public class CardLoader implements ICardSearcher { public class CardLoader implements ICardSearcher {
private final LimitManager mLimitManager; private final LimitManager mLimitManager;
private final CardManager mCardManager; private final CardManager mCardManager;
private final StringManager mStringManager;
private final Context context; private final Context context;
private CallBack mCallBack; private CallBack mCallBack;
private LimitList mLimitList; private LimitList mLimitList;
...@@ -50,7 +49,6 @@ public class CardLoader implements ICardSearcher { ...@@ -50,7 +49,6 @@ public class CardLoader implements ICardSearcher {
this.context = context; this.context = context;
mLimitManager = DataManager.get().getLimitManager(); mLimitManager = DataManager.get().getLimitManager();
mCardManager = DataManager.get().getCardManager(); mCardManager = DataManager.get().getCardManager();
mStringManager = DataManager.get().getStringManager();
mLimitList = mLimitManager.getTopLimit(); mLimitList = mLimitManager.getTopLimit();
} }
......
...@@ -68,7 +68,7 @@ public class ImageLoader implements Closeable { ...@@ -68,7 +68,7 @@ public class ImageLoader implements Closeable {
private final boolean useCache; private final boolean useCache;
private static final String TAG = ImageLoader.class.getSimpleName(); private static final String TAG = ImageLoader.class.getSimpleName();
private final Map<String, ZipFile> zipFileCache = new ConcurrentHashMap<>(); private final Map<String, ZipFile> zipFileCache = new ConcurrentHashMap<>();
private final Map<Long, Cache> zipDataCache = new ConcurrentHashMap<>(); private final Map<Long, ImageLoader.Cache> zipDataCache = new ConcurrentHashMap<>();
private ZipFile mDefaultZipFile; private ZipFile mDefaultZipFile;
private File mPicsFile; private File mPicsFile;
...@@ -182,7 +182,7 @@ public class ImageLoader implements Closeable { ...@@ -182,7 +182,7 @@ public class ImageLoader implements Closeable {
try { try {
RequestBuilder<Drawable> resource = GlideCompat.with(imageview.getContext()).load(file); RequestBuilder<Drawable> resource = GlideCompat.with(imageview.getContext()).load(file);
setDefaults(resource, setDefaults(resource,
new MediaStoreSignature("image/*", file.lastModified(), Type.origin.getId()), new MediaStoreSignature("image/*", file.lastModified(), ImageLoader.Type.origin.getId()),
pre, type); pre, type);
resource.into(imageview); resource.into(imageview);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -153,11 +153,11 @@ public class Card extends CardData implements Parcelable { ...@@ -153,11 +153,11 @@ public class Card extends CardData implements Parcelable {
} }
public boolean containsName(String key){ public boolean containsName(String key){
return Name != null && Name.contains(key); return Name != null && Name.toLowerCase().contains(key);
} }
public boolean containsDesc(String key){ public boolean containsDesc(String key){
return Desc != null && Desc.contains(key); return Desc != null && Desc.toLowerCase().contains(key);
} }
/** /**
......
...@@ -8,11 +8,7 @@ ...@@ -8,11 +8,7 @@
android:shortcutLongLabel="@string/mycard" android:shortcutLongLabel="@string/mycard"
android:shortcutShortLabel="@string/mycard"> android:shortcutShortLabel="@string/mycard">
<intent <intent android:targetClass="cn.garymb.ygomobile.ui.mycard.MyCardActivity" />
android:action="android.intent.action.VIEW"
android:targetClass="cn.garymb.ygomobile.ui.mycard.MyCardActivity"
android:targetPackage="cn.garymb.ygomobile" />
<categories android:name="android.shortcut.conversation" />
</shortcut> </shortcut>
<shortcut <shortcut
android:enabled="true" android:enabled="true"
...@@ -22,11 +18,7 @@ ...@@ -22,11 +18,7 @@
android:shortcutLongLabel="@string/card_search" android:shortcutLongLabel="@string/card_search"
android:shortcutShortLabel="@string/card_search"> android:shortcutShortLabel="@string/card_search">
<intent <intent android:targetClass="cn.garymb.ygomobile.ui.cards.CardSearchAcitivity" />
android:action="android.intent.action.VIEW"
android:targetClass="cn.garymb.ygomobile.ui.cards.CardSearchAcitivity"
android:targetPackage="cn.garymb.ygomobile" />
<categories android:name="android.shortcut.conversation" />
</shortcut> </shortcut>
<shortcut <shortcut
android:enabled="true" android:enabled="true"
...@@ -36,10 +28,6 @@ ...@@ -36,10 +28,6 @@
android:shortcutLongLabel="@string/deck_manager" android:shortcutLongLabel="@string/deck_manager"
android:shortcutShortLabel="@string/deck_manager"> android:shortcutShortLabel="@string/deck_manager">
<intent <intent android:targetClass="cn.garymb.ygomobile.ui.cards.DeckManagerActivity" />
android:action="android.intent.action.VIEW"
android:targetClass="cn.garymb.ygomobile.ui.cards.DeckManagerActivity"
android:targetPackage="cn.garymb.ygomobile" />
<categories android:name="android.shortcut.conversation" />
</shortcut> </shortcut>
</shortcuts> </shortcuts>
\ No newline at end of file
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