Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
kpmmmurphy authored Apr 20, 2017
2 parents 78f258d + 255d453 commit f2a6c2d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
23 changes: 23 additions & 0 deletions alerter/src/main/java/com/tapadoo/alerter/Alert.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.ColorInt;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
Expand Down Expand Up @@ -274,6 +275,28 @@ public void setAlertBackgroundColor(@ColorInt final int color) {
flBackground.setBackgroundColor(color);
}

/**
* Sets the Alert Background Drawable Resource
*
* @param resource The qualified drawable integer
*/
public void setAlertBackgroundResource(@DrawableRes final int resource) {
flBackground.setBackgroundResource(resource);
}

/**
* Sets the Alert Background Drawable
*
* @param drawable The qualified drawable
*/
public void setAlertBackgroundDrawable(final Drawable drawable) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
flBackground.setBackground(drawable);
} else {
flBackground.setBackgroundDrawable(drawable);
}
}

/**
* Sets the Title of the Alert
*
Expand Down
29 changes: 29 additions & 0 deletions alerter/src/main/java/com/tapadoo/alerter/Alerter.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
Expand Down Expand Up @@ -182,6 +183,34 @@ public Alerter setBackgroundColor(@ColorRes final int colorResId) {
return this;
}

/**
* Set the Alert's Background Drawable
*
* @param drawable Drawable
* @return This Alerter
*/
public Alerter setBackgroundDrawable(final Drawable drawable) {
if (getAlert() != null) {
getAlert().setAlertBackgroundDrawable(drawable);
}

return this;
}

/**
* Set the Alert's Background Drawable Resource
*
* @param drawableResId Drawable Resource Id
* @return This Alerter
*/
public Alerter setBackgroundResource(@DrawableRes final int drawableResId) {
if (getAlert() != null) {
getAlert().setAlertBackgroundResource(drawableResId);
}

return this;
}

/**
* Set the Alert's Icon
*
Expand Down

0 comments on commit f2a6c2d

Please sign in to comment.