Commit a35f00d1 authored by kenan's avatar kenan

搜索

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