In-layout notifications. Based on Toast notifications and article by Cyril Mottier (http://android.cyrilmottier.com/?p=773).

Overview

Android AppMsg (Crouton) Library

Implementation of in-layout notifications. Based on Toast notifications and article The making of Prixing #4: in-layout notifications by Cyril Mottier.

Description

Toast is far from being perfect and I am not entirely satisfied with it. Toast can be un-accurate in some cases. Indeed, Toast has one major drawback: it completely breaks contexts. This issue can be reproduced effortless. Let’s say a user is currently in an app firing a Toast and wants to switch to another application using the dedicated “multitask” button. The Toast will remain on screen even if the brought-to-front application has nothing do to with the previously shown app as described on the following figure: Example Image

As you can easily notice, the problem with Toasts is they are persistent. Once a Toast has been fired, it is displayed on top of any screen and remains visible for the duration specified at its creation.

In order to bypass the Toast persistence problem and ensure information is displayed in the correct context, we decided to create a new notification system: Activity-bound notifications. This is what it looks like in the current version of Prixing: Example Image

Crouton overcomes the main issue of having a Toast being shown while the menu is open. It sticks to the current screen sliding with it and leaving the menu completely free of any information that would have not been related to it.

Copyright (C) by Cyril Mottier

Sample

A sample application is available on Google Play:

Get it on Google Play

Example Image

The source code is available in this repository.

Compatibility

This library is compatible from API 4 (Android 1.6).

Installation

The sample project requires:

Usage

Android AppMsg is presented as an Android library project. You can include this project by referencing it as a library project in Eclipse or ant.

To display the item you need the following code:

  • Show AppMsg:
AppMsg.makeText(/*Activity*/, /*CharSequence*/, /*AppMsg.Style*/).show();

Gradle

Android-AppMsg Library is now pushed to Maven Central as a AAR, so you just need to add the following dependency to your build.gradle.

dependencies {
	implementation 'com.github.johnkil.android-appmsg:appmsg:1.2.0'
}

Example Gradle project using Android-AppMsg:

Contribution

Please fork dev repository and contribute back using pull requests.

Contributors are recommended to follow the Android Code Style Guidelines.

Any contributions, large or small, major features, bug fixes, additional language translations, unit/integration tests are welcomed and appreciated but will be thoroughly reviewed and discussed.

Developed By

License

Copyright 2012 Evgeny Shishkin

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.
Comments
  • No Activity leaking

    No Activity leaking

    Currently Activities are being leaked for as long they are kept in the queue, this PR aims to fix this issues by:

    • Auto releasing it onDestroy for ICS+, older versions must call cancelAll(Activity) (preferred) or cancelAll() at earliest convenience.
    • Using one MsgManager per Activity, this way Activity A won't have to wait for AppMsgs belonging to Activity B to be removed in order to show A's AppMsgs
    • Also updates gradle files/vars
    opened by eveliotc 8
  • java.lang.NoClassDefFoundError: com.devspark.appmsg.R$color

    java.lang.NoClassDefFoundError: com.devspark.appmsg.R$color

    It's a Fatal Exception: Main.

    And the cause is:

    java.lang.NoClassDefFoundError: com.devspark.appmsg.R$color
        at com.devspark.appmsg.AppMsg.<clinit>(AppMsg.java:52)
    

    Any ideas?

    opened by joshuapinter 5
  • I added Maven support, possibility to use custom layout, the possibility to create non-floating messages with a custom View and I also fixed a wrong behavior

    I added Maven support, possibility to use custom layout, the possibility to create non-floating messages with a custom View and I also fixed a wrong behavior

    I added the possibility to use custom layout for the message, since it has an TextView with the android.R.id.message. I also added the feature of using an in-layout View, instead of a floating View for the message. If this new feature is used, the custom view will be hidden, instead of removed from the layout. So, it can be reused as many times as the user wants to. I also fixed the behavior of the clear() method, since it wasn't removing the message when it was being shown.

    opened by fernandocamargoai 2
  • Out animation patch

    Out animation patch

    This proposed patch will allow the out animation to actually be visible on screen. Originally, the out animation was attached to the view using view.startAnimation(). Immediately following that, the message is removed from the queue and the view is removed from the parent. In most cases, the view is removed from the parent before the animation is visible on screen, thus the resulting effect is the view suddenly disappearing from the screen instead of playing the animation.

    opened by alexfu 2
  • Added support for custom Animations

    Added support for custom Animations

    Hello! The following pull request is to add support for using user defined animations instead of always using the default fade in/fade out animations. If no user defined animation is set, it will default back to the fade in/fade out animations that were originally there.

    opened by alexfu 2
  • Customizable layoutparams

    Customizable layoutparams

    This is some code to enable the caller to have a bit of control over the placement of the AppMsg by specifying LayoutParameters. There is also a helper method provided in the case where all you want to change is the layout gravity, for example to show the AppMsg at the bottom of the Actitivy.

    opened by mlc 2
  • Where is Crouton?

    Where is Crouton?

    I was reading Appolo-CM, which imported AppMsg from here. But in Appolo-CM the class Crouton is needed. And I looked for Crouton in AppMsg here and there but found nothing about it. So, where is it or does Crouton exist in another projects?

    opened by bytebeats 1
  • Display the  Android-AppMsg (crouton) for the an individual nested fragment

    Display the Android-AppMsg (crouton) for the an individual nested fragment

    I'm trying to display the crouton on child fragment it's not displaying anything

    //=================================

    //activity-->viewpager fragment--->childfragment /calling crouton here/

    MeetingFragment f = new MeetingFragment();

    AppMsg.makeText(f.getActivity(), "Hello AppMsg",AppMsg.STYLE_ALERT,(ViewGroup) f.getView()).show(); //failed in nested fragment

    Crouton.makeText(getActivity(), "Hello Crouton", Style.INFO,(ViewGroup) getView()).show(); //failed in nested fragment

    //=================================

    http://stackoverflow.com/questions/14760042/appmsg-crouton-library-support-for-fragments-urgent

    any solutions to make it available for fragment or child (nested) fragment ?!! or this will still display the crouton for the activity, not for an individual fragment?

    opened by LOG-TAG 1
  • super-preliminary support for building with gradle.

    super-preliminary support for building with gradle.

    This is some preliminary support for building AppMsg with gradle, for use in the new Android build system.

    In particular, if gradle is on your PATH and the Android SDK is set up properly, you can now do gradle :library:assemble to build the AppMsg library, and then you can include it in your projects.

    Not supported yet:

    • building the sample project (because it relies on ActionBarSherlock, which is not yet easily available as an AAR, though support for this is pending, see JakeWharton/ActionBarSherlock#891)
    • publishing an AAR of AppMsg itself to Maven Central or something like that

    I can work on these two issues (especially the latter) later, but the patch included here is sufficient to let me build my app with AppMsg, so hopefully it will be useful to someone else even in this limited state.

    opened by mlc 1
  • Message under dimmed background of a dialog.

    Message under dimmed background of a dialog.

    In my application i have a fragment dialog with some controls. Controls make possibility to chose some data and has button. This button validates entered data and make message if data is not valid. But there is a bug (maybe it's feature) - message is appeared under dimmed background of this dialog. Is it possible to show message over the dimmed background.

    Image

    opened by vlebedynskyi 0
  • waffle.io Badge

    waffle.io Badge

    Merge this to receive a badge indicating the number of issues in the ready column on your waffle.io board at http://waffle.io/johnkil/Android-AppMsg

    This was requested by a real person on waffle.io, we're not trying to spam you.

    opened by waffleio 0
  • AppMsg keeps showing forever

    AppMsg keeps showing forever

    When I move from one activity to another very fast, the app msg showing there keeps there FOREVER, even I use cancelAll() or cancelMsg(). What is the solution. Please help me.

    opened by gauravarora90 0
  • Example of custom view

    Example of custom view

    As I have not seen any example of positioning the messages in a custom view, I want to share how I solved the problem to get inputs from other users. I am not sure if this is the proper way but it works for me.... more or less:

    I added this code to the layout embedded in a RelativeLayout:

                          <!-- required by AppMsg to position in another place -->
                          <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                              android:id="@+id/messagescontainer"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:layout_centerInParent="true">
    
                              <include layout="@layout/app_msg"/>
    
                          </LinearLayout>
    

    and this code into the Java

                LinearLayout messagesContainer = (LinearLayout) findViewById(R.id.messagesContainer);
    
                AppMsg.makeText(OfferActivity.this, "Error Performing this Operation", AppMsg.STYLE_ALERT, carouselContainer).show();
    

    However, there seems to be a bug because the message is shown as soon is instantiated in makeText(), without the need to call show() method. However, you need to call show() in order to make cancel() method work. Otherwise, cancel() does not remove the message.

    Are these bugs or I am not using it in the proper way?

    opened by pellyadolfo 0
  • Error: Attempt to invoke virtual method 'boolean com.devspark.appmsg.AppMsg.isShowing()' on a null object reference

    Error: Attempt to invoke virtual method 'boolean com.devspark.appmsg.AppMsg.isShowing()' on a null object reference

    Hi, I have created two AppMsg object like below,

    public MyActivity extends Activity {
         AppMsg noConnectionMsg, connectedMsg; 
    
        @Override
        public void onCreate(Bundle bundle) {
          noConnectionMsg = AppMsg.makeText(this,
                    getResources().getString(R.string.msgNoConnection),
                    AppMsg.STYLE_ALERT);
    
            noConnectionMsg.setDuration(AppMsg.LENGTH_STICKY);
    
    
            connectedMsg = AppMsg.makeText(this,
                    getResources().getString(R.string.msgConnected),
                    AppMsg.STYLE_INFO);
        }
    
       ...
       ...
    
    }
    

    But when I run the application, notifications are successfully shown. After cancelling the AppMsgs, App is getting crashed with this Error:

    Attempt to invoke virtual method 'boolean com.devspark.appmsg.AppMsg.isShowing()' on a null object reference.

    opened by gyanminda 1
  • Latest changes not in release

    Latest changes not in release

    I am using the makeText method with OnClickListener, but I recently switched to gradle and it appears that these methods are not present in Maven Central repository, I can only use the methods without OnClickListener.

    Is it possible to make a new release with these changes?

    opened by wychowanek 2
Releases(1.2.0)
Owner
Evgeny Shishkin
Senior Android Developer
Evgeny Shishkin
Attractive, stylish and customizable toast library for Android.

FabToast min SDK 16 (Jelly Bean 4.1) written in Java To download the demo app for this library from Google Playstore so you can see it in action, clic

Dean Spencer 11 Feb 14, 2022
Android : IamToast Another Toast library for Android

Android : IamToast Another Toast library for Android Warning. toast custom view is deprecated since android 11(R) Setup allprojects { repositories

null 2 Jun 12, 2022
A library that extends the Android toast framework.

SuperToasts Library The SuperToasts library enhances and builds upon the Android Toast class. This library includes support for context sensitive Supe

John Persano 2.7k Dec 29, 2022
An Android Toast replacement, similar to the one seen in the GMail app.

MessageBar An Android Toast replacement, similar to the one seen in the GMail app. Multiple messages can be posted in succession, and each message wil

Simon Vig Therkildsen 555 Nov 25, 2022
🍞 The missing toast library for Android.

Literally Toast ?? A toast library for Android. Usage: ?? Use the LitToast to get lit and show your users a proper toast. LitToast.create(context, "My

David Voiss 229 Nov 25, 2022
Toastie is a customizable Android toast library.

Toastie Getting Started Gradle Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories: Note

Burak Fidan 36 Apr 3, 2021
Android Custom Toast

Super Toast Library Written Purely in Kotlin ❤️ Usual Toast but with super powers!!! ?? A Fully Customised and Customisable Toast. ]( https://android-

null 26 Dec 27, 2022
Android Toast For RTL Applications

RTL-Toast Android library to show Toasts in a pretty RTL way Install Add it in your root build.gradle allprojects { repositories { ... ma

Arash Hatami 15 Nov 16, 2022
Customizable toast message library for Android

Android Custom Toast Message (SnToast) Customizable Toast Message Library For Android Add this in your root build.gradle file allprojects { reposito

null 9 Nov 15, 2021
The usual Toast, but with steroids 💪

Toasty The usual Toast, but with steroids. Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { r

null 6.4k Jan 9, 2023
A really simple library that help you to display a custom toast with many colors (for : success, warning, danger, info, dark, light, primary...etc ), or with rounded corners, or event with image.

CoolToast A really simple library that help you to display a custom toast with many colors (for : success, warning, danger, info, dark, light, primary

null 21 Dec 20, 2022
Simple toast

newlibrary Simple toast Step 1. Add the JitPack repository to your build file allprojects { repositories { ... maven { url 'https://jitpack.io

Aziz Developer 0 Nov 5, 2021
An easy, flexible way to have the toast message displayed.

IToaster Library An easy, flexible way to have the toast message displayed. Download Gradle Add below codes to your root build.gradle file (not your m

Evans Kiptarus Kibet 1 Mar 19, 2022
Custom Toast Library by Google Developer Student Club University of Brawijaya

GDSCToast Custom Toast Library by Google Developer Student Club University of Brawijaya Prerequisites For old version of gradle (before arctic fox upd

Kylix Eza S 6 Sep 15, 2022
MDToast - MaterialDesign Toast library written with Kotlin with lots of extensions to interact easily in contexts

MDToast - MaterialDesign Toast A lightweight Toast library written with Kotlin i

Morteza Omar Mohammady 12 Dec 23, 2022
This custom snack bar will help you display much more personalized app toast

?? Presentation Using the native android class of snack bar. This custom snack bar will help you display much more personalized app

Xavi 4 Dec 8, 2022
Context sensitive notifications for Android

Crouton Context sensitive notifications for Android DEPRECATION NOTICE This library has passed it's prime and is now considered deprecated. With the A

Ben Weiss 3k Dec 28, 2022
Custom toasts with color and icon for Android.

Dynamic Toasts A simple library to display themed toasts with icon and text on Android 2.3 (API 9) and above devices. Since v0.4.0, it uses 26.x.x sup

Pranav Pandey 156 Dec 20, 2022
Balloon 🎈 A lightweight popup like tooltips, fully customizable with arrow and animations.

Balloon ?? A lightweight popup like tooltips, fully customizable with arrow and animations.

Jaewoong Eum 2.8k Jan 2, 2023