add 注释
Signed-off-by: Y7000p <xcl@xuegao-tzx.top>
This commit is contained in:
parent
cc59981cf5
commit
a321fa2cc7
@ -20,6 +20,9 @@ import ohos.aafwk.ability.Ability;
|
|||||||
import ohos.aafwk.content.Intent;
|
import ohos.aafwk.content.Intent;
|
||||||
import ohos.agp.window.service.WindowManager;
|
import ohos.agp.window.service.WindowManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Main ability.
|
||||||
|
*/
|
||||||
public class MainAbility extends Ability {
|
public class MainAbility extends Ability {
|
||||||
@Override
|
@Override
|
||||||
public void onStart(Intent intent) {
|
public void onStart(Intent intent) {
|
||||||
|
@ -17,6 +17,9 @@ package com.xcl.search.test;
|
|||||||
|
|
||||||
import ohos.aafwk.ability.AbilityPackage;
|
import ohos.aafwk.ability.AbilityPackage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type My application.
|
||||||
|
*/
|
||||||
public class MyApplication extends AbilityPackage {
|
public class MyApplication extends AbilityPackage {
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
|
@ -20,6 +20,9 @@ import ohos.aafwk.ability.Ability;
|
|||||||
import ohos.aafwk.content.Intent;
|
import ohos.aafwk.content.Intent;
|
||||||
import ohos.agp.window.service.WindowManager;
|
import ohos.agp.window.service.WindowManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Search demo ability.
|
||||||
|
*/
|
||||||
public class SearchDemoAbility extends Ability {
|
public class SearchDemoAbility extends Ability {
|
||||||
@Override
|
@Override
|
||||||
public void onStart(Intent intent) {
|
public void onStart(Intent intent) {
|
||||||
|
@ -23,6 +23,9 @@ import ohos.agp.components.Component;
|
|||||||
import ohos.agp.window.service.WindowManager;
|
import ohos.agp.window.service.WindowManager;
|
||||||
import ohos.utils.net.Uri;
|
import ohos.utils.net.Uri;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Main ability slice.
|
||||||
|
*/
|
||||||
public class MainAbilitySlice extends AbilitySlice {
|
public class MainAbilitySlice extends AbilitySlice {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -50,6 +53,11 @@ public class MainAbilitySlice extends AbilitySlice {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Route.
|
||||||
|
*
|
||||||
|
* @param route the route
|
||||||
|
*/
|
||||||
public void Route(String route) {
|
public void Route(String route) {
|
||||||
Intent intent1 = new Intent();
|
Intent intent1 = new Intent();
|
||||||
intent1.setParam("SEARCH_PD", route);
|
intent1.setParam("SEARCH_PD", route);
|
||||||
|
@ -33,6 +33,9 @@ import ohos.hiviewdfx.HiLogLabel;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Search demo ability slice.
|
||||||
|
*/
|
||||||
public class SearchDemoAbilitySlice extends AbilitySlice {
|
public class SearchDemoAbilitySlice extends AbilitySlice {
|
||||||
private static final HiLogLabel label = new HiLogLabel(HiLog.LOG_APP, 0x00234, "SearchDemoAbilitySlice");
|
private static final HiLogLabel label = new HiLogLabel(HiLog.LOG_APP, 0x00234, "SearchDemoAbilitySlice");
|
||||||
private int PDD = -2;
|
private int PDD = -2;
|
||||||
|
@ -21,6 +21,9 @@ import ohos.agp.animation.AnimatorValue;
|
|||||||
import ohos.agp.components.ComponentContainer;
|
import ohos.agp.components.ComponentContainer;
|
||||||
import ohos.agp.components.element.Element;
|
import ohos.agp.components.element.Element;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Background loading animation.
|
||||||
|
*/
|
||||||
public final class BackgroundLoadingAnimation {
|
public final class BackgroundLoadingAnimation {
|
||||||
private boolean isRecycled;
|
private boolean isRecycled;
|
||||||
|
|
||||||
@ -31,6 +34,13 @@ public final class BackgroundLoadingAnimation {
|
|||||||
|
|
||||||
private AnimatorValue animator;
|
private AnimatorValue animator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Background loading animation.
|
||||||
|
*
|
||||||
|
* @param view the view
|
||||||
|
* @param fromAlpha the from alpha
|
||||||
|
* @param toAlpha the to alpha
|
||||||
|
*/
|
||||||
public BackgroundLoadingAnimation(ComponentContainer view, float fromAlpha, float toAlpha) {
|
public BackgroundLoadingAnimation(ComponentContainer view, float fromAlpha, float toAlpha) {
|
||||||
this.view = view;
|
this.view = view;
|
||||||
this.fromAlpha = fromAlpha;
|
this.fromAlpha = fromAlpha;
|
||||||
@ -81,30 +91,57 @@ public final class BackgroundLoadingAnimation {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets from alpha.
|
||||||
|
*
|
||||||
|
* @param fromAlpha the from alpha
|
||||||
|
* @return the from alpha
|
||||||
|
*/
|
||||||
public BackgroundLoadingAnimation setFromAlpha(float fromAlpha) {
|
public BackgroundLoadingAnimation setFromAlpha(float fromAlpha) {
|
||||||
this.fromAlpha = fromAlpha;
|
this.fromAlpha = fromAlpha;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets to alpha.
|
||||||
|
*
|
||||||
|
* @param toAlpha the to alpha
|
||||||
|
* @return the to alpha
|
||||||
|
*/
|
||||||
public BackgroundLoadingAnimation setToAlpha(float toAlpha) {
|
public BackgroundLoadingAnimation setToAlpha(float toAlpha) {
|
||||||
this.toAlpha = toAlpha;
|
this.toAlpha = toAlpha;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets interpolator.
|
||||||
|
*
|
||||||
|
* @param interpolator the interpolator
|
||||||
|
* @return the interpolator
|
||||||
|
*/
|
||||||
public BackgroundLoadingAnimation setInterpolator(int interpolator) {
|
public BackgroundLoadingAnimation setInterpolator(int interpolator) {
|
||||||
animator.setCurveType(interpolator);
|
animator.setCurveType(interpolator);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets duration.
|
||||||
|
*
|
||||||
|
* @param duration the duration
|
||||||
|
* @return the duration
|
||||||
|
*/
|
||||||
public BackgroundLoadingAnimation setDuration(long duration) {
|
public BackgroundLoadingAnimation setDuration(long duration) {
|
||||||
animator.setDuration(duration);
|
animator.setDuration(duration);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start.
|
||||||
|
*/
|
||||||
public void start() {
|
public void start() {
|
||||||
if (isRecycled() || view.getAlpha() == toAlpha) {
|
if (isRecycled() || view.getAlpha() == toAlpha) {
|
||||||
return;
|
return;
|
||||||
@ -115,6 +152,9 @@ public final class BackgroundLoadingAnimation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop.
|
||||||
|
*/
|
||||||
public void stop() {
|
public void stop() {
|
||||||
if (!isRecycled() && isRunning()) {
|
if (!isRecycled() && isRunning()) {
|
||||||
animator.cancel();
|
animator.cancel();
|
||||||
@ -122,11 +162,19 @@ public final class BackgroundLoadingAnimation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is running boolean.
|
||||||
|
*
|
||||||
|
* @return the boolean
|
||||||
|
*/
|
||||||
public boolean isRunning() {
|
public boolean isRunning() {
|
||||||
return animator.isRunning();
|
return animator.isRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recycle.
|
||||||
|
*/
|
||||||
public void recycle() {
|
public void recycle() {
|
||||||
if (isRecycled) {
|
if (isRecycled) {
|
||||||
return;
|
return;
|
||||||
@ -138,6 +186,11 @@ public final class BackgroundLoadingAnimation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is recycled boolean.
|
||||||
|
*
|
||||||
|
* @return the boolean
|
||||||
|
*/
|
||||||
public boolean isRecycled() {
|
public boolean isRecycled() {
|
||||||
return isRecycled;
|
return isRecycled;
|
||||||
}
|
}
|
||||||
|
@ -26,17 +26,31 @@ import java.util.List;
|
|||||||
import static com.xcl.supersearch.Utils.iswear;
|
import static com.xcl.supersearch.Utils.iswear;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Contact provider sr.
|
||||||
|
*/
|
||||||
public class ContactProviderSR extends BaseItemProvider {
|
public class ContactProviderSR extends BaseItemProvider {
|
||||||
private static final HiLogLabel label = new HiLogLabel(HiLog.LOG_APP, 0x00666, "ContactProviderSR");
|
private static final HiLogLabel label = new HiLogLabel(HiLog.LOG_APP, 0x00666, "ContactProviderSR");
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private List<SRContactor> contactArrays = new ArrayList<>(0);
|
private List<SRContactor> contactArrays = new ArrayList<>(0);
|
||||||
private AdapterClickListener adapterClickListener;
|
private AdapterClickListener adapterClickListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Contact provider sr.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
* @param contactArrays the contact arrays
|
||||||
|
*/
|
||||||
public ContactProviderSR(Context context, List<SRContactor> contactArrays) {
|
public ContactProviderSR(Context context, List<SRContactor> contactArrays) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.contactArrays = contactArrays;
|
this.contactArrays = contactArrays;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Contact provider sr.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
*/
|
||||||
public ContactProviderSR(Context context) {
|
public ContactProviderSR(Context context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
@ -151,21 +165,54 @@ public class ContactProviderSR extends BaseItemProvider {
|
|||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets adapter click listener.
|
||||||
|
*
|
||||||
|
* @param adapterClickListener the adapter click listener
|
||||||
|
*/
|
||||||
void setAdapterClickListener(AdapterClickListener adapterClickListener) {
|
void setAdapterClickListener(AdapterClickListener adapterClickListener) {
|
||||||
this.adapterClickListener = adapterClickListener;
|
this.adapterClickListener = adapterClickListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets data.
|
||||||
|
*
|
||||||
|
* @param listData the list data
|
||||||
|
*/
|
||||||
public void setData(List<SRContactor> listData) {
|
public void setData(List<SRContactor> listData) {
|
||||||
contactArrays = listData;
|
contactArrays = listData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interface Adapter click listener.
|
||||||
|
*/
|
||||||
public interface AdapterClickListener {
|
public interface AdapterClickListener {
|
||||||
|
/**
|
||||||
|
* Ann 1.
|
||||||
|
*
|
||||||
|
* @param position the position
|
||||||
|
*/
|
||||||
void ann1(int position);
|
void ann1(int position);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ann 2.
|
||||||
|
*
|
||||||
|
* @param position the position
|
||||||
|
*/
|
||||||
void ann2(int position);
|
void ann2(int position);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ann 3.
|
||||||
|
*
|
||||||
|
* @param position the position
|
||||||
|
*/
|
||||||
void ann3(int position);
|
void ann3(int position);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ann 4.
|
||||||
|
*
|
||||||
|
* @param position the position
|
||||||
|
*/
|
||||||
void ann4(int position);
|
void ann4(int position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,9 @@ import ohos.hiviewdfx.HiLogLabel;
|
|||||||
|
|
||||||
import static com.xcl.supersearch.Utils.*;
|
import static com.xcl.supersearch.Utils.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Round progress bar.
|
||||||
|
*/
|
||||||
public class RoundProgressBar extends Component implements Component.DrawTask {
|
public class RoundProgressBar extends Component implements Component.DrawTask {
|
||||||
private static final HiLogLabel label = new HiLogLabel(HiLog.LOG_APP, 0x00234, "RoundProgressBar");
|
private static final HiLogLabel label = new HiLogLabel(HiLog.LOG_APP, 0x00234, "RoundProgressBar");
|
||||||
private final DisplayAttributes displayAttributes;
|
private final DisplayAttributes displayAttributes;
|
||||||
@ -42,14 +45,32 @@ public class RoundProgressBar extends Component implements Component.DrawTask {
|
|||||||
private Paint arcPaint;
|
private Paint arcPaint;
|
||||||
private float STROKE_WITH_VP = 3f;
|
private float STROKE_WITH_VP = 3f;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Round progress bar.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
*/
|
||||||
public RoundProgressBar(Context context) {
|
public RoundProgressBar(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Round progress bar.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
* @param attrSet the attr set
|
||||||
|
*/
|
||||||
public RoundProgressBar(Context context, AttrSet attrSet) {
|
public RoundProgressBar(Context context, AttrSet attrSet) {
|
||||||
this(context, attrSet, "");
|
this(context, attrSet, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Round progress bar.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
* @param attrSet the attr set
|
||||||
|
* @param styleName the style name
|
||||||
|
*/
|
||||||
public RoundProgressBar(Context context, AttrSet attrSet, String styleName) {
|
public RoundProgressBar(Context context, AttrSet attrSet, String styleName) {
|
||||||
super(context, attrSet, styleName);
|
super(context, attrSet, styleName);
|
||||||
DisplayManager displayManager = DisplayManager.getInstance();
|
DisplayManager displayManager = DisplayManager.getInstance();
|
||||||
@ -60,6 +81,9 @@ public class RoundProgressBar extends Component implements Component.DrawTask {
|
|||||||
initPaint();
|
initPaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init paint.
|
||||||
|
*/
|
||||||
protected void initPaint() {
|
protected void initPaint() {
|
||||||
try {
|
try {
|
||||||
arcPaint = new Paint();
|
arcPaint = new Paint();
|
||||||
@ -70,6 +94,11 @@ public class RoundProgressBar extends Component implements Component.DrawTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets attributes.
|
||||||
|
*
|
||||||
|
* @param attrs the attrs
|
||||||
|
*/
|
||||||
protected void setAttributes(AttrSet attrs) {
|
protected void setAttributes(AttrSet attrs) {
|
||||||
try {
|
try {
|
||||||
setMinHeight(vpToPx(32, displayAttributes));
|
setMinHeight(vpToPx(32, displayAttributes));
|
||||||
@ -119,6 +148,11 @@ public class RoundProgressBar extends Component implements Component.DrawTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets background color.
|
||||||
|
*
|
||||||
|
* @param color the color
|
||||||
|
*/
|
||||||
public void setBackgroundColor(int color) {
|
public void setBackgroundColor(int color) {
|
||||||
backgroundColor = color;
|
backgroundColor = color;
|
||||||
getContext().getUITaskDispatcher().asyncDispatch(this::invalidate);
|
getContext().getUITaskDispatcher().asyncDispatch(this::invalidate);
|
||||||
|
@ -16,43 +16,88 @@
|
|||||||
package com.xcl.supersearch;
|
package com.xcl.supersearch;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type S history contactor.
|
||||||
|
*/
|
||||||
public class SHistoryContactor {
|
public class SHistoryContactor {
|
||||||
private String searchValue;
|
private String searchValue;
|
||||||
private int searchIcon = -1;
|
private int searchIcon = -1;
|
||||||
private int removeIcon = -1;
|
private int removeIcon = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new S history contactor.
|
||||||
|
*
|
||||||
|
* @param searchValue the search value
|
||||||
|
* @param searchIcon the search icon
|
||||||
|
* @param removeIcon the remove icon
|
||||||
|
*/
|
||||||
public SHistoryContactor(String searchValue, int searchIcon, int removeIcon) {
|
public SHistoryContactor(String searchValue, int searchIcon, int removeIcon) {
|
||||||
this.searchValue = searchValue;
|
this.searchValue = searchValue;
|
||||||
this.searchIcon = searchIcon;
|
this.searchIcon = searchIcon;
|
||||||
this.removeIcon = removeIcon;
|
this.removeIcon = removeIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new S history contactor.
|
||||||
|
*
|
||||||
|
* @param searchValue the search value
|
||||||
|
*/
|
||||||
public SHistoryContactor(String searchValue) {
|
public SHistoryContactor(String searchValue) {
|
||||||
this.searchValue = searchValue;
|
this.searchValue = searchValue;
|
||||||
this.searchIcon = -3;
|
this.searchIcon = -3;
|
||||||
this.removeIcon = -3;
|
this.removeIcon = -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets search value.
|
||||||
|
*
|
||||||
|
* @return the search value
|
||||||
|
*/
|
||||||
public String getSearchValue() {
|
public String getSearchValue() {
|
||||||
return searchValue;
|
return searchValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets search value.
|
||||||
|
*
|
||||||
|
* @param searchValue the search value
|
||||||
|
*/
|
||||||
public void setSearchValue(String searchValue) {
|
public void setSearchValue(String searchValue) {
|
||||||
this.searchValue = searchValue;
|
this.searchValue = searchValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets search icon.
|
||||||
|
*
|
||||||
|
* @return the search icon
|
||||||
|
*/
|
||||||
public int getSearchIcon() {
|
public int getSearchIcon() {
|
||||||
return searchIcon;
|
return searchIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets search icon.
|
||||||
|
*
|
||||||
|
* @param searchIcon the search icon
|
||||||
|
*/
|
||||||
public void setSearchIcon(int searchIcon) {
|
public void setSearchIcon(int searchIcon) {
|
||||||
this.searchIcon = searchIcon;
|
this.searchIcon = searchIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets remove icon.
|
||||||
|
*
|
||||||
|
* @return the remove icon
|
||||||
|
*/
|
||||||
public int getRemoveIcon() {
|
public int getRemoveIcon() {
|
||||||
return removeIcon;
|
return removeIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets remove icon.
|
||||||
|
*
|
||||||
|
* @param removeIcon the remove icon
|
||||||
|
*/
|
||||||
public void setRemoveIcon(int removeIcon) {
|
public void setRemoveIcon(int removeIcon) {
|
||||||
this.removeIcon = removeIcon;
|
this.removeIcon = removeIcon;
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.xcl.supersearch;
|
package com.xcl.supersearch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Sr contactor.
|
||||||
|
*/
|
||||||
public class SRContactor {
|
public class SRContactor {
|
||||||
private String title = null;
|
private String title = null;
|
||||||
private String message = null;
|
private String message = null;
|
||||||
@ -23,6 +26,16 @@ public class SRContactor {
|
|||||||
private String bt3 = null;
|
private String bt3 = null;
|
||||||
private String bt4 = null;
|
private String bt4 = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Sr contactor.
|
||||||
|
*
|
||||||
|
* @param title the title
|
||||||
|
* @param message the message
|
||||||
|
* @param bt1 the bt 1
|
||||||
|
* @param bt2 the bt 2
|
||||||
|
* @param bt3 the bt 3
|
||||||
|
* @param bt4 the bt 4
|
||||||
|
*/
|
||||||
public SRContactor(String title, String message, String bt1, String bt2, String bt3, String bt4) {
|
public SRContactor(String title, String message, String bt1, String bt2, String bt3, String bt4) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
@ -32,6 +45,15 @@ public class SRContactor {
|
|||||||
this.bt4 = bt4;
|
this.bt4 = bt4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Sr contactor.
|
||||||
|
*
|
||||||
|
* @param title the title
|
||||||
|
* @param bt1 the bt 1
|
||||||
|
* @param bt2 the bt 2
|
||||||
|
* @param bt3 the bt 3
|
||||||
|
* @param bt4 the bt 4
|
||||||
|
*/
|
||||||
public SRContactor(String title, String bt1, String bt2, String bt3, String bt4) {
|
public SRContactor(String title, String bt1, String bt2, String bt3, String bt4) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.bt1 = bt1;
|
this.bt1 = bt1;
|
||||||
@ -40,59 +62,130 @@ public class SRContactor {
|
|||||||
this.bt4 = bt4;
|
this.bt4 = bt4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Sr contactor.
|
||||||
|
*
|
||||||
|
* @param title the title
|
||||||
|
* @param message the message
|
||||||
|
*/
|
||||||
public SRContactor(String title, String message) {
|
public SRContactor(String title, String message) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets bt 1.
|
||||||
|
*
|
||||||
|
* @return the bt 1
|
||||||
|
*/
|
||||||
public String getBt1() {
|
public String getBt1() {
|
||||||
return bt1;
|
return bt1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets bt 1.
|
||||||
|
*
|
||||||
|
* @param bt1 the bt 1
|
||||||
|
*/
|
||||||
public void setBt1(String bt1) {
|
public void setBt1(String bt1) {
|
||||||
this.bt1 = bt1;
|
this.bt1 = bt1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets bt 2.
|
||||||
|
*
|
||||||
|
* @return the bt 2
|
||||||
|
*/
|
||||||
public String getBt2() {
|
public String getBt2() {
|
||||||
return bt2;
|
return bt2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets bt 2.
|
||||||
|
*
|
||||||
|
* @param bt2 the bt 2
|
||||||
|
*/
|
||||||
public void setBt2(String bt2) {
|
public void setBt2(String bt2) {
|
||||||
this.bt2 = bt2;
|
this.bt2 = bt2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets bt 3.
|
||||||
|
*
|
||||||
|
* @return the bt 3
|
||||||
|
*/
|
||||||
public String getBt3() {
|
public String getBt3() {
|
||||||
return bt3;
|
return bt3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets bt 3.
|
||||||
|
*
|
||||||
|
* @param bt3 the bt 3
|
||||||
|
*/
|
||||||
public void setBt3(String bt3) {
|
public void setBt3(String bt3) {
|
||||||
this.bt3 = bt3;
|
this.bt3 = bt3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets bt 4.
|
||||||
|
*
|
||||||
|
* @return the bt 4
|
||||||
|
*/
|
||||||
public String getBt4() {
|
public String getBt4() {
|
||||||
return bt4;
|
return bt4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets bt 4.
|
||||||
|
*
|
||||||
|
* @param bt4 the bt 4
|
||||||
|
*/
|
||||||
public void setBt4(String bt4) {
|
public void setBt4(String bt4) {
|
||||||
this.bt4 = bt4;
|
this.bt4 = bt4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets title.
|
||||||
|
*
|
||||||
|
* @return the title
|
||||||
|
*/
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets title.
|
||||||
|
*
|
||||||
|
* @param title the title
|
||||||
|
*/
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets message.
|
||||||
|
*
|
||||||
|
* @return the message
|
||||||
|
*/
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets message.
|
||||||
|
*
|
||||||
|
* @param message the message
|
||||||
|
*/
|
||||||
public void setMessage(String message) {
|
public void setMessage(String message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets c xinxi.
|
||||||
|
*
|
||||||
|
* @return the c xinxi
|
||||||
|
*/
|
||||||
public String getCXinxi() {
|
public String getCXinxi() {
|
||||||
return title + message;
|
return title + message;
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,9 @@ import java.util.function.Predicate;
|
|||||||
|
|
||||||
import static com.xcl.supersearch.Utils.*;
|
import static com.xcl.supersearch.Utils.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Search view.
|
||||||
|
*/
|
||||||
public class SearchView extends DependentLayout implements Component.BindStateChangedListener, ContactProviderSR.AdapterClickListener {
|
public class SearchView extends DependentLayout implements Component.BindStateChangedListener, ContactProviderSR.AdapterClickListener {
|
||||||
private static final HiLogLabel label = new HiLogLabel(HiLog.LOG_APP, 0x00234, "SearchView");
|
private static final HiLogLabel label = new HiLogLabel(HiLog.LOG_APP, 0x00234, "SearchView");
|
||||||
private static final float DEFAULT_DIM_AMOUNT = 0.5f;
|
private static final float DEFAULT_DIM_AMOUNT = 0.5f;
|
||||||
@ -179,14 +182,32 @@ public class SearchView extends DependentLayout implements Component.BindStateCh
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Search view.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
*/
|
||||||
SearchView(Context context) {
|
SearchView(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Search view.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
* @param attrSet the attr set
|
||||||
|
*/
|
||||||
public SearchView(Context context, AttrSet attrSet) {
|
public SearchView(Context context, AttrSet attrSet) {
|
||||||
this(context, attrSet, "");
|
this(context, attrSet, "");
|
||||||
}//TODO:修饰符务必为public
|
}//TODO:修饰符务必为public
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Search view.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
* @param attrSet the attr set
|
||||||
|
* @param styleName the style name
|
||||||
|
*/
|
||||||
public SearchView(Context context, AttrSet attrSet, String styleName) {
|
public SearchView(Context context, AttrSet attrSet, String styleName) {
|
||||||
super(context, attrSet, styleName);
|
super(context, attrSet, styleName);
|
||||||
resManager = context.getResourceManager();
|
resManager = context.getResourceManager();
|
||||||
@ -629,6 +650,18 @@ public class SearchView extends DependentLayout implements Component.BindStateCh
|
|||||||
Utils.debug(label, SuggestionList.size() + "个搜索记录");
|
Utils.debug(label, SuggestionList.size() + "个搜索记录");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Onsearch.
|
||||||
|
*
|
||||||
|
* @param contex the contex
|
||||||
|
* @param ListContai the list contai
|
||||||
|
* @param sv the sv
|
||||||
|
* @param backComponen the back componen
|
||||||
|
* @param pgb the pgb
|
||||||
|
* @param cslist the cslist
|
||||||
|
* @param suggestions the suggestions
|
||||||
|
* @param ishow the ishow
|
||||||
|
*/
|
||||||
public void Onsearch(Context contex, ListContainer ListContai, SearchView sv, Component backComponen, RoundProgressBar pgb, List<SRContactor> cslist, List<SHistoryContactor> suggestions, boolean ishow) {
|
public void Onsearch(Context contex, ListContainer ListContai, SearchView sv, Component backComponen, RoundProgressBar pgb, List<SRContactor> cslist, List<SHistoryContactor> suggestions, boolean ishow) {
|
||||||
try {
|
try {
|
||||||
context = contex;
|
context = contex;
|
||||||
@ -658,36 +691,78 @@ public class SearchView extends DependentLayout implements Component.BindStateCh
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets context.
|
||||||
|
*
|
||||||
|
* @param contex the contex
|
||||||
|
* @return the context
|
||||||
|
*/
|
||||||
public SearchView setContext(Context contex) {
|
public SearchView setContext(Context contex) {
|
||||||
context = contex;
|
context = contex;
|
||||||
return Builder();
|
return Builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets round progress bar.
|
||||||
|
*
|
||||||
|
* @param pgb the pgb
|
||||||
|
* @return the round progress bar
|
||||||
|
*/
|
||||||
public SearchView setRoundProgressBar(RoundProgressBar pgb) {
|
public SearchView setRoundProgressBar(RoundProgressBar pgb) {
|
||||||
RoundPB = pgb;
|
RoundPB = pgb;
|
||||||
return Builder();
|
return Builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets search view.
|
||||||
|
*
|
||||||
|
* @param sv the sv
|
||||||
|
* @return the search view
|
||||||
|
*/
|
||||||
public SearchView setSearchView(SearchView sv) {
|
public SearchView setSearchView(SearchView sv) {
|
||||||
SV = sv;
|
SV = sv;
|
||||||
return Builder();
|
return Builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets sr list container.
|
||||||
|
*
|
||||||
|
* @param cslist the cslist
|
||||||
|
* @return the sr list container
|
||||||
|
*/
|
||||||
public SearchView setSRListContainer(List<SRContactor> cslist) {
|
public SearchView setSRListContainer(List<SRContactor> cslist) {
|
||||||
CXList = cslist;
|
CXList = cslist;
|
||||||
return Builder();
|
return Builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets suggestionis show.
|
||||||
|
*
|
||||||
|
* @param ishow the ishow
|
||||||
|
* @return the suggestionis show
|
||||||
|
*/
|
||||||
public SearchView setSuggestionisShow(boolean ishow) {
|
public SearchView setSuggestionisShow(boolean ishow) {
|
||||||
isShow = ishow;
|
isShow = ishow;
|
||||||
return Builder();
|
return Builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets back component.
|
||||||
|
*
|
||||||
|
* @param BackComponent the back component
|
||||||
|
* @return the back component
|
||||||
|
*/
|
||||||
public SearchView setBackComponent(Component BackComponent) {
|
public SearchView setBackComponent(Component BackComponent) {
|
||||||
backComponent = BackComponent;
|
backComponent = BackComponent;
|
||||||
return Builder();
|
return Builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets list container.
|
||||||
|
*
|
||||||
|
* @param ListContai the list contai
|
||||||
|
* @return the list container
|
||||||
|
*/
|
||||||
public SearchView setListContainer(ListContainer ListContai) {
|
public SearchView setListContainer(ListContainer ListContai) {
|
||||||
CPSR = new ContactProviderSR(context);
|
CPSR = new ContactProviderSR(context);
|
||||||
CPSR.setAdapterClickListener(this);
|
CPSR.setAdapterClickListener(this);
|
||||||
@ -701,11 +776,22 @@ public class SearchView extends DependentLayout implements Component.BindStateCh
|
|||||||
return Builder();
|
return Builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets suggestion list.
|
||||||
|
*
|
||||||
|
* @param suggestions the suggestions
|
||||||
|
* @return the suggestion list
|
||||||
|
*/
|
||||||
public SearchView setSuggestionList(List<SHistoryContactor> suggestions) {
|
public SearchView setSuggestionList(List<SHistoryContactor> suggestions) {
|
||||||
SuggestionList = suggestions;
|
SuggestionList = suggestions;
|
||||||
return Builder();
|
return Builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builder search view.
|
||||||
|
*
|
||||||
|
* @return the search view
|
||||||
|
*/
|
||||||
public SearchView Builder() {
|
public SearchView Builder() {
|
||||||
Utils.debug(SearchView.label, "Builder");
|
Utils.debug(SearchView.label, "Builder");
|
||||||
if (isShow) {
|
if (isShow) {
|
||||||
@ -717,6 +803,17 @@ public class SearchView extends DependentLayout implements Component.BindStateCh
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Onsearch.
|
||||||
|
*
|
||||||
|
* @param contex the contex
|
||||||
|
* @param ListContai the list contai
|
||||||
|
* @param sv the sv
|
||||||
|
* @param backComponen the back componen
|
||||||
|
* @param pgb the pgb
|
||||||
|
* @param cslist the cslist
|
||||||
|
* @param ishow the ishow
|
||||||
|
*/
|
||||||
public void Onsearch(Context contex, ListContainer ListContai, SearchView sv, Component backComponen, RoundProgressBar pgb, List<SRContactor> cslist, boolean ishow) {
|
public void Onsearch(Context contex, ListContainer ListContai, SearchView sv, Component backComponen, RoundProgressBar pgb, List<SRContactor> cslist, boolean ishow) {
|
||||||
try {
|
try {
|
||||||
context = contex;
|
context = contex;
|
||||||
@ -745,6 +842,16 @@ public class SearchView extends DependentLayout implements Component.BindStateCh
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Onsearch.
|
||||||
|
*
|
||||||
|
* @param contex the contex
|
||||||
|
* @param ListContai the list contai
|
||||||
|
* @param sv the sv
|
||||||
|
* @param backComponen the back componen
|
||||||
|
* @param pgb the pgb
|
||||||
|
* @param cslist the cslist
|
||||||
|
*/
|
||||||
public void Onsearch(Context contex, ListContainer ListContai, SearchView sv, Component backComponen, RoundProgressBar pgb, List<SRContactor> cslist) {
|
public void Onsearch(Context contex, ListContainer ListContai, SearchView sv, Component backComponen, RoundProgressBar pgb, List<SRContactor> cslist) {
|
||||||
try {
|
try {
|
||||||
context = contex;
|
context = contex;
|
||||||
@ -786,6 +893,11 @@ public class SearchView extends DependentLayout implements Component.BindStateCh
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets back click listener.
|
||||||
|
*
|
||||||
|
* @param backClickListener the back click listener
|
||||||
|
*/
|
||||||
public void setBackClickListener(BackClickListener backClickListener) {
|
public void setBackClickListener(BackClickListener backClickListener) {
|
||||||
this.backClickListener = backClickListener;
|
this.backClickListener = backClickListener;
|
||||||
}
|
}
|
||||||
@ -794,50 +906,110 @@ public class SearchView extends DependentLayout implements Component.BindStateCh
|
|||||||
this.searchListener = searchListener;
|
this.searchListener = searchListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets custom listener.
|
||||||
|
*
|
||||||
|
* @param customlistener the customlistener
|
||||||
|
*/
|
||||||
public void setCustomListener(CustomListener customlistener) {
|
public void setCustomListener(CustomListener customlistener) {
|
||||||
customListener = customlistener;
|
customListener = customlistener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets bt 1 listener.
|
||||||
|
*
|
||||||
|
* @param B1L the b 1 l
|
||||||
|
*/
|
||||||
public void setBt1Listener(Bt1Listener B1L) {
|
public void setBt1Listener(Bt1Listener B1L) {
|
||||||
bt1Listener = B1L;
|
bt1Listener = B1L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets bt 2 listener.
|
||||||
|
*
|
||||||
|
* @param B2L the b 2 l
|
||||||
|
*/
|
||||||
public void setBt2Listener(Bt2Listener B2L) {
|
public void setBt2Listener(Bt2Listener B2L) {
|
||||||
bt2Listener = B2L;
|
bt2Listener = B2L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets bt 3 listener.
|
||||||
|
*
|
||||||
|
* @param B3L the b 3 l
|
||||||
|
*/
|
||||||
public void setBt3Listener(Bt3Listener B3L) {
|
public void setBt3Listener(Bt3Listener B3L) {
|
||||||
bt3Listener = B3L;
|
bt3Listener = B3L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets bt 4 listener.
|
||||||
|
*
|
||||||
|
* @param B4L the b 4 l
|
||||||
|
*/
|
||||||
public void setBt4Listener(Bt4Listener B4L) {
|
public void setBt4Listener(Bt4Listener B4L) {
|
||||||
bt4Listener = B4L;
|
bt4Listener = B4L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets null warn listener.
|
||||||
|
*
|
||||||
|
* @param nullWarn the null warn
|
||||||
|
*/
|
||||||
public void setNullWarnListener(NullWarnListener nullWarn) {
|
public void setNullWarnListener(NullWarnListener nullWarn) {
|
||||||
nullWarnListener = nullWarn;
|
nullWarnListener = nullWarn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets none warn listener.
|
||||||
|
*
|
||||||
|
* @param noneWarn the none warn
|
||||||
|
*/
|
||||||
public void setNoneWarnListener(NoneWarnListener noneWarn) {
|
public void setNoneWarnListener(NoneWarnListener noneWarn) {
|
||||||
noneWarnListener = noneWarn;
|
noneWarnListener = noneWarn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets remove listener.
|
||||||
|
*
|
||||||
|
* @param removeListener the remove listener
|
||||||
|
*/
|
||||||
public void setRemoveListener(RemoveListener removeListener) {
|
public void setRemoveListener(RemoveListener removeListener) {
|
||||||
this.removeListener = removeListener;
|
this.removeListener = removeListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is expand boolean.
|
||||||
|
*
|
||||||
|
* @return the boolean
|
||||||
|
*/
|
||||||
public boolean isExpand() {
|
public boolean isExpand() {
|
||||||
return state == State.EXPANDED;
|
return state == State.EXPANDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show search view.
|
||||||
|
*/
|
||||||
public void showSearchView() {
|
public void showSearchView() {
|
||||||
startExpandAnimation(true);
|
startExpandAnimation(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide search view.
|
||||||
|
*/
|
||||||
public void hideSearchView() {
|
public void hideSearchView() {
|
||||||
startExpandAnimation(false);
|
startExpandAnimation(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On scroll.
|
||||||
|
*
|
||||||
|
* @param component the component
|
||||||
|
* @param scrollX the scroll x
|
||||||
|
* @param scrollY the scroll y
|
||||||
|
* @param oldScrollX the old scroll x
|
||||||
|
* @param oldScrollY the old scroll y
|
||||||
|
*/
|
||||||
public void onScroll(Component component, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
|
public void onScroll(Component component, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
|
||||||
if (InputSearchText.hasFocus()) {
|
if (InputSearchText.hasFocus()) {
|
||||||
InputSearchText.clearFocus();
|
InputSearchText.clearFocus();
|
||||||
@ -868,57 +1040,148 @@ public class SearchView extends DependentLayout implements Component.BindStateCh
|
|||||||
|
|
||||||
|
|
||||||
private enum State {
|
private enum State {
|
||||||
|
/**
|
||||||
|
* Expanded state.
|
||||||
|
*/
|
||||||
EXPANDED,
|
EXPANDED,
|
||||||
|
/**
|
||||||
|
* Collapsed state.
|
||||||
|
*/
|
||||||
COLLAPSED
|
COLLAPSED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interface Back click listener.
|
||||||
|
*/
|
||||||
public interface BackClickListener {
|
public interface BackClickListener {
|
||||||
|
/**
|
||||||
|
* On back click.
|
||||||
|
*/
|
||||||
void onBackClick();
|
void onBackClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interface Search listener.
|
||||||
|
*/
|
||||||
public interface SearchListener {
|
public interface SearchListener {
|
||||||
|
/**
|
||||||
|
* On search.
|
||||||
|
*
|
||||||
|
* @param search the search
|
||||||
|
*/
|
||||||
void onSearch(String search);
|
void onSearch(String search);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interface Custom listener.
|
||||||
|
*/
|
||||||
public interface CustomListener {
|
public interface CustomListener {
|
||||||
|
/**
|
||||||
|
* On filter.
|
||||||
|
*
|
||||||
|
* @param filter the filter
|
||||||
|
*/
|
||||||
void onFilter(String filter);
|
void onFilter(String filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interface Bt 1 listener.
|
||||||
|
*/
|
||||||
public interface Bt1Listener {
|
public interface Bt1Listener {
|
||||||
|
/**
|
||||||
|
* Onb t 1.
|
||||||
|
*
|
||||||
|
* @param position the position
|
||||||
|
*/
|
||||||
void onbT1(int position);
|
void onbT1(int position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interface Bt 2 listener.
|
||||||
|
*/
|
||||||
public interface Bt2Listener {
|
public interface Bt2Listener {
|
||||||
|
/**
|
||||||
|
* Onb t 2.
|
||||||
|
*
|
||||||
|
* @param position the position
|
||||||
|
*/
|
||||||
void onbT2(int position);
|
void onbT2(int position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interface Bt 3 listener.
|
||||||
|
*/
|
||||||
public interface Bt3Listener {
|
public interface Bt3Listener {
|
||||||
|
/**
|
||||||
|
* Onb t 3.
|
||||||
|
*
|
||||||
|
* @param position the position
|
||||||
|
*/
|
||||||
void onbT3(int position);
|
void onbT3(int position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interface Bt 4 listener.
|
||||||
|
*/
|
||||||
public interface Bt4Listener {
|
public interface Bt4Listener {
|
||||||
|
/**
|
||||||
|
* Onb t 4.
|
||||||
|
*
|
||||||
|
* @param position the position
|
||||||
|
*/
|
||||||
void onbT4(int position);
|
void onbT4(int position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interface Null warn listener.
|
||||||
|
*/
|
||||||
public interface NullWarnListener {
|
public interface NullWarnListener {
|
||||||
|
/**
|
||||||
|
* On null error.
|
||||||
|
*/
|
||||||
void onNullError();
|
void onNullError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interface None warn listener.
|
||||||
|
*/
|
||||||
public interface NoneWarnListener {
|
public interface NoneWarnListener {
|
||||||
|
/**
|
||||||
|
* On null warn.
|
||||||
|
*/
|
||||||
void onNullWarn();
|
void onNullWarn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interface Remove listener.
|
||||||
|
*/
|
||||||
public interface RemoveListener {
|
public interface RemoveListener {
|
||||||
|
/**
|
||||||
|
* On remove history.
|
||||||
|
*
|
||||||
|
* @param position the position
|
||||||
|
* @param suggestion the suggestion
|
||||||
|
*/
|
||||||
void onRemoveHistory(int position, SHistoryContactor suggestion);
|
void onRemoveHistory(int position, SHistoryContactor suggestion);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class HistoryProvider extends BaseItemProvider {
|
private class HistoryProvider extends BaseItemProvider {
|
||||||
private List<SHistoryContactor> mData;
|
private List<SHistoryContactor> mData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new History provider.
|
||||||
|
*
|
||||||
|
* @param data the data
|
||||||
|
*/
|
||||||
HistoryProvider(List<SHistoryContactor> data) {
|
HistoryProvider(List<SHistoryContactor> data) {
|
||||||
mData = data;
|
mData = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets data.
|
||||||
|
*
|
||||||
|
* @param mData the m data
|
||||||
|
*/
|
||||||
void setData(List<SHistoryContactor> mData) {
|
void setData(List<SHistoryContactor> mData) {
|
||||||
this.mData = mData;
|
this.mData = mData;
|
||||||
}
|
}
|
||||||
|
@ -28,11 +28,31 @@ import ohos.hiviewdfx.HiLogLabel;
|
|||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Utils.
|
||||||
|
*/
|
||||||
public class Utils {
|
public class Utils {
|
||||||
|
/**
|
||||||
|
* The constant pd_pd.
|
||||||
|
*/
|
||||||
public static boolean pd_pd = false;
|
public static boolean pd_pd = false;
|
||||||
|
/**
|
||||||
|
* The constant iswear.
|
||||||
|
*/
|
||||||
public static boolean iswear = false;
|
public static boolean iswear = false;
|
||||||
|
/**
|
||||||
|
* The Res manager.
|
||||||
|
*/
|
||||||
static ResourceManager resManager;
|
static ResourceManager resManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets boolean.
|
||||||
|
*
|
||||||
|
* @param attrSet the attr set
|
||||||
|
* @param attrName the attr name
|
||||||
|
* @param defaultValue the default value
|
||||||
|
* @return the boolean
|
||||||
|
*/
|
||||||
public static boolean getBoolean(AttrSet attrSet, String attrName, boolean defaultValue) {
|
public static boolean getBoolean(AttrSet attrSet, String attrName, boolean defaultValue) {
|
||||||
if (attrSet == null || attrName == null || attrName.isEmpty()) {
|
if (attrSet == null || attrName == null || attrName.isEmpty()) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
@ -44,6 +64,14 @@ public class Utils {
|
|||||||
return attrOptional.get().getBoolValue();
|
return attrOptional.get().getBoolValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets float.
|
||||||
|
*
|
||||||
|
* @param attrSet the attr set
|
||||||
|
* @param attrName the attr name
|
||||||
|
* @param defaultValue the default value
|
||||||
|
* @return the float
|
||||||
|
*/
|
||||||
public static float getFloat(AttrSet attrSet, String attrName, float defaultValue) {
|
public static float getFloat(AttrSet attrSet, String attrName, float defaultValue) {
|
||||||
if (attrSet == null || attrName == null || attrName.isEmpty()) {
|
if (attrSet == null || attrName == null || attrName.isEmpty()) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
@ -55,6 +83,14 @@ public class Utils {
|
|||||||
return attrOptional.get().getFloatValue();
|
return attrOptional.get().getFloatValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets color.
|
||||||
|
*
|
||||||
|
* @param attrSet the attr set
|
||||||
|
* @param attrName the attr name
|
||||||
|
* @param defaultColor the default color
|
||||||
|
* @return the color
|
||||||
|
*/
|
||||||
public static int getColor(AttrSet attrSet, String attrName, int defaultColor) {
|
public static int getColor(AttrSet attrSet, String attrName, int defaultColor) {
|
||||||
if (attrSet == null || attrName == null || attrName.isEmpty()) {
|
if (attrSet == null || attrName == null || attrName.isEmpty()) {
|
||||||
return defaultColor;
|
return defaultColor;
|
||||||
@ -67,6 +103,14 @@ public class Utils {
|
|||||||
return attrOptional.get().getColorValue().getValue();
|
return attrOptional.get().getColorValue().getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets dimension.
|
||||||
|
*
|
||||||
|
* @param attrSet the attr set
|
||||||
|
* @param attrName the attr name
|
||||||
|
* @param defaultValue the default value
|
||||||
|
* @return the dimension
|
||||||
|
*/
|
||||||
public static int getDimension(AttrSet attrSet, String attrName, int defaultValue) {
|
public static int getDimension(AttrSet attrSet, String attrName, int defaultValue) {
|
||||||
if (attrSet == null || attrName == null || attrName.isEmpty()) {
|
if (attrSet == null || attrName == null || attrName.isEmpty()) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
@ -78,6 +122,14 @@ public class Utils {
|
|||||||
return attrOptional.get().getDimensionValue() * 3;
|
return attrOptional.get().getDimensionValue() * 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets element.
|
||||||
|
*
|
||||||
|
* @param attrSet the attr set
|
||||||
|
* @param attrName the attr name
|
||||||
|
* @param defaultElement the default element
|
||||||
|
* @return the element
|
||||||
|
*/
|
||||||
public static Element getElement(AttrSet attrSet, String attrName, Element defaultElement) {
|
public static Element getElement(AttrSet attrSet, String attrName, Element defaultElement) {
|
||||||
if (attrSet == null || attrName == null || attrName.isEmpty()) {
|
if (attrSet == null || attrName == null || attrName.isEmpty()) {
|
||||||
return defaultElement;
|
return defaultElement;
|
||||||
@ -89,10 +141,25 @@ public class Utils {
|
|||||||
return attrOptional.get().getElement();
|
return attrOptional.get().getElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vp to px int.
|
||||||
|
*
|
||||||
|
* @param vp the vp
|
||||||
|
* @param displayAttributes the display attributes
|
||||||
|
* @return the int
|
||||||
|
*/
|
||||||
public static int vpToPx(float vp, DisplayAttributes displayAttributes) {
|
public static int vpToPx(float vp, DisplayAttributes displayAttributes) {
|
||||||
return (int) (vp * displayAttributes.densityPixels + 0.5f);
|
return (int) (vp * displayAttributes.densityPixels + 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets string.
|
||||||
|
*
|
||||||
|
* @param attrSet the attr set
|
||||||
|
* @param attrName the attr name
|
||||||
|
* @param defaultValue the default value
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
public static String getString(AttrSet attrSet, String attrName, String defaultValue) {
|
public static String getString(AttrSet attrSet, String attrName, String defaultValue) {
|
||||||
if (attrSet == null || attrName == null || attrName.isEmpty()) {
|
if (attrSet == null || attrName == null || attrName.isEmpty()) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
@ -104,6 +171,12 @@ public class Utils {
|
|||||||
return attrOptional.get().getStringValue();
|
return attrOptional.get().getStringValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hq string string.
|
||||||
|
*
|
||||||
|
* @param a1 the a 1
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
public static String HQString(int a1) {
|
public static String HQString(int a1) {
|
||||||
try {
|
try {
|
||||||
String text = resManager.getElement(a1).getString();
|
String text = resManager.getElement(a1).getString();
|
||||||
@ -113,6 +186,13 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adjust color alpha element.
|
||||||
|
*
|
||||||
|
* @param color the color
|
||||||
|
* @param alpha the alpha
|
||||||
|
* @return the element
|
||||||
|
*/
|
||||||
public static Element adjustColorAlpha(int color, float alpha) {
|
public static Element adjustColorAlpha(int color, float alpha) {
|
||||||
final int alphaChannel = (int) (255 * alpha);
|
final int alphaChannel = (int) (255 * alpha);
|
||||||
final int redChannel = (color >> 16) & 0xFF;
|
final int redChannel = (color >> 16) & 0xFF;
|
||||||
@ -125,30 +205,60 @@ public class Utils {
|
|||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Info.
|
||||||
|
*
|
||||||
|
* @param label the label
|
||||||
|
* @param message the message
|
||||||
|
*/
|
||||||
public static void info(HiLogLabel label, String message) {
|
public static void info(HiLogLabel label, String message) {
|
||||||
if (pd_pd) {
|
if (pd_pd) {
|
||||||
HiLog.info(label, "信息:[" + message + "]");
|
HiLog.info(label, "信息:[" + message + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Warn.
|
||||||
|
*
|
||||||
|
* @param label the label
|
||||||
|
* @param message the message
|
||||||
|
*/
|
||||||
public static void warn(HiLogLabel label, String message) {
|
public static void warn(HiLogLabel label, String message) {
|
||||||
if (pd_pd) {
|
if (pd_pd) {
|
||||||
HiLog.warn(label, "警告:[" + message + "]");
|
HiLog.warn(label, "警告:[" + message + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error.
|
||||||
|
*
|
||||||
|
* @param label the label
|
||||||
|
* @param message the message
|
||||||
|
*/
|
||||||
public static void error(HiLogLabel label, String message) {
|
public static void error(HiLogLabel label, String message) {
|
||||||
if (pd_pd) {
|
if (pd_pd) {
|
||||||
HiLog.error(label, "错误:[" + message + "]");
|
HiLog.error(label, "错误:[" + message + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Debug.
|
||||||
|
*
|
||||||
|
* @param label the label
|
||||||
|
* @param message the message
|
||||||
|
*/
|
||||||
public static void debug(HiLogLabel label, String message) {
|
public static void debug(HiLogLabel label, String message) {
|
||||||
if (pd_pd) {
|
if (pd_pd) {
|
||||||
HiLog.debug(label, "调试:[" + message + "]");
|
HiLog.debug(label, "调试:[" + message + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make press color int.
|
||||||
|
*
|
||||||
|
* @param backgroundColor the background color
|
||||||
|
* @return the int
|
||||||
|
*/
|
||||||
protected int makePressColor(int backgroundColor) {
|
protected int makePressColor(int backgroundColor) {
|
||||||
int r = (backgroundColor >> 16) & 0xFF;
|
int r = (backgroundColor >> 16) & 0xFF;
|
||||||
int g = (backgroundColor >> 8) & 0xFF;
|
int g = (backgroundColor >> 8) & 0xFF;
|
||||||
|
Reference in New Issue
Block a user