[Android] Refactoring of routing details panel.
Signed-off-by: S. Kozyr <s.trump@gmail.com>
This commit is contained in:
parent
88ec618d1d
commit
d2f0d10349
3 changed files with 76 additions and 32 deletions
|
@ -60,9 +60,11 @@ final class RoutingBottomMenuController implements View.OnClickListener
|
|||
@NonNull
|
||||
private final ImageView mAltitudeChart;
|
||||
@NonNull
|
||||
private final TextView mAltitudeDifference;
|
||||
private final TextView mTime;
|
||||
@NonNull
|
||||
private final View mNumbersFrame;
|
||||
private final TextView mAltitudeDifference;
|
||||
@Nullable
|
||||
private final TextView mArrival;
|
||||
@NonNull
|
||||
private final View mActionFrame;
|
||||
@NonNull
|
||||
|
@ -86,12 +88,13 @@ final class RoutingBottomMenuController implements View.OnClickListener
|
|||
TextView error = (TextView) getViewById(activity, frame, R.id.error);
|
||||
Button start = (Button) getViewById(activity, frame, R.id.start);
|
||||
ImageView altitudeChart = (ImageView) getViewById(activity, frame, R.id.altitude_chart);
|
||||
TextView time = (TextView) getViewById(activity, frame, R.id.time);
|
||||
TextView altitudeDifference = (TextView) getViewById(activity, frame, R.id.altitude_difference);
|
||||
View numbersFrame = getViewById(activity, frame, R.id.numbers);
|
||||
TextView arrival = (TextView) getViewById(activity, frame, R.id.arrival);
|
||||
View actionFrame = getViewById(activity, frame, R.id.routing_action_frame);
|
||||
|
||||
return new RoutingBottomMenuController(activity, altitudeChartFrame, transitFrame, error, start, altitudeChart, altitudeDifference,
|
||||
numbersFrame, actionFrame, listener);
|
||||
return new RoutingBottomMenuController(activity, altitudeChartFrame, transitFrame, error, start, altitudeChart,
|
||||
time, altitudeDifference, arrival, actionFrame, listener);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -108,8 +111,9 @@ final class RoutingBottomMenuController implements View.OnClickListener
|
|||
@NonNull TextView error,
|
||||
@NonNull Button start,
|
||||
@NonNull ImageView altitudeChart,
|
||||
@NonNull TextView time,
|
||||
@NonNull TextView altitudeDifference,
|
||||
@NonNull View numbersFrame,
|
||||
@Nullable TextView arrival,
|
||||
@NonNull View actionFrame,
|
||||
@Nullable RoutingBottomMenuListener listener)
|
||||
{
|
||||
|
@ -119,8 +123,9 @@ final class RoutingBottomMenuController implements View.OnClickListener
|
|||
mError = error;
|
||||
mStart = start;
|
||||
mAltitudeChart = altitudeChart;
|
||||
mTime = time;
|
||||
mAltitudeDifference = altitudeDifference;
|
||||
mNumbersFrame = numbersFrame;
|
||||
mArrival = arrival;
|
||||
mActionFrame = actionFrame;
|
||||
mActionMessage = actionFrame.findViewById(R.id.tv__message);
|
||||
mActionButton = actionFrame.findViewById(R.id.btn__my_position_use);
|
||||
|
@ -155,7 +160,7 @@ final class RoutingBottomMenuController implements View.OnClickListener
|
|||
@SuppressLint("SetTextI18n")
|
||||
void showTransitInfo(@NonNull TransitRouteInfo info)
|
||||
{
|
||||
UiUtils.hide(mError, mAltitudeChartFrame, mActionFrame, mAltitudeChartFrame);
|
||||
UiUtils.hide(mError, mAltitudeChartFrame, mActionFrame);
|
||||
showStartButton(false);
|
||||
UiUtils.show(mTransitFrame);
|
||||
RecyclerView rv = mTransitFrame.findViewById(R.id.transit_recycler_view);
|
||||
|
@ -332,19 +337,18 @@ final class RoutingBottomMenuController implements View.OnClickListener
|
|||
final RoutingInfo rinfo = RoutingController.get().getCachedRoutingInfo();
|
||||
if (rinfo == null)
|
||||
{
|
||||
UiUtils.hide(mNumbersFrame);
|
||||
UiUtils.hide(mTime);
|
||||
UiUtils.hide(mAltitudeDifference);
|
||||
return;
|
||||
}
|
||||
|
||||
Spanned spanned = makeSpannedRoutingDetails(mContext, rinfo);
|
||||
TextView numbersTime = mNumbersFrame.findViewById(R.id.time);
|
||||
numbersTime.setText(spanned);
|
||||
mTime.setText(spanned);
|
||||
|
||||
TextView numbersArrival = mNumbersFrame.findViewById(R.id.arrival);
|
||||
if (numbersArrival != null)
|
||||
if (mArrival != null)
|
||||
{
|
||||
String arrivalTime = RoutingController.formatArrivalTime(rinfo.totalTimeInSeconds);
|
||||
numbersArrival.setText(arrivalTime);
|
||||
mArrival.setText(arrivalTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,23 +1,71 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/altitude_chart_panel"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginBottom="@dimen/altitude_chart_margin_bottom"
|
||||
android:layout_marginTop="@dimen/altitude_chart_margin_top"
|
||||
android:paddingStart="@dimen/altitude_chart_container_padding_left"
|
||||
android:paddingEnd="@dimen/altitude_chart_container_padding_left"
|
||||
android:orientation="vertical"
|
||||
tools:showIn="@layout/fragment_routing">
|
||||
|
||||
<include layout="@layout/routing_details"/>
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginBottom="@dimen/margin_half"
|
||||
android:layout_marginEnd="@dimen/margin_half"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:layout_alignParentStart="true"
|
||||
android:orientation="horizontal"
|
||||
android:layout_toStartOf="@id/altitude_difference"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="5 h 55 min • 1555km"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/altitude_difference"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/altitude_chart_time_distance_height"
|
||||
android:layout_marginBottom="@dimen/margin_half"
|
||||
android:layout_marginStart="@dimen/margin_half"
|
||||
android:textAppearance="@style/MwmTextAppearance.Body3"
|
||||
android:fontFamily="@string/robotoMedium"
|
||||
android:textColor="?colorAccent"
|
||||
android:layout_gravity="end"
|
||||
android:gravity="center"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:visibility="gone"
|
||||
tools:text="43 m"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/altitude_chart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="@dimen/margin_half"/>
|
||||
</LinearLayout>
|
||||
android:id="@+id/altitude_chart"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@id/time"
|
||||
android:layout_toStartOf="@id/start"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="@dimen/margin_half"
|
||||
android:layout_marginBottom="@dimen/margin_half"
|
||||
android:layout_marginEnd="@dimen/margin_half" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/start"
|
||||
style="@style/MwmWidget.Button.Primary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="@dimen/start_button_width"
|
||||
android:layout_marginStart="@dimen/margin_half"
|
||||
android:layout_marginTop="@dimen/margin_half"
|
||||
android:text="@string/p2p_start"
|
||||
tools:showIn="@layout/menu_route_plan_line"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_below="@id/altitude_difference"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -7,18 +7,10 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<include layout="@layout/altitude_chart_panel"
|
||||
tools:visibility="visible"/>
|
||||
<include layout="@layout/altitude_chart_panel" />
|
||||
|
||||
<include layout="@layout/routing_bottom_panel_transit"/>
|
||||
|
||||
<include
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/margin_base"
|
||||
android:layout_gravity="center_vertical"
|
||||
layout="@layout/start_button"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/error"
|
||||
android:paddingStart="@dimen/margin_base"
|
||||
|
|
Reference in a new issue