GithubHelp home page GithubHelp logo

wisemen-digital / nointernetdialog Goto Github PK

View Code? Open in Web Editor NEW
349.0 349.0 94.0 5.99 MB

A beautiful Dialog which appears when you have lost your internet connection.

License: Apache License 2.0

Java 100.00%

nointernetdialog's Introduction

No Internet Dialog

A beautiful Dialog which appears when you have lost your Internet connection.

Android Arsenal API

Setup

Gradle:

Add following line of code to your module(app) level gradle file

    implementation 'am.appwise.components:NoInternetDialog:1.1.3'

Maven:

  <dependency>
    <groupId>am.appwise.components</groupId>
    <artifactId>NoInternetDialog</artifactId>
    <version>1.1.3</version>
    <type>pom</type>
  </dependency>

Usage

Use simple builder to initiate the dialog. It will automatically appear if you'll lose your Internet connection, and dissapear, once it came back

  NoInternetDialog noInternetDialog = new NoInternetDialog.Builder(context).build();

or

  NoInternetDialog noInternetDialog = new NoInternetDialog.Builder(fragment).build();

and at the end

    @Override
    protected void onDestroy() {
        super.onDestroy();
        noInternetDialog.onDestroy();
    }

Customize the dialog with ease

  builder.setBgGradientStart() // Start color for background gradient
  builder.setBgGradientCenter() // Center color for background gradient
  builder.setBgGradientEnd() // End color for background gradient
  builder.setBgGradientOrientation() // Background gradient orientation (possible values see below)
  builder.setBgGradientType() // Type of background gradient (possible values see below)
  builder.setDialogRadius() // Set custom radius for background gradient
  builder.setTitleTypeface() // Set custom typeface for title text
  builder.setMessageTypeface() // Set custom typeface for message text
  builder.setButtonColor() // Set custom color for dialog buttons
  builder.setButtonTextColor() // Set custom text color for dialog buttons
  builder.setButtonIconsColor() // Set custom color for icons of dialog buttons
  builder.setWifiLoaderColor() // Set custom color for wifi loader
  builder.setConnectionCallback() // Set a Callback for network status
  builder.setCancelable(false) // Set cancelable status for dialog
alt text alt text
alt text alt text

This is work is is inspired from the work of Ramakrishna V. in Dribbble.

(https://dribbble.com/shots/2887886-No-internet-connection-GIF)

Versions

1.1.3

Connection callback status added Cancelable flag added

1.1.2

Receivers issue fixed

1.1.1

Vector drawable issue fixed for < API 21 UI issues fixed for small devices

1.1.0

New customization features added Issues fixed

1.0.1

Appear issue fixed

1.0.0

First version of library

Licence

    No Internet Dialog©
    Copyright 2017 Appwise
    Url: https://github.com/appwise-labs/NoInternetDialog

    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.

nointernetdialog's People

Contributors

jobgetabu avatar kolllor33 avatar marsvard avatar robertlevonyan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nointernetdialog's Issues

implementation error

i get an error when iam implementing your lib in my app,

Error:Execution failed for task ':app:processDebugManifest'.

Manifest merger failed : Attribute application@theme value=(@style/AppTheme) from AndroidManifest.xml:11:9-40
is also present at [am.appwise.components:NoInternetDialog:1.1.3] AndroidManifest.xml:20:9-47 value=(@style/NoInternetTheme).
Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:5:5-13:19 to override.

UnregisterReceiver

Activity has leaked IntentReceiver am.appwise.components.ni.nointernetdialog.NetworkStatusReceiver@36923f41 that was originally registered here. Are you missing a call to unregisterReceiver()?
android.app.IntentReceiverLeaked: Activity has leaked IntentReceiver am.appwise.components.ni.nointernetdialog.NetworkStatusReceiver@36923f41 that was originally registered here. Are you missing a call to unregisterReceiver()?
at android.app.LoadedApk$ReceiverDispatcher.(LoadedApk.java:904)

Crash when 4g button pressed and the dialog was previously registered in previous activity

Process: com.dunatv.photosafe, PID: 9955
java.lang.RuntimeException: Unable to destroy activity {com.dunatv.photosafe/com.dunatv.photosafe.LoginActivity}: java.lang.IllegalArgumentException: Receiver not registered: am.appwise.components.ni.WifiReceiver@d1a0c92
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4603)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4621)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4895)
at android.app.ActivityThread.-wrap19(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1702)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.IllegalArgumentException: Receiver not registered: am.appwise.components.ni.WifiReceiver@d1a0c92
at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:1181)
at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1456)
at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:658)
at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:658)
at am.appwise.components.ni.NoInternetDialog.onDestroy(NoInternetDialog.java:630)
at com.dunatv.photosafe.LoginActivity.onDestroy(LoginActivity.java:262)

crashes on first activity at ondestroy

Error in gradle build in compileSdkVersion 27

Gradle is not building after adding

implementation 'am.appwise.components:NoInternetDialog:1.1.3'

Log cat error is -

Error:Execution failed for task ':app:processDebugManifest'.

Manifest merger failed : Attribute application@theme value=(@style/AppTheme) from AndroidManifest.xml:14:9-40
is also present at [am.appwise.components:NoInternetDialog:1.1.3] AndroidManifest.xml:20:9-47 value=(@style/NoInternetTheme).
Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:9:5-33:19 to override.

Dialog box is non cancelable.

Dialog box is non - cancelable in case of non availabilty of internet even after writing code for that.
I was writing:
noInternetDialog.setCancelable(true);

Crash: Error inflating Nointernet dialogue

android.view.InflateException: Binary XML file line #23: Binary XML file line #23: Error inflating class
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393)
at android.app.Dialog.setContentView(Dialog.java:512)
at am.appwise.components.ni.NoInternetDialog.onCreate(NoInternetDialog.java:163)
at android.app.Dialog.dispatchOnCreate(Dialog.java:394)

.InflateException: Binary XML file line #23:

My target SDK version: 28

android.view.InflateException: Binary XML file line #23: Binary XML file line #23: Error inflating class
Caused by: android.view.InflateException: Binary XML file line #23: Error inflating class
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:420)
at android.app.Dialog.setContentView(Dialog.java:557)
at am.appwise.components.ni.NoInternetDialog.onCreate(NoInternetDialog.java:198)
at android.app.Dialog.dispatchOnCreate(Dialog.java:407)
at android.app.Dialog.show(Dialog.java:302)
at am.appwise.components.ni.NoInternetDialog.show(NoInternetDialog.java:578)
at am.appwise.components.ni.NoInternetDialog$9.hasActiveConnection(NoInternetDialog.java:588)
at am.appwise.components.ni.Ping.onPostExecute(Ping.java:22)
at am.appwise.components.ni.Ping.onPostExecute(Ping.java:10)
at android.os.AsyncTask.finish(AsyncTask.java:695)
at android.os.AsyncTask.access$600(AsyncTask.java:180)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f0200fd a=-1}
at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:946)
at android.content.res.TypedArray.getDrawable(TypedArray.java:930)
at android.view.View.(View.java:5010)
at android.widget.ImageView.(ImageView.java:177)
at android.widget.ImageView.(ImageView.java:172)
at android.support.v7.widget.AppCompatImageView.(AppCompatImageView.java:72)
at android.support.v7.widget.AppCompatImageView.(AppCompatImageView.java:68)
at java.lang.reflect.Constructor.newInstance0(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:343) 
at android.view.LayoutInflater.createView(LayoutInflater.java:647) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:420) 
at android.app.Dialog.setContentView(Dialog.java:557) 
at am.appwise.components.ni.NoInternetDialog.onCreate(NoInternetDialog.java:198) 
at android.app.Dialog.dispatchOnCreate(Dialog.java:407) 
at android.app.Dialog.show(Dialog.java:302) 
at am.appwise.components.ni.NoInternetDialog.show(NoInternetDialog.java:578) 
at am.appwise.components.ni.NoInternetDialog$9.hasActiveConnection(NoInternetDialog.java:588) 
at am.appwise.components.ni.Ping.onPostExecute(Ping.java:22) 
at am.appwise.components.ni.Ping.onPostExecute(Ping.java:10) 
at android.os.AsyncTask.finish(AsyncTask.java:695) 
at android.os.AsyncTask.access$600(AsyncTask.java:180) 
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:193) 
at android.app.ActivityThread.main(ActivityThread.java:6669) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
I/Process: Sending signal. PID: 24895 SIG: 9
Application terminated.

Need to unregisterReceiver wifiReceiver

Library is very pretty to Use 👍

I am initialized and register for Dialog In my BaseActivity's on create method

new NoInternetDialog.Builder(this)
.setBgGradientCenter(ContextCompat.getColor(BaseActivity.this, R.color.colorPrimary))
.setBgGradientStart(ContextCompat.getColor(BaseActivity.this, R.color.colorPrimary))
.setBgGradientEnd(ContextCompat.getColor(BaseActivity.this, R.color.colorPrimary))
.setButtonColor(ContextCompat.getColor(BaseActivity.this, R.color.colorAccent))
.build();

E/ActivityThread: Activity com.medeasypatient.activities.IntroAppActivity has leaked IntentReceiver am.appwise.components.ni.NetworkStatusReceiver@9088fea that was originally registered here. Are you missing a call to unregisterReceiver()?

I think there should be some method to unregister wifiReceiver method.

java.lang.NullPointerException

Help me!!
I get following error when i put this code in my app

NoInternetDialog noInternetDialog = new NoInternetDialog.Builder(context).build();

ComponentInfo{com.trinche.trinch/com.trinche.app.MainRegister}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.ApplicationInfo android.content.Context.getApplicationInfo()' on a null object reference
...
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.ApplicationInfo android.content.Context.getApplicationInfo()' on a null object reference
...

Did you get this to work? I'm facing the same problem: InflateException

FATAL EXCEPTION: main
android.view.InflateException: Binary XML file line #23: Binary XML file line #23: Error inflating class
Caused by: android.view.InflateException: Binary XML file line #23: Error inflating class
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:419)
at android.app.Dialog.setContentView(Dialog.java:528)
at am.appwise.components.ni.NoInternetDialog.onCreate(NoInternetDialog.java:198)
at android.app.Dialog.dispatchOnCreate(Dialog.java:403)
at android.app.Dialog.show(Dialog.java:302)
at am.appwise.components.ni.NoInternetDialog.show(NoInternetDialog.java:578)
at am.appwise.components.ni.NoInternetDialog$9.hasActiveConnection(NoInternetDialog.java:588)
at am.appwise.components.ni.Ping.onPostExecute(Ping.java:22)
at am.appwise.components.ni.Ping.onPostExecute(Ping.java:10)
at android.os.AsyncTask.finish(AsyncTask.java:695)
at android.os.AsyncTask.-wrap1(Unknown Source:0)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f0301d0 a=-1}

compileSdkVersion 28, targetSdkVersion 28, other dependencies are running 28.0.0

Originally posted by @VinceGee in #8 (comment)

WindowManager: leaked activity on destroy

03-11 16:14:43.421 12736-12736/inc.nullpointer.bellax E/WindowManager: android.view.WindowLeaked: Activity inc.nullpointer.bellax.MainActivity has leaked window DecorView@d06b2bb[] that was originally added here
at android.view.ViewRootImpl.(ViewRootImpl.java:505)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:346)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93)
at android.app.Dialog.show(Dialog.java:330)
at am.appwise.components.ni.NoInternetDialog.show(NoInternetDialog.java:578)
at am.appwise.components.ni.NoInternetDialog$9.hasActiveConnection(NoInternetDialog.java:588)
at am.appwise.components.ni.Ping.onPostExecute(Ping.java:22)
at am.appwise.components.ni.Ping.onPostExecute(Ping.java:10)
at android.os.AsyncTask.finish(AsyncTask.java:695)
at android.os.AsyncTask.-wrap1(Unknown Source:0)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6809)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Crash when switching between Activities

Have 2 activities and have .onDestroy dialog implementation when onDestroy activity.
Both of them initialize this library dialog at onCreate

Navigate from Activity A->B->A -> crash at onDestroy

Manifest merger failed

Gradle:
implementation 'am.appwise.components:NoInternetDialog:1.1.0'

MainActivity:
new NoInternetDialog.Builder(this).build();

Error:Execution failed for task ':app:processDebugManifest'.

Manifest merger failed : Attribute application@theme value=(@style/AppThemeDWClub) from AndroidManifest.xml:14:9-46
is also present at [am.appwise.components:NoInternetDialog:1.1.0] AndroidManifest.xml:20:9-47 value=(@style/NoInternetTheme).
Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:7:5-57:19 to override.

Receiver not registered:

java.lang.IllegalArgumentException: Receiver not registered: am.appwise.components.ni.WifiReceiver@704475c

Memory Leaks

WindowManager: android.view.WindowLeaked: Activity com.medeasypatient.activities.SplashActivity has leaked window com.android.internal.policy.PhoneWindow$DecorView{6342793 V.ED..... R......D 0,0-640,900} that was originally added here
at android.view.ViewRootImpl.(ViewRootImpl.java:368)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:299)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
at android.app.Dialog.show(Dialog.java:319)
at am.appwise.components.ni.NoInternetDialog.show(NoInternetDialog.java:578)
at am.appwise.components.ni.NoInternetDialog$9.hasActiveConnection(NoInternetDialog.java:588)
at am.appwise.components.ni.Ping.onPostExecute(Ping.java:22)
at am.appwise.components.ni.Ping.onPostExecute(Ping.java:10)
at android.os.AsyncTask.finish(AsyncTask.java:651)
at android.os.AsyncTask.-wrap1(AsyncTask.java)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Inflate Exception

Receiving this error when I turn off wifi. The implementation is set in an Application Class.

android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class <unknown>
                                                                Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class <unknown>
                                                                Caused by: java.lang.reflect.InvocationTargetException
                                                                    at java.lang.reflect.Constructor.newInstance0(Native Method)
                                                                    at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
                                                                    at android.view.LayoutInflater.createView(LayoutInflater.java:645)
                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
                                                                    at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:412)
                                                                    at android.app.Dialog.setContentView(Dialog.java:519)
                                                                    at am.appwise.components.ni.NoInternetDialog.onCreate(NoInternetDialog.java:192)
                                                                    at android.app.Dialog.dispatchOnCreate(Dialog.java:402)
                                                                    at android.app.Dialog.show(Dialog.java:301)
                                                                    at am.appwise.components.ni.NoInternetDialog.show(NoInternetDialog.java:566)
                                                                    at am.appwise.components.ni.NoInternetDialog$9.hasActiveConnection(NoInternetDialog.java:576)
                                                                    at am.appwise.components.ni.Ping.onPostExecute(Ping.java:22)
                                                                    at am.appwise.components.ni.Ping.onPostExecute(Ping.java:10)
                                                                    at android.os.AsyncTask.finish(AsyncTask.java:667)
                                                                    at android.os.AsyncTask.-wrap1(AsyncTask.java)
                                                                    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:684)
                                                                    at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                    at android.os.Looper.loop(Looper.java:154)
                                                                    at android.app.ActivityThread.main(ActivityThread.java:6236)
                                                                    at java.lang.reflect.Method.invoke(Native Method)
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)
                                                                 Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f0402d9 a=-1}
                                                                    at android.content.res.TypedArray.getDrawable(TypedArray.java:925)
                                                                    at android.view.View.<init>(View.java:4202)
                                                                    at android.widget.ImageView.<init>(ImageView.java:155)
                                                                    at android.widget.ImageView.<init>(ImageView.java:150)
                                                                    at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:72)
                                                                    at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:68)
                                                                    at java.lang.reflect.Constructor.newInstance0(Native Method) 
                                                                    at java.lang.reflect.Constructor.newInstance(Constructor.java:430) 
                                                                    at android.view.LayoutInflater.createView(LayoutInflater.java:645) 
                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787) 
                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) 
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:858) 
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 
                                                                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:861) 
                                                                    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:518) 
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:426) 
                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:377) 
                                                                    at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:412) 
                                                                    at android.app.Dialog.setContentView(Dialog.java:519) 
                                                                    at am.appwise.components.ni.NoInternetDialog.onCreate(NoInternetDialog.java:192) 
                                                                    at android.app.Dialog.dispatchOnCreate(Dialog.java:402) 
                                                                    at android.app.Dialog.show(Dialog.java:301) 
                                                                    at am.appwise.components.ni.NoInternetDialog.show(NoInternetDialog.java:566) 
                                                                    at am.appwise.components.ni.NoInternetDialog$9.hasActiveConnection(NoInternetDialog.java:576) 
                                                                    at am.appwise.components.ni.Ping.onPostExecute(Ping.java:22) 
                                                                    at am.appwise.components.ni.Ping.onPostExecute(Ping.java:10) 
                                                                    at android.os.AsyncTask.finish(AsyncTask.java:667) 
                                                                    at android.os.AsyncTask.-wrap1(AsyncTask.java) 
                                                                    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:684) 
                                                                    at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                    at android.os.Looper.loop(Looper.java:154) 
                                                                    at android.app.ActivityThread.main(ActivityThread.java:6236) 
                                                                    at java.lang.reflect.Method.invoke(Native Method) 
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891) 
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781) 

Application Class:

@Override
    public void onCreate() {
        AppCompatDelegate.setDefaultNightMode(
                AppCompatDelegate.MODE_NIGHT_AUTO);
        super.onCreate();

        new NoInternetDialog.Builder(this)
                .setButtonColor(R.color.colorPrimary)
                //.setBgGradientEnd(getResources().getColor(R.color.colorPrimaryDark))
                .build();
}

Gradle Sync Fails

once i add the implementation. I get an gradle sync issue. merger of multiple manifest failed.

Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml #14

I set android:allowBackup to false and then I run my project it says below message

Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:24:9-36
	is also present at [am.appwise.components:NoInternetDialog:1.1.3] AndroidManifest.xml: allowBackup value=(true).
	Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:22:5-121:19 to override.

can you remove android:allowBackup

Wrong message display.

Hi Guys,

Thanks a lot for this nice library. I was testing this library, and I faced this issue that when there is no internet connection, it is showing message that "You've turned on the airplane mode" and "Please turn off" even when airplane mode is turned off and internet connection is off.

Steps to reproduce this:

  1. Start application, and then turn on Airplane mode
  2. When Airplane dialog open, then turn off Airplane mode
  3. Go back to application, and then turn off WIFI while remaining on same activity
  4. Now when dialog appears, it'll show the same old i.e. "You've turned on the airplane mode" and "Please turn off"

I think you people are not refreshing the old message

Switch 4g on bug

When 4g mobile data is clicked, the settings page opens. And when settings page is closed, the dialog does not reappear.

Steps to reproduce:

  1. Turn off internet. The dialog appears.
  2. Click on 4g Mobile data. Settings page opens.
  3. Do not switch on the mobile data and press back.
  4. There is no internet connection and no dialog.

Expected:
The dialog should appear when the activity resumes and there is no internet connection.

Content is not allowed in prolog Error

I got this error. How can i fix it?
C:\Users\Rakshith Shetty.android\build-cache\acb394dc94c4798ca4e90f1a36706fa85ceb35ae\output\res\font\montserrat_bold.ttf
Error:(1, 1) Error: Content is not allowed in prolog.
Thanks

Tablet Center Problem

Hello,
I love this library, It works well on smartphones but not working on tablet sizes. It is not centered itself on the tablets.

How can I fix it ? :) Thank you
Have fun :)

Customize

Will be great to have opportunity to customize buttons, text colors (style), e.g.

WifiReceiver not registered

I get following error when I close the activity

java.lang.RuntimeException: Unable to destroy activity {ca.DescriptionActivity}: java.lang.IllegalArgumentException: Receiver not registered: am.appwise.components.ni.WifiReceiver@9ba12bf

Close button visibility

  1. Wifi loading and "PLEASE TURN ON" string should have some margin because while loading progress bar is little hidden under text view. Check screenshot.
    screenshot_20171220-181030

  2. Is there any callback/listener for a successful connection, so that we can do some work after connection established.

  3. It's not an issue actually. It would be great if we can enable/disable close button or change its visibility so that we can have the non-cancelable dialog.

ConnectionCallback isn’t calling

I have set the connection callback when instantiating the object but the callback is never called
here is some code

public class MyActivity extends AppCompatActivity implements ConnectionCallback {
onCreate(){
…..
NoInternetDialog noInternetDialog=new NoInternetDialog.Builder(this).setConnectionCallback(this).build();
..
}

@Override
    public void hasActiveConnection(boolean hasActiveConnection) {
            if(hasActiveConnection) {
              Toast.makeText(this, “on", Toast.LENGTH_SHORT).show();
            }else {
              Toast.makeText(this, “off", Toast.LENGTH_SHORT).show();
             }
    }

Resources not found API 19

new NoInternetDialog.Builder(this).build();

Error:

android.content.res.Resources$NotFoundException: File res/drawable/ic_wifi_white.xml from drawable resource ID #0x7f07007d. If the resource you are trying to use is a vector resource, you may be referencing it in an unsupported way. See AppCompatDelegate.setCompatVectorFromResourcesEnabled() for more info.
at android.content.res.Resources.loadDrawable(Resources.java:2136)
at android.content.res.Resources.getDrawable(Resources.java:715)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:353)
at am.appwise.components.ni.NoInternetDialog.initButtonStyle(NoInternetDialog.java:275)
at am.appwise.components.ni.NoInternetDialog.onCreate(NoInternetDialog.java:195)
at android.app.Dialog.dispatchOnCreate(Dialog.java:396)
at android.app.Dialog.show(Dialog.java:268)
at am.appwise.components.ni.NoInternetDialog.show(NoInternetDialog.java:563)
at am.appwise.components.ni.NoInternetDialog$9.hasActiveConnection(NoInternetDialog.java:573)
at am.appwise.components.ni.Ping.onPostExecute(Ping.java:22)
at am.appwise.components.ni.Ping.onPostExecute(Ping.java:10)
at android.os.AsyncTask.finish(AsyncTask.java:632)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
at dalvik.system.NativeStart.main(Native Method)
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #0: invalid drawable tag vector
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:933)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
at android.content.res.Resources.loadDrawable(Resources.java:2132)
at android.content.res.Resources.getDrawable(Resources.java:715) 
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:353) 
at am.appwise.components.ni.NoInternetDialog.initButtonStyle(NoInternetDialog.java:275) 
at am.appwise.components.ni.NoInternetDialog.onCreate(NoInternetDialog.java:195) 
at android.app.Dialog.dispatchOnCreate(Dialog.java:396) 
at android.app.Dialog.show(Dialog.java:268) 
at am.appwise.components.ni.NoInternetDialog.show(NoInternetDialog.java:563) 
at am.appwise.components.ni.NoInternetDialog$9.hasActiveConnection(NoInternetDialog.java:573) 
at am.appwise.components.ni.Ping.onPostExecute(Ping.java:22) 
at am.appwise.components.ni.Ping.onPostExecute(Ping.java:10) 
at android.os.AsyncTask.finish(AsyncTask.java:632) 
at android.os.AsyncTask.access$600(AsyncTask.java:177) 
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5103) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606) 
at dalvik.system.NativeStart.main(Native Method) 

Setting airplane_mode has moved

HI, the Turn on wifi button doesn't work anymore...

2020-08-14 12:24:17.023 20668-20668/com.jackpotkings.vegasslots W/Settings: Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value. 2020-08-14 12:24:17.031 20668-20668/com.jackpotkings.vegasslots W/Settings: Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.