Skip to content

Commit

Permalink
- Added the functionality to update the title and description text color
Browse files Browse the repository at this point in the history
  • Loading branch information
Shashank02051997 committed Jul 1, 2021
1 parent a6238d8 commit cb944ad
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 19 deletions.
6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Add this to your module's `build.gradle` file (make sure the version matches the
```gradle
dependencies {
...
implementation 'com.github.Shashank02051997:FancyGifDialog-Android:1.3'
implementation 'com.github.Shashank02051997:FancyGifDialog-Android:1.4'
}
```
## Fancy Gif Dialog
Expand All @@ -42,6 +42,8 @@ Dialog with two buttons:
new FancyGifDialog.Builder(this)
.setTitle("Granny eating chocolate dialog box") // You can also send title like R.string.from_resources
.setMessage("This is a granny eating chocolate dialog box. This library is used to help you easily create fancy gify dialog.") // or pass like R.string.description_from_resources
.setTitleTextColor(R.color.titleText)
.setDescriptionTextColor(R.color.descriptionText)
.setNegativeBtnText("Cancel") // or pass it like android.R.string.cancel
.setPositiveBtnBackground("#FF4081") // or pass it like R.color.positiveButton
.setPositiveBtnText("Ok") // or pass it like android.R.string.ok
Expand Down Expand Up @@ -69,6 +71,8 @@ Dialog with one button:
new FancyGifDialog.Builder(this)
.setTitle("Granny eating chocolate dialog box")
.setMessage("This is a granny eating chocolate dialog box. This library is used to help you easily create fancy gify dialog.")
.setTitleTextColor(R.color.titleText)
.setDescriptionTextColor(R.color.descriptionText)
.setPositiveBtnText("Ok")
.setPositiveBtnBackground("#FF4081")
.setGifResource(R.drawable.gif1) //Pass your Gif here
Expand Down
10 changes: 5 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation project(':fancygifdialoglib')
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public void onClick(View view) {
.setTitle("Granny eating chocolate dialog box")
.setMessage("This is a granny eating chocolate dialog box. This library is used to help you easily create fancy gify dialog.")
.setNegativeBtnText("Cancel")
.setTitleTextColor(R.color.titleText)
.setDescriptionTextColor(R.color.descriptionText)
.setPositiveBtnBackground(R.color.positiveButton)
.setPositiveBtnText("Ok")
.setNegativeBtnBackground(R.color.negativeButton)
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>

<color name="titleText">#000000</color>
<color name="descriptionText">#777777</color>
<color name="positiveButton">#FF4081</color>
<color name="negativeButton">#A9A7A8</color>

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.android.tools.build:gradle:4.0.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'

// NOTE: Do not place your application dependencies here; they belong
Expand Down
8 changes: 4 additions & 4 deletions fancygifdialoglib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
//noinspection GradleCompatible
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.10'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class FancyGifDialog {
private String title, message, positiveBtnText, negativeBtnText;
@ColorRes
private int pBtnColor, nBtnColor;
@ColorRes
private int titleTxtColor, desTxtColor;
private Context context;
private FancyGifDialogListener pListener, nListener;
private Dialog.OnCancelListener cancelListener;
Expand All @@ -38,6 +40,8 @@ private FancyGifDialog(Builder builder) {
this.context = builder.context;
this.pListener = builder.pListener;
this.nListener = builder.nListener;
this.titleTxtColor = builder.titleTxtColor;
this.desTxtColor = builder.desTxtColor;
this.pBtnColor = builder.pBtnColor;
this.nBtnColor = builder.nBtnColor;
this.positiveBtnText = builder.positiveBtnText;
Expand All @@ -52,6 +56,7 @@ public static class Builder {
private String title, message, positiveBtnText, negativeBtnText;
@ColorRes
private int pBtnColor, nBtnColor;
private int titleTxtColor, desTxtColor;
private Context context;
private FancyGifDialogListener pListener, nListener;
private boolean cancel;
Expand Down Expand Up @@ -81,6 +86,16 @@ public Builder setMessage(@StringRes int message) {
return setMessage(context.getString(message));
}

public Builder setTitleTextColor(@ColorRes int titleTxtColor) {
this.titleTxtColor = titleTxtColor;
return this;
}

public Builder setDescriptionTextColor(@ColorRes int desTxtColor) {
this.desTxtColor = desTxtColor;
return this;
}

public Builder setPositiveBtnText(String positiveBtnText) {
this.positiveBtnText = positiveBtnText;
return this;
Expand Down Expand Up @@ -151,15 +166,19 @@ public FancyGifDialog build() {


//getting resources
title1 = (TextView) dialog.findViewById(R.id.title);
message1 = (TextView) dialog.findViewById(R.id.message);
nBtn = (Button) dialog.findViewById(R.id.negativeBtn);
pBtn = (Button) dialog.findViewById(R.id.positiveBtn);
title1 = dialog.findViewById(R.id.title);
message1 = dialog.findViewById(R.id.message);
nBtn = dialog.findViewById(R.id.negativeBtn);
pBtn = dialog.findViewById(R.id.positiveBtn);
gifImageView = dialog.findViewById(R.id.gifImageView);
gifImageView.setImageResource(gifImageResource);

title1.setText(title);
message1.setText(message);

title1.setTextColor(ContextCompat.getColor(context, titleTxtColor));
message1.setTextColor(ContextCompat.getColor(context, desTxtColor));

if (positiveBtnText != null)
pBtn.setText(positiveBtnText);
if (negativeBtnText != null)
Expand Down

0 comments on commit cb944ad

Please sign in to comment.