Fix update header
This commit is contained in:
parent
e3f4917faf
commit
d227e34b59
2 changed files with 31 additions and 29 deletions
|
@ -73,13 +73,13 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
|||
getListView().setBackgroundColor(getResources().getColor(
|
||||
getMyApplication().getSettings().isLightContent() ? R.color.ctx_menu_info_view_bg_light
|
||||
: R.color.ctx_menu_info_view_bg_dark));
|
||||
getMyActivity().onAttachFragment(this);
|
||||
getTrackActivity().onAttachFragment(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
menu.clear();
|
||||
getMyActivity().getClearToolbar(false);
|
||||
getTrackActivity().getClearToolbar(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -162,7 +162,7 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
|||
popup.setDropDownGravity(Gravity.RIGHT | Gravity.TOP);
|
||||
popup.setVerticalOffset(AndroidUtils.dpToPx(app, -48f));
|
||||
popup.setHorizontalOffset(AndroidUtils.dpToPx(app, -6f));
|
||||
popup.setAdapter(new ArrayAdapter<>(getMyActivity(),
|
||||
popup.setAdapter(new ArrayAdapter<>(getTrackActivity(),
|
||||
R.layout.popup_list_text_item, options));
|
||||
popup.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
|
||||
|
@ -232,10 +232,10 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
|
||||
private GPXUtilities.GPXFile getGpx() {
|
||||
return getMyActivity().getGpx();
|
||||
return getTrackActivity().getGpx();
|
||||
}
|
||||
|
||||
public TrackActivity getMyActivity() {
|
||||
public TrackActivity getTrackActivity() {
|
||||
return (TrackActivity) getActivity();
|
||||
}
|
||||
|
||||
|
@ -302,10 +302,10 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
|
||||
private List<GpxDisplayGroup> filterGroups(boolean useDisplayGroups) {
|
||||
if (getMyActivity() == null) {
|
||||
if (getTrackActivity() == null) {
|
||||
return null;
|
||||
}
|
||||
List<GpxDisplayGroup> result = getMyActivity().getGpxFile(useDisplayGroups);
|
||||
List<GpxDisplayGroup> result = getTrackActivity().getGpxFile(useDisplayGroups);
|
||||
List<GpxDisplayGroup> groups = new ArrayList<>();
|
||||
for (GpxDisplayGroup group : result) {
|
||||
boolean add = hasFilterType(group.getType());
|
||||
|
@ -330,7 +330,7 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
|
||||
private List<GpxDisplayItem> getSplitSegments() {
|
||||
List<GpxDisplayGroup> result = getMyActivity().getGpxFile(true);
|
||||
List<GpxDisplayGroup> result = getTrackActivity().getGpxFile(true);
|
||||
List<GpxDisplayItem> splitSegments = new ArrayList<>();
|
||||
if (result != null && result.size() > 0) {
|
||||
if (result.get(0).isSplitDistance() || result.get(0).isSplitTime()) {
|
||||
|
@ -341,7 +341,7 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
|
||||
private GpxDisplayItem getOverviewSegment() {
|
||||
List<GpxDisplayGroup> result = getMyActivity().getGpxFile(false);
|
||||
List<GpxDisplayGroup> result = getTrackActivity().getGpxFile(false);
|
||||
GpxDisplayItem overviewSegment = null;
|
||||
if (result.size() > 0) {
|
||||
overviewSegment = result.get(0).getModifiableList().get(0);
|
||||
|
@ -383,7 +383,7 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
|||
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
|
||||
GpxDisplayItem currentGpxDisplayItem = getItem(position);
|
||||
if (convertView == null) {
|
||||
convertView = getMyActivity().getLayoutInflater().inflate(R.layout.gpx_split_segment_fragment, parent, false);
|
||||
convertView = getTrackActivity().getLayoutInflater().inflate(R.layout.gpx_split_segment_fragment, parent, false);
|
||||
}
|
||||
convertView.setOnClickListener(null);
|
||||
TextView overviewTextView = (TextView) convertView.findViewById(R.id.overview_text);
|
||||
|
@ -611,7 +611,7 @@ public class SplitSegmentFragment extends OsmAndListFragment {
|
|||
|
||||
SplitTrackAsyncTask(@Nullable GpxSelectionHelper.SelectedGpxFile selectedGpxFile, List<GpxDisplayGroup> groups) {
|
||||
mSelectedGpxFile = selectedGpxFile;
|
||||
mActivity = getMyActivity();
|
||||
mActivity = getTrackActivity();
|
||||
this.groups = groups;
|
||||
}
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
public TrackActivity getMyActivity() {
|
||||
public TrackActivity getTrackActivity() {
|
||||
return (TrackActivity) getActivity();
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
menu.clear();
|
||||
getMyActivity().getClearToolbar(false);
|
||||
getTrackActivity().getClearToolbar(false);
|
||||
if (getGpx() != null && getGpx().path != null && !getGpx().showCurrentTrack) {
|
||||
MenuItem item = menu.add(R.string.shared_string_share).setIcon(R.drawable.ic_action_gshare_dark)
|
||||
.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
|
@ -236,11 +236,11 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
|
||||
private GPXFile getGpx() {
|
||||
return getMyActivity().getGpx();
|
||||
return getTrackActivity().getGpx();
|
||||
}
|
||||
|
||||
private GpxDataItem getGpxDataItem() {
|
||||
return getMyActivity().getGpxDataItem();
|
||||
return getTrackActivity().getGpxDataItem();
|
||||
}
|
||||
|
||||
private void startHandler() {
|
||||
|
@ -363,11 +363,17 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
});
|
||||
|
||||
boolean hasPath = getGpx() != null && getGpx().showCurrentTrack;
|
||||
boolean hasPath = false;
|
||||
if (getGpx() != null) {
|
||||
if (getGpx().showCurrentTrack && adapter.getCount() > 0) {
|
||||
hasPath = false;
|
||||
} else if (getGpx().tracks.size() > 0 || getGpx().routes.size() > 0) {
|
||||
hasPath = true;
|
||||
}
|
||||
}
|
||||
if (rotatedTileBox == null || mapBitmap == null || mapTrackBitmap == null) {
|
||||
QuadRect rect = getRect();
|
||||
if (rect.left != 0 && rect.top != 0) {
|
||||
hasPath = getGpx() != null && (getGpx().tracks.size() > 0 || getGpx().routes.size() > 0);
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
|
||||
double clat = rect.bottom / 2 + rect.top / 2;
|
||||
|
@ -421,7 +427,7 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
|
||||
if (hasPath) {
|
||||
if (getGpx() != null && !getGpx().showCurrentTrack && adapter.getCount() > 0) {
|
||||
if (getGpx() != null && !getGpx().showCurrentTrack) {
|
||||
prepareSplitIntervalAdapterData();
|
||||
setupSplitIntervalView(splitIntervalView);
|
||||
updateSplitIntervalView(splitIntervalView);
|
||||
|
@ -435,7 +441,7 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
popup.setDropDownGravity(Gravity.RIGHT | Gravity.TOP);
|
||||
popup.setVerticalOffset(AndroidUtils.dpToPx(app, -48f));
|
||||
popup.setHorizontalOffset(AndroidUtils.dpToPx(app, -6f));
|
||||
popup.setAdapter(new ArrayAdapter<>(getMyActivity(),
|
||||
popup.setAdapter(new ArrayAdapter<>(getTrackActivity(),
|
||||
R.layout.popup_list_text_item, options));
|
||||
popup.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
|
||||
|
@ -681,10 +687,10 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
|
||||
private List<GpxDisplayGroup> filterGroups(boolean useDisplayGroups) {
|
||||
if (getMyActivity() == null) {
|
||||
if (getTrackActivity() == null) {
|
||||
return null;
|
||||
}
|
||||
List<GpxDisplayGroup> result = getMyActivity().getGpxFile(useDisplayGroups);
|
||||
List<GpxDisplayGroup> result = getTrackActivity().getGpxFile(useDisplayGroups);
|
||||
List<GpxDisplayGroup> groups = new ArrayList<>();
|
||||
for (GpxDisplayGroup group : result) {
|
||||
boolean add = hasFilterType(group.getType());
|
||||
|
@ -718,10 +724,6 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
adapter.setNotifyOnChange(true);
|
||||
adapter.notifyDataSetChanged();
|
||||
updateHeader();
|
||||
if (getGpx() != null && (getGpx().tracks.size() > 0 || getGpx().routes.size() > 0)) {
|
||||
(headerView.findViewById(R.id.split_color_view)).setVisibility(View.VISIBLE);
|
||||
(headerView.findViewById(R.id.divider)).setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
protected List<GpxDisplayItem> flatten(List<GpxDisplayGroup> groups) {
|
||||
|
@ -813,7 +815,7 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
WrapContentHeightViewPager pager;
|
||||
boolean create = false;
|
||||
if (row == null) {
|
||||
LayoutInflater inflater = getMyActivity().getLayoutInflater();
|
||||
LayoutInflater inflater = getTrackActivity().getLayoutInflater();
|
||||
row = inflater.inflate(R.layout.gpx_list_item_tab_content, parent, false);
|
||||
|
||||
boolean light = app.getSettings().isLightContent();
|
||||
|
@ -1490,12 +1492,12 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
|
||||
void openSplitIntervalScreen() {
|
||||
getMyActivity().getSupportFragmentManager()
|
||||
getTrackActivity().getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.track_activity_layout, new SplitSegmentFragment())
|
||||
.addToBackStack(SplitSegmentFragment.TAG)
|
||||
.commit();
|
||||
getMyActivity().getSlidingTabLayout().setVisibility(View.GONE);
|
||||
getTrackActivity().getSlidingTabLayout().setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private class SplitTrackAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||
|
@ -1509,7 +1511,7 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
SplitTrackAsyncTask(@Nullable SelectedGpxFile selectedGpxFile, List<GpxDisplayGroup> groups) {
|
||||
mSelectedGpxFile = selectedGpxFile;
|
||||
mFragment = TrackSegmentFragment.this;
|
||||
mActivity = getMyActivity();
|
||||
mActivity = getTrackActivity();
|
||||
this.groups = groups;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue