diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/CustomViewDialog.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/CustomViewDialog.java index 1f0a6b3..6f91cc1 100644 --- a/SJDialog/src/main/java/com/sjapps/library/customdialog/CustomViewDialog.java +++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/CustomViewDialog.java @@ -227,6 +227,12 @@ public CustomViewDialog setMaxDialogWidth(int maxDialogWidth) { return this; } + @Override + public CustomViewDialog setDialogAnimations(int styleRes) { + super.setDialogAnimations(styleRes); + return this; + } + @Override protected void setButtons() { setButton1(R.id.btn1); diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/ListDialog.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/ListDialog.java index 2180ca0..aa7fde1 100644 --- a/SJDialog/src/main/java/com/sjapps/library/customdialog/ListDialog.java +++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/ListDialog.java @@ -242,6 +242,12 @@ public ListDialog setMaxDialogWidth(int maxDialogWidth) { return this; } + @Override + public ListDialog setDialogAnimations(int styleRes) { + super.setDialogAnimations(styleRes); + return this; + } + @Override public Button getLeftButton() { return super.getLeftButton(); diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/MessageDialog.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/MessageDialog.java index e343644..2d19a35 100644 --- a/SJDialog/src/main/java/com/sjapps/library/customdialog/MessageDialog.java +++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/MessageDialog.java @@ -128,6 +128,12 @@ public MessageDialog setMaxDialogWidth(int maxDialogWidth){ return this; } + @Override + public MessageDialog setDialogAnimations(int styleRes) { + super.setDialogAnimations(styleRes); + return this; + } + @Override public MessageDialog show(){ super.show(); diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/SJDialog.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/SJDialog.java index 331f9a5..d2d6d2f 100644 --- a/SJDialog/src/main/java/com/sjapps/library/customdialog/SJDialog.java +++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/SJDialog.java @@ -7,6 +7,7 @@ import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.view.ContextThemeWrapper; +import android.view.DragEvent; import android.view.View; import android.widget.Button; @@ -58,7 +59,7 @@ protected SJDialog Builder(Context context, @LayoutRes int layoutResID, @StyleRe setContentView(layoutResID); setDialogSize(); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); - + dialog.getWindow().getAttributes().windowAnimations = R.style.SJDialogAnimation; setButtons(); if (theme != defaultTheme) regenerateButtons(); @@ -438,6 +439,17 @@ protected SJDialog setMaxDialogWidth(int maxDialogWidth) { return this; } + + /** + * Set animation for a dialog + * @param styleRes style resource + * @return current class + */ + protected SJDialog setDialogAnimations(@StyleRes int styleRes){ + dialog.getWindow().getAttributes().windowAnimations = styleRes; + return this; + } + private OneButtonException OneButtonException() { return new OneButtonException("Trying to access right button when dialog has only one button. Use 'dialogWithTwoButtons()' to fix the problem."); } diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/SetupDialog.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/SetupDialog.java index eaa9a5f..c562fc4 100644 --- a/SJDialog/src/main/java/com/sjapps/library/customdialog/SetupDialog.java +++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/SetupDialog.java @@ -239,6 +239,12 @@ public SetupDialog setMaxDialogWidth(int maxDialogWidth) { } + @Override + public SetupDialog setDialogAnimations(int styleRes) { + super.setDialogAnimations(styleRes); + return this; + } + @Override protected void setButtons() { setButton1(R.id.btn1); diff --git a/SJDialog/src/main/res/anim/slide_in.xml b/SJDialog/src/main/res/anim/slide_in.xml new file mode 100644 index 0000000..97f2515 --- /dev/null +++ b/SJDialog/src/main/res/anim/slide_in.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/SJDialog/src/main/res/anim/slide_out.xml b/SJDialog/src/main/res/anim/slide_out.xml new file mode 100644 index 0000000..dc2c40d --- /dev/null +++ b/SJDialog/src/main/res/anim/slide_out.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/SJDialog/src/main/res/values/styles.xml b/SJDialog/src/main/res/values/styles.xml index bf052e8..6e62836 100644 --- a/SJDialog/src/main/res/values/styles.xml +++ b/SJDialog/src/main/res/values/styles.xml @@ -19,4 +19,9 @@ @color/md_theme_onError + + \ No newline at end of file