Hide shadow under RP

This commit is contained in:
crimean 2019-02-23 19:38:53 +03:00
parent ea69ecf2b6
commit 176132f504
4 changed files with 28 additions and 4 deletions

View file

@ -10,7 +10,7 @@
<View
android:id="@+id/dividerToDropDown"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_height="1dp"
android:focusable="false" />
<LinearLayout

View file

@ -63,7 +63,7 @@ import net.osmand.plus.routing.TransportRoutingHelper;
import net.osmand.plus.search.QuickSearchHelper;
import net.osmand.plus.views.MapControlsLayer;
import net.osmand.router.GeneralRouter;
import net.osmand.router.TransportRoutePlanner;
import net.osmand.router.TransportRoutePlanner.TransportRouteResult;
import net.osmand.search.SearchUICore.SearchResultCollection;
import net.osmand.search.core.SearchResult;
@ -354,6 +354,12 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
fragmentRef.get().updateFromIcon();
}
public void setBottomShadowVisible(boolean visible) {
WeakReference<MapRouteInfoMenuFragment> fragmentRef = findMenuFragment();
if (fragmentRef != null)
fragmentRef.get().setBottomShadowVisible(visible);
}
public void build(LinearLayout rootView) {
rootView.removeAllViews();
for (BaseCard card : menuCards) {
@ -375,19 +381,22 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
menuCards.clear();
boolean bottomShadowVisible = true;
if (isBasicRouteCalculated()) {
GPXFile gpx = GpxUiHelper.makeGpxFromRoute(routingHelper.getRoute(), mapActivity.getMyApplication());
if (gpx != null) {
menuCards.add(new SimpleRouteCard(mapActivity, gpx));
}
bottomShadowVisible = gpx == null;
} else if (isTransportRouteCalculated()) {
List<TransportRoutePlanner.TransportRouteResult> routes = transportHelper.getRoutes();
List<TransportRouteResult> routes = transportHelper.getRoutes();
for (int i = 0; i < routes.size(); i++) {
PublicTransportCard card = new PublicTransportCard(mapActivity, routes.get(i), i);
card.setShowBottomShadow(i == routes.size() - 1);
card.setShowTopShadow(i != 0);
menuCards.add(card);
}
bottomShadowVisible = routes.size() == 0;
} else {
HomeWorkCard homeWorkCard = new HomeWorkCard(mapActivity);
menuCards.add(homeWorkCard);
@ -434,6 +443,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
}
}
}
setBottomShadowVisible(bottomShadowVisible);
setupCards();
}

View file

@ -10,7 +10,6 @@ import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.util.TypedValue;
import android.view.GestureDetector;
import android.view.Gravity;
@ -58,6 +57,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
private MapRouteInfoMenu menu;
private InterceptorLinearLayout mainView;
private FrameLayout bottomContainer;
private View modesLayoutToolbar;
private View modesLayoutToolbarContainer;
private View modesLayoutListContainer;
@ -123,6 +123,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
AndroidUtils.addStatusBarPadding21v(getActivity(), view);
mainView = view.findViewById(R.id.main_view);
bottomContainer = (FrameLayout) view.findViewById(R.id.bottom_container);
modesLayoutToolbar = view.findViewById(R.id.modes_layout_toolbar);
modesLayoutToolbarContainer = view.findViewById(R.id.modes_layout_toolbar_container);
modesLayoutListContainer = view.findViewById(R.id.modes_layout_list_container);
@ -774,6 +775,18 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
}
}
public void setBottomShadowVisible(boolean visible) {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
if (visible) {
AndroidUtils.setForeground(mapActivity, bottomContainer, nightMode,
R.drawable.bg_contextmenu_shadow, R.drawable.bg_contextmenu_shadow);
} else {
bottomContainer.setForeground(null);
}
}
}
public void updateInfo() {
if (menu != null) {
menu.updateInfo(view);

View file

@ -73,6 +73,7 @@ public class PublicTransportCard extends BaseCard {
});
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.top_divider).setVisibility(!showTopShadow ? View.VISIBLE : View.GONE);
}
public int getRouteId() {