|
@@ -3,6 +3,7 @@ package com.tencent.qcloud.tuikit.tuisearch.classicui.page;
|
|
|
import android.content.Context;
|
|
|
import android.content.Intent;
|
|
|
import android.graphics.Color;
|
|
|
+import android.graphics.drawable.Drawable;
|
|
|
import android.net.Uri;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.IBinder;
|
|
@@ -22,10 +23,13 @@ import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.RelativeLayout;
|
|
|
import android.widget.TextView;
|
|
|
+
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
+
|
|
|
import com.tencent.qcloud.tuicore.TUIConstants;
|
|
|
import com.tencent.qcloud.tuicore.TUIThemeManager;
|
|
|
+import com.tencent.qcloud.tuikit.timcommon.component.MessageProperties;
|
|
|
import com.tencent.qcloud.tuikit.timcommon.component.activities.BaseLightActivity;
|
|
|
import com.tencent.qcloud.tuikit.timcommon.component.dialog.TUIKitDialog;
|
|
|
import com.tencent.qcloud.tuikit.timcommon.component.interfaces.IUIKitCallback;
|
|
@@ -38,6 +42,7 @@ import com.tencent.qcloud.tuikit.tuisearch.classicui.widget.PageRecycleView;
|
|
|
import com.tencent.qcloud.tuikit.tuisearch.classicui.widget.SearchResultAdapter;
|
|
|
import com.tencent.qcloud.tuikit.tuisearch.presenter.SearchMainPresenter;
|
|
|
import com.tencent.qcloud.tuikit.tuisearch.util.TUISearchLog;
|
|
|
+
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -70,6 +75,7 @@ public class SearchMainActivity extends BaseLightActivity {
|
|
|
private List<SearchDataBean> mConversationData = new ArrayList<>();
|
|
|
|
|
|
private SearchMainPresenter presenter;
|
|
|
+ private ImageView mIvSearch;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
@@ -82,6 +88,14 @@ public class SearchMainActivity extends BaseLightActivity {
|
|
|
|
|
|
private void init() {
|
|
|
initView();
|
|
|
+ int searchIconRes = MessageProperties.getInstance().getSearchIconRes();
|
|
|
+ if (searchIconRes != -1) {
|
|
|
+ mIvSearch.setImageResource(searchIconRes);
|
|
|
+ }
|
|
|
+ int mainStyleColor = MessageProperties.getInstance().getMainStyleColor();
|
|
|
+ if (mainStyleColor != -1) {
|
|
|
+ mCancleView.setTextColor(mainStyleColor);
|
|
|
+ }
|
|
|
|
|
|
if (mContactRcSearchAdapter == null) {
|
|
|
mContactRcSearchAdapter = new SearchResultAdapter(this);
|
|
@@ -112,10 +126,12 @@ public class SearchMainActivity extends BaseLightActivity {
|
|
|
private void setListener() {
|
|
|
mEdtSearch.addTextChangedListener(new TextWatcher() {
|
|
|
@Override
|
|
|
- public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
|
|
|
+ public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
- public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
|
|
|
+ public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public void afterTextChanged(Editable editable) {
|
|
@@ -281,7 +297,9 @@ public class SearchMainActivity extends BaseLightActivity {
|
|
|
}
|
|
|
|
|
|
final List<String> keywordList = new ArrayList<String>() {
|
|
|
- { add(keyWords); }
|
|
|
+ {
|
|
|
+ add(keyWords);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
presenter.searchContact(keywordList, new IUIKitCallback<List<SearchDataBean>>() {
|
|
@@ -372,7 +390,7 @@ public class SearchMainActivity extends BaseLightActivity {
|
|
|
String buyingGuidelines = getResources().getString(R.string.search_buying_guidelines);
|
|
|
int buyingGuidelinesIndex = string.lastIndexOf(buyingGuidelines);
|
|
|
final int foregroundColor =
|
|
|
- getResources().getColor(TUIThemeManager.getAttrResId(SearchMainActivity.this, com.tencent.qcloud.tuicore.R.attr.core_primary_color));
|
|
|
+ getResources().getColor(TUIThemeManager.getAttrResId(SearchMainActivity.this, com.tencent.qcloud.tuicore.R.attr.core_primary_color));
|
|
|
SpannableString spannedString = new SpannableString(string);
|
|
|
ForegroundColorSpan colorSpan2 = new ForegroundColorSpan(foregroundColor);
|
|
|
spannedString.setSpan(colorSpan2, buyingGuidelinesIndex, buyingGuidelinesIndex + buyingGuidelines.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
|
|
@@ -394,31 +412,31 @@ public class SearchMainActivity extends BaseLightActivity {
|
|
|
};
|
|
|
spannedString.setSpan(clickableSpan2, buyingGuidelinesIndex, buyingGuidelinesIndex + buyingGuidelines.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
|
|
|
TUIKitDialog.TUIIMUpdateDialog.getInstance()
|
|
|
- .createDialog(this)
|
|
|
- .setShowOnlyDebug(true)
|
|
|
- .setMovementMethod(LinkMovementMethod.getInstance())
|
|
|
- .setHighlightColor(Color.TRANSPARENT)
|
|
|
- .setCancelable(true)
|
|
|
- .setCancelOutside(true)
|
|
|
- .setTitle(spannedString)
|
|
|
- .setDialogWidth(0.75f)
|
|
|
- .setDialogFeatureName(TUIConstants.BuyingFeature.BUYING_FEATURE_SEARCH)
|
|
|
- .setPositiveButton(getString(R.string.search_no_more_reminders),
|
|
|
- new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- TUIKitDialog.TUIIMUpdateDialog.getInstance().dismiss();
|
|
|
- TUIKitDialog.TUIIMUpdateDialog.getInstance().setNeverShow(true);
|
|
|
- }
|
|
|
- })
|
|
|
- .setNegativeButton(getString(R.string.search_i_know),
|
|
|
- new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- TUIKitDialog.TUIIMUpdateDialog.getInstance().dismiss();
|
|
|
- }
|
|
|
- })
|
|
|
- .show();
|
|
|
+ .createDialog(this)
|
|
|
+ .setShowOnlyDebug(true)
|
|
|
+ .setMovementMethod(LinkMovementMethod.getInstance())
|
|
|
+ .setHighlightColor(Color.TRANSPARENT)
|
|
|
+ .setCancelable(true)
|
|
|
+ .setCancelOutside(true)
|
|
|
+ .setTitle(spannedString)
|
|
|
+ .setDialogWidth(0.75f)
|
|
|
+ .setDialogFeatureName(TUIConstants.BuyingFeature.BUYING_FEATURE_SEARCH)
|
|
|
+ .setPositiveButton(getString(R.string.search_no_more_reminders),
|
|
|
+ new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ TUIKitDialog.TUIIMUpdateDialog.getInstance().dismiss();
|
|
|
+ TUIKitDialog.TUIIMUpdateDialog.getInstance().setNeverShow(true);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .setNegativeButton(getString(R.string.search_i_know),
|
|
|
+ new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ TUIKitDialog.TUIIMUpdateDialog.getInstance().dismiss();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .show();
|
|
|
}
|
|
|
|
|
|
private void openWebUrl(String url) {
|
|
@@ -431,6 +449,7 @@ public class SearchMainActivity extends BaseLightActivity {
|
|
|
}
|
|
|
|
|
|
private void initView() {
|
|
|
+ mIvSearch = findViewById(R.id.iv_search);
|
|
|
mEdtSearch = (EditText) findViewById(R.id.edt_search);
|
|
|
mImgvDelete = (ImageView) findViewById(R.id.imgv_delete);
|
|
|
mFriendRcSearch = (RecyclerView) findViewById(R.id.friend_rc_search);
|