[android] Modified the layouts according to previous behavior, removed the useless views

This commit is contained in:
Dmitry Donskoy 2019-08-20 14:54:09 +03:00 committed by Aleksandr Zatsepin
parent cb2645f992
commit 75db5f323b
4 changed files with 32 additions and 85 deletions

View file

@ -6,31 +6,13 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
<TextView
android:id="@+id/time"
android:singleLine="true"
android:ellipsize="middle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/time"
android:singleLine="true"
android:ellipsize="middle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="33 min"/>
<TextView
style="@style/MwmWidget.TextView.PlanDetail.Number.Secondary"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="2dp"
android:visibility="gone"
android:text="•"
tools:ignore="HardcodedText"/>
<TextView
android:id="@+id/distance"
android:visibility="gone"
style="@style/MwmWidget.TextView.PlanDetail.Number"
tools:text="1024 km"/>
</LinearLayout>
tools:text="33 min"/>
<TextView
android:id="@+id/altitude_difference"
android:layout_width="wrap_content"

View file

@ -13,24 +13,6 @@
android:ellipsize="middle"
android:layout_marginBottom="4dp"
tools:text="33 min"/>
<TextView
style="@style/MwmWidget.TextView.PlanDetail.Number.Secondary"
android:id="@+id/dot"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="2dp"
android:layout_toRightOf="@id/time"
android:layout_toEndOf="@id/time"
android:visibility="gone"
android:text="•"
tools:ignore="HardcodedText"/>
<TextView
android:id="@+id/distance"
style="@style/MwmWidget.TextView.PlanDetail.Number"
android:layout_toEndOf="@id/dot"
android:layout_toRightOf="@id/dot"
android:visibility="gone"
tools:text="1024 km 324"/>
<TextView
android:id="@+id/arrival"
android:layout_width="match_parent"
@ -39,8 +21,8 @@
android:layout_alignLeft="@id/time"
android:layout_alignStart="@id/time"
android:layout_marginBottom="10dp"
android:visibility="gone"
tools:text="Arrival 13:03"
style="@style/MwmWidget.TextView.PlanDetail.Number.Secondary"
android:textSize="@dimen/text_size_routing_plan_detail_arrival"/>
<TextView
android:id="@+id/altitude_difference"

View file

@ -4,7 +4,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/numbers"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/altitude_chart_time_distance_margin_bottom">
<TextView
android:id="@+id/altitude_difference"
android:layout_width="wrap_content"
@ -20,39 +21,15 @@
tools:text="43 m"
tools:targetApi="jelly_bean"
tools:visibility="visible"/>
<LinearLayout
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="middle"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:orientation="horizontal"
android:layout_toLeftOf="@id/altitude_difference"
android:layout_toStartOf="@id/altitude_difference">
<TextView
android:id="@+id/time"
android:layout_width="0dp"
android:layout_weight="1"
android:singleLine="true"
android:ellipsize="middle"
tools:text="33 min"
android:layout_height="wrap_content"/>
<TextView
style="@style/MwmWidget.TextView.PlanDetail.Number.Secondary"
android:layout_marginLeft="6dp"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_marginRight="6dp"
android:layout_marginTop="2dp"
android:visibility="gone"
android:text="•"
tools:ignore="HardcodedText"/>
<TextView
android:id="@+id/distance"
android:layout_width="0dp"
android:layout_weight="1"
android:visibility="gone"
style="@style/MwmWidget.TextView.PlanDetail.Number"
tools:text="1024 km"/>
</LinearLayout>
android:layout_toStartOf="@id/altitude_difference"
android:layout_height="wrap_content"/>
</RelativeLayout>

View file

@ -370,7 +370,14 @@ final class RoutingBottomMenuController implements View.OnClickListener
Spanned spanned = makeSpannedRoutingDetails(mContext, rinfo);
TextView numbersTime = (TextView) mNumbersFrame.findViewById(R.id.time);
numbersTime.setText(spanned, TextView.BufferType.SPANNABLE);
numbersTime.setText(spanned);
TextView numbersArrival = (TextView) mNumbersFrame.findViewById(R.id.arrival);
if (numbersArrival != null)
{
String arrivalTime = RoutingController.formatArrivalTime(rinfo.totalTimeInSeconds);
numbersArrival.setText(arrivalTime);
}
}
@NonNull
@ -388,11 +395,7 @@ final class RoutingBottomMenuController implements View.OnClickListener
initDotBuilderSequence(context, dot, builder);
String dist = routingInfo.distToTarget + " " + routingInfo.targetUnits;
dist = "asdasdasdasdasdasdasdasdasdadqweqweqweqweqweqweqweqweqweqwe";
initTailBuilderSequence(context, dist, builder, android.R.attr.textColorPrimary);
String arrivalTime = RoutingController.formatArrivalTime(routingInfo.totalTimeInSeconds);
initTailBuilderSequence(context, arrivalTime, builder.append(" "), R.attr.secondary);
initDistanceBuilderSequence(context, dist, builder);
return builder;
}
@ -406,7 +409,8 @@ final class RoutingBottomMenuController implements View.OnClickListener
0,
builder.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.setSpan(new AbsoluteSizeSpan(context.getResources().getDimensionPixelSize(R.dimen.text_size_routing_number)),
builder.setSpan(new AbsoluteSizeSpan(context.getResources()
.getDimensionPixelSize(R.dimen.text_size_routing_number)),
0,
builder.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
@ -414,7 +418,8 @@ final class RoutingBottomMenuController implements View.OnClickListener
0,
builder.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.setSpan(new ForegroundColorSpan(ThemeUtils.getColor(context, android.R.attr.textColorPrimary)),
builder.setSpan(new ForegroundColorSpan(ThemeUtils.getColor(context,
android.R.attr.textColorPrimary)),
0,
builder.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
@ -427,7 +432,8 @@ final class RoutingBottomMenuController implements View.OnClickListener
builder.length() - dot.length(),
builder.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.setSpan(new AbsoluteSizeSpan(context.getResources().getDimensionPixelSize(R.dimen.text_size_routing_number)),
builder.setSpan(new AbsoluteSizeSpan(context.getResources()
.getDimensionPixelSize(R.dimen.text_size_routing_number)),
builder.length() - dot.length(),
builder.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
@ -437,8 +443,8 @@ final class RoutingBottomMenuController implements View.OnClickListener
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
private static void initTailBuilderSequence(@NonNull Context context, @NonNull String arrivalTime,
@NonNull SpannableStringBuilder builder, int textColor)
private static void initDistanceBuilderSequence(@NonNull Context context, @NonNull String arrivalTime,
@NonNull SpannableStringBuilder builder)
{
builder.append(arrivalTime);
builder.setSpan(new TypefaceSpan(context.getResources().getString(R.string.robotoMedium)),
@ -454,7 +460,7 @@ final class RoutingBottomMenuController implements View.OnClickListener
builder.length() - arrivalTime.length(),
builder.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.setSpan(new ForegroundColorSpan(ThemeUtils.getColor(context, textColor)),
builder.setSpan(new ForegroundColorSpan(ThemeUtils.getColor(context, android.R.attr.textColorPrimary)),
builder.length() - arrivalTime.length(),
builder.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);