mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-22 12:03:09 -04:00
Passed alertDialogShower in bundle
This commit is contained in:
parent
92e92eafcb
commit
b470198d79
@ -243,6 +243,9 @@ public class AddNoteDialog extends DialogFragment
|
||||
// Custom AlertDialog for taking user confirmation before closing note dialog in case of unsaved changes
|
||||
DialogFragment newFragment = new ConfirmationAlertDialogFragment(sharedPreferenceUtil, TAG,
|
||||
R.string.confirmation_alert_dialog_message, alertDialogShower);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("alertDialogShower", alertDialogShower);
|
||||
newFragment.setArguments(bundle);
|
||||
newFragment.show(getActivity().getSupportFragmentManager(),
|
||||
ConfirmationAlertDialogFragment.TAG);
|
||||
}
|
||||
|
@ -63,6 +63,8 @@ public class ConfirmationAlertDialogFragment extends DialogFragment {
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
Fragment parentDialogFragment = getFragmentManager().findFragmentByTag(parentDialogFragmentTAG);
|
||||
Bundle bundle = getArguments();
|
||||
alertDialogShower = (AlertDialogShower) bundle.getSerializable("alertDialogShower");
|
||||
return alertDialogShower.create(new KiwixDialog.ConfirmationAlertDialogFragment(stringResourceId),
|
||||
() -> {
|
||||
if (parentDialogFragment != null) {
|
||||
|
@ -21,9 +21,11 @@ package org.kiwix.kiwixmobile.core.utils
|
||||
import android.app.Activity
|
||||
import android.app.Dialog
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import java.io.Serializable
|
||||
import javax.inject.Inject
|
||||
|
||||
class AlertDialogShower @Inject constructor(private val activity: Activity) : DialogShower {
|
||||
class AlertDialogShower @Inject constructor(private val activity: Activity) : DialogShower,
|
||||
Serializable {
|
||||
override fun show(dialog: KiwixDialog, vararg clickListeners: () -> Unit) {
|
||||
create(dialog, *clickListeners).show()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user