Commit 6144cdc1 authored by jyx's avatar jyx

代码优化

parent 98d483b2
...@@ -22,6 +22,7 @@ class MusicPresenter : BasePresenter<MusicView>() { ...@@ -22,6 +22,7 @@ class MusicPresenter : BasePresenter<MusicView>() {
override fun onError(e: Throwable) { override fun onError(e: Throwable) {
if (isLinkView) return if (isLinkView) return
view.showToast(e.message) view.showToast(e.message)
view.rdSongMsgFail()
} }
override fun onNext(baseResponse: BaseResponse<MusicBean>) { override fun onNext(baseResponse: BaseResponse<MusicBean>) {
...@@ -35,6 +36,7 @@ class MusicPresenter : BasePresenter<MusicView>() { ...@@ -35,6 +36,7 @@ class MusicPresenter : BasePresenter<MusicView>() {
view.rdSongMsgSuc(baseResponse.data) view.rdSongMsgSuc(baseResponse.data)
} }
else -> { else -> {
view.rdSongMsgFail()
view.showToast(message) view.showToast(message)
} }
} }
...@@ -43,8 +45,9 @@ class MusicPresenter : BasePresenter<MusicView>() { ...@@ -43,8 +45,9 @@ class MusicPresenter : BasePresenter<MusicView>() {
} }
// 添加金币 // 添加金币
fun reportAddCoinMsg(carrierType: String) { fun reportAddCoinMsg(carrierType: String, ecpmId: String = "") {
val vo = HashMap<String, Any>() val vo = HashMap<String, Any>()
vo["ecpmId"] = ecpmId
vo["carrierType"] = carrierType vo["carrierType"] = carrierType
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.reportAddCoinMsg(vo), .call(loanService.reportAddCoinMsg(vo),
......
...@@ -4,5 +4,6 @@ import com.duben.dayplaylet.mvp.model.MusicBean ...@@ -4,5 +4,6 @@ import com.duben.dayplaylet.mvp.model.MusicBean
interface MusicView : BaseView { interface MusicView : BaseView {
fun rdSongMsgSuc(data: MusicBean) fun rdSongMsgSuc(data: MusicBean)
fun rdSongMsgFail()
fun reportAddCoinMsgSuc() fun reportAddCoinMsgSuc()
} }
\ No newline at end of file
...@@ -217,7 +217,7 @@ public interface LoanService { ...@@ -217,7 +217,7 @@ public interface LoanService {
* *
* @return * @return
*/ */
@POST("api/reportAddCoinMsg") @POST("api/reward/reportAddCoinMsg")
Observable<BaseResponse<JsonObject>> reportAddCoinMsg(@Body Map<String, Object> vo); Observable<BaseResponse<JsonObject>> reportAddCoinMsg(@Body Map<String, Object> vo);
/** /**
......
...@@ -281,7 +281,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR ...@@ -281,7 +281,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
// 弹出新人红包 // 弹出新人红包
if (!isShowNewuserFlag) { if (!isShowNewuserFlag) {
isShowNewuserFlag = true isShowNewuserFlag = true
showNewcomerDialog(data.userMsg.rewardCoin) // showNewcomerDialog(data.userMsg.rewardCoin)
} }
} }
......
...@@ -38,9 +38,10 @@ import com.duben.dayplaylet.mvp.views.MusicView ...@@ -38,9 +38,10 @@ import com.duben.dayplaylet.mvp.views.MusicView
import com.duben.dayplaylet.ui.fragment.base.LazyLoadBaseFragment import com.duben.dayplaylet.ui.fragment.base.LazyLoadBaseFragment
import com.duben.dayplaylet.ui.widgets.countdowntimer.CountDownTimerSupport import com.duben.dayplaylet.ui.widgets.countdowntimer.CountDownTimerSupport
import com.duben.dayplaylet.ui.widgets.countdowntimer.OnCountDownTimerListener import com.duben.dayplaylet.ui.widgets.countdowntimer.OnCountDownTimerListener
import com.duben.dayplaylet.utils.BubbleUtils
import com.duben.dayplaylet.utils.LogUtil import com.duben.dayplaylet.utils.LogUtil
import com.duben.dayplaylet.utils.SpanUtils
import kotlinx.android.synthetic.main.fragment_music.* import kotlinx.android.synthetic.main.fragment_music.*
import kotlinx.android.synthetic.main.layout_draw_header.*
/** /**
* 猜歌 * 猜歌
...@@ -51,12 +52,14 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView { ...@@ -51,12 +52,14 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView {
private val musicPresenter by lazy { MusicPresenter() } private val musicPresenter by lazy { MusicPresenter() }
private var mIsFirstInit = false
private var mIDPWidget: IDPWidget? = null private var mIDPWidget: IDPWidget? = null
private var mDrawFragment: Fragment? = null private var mDrawFragment: Fragment? = null
private val mainHandler = Handler(Looper.getMainLooper()) private val mainHandler = Handler(Looper.getMainLooper())
private var mMusicBean: MusicBean? = null private var mMusicBean: MusicBean? = null
private var mTimer: CountDownTimerSupport? = null
private var rope: YoYoString? = null
private var mPos = 0 private var mPos = 0
...@@ -64,18 +67,14 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView { ...@@ -64,18 +67,14 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView {
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
musicPresenter.attachView(this) musicPresenter.attachView(this)
rl_open_cash.setOnClickListener {
showRewardAnim(10, 10)
}
} }
override fun onFragmentFirstVisible() { override fun onFragmentFirstVisible() {
if (DPSdk.isStartSuccess()) {
//初始化draw组件
initDrawWidget()
mDrawFragment = mIDPWidget?.fragment
supportFragmentManager.beginTransaction()
.replace(R.id.draw_style1_frame, mDrawFragment!!)
.commitAllowingStateLoss()
}
} }
override fun onFragmentResume() { override fun onFragmentResume() {
...@@ -106,6 +105,19 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView { ...@@ -106,6 +105,19 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView {
// dpWidget?.fragment?.userVisibleHint = isVisibleToUser // dpWidget?.fragment?.userVisibleHint = isVisibleToUser
} }
private fun firstDrawWidget() {
if (DPSdk.isStartSuccess()) {
mIsFirstInit = true
//初始化draw组件
initDrawWidget()
mDrawFragment = mIDPWidget?.fragment
supportFragmentManager.beginTransaction()
.replace(R.id.draw_style1_frame, mDrawFragment!!)
.commitAllowingStateLoss()
}
}
private fun initDrawWidget() { private fun initDrawWidget() {
mIDPWidget = mIDPWidget =
DPHolder.getInstance() DPHolder.getInstance()
...@@ -159,6 +171,8 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView { ...@@ -159,6 +171,8 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView {
val quizTvPop = view.findViewById<TextView>(R.id.quiz_tv_pop) val quizTvPop = view.findViewById<TextView>(R.id.quiz_tv_pop)
val finger = view.findViewById<LottieAnimationView>(R.id.finger_view) val finger = view.findViewById<LottieAnimationView>(R.id.finger_view)
val rlOption0 = view.findViewById<RelativeLayout>(R.id.rl_option0)
val rlOption1 = view.findViewById<RelativeLayout>(R.id.rl_option1)
val quizIvRedbox0 = view.findViewById<ImageView>(R.id.quiz_iv_redbox0) val quizIvRedbox0 = view.findViewById<ImageView>(R.id.quiz_iv_redbox0)
val quizIvRedbox1 = view.findViewById<ImageView>(R.id.quiz_iv_redbox1) val quizIvRedbox1 = view.findViewById<ImageView>(R.id.quiz_iv_redbox1)
val quizIvOption0 = view.findViewById<ImageView>(R.id.quiz_iv_option0) val quizIvOption0 = view.findViewById<ImageView>(R.id.quiz_iv_option0)
...@@ -166,9 +180,9 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView { ...@@ -166,9 +180,9 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView {
val quizIv = view.findViewById<ImageView>(R.id.quiz_iv) val quizIv = view.findViewById<ImageView>(R.id.quiz_iv)
val option0 = view.findViewById<TextView>(R.id.quiz_option0) val option0 = view.findViewById<TextView>(R.id.quiz_option0)
val option1 = view.findViewById<TextView>(R.id.quiz_option1) val option1 = view.findViewById<TextView>(R.id.quiz_option1)
val optionsList: MutableList<TextView> = ArrayList() val optionsList: MutableList<RelativeLayout> = ArrayList()
optionsList.add(option0) optionsList.add(rlOption0)
optionsList.add(option1) optionsList.add(rlOption1)
quizIvOption0.visibility = View.GONE quizIvOption0.visibility = View.GONE
quizIvOption1.visibility = View.GONE quizIvOption1.visibility = View.GONE
quizIvRedbox0.visibility = View.GONE quizIvRedbox0.visibility = View.GONE
...@@ -178,14 +192,20 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView { ...@@ -178,14 +192,20 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView {
finger.visibility = View.GONE finger.visibility = View.GONE
mainHandler.postDelayed({ mainHandler.postDelayed({
// 点击过后不展示
if (!rlOption0.isClickable) return@postDelayed
val ls = finger.layoutParams as RelativeLayout.LayoutParams val ls = finger.layoutParams as RelativeLayout.LayoutParams
val ls2 = quizLLPop.layoutParams as RelativeLayout.LayoutParams
if (answer == 0) { if (answer == 0) {
ls.addRule(RelativeLayout.ALIGN_TOP, R.id.fl_option0) ls.addRule(RelativeLayout.ALIGN_TOP, R.id.rl_option0)
ls2.addRule(RelativeLayout.ALIGN_TOP, R.id.rl_option0)
} else { } else {
ls.addRule(RelativeLayout.ALIGN_TOP, R.id.fl_option1) ls.addRule(RelativeLayout.ALIGN_TOP, R.id.rl_option1)
ls2.addRule(RelativeLayout.ALIGN_TOP, R.id.rl_option1)
} }
playFingerAnim(finger) playFingerAnim(finger)
}, 3000) }, 5000)
for (i in optionsList.indices) { for (i in optionsList.indices) {
val right = answer == i val right = answer == i
...@@ -208,10 +228,17 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView { ...@@ -208,10 +228,17 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView {
background2 = R.drawable.icon_quiz_error background2 = R.drawable.icon_quiz_error
} }
val button = optionsList[i] val button = optionsList[i]
button.text = options[i] if (i == 0) {
button.setBackgroundResource(R.drawable.icon_quiz_button_bg) option0.text = options[i]
} else {
option1.text = options[i]
}
button.setOnClickListener { button.setOnClickListener {
quizIvRedbox0.visibility = View.GONE
quizIvRedbox1.visibility = View.GONE
finger.visibility = View.GONE finger.visibility = View.GONE
rlOption0.isClickable = false
rlOption1.isClickable = false
if (lastAnswer != -1) return@setOnClickListener if (lastAnswer != -1) return@setOnClickListener
...@@ -221,9 +248,6 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView { ...@@ -221,9 +248,6 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView {
} else { } else {
quizIv.setBackgroundResource(R.drawable.icon_quiz_error_toast_bg) quizIv.setBackgroundResource(R.drawable.icon_quiz_error_toast_bg)
} }
for (btn in optionsList) {
btn.setBackgroundResource(R.drawable.icon_quiz_button_bg)
}
if (i == 0) { if (i == 0) {
// 答案1 // 答案1
quizIvOption0.visibility = View.VISIBLE quizIvOption0.visibility = View.VISIBLE
...@@ -234,6 +258,7 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView { ...@@ -234,6 +258,7 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView {
quizIvOption1.setBackgroundResource(background2) quizIvOption1.setBackgroundResource(background2)
} }
button.setBackgroundResource(background) button.setBackgroundResource(background)
quizHandler.reportResult(i) quizHandler.reportResult(i)
mMusicBean?.let { mMusicBean?.let {
...@@ -256,6 +281,8 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView { ...@@ -256,6 +281,8 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView {
} }
if (lastAnswer == i) { if (lastAnswer == i) {
rlOption0.isClickable = false
rlOption1.isClickable = false
if (lastAnswer == 0) { if (lastAnswer == 0) {
quizIvOption0.visibility = View.VISIBLE quizIvOption0.visibility = View.VISIBLE
quizIvOption0.setBackgroundResource(background2) quizIvOption0.setBackgroundResource(background2)
...@@ -407,11 +434,92 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView { ...@@ -407,11 +434,92 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView {
) )
} }
//计算path路径中点的坐标
private var mPathMeasure: PathMeasure? = null
override fun rdSongMsgSuc(data: MusicBean) { override fun rdSongMsgSuc(data: MusicBean) {
if (!mIsFirstInit) {
firstDrawWidget()
}
mMusicBean = data mMusicBean = data
mMusicBean?.let {
if (it.openCash) {
rl_open_cash.visibility = View.VISIBLE
tv_open_cash_progress.text =
String.format("%2d/%2d", it.completeCount, it.turnNeedCount)
pb_open_cash.max = it.turnNeedCount
pb_open_cash.progress = it.completeCount
if (it.completeCount >= it.turnNeedCount) {
tv_open_cash_info.visibility = View.GONE
} else {
tv_open_cash_info.visibility = View.VISIBLE
tv_open_cash_info.text = SpanUtils()
.append("再答")
.append("" + (it.turnNeedCount - it.completeCount))
.setForegroundColor(ContextCompat.getColor(mContext, R.color.red))
.append("题立即提现")
.create()
}
} else {
rl_open_cash.visibility = View.GONE
}
}
}
override fun rdSongMsgFail() {
rl_open_cash.visibility = View.GONE
if (!mIsFirstInit) {
firstDrawWidget()
}
}
private fun showRewardAnim(cashReward: Int, goldReward: Int) {
if (cashReward <= 0 && goldReward <= 0) return
cl_reward.visibility = View.VISIBLE
iv_cash_reward.visibility = View.VISIBLE
tv_cash_reward.visibility = View.VISIBLE
iv_gold_reward.visibility = View.VISIBLE
tv_gold_reward.visibility = View.VISIBLE
if (cashReward <= 0) {
iv_cash_reward.visibility = View.GONE
tv_cash_reward.visibility = View.GONE
} else {
tv_cash_reward.text = "+$cashReward"
mainHandler.postDelayed({
addAnimation(iv_cash_reward, iv_cash)
mainHandler.postDelayed({
addAnimation(iv_cash_reward, iv_cash)
}, 200)
mainHandler.postDelayed({
addAnimation(iv_cash_reward, iv_cash)
}, 400)
mainHandler.postDelayed({
addAnimation(iv_cash_reward, iv_cash)
}, 800)
}, 100)
}
if (goldReward <= 0) {
iv_gold_reward.visibility = View.GONE
tv_gold_reward.visibility = View.GONE
} else {
tv_gold_reward.text = "+$goldReward"
mainHandler.postDelayed({
addAnimation(iv_gold_reward, iv_gold)
mainHandler.postDelayed({
addAnimation(iv_gold_reward, iv_gold)
}, 200)
mainHandler.postDelayed({
addAnimation(iv_gold_reward, iv_gold)
}, 400)
mainHandler.postDelayed({
addAnimation(iv_gold_reward, iv_gold)
}, 800)
}, 100)
}
mainHandler.postDelayed({
cl_reward.visibility = View.GONE
}, 1500)
} }
override fun reportAddCoinMsgSuc() { override fun reportAddCoinMsgSuc() {
...@@ -439,25 +547,17 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView { ...@@ -439,25 +547,17 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView {
} }
override fun adClose(vo: HashMap<String, Any>?) { override fun adClose(vo: HashMap<String, Any>?) {
musicPresenter.reportAddCoinMsg(carrierType) musicPresenter.reportAddCoinMsg(carrierType, AppConfig.gromoreId)
} }
}) })
} }
override fun adClose(vo: HashMap<String, Any>?) { override fun adClose(vo: HashMap<String, Any>?) {
musicPresenter.reportAddCoinMsg(carrierType) musicPresenter.reportAddCoinMsg(carrierType, AppConfig.gromoreId)
} }
}) })
} }
private fun showAddReward() {
}
private var mTimer: CountDownTimerSupport? = null
private var rope: YoYoString? = null
private fun showAdPop( private fun showAdPop(
quizLLPop: LinearLayout, quizLLPop: LinearLayout,
quizTvPop: TextView, quizTvPop: TextView,
...@@ -517,23 +617,34 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView { ...@@ -517,23 +617,34 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView {
view.setImageDrawable(lottieDrawable) view.setImageDrawable(lottieDrawable)
} }
/**
* 贝塞尔曲线中间过程的点的坐标
*/
private val mCurrentPosition = FloatArray(2)
/** /**
* 动画 * 动画
*/ */
private fun addAnimation(view: View, targetView: View) { private fun addAnimation(view: ImageView, targetView: View) {
/**
* 贝塞尔曲线中间过程的点的坐标
*/
val mCurrentPosition = FloatArray(2)
// 一、创造出执行动画的主题---imageview // 一、创造出执行动画的主题---imageview
//代码new一个imageview,图片资源是上面的imageview的图片 //代码new一个imageview,图片资源是上面的imageview的图片
// (这个图片就是执行动画的图片,从开始位置出发,经过一个抛物线(贝塞尔曲线),移动到购物车里) // (这个图片就是执行动画的图片,从开始位置出发,经过一个抛物线(贝塞尔曲线),移动到购物车里)
val goods = ImageView(mContext) val goods = ImageView(requireContext())
goods.setImageDrawable(ContextCompat.getDrawable(mContext, R.mipmap.ic_launcher_main)) goods.setImageDrawable(view.drawable)
val params = RelativeLayout.LayoutParams(BubbleUtils.dp2px(30), BubbleUtils.dp2px(30)) val params = RelativeLayout.LayoutParams(view.width, view.height)
rl.addView(goods, params) rl.addView(goods, params)
val offsetWidth = if (view.width >= targetView.width) {
view.width - targetView.width
} else {
targetView.width - view.width
}
// val offsetHeight = if (view.height >= targetView.height) {
// view.height - targetView.height
// } else {
// targetView.height - view.height
// }
// 二、计算动画开始/结束点的坐标的准备工作 // 二、计算动画开始/结束点的坐标的准备工作
//得到父布局的起始点坐标(用于辅助计算动画开始/结束时的点的坐标) //得到父布局的起始点坐标(用于辅助计算动画开始/结束时的点的坐标)
val parentLocation = IntArray(2) val parentLocation = IntArray(2)
...@@ -570,10 +681,11 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView { ...@@ -570,10 +681,11 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView {
path.quadTo((startX + toX) / 2, startY, toX, toY) path.quadTo((startX + toX) / 2, startY, toX, toY)
//mPathMeasure用来计算贝塞尔曲线的曲线长度和贝塞尔曲线中间插值的坐标, //mPathMeasure用来计算贝塞尔曲线的曲线长度和贝塞尔曲线中间插值的坐标,
// 如果是true,path会形成一个闭环,Path用来计算path路径中的点的坐标 // 如果是true,path会形成一个闭环,Path用来计算path路径中的点的坐标
mPathMeasure = PathMeasure(path, false) //计算path路径中点的坐标
val mPathMeasure = PathMeasure(path, false)
//★★★属性动画实现(从0到贝塞尔曲线的长度之间进行插值计算,获取中间过程的距离值) //★★★属性动画实现(从0到贝塞尔曲线的长度之间进行插值计算,获取中间过程的距离值)
val valueAnimator = ValueAnimator.ofFloat(0f, mPathMeasure!!.length) val valueAnimator = ValueAnimator.ofFloat(0f, mPathMeasure.length)
valueAnimator.duration = 500 valueAnimator.duration = 500
// 匀速线性插值器 // 匀速线性插值器
valueAnimator.interpolator = LinearInterpolator() valueAnimator.interpolator = LinearInterpolator()
...@@ -584,14 +696,26 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView { ...@@ -584,14 +696,26 @@ class MusicFragment : LazyLoadBaseFragment(), MusicView {
// boolean getPosTan(float distance, float[] pos, float[] tan) : // boolean getPosTan(float distance, float[] pos, float[] tan) :
// 传入一个距离distance(0<=distance<=getLength()),然后会计算当前距 // 传入一个距离distance(0<=distance<=getLength()),然后会计算当前距
// 离的坐标点和切线,pos会自动填充上坐标,这个方法很重要。 // 离的坐标点和切线,pos会自动填充上坐标,这个方法很重要。
mPathMeasure!!.getPosTan( mPathMeasure.getPosTan(value, mCurrentPosition, null) //mCurrentPosition此时就是中间距离点的坐标值
value,
mCurrentPosition,
null
) //mCurrentPosition此时就是中间距离点的坐标值
// 移动的商品图片(动画图片)的坐标设置为该中间点的坐标 // 移动的商品图片(动画图片)的坐标设置为该中间点的坐标
goods.translationX = mCurrentPosition[0] goods.translationX = mCurrentPosition[0]
goods.translationY = mCurrentPosition[1] goods.translationY = mCurrentPosition[1]
val transWidth = if (view.width > targetView.width) {
(targetView.width + (offsetWidth * ((mPathMeasure.length - value) / mPathMeasure.length))).toInt()
} else {
(targetView.width - (offsetWidth * ((mPathMeasure.length - value) / mPathMeasure.length))).toInt()
}
// val transHeight = if (view.height > targetView.height) {
// (targetView.height + (offsetHeight * ((mPathMeasure.length - value) / mPathMeasure.length))).toInt()
// } else {
// (targetView.height - (offsetHeight * ((mPathMeasure.length - value) / mPathMeasure.length))).toInt()
// }
val ls = goods.layoutParams
ls.width = transWidth
ls.height = transWidth
goods.layoutParams = ls
} }
// 五、 开始执行动画 // 五、 开始执行动画
valueAnimator.start() valueAnimator.start()
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rl" android:id="@+id/rl"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
...@@ -11,4 +12,128 @@ ...@@ -11,4 +12,128 @@
<include layout="@layout/layout_draw_header" /> <include layout="@layout/layout_draw_header" />
<RelativeLayout
android:id="@+id/rl_open_cash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="160dp"
android:layout_marginEnd="20dp">
<ImageView
android:id="@+id/iv_open_cash"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:src="@mipmap/pic_dttx" />
<ProgressBar
android:id="@+id/pb_open_cash"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="52dp"
android:layout_height="14dp"
android:layout_alignBottom="@id/iv_open_cash"
android:layout_centerHorizontal="true"
android:layout_marginBottom="22dp"
android:progressDrawable="@drawable/progressbar_versus_changevedio_bg" />
<TextView
android:id="@+id/tv_open_cash_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/iv_open_cash"
android:layout_centerHorizontal="true"
android:layout_marginBottom="21dp"
android:text="3/5"
android:textColor="@color/red"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_open_cash_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/iv_open_cash"
android:layout_centerHorizontal="true"
android:background="@drawable/shape_bg_write"
android:paddingStart="6dp"
android:paddingTop="2dp"
android:paddingEnd="6dp"
android:paddingBottom="2dp"
android:text="@string/app_name"
android:textSize="12sp" />
</RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_reward"
android:layout_width="match_parent"
android:layout_height="260dp"
android:layout_centerInParent="true"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
android:background="@drawable/shape_half_trans"
android:visibility="gone">
<TextView
android:id="@+id/tv_reward"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:drawablePadding="15dp"
android:text="恭喜获得"
android:textColor="@color/white"
android:textSize="22sp"
app:drawableEndCompat="@mipmap/vs_icon_anim_star"
app:drawableStartCompat="@mipmap/vs_icon_anim_star"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_cash_reward"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="20dp"
android:src="@mipmap/ic_redpkg"
app:layout_constraintEnd_toStartOf="@id/iv_gold_reward"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_reward" />
<ImageView
android:id="@+id/iv_gold_reward"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginStart="20dp"
android:layout_marginTop="40dp"
android:src="@mipmap/ic_yuanbao"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/iv_cash_reward"
app:layout_constraintTop_toBottomOf="@id/tv_reward" />
<TextView
android:id="@+id/tv_cash_reward"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="+5"
android:textColor="@color/red"
android:textSize="30sp"
app:layout_constraintEnd_toEndOf="@id/iv_cash_reward"
app:layout_constraintStart_toStartOf="@id/iv_cash_reward"
app:layout_constraintTop_toBottomOf="@id/iv_cash_reward" />
<TextView
android:id="@+id/tv_gold_reward"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="+5"
android:textColor="@color/red"
android:textSize="30sp"
app:layout_constraintEnd_toEndOf="@id/iv_gold_reward"
app:layout_constraintStart_toStartOf="@id/iv_gold_reward"
app:layout_constraintTop_toBottomOf="@id/iv_gold_reward" />
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
...@@ -10,39 +10,40 @@ ...@@ -10,39 +10,40 @@
android:id="@+id/quiz_iv" android:id="@+id/quiz_iv"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true" /> android:layout_centerInParent="true"
android:layout_marginBottom="10dp" />
<TextView <TextView
android:id="@+id/quiz_tv_qus" android:id="@+id/quiz_tv_qus"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_above="@id/fl_option0" android:layout_above="@id/rl_option0"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginStart="48dp" android:layout_marginStart="48dp"
android:layout_marginEnd="48dp" android:layout_marginEnd="48dp"
android:layout_marginBottom="80dp" android:layout_marginBottom="70dp"
android:background="@drawable/shape_mild_trans" android:background="@drawable/shape_mild_trans"
android:gravity="center" android:gravity="center"
android:padding="@dimen/dp_10" android:padding="@dimen/dp_10"
android:text="背景音乐是什么歌 _ _ _ _ ?" android:text="背景音乐是什么歌 _ _ _ _ ?"
android:textColor="@color/white" /> android:textColor="@color/white" />
<FrameLayout <RelativeLayout
android:id="@+id/fl_option0" android:id="@+id/rl_option0"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_above="@id/fl_option1" android:layout_above="@id/rl_option1"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginStart="48dp" android:layout_marginStart="48dp"
android:layout_marginEnd="48dp" android:layout_marginEnd="48dp"
android:layout_marginBottom="20dp"> android:layout_marginBottom="20dp"
android:background="@drawable/icon_quiz_button_bg">
<TextView <TextView
android:id="@+id/quiz_option0" android:id="@+id/quiz_option0"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/icon_quiz_button_bg" android:layout_centerInParent="true"
android:gravity="center"
android:paddingBottom="5dp" android:paddingBottom="5dp"
android:textColor="@color/main_mints" android:textColor="@color/main_mints"
android:textStyle="bold" android:textStyle="bold"
...@@ -52,8 +53,8 @@ ...@@ -52,8 +53,8 @@
android:id="@+id/quiz_iv_redbox0" android:id="@+id/quiz_iv_redbox0"
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_gravity="center_vertical" android:layout_centerVertical="true"
android:layout_marginStart="50dp" android:layout_toStartOf="@id/quiz_option0"
android:paddingBottom="5dp" android:paddingBottom="5dp"
android:src="@mipmap/ic_redpkg" android:src="@mipmap/ic_redpkg"
android:visibility="gone" /> android:visibility="gone" />
...@@ -62,29 +63,30 @@ ...@@ -62,29 +63,30 @@
android:id="@+id/quiz_iv_option0" android:id="@+id/quiz_iv_option0"
android:layout_width="26dp" android:layout_width="26dp"
android:layout_height="26dp" android:layout_height="26dp"
android:layout_gravity="end|center_vertical" android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp" android:layout_marginEnd="20dp"
android:paddingBottom="5dp" android:paddingBottom="5dp"
android:visibility="gone" /> android:visibility="gone" />
</FrameLayout> </RelativeLayout>
<FrameLayout <RelativeLayout
android:id="@+id/fl_option1" android:id="@+id/rl_option1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginStart="48dp" android:layout_marginStart="48dp"
android:layout_marginEnd="48dp" android:layout_marginEnd="48dp"
android:layout_marginBottom="50dp"> android:layout_marginBottom="50dp"
android:background="@drawable/icon_quiz_button_bg">
<TextView <TextView
android:id="@+id/quiz_option1" android:id="@+id/quiz_option1"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/icon_quiz_button_bg" android:layout_centerInParent="true"
android:gravity="center"
android:paddingBottom="5dp" android:paddingBottom="5dp"
android:textColor="@color/main_mints" android:textColor="@color/main_mints"
android:textStyle="bold" android:textStyle="bold"
...@@ -94,8 +96,8 @@ ...@@ -94,8 +96,8 @@
android:id="@+id/quiz_iv_redbox1" android:id="@+id/quiz_iv_redbox1"
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_gravity="center_vertical" android:layout_centerVertical="true"
android:layout_marginStart="50dp" android:layout_toStartOf="@id/quiz_option1"
android:paddingBottom="5dp" android:paddingBottom="5dp"
android:src="@mipmap/ic_redpkg" android:src="@mipmap/ic_redpkg"
android:visibility="gone" /> android:visibility="gone" />
...@@ -104,12 +106,13 @@ ...@@ -104,12 +106,13 @@
android:id="@+id/quiz_iv_option1" android:id="@+id/quiz_iv_option1"
android:layout_width="26dp" android:layout_width="26dp"
android:layout_height="26dp" android:layout_height="26dp"
android:layout_gravity="end|center_vertical" android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp" android:layout_marginEnd="20dp"
android:paddingBottom="5dp" android:paddingBottom="5dp"
android:visibility="gone" /> android:visibility="gone" />
</FrameLayout> </RelativeLayout>
<TextView <TextView
android:id="@+id/quiz_tv_pop" android:id="@+id/quiz_tv_pop"
...@@ -136,7 +139,7 @@ ...@@ -136,7 +139,7 @@
android:id="@+id/quiz_ll_pop" android:id="@+id/quiz_ll_pop"
android:layout_width="128dp" android:layout_width="128dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@id/fl_option0" android:layout_alignTop="@id/rl_option0"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginTop="-30dp" android:layout_marginTop="-30dp"
android:layout_marginEnd="30dp" android:layout_marginEnd="30dp"
...@@ -171,7 +174,7 @@ ...@@ -171,7 +174,7 @@
android:id="@+id/finger_view" android:id="@+id/finger_view"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_alignTop="@id/fl_option1" android:layout_alignTop="@id/rl_option1"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginTop="26dp" android:layout_marginTop="26dp"
android:layout_marginEnd="48dp" /> android:layout_marginEnd="48dp" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment