Move initializing variables to onCreate

This commit is contained in:
PavelRatushnyi 2017-10-25 19:45:01 +03:00
parent 107a10476c
commit 84b3b34be8

View file

@ -113,6 +113,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
lightTheme = app.getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME; lightTheme = app.getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME;
int themeId = lightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme; int themeId = lightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme;
setStyle(STYLE_NO_FRAME, themeId); setStyle(STYLE_NO_FRAME, themeId);
iconsCache = app.getIconsCache();
mapMarkersHelper = app.getMapMarkersHelper();
CoordinateInputBottomSheetDialogFragment fragment = new CoordinateInputBottomSheetDialogFragment(); CoordinateInputBottomSheetDialogFragment fragment = new CoordinateInputBottomSheetDialogFragment();
fragment.setListener(createCoordinateInputFormatChangeListener()); fragment.setListener(createCoordinateInputFormatChangeListener());
@ -124,8 +126,6 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mainView = inflater.inflate(R.layout.fragment_coordinate_input_dialog, container); mainView = inflater.inflate(R.layout.fragment_coordinate_input_dialog, container);
final MapActivity mapActivity = getMapActivity(); final MapActivity mapActivity = getMapActivity();
iconsCache = getMyApplication().getIconsCache();
mapMarkersHelper = getMyApplication().getMapMarkersHelper();
Fragment coordinateInputBottomSheetDialogFragment = mapActivity.getSupportFragmentManager().findFragmentByTag(CoordinateInputBottomSheetDialogFragment.TAG); Fragment coordinateInputBottomSheetDialogFragment = mapActivity.getSupportFragmentManager().findFragmentByTag(CoordinateInputBottomSheetDialogFragment.TAG);
if (coordinateInputBottomSheetDialogFragment != null) { if (coordinateInputBottomSheetDialogFragment != null) {
@ -340,7 +340,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
@Override @Override
public void afterTextChanged(Editable editable) { public void afterTextChanged(Editable editable) {
View focusedView = getDialog().getCurrentFocus(); View focusedView = getDialog().getCurrentFocus();
if (focusedView != null) { if (focusedView != null && focusedView instanceof EditText) {
ExtendedEditText focusedEditText = (ExtendedEditText) focusedView; ExtendedEditText focusedEditText = (ExtendedEditText) focusedView;
String str = focusedEditText.getText().toString(); String str = focusedEditText.getText().toString();
int strLength = str.length(); int strLength = str.length();