avoid deprecated DialogFragment onActivityCreated
This commit is contained in:
parent
b8dcc33696
commit
fd510a3c19
@ -22,23 +22,19 @@ public class JumpToPageFragment extends DialogFragment {
|
|||||||
|
|
||||||
private NumberPicker mPicker;
|
private NumberPicker mPicker;
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
|
||||||
super.onActivityCreated(savedInstanceState);
|
|
||||||
if (savedInstanceState != null) {
|
|
||||||
mPicker.setMinValue(savedInstanceState.getInt(STATE_PICKER_MIN));
|
|
||||||
mPicker.setMaxValue(savedInstanceState.getInt(STATE_PICKER_MAX));
|
|
||||||
mPicker.setValue(savedInstanceState.getInt(STATE_PICKER_CUR));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
mPicker = new NumberPicker(getActivity());
|
mPicker = new NumberPicker(getActivity());
|
||||||
|
if (savedInstanceState != null) {
|
||||||
|
mPicker.setMinValue(savedInstanceState.getInt(STATE_PICKER_MIN));
|
||||||
|
mPicker.setMaxValue(savedInstanceState.getInt(STATE_PICKER_MAX));
|
||||||
|
mPicker.setValue(savedInstanceState.getInt(STATE_PICKER_CUR));
|
||||||
|
} else {
|
||||||
mPicker.setMinValue(1);
|
mPicker.setMinValue(1);
|
||||||
mPicker.setMaxValue(((PdfViewer)requireActivity()).mNumPages);
|
mPicker.setMaxValue(((PdfViewer)requireActivity()).mNumPages);
|
||||||
mPicker.setValue(((PdfViewer)requireActivity()).mPage);
|
mPicker.setValue(((PdfViewer)requireActivity()).mPage);
|
||||||
|
}
|
||||||
|
|
||||||
final FrameLayout layout = new FrameLayout(getActivity());
|
final FrameLayout layout = new FrameLayout(getActivity());
|
||||||
layout.addView(mPicker, new FrameLayout.LayoutParams(
|
layout.addView(mPicker, new FrameLayout.LayoutParams(
|
||||||
|
Loading…
Reference in New Issue
Block a user