small refactoring

This commit is contained in:
Nazar-Kutz 2020-10-12 10:33:46 +03:00
parent 6941d45516
commit 3c2bda87ce
3 changed files with 10 additions and 9 deletions

View file

@ -157,14 +157,18 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
} }
private enum AdditionalInfoType { private enum AdditionalInfoType {
POINTS(MtPointsFragment.TAG), POINTS(MtPointsFragment.class.getName()),
GRAPH(MtGraphFragment.TAG); GRAPH(MtGraphFragment.class.getName());
AdditionalInfoType(String fragmentName) { AdditionalInfoType(String fragmentName) {
this.fragmentName = fragmentName; this.fragmentName = fragmentName;
} }
String fragmentName; final String fragmentName;
public String getFragmentName() {
return fragmentName;
}
} }
private void setEditingCtx(MeasurementEditingContext editingCtx) { private void setEditingCtx(MeasurementEditingContext editingCtx) {
@ -237,6 +241,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
public void hideProgressBar() { public void hideProgressBar() {
((ProgressBar) mainView.findViewById(R.id.snap_to_road_progress_bar)).setVisibility(View.GONE); ((ProgressBar) mainView.findViewById(R.id.snap_to_road_progress_bar)).setVisibility(View.GONE);
progressBarVisible = false; progressBarVisible = false;
updateAdditionalInfoView();
} }
@Override @Override
@ -526,7 +531,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
} else { } else {
return; return;
} }
setAdditionalInfoFragment(type.fragmentName); setAdditionalInfoFragment(type.getFragmentName());
} }
} }
@ -1513,7 +1518,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
for (AdditionalInfoType type : AdditionalInfoType.values()) { for (AdditionalInfoType type : AdditionalInfoType.values()) {
try { try {
FragmentManager fm = getChildFragmentManager(); FragmentManager fm = getChildFragmentManager();
Fragment fragment = fm.findFragmentByTag(type.fragmentName); Fragment fragment = fm.findFragmentByTag(type.getFragmentName());
if (fragment != null) { if (fragment != null) {
return fragment; return fragment;
} }

View file

@ -48,8 +48,6 @@ import java.util.Map;
public class MtGraphFragment extends Fragment public class MtGraphFragment extends Fragment
implements MeasurementToolFragment.OnUpdateAdditionalInfoListener { implements MeasurementToolFragment.OnUpdateAdditionalInfoListener {
public static final String TAG = MtGraphFragment.class.getName();
private static String GRAPH_DATA_GPX_FILE_NAME = "graph_data_tmp"; private static String GRAPH_DATA_GPX_FILE_NAME = "graph_data_tmp";
private View commonGraphContainer; private View commonGraphContainer;

View file

@ -21,8 +21,6 @@ import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback;
public class MtPointsFragment extends Fragment public class MtPointsFragment extends Fragment
implements MeasurementToolFragment.OnUpdateAdditionalInfoListener { implements MeasurementToolFragment.OnUpdateAdditionalInfoListener {
public static final String TAG = MtPointsFragment.class.getName();
private boolean nightMode; private boolean nightMode;
private MeasurementToolAdapter adapter; private MeasurementToolAdapter adapter;
private MeasurementEditingContext editingCtx; private MeasurementEditingContext editingCtx;