Browse Source

1.Rewards搜索界面逻辑完善
2.Rewards列表界面Sort By弹框界面
3.Rewards每日签到界面调整
4.Rewards详情界面调整

Administrator 2 years ago
parent
commit
a4a6c591b2
27 changed files with 1942 additions and 8 deletions
  1. 2 0
      cpt_rewards/src/main/java/com/hongyegroup/cpt_rewards/mvvm/RewardsSearchViewModel.kt
  2. 71 4
      cpt_rewards/src/main/java/com/hongyegroup/cpt_rewards/ui/RewardsListActivity.kt
  3. 162 0
      cpt_rewards/src/main/java/com/hongyegroup/cpt_rewards/ui/RewardsSearchActivity.kt
  4. 314 0
      cpt_rewards/src/main/java/com/hongyegroup/cpt_rewards/widget/RewardsSortByXPopup.java
  5. BIN
      cpt_rewards/src/main/res/drawable-xhdpi/rewards_icon_high.webp
  6. BIN
      cpt_rewards/src/main/res/drawable-xhdpi/rewards_icon_low.webp
  7. BIN
      cpt_rewards/src/main/res/drawable-xhdpi/rewards_latest.webp
  8. BIN
      cpt_rewards/src/main/res/drawable-xhdpi/rewards_popularity.webp
  9. BIN
      cpt_rewards/src/main/res/drawable-xxhdpi/rewards_icon_high.webp
  10. BIN
      cpt_rewards/src/main/res/drawable-xxhdpi/rewards_icon_low.webp
  11. BIN
      cpt_rewards/src/main/res/drawable-xxhdpi/rewards_latest.webp
  12. BIN
      cpt_rewards/src/main/res/drawable-xxhdpi/rewards_popularity.webp
  13. 341 0
      cpt_rewards/src/main/res/layout/activity_rewards_daily_login.xml
  14. 3 3
      cpt_rewards/src/main/res/layout/activity_rewards_detail.xml
  15. 6 0
      cpt_rewards/src/main/res/layout/activity_rewards_list.xml
  16. 9 1
      cpt_rewards/src/main/res/layout/activity_rewards_search.xml
  17. 286 0
      cpt_rewards/src/main/res/layout/view_rewards_sort_by.xml
  18. 1 0
      cs_baselib/src/main/res/values/dimens.xml
  19. 1 0
      cs_cptServices/src/main/java/com/guadou/cs_cptservices/YYConstants.java
  20. 673 0
      cs_cptServices/src/main/java/com/guadou/cs_cptservices/widget/RangeBarView.java
  21. BIN
      cs_cptServices/src/main/res/drawable-xhdpi/done.webp
  22. BIN
      cs_cptServices/src/main/res/drawable-xxhdpi/done.webp
  23. 8 0
      cs_cptServices/src/main/res/drawable/shape_page_gray_bg_border_line_3conner.xml
  24. 21 0
      cs_cptServices/src/main/res/values/attrs.xml
  25. 7 0
      cs_cptServices/src/main/res/values/colors.xml
  26. 16 0
      cs_cptServices/src/main/res/values/dimens.xml
  27. 21 0
      cs_cptServices/src/main/res/values/styles.xml

+ 2 - 0
cpt_rewards/src/main/java/com/hongyegroup/cpt_rewards/mvvm/RewardsSearchViewModel.kt

@@ -7,6 +7,8 @@ import com.hongyegroup.cpt_rewards.R
 
 class RewardsSearchViewModel : BaseViewModel() {
 
+    var mSearchStr=""
+
     var mRewardsData = ArrayList<String>()
     val mRewardsAdapter by lazy { BaseDataBindingAdapter(R.layout.item_rewards_best_offer, BR.item, mRewardsData) }
 

+ 71 - 4
cpt_rewards/src/main/java/com/hongyegroup/cpt_rewards/ui/RewardsListActivity.kt

@@ -2,6 +2,8 @@ package com.hongyegroup.cpt_rewards.ui
 
 import android.content.Intent
 import android.os.Bundle
+import android.text.TextUtils
+import android.widget.LinearLayout
 import com.guadou.lib_baselib.base.activity.BaseVDBActivity
 import com.guadou.lib_baselib.bean.DataBindingConfig
 import com.guadou.lib_baselib.ext.vertical
@@ -11,8 +13,15 @@ import com.hongyegroup.cpt_rewards.R
 import com.hongyegroup.cpt_rewards.databinding.ActivityRewardsListBinding
 import com.hongyegroup.cpt_rewards.databinding.ActivityRewardsListBindingImpl
 import com.hongyegroup.cpt_rewards.mvvm.RewardsListViewModel
+import com.hongyegroup.cpt_rewards.widget.RewardsSortByXPopup
+import com.luck.picture.lib.tools.ToastUtils
+import com.lxj.xpopup.XPopup
+import com.lxj.xpopup.enums.PopupAnimation
 
-class RewardsListActivity:BaseVDBActivity<RewardsListViewModel, ActivityRewardsListBinding>() {
+class RewardsListActivity : BaseVDBActivity<RewardsListViewModel, ActivityRewardsListBinding>() {
+
+    val mClickProxy by lazy { ClickProxy() }
+    var mSortByLl: LinearLayout? = null
 
     companion object {
 
@@ -33,24 +42,82 @@ class RewardsListActivity:BaseVDBActivity<RewardsListViewModel, ActivityRewardsL
 
     private fun initView() {
 
-        for (index in 0..9){
+        mSortByLl = findViewById<LinearLayout>(R.id.ll_rewards_recommend_sort_by)
+
+        for (index in 0..9) {
 
             mViewModel.mRewardsListData.add("")
 
         }
 
-        mBinding.recyclerViewRewardsList.vertical().adapter=mViewModel.mRewardsListAdapter
+        mBinding.recyclerViewRewardsList.vertical().adapter = mViewModel.mRewardsListAdapter
         mViewModel.mRewardsListAdapter.notifyDataSetChanged()
 
     }
 
     override fun getDataBindingConfig(): DataBindingConfig {
 
-        return DataBindingConfig(R.layout.activity_rewards_list,BR.viewModel,mViewModel)
+        return DataBindingConfig(R.layout.activity_rewards_list, BR.viewModel, mViewModel)
+            .addBindingParams(BR.click, mClickProxy)
 
     }
 
     override fun startObserve() {
 
     }
+
+    /**
+     * DataBinding事件处理
+     */
+    inner class ClickProxy {
+
+        //显示Sort By弹框
+        fun showSortByXPopup() {
+
+            ToastUtils.s(mContext, "Sort By")
+
+            XPopup.Builder(mActivity)
+                .atView(mBinding.llRewardsRecommendSort)
+//                .atView(mSortByLl)
+                .popupAnimation(PopupAnimation.NoAnimation)
+                .hasShadowBg(false)
+                .asCustom(
+                    RewardsSortByXPopup(mActivity, /*mPresenter.mSortById, mPresenter.mSortId,
+                        Integer.valueOf(mPresenter.mMinPoints), Integer.valueOf(mPresenter.mMaxPoints), */object : RewardsSortByXPopup.OnClickRewardsSortByXPopupListener {
+                        override fun onClickApply(sortById: String?, sortId: String?, startPoint: Int, endPoint: Int) {
+
+//                            mPresenter.mSortById = sortById
+//                            mPresenter.mSortId = sortId
+//                            mPresenter.mMinPoints = startPoint.toString()
+//                            mPresenter.mMaxPoints = endPoint.toString()
+//
+//                            //SortBy 1 popular(点击量) 2distance(折扣比例) 3point(积分) 4 latest(最新发布)
+//                            if (!TextUtils.isEmpty(sortById)) {
+//                                if (sortById == "1") {
+//                                    mSortByTv.setText(CommUtils.getString(R.string.popularity))
+//                                } else if (sortById == "4") {
+//                                    mSortByTv.setText(CommUtils.getString(R.string.latest))
+//                                }
+//                            }
+//
+//                            // sort 1从小到大 2从大到小
+//                            if (!TextUtils.isEmpty(sortId)) {
+//                                if (sortId == "1") {
+//                                    mSortByTv.setText(CommUtils.getString(R.string.low_to_high_points))
+//                                } else if (sortId == "2") {
+//                                    mSortByTv.setText(CommUtils.getString(R.string.high_to_low_points))
+//                                }
+//                            }
+//                            mRefreshLayout.autoRefresh()
+
+                        }
+
+                    })
+                )
+                .show()
+
+        }
+
+    }
+
 }

+ 162 - 0
cpt_rewards/src/main/java/com/hongyegroup/cpt_rewards/ui/RewardsSearchActivity.kt

@@ -2,18 +2,34 @@ package com.hongyegroup.cpt_rewards.ui
 
 import android.content.Intent
 import android.os.Bundle
+import android.text.Editable
+import android.text.TextUtils
+import android.text.TextWatcher
+import android.util.TypedValue
+import android.view.View
+import android.view.ViewGroup
 import androidx.databinding.ViewDataBinding
+import com.guadou.cs_cptservices.YYConstants
 import com.guadou.lib_baselib.base.activity.BaseVDBActivity
 import com.guadou.lib_baselib.bean.DataBindingConfig
+import com.guadou.lib_baselib.cache.ACache
 import com.guadou.lib_baselib.ext.vertical
+import com.guadou.lib_baselib.font_text_view.TextViewLight
 import com.guadou.lib_baselib.utils.CommUtils
+import com.guadou.lib_baselib.utils.KeyboardUtils
+import com.guadou.ninegrid.flownine.FlowLayout
 import com.hongyegroup.cpt_rewards.BR
 import com.hongyegroup.cpt_rewards.R
 import com.hongyegroup.cpt_rewards.databinding.ActivityRewardsSearchBinding
 import com.hongyegroup.cpt_rewards.mvvm.RewardsSearchViewModel
+import com.luck.picture.lib.tools.ToastUtils
+import java.util.*
+import kotlin.collections.ArrayList
 
 class RewardsSearchActivity : BaseVDBActivity<RewardsSearchViewModel, ActivityRewardsSearchBinding>() {
 
+    val mClickProxy by lazy { ClickProxy() }
+
     companion object {
 
         fun startInstance() {
@@ -29,6 +45,32 @@ class RewardsSearchActivity : BaseVDBActivity<RewardsSearchViewModel, ActivityRe
 
         initView()
 
+        initListener()
+
+    }
+
+    private fun initListener() {
+
+        mBinding.etSearchContent.addTextChangedListener(object :TextWatcher{
+            override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
+
+            }
+
+            override fun onTextChanged(charSequence: CharSequence?, p1: Int, p2: Int, p3: Int) {
+                if (charSequence?.length == 0) {
+                    mBinding.ivSearchDelete.setVisibility(View.GONE)
+                    mViewModel.mSearchStr = ""
+                } else {
+                    mBinding.ivSearchDelete.setVisibility(View.VISIBLE)
+                    mViewModel.mSearchStr = charSequence.toString().trim { it <= ' ' }
+                }
+            }
+
+            override fun afterTextChanged(p0: Editable?) {
+
+            }
+        })
+
     }
 
     private fun initView() {
@@ -42,15 +84,135 @@ class RewardsSearchActivity : BaseVDBActivity<RewardsSearchViewModel, ActivityRe
         mBinding.recyclerViewRewardsSearch.vertical().adapter=mViewModel.mRewardsAdapter
         mViewModel.mRewardsAdapter.notifyDataSetChanged()
 
+        //初始化搜索历史数据
+        addSearchHistory()
+
     }
 
     override fun getDataBindingConfig(): DataBindingConfig {
 
         return DataBindingConfig(R.layout.activity_rewards_search, BR.viewModel, mViewModel)
+            .addBindingParams(BR.click,mClickProxy)
+
+
+    }
+
+    //添加搜索数据到缓存中
+    private fun addSearchStrToACache() {
+
+        //如果缓存中有搜索的内容,先移除,再添加
+        var searchList = ACache.get(CommUtils.getContext()).getAsObject(YYConstants.CACHE_PROMOTION_REWARDS_LIST_SEARCH_HISTORY)
+
+        //移除相同搜索内容
+        if (searchList != null && (searchList as ArrayList<String>).size > 0) {
+            for (i in searchList.indices) {
+                if (searchList[i] == mViewModel.mSearchStr) {
+                    searchList.removeAt(i)
+                    break
+                }
+            }
+        } else {
+            searchList = ArrayList<String>()
+        }
+
+        //添加搜索内容
+        if (searchList.size >= 5) {
+            searchList.removeAt(0)
+        }
+        searchList.add(mViewModel.mSearchStr)
+        ACache.get(CommUtils.getContext()).put(YYConstants.CACHE_PROMOTION_REWARDS_LIST_SEARCH_HISTORY, searchList)
+    }
+
+    //添加历史记录View
+    private fun addSearchHistory() {
+        val searchList = ACache.get(CommUtils.getContext()).getAsObject(YYConstants.CACHE_PROMOTION_REWARDS_LIST_SEARCH_HISTORY)
+        if (searchList != null && (searchList as ArrayList<String>).size > 0) {
+            mBinding.tvRewardsSearchRecentSearch.setVisibility(View.VISIBLE)
+            mBinding.flowLayoutRewardsSearchRecentSearch.setVisibility(View.VISIBLE)
+
+            //反转List
+            Collections.reverse(searchList)
+
+            //先移除所有控件
+            mBinding.flowLayoutRewardsSearchRecentSearch.removeAllViews()
+
+            //再添加View
+            for (i in searchList.indices) {
+                val searchStr = searchList[i]
+                val textView = TextViewLight(mContext)
+                textView.setTextColor(CommUtils.getColor(R.color.black))
+                textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14F)
+                textView.setText(searchStr)
+                textView.setBackground(CommUtils.getDrawable(R.drawable.shape_page_gray_bg_border_line_3conner))
+                val layoutParams = FlowLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
+                textView.setPadding(CommUtils.dip2px(20), CommUtils.dip2px(4), CommUtils.dip2px(20), CommUtils.dip2px(4))
+                layoutParams.setMargins(0, 0, CommUtils.dip2px(7), CommUtils.dip2px(5))
+                textView.setLayoutParams(layoutParams)
+                textView.setOnClickListener(View.OnClickListener { //跳转搜索结果界面
+                    toSearchResult(searchStr)
+                })
+                //添加到流式布局中
+                mBinding.flowLayoutRewardsSearchRecentSearch.addView(textView)
+            }
+        } else {
+            mBinding.tvRewardsSearchRecentSearch.setVisibility(View.GONE)
+            mBinding.flowLayoutRewardsSearchRecentSearch.setVisibility(View.GONE)
+        }
+    }
 
+    //跳转到搜索结果界面
+    private fun toSearchResult(searchStr: String?) {
+        mBinding.etSearchContent.setText(searchStr)
+        search()
+    }
+
+    //搜索
+    private fun search() {
+        if (TextUtils.isEmpty(mViewModel.mSearchStr)) {
+
+            ToastUtils.s(CommUtils.getContext(),"Please input search content")
+            return
+        }
+
+        KeyboardUtils.hideSoftInput(mBinding.etSearchContent)
+//        startWithPop(RewardsSearchResultFragment.newInstance(mSearchStr))
+
+        //添加搜索历史到缓存
+        addSearchStrToACache()
+        //添加到历史记录View
+        addSearchHistory()
     }
 
     override fun startObserve() {
 
     }
+
+    /**
+     * DataBinding事件处理
+     */
+    inner class ClickProxy {
+
+        //处理搜索逻辑
+        fun handleSearch(){
+
+            toSearchResult(mViewModel.mSearchStr)
+
+        }
+
+        //清除搜索
+        fun clearSearch(){
+
+            mBinding.etSearchContent.setText("")
+
+        }
+
+        //返回按钮
+        fun finishActivity(){
+
+            mActivity.finish()
+
+        }
+
+    }
+
 }

+ 314 - 0
cpt_rewards/src/main/java/com/hongyegroup/cpt_rewards/widget/RewardsSortByXPopup.java

@@ -0,0 +1,314 @@
+package com.hongyegroup.cpt_rewards.widget;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.guadou.cs_cptservices.YYConstants;
+import com.guadou.cs_cptservices.widget.RangeBarView;
+import com.guadou.lib_baselib.utils.CommUtils;
+import com.guadou.lib_baselib.utils.SPUtils;
+import com.hongyegroup.cpt_rewards.R;
+import com.lxj.xpopup.core.AttachPopupView;
+import com.lxj.xpopup.impl.PartShadowPopupView;
+import com.lxj.xpopup.util.XPopupUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import androidx.annotation.NonNull;
+
+public class RewardsSortByXPopup extends PartShadowPopupView {
+
+    private LinearLayout mLastLl;
+    private TextView mLastTv;
+    private ImageView mLastChooseIv;
+    private LinearLayout mPopularityLl;
+    private TextView mPopularityTv;
+    private ImageView mPopularityChooseIv;
+    private LinearLayout mLowLl;
+    private TextView mLowTv;
+    private ImageView mLowChooseIv;
+    private LinearLayout mHighLl;
+    private TextView mHighTv;
+    private ImageView mHighChooseIv;
+    private TextView mPointFilterTv;
+    private RangeBarView mRangeBarView;
+    private ImageView mRewardsTipIv;
+    private LinearLayout mRewardsTipLl;
+    private TextView mApplyTv;
+
+    public String mSortById;
+    public String mSortId;
+    public int mAvailablePoints = 0;
+    private final int minValue = 0;
+    private final int maxValue = 100000;
+    private final int sliceValue = 3000;
+    private int mStartPoint;
+    private int mEndPoint;
+    private boolean isAgree = false;
+
+    private List<TextView> mTextList = new ArrayList<>();
+    private List<ImageView> mImageViewList = new ArrayList<>();
+
+    private OnClickRewardsSortByXPopupListener mListener;
+
+    public RewardsSortByXPopup(@NonNull Context context, /*String sortById, String sortId, int startPoint, int endPoint, */OnClickRewardsSortByXPopupListener listener) {
+        super(context);
+
+//        mSortById = sortById;
+//        mSortId = sortId;
+//        mStartPoint = startPoint;
+//        mEndPoint = endPoint;
+
+        if (listener != null) {
+
+            mListener = listener;
+
+        }
+
+    }
+
+    @Override
+    protected int getImplLayoutId() {
+        return R.layout.view_rewards_sort_by;
+    }
+
+    @Override
+    protected void onCreate() {
+        super.onCreate();
+    }
+
+    @Override
+    protected int getPopupWidth() {
+        return XPopupUtils.getWindowWidth(getContext());
+    }
+
+    @Override
+    protected void initPopupContent() {
+        super.initPopupContent();
+
+        mAvailablePoints = SPUtils.getInstance(CommUtils.getContext()).getInt(YYConstants.CACHE_REWARDS_POINTS, 0);
+
+        initView();
+        initListener();
+
+    }
+
+    @SuppressLint("CheckResult")
+    private void initListener() {
+
+        mRangeBarView.setDatas(minValue, maxValue, sliceValue, new RangeBarView.OnMoveValueListener() {
+            @Override
+            public void onMoveValue(int leftValue, int rightValue) {
+//                mPointFilterTv.setText(leftValue + CommUtils.getString(R.string.points) + " -" + " " + rightValue + " " + CommUtils.getString(R.string.points));
+                mPointFilterTv.setText(leftValue + "积分" + " -" + " " + rightValue + " " + "积分");
+                mStartPoint = leftValue;
+                mEndPoint = rightValue;
+            }
+
+            @Override
+            public void noCheckBox() {
+                isAgree = false;
+                mRewardsTipIv.setImageResource(R.drawable.filter_unchoose);
+            }
+        });
+
+        mRangeBarView.post(() -> {
+            //只要传递过来的区间左右有一个不为0就去设置上次选中的区间
+            if (mStartPoint != 0 || mEndPoint != 0) {
+                mRangeBarView.setCircleMoveCoordinateByValue(mStartPoint, mEndPoint);
+//                mPointFilterTv.setText(mStartPoint + CommUtils.getString(R.string.points) + " -" + " " + mEndPoint + " " + CommUtils.getString(R.string.points));
+                mPointFilterTv.setText(mStartPoint + "积分" + " -" + " " + mEndPoint + " " + "积分");
+            }
+        });
+
+
+        mApplyTv.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+
+                if (mListener != null) {
+
+                    mListener.onClickApply(mSortById, mSortId, mStartPoint, mEndPoint);
+
+                }
+
+                dismiss();
+
+
+            }
+        });
+
+        mRewardsTipLl.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+
+                if (isAgree) {
+                    isAgree = false;
+                    mRangeBarView.setCircleMoveCoordinateByValue(0, maxValue);
+                    mStartPoint = 0;
+                    mEndPoint = maxValue;
+                } else {
+                    isAgree = true;
+                    mRangeBarView.setCircleMoveCoordinateByValue(0, mAvailablePoints == 0 ? 3000 : mAvailablePoints);
+                    mStartPoint = 0;
+                    mEndPoint = mAvailablePoints == 0 ? 3000 : mAvailablePoints;
+                }
+                mRewardsTipIv.setImageResource(isAgree ? R.drawable.filter_choose : R.drawable.filter_unchoose);
+//            mPointFilterTv.setText(mStartPoint + CommUtils.getString(R.string.points) + " -" + " " + mEndPoint + " " + CommUtils.getString(R.string.points));
+                mPointFilterTv.setText(mStartPoint + "积分" + " -" + " " + mEndPoint + " " +"积分");
+
+            }
+        });
+
+        mLastLl.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+
+                selectSortBy(0);
+                mSortById = "4";
+                mSortId = "";
+
+            }
+        });
+
+        mPopularityLl.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+
+                selectSortBy(1);
+                mSortById = "1";
+                mSortId = "";
+
+            }
+        });
+
+        mLowLl.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+
+                selectSortBy(2);
+                mSortById = "";
+                mSortId = "1";
+
+            }
+        });
+
+        mHighLl.setOnClickListener(new OnClickListener() {
+            @Override
+            public void onClick(View view) {
+
+                selectSortBy(3);
+                mSortById = "";
+                mSortId = "2";
+
+            }
+        });
+
+
+    }
+
+    //设置选中的Sort By
+    private void selectSortBy(int position) {
+
+        for (int index = 0; index < 4; index++) {
+
+            if (index == position) {
+
+                mTextList.get(index).setTextColor(CommUtils.getColor(R.color.profile_red));
+                mImageViewList.get(index).setVisibility(VISIBLE);
+
+            } else {
+
+                mTextList.get(index).setTextColor(CommUtils.getColor(R.color.black));
+                mImageViewList.get(index).setVisibility(GONE);
+
+            }
+
+        }
+
+    }
+
+    private void initView() {
+
+        mLastLl = findViewById(R.id.ll_latest_box);
+        mLastTv = findViewById(R.id.tv_rewards_sort_by_last);
+        mLastChooseIv = findViewById(R.id.iv_latest_choose);
+
+        mPopularityLl = findViewById(R.id.ll_popularity_box);
+        mPopularityTv = findViewById(R.id.tv_rewards_sort_by_popularity);
+        mPopularityChooseIv = findViewById(R.id.iv_popularity_choose);
+
+        mLowLl = findViewById(R.id.ll_low_box);
+        mLowTv = findViewById(R.id.tv_rewards_sort_by_low);
+        mLowChooseIv = findViewById(R.id.iv_low_choose);
+
+        mHighLl = findViewById(R.id.ll_high_box);
+        mHighTv = findViewById(R.id.tv_rewards_sort_by_high);
+        mHighChooseIv = findViewById(R.id.iv_high_choose);
+
+        mPointFilterTv = findViewById(R.id.tv_points_filter_text);
+        mRangeBarView = findViewById(R.id.view_range_bar);
+        mRewardsTipIv = findViewById(R.id.iv_rewards_tip);
+        mRewardsTipLl = findViewById(R.id.ll_rewards_tip);
+        mApplyTv = findViewById(R.id.button_apply);
+
+        mTextList.clear();
+        mTextList.add(mLastTv);
+        mTextList.add(mPopularityTv);
+        mTextList.add(mLowTv);
+        mTextList.add(mHighTv);
+
+        mImageViewList.clear();
+        mImageViewList.add(mLastChooseIv);
+        mImageViewList.add(mPopularityChooseIv);
+        mImageViewList.add(mLowChooseIv);
+        mImageViewList.add(mHighChooseIv);
+
+        //设置Poin区间
+//        mPointFilterTv.setText(minValue + CommUtils.getString(R.string.points) + " -" + " " + maxValue + " " + CommUtils.getString(R.string.points));
+        mPointFilterTv.setText(minValue + "积分" + " -" + " " + maxValue + " " + "积分");
+
+        //设置Sort By
+        if (!TextUtils.isEmpty(mSortById)) {
+
+            if (mSortById.equals("4")) {
+
+                selectSortBy(0);
+            } else if (mSortById.equals("1")) {
+
+                selectSortBy(1);
+            }
+
+        }
+
+        //设置Sort
+        if (!TextUtils.isEmpty(mSortId)) {
+
+            if (mSortId.equals("1")) {
+
+                selectSortBy(2);
+
+            } else if (mSortId.equals("2")) {
+
+                selectSortBy(3);
+
+            }
+
+        }
+
+    }
+
+    public interface OnClickRewardsSortByXPopupListener {
+
+        void onClickApply(String sortById, String sortId, int startPoint, int endPoint);
+
+    }
+
+}

BIN
cpt_rewards/src/main/res/drawable-xhdpi/rewards_icon_high.webp


BIN
cpt_rewards/src/main/res/drawable-xhdpi/rewards_icon_low.webp


BIN
cpt_rewards/src/main/res/drawable-xhdpi/rewards_latest.webp


BIN
cpt_rewards/src/main/res/drawable-xhdpi/rewards_popularity.webp


BIN
cpt_rewards/src/main/res/drawable-xxhdpi/rewards_icon_high.webp


BIN
cpt_rewards/src/main/res/drawable-xxhdpi/rewards_icon_low.webp


BIN
cpt_rewards/src/main/res/drawable-xxhdpi/rewards_latest.webp


BIN
cpt_rewards/src/main/res/drawable-xxhdpi/rewards_popularity.webp


+ 341 - 0
cpt_rewards/src/main/res/layout/activity_rewards_daily_login.xml

@@ -213,6 +213,347 @@
                     android:layout_height="@dimen/d_0.5dp"
                     android:src="@color/main_divide"/>
 
+                                <!--News Feed Post-->
+                <RelativeLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:paddingLeft="@dimen/d_15dp"
+                    android:paddingTop="@dimen/d_20dp"
+                    android:paddingRight="@dimen/d_15dp"
+                    android:paddingBottom="@dimen/d_20dp">
+
+                    <ImageView
+                        android:id="@+id/iv_daily_login_logo2"
+                        android:layout_width="@dimen/d_54dp"
+                        android:layout_height="@dimen/d_54dp"
+                        android:background="@drawable/reward_yy_circle_logo" />
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewMedium
+                        android:id="@+id/tv_news_feed_Post"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginLeft="10dp"
+                        android:layout_toRightOf="@id/iv_daily_login_logo2"
+                        android:text="朋友圈发布"
+                        android:textColor="@color/home_item_title_color"
+                        android:textSize="@dimen/d_15sp" />
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewLight
+                        android:id="@+id/tv_daily_point2"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_below="@id/tv_news_feed_Post"
+                        android:layout_marginLeft="@dimen/dp_10"
+                        android:layout_marginTop="@dimen/d_15dp"
+                        android:layout_toRightOf="@id/iv_daily_login_logo2"
+                        android:text="+2"
+                        android:textColor="@color/profile_red"
+                        android:textSize="@dimen/d_14sp" />
+
+                    <ImageView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_below="@id/tv_news_feed_Post"
+                        android:layout_marginLeft="@dimen/d_5dp"
+                        android:layout_marginTop="@dimen/d_18dp"
+                        android:layout_toRightOf="@id/tv_daily_point2"
+                        android:src="@drawable/daliy_points_gold" />
+
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewLight
+                        android:id="@+id/tv_daily_login_news_feed_post"
+                        android:layout_width="88dp"
+                        android:layout_height="wrap_content"
+                        android:layout_alignParentRight="true"
+                        android:layout_centerVertical="true"
+                        android:background="@color/profile_red"
+                        android:gravity="center"
+                        android:paddingTop="@dimen/d_5dp"
+                        android:paddingBottom="@dimen/d_5dp"
+                        android:text="去发布"
+                        android:textColor="@color/white"
+                        android:textSize="@dimen/d_12sp" />
+
+                </RelativeLayout>
+
+                <ImageView
+                    android:layout_width="match_parent"
+                    android:layout_height="@dimen/d_0.5dp"
+                    android:src="@color/main_divide"/>
+
+                <!--    浏览NewsFeed    -->
+                <RelativeLayout
+                    android:id="@+id/rl_newsfeed_box"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:paddingLeft="@dimen/d_15dp"
+                    android:paddingTop="@dimen/d_20dp"
+                    android:paddingRight="@dimen/d_15dp"
+                    android:paddingBottom="@dimen/d_20dp">
+
+                    <ImageView
+                        android:id="@+id/iv_daily_login_logo4"
+                        android:layout_width="@dimen/d_54dp"
+                        android:layout_height="@dimen/d_54dp"
+                        android:background="@drawable/reward_yy_circle_logo" />
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewMedium
+                        android:id="@+id/tv_browse_news"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginLeft="10dp"
+                        android:layout_toLeftOf="@id/tv_daily_browse_news"
+                        android:layout_toRightOf="@id/iv_daily_login_logo4"
+                        android:text="浏览朋友圈>60秒"
+                        android:textColor="@color/home_item_title_color"
+                        android:textSize="@dimen/d_15sp" />
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewLight
+                        android:id="@+id/tv_daily_point4"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_below="@id/tv_browse_news"
+                        android:layout_marginLeft="@dimen/dp_10"
+                        android:layout_toRightOf="@id/iv_daily_login_logo4"
+                        android:text="+5"
+                        android:textColor="@color/profile_red"
+                        android:textSize="@dimen/d_14sp" />
+
+                    <ImageView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_below="@id/tv_browse_news"
+                        android:layout_marginLeft="@dimen/d_5dp"
+                        android:layout_marginTop="@dimen/d_3dp"
+                        android:layout_toRightOf="@id/tv_daily_point4"
+                        android:src="@drawable/daliy_points_gold" />
+
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewLight
+                        android:id="@+id/tv_daily_browse_news"
+                        android:layout_width="88dp"
+                        android:layout_height="wrap_content"
+                        android:layout_alignParentRight="true"
+                        android:layout_centerVertical="true"
+                        android:background="@color/profile_red"
+                        android:gravity="center"
+                        android:paddingTop="@dimen/d_5dp"
+                        android:paddingBottom="@dimen/d_5dp"
+                        android:text="去浏览"
+                        android:textColor="@color/white"
+                        android:textSize="@dimen/d_13sp" />
+
+                </RelativeLayout>
+
+                <ImageView
+                    android:layout_width="match_parent"
+                    android:layout_height="@dimen/d_0.5dp"
+                    android:src="@color/main_divide"/>
+
+                <!--    点赞10次    -->
+                <RelativeLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:paddingLeft="@dimen/d_15dp"
+                    android:paddingTop="@dimen/d_20dp"
+                    android:paddingRight="@dimen/d_15dp"
+                    android:paddingBottom="@dimen/d_20dp">
+
+                    <ImageView
+                        android:id="@+id/iv_daily_login_logo5"
+                        android:layout_width="@dimen/d_54dp"
+                        android:layout_height="@dimen/d_54dp"
+                        android:background="@drawable/reward_yy_circle_logo" />
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewMedium
+                        android:id="@+id/tv_give_like"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginLeft="10dp"
+                        android:layout_toRightOf="@id/iv_daily_login_logo5"
+                        android:text="点赞10个动态"
+                        android:textColor="@color/home_item_title_color"
+                        android:textSize="@dimen/d_15sp" />
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewLight
+                        android:id="@+id/tv_daily_point5"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_below="@id/tv_give_like"
+                        android:layout_marginLeft="@dimen/dp_10"
+                        android:layout_marginTop="@dimen/d_15dp"
+                        android:layout_toRightOf="@id/iv_daily_login_logo5"
+                        android:text="+5"
+                        android:textColor="@color/profile_red"
+                        android:textSize="@dimen/d_14sp" />
+
+                    <ImageView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_below="@id/tv_give_like"
+                        android:layout_marginLeft="@dimen/d_5dp"
+                        android:layout_marginTop="@dimen/d_18dp"
+                        android:layout_toRightOf="@id/tv_daily_point5"
+                        android:src="@drawable/daliy_points_gold" />
+
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewLight
+                        android:id="@+id/tv_daily_give_like"
+                        android:layout_width="88dp"
+                        android:layout_height="wrap_content"
+                        android:layout_alignParentRight="true"
+                        android:layout_centerVertical="true"
+                        android:background="@color/profile_red"
+                        android:gravity="center"
+                        android:paddingTop="@dimen/d_5dp"
+                        android:paddingBottom="@dimen/d_5dp"
+                        android:text="0 / 10"
+                        android:textColor="@color/white"
+                        android:textSize="@dimen/d_13sp" />
+
+                </RelativeLayout>
+
+                <ImageView
+                    android:layout_width="match_parent"
+                    android:layout_height="@dimen/d_0.5dp"
+                    android:src="@color/main_divide"/>
+
+                <!--    发布视频    -->
+                <RelativeLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:paddingLeft="@dimen/d_15dp"
+                    android:paddingTop="@dimen/d_20dp"
+                    android:paddingRight="@dimen/d_15dp"
+                    android:paddingBottom="@dimen/d_20dp">
+
+                    <ImageView
+                        android:id="@+id/iv_daily_login_logo6"
+                        android:layout_width="@dimen/d_54dp"
+                        android:layout_height="@dimen/d_54dp"
+                        android:background="@drawable/reward_yy_circle_logo" />
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewMedium
+                        android:id="@+id/tv_post_video"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginLeft="10dp"
+                        android:layout_toRightOf="@id/iv_daily_login_logo6"
+                        android:text="发布一个视频"
+                        android:textColor="@color/home_item_title_color"
+                        android:textSize="@dimen/d_15sp" />
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewLight
+                        android:id="@+id/tv_daily_point6"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_below="@id/tv_post_video"
+                        android:layout_marginLeft="@dimen/dp_10"
+                        android:layout_marginTop="@dimen/d_15dp"
+                        android:layout_toRightOf="@id/iv_daily_login_logo6"
+                        android:text="+30"
+                        android:textColor="@color/profile_red"
+                        android:textSize="@dimen/d_14sp" />
+
+                    <ImageView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_below="@id/tv_post_video"
+                        android:layout_marginLeft="@dimen/d_5dp"
+                        android:layout_marginTop="@dimen/d_18dp"
+                        android:layout_toRightOf="@id/tv_daily_point6"
+                        android:src="@drawable/daliy_points_gold" />
+
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewLight
+                        android:id="@+id/tv_daily_post_video"
+                        android:layout_width="88dp"
+                        android:layout_height="wrap_content"
+                        android:layout_alignParentRight="true"
+                        android:layout_centerVertical="true"
+                        android:background="@color/profile_red"
+                        android:gravity="center"
+                        android:paddingTop="@dimen/d_5dp"
+                        android:paddingBottom="@dimen/d_5dp"
+                        android:text="去发布"
+                        android:textColor="@color/white"
+                        android:textSize="@dimen/d_13sp" />
+
+                </RelativeLayout>
+
+                <ImageView
+                    android:layout_width="match_parent"
+                    android:layout_height="@dimen/d_0.5dp"
+                    android:src="@color/main_divide"/>
+
+                <!--    获得50赞    -->
+                <RelativeLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:paddingLeft="@dimen/d_15dp"
+                    android:paddingTop="@dimen/d_20dp"
+                    android:paddingRight="@dimen/d_15dp"
+                    android:paddingBottom="@dimen/d_20dp">
+
+                    <ImageView
+                        android:id="@+id/iv_daily_login_logo7"
+                        android:layout_width="@dimen/d_54dp"
+                        android:layout_height="@dimen/d_54dp"
+                        android:background="@drawable/reward_yy_circle_logo" />
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewMedium
+                        android:id="@+id/tv_get_likes"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginLeft="10dp"
+                        android:layout_toLeftOf="@id/tv_daily_get_likes"
+                        android:layout_toRightOf="@id/iv_daily_login_logo7"
+                        android:text="任何单一视频收获超过50个赞"
+                        android:textColor="@color/home_item_title_color"
+                        android:textSize="@dimen/d_15sp" />
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewLight
+                        android:id="@+id/tv_daily_point7"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_below="@id/tv_get_likes"
+                        android:layout_marginLeft="@dimen/dp_10"
+                        android:layout_toRightOf="@id/iv_daily_login_logo7"
+                        android:text="+20"
+                        android:textColor="@color/profile_red"
+                        android:textSize="@dimen/d_14sp" />
+
+                    <ImageView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_below="@id/tv_get_likes"
+                        android:layout_marginLeft="@dimen/d_5dp"
+                        android:layout_marginTop="@dimen/d_3dp"
+                        android:layout_toRightOf="@id/tv_daily_point7"
+                        android:src="@drawable/daliy_points_gold" />
+
+
+                    <com.guadou.lib_baselib.font_text_view.TextViewLight
+                        android:id="@+id/tv_daily_get_likes"
+                        android:layout_width="88dp"
+                        android:layout_height="wrap_content"
+                        android:layout_alignParentRight="true"
+                        android:layout_centerVertical="true"
+                        android:background="@color/profile_red"
+                        android:gravity="center"
+                        android:paddingTop="@dimen/d_5dp"
+                        android:paddingBottom="@dimen/d_5dp"
+                        android:text="0 / 50"
+                        android:textColor="@color/white"
+                        android:textSize="@dimen/d_13sp" />
+
+                </RelativeLayout>
+
+                <View
+                    android:layout_width="match_parent"
+                    android:layout_height="@dimen/d_10dp"
+                    android:background="@color/page_bg" />
+
 
                 <RelativeLayout
                     android:layout_width="match_parent"

+ 3 - 3
cpt_rewards/src/main/res/layout/activity_rewards_detail.xml

@@ -359,7 +359,7 @@
                                 android:layout_height="wrap_content"
                                 android:layout_marginLeft="@dimen/d_15dp"
                                 android:layout_weight="1"
-                                android:text="Also redeemable in 1 more location"
+                                android:text="还可在另外 1 个地点兑换"
                                 android:textColor="@color/black"
                                 android:textSize="@dimen/d_16sp" />
 
@@ -543,7 +543,7 @@
                             android:layout_marginLeft="@dimen/d_15dp"
                             android:layout_marginTop="@dimen/d_15dp"
                             android:layout_marginRight="@dimen/d_15dp"
-                            android:text="Reservation not required."
+                            android:text="无需预订。"
                             android:textColor="@color/dark_gray_text"
                             android:textSize="@dimen/d_15sp" />
 
@@ -760,7 +760,7 @@
                 android:layout_marginRight="@dimen/d_15dp"
                 android:background="@color/app_blue"
                 android:gravity="center"
-                android:text="兑换积分"
+                android:text="兑换"
                 binding:clicks="@{click.gotoRewardsConfirmActivity}"
                 android:textColor="@color/white"
                 android:textSize="@dimen/d_15sp" />

+ 6 - 0
cpt_rewards/src/main/res/layout/activity_rewards_list.xml

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <layout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:binding="http://schemas.android.com/apk/res-auto"
     xmlns:app="http://schemas.android.com/apk/res-auto">
 
     <data>
@@ -8,6 +9,10 @@
             name="viewModel"
             type="com.hongyegroup.cpt_rewards.mvvm.RewardsListViewModel" />
 
+        <variable
+            name="click"
+            type="com.hongyegroup.cpt_rewards.ui.RewardsListActivity.ClickProxy" />
+
     </data>
 
     <LinearLayout
@@ -73,6 +78,7 @@
                 android:layout_height="match_parent"
                 android:layout_weight="1"
                 android:gravity="center_vertical"
+                binding:clicks="@{click.showSortByXPopup}"
                 android:orientation="horizontal">
 
                 <ImageView

+ 9 - 1
cpt_rewards/src/main/res/layout/activity_rewards_search.xml

@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <layout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tool="http://schemas.android.com/tools">
+    xmlns:tool="http://schemas.android.com/tools"
+    xmlns:binding="http://schemas.android.com/apk/res-auto">
 
     <data>
 
@@ -9,6 +10,10 @@
             name="viewModel"
             type="com.hongyegroup.cpt_rewards.mvvm.RewardsSearchViewModel" />
 
+        <variable
+            name="click"
+            type="com.hongyegroup.cpt_rewards.ui.RewardsSearchActivity.ClickProxy" />
+
     </data>
 
     <LinearLayout
@@ -37,6 +42,7 @@
                 android:layout_gravity="left|center_vertical"
                 android:layout_marginLeft="@dimen/d_10dp"
                 android:padding="@dimen/d_8dp"
+                binding:clicks="@{click.finishActivity}"
                 android:src="@drawable/back_blue"
                 android:visibility="visible" />
 
@@ -71,6 +77,7 @@
                         android:layout_marginStart="@dimen/d_10dp"
                         android:layout_marginLeft="@dimen/d_10dp"
                         android:clickable="true"
+                        binding:clicks="@{click.handleSearch}"
                         android:src="@drawable/search" />
 
                     <EditText
@@ -99,6 +106,7 @@
                         android:clickable="false"
                         android:enabled="false"
                         android:padding="@dimen/d_5dp"
+                        binding:clicks="@{click.clearSearch}"
                         android:src="@drawable/search_delete"
                         android:visibility="gone" />
 

+ 286 - 0
cpt_rewards/src/main/res/layout/view_rewards_sort_by.xml

@@ -0,0 +1,286 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@color/white"
+    android:orientation="vertical">
+
+    <com.guadou.lib_baselib.font_text_view.TextViewMedium
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/d_43dp"
+        android:layout_marginTop="@dimen/d_28dp"
+        android:background="@color/page_bg"
+        android:gravity="center_vertical"
+        android:paddingLeft="@dimen/d_15dp"
+        android:text="排序"
+        android:textColor="@color/gray_76"
+        android:textSize="@dimen/d_15sp" />
+
+    <LinearLayout
+        android:id="@+id/ll_latest_box"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/d_45dp"
+        android:gravity="center_vertical"
+        android:orientation="horizontal"
+        android:paddingLeft="@dimen/d_15dp">
+
+        <ImageView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:src="@drawable/rewards_latest" />
+
+        <com.guadou.lib_baselib.font_text_view.TextViewLight
+            android:id="@+id/tv_rewards_sort_by_last"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/d_15dp"
+            android:text="最新"
+            android:textColor="@color/black"
+            android:textSize="@dimen/d_15sp" />
+
+        <View
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1" />
+
+        <ImageView
+            android:id="@+id/iv_latest_choose"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginRight="@dimen/d_15dp"
+            android:src="@drawable/done"
+            android:visibility="gone" />
+
+    </LinearLayout>
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/d_0.5dp"
+        android:layout_marginLeft="@dimen/d_15dp"
+        android:layout_marginRight="@dimen/d_15dp"
+        android:background="@color/divider_color" />
+
+    <LinearLayout
+        android:id="@+id/ll_popularity_box"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/d_45dp"
+        android:gravity="center_vertical"
+        android:orientation="horizontal"
+        android:paddingLeft="@dimen/d_15dp">
+
+        <ImageView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:src="@drawable/rewards_popularity" />
+
+        <com.guadou.lib_baselib.font_text_view.TextViewLight
+            android:id="@+id/tv_rewards_sort_by_popularity"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/d_15dp"
+            android:text="最受欢迎"
+            android:textColor="@color/black"
+            android:textSize="@dimen/d_15sp" />
+
+        <View
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1" />
+
+        <ImageView
+            android:id="@+id/iv_popularity_choose"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginRight="@dimen/d_15dp"
+            android:src="@drawable/done"
+            android:visibility="gone" />
+
+    </LinearLayout>
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/d_0.5dp"
+        android:layout_marginLeft="@dimen/d_15dp"
+        android:layout_marginRight="@dimen/d_15dp"
+        android:background="@color/divider_color" />
+
+    <LinearLayout
+        android:id="@+id/ll_low_box"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/d_45dp"
+        android:gravity="center_vertical"
+        android:orientation="horizontal"
+        android:paddingLeft="@dimen/d_15dp">
+
+        <ImageView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:src="@drawable/rewards_icon_low" />
+
+        <TextView
+            android:id="@+id/tv_rewards_sort_by_low"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/d_15dp"
+            android:text="由低到高"
+            android:textColor="@color/black"
+            android:textSize="@dimen/d_15sp" />
+
+        <View
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1" />
+
+        <ImageView
+            android:id="@+id/iv_low_choose"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginRight="@dimen/d_15dp"
+            android:src="@drawable/done"
+            android:visibility="gone" />
+
+    </LinearLayout>
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/d_0.5dp"
+        android:layout_marginLeft="@dimen/d_15dp"
+        android:layout_marginRight="@dimen/d_15dp"
+        android:background="@color/divider_color" />
+
+    <LinearLayout
+        android:id="@+id/ll_high_box"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/d_45dp"
+        android:gravity="center_vertical"
+        android:orientation="horizontal"
+        android:paddingLeft="@dimen/d_15dp">
+
+        <ImageView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:src="@drawable/rewards_icon_high" />
+
+        <com.guadou.lib_baselib.font_text_view.TextViewLight
+            android:id="@+id/tv_rewards_sort_by_high"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/d_15dp"
+            android:text="由高到低"
+            android:textColor="@color/black"
+            android:textSize="@dimen/d_15sp" />
+
+        <View
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1" />
+
+        <ImageView
+            android:id="@+id/iv_high_choose"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginRight="@dimen/d_15dp"
+            android:src="@drawable/done"
+            android:visibility="visible" />
+
+    </LinearLayout>
+
+
+    <com.guadou.lib_baselib.font_text_view.TextViewMedium
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/d_43dp"
+        android:background="@color/page_bg"
+        android:gravity="center_vertical"
+        android:paddingLeft="@dimen/d_15dp"
+        android:text="筛选"
+        android:textColor="@color/gray_76"
+        android:textSize="@dimen/d_15sp" />
+
+
+    <com.guadou.lib_baselib.font_text_view.TextViewLight
+        android:id="@+id/tv_points_filter_text"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="@dimen/d_15dp"
+        android:layout_marginTop="@dimen/d_22dp"
+        android:text="0 points - 15000 points"
+        android:textColor="@color/black"
+        android:textSize="@dimen/d_15sp" />
+
+    <!--价格选择控件-->
+    <com.guadou.cs_cptservices.widget.RangeBarView
+        android:id="@+id/view_range_bar"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/d_5dp"
+        android:paddingLeft="15dp"
+        android:paddingRight="15dp"
+
+        app:circle_radius="12dp"
+        app:circle_stroke_width="1.5dp"
+
+        app:left_circle_solid_color="@color/white"
+        app:left_circle_stroke_color="@color/app_blue"
+
+        app:range_text_color="#767676"
+        app:range_text_size="13dp"
+
+        app:rect_line_checked_color="@color/app_blue"
+        app:rect_line_default_color="@color/page_bg"
+        app:rect_line_height="9dp"
+        app:rect_price_desc_dialog_color="@color/app_blue"
+
+        app:rect_price_desc_dialog_width="100dp"
+
+        app:rect_price_desc_space_to_progress="1dp"
+
+        app:rect_price_desc_text_color="@android:color/white"
+        app:rect_price_desc_text_size="13sp"
+
+        app:right_circle_solid_color="@color/white"
+        app:right_circle_stroke_color="@color/app_blue" />
+
+
+    <LinearLayout
+        android:id="@+id/ll_rewards_tip"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/d_25dp"
+        android:layout_marginLeft="@dimen/d_15dp"
+        android:layout_marginTop="@dimen/d_15dp"
+        android:gravity="center_vertical"
+        android:orientation="horizontal">
+
+        <ImageView
+            android:id="@+id/iv_rewards_tip"
+            android:layout_width="@dimen/d_14dp"
+            android:layout_height="@dimen/d_14dp"
+            android:src="@drawable/filter_unchoose" />
+
+        <com.guadou.lib_baselib.font_text_view.TextViewLight
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/d_10dp"
+            android:text="仅显示我可兑换的商品"
+            android:textColor="@color/gray_76"
+            android:textSize="@dimen/d_13sp" />
+
+    </LinearLayout>
+
+    <com.guadou.lib_baselib.font_text_view.TextViewLight
+        android:id="@+id/button_apply"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/d_45dp"
+        android:layout_marginLeft="@dimen/d_25dp"
+        android:layout_marginTop="@dimen/d_25dp"
+        android:layout_marginRight="@dimen/d_25dp"
+        android:layout_marginBottom="@dimen/d_20dp"
+        android:background="@drawable/selector_app_blue_button_round2_bg"
+        android:gravity="center"
+        android:padding="@dimen/d_10dp"
+        android:text="应用"
+        android:textAllCaps="false"
+        android:textColor="@android:color/white"
+        android:textSize="@dimen/d_16dp" />
+
+</LinearLayout>

+ 1 - 0
cs_baselib/src/main/res/values/dimens.xml

@@ -64,6 +64,7 @@
     <dimen name="d_38dp">38dp</dimen>
     <dimen name="d_40dp">40dp</dimen>
     <dimen name="d_42dp">42dp</dimen>
+    <dimen name="d_43dp">43dp</dimen>
     <dimen name="d_45dp">45dp</dimen>
     <dimen name="d_46dp">46dp</dimen>
     <dimen name="d_47dp">47dp</dimen>

+ 1 - 0
cs_cptServices/src/main/java/com/guadou/cs_cptservices/YYConstants.java

@@ -14,6 +14,7 @@ public class YYConstants {
 
     public static final String CACHE_REWARDS_POINTS="cache_rewards_points";
     public static final String ENENT_PART_TIME_BACK = "enent_part_time_back";   //兼职首页回到第一个Tab
+    public static final String CACHE_PROMOTION_REWARDS_LIST_SEARCH_HISTORY = "cache_promotion_rewards_list_search_history";   //Rewards缓存搜索结果
 
 
 }

+ 673 - 0
cs_cptServices/src/main/java/com/guadou/cs_cptservices/widget/RangeBarView.java

@@ -0,0 +1,673 @@
+package com.guadou.cs_cptservices.widget;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Path;
+import android.graphics.RectF;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.View;
+
+import com.guadou.cs_cptservices.R;
+import com.guadou.lib_baselib.utils.CommUtils;
+
+import androidx.annotation.Nullable;
+import androidx.core.content.ContextCompat;
+
+public class RangeBarView extends View {
+
+    private int rectLineHeight;//圆角矩形线的高度,若设置高度大于圆的半径(或者未设置)就会默认给圆的1/4作为高度
+    private int rectLineCornerRadius;//圆角矩形线的圆角半径
+    private int rectLineDefaultColor;//默认颜色
+    private int rectLineCheckedColor;//选中颜色
+    private int circleRadius;//圆半径
+    private int circleStrokeWidth;//圆边框的大小
+    private int leftCircleSolidColor;//左边实心圆颜色
+    private int leftCircleStrokeColor;//左边圆边框的颜色
+    private int rightCircleSolidColor;//右边实心圆颜色
+    private int rightCircleStrokeColor;//右边圆边框的颜色
+    private int rectDialogWidth;//描述信息弹窗的宽度
+    private int rectDialogColor;//描述信息弹窗颜色
+    private int rectDialogCornerRadius;//描述信息弹窗圆角半径
+    private int rectDialogTextSize;//描述信息弹窗中文字的大小
+    private int rectDialogTextColor;//描述信息弹窗中文字的颜色
+    private int rectDialogSpaceToProgress;//描述信息弹窗距离进度条的间距
+    private int textSize, textColor;
+    private int spaceDistance;//文字与滑动控件之间的间距
+
+    //画笔
+    private Paint leftCirclePaint;
+    private Paint leftCircleStrokePaint;
+    private Paint rightCirclePaint;
+    private Paint rightCircleStrokePaint;
+    private Paint defaultLinePaint;
+    private Paint selectedLinePaint;
+    private Paint textPaint;
+    //左右两个圆对象
+    private CirclePoint leftCircleObj;
+    private CirclePoint rightCircleObj;
+    //默认颜色的圆角矩形
+    private RectF defaultCornerLineRect;
+    //中间选中颜色的圆角矩形
+    private RectF selectedCornerLineRect;
+    //表示价格数据的矩形
+    private RectF numberDescRect;
+    //画小三角形
+    private Path trianglePath;
+    //等边三角形边长
+    private int triangleLength = 15;
+    //等边三角形的高
+    private int triangleHeight;
+    private float downX;
+    private boolean touchLeftCircle;
+
+    //控件的实际宽(去除内边距之后的)
+    private int realWidth;
+    //半径+边框的总值
+    private int strokeRadius;
+    //描述信息弹窗高度+与进度条之间的间隙距离
+    private int rectDialogHeightAndSpace;
+
+    //默认分成5份
+    private int slice = 5;
+    //表示每一份所占的距离长度
+    private float perSlice;
+    //最大值,默认为100
+    private int maxValue = 100;
+    //最小值,默认为0
+    private int minValue;
+    //每一份对应的数值,数值默认值为10
+    private int sliceValue = 10;
+    //左边数值,右边数值
+    private int leftValue, rightValue;
+    //描述信息弹窗中的文字
+    private String textDesc = "0";
+    //是否显示描述信息弹窗
+    private boolean isShowRectDialog;
+    private boolean isRectDialogShowing = false;  //是否一直显示弹窗
+    private float mLastSelectedRightValue;
+
+
+    public RangeBarView(Context context) {
+        this(context, null);
+    }
+
+    public RangeBarView(Context context, @Nullable AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public RangeBarView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+        //初始化属性值,同时将每一个属性的默认值设置在styles.xml文件中
+        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RangeBarView, 0, R.style.default_range_bar_value);
+        int count = typedArray.getIndexCount();
+        for (int i = 0; i < count; i++) {
+            int attr = typedArray.getIndex(i);
+            if (attr == R.styleable.RangeBarView_rect_line_default_color) {
+                rectLineDefaultColor = typedArray.getColor(attr, ContextCompat.getColor(context, R.color.color_cdcd));
+            } else if (attr == R.styleable.RangeBarView_rect_line_checked_color) {
+                rectLineCheckedColor = typedArray.getColor(attr, ContextCompat.getColor(context, R.color.app_blue));
+            } else if (attr == R.styleable.RangeBarView_rect_line_height) {
+                rectLineHeight = typedArray.getDimensionPixelSize(attr, getResources().getDimensionPixelSize(R.dimen.rect_line_height));
+            } else if (attr == R.styleable.RangeBarView_circle_radius) {
+                circleRadius = typedArray.getDimensionPixelSize(attr, getResources().getDimensionPixelSize(R.dimen.circle_radius));
+            } else if (attr == R.styleable.RangeBarView_circle_stroke_width) {
+                circleStrokeWidth = typedArray.getDimensionPixelSize(attr, getResources().getDimensionPixelSize(R.dimen.circle_stroke_width));
+            } else if (attr == R.styleable.RangeBarView_left_circle_solid_color) {
+                leftCircleSolidColor = typedArray.getColor(attr, ContextCompat.getColor(context, R.color.color_fff));
+            } else if (attr == R.styleable.RangeBarView_left_circle_stroke_color) {
+                leftCircleStrokeColor = typedArray.getColor(attr, ContextCompat.getColor(context, R.color.color_cdcd));
+            } else if (attr == R.styleable.RangeBarView_right_circle_solid_color) {
+                rightCircleSolidColor = typedArray.getColor(attr, ContextCompat.getColor(context, R.color.color_fff));
+            } else if (attr == R.styleable.RangeBarView_right_circle_stroke_color) {
+                rightCircleStrokeColor = typedArray.getColor(attr, ContextCompat.getColor(context, R.color.color_cdcd));
+            } else if (attr == R.styleable.RangeBarView_range_text_size) {
+                textSize = typedArray.getDimensionPixelSize(attr, getResources().getDimensionPixelSize(R.dimen.item_text_size));
+            } else if (attr == R.styleable.RangeBarView_range_text_color) {
+                textColor = typedArray.getColor(attr, ContextCompat.getColor(context, R.color.color_333));
+            } else if (attr == R.styleable.RangeBarView_view_text_space) {
+                spaceDistance = typedArray.getDimensionPixelSize(attr, getResources().getDimensionPixelSize(R.dimen.view_and_text_space));
+            } else if (attr == R.styleable.RangeBarView_rect_price_desc_dialog_width) {
+                rectDialogWidth = typedArray.getDimensionPixelSize(attr, getResources().getDimensionPixelSize(R.dimen.rect_dialog_width));
+            } else if (attr == R.styleable.RangeBarView_rect_price_desc_dialog_color) {
+                rectDialogColor = typedArray.getColor(attr, ContextCompat.getColor(context, R.color.color_275D9D));
+            } else if (attr == R.styleable.RangeBarView_rect_price_desc_dialog_corner_radius) {
+                rectDialogCornerRadius = typedArray.getDimensionPixelSize(attr, getResources().getDimensionPixelSize(R.dimen.rect_dialog_corner_radius));
+            } else if (attr == R.styleable.RangeBarView_rect_price_desc_text_size) {
+                rectDialogTextSize = typedArray.getDimensionPixelSize(attr, getResources().getDimensionPixelSize(R.dimen.rect_dialog_text_size));
+            } else if (attr == R.styleable.RangeBarView_rect_price_desc_text_color) {
+                rectDialogTextColor = typedArray.getColor(attr, ContextCompat.getColor(context, R.color.color_fff));
+            } else if (attr == R.styleable.RangeBarView_rect_price_desc_space_to_progress) {
+                rectDialogSpaceToProgress = typedArray.getDimensionPixelSize(attr, getResources().getDimensionPixelSize(R.dimen.rect_dialog_space_to_progress));
+            }
+        }
+        typedArray.recycle();
+        //初始化画笔
+        initPaints();
+    }
+
+    public void setDatas(int minValue, int maxValue, int sliceValue, OnMoveValueListener listener) {
+        this.minValue = minValue;
+        this.maxValue = maxValue;
+        this.sliceValue = sliceValue;
+        this.listener = listener;
+        int num = (maxValue - minValue) / sliceValue;
+        slice = (maxValue - minValue) % sliceValue == 0 ? num : num + 1;
+        invalidate();
+    }
+
+    private void initPaints() {
+        defaultLinePaint = new Paint();
+        defaultLinePaint.setAntiAlias(true);
+        defaultLinePaint.setDither(true);
+
+        selectedLinePaint = new Paint();
+        selectedLinePaint.setAntiAlias(true);
+        selectedLinePaint.setDither(true);
+
+        textPaint = new Paint();
+        textPaint.setAntiAlias(true);
+        textPaint.setDither(true);
+        textPaint.setTextSize(textSize);
+        textPaint.setColor(textColor);
+
+        //初始化左边实心圆
+        leftCirclePaint = setPaint(leftCircleSolidColor, 0, 0f, true);
+        //初始化左边圆的边框
+        leftCircleStrokePaint = setPaint(0, leftCircleStrokeColor, circleStrokeWidth, false);
+        //初始化右边实心圆
+        rightCirclePaint = setPaint(rightCircleSolidColor, 0, 0f, true);
+        //初始化左边圆的边框
+        rightCircleStrokePaint = setPaint(0, rightCircleStrokeColor, circleStrokeWidth, false);
+        //默认颜色的圆角矩形线
+        defaultCornerLineRect = new RectF();
+        //中间选中颜色的圆角矩形
+        selectedCornerLineRect = new RectF();
+        //数值描述圆角矩形
+        numberDescRect = new RectF();
+        //画小三角形
+        trianglePath = new Path();
+        //小三角形的高
+        triangleHeight = (int) Math.sqrt(triangleLength * triangleLength - triangleLength / 2 * (triangleLength / 2));
+    }
+
+    private Paint setPaint(int bgColor, int strokeColor, float strokeWidth, boolean hasFillStyle) {
+        Paint mPaint = new Paint();
+        mPaint.setAntiAlias(true);
+        mPaint.setDither(true);
+        mPaint.setStyle(hasFillStyle ? Paint.Style.FILL : Paint.Style.STROKE);
+        mPaint.setColor(hasFillStyle ? bgColor : strokeColor);
+        mPaint.setStrokeWidth(strokeWidth);
+        return mPaint;
+    }
+
+    private class CirclePoint {
+        //圆的圆心坐标
+        public float cx;
+        public float cy;
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        int widthMode = MeasureSpec.getMode(widthMeasureSpec);
+        int widthSize = MeasureSpec.getSize(widthMeasureSpec);
+        int heightMode = MeasureSpec.getMode(heightMeasureSpec);
+        int heightSize = MeasureSpec.getSize(heightMeasureSpec);
+
+        int width, height;
+        int wSize = getPaddingLeft() + circleRadius * 2 + getPaddingRight() + circleStrokeWidth * 2;
+        //这里不绘制底部的文字了 ,高度测量不需要加上文字的一些测量
+        int hSize = getPaddingTop() + rectDialogCornerRadius * 2 + triangleHeight + rectDialogSpaceToProgress +
+                circleRadius * 2 + circleStrokeWidth * 2 + /*spaceDistance + textSize + */getPaddingBottom();
+
+        if (widthMode == MeasureSpec.EXACTLY) {
+            width = widthSize;
+        } else if (widthMode == MeasureSpec.AT_MOST) {
+            width = Math.min(widthSize, wSize);
+        } else {
+            width = wSize;
+        }
+
+        if (heightMode == MeasureSpec.EXACTLY) {
+            height = heightSize;
+        } else if (heightMode == MeasureSpec.AT_MOST) {
+            height = Math.min(heightSize, hSize);
+        } else {
+            height = hSize;
+        }
+//        Log.e("TAG", "宽onMeasure----> " + width);
+//        Log.e("TAG", "高onMeasure----> " + height);
+        setMeasuredDimension(width, height);
+    }
+
+    @Override
+    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+        super.onSizeChanged(w, h, oldw, oldh);
+
+        realWidth = w - getPaddingLeft() - getPaddingRight();
+        strokeRadius = circleRadius + circleStrokeWidth;
+        rectDialogHeightAndSpace = rectDialogCornerRadius * 2 + rectDialogSpaceToProgress;
+
+        //左边圆的圆心坐标
+        leftCircleObj = new CirclePoint();
+        leftCircleObj.cx = getPaddingLeft() + strokeRadius;
+        leftCircleObj.cy = getPaddingTop() + rectDialogHeightAndSpace + strokeRadius;
+
+        //右边圆的圆心坐标
+        rightCircleObj = new CirclePoint();
+        rightCircleObj.cx = w - getPaddingRight() - strokeRadius;
+        rightCircleObj.cy = getPaddingTop() + rectDialogHeightAndSpace + strokeRadius;
+
+        //默认圆角矩形进度条
+        rectLineCornerRadius = rectLineHeight / 2;//圆角半径
+        defaultCornerLineRect.left = getPaddingLeft() + strokeRadius;
+        defaultCornerLineRect.top = getPaddingTop() + rectDialogHeightAndSpace + strokeRadius - rectLineCornerRadius;
+        defaultCornerLineRect.right = w - getPaddingRight() - strokeRadius;
+        defaultCornerLineRect.bottom = getPaddingTop() + rectDialogHeightAndSpace + strokeRadius + rectLineCornerRadius;
+
+        //选中状态圆角矩形进度条
+        selectedCornerLineRect.left = leftCircleObj.cx;
+        selectedCornerLineRect.top = getPaddingTop() + rectDialogHeightAndSpace + strokeRadius - rectLineCornerRadius;
+        selectedCornerLineRect.right = rightCircleObj.cx;
+        selectedCornerLineRect.bottom = getPaddingTop() + rectDialogHeightAndSpace + strokeRadius + rectLineCornerRadius;
+
+        //数值描述圆角矩形
+        numberDescRect.left = w / 2 - rectDialogWidth / 2;
+        numberDescRect.top = getPaddingTop();
+        numberDescRect.right = w / 2 + rectDialogWidth / 2;
+        numberDescRect.bottom = getPaddingTop() + rectDialogCornerRadius * 2;
+
+        //每一份对应的距离
+        //将每一份所占的距离长度perSlice改成float浮点型
+        perSlice = (realWidth - strokeRadius * 2) * 1f / slice;
+    }
+
+    @Override
+    protected void onDraw(Canvas canvas) {
+        super.onDraw(canvas);
+
+        //绘制文字
+//        drawBottomText(canvas);
+        //绘制中间圆角矩形线
+        drawDefaultCornerRectLine(canvas);
+        //绘制两圆之间已经选中的的圆角矩形
+        drawSelectedRectLine(canvas);
+        //绘制描述信息圆角矩形弹窗
+        drawRectDialog(canvas);
+        //画左边圆以及圆的边框
+        drawLeftCircle(canvas);
+        //画右边圆以及圆的边框
+        drawRightCircle(canvas);
+        //绘制描述信息弹窗中的文字
+        drawTextOfRectDialog(canvas);
+        //绘制小三角形
+        drawSmallTriangle(canvas);
+    }
+
+    //绘制默认的x轴
+    private void drawDefaultCornerRectLine(Canvas canvas) {
+        defaultLinePaint.setColor(rectLineDefaultColor);
+        canvas.drawRoundRect(defaultCornerLineRect, rectLineCornerRadius, rectLineCornerRadius, defaultLinePaint);
+    }
+
+    //绘制已经选中的x轴
+    private void drawSelectedRectLine(Canvas canvas) {
+
+        //设置已经选中的渐变色
+//        LinearGradient shader2 = new LinearGradient(selectedCornerLineRect.left, selectedCornerLineRect.top,
+//                selectedCornerLineRect.right, selectedCornerLineRect.bottom
+//                , CommUtils.getColor(R.color.app_blue),
+//                CommUtils.getColor(R.color.profile_red),
+//                Shader.TileMode.MIRROR);
+//        selectedLinePaint.setShader(shader2);
+        selectedLinePaint.setColor(rectLineCheckedColor);
+
+        canvas.drawRoundRect(selectedCornerLineRect, rectLineCornerRadius, rectLineCornerRadius, selectedLinePaint);
+
+    }
+
+    //绘制左侧的圆形
+    private void drawLeftCircle(Canvas canvas) {
+        canvas.drawCircle(leftCircleObj.cx, leftCircleObj.cy, circleRadius, leftCirclePaint);
+        canvas.drawCircle(leftCircleObj.cx, leftCircleObj.cy, circleRadius, leftCircleStrokePaint);
+    }
+
+    //绘制右侧的圆形
+    private void drawRightCircle(Canvas canvas) {
+        canvas.drawCircle(rightCircleObj.cx, rightCircleObj.cy, circleRadius, rightCirclePaint);
+        canvas.drawCircle(rightCircleObj.cx, rightCircleObj.cy, circleRadius, rightCircleStrokePaint);
+    }
+
+    //绘制底部的文本显示(效果图修改,不需要刻度了)
+//    private void drawBottomText(Canvas canvas) {
+//        textPaint.setColor(textColor);
+//        textPaint.setTextSize(textSize);
+//        //这里不绘制第0个索引和最后的索引
+//        for (int i = 1; i < slice; i++) {
+//            int value = i * sliceValue > maxValue ? maxValue : i * sliceValue + minValue;
+//            String text = String.valueOf(value);
+//            //格式化带,的数值
+//            DecimalFormat df = new DecimalFormat("###,###,###.##");
+//            String formatText = df.format(Double.parseDouble(text));
+//
+//            float textWidth = textPaint.measureText(formatText);
+//            //绘制文本
+//            canvas.drawText(formatText,
+//                    i * perSlice - textWidth / 2 + (getPaddingLeft() + strokeRadius),
+//                    getPaddingTop() + rectDialogHeightAndSpace + strokeRadius * 2 + spaceDistance + textSize / 2,
+//                    textPaint);
+//            //顺便绘制刻度文本标识
+//            canvas.drawText("|",
+//                    i * perSlice + (getPaddingLeft() + strokeRadius),
+//                    getPaddingTop() + rectDialogHeightAndSpace / 2 + strokeRadius * 2 + textSize / 2,
+//                    textPaint);
+//        }
+//    }
+
+    //顶部弹窗的背景和矩形绘制
+    private void drawRectDialog(Canvas canvas) {
+        if (isShowRectDialog) {
+            selectedLinePaint.setShader(null);
+            selectedLinePaint.setColor(rectDialogColor);
+            canvas.drawRoundRect(numberDescRect, rectDialogCornerRadius, rectDialogCornerRadius, selectedLinePaint);
+        }
+    }
+
+    //顶部弹窗的文本绘制
+    private void drawTextOfRectDialog(Canvas canvas) {
+        if (leftValue == minValue && (rightValue == maxValue || rightValue < maxValue)) {
+//            textDesc = CommUtils.getString(R.string.under) + " " + rightValue;
+            textDesc = "低于" + " " + rightValue;
+        } else if (leftValue > minValue && rightValue == maxValue) {
+//            textDesc = CommUtils.getString(R.string.over) + " " + leftValue;
+            textDesc = "高于" + " " + leftValue;
+        } else if (leftValue > minValue && rightValue < maxValue) {
+            if (leftValue == rightValue) {
+//                textDesc = CommUtils.getString(R.string.under) + " " + rightValue;
+                textDesc = "低于" + " " + rightValue;
+            } else
+                textDesc = leftValue + "-" + rightValue;
+        }
+
+        if (isShowRectDialog) {
+            textPaint.setColor(rectDialogTextColor);
+            textPaint.setTextSize(rectDialogTextSize);
+            float textWidth = textPaint.measureText(textDesc);
+            float textLeft = numberDescRect.left + rectDialogWidth / 2 - textWidth / 2;
+            canvas.drawText(textDesc, textLeft, getPaddingTop() + rectDialogCornerRadius + rectDialogTextSize / 4, textPaint);
+        }
+    }
+
+    //顶部弹窗的小三角形箭头绘制
+    private void drawSmallTriangle(Canvas canvas) {
+        if (isShowRectDialog) {
+            trianglePath.reset();
+            trianglePath.moveTo(numberDescRect.left + rectDialogWidth / 2 - triangleLength / 2, getPaddingTop() + rectDialogCornerRadius * 2);
+            trianglePath.lineTo(numberDescRect.left + rectDialogWidth / 2 + triangleLength / 2, getPaddingTop() + rectDialogCornerRadius * 2);
+            trianglePath.lineTo(numberDescRect.left + rectDialogWidth / 2, getPaddingTop() + rectDialogCornerRadius * 2 + triangleHeight);
+            trianglePath.close();
+            canvas.drawPath(trianglePath, selectedLinePaint);
+        }
+    }
+
+    //触摸事件的处理
+    @Override
+    public boolean onTouchEvent(MotionEvent event) {
+        switch (event.getAction()) {
+            case MotionEvent.ACTION_DOWN:
+                downX = event.getX();
+                //判断手指按下的点是在左边圆圈的位置范围还是在右边圆圈的位置范围
+                touchLeftCircle = checkIsLeftOrRight(downX);
+                if (touchLeftCircle) {//表示按下的点位于左边圆圈活动范围内
+                    leftCircleObj.cx = (int) downX;
+                } else {
+                    rightCircleObj.cx = (int) downX;
+                }
+                break;
+            case MotionEvent.ACTION_MOVE:
+                float moveX = event.getX();
+                isShowRectDialog = true;
+                if (leftCircleObj.cx == rightCircleObj.cx) {//两圆圈重合的情况
+                    if (touchLeftCircle) {
+                        //极端情况的优化处理,滑动左边圆到达最右边时,再次滑动时设置为左滑,即:继续让左边圆向左滑动
+                        if (leftCircleObj.cx == getWidth() - getPaddingRight() - strokeRadius) {
+                            touchLeftCircle = true;
+                            leftCircleObj.cx = (int) moveX;
+                        } else {
+                            //当滑动左边圆在中间某处与右边圆重合时,此时再次继续滑动则左边圆处于右边圆位置处不动,右边圆改为向右滑动
+                            touchLeftCircle = false;
+                            rightCircleObj.cx = (int) moveX;
+                        }
+                    } else {
+                        if (rightCircleObj.cx == getPaddingLeft() + strokeRadius) {
+                            touchLeftCircle = false;
+                            rightCircleObj.cx = (int) moveX;
+                        } else {
+                            touchLeftCircle = true;
+                            leftCircleObj.cx = (int) moveX;
+                        }
+                    }
+                } else {
+                    if (touchLeftCircle) {
+                        //滑动左边圆圈时,如果位置等于或者超过右边圆的位置时,设置右边圆圈的坐标给左边圆圈,就相当于左边圆圈停留在右边圆圈之前的位置上,然后移动右边圆圈
+                        leftCircleObj.cx = leftCircleObj.cx - rightCircleObj.cx >= 0 ? rightCircleObj.cx : (int) moveX;
+                    } else {
+                        //同理
+                        rightCircleObj.cx = rightCircleObj.cx - leftCircleObj.cx <= 0 ? leftCircleObj.cx : (int) moveX;
+                    }
+                }
+
+                //移动的时候不停的计算左右两侧的值
+                int moveLeftData = getPercentByMax(leftCircleObj.cx - getPaddingLeft() - strokeRadius);
+                int moveRightData = getPercentByMax(rightCircleObj.cx - getPaddingLeft() - strokeRadius);
+                leftValue = moveLeftData > maxValue ? maxValue : moveLeftData;
+                rightValue = moveRightData > maxValue ? maxValue : moveRightData;
+
+                //移动的时候如果右边的值大于上次选择的值,那么就回调出去->去掉勾选状态,
+                if (mLastSelectedRightValue > 0 && rightValue > mLastSelectedRightValue) {
+                    mLastSelectedRightValue = 0;
+                    if (listener != null) listener.noCheckBox();
+                }
+                break;
+            case MotionEvent.ACTION_UP:
+            case MotionEvent.ACTION_CANCEL:
+                //移动到刻度,再重新算距离
+//                if (touchLeftCircle) {
+                // 每一步的距离 = 有效的长度(即实际矩形线长度范围内) / 步数,
+                // 所以这个有效的距离应该是移动的坐标距离(event.getX())减去左内边距以及strokeRadius,
+                // 减去之后剩下的距离才是在矩形线上真正体现出来的间距,(有点绕,自己多理解下就想通了)
+//                    int partsOfLeft = getSliceByCoordinate((int) event.getX() - getPaddingLeft() - strokeRadius);
+                //最终计算圆心的坐标位置的时候还是需要加上这些的,因为坐标原点是此控件view的左上角
+//                    leftCircleObj.cx = leftCircleObj.cx - rightCircleObj.cx >= 0 ? rightCircleObj.cx : partsOfLeft * perSlice + strokeRadius + getPaddingLeft();
+//                } else {
+//                    int partsOfRight = getSliceByCoordinate((int) event.getX() - getPaddingLeft() - strokeRadius);
+//                    rightCircleObj.cx = rightCircleObj.cx - leftCircleObj.cx <= 0 ? leftCircleObj.cx : partsOfRight * perSlice + strokeRadius + getPaddingLeft();
+//                }
+
+                //移动到刻度
+//                int leftData = getSliceByCoordinate(leftCircleObj.cx - getPaddingLeft() - strokeRadius) * sliceValue + minValue;
+//                int rightData = getSliceByCoordinate(rightCircleObj.cx - getPaddingLeft() - strokeRadius) * sliceValue + minValue;
+
+                //UP的时候再次计算左右两侧的值回调出去
+                //滑动到哪移动到哪,根据滑动的百分比计算值
+                int leftData = getPercentByMax(leftCircleObj.cx - getPaddingLeft() - strokeRadius);
+                int rightData = getPercentByMax(rightCircleObj.cx - getPaddingLeft() - strokeRadius);
+                leftValue = leftData > maxValue ? maxValue : leftData;
+                rightValue = rightData > maxValue ? maxValue : rightData;
+                //回调
+                if (listener != null) {
+                    listener.onMoveValue(leftValue, rightValue);
+                }
+                //延时显示之后移除顶部dialog的显示
+                CommUtils.getHandler().removeCallbacksAndMessages(null);
+                CommUtils.getHandler().postDelayed(new Runnable() {
+                    @Override
+                    public void run() {
+                        if (!isRectDialogShowing)
+                            isShowRectDialog = false;
+                        postInvalidate();
+                    }
+                }, 800);
+                break;
+        }
+
+        //所有的手势操作处理防止越界
+        if (touchLeftCircle) {
+            if (leftCircleObj.cx > rightCircleObj.cx) {
+                leftCircleObj.cx = rightCircleObj.cx;
+            } else {
+                if (leftCircleObj.cx < getPaddingLeft() + strokeRadius) {
+                    leftCircleObj.cx = getPaddingLeft() + strokeRadius;
+                }
+                if (leftCircleObj.cx > getWidth() - getPaddingRight() - strokeRadius) {
+                    leftCircleObj.cx = getWidth() - getPaddingRight() - strokeRadius;
+                }
+            }
+        } else {
+            if (leftCircleObj.cx > rightCircleObj.cx) {
+                rightCircleObj.cx = leftCircleObj.cx;
+            } else {
+                if (rightCircleObj.cx > getWidth() - getPaddingRight() - strokeRadius) {
+                    rightCircleObj.cx = getWidth() - getPaddingRight() - strokeRadius;
+                }
+
+                if (rightCircleObj.cx < getPaddingLeft() + strokeRadius) {
+                    rightCircleObj.cx = getPaddingLeft() + strokeRadius;
+                }
+            }
+        }
+
+        //由于按下的点的坐标在改变,所以中间的圆角矩形选中的范围坐标也要跟着改变
+        selectedCornerLineRect.left = leftCircleObj.cx;
+        selectedCornerLineRect.right = rightCircleObj.cx;
+        //不管是滑动左边圆还是右边圆,都要计算两圆间的中心距离作为展示价格进度框的中心点
+        numberDescRect.left = (rightCircleObj.cx + leftCircleObj.cx) / 2 - rectDialogWidth / 2;
+        numberDescRect.right = (rightCircleObj.cx + leftCircleObj.cx) / 2 + rectDialogWidth / 2;
+
+        //全部的手势操作都会刷新页面,在此之前赋值完成
+        invalidate();
+
+        return true;
+    }
+
+    //计算up的时候究竟是多少距离,偏移到最近的刻度上
+//    private int getSliceByCoordinate(float moveDistance) {
+//        //此位置坐标对应的距离能分多少份
+//        int lineLength = getWidth() - getPaddingLeft() - getPaddingRight() - strokeRadius * 2;
+//        moveDistance = moveDistance <= 0 ? 0 : (moveDistance >= lineLength ? lineLength : moveDistance);
+//        int parts = (int) (moveDistance / perSlice);//总距离 / 每一份的距离
+//        parts = moveDistance % perSlice >= perSlice / 2 ? parts + 1 : parts;
+//        Log.e("TAG", "左边aaa-----> moveDistance:" + moveDistance);
+//        Log.e("TAG", "左边aaa-----> perSlice:" + perSlice);
+//        Log.e("TAG", "左边aaa-----> parts:" + parts);
+//        return parts > slice ? slice : parts;
+//    }
+
+    //获取移动的百分比对应的值
+    private int getPercentByMax(float moveDistance) {
+        //此位置坐标对应的距离能分多少份
+        int lineLength = getWidth() - getPaddingLeft() - getPaddingRight() - strokeRadius * 2;
+        moveDistance = moveDistance <= 0 ? 0 : (moveDistance >= lineLength ? lineLength : moveDistance);
+
+        //计算滑动的百分比
+        float percentage = moveDistance / lineLength;
+//        Log.e("TAG", "移动的百分比:" + percentage);
+        int value = (int) (percentage * maxValue);
+//        Log.e("TAG", "移动的值:" + value);
+        return value;
+    }
+
+    /**
+     * 通过外界传值让小圆自动移动到相应数值对应的坐标处
+     * 移动到刻度上
+     */
+//    public void setCircleMoveCoordinateByValue(int minData, int maxData) {
+//        if (minData < minValue) minData = minValue;
+//        if (maxData > maxValue) maxData = maxValue;
+//        //占了多少份
+//        int sliceL = (minData - minValue) / sliceValue;
+//        int sliceR = (maxData - minValue) / sliceValue;
+//        sliceL = (minData - minValue) % sliceValue == 0 ? sliceL : sliceL + 1;
+//        sliceR = (maxData - minValue) % sliceValue == 0 ? sliceR : sliceR + 1;
+//        //左边圆的圆心坐标 = minData所占的份数 * 每一份的坐标距离 + getPaddingLeft() + circleRadius
+//        leftCircleObj.cx = sliceL * perSlice + getPaddingLeft() + circleRadius;
+//        rightCircleObj.cx = sliceR * perSlice + getPaddingLeft() + circleRadius;
+//        //设置线的位置
+//        selectedCornerLineRect.left = leftCircleObj.cx;
+//        selectedCornerLineRect.right = rightCircleObj.cx;
+//        //设置顶部价格弹窗位置
+//        numberDescRect.left = (rightCircleObj.cx + leftCircleObj.cx) / 2 - rectDialogWidth / 2;
+//        numberDescRect.right = (rightCircleObj.cx + leftCircleObj.cx) / 2 + rectDialogWidth / 2;
+//        invalidate();
+//    }
+
+    /**
+     * 外界调用,移动到百分比上面
+     */
+    public void setCircleMoveCoordinateByValue(float minData, float maxData) {
+        mLastSelectedRightValue = maxData;
+        if (minData < minValue) minData = minValue;
+        if (maxData > maxValue) maxData = maxValue;
+        //占了多少百分比
+        float leftPercent = minData / maxValue;
+        float rightPercent = maxData / maxValue;
+        //计算多少对应的百分比位置
+        int lineLength = getWidth() - getPaddingLeft() - getPaddingRight() - strokeRadius * 2;
+        int leftDistance = (int) (lineLength * leftPercent);
+        int RightDistance = (int) (lineLength * rightPercent);
+
+        //展示值,展示对话框
+        isShowRectDialog = true;
+        leftValue = minData > maxValue ? maxValue : (int) minData;
+        rightValue = maxData > maxValue ? maxValue : (int) maxData;
+
+        //左边圆的圆心坐标 = minData所占的份数 * 每一份的坐标距离 + getPaddingLeft() + circleRadius
+        leftCircleObj.cx = leftDistance + getPaddingLeft() + circleRadius;
+        rightCircleObj.cx = RightDistance + getPaddingLeft() + circleRadius;
+        //设置线的位置
+        selectedCornerLineRect.left = leftCircleObj.cx;
+        selectedCornerLineRect.right = rightCircleObj.cx;
+        //设置顶部价格弹窗位置
+        numberDescRect.left = (rightCircleObj.cx + leftCircleObj.cx) / 2 - rectDialogWidth / 2;
+        numberDescRect.right = (rightCircleObj.cx + leftCircleObj.cx) / 2 + rectDialogWidth / 2;
+        invalidate();
+
+        //延时关闭对话框
+        CommUtils.getHandler().removeCallbacksAndMessages(null);
+        CommUtils.getHandler().postDelayed(new Runnable() {
+            @Override
+            public void run() {
+                if (!isRectDialogShowing)
+                    isShowRectDialog = false;
+                postInvalidate();
+            }
+        }, 800);
+    }
+
+    //是否设置一直显示
+    public void setRectDialogShowing(boolean isRectDialogShowing) {
+        this.isRectDialogShowing = isRectDialogShowing;
+    }
+
+
+    //点下小圆圈的左右判断
+    private boolean checkIsLeftOrRight(float downX) {
+        //如果按下的区域位于左边区域,则按下坐标downX的值就会比较小(即按下坐标点在左边),那么leftCircleObj.cx - downX的绝对值也会比较小
+        //rightCircleObj.cx - downX绝对值肯定是大于leftCircleObj.cx - downX绝对值的,两者相减肯定是小于0的
+        if (Math.abs(leftCircleObj.cx - downX) - Math.abs(rightCircleObj.cx - downX) > 0) {//表示按下的区域位于右边
+            return false;
+        }
+        return true;
+    }
+
+    //回调移动值的监听,在Up的时候才触发回调
+    private OnMoveValueListener listener;
+
+    public interface OnMoveValueListener {
+        void onMoveValue(int leftValue, int rightValue);
+
+        void noCheckBox();
+    }
+}

BIN
cs_cptServices/src/main/res/drawable-xhdpi/done.webp


BIN
cs_cptServices/src/main/res/drawable-xxhdpi/done.webp


+ 8 - 0
cs_cptServices/src/main/res/drawable/shape_page_gray_bg_border_line_3conner.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <solid android:color="@color/page_bg"/>
+    <stroke android:color="@color/divider_color" android:width="@dimen/d_0.5dp"/>
+    <corners android:radius="@dimen/d_3dp"/>
+
+</shape>

+ 21 - 0
cs_cptServices/src/main/res/values/attrs.xml

@@ -50,4 +50,25 @@
         <attr name="removeDefaultPadding" format="boolean" />
     </declare-styleable>
 
+    <declare-styleable name="RangeBarView">
+        <attr name="rect_line_height" format="dimension"/>
+        <attr name="rect_line_default_color" format="color"/>
+        <attr name="rect_line_checked_color" format="color"/>
+        <attr name="circle_radius" format="dimension"/>
+        <attr name="circle_stroke_width" format="dimension"/>
+        <attr name="left_circle_solid_color" format="color"/>
+        <attr name="left_circle_stroke_color" format="color"/>
+        <attr name="right_circle_solid_color" format="color"/>
+        <attr name="right_circle_stroke_color" format="color"/>
+        <attr name="range_text_size" format="dimension"/>
+        <attr name="range_text_color" format="color"/>
+        <attr name="view_text_space" format="dimension"/>
+        <attr name="rect_price_desc_dialog_width" format="dimension"/>
+        <attr name="rect_price_desc_dialog_color" format="color"/>
+        <attr name="rect_price_desc_dialog_corner_radius" format="dimension"/>
+        <attr name="rect_price_desc_text_size" format="dimension"/>
+        <attr name="rect_price_desc_text_color" format="color"/>
+        <attr name="rect_price_desc_space_to_progress" format="dimension"/>
+    </declare-styleable>
+
 </resources>

+ 7 - 0
cs_cptServices/src/main/res/values/colors.xml

@@ -59,4 +59,11 @@
     <color name="white_text_fe">#fefefe</color>
     <color name="gray_text_8e">#8E8E8E</color>
 
+    <color name="color_333">#767676</color>
+    <color name="color_275D9D">#275D9D</color>
+    <color name="color_cdcd">#CDCDCD</color>
+    <color name="color_fff">#ffffff</color>
+    <color name="color_d10773">#D10773</color>
+    <color name="color_4499ff">#4499FF</color>
+
 </resources>

+ 16 - 0
cs_cptServices/src/main/res/values/dimens.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <dimen name="item_text_size">14sp</dimen>
+    <dimen name="rect_line_corner">5dp</dimen>
+    <dimen name="rect_line_height">10dp</dimen>
+    <dimen name="rect_line_width">100dp</dimen>
+    <dimen name="circle_radius">20dp</dimen>
+    <dimen name="circle_stroke_width">2dp</dimen>
+    <dimen name="view_and_text_space">10dp</dimen>
+    <dimen name="rect_dialog_width">200dp</dimen>
+    <dimen name="rect_dialog_corner_radius">50dp</dimen>
+    <dimen name="rect_dialog_text_size">12sp</dimen>
+    <dimen name="rect_dialog_space_to_progress">5dp</dimen>
+
+</resources>

+ 21 - 0
cs_cptServices/src/main/res/values/styles.xml

@@ -28,4 +28,25 @@
         </attr>
     </declare-styleable>
 
+    <style name="default_range_bar_value">
+        <item name="rect_line_height">5dp</item>
+        <item name="rect_line_default_color">#CDCDCD</item>
+        <item name="rect_line_checked_color">#275D9D</item>
+        <item name="circle_radius">10dp</item>
+        <item name="circle_stroke_width">2dp</item>
+        <item name="left_circle_solid_color">#D10773</item>
+        <item name="left_circle_stroke_color">#275D9D</item>
+        <item name="right_circle_solid_color">#4499FF</item>
+        <item name="right_circle_stroke_color">#275D9D</item>
+        <item name="range_text_size">16sp</item>
+        <item name="range_text_color">#333333</item>
+        <item name="view_text_space">10dp</item>
+        <item name="rect_price_desc_dialog_width">85dp</item>
+        <item name="rect_price_desc_dialog_color">#275D9D</item>
+        <item name="rect_price_desc_dialog_corner_radius">15dp</item>
+        <item name="rect_price_desc_text_size">12sp</item>
+        <item name="rect_price_desc_text_color">#FFFFFF</item>
+        <item name="rect_price_desc_space_to_progress">5dp</item>
+    </style>
+
 </resources>