Giter Club home page Giter Club logo

crouton's People

Contributors

angeldevil avatar arturdryomov avatar ataulm avatar chrisjenx avatar coreform avatar damianflannery avatar flavioarfaria avatar gabrielittner avatar hameno avatar imminent avatar intrications avatar izzyleung avatar johnjohndoe avatar jtietema avatar keyboardsurfer avatar ligi avatar likebobby avatar mattkranzler5 avatar morphine9 avatar niqo01 avatar rtack avatar scleriot avatar stefanhoth avatar tasomaniac avatar theelfismike avatar writtmeyer 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

crouton's Issues

Crouton vs HoloEverywhere

When using HoloEverywhere Croutons are displayed on whole screen. This occurs even after changing all references to HoloEverywhere classes.

My question is just if you haven't tried Croutons on HoloEverywhere. Thx

Adjust View when Crouton is shown

Not sure if this is possible but an example of what I mean is lets say I have a ListFragment and I display a crouton in the activity that holds the ListFragment. The crouton will cover most of the first item in the list and you cannot scroll or anything to view it. Its not a big problem with croutons that only show for a bit but it is a problem with infinite croutons.

A workaround would be to add a top margin to the view but if there are no croutons then you have this gap of wasted space

Is there any way where the view can be adjusted/shrunk when a crouton appears so that the it does not cover it up like that?

[Bug] Animations use fix value for height

Currently the default in and out animations use -50 offset. This does not consider different densities. For example on my device the height of the view is 58px. So 8 pixel will not be animated and it will result in a jump.

This specially affects custom views, since the height there can be any size.

I already got this fixed here and will send a pull request in a few minutes.

Add setView(View)

Add setView(View) for completely custom Views to the Crouton class.

allow margins for custom action bars and older devices

Hi, I don't use the normal actionbar or the sherlock actionbar but I still have an actionbar and I would like to place the crouton under this bar. As I know its height, I modified the library to add a margin and place the crounton from that height ( I had to change the animation as it was sliding from top to bottom to a fadein/out)

I changed the Crouton.initializeCroutonView() this way:
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, height);
lp.setMargins(0, this.style.marginTopInPixels, 0, 0);
this.croutonView.setLayoutParams(lp);

I set the marginTopInPixels in the style builder (I also modified) and it works for ICS but not for froyo or gingerbread (it still appears on top of the screen without taking into account the margin).

Do you have any idea how to resolve this?

Thanks.

Controlling number of alerts

First of all, I would like to appreciate your work. I think it's a must for a lot of applications, and a big alternative to Toast :-)
I've found that, if you click repeatedly a button, for showing crouton text, it keeps the number of times it has pressed, so if I click 15 times, the alert appears 15 times. It shouldn't be correct, right? You should control if toast is already showing text to user.

Thank you so much!

Why crouton is bound to activity rather than context?

I wonder why croutons are bound to only activities? Why can't we pass contexts? That gives crouton a limitation over toast, they can not be fired from anywhere from application, i.e. Service and broadcasts. Is there any good workaround to use croutons from any class that has visibility to context?

Allow setting the width of a Crouton via Style

It should be possible to display a Crouton, that does not display on the full width of the screen. This is especially relevant for bigger screen devices i.e. tablet or tv.

This should be possible without having to introduce a special layout placeholder for the Crouton.

Include setAnimation in the AnimationsBuilder class

I am sorry I don't know how to commit to a project outside my own deposit, this is the class I use on my own project :

/*
 * Copyright 2012 Benjamin Weiss
 * Copyright 2012 Neofonie Mobile GmbH
 *
 * 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.
 */

package de.neofonie.mobile.app.android.widget.crouton;

import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;

final public class AnimationsBuilder {

    private static Animation slideInDownAnimation, slideOutUpAnimation;

    private static final class SlideInDownAnimationParameters {
        private SlideInDownAnimationParameters() {
        }

        public static final float FROM_X_DELTA = 0;
        public static final float TO_X_DELTA = 0;
        public static final float FROM_Y_DELTA = -50;
        public static final float TO_Y_DELTA = 0;

        public static final long DURATION = 400;
    }

    private static final class SlideOutUpAnimationParameters {
        private SlideOutUpAnimationParameters() {
        }

        public static final float FROM_X_DELTA = 0;
        public static final float TO_X_DELTA = 0;
        public static final float FROM_Y_DELTA = 0;
        public static final float TO_Y_DELTA = -50;

        public static final long DURATION = 400;
    }

    private AnimationsBuilder() {
    }

    public static Animation buildSlideInDownAnimation() {
        if (slideInDownAnimation == null) {
            slideInDownAnimation = new TranslateAnimation(SlideInDownAnimationParameters.FROM_X_DELTA, SlideInDownAnimationParameters.TO_X_DELTA,
                    SlideInDownAnimationParameters.FROM_Y_DELTA, SlideInDownAnimationParameters.TO_Y_DELTA);
            slideInDownAnimation.setDuration(SlideInDownAnimationParameters.DURATION);
        }

        return slideInDownAnimation;
    }

    public static Animation buildSlideOutUpAnimation() {
        if (slideOutUpAnimation == null) {
            slideOutUpAnimation = new TranslateAnimation(SlideOutUpAnimationParameters.FROM_X_DELTA, SlideOutUpAnimationParameters.TO_X_DELTA,
                    SlideOutUpAnimationParameters.FROM_Y_DELTA, SlideOutUpAnimationParameters.TO_Y_DELTA);
            slideOutUpAnimation.setDuration(SlideOutUpAnimationParameters.DURATION);
        }
        return slideOutUpAnimation;
    }

    /**
     * Set Crouton in animation.
     *
     * @param anim the animation to use to make Crouton appear.
     */
    public static void setSlideOutUpAnimation(Animation anim) {
        slideOutUpAnimation = anim;
    }

    /**
     * Set Crouton out animation.
     *
     * @param anim the animation to use to make Crouton disappear.
     */
    public static void setSlideInDownAnimation(Animation anim) {
        slideInDownAnimation = anim;
    }

}

I have added 2 functions and change some class visibility parameters.

I use it like that:

    /**
     * Configure my own animation for Crouton Library
     */
    public static void setMyOwnAnimation(Context mContext){
        Animation inAnimation = AnimationUtils.loadAnimation(mContext,
                R.anim.translate_in);
        inAnimation.setInterpolator(new SmoothInterpolator());
        AnimationsBuilder.setSlideInDownAnimation(inAnimation);
        Animation outAnimation = AnimationUtils.loadAnimation(mContext,
                R.anim.translate_out);
        outAnimation.setInterpolator(new SmoothInterpolator());
        AnimationsBuilder.setSlideOutUpAnimation(outAnimation);
    }

Include code example to show how to create our own Styles without lib modification

It would be something like this:

public class MyStyles {
        public static final Style ALERT;
        public static final Style CONFIRM;
        public static final Style INFO;

        static {
            ALERT = new Style.Builder().setDuration(5000)
                    .setBackgroundColor(R.color.dark_gray)
                    .setTextColor(R.color.clear_gray)
                    .setHeight(ViewGroup.LayoutParams.WRAP_CONTENT)
                    .build();
            CONFIRM = new Style.Builder().setDuration(3000)
                    .setBackgroundColor(R.color.blue)
                    .setTextColor(R.color.clear_gray)
                    .setHeight(ViewGroup.LayoutParams.WRAP_CONTENT)
                    .build();
            INFO = new Style.Builder().setDuration(3000)
                    .setBackgroundColor(R.color.orange)
                    .setTextColor(R.color.dark_gray)
                    .setHeight(ViewGroup.LayoutParams.WRAP_CONTENT)
                    .build();
        }
}

Missing manifest file in new version.

I am not an expert but is it possible that the AndroidManifest.xml file is missing in the latest version of your library? I have problems with importing the project in eclipse and it seems like this could be the cause.

Thank you for your time!

Simplify Style API

It’ll be not a very popular idea I presume.

Style class is large and it’s expanding! There are various parameters: text shadow, text appearance, padding, image scale and more.
My opinion is to remove all stuff in favor of custom view. The parameters that remain (each one includes options for value and resource ID): duration, background color, text color, animations.

Maven Central

Release to a public Maven repo is a way to make usage of the library easier.

Extra resolutions for pixel

A lack of a resolutions was never a big problem for Croutons... until the Pixel. Why not add the resolutions to the chroot if we are running the Pixel. To make it easy to use the display manager to switch. Most 3:2 resolutions work. including 1440x960 and 1920x1280.

I made an xrandr script for those.
http://pastebin.com/NKvgvHzY

Error on building project with Crouton 1.6 dependency

I had to change the pom in Crouton to point to the android-maven-deployer support library dependency, because r11 didn't exist. I don't think this should be a problem, and Crouton installed fine after I made that change. Then I increased my projects dependency from 1.5 to 1.6 and tried to build it. I got this:

Failed to read artifact descriptor for de.keyboardsurfer.android.widget:crouton:jar:1.6: 
Could not find artifact de.keyboardsurfer.android.widget:crouton-parent:pom:1.6 in central (http://repo1.maven.org/maven2)

I've checked my local repository, the 1.5 and 1.6 directories look symmetrical. I used this command to build the library:

mvn -f library/pom.xml clean install

Missing artifact when trying to build library jar with maven

When I try to create the jar using the commands found here (mvn -f library/pom.xml clean package) , I get this error:

1 required artifact is missing. for artifact: de.keyboardsurfer.android.widget:crouton:jar:1.6

I'm musing a freshly installed maven2 under linux:
Apache Maven 2.2.1 (rdebian-8)
Java version: 1.7.0_10

I'm new to maven, but I've doublechecked I issued the right commands with the right paths an all... and yet I get that missing artifact error. Is everything all right with the zip package?

An already built jar in the download would really be appreciated, BTW.

Problem with ListActivity and Crouton

I'm actually working on an app and i want to use the Crouton library. So i decide to replace my Toast by this and all is right. Yet, i discover a problem with my ListActivity. I start an activity which needs internet connection so if it is not the case, i display a Crouton.

And when i display a Crouton i can no longer click on listview items.

ps : I use it with ActionBarSherlock

Update POM for compatibility package

The compatibility package dependency is now changed to :

<dependency>
  <groupId>android.support</groupId>
  <artifactId>compatibility-v4</artifactId>
  <version>11</version>
</dependency>

Please update POM of the project.

use setColorId or similar name instead of setColor

If someone sees the method without knowing the source code, it's possible that he thinks he has to pass the color and not the id. Also lint detects this as an error and suggests to pass a color not an id.

Some methods are declared as private or final, protected would be better

Hi, I use your lib in my app, but I have to rewrite some parts as I want to use on some parts of the lib my own implementation.

By example I have my own animation of appearance and disappearance of the notification, but the method setUpAnimations is declared as private.

Of course I am free to modify the code but I would have preferred to create a class which extends Manager.class and override this method.

In this case, when the lib is updated, I ll have nothing to do. But because I have modified the original class I have to check and search what I ve changed and transfer it to the updated version.

Moreover, it should be facilitate to add style to the Style class, even during the execution (so we can manage kind of themes).

add jar to downloads

It would probably be helpful if you add the jar of the current version to the download section. Not everyone has/uses maven.

Dialog Support

Supporting a dialog as parent would be a nice feature... It's not possible yet, isn't it?

PS: wanted to mark it as a question, but can't find the option for it...

Showing multiple croutons at once [Enhancement]

Something that might be useful (I know I could use it) would be the ability to show multiple croutons at once, one right under another.

In my case this would be useful (especially with infinite croutons) to tell the user that something needs to be synced and if multiple items in my app needs to be synced with the server it shows multiple ones in a stack and they would click on it to sync.

Of course though that brings the possibility of having too many displayed and covering up part of the view so something would have to be implements to handle that case, maybe just limit to 3 croutons at once?

Problem when adding Crouton to pom.xml

Hey, I'm kinda new to Maven and really got hard to make it work with Crouton.
I did what stands on the Wiki Crouton project page, but when I "mvn clean package android:deploy android:run" I get an error.

I can't understand why does it try to
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/de/keyboardsurfer/android/widget/crouton-parent/1.5/crouton-parent-1.5.pom
[INFO]

IntelliJ correctly sees it because I have access to the Classes...

I did :

Building

The build requires Maven. Operations are very simple:

mvn -f library/pom.xml clean package will build jar library;
mvn clean package will build jar library and sample application apk package;
mvn -f library/pom.xml clean install will put Crouton in your local Maven repository.
After putting Crouton in the repository you can add it as a dependency.

crouton 1.5 de.keyboardsurfer.android.widget

AFAIK mvn should use my local repo no ?

Sorry to ask such a (I think) maven newbie question, but I can't find any info on how to get this work...

Need new mode: wait touch for dismiss

I see in Gmail app, its Discard toast looks great:

  • Delete an email
  • The Discard toast appears, and still show in screen until user touches on screen.

Can you create this behavior for Crouton?

Remove manifest from the library

It seems like library could be built without AndroidManifest.xml, because it is only jar and not apklib. I have built library without it and Seismic does it the same way I suggest.

Orientation changes prevent the Crouton queue to be displayed correctly.

If there are a few Croutons within the queue and the device's orientation changes, all Croutons that have not yet been displayed will not be displayed.

Also Croutons that get added to the queue will not be displayed until the pre-orientation change queue has been fully processed.

This issue exists since the initial version of Crouton.

Preferences get redrawn when showing Crouton

Hi,

I noticed that when you are using Croutons in PreferenceActivities the List of Preferences flickers (gets redrawn) when the Crouton appears. Additionally it "scrolls" to top if you were somewhere down in the list.

If you need more details to reproduce, feel free to ask. If I find the time at work I will eventually look into the Crouton code for myself.

Regards,
David

Code style

Guidelines for code style always keep it common everywhere. Checkstyle Maven plugin would be perfect. ActionBarSherlock is an example of project using it.

Improve Crouton hiding

Repost of my message in issue 64

Hi,

Regarding this new feature (indefinit displayed) I tested it in my application this morning.

It works as advertised, no issue with that.... BUT I think there is an API issue here.

To remove it I need to call Crouton.hide(blabla), so I need a click listener and all the stuff... it makes lots of mandatory boiler code.

A good improvement would be a default listener on every Crouton, when you click on a Crouton, whatever is its duration, it disappears. It may also be setAutoDisappear(true/false)...

What do you think about that?

Regards

the demo application doesn't work on pre ICS devices

Thank you for this awesome library!

the demo application doesn't work on pre ICS devices, You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.
this is what I got in the logcat.

I removed "android:theme="@android:style/Theme.Holo.Light.DarkActionBar"" from CroutonDemo activity and added "android:theme="@style/Theme.Sherlock" instead.

many thanks

Create a Builder based on a current Style object

This would ease creating custom Styles. Those could be based on an existing style. Thus clients would only need to call the setter methods for where this second style differs.

public Builder(Style baseStyle) {...}

Allow Crouton to appear from Top/Bottom

I'm raising this, but am currently working on it so will send a pull request.

The idea being that, you can tell the Crouton to appear at the bottom or top of the screen.

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.