forked from organicmaps/organicmaps
[android] Added size of altitude chart panel processing depending on route type (the altitude image is not diplayed for vehicle route)
This commit is contained in:
parent
3315c9e49e
commit
124e445e63
5 changed files with 34 additions and 23 deletions
|
@ -1345,17 +1345,16 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onRouteBuilt() {
|
||||
mLogger.d("onRouteBuilt");
|
||||
public void onRouteBuilt(@Framework.RouterType int router) {
|
||||
if (mIsFragmentContainer)
|
||||
{
|
||||
RoutingPlanFragment fragment = (RoutingPlanFragment) getFragment(RoutingPlanFragment.class);
|
||||
if (fragment != null)
|
||||
fragment.showRouteAltitudeChart();
|
||||
fragment.showRouteAltitudeChart(router != Framework.ROUTER_TYPE_VEHICLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
mRoutingPlanInplaceController.showRouteAltitudeChart();
|
||||
mRoutingPlanInplaceController.showRouteAltitudeChart(router != Framework.ROUTER_TYPE_VEHICLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public class RoutingController
|
|||
void showDownloader(boolean openDownloaded);
|
||||
void updateMenu();
|
||||
void updatePoints();
|
||||
void onRouteBuilt();
|
||||
void onRouteBuilt(@Framework.RouterType int router);
|
||||
|
||||
/**
|
||||
* @param progress progress to be displayed.
|
||||
|
@ -116,7 +116,7 @@ public class RoutingController
|
|||
mCachedRoutingInfo = Framework.nativeGetRouteFollowingInfo();
|
||||
setBuildState(BuildState.BUILT);
|
||||
mLastBuildProgress = 100;
|
||||
mContainer.onRouteBuilt();
|
||||
mContainer.onRouteBuilt(mLastRouterType);
|
||||
}
|
||||
|
||||
processRoutingEvent();
|
||||
|
|
|
@ -291,6 +291,11 @@ public class RoutingPlanController extends ToolbarController
|
|||
}
|
||||
}
|
||||
|
||||
protected boolean isVehicleRouteChecked()
|
||||
{
|
||||
return mRouterTypes.getCheckedRadioButtonId() == R.id.vehicle;
|
||||
}
|
||||
|
||||
public void disableToggle()
|
||||
{
|
||||
UiUtils.hide(mToggle);
|
||||
|
@ -302,15 +307,28 @@ public class RoutingPlanController extends ToolbarController
|
|||
return mOpen;
|
||||
}
|
||||
|
||||
public void showRouteAltitudeChart()
|
||||
public void showRouteAltitudeChart(boolean show)
|
||||
{
|
||||
ImageView altitudeChart = (ImageView) mFrame.findViewById(R.id.altitude_chart);
|
||||
int chartWidth = mActivity.getResources().getDimensionPixelSize(R.dimen.altitude_chart_image_width);
|
||||
int chartHeight = mActivity.getResources().getDimensionPixelSize(R.dimen.altitude_chart_image_height);
|
||||
Bitmap bm = Framework.GenerateRouteAltitudeChart(chartWidth, chartHeight);
|
||||
if (bm != null)
|
||||
showRouteAltitudeChartInternal(show, altitudeChart);
|
||||
}
|
||||
|
||||
protected void showRouteAltitudeChartInternal(boolean show, ImageView altitudeChart)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
altitudeChart.setImageBitmap(bm);
|
||||
int chartWidth = mActivity.getResources().getDimensionPixelSize(R.dimen.altitude_chart_image_width);
|
||||
int chartHeight = mActivity.getResources().getDimensionPixelSize(R.dimen.altitude_chart_image_height);
|
||||
Bitmap bm = Framework.GenerateRouteAltitudeChart(chartWidth, chartHeight);
|
||||
if (bm != null)
|
||||
{
|
||||
altitudeChart.setImageBitmap(bm);
|
||||
altitudeChart.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
altitudeChart.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,8 +70,8 @@ public class RoutingPlanFragment extends BaseMwmFragment
|
|||
return RoutingController.get().cancelPlanning();
|
||||
}
|
||||
|
||||
public void showRouteAltitudeChart()
|
||||
public void showRouteAltitudeChart(boolean show)
|
||||
{
|
||||
mPlanController.showRouteAltitudeChart();
|
||||
mPlanController.showRouteAltitudeChart(show);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,20 +93,14 @@ public class RoutingPlanInplaceController extends RoutingPlanController
|
|||
mSlotsRestoredState = state.getBoolean(STATE_OPEN);
|
||||
|
||||
if (state.getBoolean(STATE_ALTITUDE_CHART_SHOWN))
|
||||
showRouteAltitudeChart();
|
||||
showRouteAltitudeChart(!isVehicleRouteChecked());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showRouteAltitudeChart()
|
||||
public void showRouteAltitudeChart(boolean show)
|
||||
{
|
||||
ImageView altitudeChart = (ImageView) mActivity.findViewById(R.id.altitude_chart);
|
||||
int chartWidth = mActivity.getResources().getDimensionPixelSize(R.dimen.altitude_chart_image_width);
|
||||
int chartHeight = mActivity.getResources().getDimensionPixelSize(R.dimen.altitude_chart_image_height);
|
||||
Bitmap bm = Framework.GenerateRouteAltitudeChart(chartWidth, chartHeight);
|
||||
if (bm != null)
|
||||
{
|
||||
altitudeChart.setImageBitmap(bm);
|
||||
}
|
||||
showRouteAltitudeChartInternal(show, altitudeChart);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue