Guest User

Untitled

a guest
Sep 20th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. class GoOnlineActivity : BaseActivity() {
  2.  
  3. override fun onCreate(savedInstanceState: Bundle?) {
  4. super.onCreate(savedInstanceState)
  5. setContentView(R.layout.activity_go_online)
  6.  
  7. btn_go_online.setOnClickListener {
  8. if (!Utils.isShouldExecuteAsapCommand(AsapCommand.UPDATE_DEVICE_INFO)) {
  9. Metrics.event(Metrics.GO_ONLINE)
  10. SessionPool.clear()
  11. LoginScreenActivity.startWithRevealAnimation(this, btn_go_online)
  12.  
  13. } else {
  14. showErrorDialog()
  15. }
  16. }
  17.  
  18. tv_about_flare.setOnClickListener {
  19. OnTripActivity.start(this) // todo
  20. // AboutServiceActivity.start(this@GoOnlineActivity)
  21. }
  22.  
  23. setCompanyLogo()
  24. }
  25.  
  26. private fun showErrorDialog() {
  27. if (!Utils.isConnected(this)) {
  28. CommonDialog.with(this).showOnNoInternetConnection(
  29. { SplashActivity.start(this); finish() },
  30. false)
  31. } else {
  32. CommonDialog.with(this).show(
  33. getString(R.string.no_data),
  34. { SplashActivity.start(this); finish() },
  35. false)
  36. }
  37. }
  38.  
  39. @Subscribe(threadMode = ThreadMode.MAIN)
  40. fun onWarningEvent(event: WarningEvent) {
  41. warning_view.displayWarnings(event.warnings)
  42. }
  43.  
  44. private fun setCompanyLogo() {
  45. flare_logo_subtitle.text = ObjectPool.getCompanyName()
  46. ChatUtils.setChatProfileInfo()
  47. }
  48.  
  49. override fun afterPermissionsOk() {
  50. // not used
  51. }
  52.  
  53. override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
  54. if (keyCode == KeyEvent.KEYCODE_APP_SWITCH && event.repeatCount == 0) {
  55. Timber.i("keycode_app_switch blocked")
  56. }
  57. if (keyCode == KeyEvent.KEYCODE_BACK && event.repeatCount == 0) {
  58. Timber.i("keycode_back blocked")
  59. return false
  60. }
  61. return super.onKeyDown(keyCode, event)
  62. }
  63. }
Add Comment
Please, Sign In to add comment