首充UI修改

This commit is contained in:
huangjian
2022-06-08 18:52:43 +08:00
parent 733824140c
commit 97bf86c15e
15 changed files with 197 additions and 164 deletions

View File

@@ -619,7 +619,7 @@
<activity
android:name=".ui.pay.ChargeDialog"
android:label="充值"
android:theme="@style/dialog_web_view_activity"/>
android:theme="@style/dialogactivity"/>
<activity
android:name=".home.activity.CollectionRoomActivity"

View File

@@ -5,6 +5,9 @@ import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.text.Spannable
import android.text.SpannableStringBuilder
import android.text.style.ForegroundColorSpan
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
@@ -62,27 +65,31 @@ class FirstChargeDialog : BaseViewBindingActivity<DialogFirstChargeBinding>() {
@SuppressLint("CheckResult")
override fun init() {
//这里的height用MATCH_PARENT状态栏会被顶上去,不知道什么鬼
val height = ScreenUtil.screenHeight - ScreenUtil.getStatusBarHeight(context)
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, height)
window.setGravity(Gravity.CENTER)
EventBus.getDefault().register(this)
binding.rbPlanA.setOnClickListener {
reset()
binding.rbPlanA.isChecked = true
binding.rbPlanA.textSize = 22f
binding.rbPlanB.isChecked = false
binding.rbPlanC.isChecked = false
updateCurrGoods(goodsList?.getOrNull(0))
}
binding.rbPlanB.setOnClickListener {
reset()
binding.rbPlanA.isChecked = false
binding.rbPlanB.isChecked = true
binding.rbPlanB.textSize = 22f
binding.rbPlanC.isChecked = false
updateCurrGoods(goodsList?.getOrNull(1))
}
binding.rbPlanC.setOnClickListener {
reset()
binding.rbPlanA.isChecked = false
binding.rbPlanB.isChecked = false
binding.rbPlanC.isChecked = true
binding.rbPlanC.textSize = 22f
updateCurrGoods(goodsList?.getOrNull(2))
}
binding.ivHelp.setOnClickListener { showHelpPopup() }
binding.ivCharge.setOnClickListener {
binding.tvCharge.setOnClickListener {
currGoods?.let {
SelectPayTypeDialog.newInstance(it.chargeProdId, "¥${it.chargeMoney}")
.show(this)
@@ -111,6 +118,13 @@ class FirstChargeDialog : BaseViewBindingActivity<DialogFirstChargeBinding>() {
SingleToastUtil.showToast(it.message)
finish()
})
binding.viewBg.setOnClickListener {
//do nothing
}
binding.root.setOnClickListener {
finish()
}
}
@SuppressLint("SetTextI18n")
@@ -140,20 +154,22 @@ class FirstChargeDialog : BaseViewBindingActivity<DialogFirstChargeBinding>() {
private fun updateCurrGoods(firstChargeGoods: FirstChargeGoods?) {
firstChargeGoods?.let {
currGoods = it
binding.tvTitle.text = it.chargeProdTitle
val giveMoneyIndex = it.chargeProdTitle.lastIndexOf(it.giveMoney)
if (giveMoneyIndex == -1) {
binding.tvTitle.text = it.chargeProdTitle
} else {
val builder = SpannableStringBuilder(it.chargeProdTitle)
builder.setSpan(
ForegroundColorSpan(Color.parseColor("#FFA027")), giveMoneyIndex,
giveMoneyIndex + (it.giveMoney?.length ?: 0),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
)
binding.tvTitle.text = builder
}
rewardAdapter.setNewData(it.firstChargeRewardList)
}
}
private fun reset() {
binding.rbPlanA.isChecked = false
binding.rbPlanB.isChecked = false
binding.rbPlanC.isChecked = false
binding.rbPlanA.textSize = 18f
binding.rbPlanB.textSize = 18f
binding.rbPlanC.textSize = 18f
}
private fun showHelpPopup() {
if (currGoods == null) {
SingleToastUtil.showToast("数据加载中,请稍后...")
@@ -162,7 +178,8 @@ class FirstChargeDialog : BaseViewBindingActivity<DialogFirstChargeBinding>() {
val contentView: View
if (!this::helpPopupWindow.isInitialized) {
contentView =
LayoutInflater.from(context).inflate(R.layout.layout_first_charge_help_view, null)
LayoutInflater.from(context)
.inflate(R.layout.layout_first_charge_help_view, null)
contentView.findViewById<TextView>(R.id.tv_content).text =
currGoods?.chargeProdDesc?.replace("\\n", "\n")?.replace("\\r", "\r")
helpPopupWindow =
@@ -177,12 +194,7 @@ class FirstChargeDialog : BaseViewBindingActivity<DialogFirstChargeBinding>() {
}
try {
helpPopupWindow.showAsDropDown(
binding.ivHelp,
0,
0,
Gravity.START or Gravity.BOTTOM
)
helpPopupWindow.showAsDropDown(binding.viewAnchor, 0, 0, Gravity.BOTTOM)
} catch (e: Exception) {
e.printStackTrace()
}

View File

@@ -17,12 +17,11 @@ public class RewardAdapter extends BaseQuickAdapter<FirstChargeReward, BaseViewH
@Override
protected void convert(BaseViewHolder helper, FirstChargeReward item) {
LogUtils.d(item.toString());
ImageLoadUtils.loadRectImage(
ImageLoadUtils.loadImage(
mContext,
item.getShowPir(),
helper.getView(R.id.iv_pic),
R.drawable.default_cover,
ScreenUtil.dip2px(8));
R.drawable.default_cover);
helper.setText(R.id.tv_name, item.getShowText())
.setText(R.id.tv_time, item.getShowTime())
.setGone(R.id.tv_time, !TextUtils.isEmptyText(item.getShowTime()));

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/white" android:state_checked="true" />
<item android:color="@color/white" android:state_selected="true" />
<item android:color="#FF845DFF" />
</selector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 KiB

After

Width:  |  Height:  |  Size: 428 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,13 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:centerColor="#FF5D31B3"
android:endColor="#ff5226ab"
android:startColor="#ff5226ab"
android:type="linear"
android:useLevel="true" />
<solid android:color="#FFFCE9FC"/>
<corners
android:bottomLeftRadius="15dp"
android:bottomRightRadius="15dp"

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffefcdff" />
<corners android:radius="15dp" />
</shape>

View File

@@ -1,10 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FF2D0884" />
<solid android:color="#FFE0B4FF" />
<corners
android:bottomLeftRadius="4dp"
android:bottomRightRadius="4dp"
android:topLeftRadius="4dp"
android:topRightRadius="4dp" />
android:radius="8dp" />
</shape>

View File

@@ -1,28 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
<shape android:shape="rectangle">
<solid android:color="#FF5226AB" />
<corners android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp" android:topLeftRadius="10dp" android:topRightRadius="10dp" />
</shape>
</item>
<item android:drawable="@drawable/bg_first_charge_product" android:state_checked="true" />
<item>
<layer-list>
<item>
<shape android:shape="rectangle">
<size android:height="5dp" />
<solid android:color="@color/transparent" />
</shape>
</item>
<item android:gravity="bottom">
<shape android:shape="rectangle">
<size android:height="30dp" />
<solid android:color="#FF6B3AC5" />
<corners android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp" android:topLeftRadius="10dp" android:topRightRadius="10dp" />
</shape>
</item>
</layer-list>
<shape android:shape="rectangle">
<size android:height="5dp" />
<solid android:color="@color/transparent" />
</shape>
</item>
</selector>

View File

@@ -1,115 +1,145 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center">
<LinearLayout
android:layout_width="290dp"
android:layout_height="439dp"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="21.5dp"
<View
android:id="@+id/view_bg"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@drawable/bg_first_charge"
android:orientation="vertical">
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="750:886"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_help"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_gravity="end"
android:layout_marginTop="100dp"
android:layout_marginEnd="13dp"
android:src="@drawable/ic_first_charge_help" />
</View>
<LinearLayout
android:layout_width="250dp"
android:layout_height="35dp"
<FrameLayout
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="15dp"
android:layout_marginBottom="18dp"
android:background="@drawable/bg_first_charge_list"
app:layout_constraintBottom_toTopOf="@id/tv_charge"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/ll_plan"
app:layout_constraintWidth_percent="0.65">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="8dp"
android:orientation="horizontal">
android:layout_marginTop="27dp"
android:textColor="#FF845DFF"
android:textSize="14sp"
tools:text="充A元额外送abC元礼包" />
<CheckBox
android:id="@+id/rb_plan_a"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_weight="1"
android:background="@drawable/bg_first_charge_selector_rb_plan_a"
android:button="@null"
android:checked="true"
android:gravity="center_horizontal|bottom"
android:includeFontPadding="false"
android:paddingBottom="3dp"
android:textColor="@color/color_selector_c06100_false_white"
android:textSize="22sp"
tools:text="1元" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="57dp" />
<CheckBox
android:id="@+id/rb_plan_b"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_marginStart="1dp"
android:layout_weight="1"
android:background="@drawable/bg_first_charge_selector_rb_plan_a"
android:button="@null"
android:gravity="center_horizontal|bottom"
android:includeFontPadding="false"
android:paddingBottom="3dp"
android:textColor="@color/color_selector_c06100_false_white"
android:textSize="18sp"
tools:text="6元" />
</FrameLayout>
<CheckBox
android:id="@+id/rb_plan_c"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_gravity="end"
android:layout_marginStart="1dp"
android:layout_weight="1"
android:background="@drawable/bg_first_charge_selector_rb_plan_a"
android:button="@null"
android:gravity="center_horizontal|bottom"
android:includeFontPadding="false"
android:paddingBottom="3dp"
android:textColor="@color/color_selector_c06100_false_white"
android:textSize="18sp"
tools:text="188元" />
<LinearLayout
android:id="@+id/ll_plan"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/bg_first_charge_ll_product"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="@id/view_bg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/view_bg"
app:layout_constraintVertical_bias="0.25"
app:layout_constraintWidth_percent="0.65">
</LinearLayout>
<CheckBox
android:id="@+id/rb_plan_a"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/bg_first_charge_selector_rb_plan_a"
android:button="@null"
android:checked="true"
android:gravity="center"
android:includeFontPadding="false"
android:textColor="@color/color_selector_white_false_845dff"
android:textSize="14sp"
tools:text="1元" />
<FrameLayout
android:layout_width="250dp"
android:layout_height="232dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/bg_first_charge_list">
<CheckBox
android:id="@+id/rb_plan_b"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/bg_first_charge_selector_rb_plan_a"
android:button="@null"
android:gravity="center"
android:includeFontPadding="false"
android:textColor="@color/color_selector_white_false_845dff"
android:textSize="14sp"
tools:text="6元" />
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:textColor="#FFFFDB49"
android:textSize="13sp"
tools:text="充A元额外送abC元礼包" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_marginTop="30dp" />
</FrameLayout>
<CheckBox
android:id="@+id/rb_plan_c"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/bg_first_charge_selector_rb_plan_a"
android:button="@null"
android:gravity="center"
android:includeFontPadding="false"
android:textColor="@color/color_selector_white_false_845dff"
android:textSize="14sp"
tools:text="188元" />
</LinearLayout>
<ImageView
android:id="@+id/iv_charge"
android:id="@+id/iv_help"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginBottom="8dp"
android:src="@drawable/ic_first_charge_help"
app:layout_constraintBottom_toTopOf="@id/ll_plan"
app:layout_constraintStart_toStartOf="@id/ll_plan" />
<View
android:id="@+id/view_anchor"
android:layout_width="150dp"
android:layout_height="1px"
app:layout_constraintEnd_toEndOf="@id/iv_help"
app:layout_constraintStart_toStartOf="@id/iv_help"
app:layout_constraintBottom_toBottomOf="@id/iv_help" />
<TextView
android:id="@+id/tv_charge"
android:layout_width="185dp"
android:layout_height="45dp"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginTop="12dp"
android:background="@drawable/bg_first_charge_charge_btn" />
android:layout_marginBottom="13dp"
android:background="@drawable/bg_first_charge_charge_btn"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:text="立即充值"
android:textColor="#ffd67900"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="@id/view_bg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -2,26 +2,29 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="73dp"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp">
android:layout_marginStart="10dp"
android:layout_marginTop="6dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="6dp"
tools:layout_width="80dp">
<View
android:id="@+id/view_bg"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@drawable/bg_first_charge_reward_item"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_pic"
android:layout_width="55dp"
android:layout_height="55dp"
android:scaleType="centerCrop"
android:layout_width="50dp"
android:layout_height="50dp"
android:scaleType="fitCenter"
app:layout_constraintBottom_toBottomOf="@id/view_bg"
app:layout_constraintEnd_toEndOf="@id/view_bg"
app:layout_constraintStart_toStartOf="@id/view_bg"
@@ -56,11 +59,11 @@
android:layout_marginTop="4dp"
android:ellipsize="end"
android:lines="1"
android:text="玫瑰玫瑰"
android:textColor="@color/white"
android:textColor="#FF845DFF"
android:textSize="10sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/view_bg" />
app:layout_constraintTop_toBottomOf="@id/view_bg"
tools:text="玫瑰玫瑰玫瑰玫瑰" />
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 54 KiB