Route details almost done

This commit is contained in:
crimean 2019-03-24 21:48:26 +03:00
parent 2316cd8ae1
commit 25656e83a8
6 changed files with 225 additions and 29 deletions

View file

@ -7,6 +7,7 @@
android:background="@color/color_transparent"> android:background="@color/color_transparent">
<LinearLayout <LinearLayout
android:id="@+id/pager_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"

View file

@ -73,6 +73,8 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
private int minHalfY; private int minHalfY;
private int topScreenPosY; private int topScreenPosY;
private int topToolbarPosY;
private int bottomToolbarPosY;
private int topPadding; private int topPadding;
private int menuFullHeightMax; private int menuFullHeightMax;
private int menuBottomViewHeight; private int menuBottomViewHeight;
@ -164,6 +166,10 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
this.listener = listener; this.listener = listener;
} }
public boolean isPortrait() {
return portrait;
}
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
@ -190,8 +196,10 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
topShadowMargin = AndroidUtils.dpToPx(mapActivity, 9f); topShadowMargin = AndroidUtils.dpToPx(mapActivity, 9f);
statusBarHeight = AndroidUtils.getStatusBarHeight(mapActivity); statusBarHeight = AndroidUtils.getStatusBarHeight(mapActivity);
shadowHeight = AndroidUtils.dpToPx(mapActivity, SHADOW_HEIGHT_TOP_DP); shadowHeight = portrait ? AndroidUtils.dpToPx(mapActivity, SHADOW_HEIGHT_TOP_DP) : 0;
topScreenPosY = addStatusBarHeightIfNeeded(-shadowHeight); topScreenPosY = addStatusBarHeightIfNeeded(-shadowHeight);
topToolbarPosY = getMenuStatePosY(MenuState.FULL_SCREEN);
bottomToolbarPosY = topToolbarPosY + getToolbarHeight();
mainView = view.findViewById(getMainViewId()); mainView = view.findViewById(getMainViewId());
nightMode = app.getDaynightHelper().isNightModeForMapControls(); nightMode = app.getDaynightHelper().isNightModeForMapControls();
@ -202,12 +210,18 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
AndroidUtils.setBackground(app, mainView, nightMode, R.drawable.bg_map_context_menu_light, R.drawable.bg_map_context_menu_dark); AndroidUtils.setBackground(app, mainView, nightMode, R.drawable.bg_map_context_menu_light, R.drawable.bg_map_context_menu_dark);
if (!portrait) { if (!portrait) {
topPadding = getToolbarHeight() - topScreenPosY; currentMenuState = MenuState.FULL_SCREEN;
if (isSingleFragment()) {
topPadding = getToolbarHeight() - topScreenPosY;
final TypedValue typedValueAttr = new TypedValue();
mapActivity.getTheme().resolveAttribute(R.attr.left_menu_view_bg, typedValueAttr, true);
mainView.setBackgroundResource(typedValueAttr.resourceId);
mainView.setLayoutParams(new FrameLayout.LayoutParams(getResources().getDimensionPixelSize(R.dimen.dashboard_land_width), ViewGroup.LayoutParams.MATCH_PARENT));
} else {
topPadding = getToolbarHeight() + topShadowMargin;
mainView.setLayoutParams(new FrameLayout.LayoutParams(AndroidUtils.dpToPx(mapActivity, 345f), ViewGroup.LayoutParams.MATCH_PARENT));
}
bottomScrollView.setPadding(0, topPadding, 0, 0); bottomScrollView.setPadding(0, topPadding, 0, 0);
final TypedValue typedValueAttr = new TypedValue();
mapActivity.getTheme().resolveAttribute(R.attr.left_menu_view_bg, typedValueAttr, true);
mainView.setBackgroundResource(typedValueAttr.resourceId);
mainView.setLayoutParams(new FrameLayout.LayoutParams(getResources().getDimensionPixelSize(R.dimen.dashboard_land_width), ViewGroup.LayoutParams.MATCH_PARENT));
} }
processScreenHeight(container); processScreenHeight(container);
@ -296,7 +310,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
if ((Math.abs(initialVelocity) > minimumVelocity) && currentY != fullScreenTopPosY) { if ((Math.abs(initialVelocity) > minimumVelocity) && currentY != fullScreenTopPosY) {
scroller.abortAnimation(); scroller.abortAnimation();
scroller.fling(0, currentY, 0, initialVelocity, 0, 0, scroller.fling(0, currentY, 0, initialVelocity, 0, 0,
Math.min(viewHeight - menuFullHeightMax, fullScreenTopPosY), Math.min(getMinY(), fullScreenTopPosY),
screenHeight, screenHeight,
0, 0); 0, 0);
currentY = scroller.getFinalY(); currentY = scroller.getFinalY();
@ -363,6 +377,52 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
return view; return view;
} }
public float getToolbarAlpha(int y) {
float a = 0;
if (portrait) {
if (y < bottomToolbarPosY) {
a = 1f - (y - topToolbarPosY) * (1f / (bottomToolbarPosY - topToolbarPosY));
}
if (a < 0) {
a = 0;
} else if (a > 1) {
a = 1;
}
}
return a;
}
public void updateToolbarVisibility(View view) {
updateToolbarVisibility(view, getViewY());
}
public void updateToolbarVisibility(View view, int y) {
float a = getToolbarAlpha(y);
updateVisibility(view, a);
}
public void updateVisibility(View v, float alpha) {
boolean visible = alpha > 0;
v.setAlpha(alpha);
if (visible && v.getVisibility() != View.VISIBLE) {
v.setVisibility(View.VISIBLE);
} else if (!visible && v.getVisibility() == View.VISIBLE) {
v.setVisibility(View.INVISIBLE);
}
}
public void updateVisibility(View v, boolean visible) {
if (visible && v.getVisibility() != View.VISIBLE) {
v.setVisibility(View.VISIBLE);
} else if (!visible && v.getVisibility() == View.VISIBLE) {
v.setVisibility(View.INVISIBLE);
}
}
public int getMinY() {
return viewHeight - menuFullHeightMax - (portrait ? getToolbarHeight() : 0);
}
private int addStatusBarHeightIfNeeded(int res) { private int addStatusBarHeightIfNeeded(int res) {
MapActivity mapActivity = getMapActivity(); MapActivity mapActivity = getMapActivity();
if (Build.VERSION.SDK_INT >= 21 && mapActivity != null) { if (Build.VERSION.SDK_INT >= 21 && mapActivity != null) {
@ -461,7 +521,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
return (int) mainView.getY(); return (int) mainView.getY();
} }
private void setViewY(int y, boolean animated, boolean adjustMapPos) { protected void setViewY(int y, boolean animated, boolean adjustMapPos) {
mainView.setY(y); mainView.setY(y);
ContextMenuFragmentListener listener = this.listener; ContextMenuFragmentListener listener = this.listener;
if (listener != null) { if (listener != null) {
@ -505,7 +565,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
} }
} }
private int getMenuStatePosY(int menuState) { public int getMenuStatePosY(int menuState) {
if (!portrait) { if (!portrait) {
return topScreenPosY; return topScreenPosY;
} }
@ -543,7 +603,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
} }
} }
private void changeMenuState(int currentY, boolean slidingUp, boolean slidingDown, boolean animated) { protected void changeMenuState(int currentY, boolean slidingUp, boolean slidingDown, boolean animated) {
boolean needCloseMenu = false; boolean needCloseMenu = false;
int currentMenuState = getCurrentMenuState(); int currentMenuState = getCurrentMenuState();
@ -629,7 +689,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
break; break;
case MenuState.FULL_SCREEN: case MenuState.FULL_SCREEN:
if (currentY != CURRENT_Y_UNDEFINED) { if (currentY != CURRENT_Y_UNDEFINED) {
int maxPosY = viewHeight - menuFullHeightMax; int maxPosY = getMinY();
int minPosY = getMenuStatePosY(MenuState.FULL_SCREEN); int minPosY = getMenuStatePosY(MenuState.FULL_SCREEN);
if (maxPosY > minPosY) { if (maxPosY > minPosY) {
maxPosY = minPosY; maxPosY = minPosY;
@ -662,14 +722,13 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
} }
} }
private void applyPosY(final int currentY, final boolean needCloseMenu, boolean needMapAdjust, protected void applyPosY(final int currentY, final boolean needCloseMenu, boolean needMapAdjust,
final int previousMenuState, final int newMenuState, int dZoom, boolean animated) { final int previousMenuState, final int newMenuState, int dZoom, final boolean animated) {
final int posY = getPosY(currentY, needCloseMenu, previousMenuState); final int posY = getPosY(currentY, needCloseMenu, previousMenuState);
if (getViewY() != posY || dZoom != 0) { if (getViewY() != posY || dZoom != 0) {
if (posY < getViewY()) { if (posY < getViewY()) {
updateMainViewLayout(posY); updateMainViewLayout(posY);
} }
if (animated) { if (animated) {
mainView.animate().y(posY) mainView.animate().y(posY)
.setDuration(ANIMATION_DURATION) .setDuration(ANIMATION_DURATION)
@ -708,7 +767,6 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
} }
} }
} }
ContextMenuFragmentListener listener = this.listener; ContextMenuFragmentListener listener = this.listener;
if (listener != null) { if (listener != null) {
listener.onContextMenuYPosChanged(this, posY, true); listener.onContextMenuYPosChanged(this, posY, true);

View file

@ -1,6 +1,8 @@
package net.osmand.plus.routepreparationmenu; package net.osmand.plus.routepreparationmenu;
import android.Manifest; import android.Manifest;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.content.Intent; import android.content.Intent;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
@ -17,10 +19,12 @@ import android.support.v4.view.ViewPager;
import android.support.v7.view.ContextThemeWrapper; import android.support.v7.view.ContextThemeWrapper;
import android.text.Html; import android.text.Html;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.TypedValue;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageButton; import android.widget.ImageButton;
@ -118,10 +122,13 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
if (!portrait) { if (!portrait) {
initialMenuState = MenuState.FULL_SCREEN; initialMenuState = MenuState.FULL_SCREEN;
solidToolbarView.setLayoutParams(new FrameLayout.LayoutParams(AndroidUtils.dpToPx(mapActivity, 345f), ViewGroup.LayoutParams.WRAP_CONTENT)); solidToolbarView.setLayoutParams(new FrameLayout.LayoutParams(AndroidUtils.dpToPx(mapActivity, 345f), ViewGroup.LayoutParams.WRAP_CONTENT));
solidToolbarView.setVisibility(View.VISIBLE);
final TypedValue typedValueAttr = new TypedValue();
mapActivity.getTheme().resolveAttribute(R.attr.left_menu_view_bg, typedValueAttr, true);
view.findViewById(R.id.pager_container).setBackgroundResource(typedValueAttr.resourceId);
view.setLayoutParams(new FrameLayout.LayoutParams(getResources().getDimensionPixelSize(R.dimen.dashboard_land_width), ViewGroup.LayoutParams.MATCH_PARENT)); view.setLayoutParams(new FrameLayout.LayoutParams(getResources().getDimensionPixelSize(R.dimen.dashboard_land_width), ViewGroup.LayoutParams.MATCH_PARENT));
} }
viewPager.setClipToPadding(false); viewPager.setClipToPadding(false);
//viewPager.setPageMargin(-60);
final RoutesPagerAdapter pagerAdapter = new RoutesPagerAdapter(getChildFragmentManager(), publicTransportMode ? routes.size() : 1, initialMenuState); final RoutesPagerAdapter pagerAdapter = new RoutesPagerAdapter(getChildFragmentManager(), publicTransportMode ? routes.size() : 1, initialMenuState);
viewPager.setAdapter(pagerAdapter); viewPager.setAdapter(pagerAdapter);
viewPager.setCurrentItem(routeIndex); viewPager.setCurrentItem(routeIndex);
@ -608,14 +615,32 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
} }
} }
public void updateToolbars(@NonNull ContextMenuFragment fragment, int y) { public void updateToolbars(@NonNull final ContextMenuFragment fragment, int y, boolean animated) {
MapActivity mapActivity = getMapActivity(); final MapActivity mapActivity = getMapActivity();
if (mapActivity != null) { if (mapActivity != null) {
View solidToolbarView = this.solidToolbarView; final View solidToolbarView = this.solidToolbarView;
if (solidToolbarView != null) { if (solidToolbarView != null && portrait) {
solidToolbarView.setVisibility(y - fragment.getTopShadowMargin() <= solidToolbarHeight ? View.VISIBLE : View.GONE); if (animated) {
final float toolbarAlpha = fragment.getToolbarAlpha(y);
if (toolbarAlpha > 0) {
fragment.updateVisibility(solidToolbarView, true);
}
solidToolbarView.animate().alpha(toolbarAlpha)
.setDuration(ContextMenuFragment.ANIMATION_DURATION)
.setInterpolator(new DecelerateInterpolator())
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
fragment.updateVisibility(solidToolbarView, toolbarAlpha);
mapActivity.updateStatusBarColor();
}
})
.start();
} else {
fragment.updateToolbarVisibility(solidToolbarView, y);
mapActivity.updateStatusBarColor();
}
} }
mapActivity.updateStatusBarColor();
} }
} }
@ -651,7 +676,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
@Override @Override
public void onContextMenuYPosChanged(@NonNull ContextMenuFragment fragment, int y, boolean animated) { public void onContextMenuYPosChanged(@NonNull ContextMenuFragment fragment, int y, boolean animated) {
if (fragment == getCurrentFragment()) { if (fragment == getCurrentFragment()) {
updateToolbars(fragment, y); updateToolbars(fragment, y, animated);
updateZoomButtonsPos(fragment, y, animated); updateZoomButtonsPos(fragment, y, animated);
updateViewPager(fragment.getViewY()); updateViewPager(fragment.getViewY());
} }
@ -662,7 +687,6 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
LockableViewPager viewPager = this.viewPager; LockableViewPager viewPager = this.viewPager;
if (viewPager != null) { if (viewPager != null) {
int currentItem = viewPager.getCurrentItem(); int currentItem = viewPager.getCurrentItem();
int i = 0;
List<WeakReference<RouteDetailsFragment>> routeDetailsFragments = this.routeDetailsFragments; List<WeakReference<RouteDetailsFragment>> routeDetailsFragments = this.routeDetailsFragments;
for (WeakReference<RouteDetailsFragment> ref : routeDetailsFragments) { for (WeakReference<RouteDetailsFragment> ref : routeDetailsFragments) {
RouteDetailsFragment f = ref.get(); RouteDetailsFragment f = ref.get();
@ -676,7 +700,6 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
updateViewPager(fragment.getViewY()); updateViewPager(fragment.getViewY());
} }
} }
i++;
} }
} }
} }

View file

@ -25,6 +25,8 @@ import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener; import android.view.View.OnLongClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.Transformation;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@ -93,9 +95,12 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT
CardListener { CardListener {
public static final String ROUTE_ID_KEY = "route_id_key"; public static final String ROUTE_ID_KEY = "route_id_key";
private static final float PAGE_MARGIN = 5f;
private int routeId = -1; private int routeId = -1;
private String destinationStreetStr = ""; private String destinationStreetStr = "";
private int pageMarginPx;
private int toolbarHeightPx;
private GPXFile gpx; private GPXFile gpx;
private OrderedLineDataSet slopeDataSet; private OrderedLineDataSet slopeDataSet;
@ -127,7 +132,7 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT
@Override @Override
public int getToolbarHeight() { public int getToolbarHeight() {
return getResources().getDimensionPixelSize(R.dimen.dashboard_map_toolbar); return toolbarHeightPx;
} }
@Override @Override
@ -142,11 +147,17 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
Bundle args = getArguments();
if (args != null) {
routeId = args.getInt(ROUTE_ID_KEY);
}
pageMarginPx = dpToPx(PAGE_MARGIN);
toolbarHeightPx = getResources().getDimensionPixelSize(R.dimen.dashboard_map_toolbar);
View view = super.onCreateView(inflater, container, savedInstanceState); View view = super.onCreateView(inflater, container, savedInstanceState);
if (view != null) { if (view != null) {
Bundle args = getArguments(); if (isPortrait()) {
if (args != null) { view.findViewById(getBottomScrollViewId()).setBackgroundDrawable(null);
routeId = args.getInt(ROUTE_ID_KEY);
} }
updateCards(view); updateCards(view);
runLayoutListener(); runLayoutListener();
@ -159,6 +170,96 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT
return transportCard; return transportCard;
} }
@Override
protected void changeMenuState(int currentY, boolean slidingUp, boolean slidingDown, boolean animated) {
super.changeMenuState(currentY, slidingUp, slidingDown, animated);
View mainView = getMainView();
if (mainView != null && isPortrait()) {
final LinearLayout cardsContainer = (LinearLayout) mainView.findViewById(R.id.route_menu_cards_container);
final FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) cardsContainer.getLayoutParams();
final int currentMenuState = getCurrentMenuState();
if (animated) {
final int marginStart = layoutParams.leftMargin;
final int marginEnd = currentMenuState == MenuState.HEADER_ONLY ? pageMarginPx : 0;
if (marginStart != marginEnd) {
Animation a = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
int margin = marginStart + (int) ((marginEnd - marginStart) * interpolatedTime);
layoutParams.setMargins(margin, 0, margin, 0);
cardsContainer.setLayoutParams(layoutParams);
}
};
a.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
updateCardsLayout();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
a.setDuration(ANIMATION_DURATION);
cardsContainer.startAnimation(a);
}
} else {
updateCardsLayout();
}
}
}
private void updateCardsLayout() {
View mainView = getMainView();
if (mainView != null) {
LinearLayout cardsContainer = (LinearLayout) mainView.findViewById(R.id.route_menu_cards_container);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) cardsContainer.getLayoutParams();
if (getCurrentMenuState() == MenuState.HEADER_ONLY) {
layoutParams.setMargins(pageMarginPx, 0, pageMarginPx, 0);
AndroidUtils.setBackground(mainView.getContext(), cardsContainer, isNightMode(), R.drawable.travel_card_bg_light, R.drawable.travel_card_bg_dark);
mainView.setBackgroundDrawable(null);
} else {
layoutParams.setMargins(0, 0, 0, 0);
cardsContainer.setBackgroundDrawable(null);
AndroidUtils.setBackground(mainView.getContext(), mainView, isNightMode(), R.drawable.bg_map_context_menu_light, R.drawable.bg_map_context_menu_dark);
}
cardsContainer.setLayoutParams(layoutParams);
}
}
@Override
protected void setViewY(int y, boolean animated, boolean adjustMapPos) {
super.setViewY(y, animated, adjustMapPos);
View mainView = getMainView();
if (mainView != null && isPortrait()) {
int headerOnlyY = getMenuStatePosY(MenuState.HEADER_ONLY);
int halfScreenY = getMenuStatePosY(MenuState.HALF_SCREEN);
float margin = 0;
if (y > headerOnlyY) {
margin = PAGE_MARGIN;
} else if (y > halfScreenY) {
margin = PAGE_MARGIN * (1f - (float)(headerOnlyY - y) / (headerOnlyY - halfScreenY));
}
int marginPx = dpToPx(margin);
LinearLayout cardsContainer = (LinearLayout) mainView.findViewById(R.id.route_menu_cards_container);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) cardsContainer.getLayoutParams();
if (layoutParams.leftMargin != marginPx) {
layoutParams.setMargins(marginPx, 0, marginPx, 0);
}
if (y > halfScreenY) {
AndroidUtils.setBackground(mainView.getContext(), cardsContainer, isNightMode(), R.drawable.travel_card_bg_light, R.drawable.travel_card_bg_dark);
mainView.setBackgroundDrawable(null);
} else {
cardsContainer.setBackgroundDrawable(null);
AndroidUtils.setBackground(mainView.getContext(),mainView, isNightMode(), R.drawable.bg_map_context_menu_light, R.drawable.bg_map_context_menu_dark);
}
}
}
private void updateCards(@NonNull View view) { private void updateCards(@NonNull View view) {
MapActivity mapActivity = getMapActivity(); MapActivity mapActivity = getMapActivity();
if (mapActivity != null) { if (mapActivity != null) {
@ -176,6 +277,7 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT
card.setShowTopShadow(false); card.setShowTopShadow(false);
card.setShowBottomShadow(false); card.setShowBottomShadow(false);
card.setShowDivider(false); card.setShowDivider(false);
card.setTransparentBackground(true);
card.setTransportCardListener(this); card.setTransportCardListener(this);
card.setListener(this); card.setListener(this);
transportCard = card; transportCard = card;

View file

@ -25,6 +25,7 @@ public abstract class BaseCard {
boolean showTopShadow; boolean showTopShadow;
boolean showBottomShadow; boolean showBottomShadow;
boolean showDivider = true; boolean showDivider = true;
boolean transparentBackground;
protected boolean nightMode; protected boolean nightMode;
private CardListener listener; private CardListener listener;
@ -122,4 +123,12 @@ public abstract class BaseCard {
public void setShowDivider(boolean showDivider) { public void setShowDivider(boolean showDivider) {
this.showDivider = showDivider; this.showDivider = showDivider;
} }
public boolean isTransparentBackground() {
return transparentBackground;
}
public void setTransparentBackground(boolean transparentBackground) {
this.transparentBackground = transparentBackground;
}
} }

View file

@ -144,6 +144,9 @@ public class PublicTransportCard extends BaseCard {
view.findViewById(R.id.bottom_shadow).setVisibility(showBottomShadow ? View.VISIBLE : View.GONE); view.findViewById(R.id.bottom_shadow).setVisibility(showBottomShadow ? View.VISIBLE : View.GONE);
view.findViewById(R.id.card_divider).setVisibility(showTopShadow ? View.VISIBLE : View.GONE); view.findViewById(R.id.card_divider).setVisibility(showTopShadow ? View.VISIBLE : View.GONE);
view.findViewById(R.id.top_divider).setVisibility(!showTopShadow && showDivider ? View.VISIBLE : View.GONE); view.findViewById(R.id.top_divider).setVisibility(!showTopShadow && showDivider ? View.VISIBLE : View.GONE);
if (transparentBackground) {
view.findViewById(R.id.routes_info_container).setBackgroundDrawable(null);
}
} }
public int getRouteId() { public int getRouteId() {