1
1
package com.xiasuhuei321.gank_kotlin
2
2
3
+ import android.content.Intent
3
4
import android.os.Bundle
4
5
import android.support.v7.app.AppCompatActivity
5
6
import android.view.Window
6
7
import android.view.WindowManager
8
+ import com.xiasuhuei321.gank_kotlin.customview.weather.WeatherView
9
+ import com.xiasuhuei321.gank_kotlin.extension.LogUtil
7
10
import com.xiasuhuei321.gank_kotlin.extension.shortToast
11
+ import com.xiasuhuei321.weather.TestActivity
8
12
import kotlinx.android.synthetic.main.activity_main.*
9
13
10
14
class MainActivity : AppCompatActivity () {
15
+ lateinit var weatherWv: WeatherView
11
16
override fun onCreate (savedInstanceState : Bundle ? ) {
12
17
super .onCreate(savedInstanceState)
13
18
supportRequestWindowFeature(Window .FEATURE_NO_TITLE )
@@ -18,12 +23,31 @@ class MainActivity : AppCompatActivity() {
18
23
weatherIv.setOnClickListener {
19
24
shortToast(" weather icon be clicked" )
20
25
}
26
+ startActivity(Intent (this , TestActivity ::class .java))
27
+ weatherWv = WeatherView (this )
21
28
}
22
29
23
30
override fun onResume () {
31
+ // weatherWv.setZOrderOnTop(true)
32
+ // weatherWv.setZOrderMediaOverlay(false)
33
+ // weatherWv.canRun = true
34
+ // try {
35
+ // weatherWv.lock.notify()
36
+ // }catch (e: Exception){}
37
+ containerFl.addView(weatherWv)
38
+ LogUtil .i(" onResume" )
24
39
super .onResume()
25
40
}
26
41
42
+ override fun onPause () {
43
+ super .onPause()
44
+ containerFl.removeAllViews()
45
+ // weatherWv.setZOrderOnTop(false)
46
+ // weatherWv.setZOrderMediaOverlay(true)
47
+ // weatherWv.canRun = false
48
+ // LogUtil.i("onPause")
49
+ }
50
+
27
51
override fun onDestroy () {
28
52
super .onDestroy()
29
53
weatherWv.onDestroy()
0 commit comments