Skip to content

Commit

Permalink
Update PostSettingsInputDialogFragment.java
Browse files Browse the repository at this point in the history
  • Loading branch information
neeldoshii committed Jun 11, 2024
1 parent 57cfb46 commit fb445cc
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.wordpress.android.databinding.PostSettingsInputDialogBinding;
import org.wordpress.android.util.ActivityUtils;

import java.util.Objects;

public class PostSettingsInputDialogFragment extends DialogFragment implements TextWatcher {
public static final String TAG = "post_settings_input_dialog_fragment";
Expand All @@ -35,7 +34,6 @@ public interface PostSettingsInputDialogListener {
private static final String DISABLE_EMPTY_INPUT_TAG = "disable_empty_input";
private static final String MULTILINE_INPUT_TAG = "is_multiline_input";

private PostSettingsInputDialogBinding mBinding;
private String mCurrentInput;
private String mTitle;
private String mHint;
Expand Down Expand Up @@ -97,7 +95,8 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
new MaterialAlertDialogBuilder(new ContextThemeWrapper(getActivity(), R.style.PostSettingsTheme));
LayoutInflater layoutInflater = requireActivity().getLayoutInflater();
//noinspection InflateParams
mBinding = PostSettingsInputDialogBinding.inflate(layoutInflater, null, false);
PostSettingsInputDialogBinding mBinding =
PostSettingsInputDialogBinding.inflate(layoutInflater, null, false);
builder.setView(mBinding.getRoot());
if (mIsMultilineInput) {
mBinding.postSettingsInputDialogEditText.setRawInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE);
Expand All @@ -119,7 +118,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mCurrentInput = Objects.requireNonNull(mBinding.postSettingsInputDialogEditText.getText()).toString();
mCurrentInput = mBinding.postSettingsInputDialogEditText.getText().toString();
if (mListener != null) {
mListener.onInputUpdated(mCurrentInput);
}
Expand Down Expand Up @@ -152,10 +151,4 @@ public void afterTextChanged(Editable editable) {
mDialog.getButton(Dialog.BUTTON_POSITIVE).setEnabled(!disabled);
}
}

@Override
public void onDestroy() {
super.onDestroy();
mBinding = null; // ensures binding reference gets null on fragment destroy
}
}

0 comments on commit fb445cc

Please sign in to comment.