return bg_contextmenu_shadow in header;
move OverviewCard build in header; minor fixes;
This commit is contained in:
parent
fdbf7a0f4b
commit
6755a76aad
5 changed files with 69 additions and 108 deletions
|
@ -15,7 +15,7 @@
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
tools:itemCount="4"
|
tools:itemCount="4"
|
||||||
tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
tools:listitem="@layout/item_gpx_action_segment" />
|
tools:listitem="@layout/item_gpx_stat_block" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -54,6 +54,7 @@
|
||||||
android:layout_marginEnd="@dimen/content_padding"
|
android:layout_marginEnd="@dimen/content_padding"
|
||||||
android:layout_marginRight="@dimen/content_padding"
|
android:layout_marginRight="@dimen/content_padding"
|
||||||
android:layout_marginTop="@dimen/content_padding_half"
|
android:layout_marginTop="@dimen/content_padding_half"
|
||||||
|
android:layout_marginBottom="@dimen/content_padding"
|
||||||
android:weightSum="4"
|
android:weightSum="4"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<!-- todo stretch buttons correctly -->
|
<!-- todo stretch buttons correctly -->
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<!--android:paddingLeft="@dimen/content_padding"
|
|
||||||
android:paddingRight="@dimen/content_padding"-->
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
|
@ -96,6 +96,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/activity_background_basic"
|
android:background="?attr/activity_background_basic"
|
||||||
|
android:foreground="@drawable/bg_contextmenu_shadow"
|
||||||
android:foregroundGravity="top|fill_horizontal">
|
android:foregroundGravity="top|fill_horizontal">
|
||||||
|
|
||||||
<net.osmand.plus.LockableScrollView
|
<net.osmand.plus.LockableScrollView
|
||||||
|
|
|
@ -37,7 +37,6 @@ import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper.LineGraphType;
|
import net.osmand.plus.helpers.GpxUiHelper.LineGraphType;
|
||||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||||
import net.osmand.plus.myplaces.SegmentActionsListener;
|
import net.osmand.plus.myplaces.SegmentActionsListener;
|
||||||
import net.osmand.plus.myplaces.SegmentGPXAdapter;
|
|
||||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||||
import net.osmand.plus.widgets.TextViewEx;
|
import net.osmand.plus.widgets.TextViewEx;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -54,19 +53,15 @@ import static net.osmand.plus.track.OptionsCard.SHOW_ON_MAP_BUTTON_INDEX;
|
||||||
public class OverviewCard extends BaseCard {
|
public class OverviewCard extends BaseCard {
|
||||||
|
|
||||||
private RecyclerView rvOverview;
|
private RecyclerView rvOverview;
|
||||||
private ImageView direction;
|
|
||||||
private TextView distanceText;
|
|
||||||
private MapContextMenu menu;
|
|
||||||
private View showButton;
|
private View showButton;
|
||||||
private View appearanceButton;
|
private View appearanceButton;
|
||||||
private View editButton;
|
private View editButton;
|
||||||
private View directionsButton;
|
private View directionsButton;
|
||||||
|
|
||||||
private TrackDisplayHelper displayHelper;
|
private final TrackDisplayHelper displayHelper;
|
||||||
private GPXFile gpxFile;
|
private final GPXFile gpxFile;
|
||||||
private GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[]{GpxDisplayItemType.TRACK_SEGMENT};
|
private final GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[]{GpxDisplayItemType.TRACK_SEGMENT};
|
||||||
private SegmentGPXAdapter adapter;
|
private final SegmentActionsListener listener;
|
||||||
private SegmentActionsListener listener;
|
|
||||||
|
|
||||||
public OverviewCard(@NonNull MapActivity mapActivity, @NonNull TrackDisplayHelper displayHelper,
|
public OverviewCard(@NonNull MapActivity mapActivity, @NonNull TrackDisplayHelper displayHelper,
|
||||||
@NonNull SegmentActionsListener listener) {
|
@NonNull SegmentActionsListener listener) {
|
||||||
|
@ -83,9 +78,6 @@ public class OverviewCard extends BaseCard {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateContent() {
|
protected void updateContent() {
|
||||||
// ViewGroup container = (ViewGroup) view;
|
|
||||||
// container.removeAllViews();
|
|
||||||
|
|
||||||
int iconColorDef = R.color.icon_color_active_light;
|
int iconColorDef = R.color.icon_color_active_light;
|
||||||
int iconColorPres = R.color.active_buttons_and_links_text_dark;
|
int iconColorPres = R.color.active_buttons_and_links_text_dark;
|
||||||
boolean fileAvailable = gpxFile.path != null && !gpxFile.showCurrentTrack;
|
boolean fileAvailable = gpxFile.path != null && !gpxFile.showCurrentTrack;
|
||||||
|
@ -96,9 +88,9 @@ public class OverviewCard extends BaseCard {
|
||||||
directionsButton = view.findViewById(R.id.directions_button);
|
directionsButton = view.findViewById(R.id.directions_button);
|
||||||
rvOverview = view.findViewById(R.id.recycler_overview);
|
rvOverview = view.findViewById(R.id.recycler_overview);
|
||||||
|
|
||||||
menu = mapActivity.getContextMenu();
|
MapContextMenu menu = mapActivity.getContextMenu();
|
||||||
distanceText = (TextView) view.findViewById(R.id.distance);
|
TextView distanceText = (TextView) view.findViewById(R.id.distance);
|
||||||
direction = (ImageView) view.findViewById(R.id.direction);
|
ImageView direction = (ImageView) view.findViewById(R.id.direction);
|
||||||
UpdateLocationViewCache updateLocationViewCache = app.getUIUtilities().getUpdateLocationViewCache();
|
UpdateLocationViewCache updateLocationViewCache = app.getUIUtilities().getUpdateLocationViewCache();
|
||||||
app.getUIUtilities().updateLocationView(updateLocationViewCache, direction, distanceText, menu.getLatLon());
|
app.getUIUtilities().updateLocationView(updateLocationViewCache, direction, distanceText, menu.getLatLon());
|
||||||
|
|
||||||
|
@ -109,10 +101,10 @@ public class OverviewCard extends BaseCard {
|
||||||
initDirectionsButton(iconColorDef, iconColorPres);
|
initDirectionsButton(iconColorDef, iconColorPres);
|
||||||
}
|
}
|
||||||
|
|
||||||
initSegments();
|
initStatBlocks();
|
||||||
}
|
}
|
||||||
|
|
||||||
void initSegments() {
|
void initStatBlocks() {
|
||||||
GpxDisplayItem gpxItem = TrackDisplayHelper.flatten(displayHelper.getOriginalGroups(filterTypes)).get(0);
|
GpxDisplayItem gpxItem = TrackDisplayHelper.flatten(displayHelper.getOriginalGroups(filterTypes)).get(0);
|
||||||
GPXTrackAnalysis analysis = gpxItem.analysis;
|
GPXTrackAnalysis analysis = gpxItem.analysis;
|
||||||
boolean joinSegments = displayHelper.isJoinSegments();
|
boolean joinSegments = displayHelper.isJoinSegments();
|
||||||
|
@ -123,21 +115,26 @@ public class OverviewCard extends BaseCard {
|
||||||
String avg = OsmAndFormatter.getFormattedSpeed(analysis.avgSpeed, app);
|
String avg = OsmAndFormatter.getFormattedSpeed(analysis.avgSpeed, app);
|
||||||
String max = OsmAndFormatter.getFormattedSpeed(analysis.maxSpeed, app);
|
String max = OsmAndFormatter.getFormattedSpeed(analysis.maxSpeed, app);
|
||||||
|
|
||||||
SegmentItem sDistance = new SegmentItem(app.getResources().getString(R.string.distance), OsmAndFormatter.getFormattedDistance(totalDistance, app),
|
StatBlock sDistance = new StatBlock(app.getResources().getString(R.string.distance), OsmAndFormatter.getFormattedDistance(totalDistance, app),
|
||||||
R.drawable.ic_action_track_16, R.color.icon_color_default_light, LineGraphType.ALTITUDE, LineGraphType.SPEED);
|
R.drawable.ic_action_track_16, R.color.icon_color_default_light, LineGraphType.ALTITUDE, LineGraphType.SPEED);
|
||||||
SegmentItem sAscent = new SegmentItem(app.getResources().getString(R.string.altitude_ascent), asc, R.drawable.ic_action_arrow_up_16, R.color.gpx_chart_red, LineGraphType.SLOPE, null);
|
StatBlock sAscent = new StatBlock(app.getResources().getString(R.string.altitude_ascent), asc,
|
||||||
SegmentItem sDescent = new SegmentItem(app.getResources().getString(R.string.altitude_descent), desc, R.drawable.ic_action_arrow_down_16, R.color.gpx_pale_green, LineGraphType.ALTITUDE, LineGraphType.SLOPE);
|
R.drawable.ic_action_arrow_up_16, R.color.gpx_chart_red, LineGraphType.SLOPE, null);
|
||||||
SegmentItem sAvSpeed = new SegmentItem(app.getResources().getString(R.string.average_speed), avg, R.drawable.ic_action_speed_16, R.color.icon_color_default_light, LineGraphType.SPEED, null);
|
StatBlock sDescent = new StatBlock(app.getResources().getString(R.string.altitude_descent), desc,
|
||||||
SegmentItem sMaxSpeed = new SegmentItem(app.getResources().getString(R.string.max_speed), max, R.drawable.ic_action_max_speed_16, R.color.icon_color_default_light, LineGraphType.SPEED, null);
|
R.drawable.ic_action_arrow_down_16, R.color.gpx_pale_green, LineGraphType.ALTITUDE, LineGraphType.SLOPE);
|
||||||
SegmentItem sTimeSpan = new SegmentItem(app.getResources().getString(R.string.shared_string_time_span), Algorithms.formatDuration((int) (timeSpan / 1000), app.accessibilityEnabled()),
|
StatBlock sAvSpeed = new StatBlock(app.getResources().getString(R.string.average_speed), avg,
|
||||||
|
R.drawable.ic_action_speed_16, R.color.icon_color_default_light, LineGraphType.SPEED, null);
|
||||||
|
StatBlock sMaxSpeed = new StatBlock(app.getResources().getString(R.string.max_speed), max,
|
||||||
|
R.drawable.ic_action_max_speed_16, R.color.icon_color_default_light, LineGraphType.SPEED, null);
|
||||||
|
StatBlock sTimeSpan = new StatBlock(app.getResources().getString(R.string.shared_string_time_span),
|
||||||
|
Algorithms.formatDuration((int) (timeSpan / 1000), app.accessibilityEnabled()),
|
||||||
R.drawable.ic_action_time_span_16, R.color.icon_color_default_light, LineGraphType.SPEED, null);
|
R.drawable.ic_action_time_span_16, R.color.icon_color_default_light, LineGraphType.SPEED, null);
|
||||||
|
|
||||||
LinearLayoutManager llManager = new LinearLayoutManager(app);
|
LinearLayoutManager llManager = new LinearLayoutManager(app);
|
||||||
llManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
llManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
||||||
rvOverview.setLayoutManager(llManager);
|
rvOverview.setLayoutManager(llManager);
|
||||||
rvOverview.setItemAnimator(new DefaultItemAnimator());
|
rvOverview.setItemAnimator(new DefaultItemAnimator());
|
||||||
List<SegmentItem> items = Arrays.asList(sDistance, sAscent, sDescent, sAvSpeed, sMaxSpeed, sTimeSpan);
|
List<StatBlock> items = Arrays.asList(sDistance, sAscent, sDescent, sAvSpeed, sMaxSpeed, sTimeSpan);
|
||||||
final SegmentItemAdapter siAdapter = new SegmentItemAdapter(items);
|
final StatBlockAdapter siAdapter = new StatBlockAdapter(items);
|
||||||
rvOverview.setAdapter(siAdapter);
|
rvOverview.setAdapter(siAdapter);
|
||||||
rvOverview.addItemDecoration(new HorizontalDividerDecoration(app));
|
rvOverview.addItemDecoration(new HorizontalDividerDecoration(app));
|
||||||
}
|
}
|
||||||
|
@ -225,45 +222,45 @@ public class OverviewCard extends BaseCard {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SegmentItemAdapter extends RecyclerView.Adapter<SegmentItemAdapter.SegmentItemViewHolder> {
|
private class StatBlockAdapter extends RecyclerView.Adapter<StatBlockAdapter.StatBlockViewHolder> {
|
||||||
private final List<SegmentItem> segmentItems;
|
private final List<StatBlock> StatBlocks;
|
||||||
|
|
||||||
public SegmentItemAdapter(List<SegmentItem> segmentItems) {
|
public StatBlockAdapter(List<StatBlock> StatBlocks) {
|
||||||
this.segmentItems = segmentItems;
|
this.StatBlocks = StatBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return segmentItems.size();
|
return StatBlocks.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public SegmentItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
public StatBlockViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
View itemView = LayoutInflater.from(parent.getContext())
|
View itemView = LayoutInflater.from(parent.getContext())
|
||||||
.inflate(R.layout.item_gpx_action_segment, parent, false);
|
.inflate(R.layout.item_gpx_stat_block, parent, false);
|
||||||
return new SegmentItemViewHolder(itemView);
|
return new StatBlockViewHolder(itemView);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(SegmentItemViewHolder holder, int position) {
|
public void onBindViewHolder(StatBlockViewHolder holder, int position) {
|
||||||
SegmentItem item = segmentItems.get(position);
|
StatBlock item = StatBlocks.get(position);
|
||||||
holder.bind(item);
|
holder.bind(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
class SegmentItemViewHolder extends RecyclerView.ViewHolder {
|
class StatBlockViewHolder extends RecyclerView.ViewHolder {
|
||||||
private final TextViewEx valueText;
|
private final TextViewEx valueText;
|
||||||
private final TextView titleText;
|
private final TextView titleText;
|
||||||
private final AppCompatImageView imageView;
|
private final AppCompatImageView imageView;
|
||||||
|
|
||||||
SegmentItemViewHolder(View view) {
|
StatBlockViewHolder(View view) {
|
||||||
super(view);
|
super(view);
|
||||||
valueText = view.findViewById(R.id.value);
|
valueText = view.findViewById(R.id.value);
|
||||||
titleText = view.findViewById(R.id.title);
|
titleText = view.findViewById(R.id.title);
|
||||||
imageView = view.findViewById(R.id.image);
|
imageView = view.findViewById(R.id.image);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bind(final SegmentItem overviewItem) {
|
public void bind(final StatBlock overviewItem) {
|
||||||
valueText.setText(overviewItem.value);
|
valueText.setText(overviewItem.value);
|
||||||
valueText.setTextColor(app.getResources().getColor(R.color.active_color_primary_light));
|
valueText.setTextColor(app.getResources().getColor(R.color.active_color_primary_light));
|
||||||
titleText.setText(overviewItem.title);
|
titleText.setText(overviewItem.title);
|
||||||
|
@ -289,10 +286,10 @@ public class OverviewCard extends BaseCard {
|
||||||
|
|
||||||
public HorizontalDividerDecoration(Context context) {
|
public HorizontalDividerDecoration(Context context) {
|
||||||
int[] ATTRS = new int[]{android.R.attr.listDivider};
|
int[] ATTRS = new int[]{android.R.attr.listDivider};
|
||||||
final TypedArray a = context.obtainStyledAttributes(ATTRS);
|
final TypedArray ta = context.obtainStyledAttributes(ATTRS);
|
||||||
divider = a.getDrawable(0);
|
divider = ta.getDrawable(0);
|
||||||
a.recycle();
|
// DrawableCompat.setTint(divider, context.getResources().getColor(R.color.divider_color_light)); //todo change drawable color
|
||||||
// mDivider = getMyApplication().getUIUtilities().getIcon(R.drawable.divider_solid, R.color.divider_color_light); //todo change drawable
|
ta.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -323,7 +320,7 @@ public class OverviewCard extends BaseCard {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SegmentItem {
|
private static class StatBlock {
|
||||||
private String title;
|
private String title;
|
||||||
private String value;
|
private String value;
|
||||||
private int imageResId;
|
private int imageResId;
|
||||||
|
@ -331,7 +328,7 @@ public class OverviewCard extends BaseCard {
|
||||||
private LineGraphType firstType;
|
private LineGraphType firstType;
|
||||||
private LineGraphType secondType;
|
private LineGraphType secondType;
|
||||||
|
|
||||||
public SegmentItem(String title, String value, @DrawableRes int imageResId, @ColorRes int imageColorId, LineGraphType firstType, LineGraphType secondType) {
|
public StatBlock(String title, String value, @DrawableRes int imageResId, @ColorRes int imageColorId, LineGraphType firstType, LineGraphType secondType) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.imageResId = imageResId;
|
this.imageResId = imageResId;
|
||||||
|
@ -340,53 +337,5 @@ public class OverviewCard extends BaseCard {
|
||||||
this.secondType = secondType;
|
this.secondType = secondType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getImageResId() {
|
|
||||||
return imageResId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImageResId(int imageResId) {
|
|
||||||
this.imageResId = imageResId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getImageColorId() {
|
|
||||||
return imageColorId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImageColorId(int imageColorId) {
|
|
||||||
this.imageColorId = imageColorId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LineGraphType getFirstType() {
|
|
||||||
return firstType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFirstType(LineGraphType firstType) {
|
|
||||||
this.firstType = firstType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LineGraphType getSecondType() {
|
|
||||||
return secondType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void getSecondType(LineGraphType secondType) {
|
|
||||||
this.secondType = secondType;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -221,6 +221,10 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateHeader() {
|
private void updateHeader() {
|
||||||
|
ViewGroup headerContainer = (ViewGroup) routeMenuTopShadowAll;
|
||||||
|
if (overviewCard != null && overviewCard.getView() != null) {
|
||||||
|
headerContainer.removeView(overviewCard.getView());
|
||||||
|
}
|
||||||
if (menuType == TrackMenuType.OPTIONS) {
|
if (menuType == TrackMenuType.OPTIONS) {
|
||||||
headerTitle.setText(menuType.titleId);
|
headerTitle.setText(menuType.titleId);
|
||||||
AndroidUiHelper.updateVisibility(headerIcon, false);
|
AndroidUiHelper.updateVisibility(headerIcon, false);
|
||||||
|
@ -228,7 +232,27 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
String fileName = Algorithms.getFileWithoutDirs(getGpx().path);
|
String fileName = Algorithms.getFileWithoutDirs(getGpx().path);
|
||||||
headerTitle.setText(GpxUiHelper.getGpxTitle(fileName));
|
headerTitle.setText(GpxUiHelper.getGpxTitle(fileName));
|
||||||
AndroidUiHelper.updateVisibility(headerIcon, true);
|
AndroidUiHelper.updateVisibility(headerIcon, true);
|
||||||
|
if (menuType == TrackMenuType.OVERVIEW) {
|
||||||
|
if (overviewCard != null && overviewCard.getView() != null) {
|
||||||
|
ViewGroup parent = ((ViewGroup) overviewCard.getView().getParent());
|
||||||
|
if (parent != null) {
|
||||||
|
parent.removeView(overviewCard.getView());
|
||||||
}
|
}
|
||||||
|
headerContainer.addView(overviewCard.getView());
|
||||||
|
} else {
|
||||||
|
overviewCard = new OverviewCard(getMapActivity(), displayHelper, this);
|
||||||
|
overviewCard.setListener(this);
|
||||||
|
headerContainer.addView(overviewCard.build(getMapActivity()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
runLayoutListener();
|
||||||
|
headerContainer.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
openMenuScreen(menuType == TrackMenuType.OVERVIEW ? MenuState.HEADER_ONLY : MenuState.HALF_SCREEN, false);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupCards() {
|
private void setupCards() {
|
||||||
|
@ -236,19 +260,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
ViewGroup cardsContainer = getCardsContainer();
|
ViewGroup cardsContainer = getCardsContainer();
|
||||||
cardsContainer.removeAllViews();
|
cardsContainer.removeAllViews();
|
||||||
if (menuType == TrackMenuType.OVERVIEW) {
|
if (menuType == TrackMenuType.TRACK) {
|
||||||
if (overviewCard != null && overviewCard.getView() != null) {
|
|
||||||
ViewGroup parent = (ViewGroup) overviewCard.getView().getParent();
|
|
||||||
if (parent != null) {
|
|
||||||
parent.removeAllViews();
|
|
||||||
}
|
|
||||||
cardsContainer.addView(overviewCard.getView());
|
|
||||||
} else {
|
|
||||||
overviewCard = new OverviewCard(mapActivity, displayHelper, this);
|
|
||||||
overviewCard.setListener(this);
|
|
||||||
cardsContainer.addView(overviewCard.build(mapActivity));
|
|
||||||
}
|
|
||||||
} else if (menuType == TrackMenuType.TRACK) {
|
|
||||||
if (segmentsCard != null && segmentsCard.getView() != null) {
|
if (segmentsCard != null && segmentsCard.getView() != null) {
|
||||||
ViewGroup parent = (ViewGroup) segmentsCard.getView().getParent();
|
ViewGroup parent = (ViewGroup) segmentsCard.getView().getParent();
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
|
|
Loading…
Reference in a new issue