Commit 0b399b85 authored by 王雪伟's avatar 王雪伟

[提交人]:王雪伟

[提交简述] :1.1.1
[实现方案] :修改搜索
parent 5a5aa459
PACKAGE_NAME=com.zxhl.shop
VERSION_CODE=12
VERSION_NAME=1.1.1
\ No newline at end of file
VERSION_CODE=11
VERSION_NAME=1.1.0
\ No newline at end of file
......@@ -40,7 +40,7 @@ object EventApiClient {
.connectTimeout(10000, TimeUnit.MILLISECONDS)
.readTimeout(10000, TimeUnit.MILLISECONDS)
.addInterceptor(logInterceptor.apply {
level = HttpLoggingInterceptor.Level.BODY
level = HttpLoggingInterceptor.Level.NONE
})
.hostnameVerifier { hostname, session ->
true
......
......@@ -287,4 +287,7 @@ interface RounterApi {
@RounterUri(Constant.scheme + "://recharge")
fun getIntentRecharge(): Intent
@RounterUri(Constant.scheme + "://search")
fun getIntentSearch(): Intent
}
\ No newline at end of file
......@@ -500,4 +500,14 @@ public class JumpUtils {
Utils.showToast(AppContext.get(), "该版本暂不支持,请更新版本!");
}
}
public static void SearchJump() {
try {
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentSearch();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
AppContext.get().startActivity(intent);
} catch (Exception e) {
Utils.showToast(AppContext.get(), "该版本暂不支持,请更新版本!");
}
}
}
......@@ -344,6 +344,22 @@
android:scheme="xxsqshop" />
</intent-filter>
</activity>
<activity
android:name=".activity.SearchActivity"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="search"
android:scheme="xxsqshop" />
</intent-filter>
</activity>
</application>
......
......@@ -13,9 +13,12 @@ import com.zxbw.modulemain.adapter.SearchGoodsTopAdapter
import com.zxbw.modulemain.contract.SearchContract
import com.zxbw.modulemain.presenter.SearchPresenter
import com.zxbw.modulemain.uitls.SPUtils
import com.zxhl.cms.common.Constant
import com.zxhl.cms.common.base.BaseActivity
import com.zxhl.cms.net.model.qy.TbGoodsItemEntity
import com.zxhl.cms.net.model.shop.ShopListEntity
import com.zxhl.cms.utils.EventUtils
import com.zxhl.cms.utils.JumpUtils
import com.zxhl.cms.utils.OnRecycleItemClickListener
import kotlinx.android.synthetic.main.activity_layout_search.*
......@@ -26,7 +29,7 @@ import kotlinx.android.synthetic.main.activity_layout_search.*
* @detail :搜索
*/
class SearchActivity : BaseActivity(), SearchContract.View,
OnRecycleItemClickListener<ShopListEntity> {
OnRecycleItemClickListener<TbGoodsItemEntity> {
private var mPresenter: SearchPresenter? = null
var mGoodsAdapter: SearchGoodsTopAdapter? = null
override fun before() {
......@@ -51,7 +54,6 @@ class SearchActivity : BaseActivity(), SearchContract.View,
SPUtils.getInstance(this).saveHistory(searchValue)
// showToast(searchValue)
// JumpUtils.SearchReslutJumo(searchValue, "0", "")
finish()
}
}
}
......@@ -96,7 +98,7 @@ class SearchActivity : BaseActivity(), SearchContract.View,
}
}
override fun setBestGoodsList(result: List<ShopListEntity>?) {
override fun setBestGoodsList(result: List<TbGoodsItemEntity>?) {
if (result.isNullOrEmpty()) {
id_tv_title2.visibility = View.GONE
id_rck_goods_list.visibility = View.GONE
......@@ -137,7 +139,6 @@ class SearchActivity : BaseActivity(), SearchContract.View,
id_search_history_view.setOnTagClickListener { view, position ->
// JumpUtils.SearchReslutJumo(mData[position], "0", "")
finish()
}
}
......@@ -212,13 +213,21 @@ class SearchActivity : BaseActivity(), SearchContract.View,
id_search_history_view.setChildren(mViewList)
}
override fun onItemClick(view: View?, position: Int, data: ShopListEntity?) {
EventUtils.onEvent("ShopGoodsClick", data?.id ?: "-1")
// var intent = Intent();
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
// intent.putExtra("goods", data)
// intent.setClass(this, ShopGoodsDetailActivity().javaClass)
// startActivity(intent)
override fun onItemClick(view: View?, position: Int, data: TbGoodsItemEntity?) {
EventUtils.onEvent("SearchGoodsClick", data?.id ?: "-1")
if (data?.bannerType.equals("blindBox")){
// if (!Constant.Switch.isOpenVip) {
// JumpUtils.MemberOrderJump()
// }else{
// JumpUtils.goodsDetailJump(data?.boxId)
// }
}else{
var intent = Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
intent.putExtra("goods", data)
intent.setClass(this, TbGoodsDetailActivity().javaClass)
startActivity(intent)
}
}
}
\ No newline at end of file
package com.zxbw.modulemain.adapter
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.graphics.Paint
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.RelativeLayout
import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.zxbw.modulemain.R
import com.zxhl.cms.AppContext
import com.zxhl.cms.common.base.BaseRecyclerAdapter
import com.zxhl.cms.net.model.box.DepotEntity
import com.zxhl.cms.net.model.box.ShopOrderEntity
import com.zxhl.cms.net.model.shop.ShopListEntity
import com.zxhl.cms.net.model.qy.TbGoodsItemEntity
import com.zxhl.cms.utils.OnRecycleItemClickListener
import com.zxhl.cms.utils.Utils
import com.zxhl.cms.widget.RecycleImageView
//搜索商品排行榜
class SearchGoodsTopAdapter :
BaseRecyclerAdapter<ShopListEntity, SearchGoodsTopAdapter.ViewHolder> {
BaseRecyclerAdapter<TbGoodsItemEntity, SearchGoodsTopAdapter.ViewHolder> {
private var mContext: Context? = null
private val listener: OnRecycleItemClickListener<ShopListEntity>
private val listener: OnRecycleItemClickListener<TbGoodsItemEntity>
// private var mTopIconList = listOf(
//// R.drawable.icon_goods_top1,
//// R.drawable.icon_goods_top2,
//// R.drawable.icon_goods_top3,
//// R.drawable.icon_goods_top4,
//// R.drawable.icon_goods_top5,
//// R.drawable.icon_goods_top6,
//// R.drawable.icon_goods_top7,
//// R.drawable.icon_goods_top8,
//// R.drawable.icon_goods_top9
// )
private var mTopIconList = listOf(
R.drawable.icon_goods_top1,
R.drawable.icon_goods_top2,
R.drawable.icon_goods_top3,
R.drawable.icon_goods_top4,
R.drawable.icon_goods_top5,
R.drawable.icon_goods_top6,
R.drawable.icon_goods_top7,
R.drawable.icon_goods_top8,
R.drawable.icon_goods_top9
)
constructor(
content: Context?,
listener: OnRecycleItemClickListener<ShopListEntity>
listener: OnRecycleItemClickListener<TbGoodsItemEntity>
) : super() {
mContext = content
this.listener = listener
......@@ -51,53 +45,74 @@ class SearchGoodsTopAdapter :
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
var bean = mList[position]
// holder.id_rl_goods_item?.setOnClickListener {
// listener?.onItemClick(it, position, bean)
// }
// holder.id_tv_goods_name?.text = bean.productName
//// holder.id_tv_goods_price?.text = bean.salePriceStr
// holder.id_tv_goods_price?.text = bean.originalPriceDb
// holder.id_img_goods_img?.setLoadImageUrl(bean.mainImage, false)
// holder.id_tv_goods_sale_num?.text = "${bean.salesVolume ?: "0"}人付款"
//// holder.id_tv_goods_old_price?.text = "¥${bean.originalPriceDb}"
// holder.id_tv_goods_old_price?.text = "¥${bean.salePriceStr}"
// holder.id_tv_goods_old_price?.paint?.flags = Paint.STRIKE_THRU_TEXT_FLAG
holder.id_rl_goods_item?.setOnClickListener {
listener?.onItemClick(it, position, bean)
}
holder.id_tv_goods_name?.text = bean.title
if (bean.coupon_amount.isNullOrEmpty()) {
holder.id_tv_goods_price?.text = "${bean.zk_final_price}"
} else {
var r_price = bean.zk_final_price?.toDoubleOrNull() ?: 0 as Double
var c_price = bean.coupon_amount?.toDoubleOrNull() ?: 0 as Double
holder.id_tv_goods_price?.text = Utils.getNoMoreThanTwoDigits(
Utils.sub(
r_price,
c_price
)
)
}
if (bean.pict_url?.startsWith("//img") == true) {
holder.id_img_goods_img?.setLoadImageUrl("https:" + bean.pict_url, 0, 5)
} else {
holder.id_img_goods_img?.setLoadImageUrl(bean.pict_url, 0, 5)
}
holder.id_tv_goods_sale_num?.text = "${bean.volume ?: "0"}人付款"
// holder.id_tv_goods_old_price?.text = "¥${bean.originalPriceDb}"
holder.id_tv_goods_old_price?.text = "¥${bean.zk_final_price}"
holder.id_tv_goods_old_price?.paint?.flags = Paint.STRIKE_THRU_TEXT_FLAG
if (position < 9) {
// holder.id_img_goods_number?.setImageResource(mTopIconList[position])
holder.id_img_goods_number?.setImageResource(mTopIconList[position])
}
}
override fun getItemCount(): Int {
if (mList.size > 9) {
return 9;
} else {
return super.getItemCount()
}
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
// return ViewHolder(
// LayoutInflater.from(AppContext.get())
// .inflate(R.layout.item_search_goods_view, parent, false)
// )
return ViewHolder(
LayoutInflater.from(AppContext.get())
.inflate(R.layout.item_layout_skill_time, parent, false)
.inflate(R.layout.item_search_top_goods_view, parent, false)
)
}
class ViewHolder : RecyclerView.ViewHolder {
// var id_rl_goods_item: RelativeLayout?
// var id_img_goods_img: RecycleImageView?
// var id_tv_goods_name: TextView?
// var id_tv_goods_price: TextView?
// var id_tv_goods_old_price: TextView?
// var id_tv_goods_sale_num: TextView?
// var id_img_goods_number: ImageView?
var id_rl_goods_item: RelativeLayout?
var id_img_goods_img: RecycleImageView?
var id_tv_goods_name: TextView?
var id_tv_goods_price: TextView?
var id_tv_goods_old_price: TextView?
var id_tv_goods_sale_num: TextView?
var id_img_goods_number: ImageView?
constructor(
itemView: View
) : super(itemView) {
// id_rl_goods_item = itemView.findViewById<RelativeLayout>(R.id.id_rl_goods_item)
// id_img_goods_img = itemView.findViewById<RecycleImageView>(R.id.id_img_goods_img)
// id_tv_goods_name = itemView.findViewById<TextView>(R.id.id_tv_goods_name)
// id_tv_goods_price = itemView.findViewById<TextView>(R.id.id_tv_goods_price)
// id_tv_goods_old_price = itemView.findViewById<TextView>(R.id.id_tv_goods_old_price)
// id_tv_goods_sale_num = itemView.findViewById<TextView>(R.id.id_tv_goods_sale_num)
// id_img_goods_number = itemView.findViewById<ImageView>(R.id.id_img_goods_number)
id_rl_goods_item = itemView.findViewById<RelativeLayout>(R.id.id_rl_goods_item)
id_img_goods_img = itemView.findViewById<RecycleImageView>(R.id.id_img_goods_img)
id_tv_goods_name = itemView.findViewById<TextView>(R.id.id_tv_goods_name)
id_tv_goods_price = itemView.findViewById<TextView>(R.id.id_tv_goods_price)
id_tv_goods_old_price = itemView.findViewById<TextView>(R.id.id_tv_goods_old_price)
id_tv_goods_sale_num = itemView.findViewById<TextView>(R.id.id_tv_goods_sale_num)
id_img_goods_number = itemView.findViewById<ImageView>(R.id.id_img_goods_number)
}
}
......
package com.zxbw.modulemain.contract
import com.zxhl.cms.net.model.qy.TbGoodsItemEntity
import com.zxhl.cms.net.model.shop.ShopListEntity
......@@ -7,7 +8,7 @@ class SearchContract {
interface View {
fun setSearchHistory()
fun setBestGoodsList(result: List<ShopListEntity>?)
fun setBestGoodsList(result: List<TbGoodsItemEntity>?)
}
interface Presenter {
......
......@@ -57,7 +57,7 @@ class HomeFragment : BaseFragment(), HomeContract.View, UpdateCallback {
mPresenter = HomePresenter(this)
id_rl_search_view.setOnClickListener {
showToast("搜索")
JumpUtils.SearchJump()
}
id_img_kefu.setOnClickListener {
// JumpUtils.webJump("客服", NetConfig.H5.WEB_URL_CUSTOMER_SERVICE)
......@@ -113,16 +113,19 @@ class HomeFragment : BaseFragment(), HomeContract.View, UpdateCallback {
id_fragment_home_tab.textUnselectColor = Color.parseColor("#FCFFFFFF")
id_fragment_home_tab.indicatorColor = Color.parseColor("#FFFFFF")
toolbar_layout.setContentScrimColor(Color.parseColor("#8B3AFE"))
id_tv_search_btn.setBackgroundResource(R.drawable.shape_8d41fd_r15)
} else if (bannerType.equals("H5")) {
id_fragment_home_tab.textSelectColor = Color.parseColor("#333333")
id_fragment_home_tab.textUnselectColor = Color.parseColor("#5C6C52")
id_fragment_home_tab.indicatorColor = Color.parseColor("#333333")
id_fragment_home_tab.textSelectColor = Color.parseColor("#FFFFFF")
id_fragment_home_tab.textUnselectColor = Color.parseColor("#FCFFFFFF")
id_fragment_home_tab.indicatorColor = Color.parseColor("#FFFFFF")
toolbar_layout.setContentScrimColor(Color.parseColor("#628E43"))
id_tv_search_btn.setBackgroundResource(R.drawable.shape_689349_r15)
} else {
id_fragment_home_tab.textSelectColor = Color.parseColor("#FFFFFF")
id_fragment_home_tab.textUnselectColor = Color.parseColor("#FFDBDB")
id_fragment_home_tab.indicatorColor = Color.parseColor("#FFFFFF")
toolbar_layout.setContentScrimColor(Color.parseColor("#FFED2E28"))
id_tv_search_btn.setBackgroundResource(R.drawable.shape_eb3625_r15)
}
}
......
package com.zxbw.modulemain.presenter
import com.zxbw.modulemain.contract.SearchContract
import com.zxhl.cms.net.ApiClient
import com.zxhl.cms.net.RxSchedulers
import com.zxhl.cms.net.callback.BaseObserver
import com.zxhl.cms.net.model.qy.TbGoodsEntity
class SearchPresenter : SearchContract.Presenter {
private val mView: SearchContract.View
......@@ -15,17 +19,17 @@ class SearchPresenter : SearchContract.Presenter {
}
override fun getBestGoodsList() {
// ApiClient.shopApi.getShopHotProducts()
// .compose(RxSchedulers.observableIO2Main())
// .subscribe(object : BaseObserver<List<ShopListEntity>>() {
// override fun onSuccess(result: List<ShopListEntity>?) {
// mView.setBestGoodsList(result)
// }
//
// override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
// mView.setBestGoodsList(null)
// }
// })
ApiClient.homeApi.getGoodsGuessLike(1, 9)
.compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<TbGoodsEntity>() {
override fun onSuccess(result: TbGoodsEntity?) {
mView.setBestGoodsList(result?.data)
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
mView.setBestGoodsList(null)
}
})
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#689349" />
<corners android:radius="15dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#8D41FD" />
<corners android:radius="15dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff" />
<stroke
android:width="1dp"
android:color="#EDEDED" />
<corners android:radius="10dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#F5F6F7" />
<corners android:radius="21dp" />
</shape>
\ No newline at end of file
......@@ -33,7 +33,7 @@
<com.zxbw.modulemain.view.WrapContentHeightViewPager
android:id="@+id/id_home_top_banner"
android:layout_width="match_parent"
android:layout_height="280dp" />
android:layout_height="wrap_content" />
<com.zhpan.indicator.IndicatorView
android:id="@+id/indicator_view"
......@@ -81,10 +81,11 @@
android:drawableLeft="@drawable/icon_search"
android:drawablePadding="4dp"
android:text="搜索商品"
android:textColor="@color/color_000000"
android:textColor="@color/color_999999"
android:textSize="14sp" />
<TextView
android:id="@+id/id_tv_search_btn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/id_rl_goods_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:background="@drawable/shape_ededed_r10_stroke"
android:orientation="vertical">
<com.zxhl.cms.widget.RecycleImageView
android:id="@+id/id_img_goods_img"
android:layout_width="match_parent"
android:layout_height="74dp"
android:layout_margin="6dp" />
<TextView
android:id="@+id/id_tv_goods_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/id_img_goods_img"
android:ellipsize="end"
android:maxLines="1"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:textColor="@color/color_333333"
android:textSize="14sp" />
<LinearLayout
android:id="@+id/id_ll_goods_price_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/id_tv_goods_name"
android:layout_marginLeft="8dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="¥"
android:textColor="#F22B52"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/id_tv_goods_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="9.9"
android:textColor="#F22B52"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/id_ll_goods_price_view"
android:layout_marginLeft="8dp"
android:layout_marginTop="1dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:orientation="horizontal">
<TextView
android:id="@+id/id_tv_goods_old_price"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="¥2300"
android:textColor="@color/color_999999"
android:textSize="10sp"
android:textStyle="bold" />
<TextView
android:id="@+id/id_tv_goods_sale_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="已售500+件"
android:textColor="@color/color_999999"
android:textSize="10sp" />
</LinearLayout>
<ImageView
android:id="@+id/id_img_goods_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp" />
</RelativeLayout>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment