Skip to content

Commit

Permalink
Merge pull request #13 from SlaVcE14/1.3.2
Browse files Browse the repository at this point in the history
Add setButtonColor function
  • Loading branch information
SlaVcE14 authored May 16, 2022
2 parents de1f5b0 + d7f7cfa commit 369f8a1
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
4 changes: 2 additions & 2 deletions SJDialog/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {

defaultConfig {
minSdk 23
versionCode 8
versionName "1.3.1"
versionCode 9
versionName "1.3.2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ public MessageDialog setButtonBackgroundResource(int drawable){
button.setBackgroundResource(drawable);
return this;
}
/**
* Set button color.
* @param color Color to use for tinting this drawable
* @return current class
* */
public MessageDialog setButtonColor(int color){
button.getBackground().setTint(color);
return this;
}

public Button getButton() {
return button;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.ColorInt;

import com.sjapps.library.R;

/**
Expand Down Expand Up @@ -211,6 +215,36 @@ public SetupDialog setDialogBackgroundResource(int drawable){
background.setBackgroundResource(drawable);
return this;
}
/**
* Set background color for all buttons.
* @param color Color to use for tinting buttons
* @return current class
* */
public SetupDialog setButtonsColor(int color){
button1.getBackground().setTint(color);
button2.getBackground().setTint(color);
return this;
}

/**
* Set background color for left button.
* @param color Color to use for tinting this drawable
* @return current class
* */
public SetupDialog setLeftButtonColor(int color){
button1.getBackground().setTint(color);
return this;
}
/**
* Set background color for right button.
* @param color Color to use for tinting this drawable
* @return current class
* */
public SetupDialog setRightButtonColor(int color){
button2.getBackground().setTint(color);
return this;
}

/**
* Set onClick listener for both buttons
* @param dialogButtonEvents dialog button events
Expand Down

0 comments on commit 369f8a1

Please sign in to comment.