diff --git a/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Button.java b/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Button.java index db24638..a3171b2 100644 --- a/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Button.java +++ b/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Button.java @@ -30,7 +30,7 @@ public abstract class Button extends CustomView { OnClickListener onClickListener; boolean clickAfterRipple = true; int backgroundColor = Color.parseColor("#1E88E5"); - TextView textButton; + public Button(Context context, AttributeSet attrs) { super(context, attrs); @@ -181,19 +181,11 @@ public float getRippleSpeed() { return this.rippleSpeed; } - public void setText(String text) { - textButton.setText(text); - } + public abstract void setText(String text); - public void setTextColor(int color) { - textButton.setTextColor(color); - } + public abstract void setTextColor(int color); - public TextView getTextView() { - return textButton; - } + public abstract TextView getTextView(); - public String getText() { - return textButton.getText().toString(); - } + public abstract String getText(); } diff --git a/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFlat.java b/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFlat.java index b1664c9..de89d26 100644 --- a/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFlat.java +++ b/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFlat.java @@ -96,10 +96,7 @@ protected int makePressColor(){ return Color.parseColor("#88DDDDDD"); } - public void setText(String text){ - textButton.setText(text.toUpperCase()); - } - + // Set color of background public void setBackgroundColor(int color){ backgroundColor = color; @@ -117,4 +114,13 @@ public String getText(){ return textButton.getText().toString(); } + public void setText(String text){ + textButton.setText(text.toUpperCase()); + } + + @Override + public void setTextColor(int color) { + textButton.setTextColor(color); + } + } diff --git a/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFloat.java b/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFloat.java index b4970b9..5d4299f 100644 --- a/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFloat.java +++ b/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFloat.java @@ -11,6 +11,7 @@ import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; +import android.graphics.PorterDuff; import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuffXfermode; import android.graphics.Rect; @@ -18,7 +19,10 @@ import android.graphics.drawable.Drawable; import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.LayerDrawable; +import android.support.annotation.ColorInt; +import android.support.v4.view.TintableBackgroundView; import android.util.AttributeSet; +import android.util.Log; import android.view.animation.BounceInterpolator; import android.widget.ImageView; import android.widget.ImageView.ScaleType; @@ -175,11 +179,6 @@ public Bitmap cropCircle(Bitmap bitmap) { return output; } - @Override - public TextView getTextView() { - return null; - } - public void setRippleColor(int rippleColor) { this.rippleColor = rippleColor; } @@ -205,5 +204,30 @@ public void hide(){ public boolean isShow(){ return isShow; } + + @Override + public TextView getTextView() { + Log.e("ButtonFloat", "getTextView() - no text view on float button"); + return null; + } + + @Override + public String getText() { + Log.e("ButtonFloat", "getText() - no text view on float button"); + return null; + } + + @Override + public void setText(String text) { + Log.e("ButtonFloat", "ButtonFloat does not have a text"); + } + + @Override + public void setTextColor(int color) { + if (drawableIcon != null){ + Log.w("ButtonFloat", "ButtonFloat does not have a text, will try to tint image, but make sure this is what you want"); + drawableIcon.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); + } + } } diff --git a/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonRectangle.java b/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonRectangle.java index e261c7d..b61eb66 100644 --- a/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonRectangle.java +++ b/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonRectangle.java @@ -146,5 +146,25 @@ protected void onDraw(Canvas canvas) { invalidate(); } } + + @Override + public void setText(String text) { + textButton.setText(text); + } + + @Override + public void setTextColor(int color) { + textButton.setTextColor(color); + } + + @Override + public TextView getTextView() { + return textButton; + } + + @Override + public String getText() { + return textButton.getText().toString(); + } } diff --git a/MaterialDesignLibrary/build.gradle b/MaterialDesignLibrary/build.gradle index 7a979d7..a09d8fa 100644 --- a/MaterialDesignLibrary/build.gradle +++ b/MaterialDesignLibrary/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.+' + classpath 'com.android.tools.build:gradle:2.2.0' // COMMENT TO DEVELOPER MODE / UNCOMMENT TO UPLOAD TO BINTARRAY // classpath 'org.codehaus.groovy:groovy-backports-compat23:2.3.5' // classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0' diff --git a/MaterialDesignLibrary/gradle/wrapper/gradle-wrapper.properties b/MaterialDesignLibrary/gradle/wrapper/gradle-wrapper.properties index 707f4c9..c859f42 100644 --- a/MaterialDesignLibrary/gradle/wrapper/gradle-wrapper.properties +++ b/MaterialDesignLibrary/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sat Aug 22 18:02:59 CEST 2015 +#Sun Sep 25 06:58:35 CEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip