DialogFragment over DialogFragment produces spawn with no background animation - android

Good evening. A fast question.
i have seen that showing a not-fullscreen dialogfragment over activity or fragment, animates normally.
but when dialogfragment is showing over other dialogfragment, it animates the view BUT the dimmed background is not animating..its just appears.
Any reason why? also any workaround?
example:
Open a fullscreen dialogfragment and then open a non-fullscreen dialogfragment. You will notice that the "semitransparent" dim background is never animating.
If the fullscreen dialogfragment, were fragment(or activity), it would work fine

Related

How to display fragment in android with background grayed out?

When a RelativeLayout in an activity is clicked, it should open a fragment that shows a few checkboxes. The fragment should be in the center of the screen but should not cover the whole screen. The original contents activity should appear in the background but it should be grayed out. When I click 'OK' button in the fragment, the fragment should disappear and the original contents of the activity should appear normal (without graying out). I've tried writing a lot of code but what I get is completely different from what I have in mind. How can I achieve this functionality?
you should use DialogFragment , see this thread: https://developer.android.com/reference/android/app/DialogFragment.html

DialogFragment reappears after activity recreate() even after dismissing it

I am showing one DialogFragment inside an activity. Now when I call recreate from the activity (trying to reproduce kill on low memory issue) I want to dismiss the dialog. So I tried calling dismissAllowingStateLoss() and removing fragment from the onStop of the fragment. But even after that I see onCreateDialog() of DialogFragment getting called.
My objective is to cancel the dissmiss the DialogFragment when acitvity recreates, but for me dialog is always reappearing, Can anyone help me on this issue?
The proper way to do it is to do it from parent activity but it looks like in your case parent activity have no control on you dialog fragment, right?
So your DialogFragment is more like a "Toast" dialog with a timer or with an OK button, correct?

Activity with Theme.Dialog can be dismissed when user touches anywhere on screen, but not with Theme.panel

I'm trying to display an activity with a button that covers a portion of the screen similar to a dialog.
This was almost working as I wanted it by using #android:style/android:Theme.Holo.Panel. It wasn't quite what I wanted however as I want the background to be dimmed with the activity is displayed. So I switched to this style instead: #android:style/android:Theme.Holo.Dialog.NoActionBar.
Now this looks like I want it and the background is dimmed. BUT the problem with this is if the user touches anywhere on the screen apart from the dialog then the activity gets dismissed. This does't happen with the Panel theme, the user can only dismiss it by pressing on the button.
How can I prevent the activity from being dismissed on any touch event with the Theme.Holo.Dialog?
Have you tried this.setFinishOnTouchOutside(false); ?
This being your activity.

DialogFragment without animation

I have DialogFragment with slide up animation on show. After clicking a button in dialog I start another activity without dismissing my dialog. The problem is, every time I finish an acitivity, the animation runs on dialog. Is there any way to turn off dialog animation after dialog is shown?
The situation sounds weird: if it's a DialogFragment that is attached to the first Activity, then how is it that you would keep the dialog showing when you start a different Activity? Or are you just re-starting the DialogFragment for both of your Activities?
Anyway, without knowing more details, there are a couple of things you can try.
If it really is the same DialogFragment instance that is running the same animation twice, then you can add a boolean in the dialog that is initially false, and gets set to true when you fire the animation. Then only fire the animation when the boolean is false.
If you are starting the same DialogFragment twice, for each of the two Activities you describe, then you can use setArguments(Bundle) right after constructing the DialogFragment, and add a boolean argument that says whether you want to show the animation.

Rendering bugs when SoftKeyboard closes

I have the following problem:
I have a FrameLayout with a main Fragment, which is always shown, and some overlay "extra" fragments which are shown or not, depending on the state of the application. (This Layout is used on tablets)
Now, if the user initiates a dialog with an EditText, this causes the SoftKeyboard to appear.
The Dialog and the Keyboard(No matter which type of dialog, I tried AlertDialog and DialogFragment) overlays the other Fragments.
So far, so good.
But when the dialog is finished and the keyboard closes, my whole application is pushed a bit up and down in an animation, and then there are several rendering bug in the ActionBar and at the bottom edges of my fragments.
This happens only if the keyboard overlaid exactly one of my "extra" fragments. (If it overlays two fragments, then everything is good).
Anyone an idea how to get rid of this?
Configuring android:windowSoftInputMode does not help.
You can adjust your keyboard in fragment using
getActivity().getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

Categories

Resources