Skip to content

Commit

Permalink
Update Custom Button AAR
Browse files Browse the repository at this point in the history
*Update Custom Button AAR with customizable stroke color.
*Update button drawables to have selector states.
  • Loading branch information
rayliverified committed Jul 7, 2017
1 parent cdcdbeb commit 4b2cb94
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 6 deletions.
Binary file modified custombutton/custombutton.aar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ private void initPermissionsButton(View view) {
if (builder.getRequiredRequestPermissions().size() == 0)
{
mButton.setText("Continue");
mButton.setBackground(ContextCompat.getDrawable(mContext, R.drawable.icon_add_activated));
mButton.setBackground(ContextCompat.getDrawable(mContext, R.drawable.icon_add_activated_selector));
if (builder.getOnContinueClicked() != null)
{
mButton.setOnClickListener(new View.OnClickListener() {
Expand Down Expand Up @@ -339,7 +339,7 @@ private void refreshPermissionsButton(boolean denied)
if (denied)
{
mButton.setText("DENIED - Open Settings");
mButton.setBackground(ContextCompat.getDrawable(mContext, R.drawable.icon_add_error));
mButton.setBackground(ContextCompat.getDrawable(mContext, R.drawable.icon_add_error_selector));
mButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Expand All @@ -356,7 +356,7 @@ public void onClick(View view) {
else if (builder.getRequiredRequestPermissions().size() == 0)
{
mButton.setText("Success!");
mButton.setBackground(ContextCompat.getDrawable(mContext, R.drawable.icon_add_activated));
mButton.setBackground(ContextCompat.getDrawable(mContext, R.drawable.icon_add_activated_selector));
if (builder.getOnContinueClicked() != null)
{
mButton.setOnClickListener(new View.OnClickListener() {
Expand Down Expand Up @@ -393,7 +393,7 @@ public void run() {
}
else {
mButton.setText("Permission Denied");
mButton.setBackground(ContextCompat.getDrawable(mContext, R.drawable.icon_add_error));
mButton.setBackground(ContextCompat.getDrawable(mContext, R.drawable.icon_add_error_selector));
mButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Expand Down Expand Up @@ -1099,8 +1099,8 @@ public void setRequestPermissions(final String requestPermission)
if (optional) {
mButton.setText("Active");
mButton.setColor(ContextCompat.getColor(mContext, R.color.white), ContextCompat.getColor(mContext, R.color.white),
ContextCompat.getColor(mContext, R.color.green_light), ContextCompat.getColor(mContext, R.color.green), ContextCompat.getColor(mContext, R.color.green));
mButton.setButtonStatus(true);
ContextCompat.getColor(mContext, R.color.green), ContextCompat.getColor(mContext, R.color.green_light),
ContextCompat.getColor(mContext, R.color.green), ContextCompat.getColor(mContext, R.color.green_light));
mButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners
android:topLeftRadius="20dp"
android:topRightRadius="20dp"
android:bottomLeftRadius="20dp"
android:bottomRightRadius="20dp"/>
<solid android:color="@color/green_light"/>
</shape>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/icon_add_activated_pressed"/>
<item android:state_focused="true" android:drawable="@drawable/icon_add_activated_pressed"/>
<item android:drawable="@drawable/icon_add_activated"/>
</selector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners
android:topLeftRadius="20dp"
android:topRightRadius="20dp"
android:bottomLeftRadius="20dp"
android:bottomRightRadius="20dp"/>
<solid android:color="@color/red_light"/>
</shape>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/icon_add_error_pressed"/>
<item android:state_focused="true" android:drawable="@drawable/icon_add_error_pressed"/>
<item android:drawable="@drawable/icon_add_error"/>
</selector>
1 change: 1 addition & 0 deletions custompermissionsdialogue/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<color name="green">#15CC87</color>
<color name="green_light">#1affa7</color>
<color name="red">#FE5442</color>
<color name="red_light">#ff6c5c</color>
<color name="blue">#008af9</color>
<color name="blue_light">#4dafff</color>
</resources>

0 comments on commit 4b2cb94

Please # to comment.