| | |
| | | import org.jetbrains.anko.startActivity |
| | | import org.jetbrains.anko.startActivityForResult |
| | | import org.jetbrains.anko.textColor |
| | | import androidx.core.net.toUri |
| | | |
| | | class MainActivity : TransparentStatusBarActivity() { |
| | | override fun setContentView() = R.layout.activity_main |
| | |
| | | if (version > BuildConfig.VERSION_NAME && mandatory.isNotEmpty()) { |
| | | val tipDialog = TipDialog() |
| | | tipDialog.arguments = bundleOf( |
| | | "title" to "新版本更新", |
| | | "title" to getString(R.string.新版本更新), |
| | | "msg" to content, |
| | | "ok" to "去更新", |
| | | "ok" to getString(R.string.确定), |
| | | "isAlert" to true |
| | | ) |
| | | tipDialog.setCallback(object : TipDialog.OnClickCallback { |
| | | override fun onOk() { |
| | | val intent = Intent() |
| | | intent.action = "android.intent.action.VIEW" |
| | | intent.data = Uri.parse(url) |
| | | intent.data = url.toUri() |
| | | startActivity(intent) |
| | | } |
| | | |