Coder Social home page Coder Social logo

tapadoo / alerter Goto Github PK

View Code? Open in Web Editor NEW
5.5K 104.0 635.0 36.21 MB

An Android Alerting Library

License: MIT License

Java 12.97% Kotlin 87.03%
android android-library alerting ui android-app android-ui android-development customisation java material-design

alerter's People

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  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

alerter's Issues

setIcon crash

ndroid.content.res.Resources$NotFoundException: File res/drawable-xxhdpi-v4/ 4.4.2 huawei crash

Global alerter

Is it possible to create an global alerter regardless on which activity?

Strange behaviour using click TextView as the event to trigger alerter

I've run into a strange behaviour while defining an OnClickListener in a TextView in order to show an alerter. It doesn't show at the first click, while the second triggers it twice. You can observe the same behaviour every second click. I just reproduced it in the example application by adding a TextView to the layout and:

@Override
protected void onCreate(Bundle savedInstanceState) {
         
    ...
        
    findViewById(R.id.textttt).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            showAlertDefault();
        }
    });
}

Possible duplication of icon names

I have an icon named ic_notifications when the Alert is showing, my icon tints to white color, its due to the fact that the library has the same name as my icon. A possible solution would be to change the icons name to something that is tied to the library name.

Crash

Hi,

The library is crashing.

Please provide a fix.

java.lang.NullPointerException:
at com.tapadoo.alerter.Alerter$1.run(Alerter.java:90)
at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1119)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1239)
at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:766)
at android.animation.ValueAnimator$AnimationHandler$1.run(ValueAnimator.java:801)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:860)
at android.view.Choreographer.doCallbacks(Choreographer.java:672)
at android.view.Choreographer.doFrame(Choreographer.java:605)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:846)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5441)
at java.lang.reflect.Method.invoke(Native Method:0)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)

Progress Bar Color

Hello guys! First of all, thanks so much for this amazing library.

Is there any way to change the color of the progress bar?

Crashes - NullPointerException

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.ViewGroup.removeView(android.view.View)' on a null object reference
at com.tapadoo.alerter.Alerter$1.run(Alerter.java:90)
at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1140)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1239)
at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:766)
at android.animation.ValueAnimator$AnimationHandler$1.run(ValueAnimator.java:801)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:894)
at android.view.Choreographer.doCallbacks(Choreographer.java:696)
at android.view.Choreographer.doFrame(Choreographer.java:628)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:880)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5740)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:766)

Showing lots of Alerts rapidly can leave stray Alerts on screen

In the sample app, if you press a bunch of times on DEFAULT ALERT you end up with a stack of Alerts on top of each other, it just looks like one. If you then press on e.g. COLOURED ALERT it'll call clearCurrent and remove the first of the existing Alerts that it finds, but when the coloured Alert goes away you can see the old Alerts still there. If you do COLOURED ALERT (slowly) enough times eventually you clear the stack of Alerts, but that doesn't seem like the right behaviour.

Publish to bintray/jitpack

As of now the integration of the lib requires that one has to checkout the code and include the module.
If published to jitpack/bintray other devs need only include a single line for the dependency and gradle would pull the dependency.

Opening the project fails without BINTRAY_USER or BINTRAY_KEY

Hi guys!

I tried to import the project. The current build.gradle for the alerter module will throw an error if no Bintray credentials are not present. This means no one can open the project, until they go to their gradle.properties file and provide dummy credentials.

See here:

Screenshot of the issue

I think this is not what you want, so I fixed it in this PR: #5

No icon option

Hi! Is there a way to don't show any icon? I tried "null" and color trasparent but it has to be a Drawable so it doesn't work. I could make a trasparent drawable but it would be very easy to check if drawable exists or is null and set icon to null if that.
If there is a way I couldn't find it and if there is not we could add that option.

Modify Alerter Height

For my Requirements, I need to decrease the Alerter Height. Any Possible way to do so?
Or should i resort to removing the Title?

RTL

Is there Any support for RTL Languages?!
It's fairly simple to change the alerter_alert_view.xml and make it RTL Friendly!

Binary XML file line #29

I use this on Android Studio,and exception happened:
android.view.InflateException: Binary XML file line #29: Binary XML file line #29: Error inflating class android.support.v7.widget.AppCompatImageView
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 android.view.View.inflate(View.java:19784)
at com.tapadoo.alerter.Alert.initView(Alert.java:108)
at com.tapadoo.alerter.Alert.(Alert.java:79)
at com.tapadoo.alerter.Alerter.create(Alerter.java:56)
at com.coldstorage3.AlarmNotificationPackage.AlarmNotification.rnCallNative(AlarmNotification.java:64)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:368)
at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:138)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
at android.os.Looper.loop(Looper.java:148)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:208)
at java.lang.Thread.run(Thread.java:818)
Caused by: android.view.InflateException: Binary XML file line #29: Error inflating class android.support.v7.widget.AppCompatImageView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)

can you give me some propose?
Thanks.

Multiple onDraw()

When the Alerter is shown, the PorterDuffView will not call the method onDraw until it is hiden.
Here is my code:

        setContentView(new PorterDuffView(this));
        Alerter.create(this)
                .setIcon(R.mipmap.ic_launcher)
                .setText("hello world")
                .setDuration(3000)
                .setBackgroundColor(R.color.colorPrimary)
                .setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {

                    }
                })
                .show();

Can update text or icon after showing?

Hi,
It's can update title/text/icon after the Alerter showing?
In my app, use Alerter to notify user when receive new audio message.
And I want to show audio playing duration in text.

Thanks,

java.lang.NullPointerException

Fatal Exception: java.lang.NullPointerException
at com.tapadoo.alerter.Alerter$1.run(SourceFile:90)
at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1035)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1056)
at android.animation.ValueAnimator.access$400(ValueAnimator.java:50)
at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:644)
at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:660)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:803)
at android.view.Choreographer.doCallbacks(Choreographer.java:603)
at android.view.Choreographer.doFrame(Choreographer.java:572)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:789)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5356)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(NativeStart.java)

Cannot use inside BroadcastReceiver

Thanks a lot for this lib, I have issues in using inside OnReceive
Alerter.create(context)
.setTitle("Alert Title")
.setText("Alert text...")
.show();

Failed to resolve: com.tapadoo.android:alerter:1.0.9

Hello,

I am not able to load this library in my code.
I get this error when I include it in gradle: Failed to resolve: com.tapadoo.android:alerter:1.0.9

My Gradle version : 2.2.0
My Android Studio version : 2.3.1

com.tapadoo.android:alerter:1.0.8 works

Unable to add dependency in abdroid studio

I'm unable to add this compile 'com.tapadoo.android:alerter:1.0.4' dependency in build.gradle file
I'm getting error:
Failed to resolve: com.tapadoo.android:alerter:1.0.4
What to do to resolve that error?

Make vibration optional

It would be cool if the haptic feedback was optional instead of mandatory since it can be sometimes annoying

Swipe to dismiss or another button to close?

I think it would be a great feature to be able to swipe and dismiss the alert, in case onClick is used for something else.

Or another close button at the top right if that's easier.

Custom font size

Our app is viewed by drivers and the default text is a bit too small. Any chance of getting a jumbo text mode?

Thank you

BTW this is a very nicely designed component and api. Thanks for creating it.

"progress bar" for remaining time

Thanks for the awesome lib!
In multiple new Google apps a very thin progress bar is used (e.g. the new web login form)

It would be handy if a similar progress bar is indicating the remaining time of an Alerter until automatically disappearing when millis are given.

Resource not found in icons

i had a problem when set icon to the alerter follow the
creash report

NotFoundException for com.aitrich.android.orderpro
android.content.res.Resources$NotFoundException: File res/drawable-xxhdpi-v4/ic_map_marker_white_48dp.png from xml type xml resource ID #0x7f020102
at android.content.res.Resources.loadXmlResourceParser(Resources.java:3059)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:3014)
at android.content.res.Resources.getXml(Resources.java:1383)
at android.support.graphics.drawable.VectorDrawableCompat.create(VectorDrawableCompat.java:586)
at com.tapadoo.alerter.Alert.setIcon(Alert.java:471)
at com.tapadoo.alerter.Alerter.setIcon(Alerter.java:342)
at com.aitrich.android.orderpro.ui.fragment.operation.InventoryVoucherFormFragment$4.onClick(InventoryVoucherFormFragment.java:1732)
at android.view.View.performClick(View.java:5269)
at android.view.View$PerformClick.run(View.java:21556)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
Caused by: java.io.FileNotFoundException: Corrupt XML binary file
at android.content.res.AssetManager.openXmlAssetNative(Native Method)
at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:504)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:3041)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:3014) 
at android.content.res.Resources.getXml(Resources.java:1383) 
at android.support.graphics.drawable.VectorDrawableCompat.create(VectorDrawableCompat.java:586) 
at com.tapadoo.alerter.Alert.setIcon(Alert.java:471) 
at com.tapadoo.alerter.Alerter.setIcon(Alerter.java:342) 
at com.aitrich.android.orderpro.ui.fragment.operation.InventoryVoucherFormFragment$4.onClick(InventoryVoucherFormFragment.java:1732) 
at android.view.View.performClick(View.java:5269) 
at android.view.View$PerformClick.run(View.java:21556) 
at android.os.Handler.handleCallback(Handler.java:815) 
at android.os.Handler.dispatchMessage(Handler.java:104) 
at android.os.Looper.loop(Looper.java:207) 
at android.app.ActivityThread.main(ActivityThread.java:5776) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) 

My code

Alerter.create(getActivity())
.setText("Eelect destination location")
.setBackgroundColorRes(R.color.colorAccent)
.setIcon(R.drawable.ic_map_marker_white_48dp)
.show();

Disable Outside Touch

I want to disable the outside touch when the Alerter is showing. Can I do that with your Library?
or by Any other way?
let me know ASAP.
thanks.

Custom layouts for Alerts.

Something I could see useful, is allowing custom layout files to be provided, is this something planned for in the future?

This could allow much more flexibility, such as custom fonts, no icons, etc.

add RTL support

add setLayoutDirection so that we could change layout direction for RTL texts in non RTL phones as well

Button options

Hello friend, incredible LIB that you have created, I've been using it in a project and would like to know if it's possible to include buttons inside the notification. Example: When a notification appears, there is also option A and option B each with a different activity.

Thanks for help. ;)

Possible minSdkVersion < 16 ?

Wondering if min sdk is 16 for a reason... Do you foresee any problems by having a min sdk < 16? In my case would be 15.

set action?

Would there be any way to set an action? For example, if someone accidentally deletes something in a coordinator layout with a snackbar I can do .setAction and set a button to undo.

NullPointerException

java.lang.NullPointerException at com.tapadoo.alerter.Alerter$1.run(Alerter.java:91) at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1050) at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1056) at android.animation.ValueAnimator.access$400(ValueAnimator.java:50) at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:644) at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:660) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:788) at android.view.Choreographer.doCallbacks(Choreographer.java:591) at android.view.Choreographer.doFrame(Choreographer.java:559) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:774) at android.os.Handler.handleCallback(Handler.java:808) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loop(Looper.java:229) at android.app.ActivityThread.main(ActivityThread.java:5493) 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:860) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:676) at dalvik.system.NativeStart.main(Native Method)

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.