Skip to content

Commit

Permalink
Merge pull request Tapadoo#32 from riclage/show-icon
Browse files Browse the repository at this point in the history
Add option to show/hide the icon
  • Loading branch information
kpmmmurphy authored Mar 6, 2017
2 parents a87db76 + d14dfd7 commit 5a562c8
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Change Log
All notable changes to this project will be documented in this file.

## 1.0.5 - 2017-03-06
* Add ability to hide the icon.

## 1.0.3 - 2017-02-21
- Back Ported to API Level 9
- Updated BinTray uploading in build script
Expand Down
2 changes: 1 addition & 1 deletion alerter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ apply plugin: "maven-publish"
apply from: rootProject.file('quality.gradle')

def final String PACKAGE_NAME = "com.tapadoo.android"
def final String VERSION = "1.0.4"
def final String VERSION = "1.0.5"
def final String DESCRIPTION = "An Android Alerting Library"
def final String GITHUB_URL = "https://github.com/Tapadoo/Alerter"

Expand Down
11 changes: 10 additions & 1 deletion alerter/src/main/java/com/tapadoo/alerter/Alert.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public void onAnimationStart(final Animation animation) {
@Override
public void onAnimationEnd(final Animation animation) {
//Start the Icon Animation once the Alert is settled
if (enableIconPulse) {
if (enableIconPulse && ivIcon.getVisibility() == VISIBLE) {
try {
ivIcon.startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.alerter_pulse));
} catch (Exception ex) {
Expand Down Expand Up @@ -341,6 +341,15 @@ public void setIcon(@DrawableRes final int iconId) {
ivIcon.setImageDrawable(iconDrawable);
}

/**
* Set whether to show the icon in the alert or not
*
* @param showIcon True to show the icon, false otherwise
*/
public void showIcon(final boolean showIcon) {
ivIcon.setVisibility(showIcon ? View.VISIBLE : View.GONE);
}

/**
* Get the Alert's on screen duration
*
Expand Down
13 changes: 13 additions & 0 deletions alerter/src/main/java/com/tapadoo/alerter/Alerter.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,19 @@ public Alerter enableIconPulse(final boolean pulse) {
return this;
}

/**
* Set whether to show the icon in the alert or not
*
* @param showIcon True to show the icon, false otherwise
* @return This Alerter
*/
public Alerter showIcon(final boolean showIcon) {
if (getAlert() != null) {
getAlert().showIcon(showIcon);
}
return this;
}

/**
* Enable or disable infinite duration of the alert
*
Expand Down

0 comments on commit 5a562c8

Please sign in to comment.