Skip to content

Commit

Permalink
[Fix] StatefulViewDialog crash when pop itself from route
Browse files Browse the repository at this point in the history
  • Loading branch information
rh-id committed Dec 1, 2021
1 parent 4945e08 commit 20a33e7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ protected View createView(Activity activity, ViewGroup container) {
});
Button buttonRetry = view.findViewById(R.id.button_retry);
buttonRetry.setOnClickListener(v -> getNavigator().retry());
Button buttonDismis = view.findViewById(R.id.button_dismiss);
buttonDismis.setOnClickListener(v -> getNavigator().pop());
Toast.makeText(activity, "Dialog page 2 createView", Toast.LENGTH_LONG).show();
return view;
}
Expand Down
9 changes: 9 additions & 0 deletions example/src/main/res/layout/page_dialog_2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,13 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/button_rebuild" />

<com.google.android.material.button.MaterialButton
android:id="@+id/button_dismiss"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dismiss current dialog"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/button_retry" />
</androidx.constraintlayout.widget.ConstraintLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ final void dismissWithoutPop(ACT activity) {
public void dispose(ACT activity) {
super.dispose(activity);
if (mActiveDialog != null) {
mShouldPop = false;
mActiveDialog.dismiss();
}
mActiveDialog = null;
Expand Down

0 comments on commit 20a33e7

Please sign in to comment.