Skip to content

Commit

Permalink
remove no header dialog type
Browse files Browse the repository at this point in the history
update README.md
  • Loading branch information
Daniel committed Jun 5, 2020
1 parent 41d3cf8 commit 8124c4a
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 15 deletions.
1 change: 0 additions & 1 deletion app/src/main/java/com/nordan/dialog/DialogType.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ public enum DialogType {
WARNING,
ERROR,
INFORMATION,
NO_HEADER,
QUESTION,
SUCCESS
}
25 changes: 11 additions & 14 deletions app/src/main/java/com/nordan/dialog/NordanAlertDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
import com.google.android.material.button.MaterialButton;
import com.google.android.material.textview.MaterialTextView;
import java.util.Optional;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import pl.droidsonroids.gif.GifImageView;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class NordanAlertDialog {

private NordanAlertDialog() {
}

public static class Builder {

private String title;
Expand Down Expand Up @@ -90,7 +90,7 @@ public Builder isCancellable(boolean cancel) {
return this;
}

public void show() {
public Dialog build() {
final MaterialTextView messageDialog;
final MaterialTextView titleDialog;
final GifImageView iconImg;
Expand Down Expand Up @@ -123,17 +123,14 @@ public void show() {
case QUESTION:
setQuestionDialog(iconImg, view);
break;
case NO_HEADER:
setNoHeaderDialog(dialog);
break;
case INFORMATION:
setInformationDialog(iconImg, view);
break;
case SUCCESS:
setLevelCompleteDialog(iconImg, view);
break;
default:
setCustomDialog(iconImg, view);
setCustomDialog(dialog, iconImg, view);
break;
}
}
Expand Down Expand Up @@ -162,7 +159,7 @@ public void show() {
} else {
negativeButton.setOnClickListener(click -> dialog.dismiss());
}
dialog.show();
return dialog;
}

private void setLevelCompleteDialog(GifImageView iconImg, View view) {
Expand All @@ -189,17 +186,17 @@ private void setQuestionDialog(GifImageView iconImg, View view) {
view.setBackgroundColor(activity.getColor(R.color.colorBlue));
}

private void setNoHeaderDialog(Dialog dialog) {
dialog.findViewById(R.id.relative_header).setVisibility(View.GONE);
}

private void setInformationDialog(GifImageView iconImg, View view) {
iconImg.setImageResource(R.drawable.ic_baseline_info_24);
iconImg.setVisibility(View.VISIBLE);
view.setBackgroundColor(activity.getColor(R.color.colorPurple));
}

private void setCustomDialog(GifImageView iconImg, View view) {
private void setCustomDialog(Dialog dialog, GifImageView iconImg, View view) {
if (icon == 0 && backgroundColor == 0) {
dialog.findViewById(R.id.relative_header).setVisibility(View.GONE);
return;
}
if (icon != 0) {
iconImg.setImageResource(icon);
iconImg.setVisibility(View.VISIBLE);
Expand Down
Binary file removed img/default.jpg
Binary file not shown.
Binary file removed img/dialogs_h.png
Binary file not shown.
Binary file removed img/dialogs_small.png
Binary file not shown.
Binary file removed img/error.jpg
Binary file not shown.
Binary file removed img/information.jpg
Binary file not shown.
Binary file removed img/no_header.jpg
Binary file not shown.
Binary file removed img/question.jpg
Binary file not shown.
Binary file removed img/success.jpg
Binary file not shown.

0 comments on commit 8124c4a

Please sign in to comment.