Advertisement
Guest User

Untitled

a guest
Dec 5th, 2020
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. public class DialogTest extends DialogFragment {
  2.  
  3. private Context mContext;
  4.  
  5. public static DialogTest newInstance() {
  6. return new DialogTest();
  7. }
  8.  
  9. @Override
  10. public Dialog onCreateDialog(Bundle savedInstanceState)
  11. {
  12. final Dialog dialog = super.onCreateDialog(savedInstanceState);
  13. dialog.getWindow().getAttributes().windowAnimations = R.style.FragmentDialogAnim;
  14. return dialog;
  15. }
  16.  
  17. @Override
  18. public void onCreate(@Nullable Bundle savedInstanceState) {
  19. super.onCreate(savedInstanceState);
  20. mContext = getContext();
  21. setStyle(DialogFragment.STYLE_NORMAL, R.style.AppTheme);
  22. }
  23.  
  24. @Nullable
  25. @Override
  26. public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
  27. View view = inflater.inflate(R.layout.dialog_test, container, false);
  28.  
  29. return view;
  30. }
  31.  
  32. @Override
  33. public void onStop() {
  34. super.onStop();
  35. if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) {
  36. getDialog().getWindow().setWindowAnimations(-1);
  37. }
  38.  
  39. }
  40.  
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement