Skip to content

Commit

Permalink
Internet connection popup now only shows when not connected.
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaK2905 committed Dec 30, 2023
1 parent 7b6f54b commit 59a2fa5
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ class SplashScreenActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_splash_screen)
connectedToInternet = isNetworkAvailable(this.applicationContext)
Log.d("Connected to internet: ", ""+connectedToInternet)
if (!connectedToInternet) {
onPause()
stopActivity()
}

// if user taps animation, increment CountDown latch (to avoid waiting for anim to finish)
Expand Down Expand Up @@ -183,14 +184,15 @@ class SplashScreenActivity : AppCompatActivity() {
}
}

override fun onPause() {
fun stopActivity() {
Log.d("Internet", "not connected.")
val text = "Your device is not connected to the internet. Please try again."
val duration = Toast.LENGTH_LONG

val toast = Toast.makeText(this, text, duration) // in Activity
toast.show()
moveTaskToBack(true)
super.onPause()
//countDownLatch.count()
//super.onPause()
}
}

0 comments on commit 59a2fa5

Please sign in to comment.