No Internet Layout Library 2.5 0.0 Java #layout #check_internet

Overview

No Internet Layout Library

Library to check internet connection and change layout to no internet layout if there is no internet.

Gradle:

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

dependencies {
     implementation 'com.github.MohamedWessam:no-internet-layout:0.1.1'
}

Usage:

In Kotlin

NoInternetLayout.Builder(activity, R.layout.activity_main) //change activity_main with your layout

In Java

new NoInternetLayout.Builder(activity, R.layout.activity_main); //change activity_main with your layout

All available options

NoInternetLayout.Builder(activity, R.layout.activity_main) //change activity_main with your layout
            .animate() //if you want to animate layout image
            .mainTitle("your title") //add a title as a String or as Int from string.xml
            .secondaryText("your text") //add a text as a String or as Int from string.xml
            .buttonText("your text") //add a text as a String or as Int from string.xml
            .setImage(R.drawable.your_image) //to add your own image
            .setImage(LayoutImage.DINOSAUR) //to choose image from library images(see below picture for all images)

All available images

You can use setImage() which take int as a parameter to set your own image from drawable resourse id. Or use setImage() which take LayoutImage as a parameter to choose from library images (see below picture).


Check internet connection only

You can check internet connection easly without changing the layout by the help of isNetworkConnected() which returns boolean.

NetworkChecker.isNetworkConnected(context)

License

   Copyright 2019 Mohamed Wessam.

   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.
You might also like...
Unirest in Java: Simplified, lightweight HTTP client library.

Unirest for Java Install With Maven: !-- Pull in as a traditional dependency -- dependency groupIdcom.konghq/groupId artifactIdunire

Unirest in Java: Simplified, lightweight HTTP client library.

Unirest for Java Install With Maven: !-- Pull in as a traditional dependency -- dependency groupIdcom.konghq/groupId artifactIdunire

Run Node.js on Android by rewrite Node.js in Java

node-android Run Node.js on Android by rewrite Node.js in Java with the compatible API. third-party: libuvpp, libuv-java JNI code by Oracle. Build Clo

Repo of the Open Source Android library : RoboSpice. RoboSpice is a modular android library that makes writing asynchronous long running tasks easy. It is specialized in network requests, supports caching and offers REST requests out-of-the box using extension modules.
dns library for android

Qiniu Happy DNS for Android 安装 直接安装 通过maven 使用方法 DnsManager 可以创建一次,一直使用。 IResolver[] resolvers = new IResolver[3]; resolvers[0] = AndroidDnsSe

🚀 A Complete Fast Android Networking Library that also supports HTTP/2 🚀
🚀 A Complete Fast Android Networking Library that also supports HTTP/2 🚀

Fast Android Networking Library About Fast Android Networking Library Fast Android Networking Library is a powerful library for doing any type of netw

HttpMocker is a simple HTTP mocking library written in Kotlin to quickly and easily handle offline modes in your apps

HttpMocker HttpMocker is a very lightweight Kotlin library that allows to mock HTTP calls relying on either OkHttp or the Ktor client libraries. It ca

Kotlin HTTP requests library. Similar to Python requests.

khttp khttp is a simple library for HTTP requests in Kotlin. It functions similarly to Python's requests module. import khttp.get fun main(args: Arra

The easiest HTTP networking library for Kotlin/Android

Fuel The easiest HTTP networking library for Kotlin/Android. You are looking at the documentation for 2.x.y.. If you are looking for the documentation

Comments
  • Failed to resolve issue with gradle

    Failed to resolve issue with gradle

    Experiencing failed to resolve issue when trying to add it in gradle file.

    ERROR: Failed to resolve: com.github.MohamedWessam:no-internet-layout:0.1.1 Show in Project Structure dialog Affected Modules: app

    opened by amanasci 3
  • Getting issue with fragments

    Getting issue with fragments

    What If I want to use this layout in Fragments?

    I have tried with this way:

    new NoInternetLayout.Builder(getActivity(), R.layout.fragment_privacy_policy);

    • Its displaying full screen internet view
    • If I press back button, its finishing activity.
    opened by pratikbutani 2
  • Duplicate ID when internet is available

    Duplicate ID when internet is available

    Am using navigation component in my application main activity, after adding no-internet-layout as shown in the exmaple i get the following error:-

    Caused by: java.lang.IllegalArgumentException: Binary XML file line #12: Duplicate id 0x7f090160, tag null, or parent id 0x7f090137 with another fragment for androidx.navigation.fragment.NavHostFragment

    @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
            new NoInternetLayout
                    .Builder(this, R.layout.activity_main)
                    .setImage(LayoutImage.SIMPLE)
                    .animate();
    
    

    however, if I comment setContentView as below it works Ok

    @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            //setContentView(R.layout.activity_main);
            new NoInternetLayout
                    .Builder(this, R.layout.activity_main)
                    .setImage(LayoutImage.SIMPLE)
                    .animate();
    

    Am thinking the problem could be because the layout is set twice when internet is present, what do you think?

    opened by choxxy 0
Releases(0.1.1)
Owner
Mohamed Wessam
Android developer (Java | Kotlin)
Mohamed Wessam
Light library to check internet connection in android apps easily.

check-internet-android Light library to check internet connection in android apps easily. It checks real internet connection by connecting to Google's

Raheem 7 Nov 15, 2022
Practice parsing data from the internet

InspirationalQuotesExercise A small Android project to practice executing network requests and parsing the network response This app uses the ZenQuote

Ayana Bando 0 Oct 19, 2021
Starter code for getting and saving data from the Internet using Kotlin.

Doggos Description Doggos is an app that fetches (pun intended) information from a third party API. The API returns data about a random dog that conta

Latifah President 0 Nov 4, 2021
consumo de internet cortesia de google developers

MarsRealEstateFinal - Solution Code Solution code for Android Kotlin Fundamentals Codelab 8.3 Filtering and detail views with internet data. Introduct

null 0 Nov 3, 2021
CheckInternetConnection - CheckInternetConnection helps to find out if user`s Android device is connected to Internet or not

Check Internet Connection CheckInternetConnection helps to find out if user`s An

Hamed.D 1 Jan 16, 2022
WideFi - Internet sharing without Root

widefi Internet sharing without Root What Share your Android device's Internet connection with other devices without needing Root. WideFi works by cre

pyamsoft 18 Dec 28, 2022
An App to download a file from Internet by clicking on a custom-built button

LoadApp LoadApp is an app to download a file from the Internet by clicking on a custom-built button where: Width of the button gets animated from left

Anas Tariq 2 Aug 29, 2022
LiteHttp is a simple, intelligent and flexible HTTP framework for Android. With LiteHttp you can make HTTP request with only one line of code! It could convert a java model to the parameter and rander the response JSON as a java model intelligently.

Android network framework: LiteHttp Tags : litehttp2.x-tutorials Website : http://litesuits.com QQgroup : 42960650 , 47357508 Android网络通信为啥子选 lite-htt

马天宇 829 Dec 29, 2022
Asynchronous Http and WebSocket Client library for Java

Async Http Client Follow @AsyncHttpClient on Twitter. The AsyncHttpClient (AHC) library allows Java applications to easily execute HTTP requests and a

AsyncHttpClient 6k Jan 8, 2023
Java HTTP Request Library

Http Request A simple convenience library for using a HttpURLConnection to make requests and access the response. This library is available under the

Kevin Sawicki 3.3k Jan 6, 2023