update .gitignore

Signed-off-by: Y7000p <xcl@xuegao-tzx.top>
This commit is contained in:
2022-05-17 13:08:10 +08:00
parent cbbfa39c0b
commit bd880de720
86 changed files with 4328 additions and 0 deletions

36
entry/build.gradle Normal file
View File

@@ -0,0 +1,36 @@
apply plugin: 'com.huawei.ohos.hap'
apply plugin: 'com.huawei.ohos.decctest'
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
ohos {
compileSdkVersion 6
defaultConfig {
compatibleSdkVersion 5
}
buildTypes {
release {
proguardOpt {
proguardEnabled false
rulesFiles 'proguard-rules.pro'
}
}
debug {
proguardOpt {
proguardEnabled true
rulesFiles 'proguard-rules.pro'
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
//testImplementation files('../libs/ImageTracer.jar')
testImplementation 'top.xuegao-tzx:ImageTracerJava:1.1.4.516'
testImplementation 'junit:junit:4.13.1'
ohosTestImplementation 'com.huawei.ohos.testkit:runner:2.0.0.200'
//implementation project(":supersearch")
implementation 'top.xuegao-tzx:SuperSearch:1.2.3.517'
}
decc {
supportType = ['html', 'xml']
}

76
entry/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,76 @@
# config module specific ProGuard rules here.
-dontwarn
# 代码混淆压缩比在0~7之间
-optimizationpasses 15
# 混合时不使用大小写混合,混合后的类名为小写
-dontusemixedcaseclassnames
# 在读取依赖的库文件时不要略过那些非public类成员
-dontskipnonpubliclibraryclassmembers
# 指定不去忽略非公共库的类
-dontskipnonpubliclibraryclasses
# 不做预校验preverify是proguard的四个步骤之一去掉这一步能够加快混淆速度
-dontpreverify
-verbose
# google推荐算法
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
#-dontoptimize#注意在上传时配置,本地无需配置
# 保留注解、内部类、泛型、匿名类
-keepattributes *Annotation*,Exceptions,InnerClasses,Signature,EnclosingMethod
# 重命名抛出异常时的文件名称
-renamesourcefileattribute SourceFile
# 抛出异常时保留代码行号
-keepattributes SourceFile,LineNumberTable
-dontwarn javax.annotation.**
# 保留本地native方法不被混淆
-keepclasseswithmembernames,allowshrinking class * {
native <methods>;
}
# 保留枚举类不被混淆
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
# 保留自定义类
-keep enum com.xcl.supersearch.**
-keep class com.xcl.supersearch.**{*;}
-keep class com.xcl.supersearch.**
-keepclassmembers enum com.xcl.supersearch.**{*;}
-keep interface com.xcl.supersearch.**
# 忽略继承
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
# 保留HMS相关接入[AnalyticsKit SDK和依赖SDK的混淆配置]
-ignorewarnings
-repackageclasses
-keep class com.huawei.agconnect.**{*;}
-keep class com.huawei.hms.analytics.**{*;}
-keep class com.huawei.hms.push.**{*;}
-keep class com.huawei.hms.**{*;}
# HMS接口服务
-keepattributes Exceptions
-keep interface com.huawei.hms.analytics.type.HAEventType{*;}
-keep interface com.huawei.hms.analytics.type.HAParamType{*;}
-keep class com.huawei.hms.analytics.HiAnalyticsInstance{*;}
-keep class com.huawei.hms.analytics.HiAnalytics{*;}
-keep class com.huawei.hianalytics.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.harmony.**{*;}
-keep class com.huawei.mylibrary.**{*;}
# 保留HarmonyOS应用/服务入口类
-keep public class * extends *.aafwk.ability.Ability
-keep public class * extends *.ace.ability.AceAbility
-keep public class * extends *.aafwk.ability.AbilitySlice
-keep public class * extends *.aafwk.ability.AbilityPackage
-dontwarn java.lang.invoke.**
-dontwarn javax.naming.**
-dontwarn ohos.utils.PacMap.**
-keep class **.ResourceTable$* {*;}
-keepattributes Signature, InnerClasses, EnclosingMethod, Exceptions
# 保留配置文件
-printmapping mapping.txt

View File

@@ -0,0 +1,69 @@
{
"app": {
"bundleName": "com.xcl.studyt",
"vendor": "tzx",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {},
"module": {
"package": "com.xcl.search.test",
"name": ".MyApplication",
"mainAbility": "com.xcl.search.test.MainAbility",
"deviceType": [
"phone",
"tablet",
"tv",
"wearable",
"car"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"metaData": {
"customizeData": [
{
"name": "hwc-theme",
"extra": "",
"value": "androidhwext:style/Theme.Emui.Wallpaper.NoTitleBar"
}
]
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"visible": true,
"name": "com.xcl.search.test.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
},
{
"orientation": "unspecified",
"name": "com.xcl.search.test.SearchDemoAbility",
"icon": "$media:icon",
"description": "$string:searchdemoability_description",
"label": "$string:entry_SearchDemoAbility",
"type": "page",
"launchType": "standard"
}
]
}
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright 2022 田梓萱, xcl@xuegao-tzx.top
*
* Licensed under the GNU Affero General Public License, Version 3.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xcl.search.test;
import com.xcl.search.test.slice.MainAbilitySlice;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.agp.window.service.WindowManager;
public class MainAbility extends Ability {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
super.setAbilitySliceAnimator(null);
super.setTransitionAnimation(0, 0);
this.getWindow().addFlags(WindowManager.LayoutConfig.MARK_ALLOW_EXTEND_LAYOUT);
super.setMainRoute(MainAbilitySlice.class.getName());
super.setTransitionAnimation(0, 0);
super.setAbilitySliceAnimator(null);
}
}

View File

@@ -0,0 +1,25 @@
/*
* Copyright 2022 田梓萱, xcl@xuegao-tzx.top
*
* Licensed under the GNU Affero General Public License, Version 3.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xcl.search.test;
import ohos.aafwk.ability.AbilityPackage;
public class MyApplication extends AbilityPackage {
@Override
public void onInitialize() {
super.onInitialize();
}
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright 2022 田梓萱, xcl@xuegao-tzx.top
*
* Licensed under the GNU Affero General Public License, Version 3.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xcl.search.test;
import com.xcl.search.test.slice.SearchDemoAbilitySlice;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.agp.window.service.WindowManager;
public class SearchDemoAbility extends Ability {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
super.setAbilitySliceAnimator(null);
super.setTransitionAnimation(0, 0);
this.getWindow().addFlags(WindowManager.LayoutConfig.MARK_ALLOW_EXTEND_LAYOUT);
super.setMainRoute(SearchDemoAbilitySlice.class.getName());
super.setTransitionAnimation(0, 0);
super.setAbilitySliceAnimator(null);
}
}

View File

@@ -0,0 +1,74 @@
/*
* Copyright 2022 田梓萱, xcl@xuegao-tzx.top
*
* Licensed under the GNU Affero General Public License, Version 3.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xcl.search.test.slice;
import com.xcl.search.test.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.aafwk.content.Operation;
import ohos.agp.components.Component;
import ohos.agp.window.service.WindowManager;
import ohos.utils.net.Uri;
public class MainAbilitySlice extends AbilitySlice {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
super.setUIContent(ResourceTable.Layout_ability_main);
this.getWindow().addFlags(WindowManager.LayoutConfig.MARK_ALLOW_EXTEND_LAYOUT);
this.findComponentById(ResourceTable.Id_withoutSug).setClickedListener(new Component.ClickedListener() {
@Override
public void onClick(Component v) {
Route("withoutSug");
}
});
this.findComponentById(ResourceTable.Id_recentSug).setClickedListener(new Component.ClickedListener() {
@Override
public void onClick(Component v) {
Route("recentSug");
}
});
this.findComponentById(ResourceTable.Id_hasknownSug).setClickedListener(new Component.ClickedListener() {
@Override
public void onClick(Component v) {
Route("hasknownSug");
}
});
}
public void Route(String route) {
Intent intent1 = new Intent();
intent1.setParam("SEARCH_PD", route);
Operation operation = new Intent.OperationBuilder()
.withDeviceId("")
.withBundleName(MainAbilitySlice.this.getBundleName())
.withAbilityName("com.xcl.search.test.SearchDemoAbility")
.build();
intent1.setOperation(operation);
MainAbilitySlice.this.startAbility(intent1);
}
@Override
public void onActive() {
super.onActive();
}
@Override
public void onForeground(Intent intent) {
super.onForeground(intent);
}
}

View File

@@ -0,0 +1,198 @@
/*
* Copyright 2022 田梓萱, xcl@xuegao-tzx.top
*
* Licensed under the GNU Affero General Public License, Version 3.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xcl.search.test.slice;
import com.xcl.search.test.ResourceTable;
import com.xcl.supersearch.SHistoryContactor;
import com.xcl.supersearch.SRContactor;
import com.xcl.supersearch.SearchView;
import com.xcl.supersearch.Utils;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.ListContainer;
import ohos.agp.window.service.WindowManager;
import ohos.data.distributed.common.KvManagerConfig;
import ohos.data.distributed.common.KvManagerFactory;
import ohos.distributedhardware.devicemanager.DeviceInfo;
import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;
import java.util.ArrayList;
import java.util.List;
public class SearchDemoAbilitySlice extends AbilitySlice {
private static final HiLogLabel label = new HiLogLabel(HiLog.LOG_APP, 0x00234, "SearchDemoAbilitySlice");
private int PDD = -2;
private SearchView sV;
private static List<SRContactor> getSearch() {
List<SRContactor> list = new ArrayList<>();
for (int i = 0; i < 15; i++) {
list.add(new SRContactor("zhangsan", "class1", "1", "2你", "3", "4.7"));
}
list.add(new SRContactor("zhtzx5", "clsths2"));//支持只传标题、信息此时后面4个按钮默认不显示
list.add(new SRContactor("zhng", "cl1", null, ",2u", "3g", "7n7"));//支持传null此时传null的将不会显示
list.add(new SRContactor("zhxcl5", null));//支持只传标题同时传null此时后面4个按钮和信息不显示
//TODO:注意:第一个不可为null
list.add(new SRContactor("zhags", "clhhs1", "1操", "2", "3码", "47"));//支持传入全部信息
return list;
}
private static List<SHistoryContactor> getSuggection() {
List<SHistoryContactor> list = new ArrayList<>();
list.add(new SHistoryContactor("小草林", ResourceTable.Media_ic_history_black_24dp, -3));//这里-3代表根据默认图标或xml中配置的图标显示
list.add(new SHistoryContactor("TEST", ResourceTable.Media_ic_history_black_24dp, -1));//这里-1代表根据不显示图标
list.add(new SHistoryContactor("测试", -1, ResourceTable.Media_ic_close_black_24dp));
list.add(new SHistoryContactor("...", ResourceTable.Media_ic_history_black_24dp, ResourceTable.Media_ic_close_black_24dp));
list.add(new SHistoryContactor("test"));//可以只配置建议信息会自动根据默认图标或xml中配置的图标显示
return list;
}
@Override
public void onStart(Intent intent) {
super.onStart(intent);
getWindow().addFlags(WindowManager.LayoutConfig.MARK_ALLOW_EXTEND_LAYOUT);
ohos.data.distributed.device.DeviceInfo localDeviceInfo = KvManagerFactory.getInstance()
.createKvManager(new KvManagerConfig((getContext()))).getLocalDeviceInfo();
int localDeviceType = Integer.parseInt(localDeviceInfo.getType());
if (localDeviceType == DeviceInfo.DeviceType.WEARABLE.value()) {
super.setUIContent(ResourceTable.Layout_ability_search_demow);
} else {
super.setUIContent(ResourceTable.Layout_ability_search_demo);
}
Utils.pd_pd = true;
sV = (SearchView) findComponentById(ResourceTable.Id_searchview);
if (sV == null) {
Utils.info(SearchDemoAbilitySlice.label, "null");
} else {
Utils.info(SearchDemoAbilitySlice.label, "not null");
}
if (intent != null) {
String action = intent.getStringParam("SEARCH_PD");
if ("withoutSug".equals(action)) {
PDD = -1;
} else if ("recentSug".equals(action)) {
PDD = 0;
} else if ("hasknownSug".equals(action)) {
PDD = 1;
}
} else {
terminate();
}
initView();
}
private void initView() {
if (PDD == 0) {
/*sv.Onsearch(getContext(),
(ListContainer) findComponentById(ResourceTable.Id_ListContainer),
sv,
findComponentById(ResourceTable.Id_emptyView),
(com.xcl.supersearch.RoundProgressBar) findComponentById(ResourceTable.Id_progressBar),
getSearch(),
true);*///TODO:方法一无需建议列表只需配置true即可
sV.setContext(getContext())
.setRoundProgressBar((com.xcl.supersearch.RoundProgressBar) findComponentById(ResourceTable.Id_progressBar))
.setSearchView(sV)
.setSRListContainer(SearchDemoAbilitySlice.getSearch())
.setSuggestionisShow(true)
.setBackComponent(findComponentById(ResourceTable.Id_emptyView))
.setListContainer((ListContainer) findComponentById(ResourceTable.Id_ListContainer))
.Builder();//TODO:方法二
} else if (PDD == 1) {
/*sv.Onsearch(getContext(),//获取所在能力的context
(ListContainer) findComponentById(ResourceTable.Id_ListContainer),//根据id获取并绑定结果列表展示控件
sv,//根据id绑定控件
findComponentById(ResourceTable.Id_emptyView),//根据id获取并绑定背景展示控件
(com.xcl.supersearch.RoundProgressBar) findComponentById(ResourceTable.Id_progressBar),//根据id获取并绑定背景Loading加载动画控件
getSearch(),//传入搜索的数据
getSuggection(),//传入搜索建议的数据,如果不配置这个,则不会自带搜索建议
true);//是否开启搜索建议
*///TODO:方法一
sV.setContext(getContext())//设置所在能力的context
.setRoundProgressBar((com.xcl.supersearch.RoundProgressBar) findComponentById(ResourceTable.Id_progressBar))//设置背景Loading加载动画控件
.setSearchView(sV)//设置搜索控件
.setSRListContainer(SearchDemoAbilitySlice.getSearch())//传入搜索的数据
.setSuggestionisShow(true)//设置是否开启搜索建议
.setSuggestionList(SearchDemoAbilitySlice.getSuggection())//设置搜索建议的数据
.setBackComponent(findComponentById(ResourceTable.Id_emptyView))//设置背景展示控件
.setListContainer((ListContainer) findComponentById(ResourceTable.Id_ListContainer))//设置结果列表展示控件
.Builder();//执行构造
//TODO:方法二
} else if (PDD == -1) {
sV.setContext(getContext())
.setRoundProgressBar((com.xcl.supersearch.RoundProgressBar) findComponentById(ResourceTable.Id_progressBar))
.setSearchView(sV)
.setSRListContainer(SearchDemoAbilitySlice.getSearch())
.setBackComponent(findComponentById(ResourceTable.Id_emptyView))
.setListContainer((ListContainer) findComponentById(ResourceTable.Id_ListContainer))
.Builder();//TODO:方法二
/*sv.Onsearch(getContext(),
(ListContainer) findComponentById(ResourceTable.Id_ListContainer),
sv,
findComponentById(ResourceTable.Id_emptyView),
(com.xcl.supersearch.RoundProgressBar) findComponentById(ResourceTable.Id_progressBar),
getSearch());*///TODO:方法一,不配置默认不开启搜索建议
}
sV.setCustomListener(new SearchView.CustomListener() {
@Override
public void onFilter(String filter) {
//TODO:右上角的按钮事件
}
});
sV.setBt1Listener(new SearchView.Bt1Listener() {
@Override
public void onbT1(int position) {
HiLog.error(SearchDemoAbilitySlice.label, "点击了按钮1其的行号为" + position + 1);
//TODO:一行列表第一个的按钮事件
}
});
sV.setBackClickListener(new SearchView.BackClickListener() {
@Override
public void onBackClick() {
terminate();
//TODO:左上角的按钮事件
}
});
sV.setNullWarnListener(new SearchView.NullWarnListener() {
@Override
public void onNullError() {
HiLog.error(SearchDemoAbilitySlice.label, "空搜索警告1");
//TODO:支持自定义空搜索警告
}
});
sV.setNoneWarnListener(new SearchView.NoneWarnListener() {
@Override
public void onNullWarn() {
HiLog.error(SearchDemoAbilitySlice.label, "空结果警告1");
//TODO:支持自定义空结果警告
}
});
}
@Override
public void onActive() {
super.onActive();
}
@Override
public void onForeground(Intent intent) {
super.onForeground(intent);
}
}

View File

@@ -0,0 +1,64 @@
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "mainability_description",
"value": "Java_Empty Ability"
},
{
"name": "mainability_HelloWorld",
"value": "Hello World"
},
{
"name": "searchmr",
"value": "搜索默认页面"
},
{
"name": "withoutSug",
"value": "无建议搜索"
},
{
"name": "recentSug",
"value": "有最近建议搜索"
},
{
"name": "hasknownSug",
"value": "有已知建议搜索"
},
{
"name": "suggestion_text",
"value": "建议文本"
},
{
"name": "search_hint_text",
"value": "搜索..."
},
{
"name": "search_hint_text_",
"value": "搜索."
},
{
"name": "search_input_null",
"value": "搜索值为空"
},
{
"name": "search_answer_none",
"value": "搜索结果为空"
},
{
"name": "searchdemoability_description",
"value": "Java_Empty Ability"
},
{
"name": "searchdemoability_HelloWorld",
"value": "Hello World"
},
{
"name": "entry_SearchDemoAbility",
"value": "entry_SearchDemoAbility"
}
]
}

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<shape
xmlns:ohos="http://schemas.huawei.com/res/ohos"
ohos:shape="rectangle">
<solid
ohos:color="#FFFFFF"/>
</shape>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<shape
xmlns:ohos="http://schemas.huawei.com/res/ohos"
ohos:shape="rectangle">
<solid
ohos:color="#F8D4C9C9"/>
</shape>

View File

@@ -0,0 +1,12 @@
<!-- drawable/arrow_left.xml -->
<vector
xmlns:ohos="http://schemas.huawei.com/res/ohos"
ohos:height="24vp"
ohos:width="24vp"
ohos:viewportHeight="24"
ohos:viewportWidth="24">
<path
ohos:fillColor="#FFD2D257"
ohos:pathData="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z"/>
</vector>

View File

@@ -0,0 +1,12 @@
<!-- drawable/close.xml -->
<vector
xmlns:ohos="http://schemas.huawei.com/res/ohos"
ohos:height="24vp"
ohos:width="24vp"
ohos:viewportHeight="24"
ohos:viewportWidth="24">
<path
ohos:fillColor="#FF391D3C"
ohos:pathData="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"/>
</vector>

View File

@@ -0,0 +1,12 @@
<!-- drawable/filter_variant.xml -->
<vector
xmlns:ohos="http://schemas.huawei.com/res/ohos"
ohos:height="24vp"
ohos:width="24vp"
ohos:viewportHeight="24"
ohos:viewportWidth="24">
<path
ohos:fillColor="#FFFF0000"
ohos:pathData="M6,13H18V11H6M3,6V8H21V6M10,18H14V16H10V18Z"/>
</vector>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<vector
xmlns:ohos="http://schemas.huawei.com/res/ohos"
ohos:height="72vp"
ohos:width="72vp"
ohos:viewportHeight="72"
ohos:viewportWidth="72">
<path
ohos:fillAlpha="0.011764706"
ohos:fillColor="#000000"
ohos:pathData="M0.5,0L72,0.5L71.5,72L0,71.5L0.5,0Z"
ohos:strokeAlpha="0.011764706"
ohos:strokeColor="#000000"
ohos:strokeWidth="1"></path>
<path
ohos:fillAlpha="0.972549"
ohos:fillColor="#000000"
ohos:pathData="M34.5,9Q44.8,7.8 50,11.5L60,18.5Q67,25.5 66,40.5Q63.5,51 56.5,57Q49.5,64 34.5,63Q25.6,60.9 20,55.5L23.5,51Q29.2,57.8 42.5,57Q52.5,55 57,47.5L59.5,40L60,32.5Q58,22.5 50.5,18L43,15.5L34.5,15Q25.5,17.5 21,24.5L18.5,31L18,35.5L27,36.5L14.5,48L3.5,36L12,35.5L12.5,31L14.5,25L21.5,15L34.5,9Z"
ohos:strokeAlpha="0.972549"
ohos:strokeColor="#000000"
ohos:strokeWidth="1"></path>
<path
ohos:fillAlpha="0.972549"
ohos:fillColor="#000000"
ohos:pathData="M36.5,24L41,24.5L41,33.5Q40.3,38.3 43.5,39L51,43.5L49.5,46L44.5,44L36,38.5L36.5,24Z"
ohos:strokeAlpha="0.972549"
ohos:strokeColor="#000000"
ohos:strokeWidth="1"></path>
</vector>

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<DependentLayout
xmlns:ohos="http://schemas.huawei.com/res/ohos"
ohos:height="match_parent"
ohos:width="match_parent"
ohos:alignment="center"
ohos:background_element="#F8D4C9C9"
ohos:orientation="vertical"
ohos:padding="10vp">
<DirectionalLayout
ohos:height="match_content"
ohos:width="match_content"
ohos:alignment="horizontal_center"
ohos:center_in_parent="true"
ohos:orientation="vertical">
<Button
ohos:id="$+id:withoutSug"
ohos:height="match_content"
ohos:width="match_content"
ohos:background_element="#AD5F9EE3"
ohos:padding="10vp"
ohos:text="$string:withoutSug"
ohos:text_size="16vp"
ohos:text_weight="800"/>
<Button
ohos:id="$+id:recentSug"
ohos:height="match_content"
ohos:width="match_content"
ohos:background_element="#AD5F9EE3"
ohos:padding="10vp"
ohos:text="$string:recentSug"
ohos:text_size="16vp"
ohos:text_weight="800"
ohos:top_margin="10vp"/>
<Button
ohos:id="$+id:hasknownSug"
ohos:height="match_content"
ohos:width="match_content"
ohos:background_element="#AD5F9EE3"
ohos:padding="10vp"
ohos:text="$string:hasknownSug"
ohos:text_size="16vp"
ohos:text_weight="800"
ohos:top_margin="10vp"/>
</DirectionalLayout>
</DependentLayout>

View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<DependentLayout
xmlns:ohos="http://schemas.huawei.com/res/ohos"
xmlns:app="http://schemas.huawei.com/app/res/ohos"
ohos:height="match_parent"
ohos:width="match_parent"
ohos:background_element="#F8D4C9C9"
ohos:top_padding="50vp">
<ListContainer
ohos:id="$+id:ListContainer"
ohos:height="match_parent"
ohos:width="match_parent"
ohos:background_element="#C88D8888"
ohos:bottom_padding="16vp"
ohos:color="#FF4C29CB"
ohos:left_padding="15vp"
ohos:orientation="vertical"
ohos:right_padding="15vp"
ohos:top_padding="60vp"
/>
<DirectionalLayout
ohos:id="$+id:emptyView"
ohos:height="match_content"
ohos:width="match_content"
ohos:padding="10vp"
ohos:center_in_parent="true"
ohos:orientation="vertical"
>
<Text
ohos:id="$+id:text_back"
ohos:height="match_content"
ohos:width="match_content"
ohos:background_element="$graphic:background_ability_search_demo"
ohos:layout_alignment="horizontal_center"
ohos:text="$string:searchmr"
ohos:text_size="30vp"
/>
</DirectionalLayout>
<com.xcl.supersearch.RoundProgressBar
ohos:id="$id:progressBar"
ohos:height="50vp"
ohos:width="50vp"
ohos:center_in_parent="true"
ohos:visibility="hide"
app:round_progress_color="#FF82F8EF"
app:round_progress_with="5f"
/>
<com.xcl.supersearch.SearchView
ohos:id="$+id:searchview"
ohos:height="match_parent"
ohos:width="match_parent"
ohos:left_padding="15vp"
ohos:padding="5vp"
ohos:right_padding="15vp"
ohos:visibility="visible"
app:background_mask_degree="0.35f"
app:delete_search_history="$graphic:ic_close"
app:isDebugEnabled="true"
app:isrightButton_ClearEnabled="true"
app:leftButton_Back="$graphic:ic_arrow_left"
app:leftButton_Loadding_color="#FF1300FF"
app:noneWarnByMySelf="true"
app:none_warn_text="$string:search_answer_none"
app:none_warn_text_color="#5CFF0000"
app:nullWarnByMySelf="true"
app:null_warn_text="$string:search_input_null"
app:null_warn_text_color="#79FF006E"
app:queryInput_background_color="#FFF8F3EC"
app:queryInput_buttom_color="#A18770B1"
app:queryInput_cursor_color="#FF8377FF"
app:queryInput_hint_color="#FFFF0000"
app:queryInput_hint_text="$string:search_hint_text"
app:queryInput_text_color="#FF6B16FF"
app:queryRadius="5vp"
app:rightButton_Clear="$graphic:ic_close"
app:search_history="$graphic:ic_history_black"
app:suggestion_count="6"
/>
</DependentLayout>

View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<DependentLayout
xmlns:ohos="http://schemas.huawei.com/res/ohos"
xmlns:app="http://schemas.huawei.com/app/res/ohos"
ohos:height="match_parent"
ohos:width="match_parent"
ohos:background_element="#F8D4C9C9">
<ListContainer
ohos:id="$+id:ListContainer"
ohos:height="match_parent"
ohos:width="match_parent"
ohos:background_element="#F8D4C9C9"
ohos:bottom_padding="43.5vp"
ohos:color="#FF4C29CB"
ohos:left_padding="26.5vp"
ohos:orientation="vertical"
ohos:right_padding="26.5vp"
ohos:top_padding="60vp"
/>
<DirectionalLayout
ohos:id="$+id:emptyView"
ohos:height="match_content"
ohos:width="match_content"
ohos:center_in_parent="true"
ohos:orientation="vertical"
>
<Text
ohos:id="$+id:text_back"
ohos:height="match_content"
ohos:width="match_content"
ohos:background_element="$graphic:background_ability_search_demo"
ohos:layout_alignment="horizontal_center"
ohos:text="$string:searchmr"
ohos:text_size="15vp"
/>
</DirectionalLayout>
<com.xcl.supersearch.RoundProgressBar
ohos:id="$id:progressBar"
ohos:height="25vp"
ohos:width="25vp"
ohos:center_in_parent="true"
ohos:visibility="hide"
app:round_progress_color="#FF82F8EF"
app:round_progress_with="3f"
/>
<com.xcl.supersearch.SearchView
ohos:id="$+id:searchview"
ohos:height="match_parent"
ohos:width="match_parent"
ohos:bottom_padding="40vp"
ohos:left_padding="34vp"
ohos:right_padding="34vp"
ohos:top_padding="35.5vp"
ohos:visibility="visible"
app:background_mask_color="#75B5D290"
app:background_mask_degree="0.35f"
app:delete_search_history="$graphic:ic_close"
app:isDebugEnabled="true"
app:isWearable="true"
app:isrightButton_ClearEnabled="true"
app:leftButton_Back="$graphic:ic_arrow_left"
app:leftButton_Loadding_color="#FF1300FF"
app:noneWarnByMySelf="true"
app:none_warn_text="$string:search_answer_none"
app:none_warn_text_color="#5CFF0000"
app:nullWarnByMySelf="true"
app:null_warn_text="$string:search_input_null"
app:null_warn_text_color="#79FF006E"
app:queryInput_background_color="#FFF8F3EC"
app:queryInput_buttom_color="#A18770B1"
app:queryInput_cursor_color="#FF8377FF"
app:queryInput_hint_color="#FFFF0000"
app:queryInput_hint_text="$string:search_hint_text"
app:queryInput_text_color="#FF6B16FF"
app:queryRadius="3vp"
app:rightButton_Clear="$graphic:ic_close"
app:search_history="$graphic:ic_history_black"
app:suggestion_count="6"
/>
</DependentLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@@ -0,0 +1,64 @@
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "mainability_description",
"value": "Java_Empty Ability"
},
{
"name": "mainability_HelloWorld",
"value": "你好,世界"
},
{
"name": "searchmr",
"value": "搜索默认页面"
},
{
"name": "withoutSug",
"value": "无建议搜索"
},
{
"name": "recentSug",
"value": "有最近建议搜索"
},
{
"name": "hasknownSug",
"value": "有已知建议搜索"
},
{
"name": "suggestion_text",
"value": "建议文本"
},
{
"name": "search_hint_text",
"value": "搜索..."
},
{
"name": "search_hint_text_",
"value": "搜索."
},
{
"name": "search_input_null",
"value": "搜索值为空"
},
{
"name": "search_answer_none",
"value": "搜索结果为空"
},
{
"name": "entry_SearchDemoAbility",
"value": "entry_SearchDemoAbility"
},
{
"name": "searchdemoability_description",
"value": "Java_Empty Ability"
},
{
"name": "searchdemoability_HelloWorld",
"value": "你好,世界"
}
]
}

View File

@@ -0,0 +1,14 @@
package com.xcl.search.test;
import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class ExampleOhosTest {
@Test
public void testBundleName() {
final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName();
assertEquals("com.xcl.search.test", actualBundleName);
}
}

View File

@@ -0,0 +1,49 @@
package com.xcl.search.test;
import com.xcl.imagetracer_mod.ImageTracer;
import org.junit.Test;
import java.util.HashMap;
public class ExampleTest {
@Test
public void onStart() throws Exception {
// Options
HashMap<String, Float> options = new HashMap<String, Float>();
// Tracing
options.put("ltres", 1f);
options.put("qtres", 1f);
options.put("pathomit", 8f);
// Color quantization
options.put("colorsampling", 1f); // 1f means true ; 0f means false: starting with generated palette
options.put("numberofcolors", 16f);
options.put("mincolorratio", 0.02f);
options.put("colorquantcycles", 3f);
// SVG rendering
options.put("scale", 1f);
options.put("roundcoords", 1f); // 1f means rounded to 1 decimal places, like 7.3 ; 3f means rounded to 3 places, like 7.356 ; etc.
options.put("lcpr", 0f);
options.put("qcpr", 0f);
options.put("desc", 1f); // 1f means true ; 0f means false: SVG descriptions deactivated
options.put("viewbox", 0f); // 1f means true ; 0f means false: fixed width and height
// Selective Gauss Blur
options.put("blurradius", 0f); // 0f means deactivated; 1f .. 5f : blur with this radius
options.put("blurdelta", 20f); // smaller than this RGB difference will be blurred
// Palette
// This is an example of a grayscale palette
// please note that signed byte values [ -128 .. 127 ] will be converted to [ 0 .. 255 ] in the getsvgstring function
//下方的两个数字16请参照实际图片动态调整以实现最佳效果
byte[][] palette = new byte[16][4];
for (int colorcnt = 0; colorcnt < 16; colorcnt++) {
palette[colorcnt][0] = (byte) (-128 + colorcnt * 32); // R
palette[colorcnt][1] = (byte) (-128 + colorcnt * 32); // G
palette[colorcnt][2] = (byte) (-128 + colorcnt * 32); // B
palette[colorcnt][3] = (byte) 127; // A
}
ImageTracer.saveString(
"src\\main\\resources\\base\\media\\ic_close_black_24dp.svg",
ImageTracer.imageToSVG("src\\main\\resources\\base\\media\\ic_close_black_24dp.png", options, palette)
);
}
}