Skip to content

Commit

Permalink
Merge pull request #12 from ahmmedrejowan/master
Browse files Browse the repository at this point in the history
Minor Changes
  • Loading branch information
ahmmedrejowan authored Oct 24, 2022
2 parents d64d519 + e42e07e commit c585366
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 43 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
.externalNativeBuild
.cxx
local.properties
/.idea/intellij-javadocs-4.0.1.xml
/.idea/.name
6 changes: 6 additions & 0 deletions .idea/misc.xml

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

Original file line number Diff line number Diff line change
Expand Up @@ -1573,7 +1573,7 @@ public withImage setPrimaryColor(int primaryColor) {

}

public static class withAnim extends Dialog {
public static class withAnimation extends Dialog {

Context context;

Expand All @@ -1583,7 +1583,7 @@ public static class withAnim extends Dialog {
boolean isPositiveColorChanged = false;
boolean isNegativeColorChanged = false;

public withAnim(Context context) {
public withAnimation(Context context) {
super(context);
this.context = context;
binding = CuteDialogMainLayoutBinding.inflate(LayoutInflater.from(context));
Expand Down Expand Up @@ -1661,7 +1661,7 @@ private void init() {
}


public withAnim setDialogBackgroundColor(int bgColor) {
public withAnimation setDialogBackgroundColor(int bgColor) {
if (bgColor != 0) {
try {
binding.wholeCard.setCardBackgroundColor(ContextCompat.getColor(context, bgColor));
Expand All @@ -1672,14 +1672,14 @@ public withAnim setDialogBackgroundColor(int bgColor) {
return this;
}

public withAnim setDialogRadius(int cornerRadius) {
public withAnimation setDialogRadius(int cornerRadius) {
if (cornerRadius != 0) {
binding.wholeCard.setRadius(cornerRadius * 4);
}
return this;
}

public withAnim setDialogPosition(int dialogPosition) {
public withAnimation setDialogPosition(int dialogPosition) {
if (dialogPosition == 1) {
getWindow().setGravity(Gravity.CENTER);
} else if (dialogPosition == 2) {
Expand All @@ -1692,7 +1692,7 @@ public withAnim setDialogPosition(int dialogPosition) {
return this;
}

public withAnim setPadding(int padding) {
public withAnimation setPadding(int padding) {
if (padding != 0) {
binding.padding1.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, padding * 4));
binding.padding2.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, padding * 2));
Expand All @@ -1705,7 +1705,7 @@ public withAnim setPadding(int padding) {
}


public withAnim setAnimation(int animation) {
public withAnimation setAnimation(int animation) {
try {
binding.mainAnimation.setAnimation(animation);
} catch (Resources.NotFoundException e) {
Expand All @@ -1716,25 +1716,25 @@ public withAnim setAnimation(int animation) {
}


public withAnim isCancelable(boolean cancelable) {
public withAnimation isCancelable(boolean cancelable) {
setCancelable(cancelable);
return this;
}


public withAnim setTitle(String string) {
public withAnimation setTitle(String string) {
binding.titleText.setText(string);
return this;
}

public withAnim setTitleTextSize(int textSizeInSP) {
public withAnimation setTitleTextSize(int textSizeInSP) {
if (textSizeInSP != 0) {
binding.titleText.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSizeInSP);
}
return this;
}

public withAnim setTitleTextColor(int textColor) {
public withAnimation setTitleTextColor(int textColor) {
if (textColor != 0) {
try {
binding.titleText.setTextColor(ContextCompat.getColor(context, textColor));
Expand All @@ -1746,7 +1746,7 @@ public withAnim setTitleTextColor(int textColor) {
return this;
}

public withAnim setTitleTextStyle(int textStyle) {
public withAnimation setTitleTextStyle(int textStyle) {
if (textStyle == 1) {
binding.titleText.setTypeface(binding.titleText.getTypeface(), Typeface.NORMAL);
} else if (textStyle == 2) {
Expand All @@ -1762,19 +1762,19 @@ public withAnim setTitleTextStyle(int textStyle) {
}


public withAnim setDescription(String descText) {
public withAnimation setDescription(String descText) {
binding.descText.setText(descText);
return this;
}

public withAnim setDescriptionTextSize(int textSizeInSP) {
public withAnimation setDescriptionTextSize(int textSizeInSP) {
if (textSizeInSP != 0) {
binding.descText.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSizeInSP);
}
return this;
}

public withAnim setDescriptionTextColor(int textColor) {
public withAnimation setDescriptionTextColor(int textColor) {
if (textColor != 0) {
try {
binding.descText.setTextColor(ContextCompat.getColor(context, textColor));
Expand All @@ -1785,7 +1785,7 @@ public withAnim setDescriptionTextColor(int textColor) {
return this;
}

public withAnim setDescriptionTextStyle(int textStyle) {
public withAnimation setDescriptionTextStyle(int textStyle) {

if (textStyle == 1) {
binding.descText.setTypeface(binding.descText.getTypeface(), Typeface.NORMAL);
Expand All @@ -1802,7 +1802,7 @@ public withAnim setDescriptionTextStyle(int textStyle) {
}


public withAnim setPositiveButtonText(String string, View.OnClickListener listener) {
public withAnimation setPositiveButtonText(String string, View.OnClickListener listener) {
binding.positiveText.setText(string);
binding.positiveButton.setOnClickListener(v -> {
listener.onClick(v);
Expand All @@ -1811,7 +1811,7 @@ public withAnim setPositiveButtonText(String string, View.OnClickListener listen
return this;
}

public withAnim setPositiveButtonTextColor(int textColor) {
public withAnimation setPositiveButtonTextColor(int textColor) {
if (textColor != 0) {
try {
binding.positiveText.setTextColor(ContextCompat.getColor(context, textColor));
Expand All @@ -1822,7 +1822,7 @@ public withAnim setPositiveButtonTextColor(int textColor) {
return this;
}

public withAnim setPositiveButtonTextStyle(int textStyle) {
public withAnimation setPositiveButtonTextStyle(int textStyle) {
if (textStyle == 1) {
binding.positiveText.setTypeface(binding.positiveText.getTypeface(), Typeface.NORMAL);
} else if (textStyle == 2) {
Expand All @@ -1838,15 +1838,15 @@ public withAnim setPositiveButtonTextStyle(int textStyle) {
return this;
}

public withAnim setPositiveButtonTextSize(int textSizeInSP) {
public withAnimation setPositiveButtonTextSize(int textSizeInSP) {
if (textSizeInSP != 0) {
binding.positiveText.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSizeInSP);
}
return this;
}


public withAnim setPositiveButtonColor(int bgColorOfButton) {
public withAnimation setPositiveButtonColor(int bgColorOfButton) {
if (bgColorOfButton != 0) {
try {
binding.positiveButton.setCardBackgroundColor(ContextCompat.getColor(context, bgColorOfButton));
Expand All @@ -1858,14 +1858,14 @@ public withAnim setPositiveButtonColor(int bgColorOfButton) {
return this;
}

public withAnim setPositiveButtonRadius(int radiusOfButton) {
public withAnimation setPositiveButtonRadius(int radiusOfButton) {
if (radiusOfButton != 0) {
binding.positiveButton.setRadius(radiusOfButton * 4);
}
return this;
}

public withAnim setPositiveButtonBorderColor(int borderColor) {
public withAnimation setPositiveButtonBorderColor(int borderColor) {
if (borderColor != 0) {
try {
binding.positiveButton.setStrokeColor(ContextCompat.getColor(context, borderColor));
Expand All @@ -1878,15 +1878,15 @@ public withAnim setPositiveButtonBorderColor(int borderColor) {
return this;
}

public withAnim setPositiveButtonBorderWidth(int borderWidth) {
public withAnimation setPositiveButtonBorderWidth(int borderWidth) {
if (borderWidth != 0) {
binding.positiveButton.setStrokeWidth(borderWidth);
}
return this;
}


public withAnim setNegativeButtonText(String string, View.OnClickListener listener) {
public withAnimation setNegativeButtonText(String string, View.OnClickListener listener) {
binding.negativeText.setText(string);
binding.negativeButton.setOnClickListener(v -> {
listener.onClick(v);
Expand All @@ -1895,7 +1895,7 @@ public withAnim setNegativeButtonText(String string, View.OnClickListener listen
return this;
}

public withAnim setNegativeButtonTextColor(int textColor) {
public withAnimation setNegativeButtonTextColor(int textColor) {
if (textColor != 0) {
try {
binding.negativeText.setTextColor(ContextCompat.getColor(context, textColor));
Expand All @@ -1906,7 +1906,7 @@ public withAnim setNegativeButtonTextColor(int textColor) {
return this;
}

public withAnim setNegativeButtonTextStyle(int textStyle) {
public withAnimation setNegativeButtonTextStyle(int textStyle) {
if (textStyle == 1) {
binding.negativeText.setTypeface(binding.negativeText.getTypeface(), Typeface.NORMAL);
} else if (textStyle == 2) {
Expand All @@ -1921,15 +1921,15 @@ public withAnim setNegativeButtonTextStyle(int textStyle) {
return this;
}

public withAnim setNegativeButtonTextSize(int textSizeInSP) {
public withAnimation setNegativeButtonTextSize(int textSizeInSP) {
if (textSizeInSP != 0) {
binding.negativeText.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSizeInSP);
}
return this;
}


public withAnim setNegativeButtonColor(int bgColorOfButton) {
public withAnimation setNegativeButtonColor(int bgColorOfButton) {
if (bgColorOfButton != 0) {
try {
binding.negativeButton.setCardBackgroundColor(ContextCompat.getColor(context, bgColorOfButton));
Expand All @@ -1940,15 +1940,15 @@ public withAnim setNegativeButtonColor(int bgColorOfButton) {
return this;
}

public withAnim setNegativeButtonRadius(int radiusOfButton) {
public withAnimation setNegativeButtonRadius(int radiusOfButton) {
if (radiusOfButton != 0) {
binding.negativeButton.setRadius(radiusOfButton * 4);

}
return this;
}

public withAnim setNegativeButtonBorderColor(int borderColor) {
public withAnimation setNegativeButtonBorderColor(int borderColor) {
if (borderColor != 0) {
try {
binding.negativeButton.setStrokeColor(ContextCompat.getColor(context, borderColor));
Expand All @@ -1962,15 +1962,15 @@ public withAnim setNegativeButtonBorderColor(int borderColor) {
return this;
}

public withAnim setNegativeButtonBorderWidth(int borderWidth) {
public withAnimation setNegativeButtonBorderWidth(int borderWidth) {
if (borderWidth != 0) {
binding.negativeButton.setStrokeWidth(borderWidth);
}
return this;
}


public withAnim hideCloseIcon(boolean bool) {
public withAnimation hideCloseIcon(boolean bool) {
if (bool) {
binding.closeIcon.setVisibility(View.GONE);
} else {
Expand All @@ -1980,7 +1980,7 @@ public withAnim hideCloseIcon(boolean bool) {

}

public withAnim hideTitle(boolean bool) {
public withAnimation hideTitle(boolean bool) {
if (bool) {
binding.titleText.setVisibility(View.GONE);
} else {
Expand All @@ -1989,7 +1989,7 @@ public withAnim hideTitle(boolean bool) {
return this;
}

public withAnim hideDescription(boolean bool) {
public withAnimation hideDescription(boolean bool) {
if (bool) {
binding.descText.setVisibility(View.GONE);
} else {
Expand All @@ -1998,7 +1998,7 @@ public withAnim hideDescription(boolean bool) {
return this;
}

public withAnim hidePositiveButton(boolean bool) {
public withAnimation hidePositiveButton(boolean bool) {
if (bool) {
binding.positiveButton.setVisibility(View.GONE);
binding.padding4.setVisibility(View.GONE);
Expand All @@ -2008,7 +2008,7 @@ public withAnim hidePositiveButton(boolean bool) {
return this;
}

public withAnim hideNegativeButton(boolean bool) {
public withAnimation hideNegativeButton(boolean bool) {

if (bool) {
binding.negativeButton.setVisibility(View.GONE);
Expand All @@ -2022,15 +2022,15 @@ public withAnim hideNegativeButton(boolean bool) {

}

public withAnim setCloseIconListener(View.OnClickListener listener) {
public withAnimation setCloseIconListener(View.OnClickListener listener) {
binding.closeIcon.setOnClickListener(v -> {
listener.onClick(v);
dismiss();
});
return this;
}

public withAnim setCloseIcon(int iconResID) {
public withAnimation setCloseIcon(int iconResID) {
if (iconResID != 0) {
try {
binding.closeIcon.setImageResource(iconResID);
Expand All @@ -2041,7 +2041,7 @@ public withAnim setCloseIcon(int iconResID) {
return this;
}

public withAnim setCloseIconSize(int sizeInDP) {
public withAnimation setCloseIconSize(int sizeInDP) {
if (sizeInDP != 0) {
binding.closeIcon.getLayoutParams().height = sizeInDP * 2;
binding.closeIcon.getLayoutParams().width = sizeInDP * 2;
Expand All @@ -2050,7 +2050,7 @@ public withAnim setCloseIconSize(int sizeInDP) {
return this;
}

public withAnim setCloseIconColor(int colorOfIcon) {
public withAnimation setCloseIconColor(int colorOfIcon) {
if (colorOfIcon != 0) {
try {
binding.closeIcon.setColorFilter(ContextCompat.getColor(context, colorOfIcon));
Expand All @@ -2061,7 +2061,7 @@ public withAnim setCloseIconColor(int colorOfIcon) {
return this;
}

public withAnim setPrimaryColor(int primaryColor) {
public withAnimation setPrimaryColor(int primaryColor) {
if (primaryColor != 0) {

if (!isTitleColorChanged) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected void onCreate(Bundle savedInstanceState) {
.show());

binding.design3.setOnClickListener(v ->
new CuteDialog.withAnim(this)
new CuteDialog.withAnimation(this)
.setAnimation(R.raw.anim1)
.setTitle("Set Reminder")
.setDescription("Do you want me to remind you? ")
Expand Down

0 comments on commit c585366

Please sign in to comment.