package com.tjhello.demo.adeasy import android.content.Intent import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import com.tjhello.adeasy.ADEasy import com.tjhello.adeasy.imp.ADEasyActivityImp /** * 作者:天镜baobao * 时间:2019/11/30 19:02 * 说明:允许使用,但请遵循Apache License 2.0 * 使用: * Copyright 2019/11/30 天镜baobao * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ abstract class AppActivity : AppCompatActivity(), ADEasyActivityImp { protected val adEasy by lazy { ADEasy.getInstance(this,this) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) adEasy.isAutoShowInterstitial(true) onInitValue(savedInstanceState) onInitView() adEasy.onCreate() onLoadData() } override fun onStart() { super.onStart() } override fun onPause() { super.onPause() adEasy.onPause() } override fun onResume() { super.onResume() adEasy.onResume() } override fun onStop() { super.onStop() } override fun onDestroy() { super.onDestroy() adEasy.onDestroy() } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) adEasy.onActivityResult(requestCode,resultCode,data) } override fun onRequestPermissionsResult( requestCode: Int, permissions: Array, grantResults: IntArray ) { super.onRequestPermissionsResult(requestCode, permissions, grantResults) adEasy.onRequestPermissionsResult(requestCode,permissions,grantResults) } protected abstract fun onInitValue(savedInstanceState: Bundle?) protected abstract fun onInitView() protected abstract fun onLoadData() override fun isActivityFinish(): Boolean { return isFinishing } }