From 434a6aabe3c43c417e5a1e22f5a7465d31ffecdf Mon Sep 17 00:00:00 2001 From: Kishan Jadav Date: Tue, 11 Dec 2018 09:32:36 +0200 Subject: [PATCH] v1.2.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Fixed the spacing between Positive and Negative buttons when added programatically. --- app/build.gradle | 2 +- superdialog/build.gradle | 4 ++-- .../superdialog/SuperDialog.java | 24 ++++++++++++++++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3fccfbb..ef83290 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,7 +7,7 @@ android { minSdkVersion 17 targetSdkVersion 28 versionCode 1 - versionName "v1.2.1" + versionName "v1.2.2" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/superdialog/build.gradle b/superdialog/build.gradle index dea6a8a..2e6cdd5 100644 --- a/superdialog/build.gradle +++ b/superdialog/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'com.github.dcendents.android-maven' group = 'com.github.kishannareshpal' -version = 'v1.2.1' +version = 'v1.2.2' android { compileSdkVersion 28 @@ -12,7 +12,7 @@ android { minSdkVersion 17 targetSdkVersion 28 versionCode 1 - versionName "v1.2.1" + versionName "v1.2.2" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" diff --git a/superdialog/src/main/java/com/kishannareshpal/superdialog/SuperDialog.java b/superdialog/src/main/java/com/kishannareshpal/superdialog/SuperDialog.java index c0c859f..c598c9e 100644 --- a/superdialog/src/main/java/com/kishannareshpal/superdialog/SuperDialog.java +++ b/superdialog/src/main/java/com/kishannareshpal/superdialog/SuperDialog.java @@ -217,9 +217,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c changeMessageGravity(gravity); // Add space between positive and negative button when both are visible. - if (negativeText != null && positiveText != null){ - space.setVisibility(View.VISIBLE); - } + addSpaceBetweenButtons(); // Setup Positive Button changePositiveText(positiveText); @@ -254,6 +252,13 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c + // Setup Space between buttons + private void addSpaceBetweenButtons(){ + if (negativeText != null && positiveText != null){ + space.setVisibility(View.VISIBLE); + } + } + // Setup Cancelable private void changeCancelable(boolean cancelable){ setCancelable(cancelable); @@ -265,6 +270,12 @@ private void changePositiveText(String positiveText){ btn_positive.setVisibility(View.VISIBLE); btn_positive.setText(positiveText); + if (negativeText != null){ + space.setVisibility(View.VISIBLE); + } else { + space.setVisibility(View.GONE); + } + } else { btn_positive.setVisibility(View.GONE); } @@ -309,6 +320,13 @@ private void changeNegativeText(String negativeText){ if (negativeText != null){ btn_negative.setVisibility(View.VISIBLE); btn_negative.setText(negativeText); + + if (positiveText != null){ + space.setVisibility(View.VISIBLE); + } else { + space.setVisibility(View.GONE); + } + } else { btn_negative.setVisibility(View.GONE); }