parent
683457c14f
commit
f321ac0e57
@ -1,31 +1,62 @@
|
||||
package com.example.diarybottleapp.ui.read
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import android.view.animation.Animation
|
||||
import android.view.animation.AnimationUtils
|
||||
import com.example.diarybottleapp.R
|
||||
import com.example.diarybottleapp.base.BaseActivity
|
||||
import com.example.diarybottleapp.util.TimeUtil
|
||||
import kotlinx.android.synthetic.main.activity_read.*
|
||||
|
||||
class ReadActivity : BaseActivity() {
|
||||
|
||||
//底部页面动画
|
||||
private lateinit var bottomAnimIn: Animation
|
||||
private lateinit var bottomAnimOut: Animation
|
||||
|
||||
override fun initTheme() {
|
||||
setContentView(R.layout.activity_read)
|
||||
}
|
||||
|
||||
override fun initEvents() {
|
||||
read_save.setOnClickListener(this)
|
||||
read_delete.setOnClickListener(this)
|
||||
read_back.setOnClickListener(this)
|
||||
read_info_title.requestFocus() //初始时让内容输入框获取焦点
|
||||
|
||||
check_msg.setOnClickListener(this)
|
||||
hide_msg.setOnClickListener(this)
|
||||
}
|
||||
|
||||
override fun onActivityCreated() {
|
||||
|
||||
read_time.text = TimeUtil.getTime()
|
||||
bottomAnimIn = AnimationUtils.loadAnimation(this, R.anim.slide_bottom_in)
|
||||
bottomAnimOut = AnimationUtils.loadAnimation(this, R.anim.slide_bottom_out)
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
when(v?.id) {
|
||||
R.id.read_back -> finish()
|
||||
R.id.check_msg -> {
|
||||
check_msg.visibility = View.GONE
|
||||
read_msg_rl.visibility = View.VISIBLE
|
||||
read_msg_rl.startAnimation(bottomAnimIn)
|
||||
}
|
||||
R.id.hide_msg -> {
|
||||
check_msg.visibility = View.VISIBLE
|
||||
read_msg_rl.visibility = View.GONE
|
||||
read_msg_rl.startAnimation(bottomAnimOut)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inner class ReadBroadCastReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
//接收系统时间变化广播
|
||||
if(intent?.action == Intent.ACTION_TIME_TICK) {
|
||||
read_time.text = TimeUtil.getTime()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:fromYDelta="100%"
|
||||
android:toYDelta="0"
|
||||
android:duration="250"/>
|
||||
</set>
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:fromYDelta="0"
|
||||
android:toYDelta="100%"
|
||||
android:duration="250"/>
|
||||
</set>
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromXDelta="-100%"
|
||||
android:fromYDelta="0"
|
||||
android:toXDelta="0"
|
||||
android:toYDelta="0"
|
||||
android:duration="250"/>
|
||||
</set>
|
||||
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromXDelta="0"
|
||||
android:toXDelta="-100%"
|
||||
android:duration="250"/>
|
||||
</set>
|
||||
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromXDelta="-100%" android:toXDelta="0%"
|
||||
android:fromYDelta="0%" android:toYDelta="0%"
|
||||
android:duration="300"/>
|
||||
</set>
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<translate android:fromXDelta="100%" android:toXDelta="0%"
|
||||
android:fromYDelta="0%" android:toYDelta="0%"
|
||||
android:duration="300"/>
|
||||
</set>
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<translate android:fromXDelta="0%" android:toXDelta="-100%"
|
||||
android:fromYDelta="0%" android:toYDelta="0%"
|
||||
android:duration="300"/>
|
||||
</set>
|
||||
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromXDelta="0%" android:toXDelta="100%"
|
||||
android:fromYDelta="0%" android:toYDelta="0%"
|
||||
android:duration="300"/>
|
||||
</set>
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromXDelta="0"
|
||||
android:fromYDelta="-100%"
|
||||
android:toXDelta="0"
|
||||
android:toYDelta="0"
|
||||
android:duration="250"/>
|
||||
</set>
|
||||
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromYDelta="0"
|
||||
android:toYDelta="-100%"
|
||||
android:duration="250"/>
|
||||
</set>
|
||||
Loading…
Reference in new issue