Version 2 of Oops! No Internet! library released!

Photo by brandon siu on Unsplash

A short introduction… 🚀

Dialogs

As the entire library has been restructured, we’ve changed NoInternetDialog to NoInternetDialogPendulum . We’ve created a brand new dialog called NoInternetDialogSignal . Both are dark-mode ready 😃.

Preview of NoInternetDialogPendulum
Preview of NoInternetDialogSignal

Snackbar

We’ve added a new snackbar named NoInternetSnackbarFire .

Preview of NoInternetSnackbarFire

Lifecycle-Aware Component

We’ve created NoInternetObserveComponent , which is a lifecycle-aware component. It can be used to create any custom no internet alert component like dialog, snackbar, etc. with ease. So, the components will show-hide automatically and will be created and destroy based on the application lifecycle.

We are now using the Maven repository for our library 😎 Yeaaa…

No extra repository is required for using the library! We hosted our library at the Maven repository. So you can use the library just by adding the library as a dependency.

How to use… 🤨

As we are now using a lifecycle-aware component, the usage of the library is super ⚡ simple.

android {

// ...

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

}

dependencies {
// ...

// Material Components for Android. Replace the version with the latest version of Material Components library.
implementation 'com.google.android.material:material:x.x.x'

implementation 'org.imaginativeworld.oopsnointernet:oopsnointernet:x.x.x'
}
  • 1. Your application has to use AndroidX to use this library.
  • 2. You have to use *.MaterialComponents.* in your styles.
// Kotlin
class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

// ...

// No Internet Dialog: Pendulum
NoInternetDialogPendulum.Builder(
this,
lifecycle
).build()


// No Internet Dialog: Signal
NoInternetDialogSignal.Builder(
this,
lifecycle
).build()


// No Internet Snackbar: Fire
NoInternetSnackbarFire.Builder(
binding.mainContainer,
lifecycle
).build()

}
}

What next… 🤔

Use it… Clone it… Fork it… Check out the library source-code… Give suggestions, ideas, PRs...

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store