Ich benutze BottomSheetDialogFragment aus der Support-Bibliothek und warnt mich, dass die Funktion setupDialog()
sollte nur innerhalb der Bibliotheksgruppe verwendet werden. Aber diese Funktion ist der Ort, an dem ich meinen Dialog initialisiere:BottomSheetDialogFragment setupDialog beschränkt auf Bibliotheksgruppe
@Override
public void setupDialog(final Dialog dialog, int style) {
super.setupDialog(dialog, style);
FragmentArgs.inject(this);
dialog.setOnShowListener(dialogINterface -> {
if(dialog.getWindow() != null) {
dialog.getWindow().setLayout(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.MATCH_PARENT);
}
});
BottomSheetStatisticsExportBinding binding = DataBindingUtil.inflate(
LayoutInflater.from(getContext()),
R.layout.bottom_sheet_statistics_export,
null,
false
);
View contentView = binding.getRoot();
dialog.setContentView(contentView);
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) ((View) contentView.getParent()).getLayoutParams();
CoordinatorLayout.Behavior behavior = params.getBehavior();
if(behavior != null && behavior instanceof BottomSheetBehavior)
((BottomSheetBehavior) behavior).setBottomSheetCallback(bottomSheetBehaviorCallback);
for (Export export : exports)
binding.flexbox.addView(new ExportItemView(getContext(), export));
}
Die Warnung ist, weil ich die Super-Methode verwende. Aber was soll ich stattdessen tun? Sollte ich meinen Code in eine andere Funktion verschieben (onCreateDialog()
, onResume()
...?), Sollte ich den Anruf zum Super entfernen?
Wer weiß?