-
Notifications
You must be signed in to change notification settings - Fork 342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DialogController like DialogFragment #248
Conversation
I haven't looked at the source closely, but could this be just a separate library? |
if (mDismissed) { | ||
return; | ||
} | ||
getRouter().popCurrentController(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if there are multiple dialogs. It would make sense to let the user supply a tag.
import com.bluelinelabs.conductor.changehandler.FadeChangeHandler; | ||
|
||
/** | ||
* @author Dmitriy Gorbunov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove header and add documentation
import com.bluelinelabs.conductor.demo.util.BundleBuilder; | ||
|
||
/** | ||
* @author Dmitriy Gorbunov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove author
|
||
private static final String SAVED_DIALOG_STATE_TAG = "android:savedDialogState"; | ||
|
||
private Dialog mDialog; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No Hungarian style
public void onShow(DialogInterface dialog) { | ||
TextView messageTextView = ((TextView) alertDialog.findViewById(android.R.id.message)); | ||
if (messageTextView != null) { | ||
//Make the textview clickable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo, make links clickable in textview
public void showDialog(@NonNull Router router, @Nullable String tag) { | ||
dismissed = false; | ||
router.pushController(RouterTransaction.with(this) | ||
.pushChangeHandler(new FadeChangeHandler(false)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to let the implementer supply a ChangeHandler
instead of forcing one? I guess the showDialog
method could be overloaded to allow this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so too. The dialog needs to call removesFromViewOnPush
on the push change handler in that case and throw an exception if it's true.
I also ask myself if it's possible to skip the whole showDialog stuff and use the controller lifecycle callbacks to handle the dialog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DialogController
return a stub view because a method onCreateView
requires non-nullable result. This view not visible for user. At the same time we should not remove the view of controller on top of which the dialog is displayed. Therefore, there are no views that need to be animated. I think apply SimpleSwapChangeHandler(false)
instead FadeChangeHandler(false)
.
private Dialog dialog; | ||
private boolean dismissed; | ||
|
||
public DialogController(@Nullable Bundle args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a no-args constructor too
Any update on this guys? |
Why use stub view? There is must be a way to pass Now we forced to use |
Thank you for your efford! Closing this for the same reason as #467 |
Implemented DialogController as a wrapper over standard android dialog.