blob: 3903cf0f8081c2bfefeb6a6c3ef6445b28f900f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
package com.mapswithme.maps.routing;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import com.mapswithme.maps.Framework;
import com.mapswithme.maps.R;
import com.mapswithme.maps.base.BaseMwmFragment;
import com.mapswithme.maps.base.OnBackPressListener;
public class RoutingPlanFragment extends BaseMwmFragment
implements OnBackPressListener
{
private RoutingPlanController mPlanController;
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
{
View res = inflater.inflate(R.layout.fragment_routing, container, false);
mPlanController = new RoutingPlanController(res, getActivity());
updatePoints();
Button start = (Button) res.findViewById(R.id.start);
RoutingController.get().setStartButton(start);
start.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
RoutingController.get().start();
}
});
Bundle activityState = getMwmActivity().getSavedInstanceState();
if (activityState != null)
restoreAltitudeChartState(activityState);
return res;
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState)
{
mPlanController.disableToggle();
}
@Override
public void onDestroyView()
{
super.onDestroyView();
RoutingController.get().setStartButton(null);
}
public void updatePoints()
{
mPlanController.updatePoints();
}
public void updateBuildProgress(int progress, @Framework.RouterType int router)
{
mPlanController.updateBuildProgress(progress, router);
}
@Override
public boolean onBackPressed()
{
return RoutingController.get().cancelPlanning();
}
public void showRouteAltitudeChart(boolean show)
{
mPlanController.showRouteAltitudeChart(show);
}
public void restoreAltitudeChartState(@NonNull Bundle state)
{
mPlanController.restoreAltitudeChartState(state);
}
public void saveAltitudeChartState(@NonNull Bundle outState)
{
mPlanController.saveAltitudeChartState(outState);
}
}
|