Skip to content

Commit

Permalink
优化搜索结果
Browse files Browse the repository at this point in the history
  • Loading branch information
Fan095 committed Dec 2, 2024
1 parent 8113a83 commit 3331797
Show file tree
Hide file tree
Showing 6 changed files with 308 additions and 300 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import java.util.Locale;
import java.util.concurrent.CopyOnWriteArrayList;

import fan.internal.utils.AnimHelper;
import fan.recyclerview.card.CardGroupAdapter;

public class ModSearchAdapter extends CardGroupAdapter {
Expand Down
528 changes: 237 additions & 291 deletions app/src/main/java/com/sevtinge/hyperceiler/utils/search/SearchHelper.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.sevtinge.hyperceiler.utils.search;


import android.text.TextUtils;

import com.sevtinge.hyperceiler.data.ModData;

public class SearchResultItem implements Comparable<SearchResultItem> {

public static final int SEARCH_ITEM_NORMAL = 0;
public static final int SEARCH_EMPTY = 1;
public static final int SEARCH_SEPARATE_APP = 2;
public static final int SEARCH_CATEGORY = 3;
public static final int SEARCH_FOOTER = 4;

public String group;

public String title;
public String breadcrumbs;
public String key;
public ModData.ModCat cat;
public String sub;
public int order;
public String fragment;
public int catTitleResId;

public final int type;
public static final SearchResultItem EMPTY = new SearchResultItem(SEARCH_EMPTY);
public static final SearchResultItem CATEGORY = new SearchResultItem(SEARCH_CATEGORY);
public static final SearchResultItem FOOTER = new SearchResultItem(SEARCH_FOOTER);

public SearchResultItem(int type) {
this.type = type;
}

public String getGroupInfo(String str, String str2) {
String str3 = !TextUtils.isEmpty(str) ? str.split("/")[0] : null;
if (!TextUtils.isEmpty(str3)) {
return str3;
}
if (!TextUtils.isEmpty(str2)) {
str3 = str2.split("/")[0];
}
if (!TextUtils.isEmpty(str3)) {
return str3;
}
throw new RuntimeException("group is null: " + title);
}

@Override
public int compareTo(SearchResultItem o) {
return 0;
}
}
3 changes: 1 addition & 2 deletions app/src/main/res/layout/item_search_result.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
android:orientation="horizontal"
android:paddingHorizontal="25dp"
android:paddingVertical="10dp"
android:descendantFocusability="blocksDescendants"
style="@style/Widget.ListView.Item.Immersion">
android:descendantFocusability="blocksDescendants">

<ImageView
android:id="@android:id/icon"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Mon Dec 02 18:59:36 CST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.11.1-bin.zip
distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
20 changes: 14 additions & 6 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

pluginManagement {
repositories {
//maven { url = uri("https://mirrors.tuna.tsinghua.edu.cn/maven/") }
//maven { url = uri("https://maven.aliyun.com/repository/public/") }
maven("https://jitpack.io")
maven("https://api.xposed.info")
maven { url = uri("https://mirrors.tuna.tsinghua.edu.cn/maven/") }
maven{ url = uri("https://maven.aliyun.com/repository/google") }
//maven{ url = uri("https://maven.aliyun.com/repository/gradle-plugin") }
maven{ url = uri("https://maven.aliyun.com/repository/public") }
maven{ url = uri("https://maven.aliyun.com/repository/jcenter") }
gradlePluginPortal()
google()
mavenCentral()
Expand All @@ -13,12 +18,15 @@ pluginManagement {
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
//maven { url = uri("https://mirrors.tuna.tsinghua.edu.cn/maven/") }
//maven { url = uri("https://maven.aliyun.com/repository/public/") }
maven("https://jitpack.io")
maven("https://api.xposed.info")
maven { url = uri("https://mirrors.tuna.tsinghua.edu.cn/maven/") }
maven{ url = uri("https://maven.aliyun.com/repository/google") }
//maven{ url = uri("https://maven.aliyun.com/repository/gradle-plugin") }
maven{ url = uri("https://maven.aliyun.com/repository/public") }
maven{ url = uri("https://maven.aliyun.com/repository/jcenter") }
google()
mavenCentral()
maven("https://api.xposed.info")
maven("https://jitpack.io")
}
}

Expand Down

0 comments on commit 3331797

Please sign in to comment.