Giter Site home page Giter Site logo

johnkil / android-appmsg Goto Github PK

View Code? Open in Web Editor NEW
1.4K 90.0 399.0 705 KB

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

Home Page: http://johnkil.github.com/Android-AppMsg

License: Apache License 2.0

Java 100.00%
android toast crouton snackbar

android-appmsg's Introduction

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.

android-appmsg's People

Contributors

atermenji avatar dreamer0924 avatar eveliotc avatar fernandocamargoai avatar gipi avatar johnkil avatar mcutler81 avatar technowasim3 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  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

android-appmsg's Issues

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?

Crouton appearing offscreen

I use croutons for EditText validation. When I select an EditText which is close to the bottom of the screen, there is an automatic "scroll down" so that the on-screen keyboard appears just below the active EditText. This "scrolling down" prevents the crouton from being displayed - it is displayed at the very top, offscreen.

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?

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?

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.

Support for orientation/configuration changes

As shown in the sample app, any messages that are currently displayed (or queued) are lost on orientation changes. Although this certainly is not a simple case to address, it seems like a fairly large limitation of this library's architecture.

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?

Android 4.4 KitKat translucent system bar issues

If you use the translucent status bar on Android 4.4 KitKat with the android:fitsSystemWindows theme attribute, AppMsges are shown above the action bar in the status bar area and you can't see much of them.

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

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.

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.