28
supersearch/build.gradle
Normal file
@@ -0,0 +1,28 @@
|
||||
apply plugin: 'com.huawei.ohos.library'
|
||||
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
|
||||
//apply from: './upload.gradle'
|
||||
ohos {
|
||||
compileSdkVersion 6
|
||||
defaultConfig {
|
||||
compatibleSdkVersion 5
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
proguardOpt {
|
||||
proguardEnabled false
|
||||
rulesFiles 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
debug {
|
||||
proguardOpt {
|
||||
proguardEnabled false
|
||||
rulesFiles 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
testImplementation 'junit:junit:4.13.1'
|
||||
}
|
1
supersearch/consumer-rules.pro
Normal file
@@ -0,0 +1 @@
|
||||
# Add har specific ProGuard rules for consumer here.
|
35
supersearch/src/main/config.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.xcl.search",
|
||||
"vendor": "xcl",
|
||||
"version": {
|
||||
"code": 220517,
|
||||
"name": "1.2.3.517"
|
||||
}
|
||||
},
|
||||
"deviceConfig": {
|
||||
},
|
||||
"module": {
|
||||
"package": "com.xcl.supersearch",
|
||||
"deviceType": [
|
||||
"phone",
|
||||
"tablet",
|
||||
"tv",
|
||||
"wearable"
|
||||
],
|
||||
"distro": {
|
||||
"deliveryWithInstall": true,
|
||||
"moduleName": "supersearch",
|
||||
"moduleType": "har"
|
||||
},
|
||||
"metaData": {
|
||||
"customizeData": [
|
||||
{
|
||||
"name": "hwc-theme",
|
||||
"extra": "",
|
||||
"value": "androidhwext:style/Theme.Emui.Wallpaper.NoTitleBar"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* 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.supersearch;
|
||||
|
||||
import ohos.agp.animation.Animator;
|
||||
import ohos.agp.animation.AnimatorValue;
|
||||
import ohos.agp.components.ComponentContainer;
|
||||
import ohos.agp.components.element.Element;
|
||||
|
||||
public final class BackgroundLoadingAnimation {
|
||||
private boolean isRecycled;
|
||||
|
||||
private float fromAlpha;
|
||||
private float toAlpha;
|
||||
|
||||
private ComponentContainer view;
|
||||
|
||||
private AnimatorValue animator;
|
||||
|
||||
public BackgroundLoadingAnimation(ComponentContainer view, float fromAlpha, float toAlpha) {
|
||||
this.view = view;
|
||||
this.fromAlpha = fromAlpha;
|
||||
this.toAlpha = toAlpha;
|
||||
this.isRecycled = false;
|
||||
initAnimator();
|
||||
}
|
||||
|
||||
private void initAnimator() {
|
||||
animator = new AnimatorValue();
|
||||
animator.setDuration(200);
|
||||
animator.setCurveType(Animator.CurveType.LINEAR);
|
||||
animator.setValueUpdateListener((valueAnimator, v) -> {
|
||||
Element element = view.getBackgroundElement();
|
||||
element.setAlpha((int) (fromAlpha * 0xFF + (toAlpha - fromAlpha) * 0xFF * v));
|
||||
}
|
||||
);
|
||||
animator.setStateChangedListener(new Animator.StateChangedListener() {
|
||||
@Override
|
||||
public void onStart(Animator animator) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop(Animator animator) {
|
||||
view.setClickable(toAlpha != 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(Animator animator) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnd(Animator animator) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause(Animator animator) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(Animator animator) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public BackgroundLoadingAnimation setFromAlpha(float fromAlpha) {
|
||||
this.fromAlpha = fromAlpha;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public BackgroundLoadingAnimation setToAlpha(float toAlpha) {
|
||||
this.toAlpha = toAlpha;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public BackgroundLoadingAnimation setInterpolator(int interpolator) {
|
||||
animator.setCurveType(interpolator);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public BackgroundLoadingAnimation setDuration(long duration) {
|
||||
animator.setDuration(duration);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public void start() {
|
||||
if (isRecycled() || view.getAlpha() == toAlpha) {
|
||||
return;
|
||||
}
|
||||
|
||||
stop();
|
||||
animator.start();
|
||||
}
|
||||
|
||||
|
||||
public void stop() {
|
||||
if (!isRecycled() && isRunning()) {
|
||||
animator.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isRunning() {
|
||||
return animator.isRunning();
|
||||
}
|
||||
|
||||
|
||||
public void recycle() {
|
||||
if (isRecycled) {
|
||||
return;
|
||||
}
|
||||
|
||||
view = null;
|
||||
animator = null;
|
||||
isRecycled = true;
|
||||
}
|
||||
|
||||
|
||||
public boolean isRecycled() {
|
||||
return isRecycled;
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* 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.supersearch;
|
||||
|
||||
import ohos.agp.components.*;
|
||||
import ohos.app.Context;
|
||||
import ohos.hiviewdfx.HiLog;
|
||||
import ohos.hiviewdfx.HiLogLabel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.xcl.supersearch.Utils.iswear;
|
||||
|
||||
|
||||
public class ContactProviderSR extends BaseItemProvider {
|
||||
private static final HiLogLabel label = new HiLogLabel(HiLog.LOG_APP, 0x00666, "ContactProviderSR");
|
||||
private final Context context;
|
||||
private List<SRContactor> contactArrays = new ArrayList<>(0);
|
||||
private AdapterClickListener adapterClickListener;
|
||||
|
||||
public ContactProviderSR(Context context, List<SRContactor> contactArrays) {
|
||||
this.context = context;
|
||||
this.contactArrays = contactArrays;
|
||||
}
|
||||
|
||||
public ContactProviderSR(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return this.contactArrays == null ? 0 : this.contactArrays.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SRContactor getItem(int position) {
|
||||
if (position < this.contactArrays.size() && position >= 0) return this.contactArrays.get(position);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getComponent(int position, Component componentPara, ComponentContainer componentContainer) {
|
||||
Component component = componentPara;
|
||||
try {
|
||||
ViewHolder viewHolder = null;
|
||||
if (component == null) {
|
||||
if (iswear) {
|
||||
component = LayoutScatter.getInstance(this.context).parse(ResourceTable.Layout_searchresw,
|
||||
null, false);
|
||||
} else {
|
||||
component = LayoutScatter.getInstance(this.context).parse(ResourceTable.Layout_searchres,
|
||||
null, false);
|
||||
}
|
||||
viewHolder = new ViewHolder();
|
||||
viewHolder.button1 = (Button) component.findComponentById(ResourceTable.Id_button1);
|
||||
viewHolder.button2 = (Button) component.findComponentById(ResourceTable.Id_button2);
|
||||
viewHolder.button3 = (Button) component.findComponentById(ResourceTable.Id_button3);
|
||||
viewHolder.button4 = (Button) component.findComponentById(ResourceTable.Id_button4);
|
||||
viewHolder.text2 = (Text) component.findComponentById(ResourceTable.Id_message);
|
||||
viewHolder.text1 = (Text) component.findComponentById(ResourceTable.Id_title);
|
||||
component.setTag(viewHolder);
|
||||
} else if (component.getTag() instanceof ViewHolder) viewHolder = (ViewHolder) component.getTag();
|
||||
if (viewHolder != null) {
|
||||
viewHolder.text1.setVisibility(Component.VISIBLE);
|
||||
viewHolder.text2.setVisibility(Component.VISIBLE);
|
||||
viewHolder.button1.setVisibility(Component.VISIBLE);
|
||||
viewHolder.button2.setVisibility(Component.VISIBLE);
|
||||
viewHolder.button3.setVisibility(Component.VISIBLE);
|
||||
viewHolder.button4.setVisibility(Component.VISIBLE);
|
||||
if (this.contactArrays.get(position).getBt1() != null) {
|
||||
viewHolder.button1.setText(this.contactArrays.get(position).getBt1());
|
||||
} else {
|
||||
viewHolder.button1.setVisibility(Component.HIDE);
|
||||
}
|
||||
viewHolder.button1.setClickedListener(new Component.ClickedListener() {
|
||||
@Override
|
||||
public void onClick(Component deleteComponent) {
|
||||
if (ContactProviderSR.this.adapterClickListener != null)
|
||||
ContactProviderSR.this.adapterClickListener.ann1(position);
|
||||
}
|
||||
});
|
||||
if (this.contactArrays.get(position).getBt2() != null) {
|
||||
viewHolder.button2.setText(this.contactArrays.get(position).getBt2());
|
||||
} else {
|
||||
viewHolder.button2.setVisibility(Component.HIDE);
|
||||
}
|
||||
viewHolder.button2.setClickedListener(new Component.ClickedListener() {
|
||||
@Override
|
||||
public void onClick(Component deleteComponent) {
|
||||
if (ContactProviderSR.this.adapterClickListener != null)
|
||||
ContactProviderSR.this.adapterClickListener.ann2(position);
|
||||
}
|
||||
});
|
||||
if (this.contactArrays.get(position).getBt3() != null) {
|
||||
viewHolder.button3.setText(this.contactArrays.get(position).getBt3());
|
||||
} else {
|
||||
viewHolder.button3.setVisibility(Component.HIDE);
|
||||
}
|
||||
viewHolder.button3.setClickedListener(new Component.ClickedListener() {
|
||||
@Override
|
||||
public void onClick(Component deleteComponent) {
|
||||
if (ContactProviderSR.this.adapterClickListener != null)
|
||||
ContactProviderSR.this.adapterClickListener.ann3(position);
|
||||
}
|
||||
});
|
||||
if (this.contactArrays.get(position).getBt4() != null) {
|
||||
viewHolder.button4.setText(this.contactArrays.get(position).getBt4());
|
||||
} else {
|
||||
viewHolder.button4.setVisibility(Component.HIDE);
|
||||
}
|
||||
viewHolder.button4.setClickedListener(new Component.ClickedListener() {
|
||||
@Override
|
||||
public void onClick(Component deleteComponent) {
|
||||
if (ContactProviderSR.this.adapterClickListener != null)
|
||||
ContactProviderSR.this.adapterClickListener.ann4(position);
|
||||
}
|
||||
});
|
||||
if (this.contactArrays.get(position).getTitle() != null) {
|
||||
viewHolder.text1.setText(this.contactArrays.get(position).getTitle());
|
||||
} else {
|
||||
viewHolder.text1.setVisibility(Component.HIDE);
|
||||
}
|
||||
if (this.contactArrays.get(position).getMessage() != null) {
|
||||
viewHolder.text2.setText(this.contactArrays.get(position).getMessage());
|
||||
} else {
|
||||
viewHolder.text2.setVisibility(Component.HIDE);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Utils.error(label, e.getMessage());
|
||||
}
|
||||
return component;
|
||||
}
|
||||
|
||||
void setAdapterClickListener(AdapterClickListener adapterClickListener) {
|
||||
this.adapterClickListener = adapterClickListener;
|
||||
}
|
||||
|
||||
public void setData(List<SRContactor> listData) {
|
||||
contactArrays = listData;
|
||||
}
|
||||
|
||||
public interface AdapterClickListener {
|
||||
void ann1(int position);
|
||||
|
||||
void ann2(int position);
|
||||
|
||||
void ann3(int position);
|
||||
|
||||
void ann4(int position);
|
||||
}
|
||||
|
||||
private static class ViewHolder {
|
||||
private Text text1;
|
||||
private Text text2;
|
||||
private Button button1;
|
||||
private Button button2;
|
||||
private Button button3;
|
||||
private Button button4;
|
||||
}
|
||||
}
|
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* 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.supersearch;
|
||||
|
||||
import ohos.agp.components.AttrSet;
|
||||
import ohos.agp.components.Component;
|
||||
import ohos.agp.render.Arc;
|
||||
import ohos.agp.render.Canvas;
|
||||
import ohos.agp.render.Paint;
|
||||
import ohos.agp.utils.Color;
|
||||
import ohos.agp.utils.RectFloat;
|
||||
import ohos.agp.window.service.Display;
|
||||
import ohos.agp.window.service.DisplayAttributes;
|
||||
import ohos.agp.window.service.DisplayManager;
|
||||
import ohos.app.Context;
|
||||
import ohos.hiviewdfx.HiLog;
|
||||
import ohos.hiviewdfx.HiLogLabel;
|
||||
|
||||
import static com.xcl.supersearch.Utils.*;
|
||||
|
||||
public class RoundProgressBar extends Component implements Component.DrawTask {
|
||||
private static final HiLogLabel label = new HiLogLabel(HiLog.LOG_APP, 0x00234, "RoundProgressBar");
|
||||
private final DisplayAttributes displayAttributes;
|
||||
private int backgroundColor = Color.getIntColor("#FF4C29CB");//默认紫色背景
|
||||
private int arcD = 1;
|
||||
private int arcO = 0;
|
||||
private float rotateAngle = 0;
|
||||
private int limite = 0;
|
||||
private Paint arcPaint;
|
||||
private float STROKE_WITH_VP = 3f;
|
||||
|
||||
public RoundProgressBar(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public RoundProgressBar(Context context, AttrSet attrSet) {
|
||||
this(context, attrSet, "");
|
||||
}
|
||||
|
||||
public RoundProgressBar(Context context, AttrSet attrSet, String styleName) {
|
||||
super(context, attrSet, styleName);
|
||||
DisplayManager displayManager = DisplayManager.getInstance();
|
||||
Display display = displayManager.getDefaultDisplay(this.getContext()).get();
|
||||
displayAttributes = display.getAttributes();
|
||||
setAttributes(attrSet);
|
||||
addDrawTask(this);
|
||||
initPaint();
|
||||
}
|
||||
|
||||
protected void initPaint() {
|
||||
try {
|
||||
arcPaint = new Paint();
|
||||
arcPaint.setAntiAlias(true);
|
||||
arcPaint.setStyle(Paint.Style.STROKE_STYLE);
|
||||
} catch (Exception e) {
|
||||
Utils.error(label, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
protected void setAttributes(AttrSet attrs) {
|
||||
try {
|
||||
setMinHeight(vpToPx(32, displayAttributes));
|
||||
setMinWidth(vpToPx(32, displayAttributes));
|
||||
if (attrs != null) {
|
||||
String background = null;
|
||||
if (background != null) {
|
||||
setBackgroundColor(Color.getIntColor(background));
|
||||
}
|
||||
backgroundColor = getColor(attrs, "round_progress_color", backgroundColor);
|
||||
STROKE_WITH_VP = getFloat(attrs, "round_progress_with", STROKE_WITH_VP);
|
||||
}
|
||||
setMinHeight(vpToPx(3, displayAttributes));
|
||||
} catch (Exception e) {
|
||||
Utils.error(label, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void drawAnimation(Canvas canvas) {
|
||||
try {
|
||||
int halfWidth = getWidth() / 2;
|
||||
int halfHeight = getHeight() / 2;
|
||||
if (arcO == limite) {
|
||||
arcD += 6;
|
||||
}
|
||||
if (arcD >= 290 || arcO > limite) {
|
||||
arcO += 6;
|
||||
arcD -= 6;
|
||||
}
|
||||
if (arcO > limite + 290) {
|
||||
limite = arcO;
|
||||
arcO = limite;
|
||||
arcD = 1;
|
||||
}
|
||||
rotateAngle += 4;
|
||||
canvas.rotate(rotateAngle, halfWidth, halfHeight);
|
||||
int strokeWith = vpToPx(STROKE_WITH_VP, displayAttributes);
|
||||
int halfStrokeWith = vpToPx(STROKE_WITH_VP / 2f, displayAttributes);
|
||||
arcPaint.setStrokeWidth(strokeWith);
|
||||
arcPaint.setColor(new Color(backgroundColor));
|
||||
canvas.drawArc(new RectFloat(halfStrokeWith, halfStrokeWith, getWidth() - halfStrokeWith, getHeight() - halfStrokeWith),
|
||||
new Arc(arcO, arcD, false), arcPaint);
|
||||
getContext().getUITaskDispatcher().asyncDispatch(this::invalidate);
|
||||
} catch (Exception e) {
|
||||
Utils.error(label, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void setBackgroundColor(int color) {
|
||||
backgroundColor = color;
|
||||
getContext().getUITaskDispatcher().asyncDispatch(this::invalidate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Component component, Canvas canvas) {
|
||||
drawAnimation(canvas);
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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.supersearch;
|
||||
|
||||
|
||||
public class SHistoryContactor {
|
||||
private String searchValue;
|
||||
private int searchIcon = -1;
|
||||
private int removeIcon = -1;
|
||||
|
||||
public SHistoryContactor(String searchValue, int searchIcon, int removeIcon) {
|
||||
this.searchValue = searchValue;
|
||||
this.searchIcon = searchIcon;
|
||||
this.removeIcon = removeIcon;
|
||||
}
|
||||
|
||||
public SHistoryContactor(String searchValue) {
|
||||
this.searchValue = searchValue;
|
||||
this.searchIcon = -3;
|
||||
this.removeIcon = -3;
|
||||
}
|
||||
|
||||
public String getSearchValue() {
|
||||
return searchValue;
|
||||
}
|
||||
|
||||
public void setSearchValue(String searchValue) {
|
||||
this.searchValue = searchValue;
|
||||
}
|
||||
|
||||
public int getSearchIcon() {
|
||||
return searchIcon;
|
||||
}
|
||||
|
||||
public void setSearchIcon(int searchIcon) {
|
||||
this.searchIcon = searchIcon;
|
||||
}
|
||||
|
||||
public int getRemoveIcon() {
|
||||
return removeIcon;
|
||||
}
|
||||
|
||||
public void setRemoveIcon(int removeIcon) {
|
||||
this.removeIcon = removeIcon;
|
||||
}
|
||||
}
|
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* 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.supersearch;
|
||||
|
||||
public class SRContactor {
|
||||
private String title = null;
|
||||
private String message = null;
|
||||
private String bt1 = null;
|
||||
private String bt2 = null;
|
||||
private String bt3 = null;
|
||||
private String bt4 = null;
|
||||
|
||||
public SRContactor(String title, String message, String bt1, String bt2, String bt3, String bt4) {
|
||||
this.title = title;
|
||||
this.message = message;
|
||||
this.bt1 = bt1;
|
||||
this.bt2 = bt2;
|
||||
this.bt3 = bt3;
|
||||
this.bt4 = bt4;
|
||||
}
|
||||
|
||||
public SRContactor(String title, String bt1, String bt2, String bt3, String bt4) {
|
||||
this.title = title;
|
||||
this.bt1 = bt1;
|
||||
this.bt2 = bt2;
|
||||
this.bt3 = bt3;
|
||||
this.bt4 = bt4;
|
||||
}
|
||||
|
||||
public SRContactor(String title, String message) {
|
||||
this.title = title;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getBt1() {
|
||||
return bt1;
|
||||
}
|
||||
|
||||
public void setBt1(String bt1) {
|
||||
this.bt1 = bt1;
|
||||
}
|
||||
|
||||
public String getBt2() {
|
||||
return bt2;
|
||||
}
|
||||
|
||||
public void setBt2(String bt2) {
|
||||
this.bt2 = bt2;
|
||||
}
|
||||
|
||||
public String getBt3() {
|
||||
return bt3;
|
||||
}
|
||||
|
||||
public void setBt3(String bt3) {
|
||||
this.bt3 = bt3;
|
||||
}
|
||||
|
||||
public String getBt4() {
|
||||
return bt4;
|
||||
}
|
||||
|
||||
public void setBt4(String bt4) {
|
||||
this.bt4 = bt4;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getCXinxi() {
|
||||
return title + message;
|
||||
}
|
||||
}
|
1024
supersearch/src/main/java/com/xcl/supersearch/SearchView.java
Normal file
158
supersearch/src/main/java/com/xcl/supersearch/Utils.java
Normal file
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* 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.supersearch;
|
||||
|
||||
import ohos.agp.colors.RgbColor;
|
||||
import ohos.agp.components.Attr;
|
||||
import ohos.agp.components.AttrSet;
|
||||
import ohos.agp.components.element.Element;
|
||||
import ohos.agp.components.element.ShapeElement;
|
||||
import ohos.agp.utils.Color;
|
||||
import ohos.agp.window.service.DisplayAttributes;
|
||||
import ohos.global.resource.ResourceManager;
|
||||
import ohos.hiviewdfx.HiLog;
|
||||
import ohos.hiviewdfx.HiLogLabel;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class Utils {
|
||||
public static boolean pd_pd = false;
|
||||
public static boolean iswear = false;
|
||||
static ResourceManager resManager;
|
||||
|
||||
public static boolean getBoolean(AttrSet attrSet, String attrName, boolean defaultValue) {
|
||||
if (attrSet == null || attrName == null || attrName.isEmpty()) {
|
||||
return defaultValue;
|
||||
}
|
||||
Optional<Attr> attrOptional = attrSet.getAttr(attrName);
|
||||
if (attrOptional == null || !attrOptional.isPresent()) {
|
||||
return defaultValue;
|
||||
}
|
||||
return attrOptional.get().getBoolValue();
|
||||
}
|
||||
|
||||
public static float getFloat(AttrSet attrSet, String attrName, float defaultValue) {
|
||||
if (attrSet == null || attrName == null || attrName.isEmpty()) {
|
||||
return defaultValue;
|
||||
}
|
||||
Optional<Attr> attrOptional = attrSet.getAttr(attrName);
|
||||
if (attrOptional == null || !attrOptional.isPresent()) {
|
||||
return defaultValue;
|
||||
}
|
||||
return attrOptional.get().getFloatValue();
|
||||
}
|
||||
|
||||
public static int getColor(AttrSet attrSet, String attrName, int defaultColor) {
|
||||
if (attrSet == null || attrName == null || attrName.isEmpty()) {
|
||||
return defaultColor;
|
||||
}
|
||||
|
||||
Optional<Attr> attrOptional = attrSet.getAttr(attrName);
|
||||
if (attrOptional == null || !attrOptional.isPresent()) {
|
||||
return defaultColor;
|
||||
}
|
||||
return attrOptional.get().getColorValue().getValue();
|
||||
}
|
||||
|
||||
public static int getDimension(AttrSet attrSet, String attrName, int defaultValue) {
|
||||
if (attrSet == null || attrName == null || attrName.isEmpty()) {
|
||||
return defaultValue;
|
||||
}
|
||||
Optional<Attr> attrOptional = attrSet.getAttr(attrName);
|
||||
if (attrOptional == null || !attrOptional.isPresent()) {
|
||||
return defaultValue;
|
||||
}
|
||||
return attrOptional.get().getDimensionValue() * 3;
|
||||
}
|
||||
|
||||
public static Element getElement(AttrSet attrSet, String attrName, Element defaultElement) {
|
||||
if (attrSet == null || attrName == null || attrName.isEmpty()) {
|
||||
return defaultElement;
|
||||
}
|
||||
Optional<Attr> attrOptional = attrSet.getAttr(attrName);
|
||||
if (attrOptional == null || !attrOptional.isPresent()) {
|
||||
return defaultElement;
|
||||
}
|
||||
return attrOptional.get().getElement();
|
||||
}
|
||||
|
||||
public static int vpToPx(float vp, DisplayAttributes displayAttributes) {
|
||||
return (int) (vp * displayAttributes.densityPixels + 0.5f);
|
||||
}
|
||||
|
||||
public static String getString(AttrSet attrSet, String attrName, String defaultValue) {
|
||||
if (attrSet == null || attrName == null || attrName.isEmpty()) {
|
||||
return defaultValue;
|
||||
}
|
||||
Optional<Attr> attrOptional = attrSet.getAttr(attrName);
|
||||
if (attrOptional == null || !attrOptional.isPresent()) {
|
||||
return defaultValue;
|
||||
}
|
||||
return attrOptional.get().getStringValue();
|
||||
}
|
||||
|
||||
public static String HQString(int a1) {
|
||||
try {
|
||||
String text = resManager.getElement(a1).getString();
|
||||
return text;
|
||||
} catch (Exception e) {
|
||||
return e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
public static Element adjustColorAlpha(int color, float alpha) {
|
||||
final int alphaChannel = (int) (255 * alpha);
|
||||
final int redChannel = (color >> 16) & 0xFF;
|
||||
final int greenChannel = (color >> 8) & 0xFF;
|
||||
final int blueChannel = color & 0xFF;
|
||||
|
||||
ShapeElement element = new ShapeElement();
|
||||
element.setAlpha(alphaChannel);
|
||||
element.setRgbColor(RgbColor.fromArgbInt(Color.rgb(redChannel, greenChannel, blueChannel)));
|
||||
return element;
|
||||
}
|
||||
|
||||
public static void info(HiLogLabel label, String message) {
|
||||
if (pd_pd) {
|
||||
HiLog.info(label, "信息:[" + message + "]");
|
||||
}
|
||||
}
|
||||
|
||||
public static void warn(HiLogLabel label, String message) {
|
||||
if (pd_pd) {
|
||||
HiLog.warn(label, "警告:[" + message + "]");
|
||||
}
|
||||
}
|
||||
|
||||
public static void error(HiLogLabel label, String message) {
|
||||
if (pd_pd) {
|
||||
HiLog.error(label, "错误:[" + message + "]");
|
||||
}
|
||||
}
|
||||
|
||||
public static void debug(HiLogLabel label, String message) {
|
||||
if (pd_pd) {
|
||||
HiLog.debug(label, "调试:[" + message + "]");
|
||||
}
|
||||
}
|
||||
|
||||
protected int makePressColor(int backgroundColor) {
|
||||
int r = (backgroundColor >> 16) & 0xFF;
|
||||
int g = (backgroundColor >> 8) & 0xFF;
|
||||
int b = (backgroundColor) & 0xFF;
|
||||
return Color.argb(128, r, g, b);
|
||||
}
|
||||
}
|
40
supersearch/src/main/resources/base/element/string.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"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": "搜索结果为空"
|
||||
}
|
||||
]
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:ohos="http://schemas.huawei.com/res/ohos"
|
||||
ohos:shape="rectangle">
|
||||
|
||||
<solid ohos:color="#FFF3ECEC"/>
|
||||
|
||||
<stroke
|
||||
ohos:width="1.7vp"
|
||||
ohos:color="#33999999"/>
|
||||
|
||||
<corners
|
||||
ohos:radius="15vp"/>
|
||||
</shape>
|
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:ohos="http://schemas.huawei.com/res/ohos"
|
||||
ohos:shape="rectangle">
|
||||
|
||||
<solid ohos:color="#FFFFFF"/>
|
||||
|
||||
<stroke
|
||||
ohos:width="1vp"
|
||||
ohos:color="#33999999"/>
|
||||
|
||||
<corners
|
||||
ohos:radius="3vp"/>
|
||||
</shape>
|
12
supersearch/src/main/resources/base/graphic/ic_search.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<!-- drawable/magnify.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="#657786"
|
||||
ohos:pathData="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z"/>
|
||||
</vector>
|
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<DirectionalLayout
|
||||
xmlns:ohos="http://schemas.huawei.com/res/ohos"
|
||||
ohos:height="48vp"
|
||||
ohos:width="match_parent"
|
||||
ohos:alignment="vertical_center"
|
||||
ohos:orientation="horizontal"
|
||||
>
|
||||
|
||||
<Image
|
||||
ohos:id="$+id:iconIv"
|
||||
ohos:height="48vp"
|
||||
ohos:width="48vp"
|
||||
ohos:padding="12vp"
|
||||
ohos:scale_mode="zoom_center"
|
||||
/>
|
||||
|
||||
<Text
|
||||
ohos:id="$+id:textTv"
|
||||
ohos:height="match_parent"
|
||||
ohos:width="0vp"
|
||||
ohos:end_margin="16vp"
|
||||
ohos:max_text_lines="1"
|
||||
ohos:multiple_lines="false"
|
||||
ohos:start_margin="16vp"
|
||||
ohos:text="$string:suggestion_text"
|
||||
ohos:text_alignment="vertical_center"
|
||||
ohos:text_color="#000000"
|
||||
ohos:text_size="14fp"
|
||||
ohos:truncation_mode="ellipsis_at_end"
|
||||
ohos:weight="1"
|
||||
/>
|
||||
|
||||
<StackLayout
|
||||
ohos:id="$+id:removeBtnWrapperFl"
|
||||
ohos:height="48vp"
|
||||
ohos:width="48vp"
|
||||
ohos:align_parent_end="true"
|
||||
>
|
||||
|
||||
<Image
|
||||
ohos:id="$+id:removeBtnIv"
|
||||
ohos:height="30vp"
|
||||
ohos:width="30vp"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:padding="5vp"
|
||||
ohos:scale_mode="zoom_center"
|
||||
/>
|
||||
|
||||
</StackLayout>
|
||||
|
||||
</DirectionalLayout>
|
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<DirectionalLayout
|
||||
xmlns:ohos="http://schemas.huawei.com/res/ohos"
|
||||
ohos:height="22vp"
|
||||
ohos:width="match_parent"
|
||||
ohos:alignment="vertical_center"
|
||||
ohos:orientation="horizontal"
|
||||
>
|
||||
|
||||
<Image
|
||||
ohos:id="$+id:iconIv"
|
||||
ohos:height="20vp"
|
||||
ohos:width="20vp"
|
||||
ohos:padding="1vp"
|
||||
ohos:scale_mode="zoom_center"
|
||||
/>
|
||||
|
||||
<Text
|
||||
ohos:id="$+id:textTv"
|
||||
ohos:height="match_parent"
|
||||
ohos:width="0vp"
|
||||
ohos:end_margin="16vp"
|
||||
ohos:max_text_lines="1"
|
||||
ohos:multiple_lines="false"
|
||||
ohos:start_margin="13vp"
|
||||
ohos:text="$string:suggestion_text"
|
||||
ohos:text_alignment="vertical_center"
|
||||
ohos:text_color="#000000"
|
||||
ohos:text_size="13fp"
|
||||
ohos:truncation_mode="ellipsis_at_end"
|
||||
ohos:weight="1"
|
||||
/>
|
||||
|
||||
<StackLayout
|
||||
ohos:id="$+id:removeBtnWrapperFl"
|
||||
ohos:height="22vp"
|
||||
ohos:width="22vp"
|
||||
ohos:align_parent_end="true"
|
||||
>
|
||||
|
||||
<Image
|
||||
ohos:id="$+id:removeBtnIv"
|
||||
ohos:height="20vp"
|
||||
ohos:width="20vp"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:padding="1vp"
|
||||
ohos:scale_mode="zoom_center"
|
||||
/>
|
||||
|
||||
</StackLayout>
|
||||
|
||||
</DirectionalLayout>
|
124
supersearch/src/main/resources/base/layout/search_view.xml
Normal file
@@ -0,0 +1,124 @@
|
||||
<?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_content"
|
||||
ohos:width="match_parent"
|
||||
ohos:background_element="$graphic:background_search_view"
|
||||
ohos:clickable="true"
|
||||
ohos:orientation="vertical">
|
||||
|
||||
<DependentLayout
|
||||
ohos:height="48vp"
|
||||
ohos:width="match_parent">
|
||||
|
||||
<StackLayout
|
||||
ohos:id="$+id:leftContainerFl"
|
||||
ohos:height="48vp"
|
||||
ohos:width="48vp"
|
||||
ohos:align_parent_start="true"
|
||||
>
|
||||
|
||||
<Image
|
||||
ohos:id="$+id:leftBtnIv"
|
||||
ohos:height="match_parent"
|
||||
ohos:width="match_parent"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:padding="11vp"
|
||||
ohos:scale_mode="zoom_center"
|
||||
/>
|
||||
|
||||
<com.xcl.supersearch.RoundProgressBar
|
||||
ohos:id="$+id:progressBar"
|
||||
ohos:height="24vp"
|
||||
ohos:width="24vp"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:visibility="hide"
|
||||
app:progress_color="#657786"
|
||||
app:progress_with="2f"
|
||||
/>
|
||||
|
||||
</StackLayout>
|
||||
|
||||
<TextField
|
||||
ohos:id="$+id:inputEt"
|
||||
ohos:height="match_parent"
|
||||
ohos:width="match_parent"
|
||||
ohos:bubble_height="0vp"
|
||||
ohos:end_margin="16vp"
|
||||
ohos:end_of="$+id:leftContainerFl"
|
||||
ohos:input_enter_key_type="enter_key_type_search"
|
||||
ohos:multiple_lines="false"
|
||||
ohos:start_margin="13vp"
|
||||
ohos:start_of="$+id:inputBtnsContainerFl"
|
||||
ohos:text_alignment="vertical_center"
|
||||
ohos:text_size="16fp"
|
||||
ohos:text_weight="700"
|
||||
/>
|
||||
|
||||
<DirectionalLayout
|
||||
ohos:id="$+id:inputBtnsContainerFl"
|
||||
ohos:height="48vp"
|
||||
ohos:width="match_content"
|
||||
ohos:align_parent_end="true"
|
||||
ohos:orientation="horizontal"
|
||||
>
|
||||
|
||||
<Image
|
||||
ohos:id="$+id:clearInputBtnIv"
|
||||
ohos:height="match_parent"
|
||||
ohos:width="48vp"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:padding="11vp"
|
||||
ohos:scale_mode="zoom_center"
|
||||
ohos:visibility="hide"
|
||||
/>
|
||||
|
||||
<Image
|
||||
ohos:id="$+id:imgSearch"
|
||||
ohos:height="match_parent"
|
||||
ohos:width="48vp"
|
||||
ohos:image_src="$graphic:ic_search"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:padding="11vp"
|
||||
ohos:scale_mode="zoom_center"
|
||||
ohos:visibility="hide"
|
||||
/>
|
||||
|
||||
<Image
|
||||
ohos:id="$+id:rightBtnIv"
|
||||
ohos:height="match_parent"
|
||||
ohos:width="48vp"
|
||||
ohos:image_src="$graphic:ic_search"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:padding="11vp"
|
||||
ohos:scale_mode="zoom_center"
|
||||
/>
|
||||
|
||||
</DirectionalLayout>
|
||||
|
||||
</DependentLayout>
|
||||
|
||||
<DirectionalLayout
|
||||
ohos:id="$+id:suggestionsContainerLl"
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_parent"
|
||||
ohos:orientation="vertical"
|
||||
ohos:top_margin="48vp"
|
||||
>
|
||||
|
||||
<Component
|
||||
ohos:id="$+id:divider"
|
||||
ohos:height="0.75vp"
|
||||
ohos:width="match_parent"
|
||||
ohos:background_element="#BCBCBC"/>
|
||||
|
||||
<ListContainer
|
||||
ohos:id="$+id:suggestionsRecyclerView"
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_parent"
|
||||
ohos:scrollbar_background_color="#00000000"/>
|
||||
|
||||
</DirectionalLayout>
|
||||
|
||||
</DependentLayout>
|
125
supersearch/src/main/resources/base/layout/search_vieww.xml
Normal file
@@ -0,0 +1,125 @@
|
||||
<?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_content"
|
||||
ohos:width="match_parent"
|
||||
ohos:background_element="$graphic:background_search_view"
|
||||
ohos:clickable="true"
|
||||
ohos:orientation="vertical">
|
||||
|
||||
<DependentLayout
|
||||
ohos:height="22vp"
|
||||
|
||||
ohos:width="match_parent">
|
||||
|
||||
<StackLayout
|
||||
ohos:id="$+id:leftContainerFl"
|
||||
ohos:height="20vp"
|
||||
ohos:width="20vp"
|
||||
ohos:align_parent_start="true"
|
||||
>
|
||||
|
||||
<Image
|
||||
ohos:id="$+id:leftBtnIv"
|
||||
ohos:height="match_parent"
|
||||
ohos:width="match_parent"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:padding="1.5vp"
|
||||
ohos:scale_mode="zoom_center"
|
||||
/>
|
||||
|
||||
<com.xcl.supersearch.RoundProgressBar
|
||||
ohos:id="$+id:progressBar"
|
||||
ohos:height="16vp"
|
||||
ohos:width="16vp"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:visibility="hide"
|
||||
app:progress_color="#657786"
|
||||
app:progress_with="2f"
|
||||
/>
|
||||
|
||||
</StackLayout>
|
||||
|
||||
<TextField
|
||||
ohos:id="$+id:inputEt"
|
||||
ohos:height="match_parent"
|
||||
ohos:width="match_parent"
|
||||
ohos:bubble_height="0vp"
|
||||
ohos:end_margin="16vp"
|
||||
ohos:end_of="$+id:leftContainerFl"
|
||||
ohos:input_enter_key_type="enter_key_type_search"
|
||||
ohos:multiple_lines="false"
|
||||
ohos:start_margin="10vp"
|
||||
ohos:start_of="$+id:inputBtnsContainerFl"
|
||||
ohos:text_alignment="vertical_center"
|
||||
ohos:text_size="13fp"
|
||||
ohos:text_weight="700"
|
||||
/>
|
||||
|
||||
<DirectionalLayout
|
||||
ohos:id="$+id:inputBtnsContainerFl"
|
||||
ohos:height="22vp"
|
||||
ohos:width="match_content"
|
||||
ohos:align_parent_end="true"
|
||||
ohos:orientation="horizontal"
|
||||
>
|
||||
|
||||
<Image
|
||||
ohos:id="$+id:clearInputBtnIv"
|
||||
ohos:height="match_parent"
|
||||
ohos:width="20vp"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:padding="1vp"
|
||||
ohos:scale_mode="zoom_center"
|
||||
ohos:visibility="hide"
|
||||
/>
|
||||
|
||||
<Image
|
||||
ohos:id="$+id:imgSearch"
|
||||
ohos:height="match_parent"
|
||||
ohos:width="20vp"
|
||||
ohos:image_src="$graphic:ic_search"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:padding="1vp"
|
||||
ohos:scale_mode="zoom_center"
|
||||
ohos:visibility="hide"
|
||||
/>
|
||||
|
||||
<Image
|
||||
ohos:id="$+id:rightBtnIv"
|
||||
ohos:height="match_parent"
|
||||
ohos:width="20vp"
|
||||
ohos:image_src="$graphic:ic_search"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:padding="1vp"
|
||||
ohos:scale_mode="zoom_center"
|
||||
/>
|
||||
|
||||
</DirectionalLayout>
|
||||
|
||||
</DependentLayout>
|
||||
|
||||
<DirectionalLayout
|
||||
ohos:id="$+id:suggestionsContainerLl"
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_parent"
|
||||
ohos:orientation="vertical"
|
||||
ohos:top_margin="22vp"
|
||||
>
|
||||
|
||||
<Component
|
||||
ohos:id="$+id:divider"
|
||||
ohos:height="0.5vp"
|
||||
ohos:width="match_parent"
|
||||
ohos:background_element="#BCBCBC"/>
|
||||
|
||||
<ListContainer
|
||||
ohos:id="$+id:suggestionsRecyclerView"
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_parent"
|
||||
ohos:scrollbar_background_color="#00000000"/>
|
||||
|
||||
</DirectionalLayout>
|
||||
|
||||
</DependentLayout>
|
109
supersearch/src/main/resources/base/layout/searchres.xml
Normal file
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<DirectionalLayout
|
||||
xmlns:ohos="http://schemas.huawei.com/res/ohos"
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_parent"
|
||||
ohos:orientation="vertical"
|
||||
ohos:padding="1.5vp"
|
||||
>
|
||||
|
||||
<DirectionalLayout
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_parent"
|
||||
ohos:background_element="$graphic:background_list_item"
|
||||
ohos:orientation="horizontal"
|
||||
>
|
||||
|
||||
<DirectionalLayout
|
||||
ohos:height="55vp"
|
||||
ohos:width="match_parent"
|
||||
ohos:alignment="center"
|
||||
ohos:orientation="vertical"
|
||||
ohos:weight="1"
|
||||
>
|
||||
|
||||
<Text
|
||||
ohos:id="$+id:title"
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_content"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:text="标题"
|
||||
ohos:text_color="#FF2F2A2A"
|
||||
ohos:text_size="23vp"
|
||||
ohos:weight="2"
|
||||
/>
|
||||
|
||||
<Text
|
||||
ohos:id="$+id:message"
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_content"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:text="信息"
|
||||
ohos:text_color="#FF2F2A2A"
|
||||
ohos:text_size="18vp"
|
||||
ohos:weight="1"
|
||||
/>
|
||||
</DirectionalLayout>
|
||||
|
||||
<DirectionalLayout
|
||||
ohos:height="55vp"
|
||||
ohos:width="match_parent"
|
||||
ohos:alignment="center"
|
||||
ohos:orientation="horizontal"
|
||||
ohos:weight="2.3"
|
||||
>
|
||||
|
||||
<Button
|
||||
ohos:id="$+id:button1"
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_parent"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:text="按钮1"
|
||||
ohos:text_color="#EB1F1818"
|
||||
ohos:text_size="20vp"
|
||||
ohos:weight="1"
|
||||
/>
|
||||
|
||||
<Button
|
||||
ohos:id="$+id:button2"
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_parent"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:text="按钮2"
|
||||
ohos:text_color="#EB1F1818"
|
||||
ohos:text_size="20vp"
|
||||
ohos:weight="1"
|
||||
/>
|
||||
|
||||
<Button
|
||||
ohos:id="$+id:button3"
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_parent"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:text="按钮3"
|
||||
ohos:text_color="#EB1F1818"
|
||||
ohos:text_size="20vp"
|
||||
ohos:weight="1"
|
||||
/>
|
||||
|
||||
<Button
|
||||
ohos:id="$+id:button4"
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_parent"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:text="按钮4"
|
||||
ohos:text_color="#EB1F1818"
|
||||
ohos:text_size="20vp"
|
||||
ohos:weight="1"
|
||||
/>
|
||||
</DirectionalLayout>
|
||||
|
||||
</DirectionalLayout>
|
||||
|
||||
<DirectionalLayout
|
||||
ohos:height="2vp"
|
||||
ohos:width="match_parent"
|
||||
ohos:orientation="horizontal"
|
||||
>
|
||||
</DirectionalLayout>
|
||||
</DirectionalLayout>
|
109
supersearch/src/main/resources/base/layout/searchresw.xml
Normal file
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<DirectionalLayout
|
||||
xmlns:ohos="http://schemas.huawei.com/res/ohos"
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_parent"
|
||||
ohos:orientation="vertical"
|
||||
ohos:padding="0.5vp"
|
||||
>
|
||||
|
||||
<DirectionalLayout
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_parent"
|
||||
ohos:background_element="$graphic:background_list_item"
|
||||
ohos:orientation="horizontal"
|
||||
>
|
||||
|
||||
<DirectionalLayout
|
||||
ohos:height="25vp"
|
||||
ohos:width="match_parent"
|
||||
ohos:alignment="center"
|
||||
ohos:orientation="vertical"
|
||||
ohos:weight="1"
|
||||
>
|
||||
|
||||
<Text
|
||||
ohos:id="$+id:title"
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_content"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:text="标题"
|
||||
ohos:text_color="#FF2F2A2A"
|
||||
ohos:text_size="12vp"
|
||||
ohos:weight="2"
|
||||
/>
|
||||
|
||||
<Text
|
||||
ohos:id="$+id:message"
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_content"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:text="信息"
|
||||
ohos:text_color="#FF2F2A2A"
|
||||
ohos:text_size="9vp"
|
||||
ohos:weight="1"
|
||||
/>
|
||||
</DirectionalLayout>
|
||||
|
||||
<DirectionalLayout
|
||||
ohos:height="25vp"
|
||||
ohos:width="match_parent"
|
||||
ohos:alignment="center"
|
||||
ohos:orientation="horizontal"
|
||||
ohos:weight="2"
|
||||
>
|
||||
|
||||
<Button
|
||||
ohos:id="$+id:button1"
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_parent"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:text="按钮1"
|
||||
ohos:text_color="#EB1F1818"
|
||||
ohos:text_size="11vp"
|
||||
ohos:weight="1"
|
||||
/>
|
||||
|
||||
<Button
|
||||
ohos:id="$+id:button2"
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_parent"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:text="按钮2"
|
||||
ohos:text_color="#EB1F1818"
|
||||
ohos:text_size="11vp"
|
||||
ohos:weight="1"
|
||||
/>
|
||||
|
||||
<Button
|
||||
ohos:id="$+id:button3"
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_parent"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:text="按钮3"
|
||||
ohos:text_color="#EB1F1818"
|
||||
ohos:text_size="11vp"
|
||||
ohos:weight="1"
|
||||
/>
|
||||
|
||||
<Button
|
||||
ohos:id="$+id:button4"
|
||||
ohos:height="match_content"
|
||||
ohos:width="match_parent"
|
||||
ohos:layout_alignment="center"
|
||||
ohos:text="按钮4"
|
||||
ohos:text_color="#EB1F1818"
|
||||
ohos:text_size="11vp"
|
||||
ohos:weight="1"
|
||||
/>
|
||||
</DirectionalLayout>
|
||||
|
||||
</DirectionalLayout>
|
||||
|
||||
<DirectionalLayout
|
||||
ohos:height="2vp"
|
||||
ohos:width="match_parent"
|
||||
ohos:orientation="horizontal"
|
||||
>
|
||||
</DirectionalLayout>
|
||||
</DirectionalLayout>
|
After Width: | Height: | Size: 528 B |
After Width: | Height: | Size: 539 B |
After Width: | Height: | Size: 680 B |
After Width: | Height: | Size: 752 B |
After Width: | Height: | Size: 589 B |
After Width: | Height: | Size: 630 B |
After Width: | Height: | Size: 903 B |
After Width: | Height: | Size: 1008 B |
After Width: | Height: | Size: 451 B |
After Width: | Height: | Size: 429 B |
After Width: | Height: | Size: 490 B |
After Width: | Height: | Size: 532 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 2.3 KiB |
40
supersearch/src/main/resources/en/element/string.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "searchmr",
|
||||
"value": "SEARCH DEFAULT PAGE"
|
||||
},
|
||||
{
|
||||
"name": "withoutSug",
|
||||
"value": "NO SUGGESTED SEARCH"
|
||||
},
|
||||
{
|
||||
"name": "recentSug",
|
||||
"value": "HAS RECENT SUGGESTED SEARCHES"
|
||||
},
|
||||
{
|
||||
"name": "hasknownSug",
|
||||
"value": "HAS KNOWN SUGGESTED SEARCHES"
|
||||
},
|
||||
{
|
||||
"name": "suggestion_text",
|
||||
"value": "Suggestion Text"
|
||||
},
|
||||
{
|
||||
"name": "search_hint_text",
|
||||
"value": "Searching..."
|
||||
},
|
||||
{
|
||||
"name": "search_hint_text_",
|
||||
"value": "Search ."
|
||||
},
|
||||
{
|
||||
"name": "search_input_null",
|
||||
"value": "Search Text is Null"
|
||||
},
|
||||
{
|
||||
"name": "search_answer_none",
|
||||
"value": "Search Answer is None"
|
||||
}
|
||||
]
|
||||
}
|
40
supersearch/src/main/resources/zh/element/string.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"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": "搜索结果为空"
|
||||
}
|
||||
]
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
package com.xcl.supersearch;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class ExampleTest {
|
||||
@Test
|
||||
public void onStart() {
|
||||
}
|
||||
}
|