Commit c747f5d9 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 4c38e199
...@@ -43,6 +43,8 @@ class AlipayTimeActivity : BaseActivity(), View.OnClickListener { ...@@ -43,6 +43,8 @@ class AlipayTimeActivity : BaseActivity(), View.OnClickListener {
} }
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
ivBack.setOnClickListener(this)
countDownTimer = SimpleCountDownTimer(alipaytime.toLong() * 1000, tv_alipaytime).setOnFinishListener { countDownTimer = SimpleCountDownTimer(alipaytime.toLong() * 1000, tv_alipaytime).setOnFinishListener {
finish() finish()
}.start() as SimpleCountDownTimer? }.start() as SimpleCountDownTimer?
...@@ -58,20 +60,20 @@ class AlipayTimeActivity : BaseActivity(), View.OnClickListener { ...@@ -58,20 +60,20 @@ class AlipayTimeActivity : BaseActivity(), View.OnClickListener {
countDownTimer?.cancel() countDownTimer?.cancel()
} }
// override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
// return if (keyCode == KeyEvent.KEYCODE_BACK) { return if (keyCode == KeyEvent.KEYCODE_BACK) {
// true true
// } else super.onKeyDown(keyCode, event) } else super.onKeyDown(keyCode, event)
// } }
override fun onClick(v: View) { override fun onClick(v: View) {
if (AntiShake.check(v.id)) return if (AntiShake.check(v.id)) return
// when (v.id) { when (v.id) {
// R.id.ivAwardBack -> { R.id.ivBack -> {
// finish() finish()
// } }
// } }
} }
private fun playCollectAnim(view: LottieAnimationView) { private fun playCollectAnim(view: LottieAnimationView) {
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView 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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
...@@ -10,20 +11,31 @@ ...@@ -10,20 +11,31 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<ImageView
android:id="@+id/ivBack"
android:src="@mipmap/ic_quit_white"
android:layout_width="30dp"
android:layout_marginTop="50dp"
android:layout_gravity="right"
android:layout_marginRight="30dp"
android:layout_height="30dp"></ImageView>
<com.airbnb.lottie.LottieAnimationView <com.airbnb.lottie.LottieAnimationView
android:id="@+id/zan_iv" android:layout_width="325dp"
android:layout_width="35dp" android:layout_height="325dp"
android:layout_height="35dp" android:layout_marginTop="30dp"
android:layout_marginTop="10dp" android:layout_gravity="center_horizontal"
android:src="@mipmap/home_collect_img_0" /> app:lottie_autoPlay="true"
app:lottie_fileName="alipay_act.json"
app:lottie_loop="true" />
<TextView <TextView
android:id="@+id/tv_alipaytime" android:id="@+id/tv_alipaytime"
android:textSize="40sp"
android:layout_gravity="center"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/red"></TextView> android:layout_gravity="center"
android:textColor="@color/red"
android:textSize="40sp"></TextView>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
\ No newline at end of file
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