Merge pull request #5413 from osmandapp/TransportRoutesImprovements
Transport routes UI improvements
This commit is contained in:
commit
ab4c2dd765
3 changed files with 22 additions and 1 deletions
|
@ -99,6 +99,7 @@
|
|||
android:paddingTop="3dp">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/nearby_routes_within_text_view"
|
||||
style="@style/TextAppearance.ContextMenuSubtitle"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -109,6 +110,7 @@
|
|||
osmand:typeface="@string/font_roboto_medium" />
|
||||
|
||||
<GridView
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/transport_stop_nearby_routes_grid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -380,6 +380,8 @@
|
|||
<color name="ctx_menu_controller_disabled_text_color_dark">#666666</color>
|
||||
<color name="ctx_menu_collapse_icon_color_light">#727272</color>
|
||||
<color name="ctx_menu_collapse_icon_color_dark">#a6a6a6</color>
|
||||
<color name="ctx_menu_route_icon_color_light">#b3b3b3</color>
|
||||
<color name="ctx_menu_route_icon_color_dark">#4d4d4d</color>
|
||||
|
||||
<color name="route_info_bg_light">#ffffff</color>
|
||||
<color name="route_info_bg_dark">#17191a</color>
|
||||
|
|
|
@ -15,7 +15,11 @@ import android.support.annotation.NonNull;
|
|||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.view.ContextThemeWrapper;
|
||||
import android.text.ClipboardManager;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.DynamicDrawableSpan;
|
||||
import android.text.style.ImageSpan;
|
||||
import android.text.util.Linkify;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
|
@ -824,7 +828,20 @@ public class MenuBuilder {
|
|||
titleView.setLayoutParams(titleParams);
|
||||
titleView.setTextSize(16);
|
||||
titleView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_bottom_view_text_color_light : R.color.ctx_menu_bottom_view_text_color_dark));
|
||||
titleView.setText(route.getDescription(getMapActivity().getMyApplication(), true));
|
||||
String desc = route.getDescription(getMapActivity().getMyApplication(), true);
|
||||
SpannableString stringWithImage = new SpannableString(desc);
|
||||
if (desc.contains("=>") || desc.contains(" - ")) {
|
||||
Drawable arrow = app.getIconsCache().getIcon(R.drawable.ic_arrow_right_16, light ? R.color.ctx_menu_route_icon_color_light : R.color.ctx_menu_route_icon_color_dark);
|
||||
arrow.setBounds(0, 0, arrow.getIntrinsicWidth(), arrow.getIntrinsicHeight());
|
||||
int replaceIndex = desc.indexOf("=>");
|
||||
if (replaceIndex != -1) {
|
||||
stringWithImage.setSpan(new ImageSpan(arrow, DynamicDrawableSpan.ALIGN_BASELINE), replaceIndex, replaceIndex + 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
} else {
|
||||
replaceIndex = desc.indexOf(" - ") + 1;
|
||||
stringWithImage.setSpan(new ImageSpan(arrow, DynamicDrawableSpan.ALIGN_BASELINE), replaceIndex, replaceIndex + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
titleView.setText(stringWithImage);
|
||||
infoView.addView(titleView);
|
||||
|
||||
LinearLayout typeView = new LinearLayout(view.getContext());
|
||||
|
|
Loading…
Reference in a new issue