Merge pull request #5102 from osmandapp/TransportStopRoutesGrid
set length of text in gridview items
This commit is contained in:
commit
17f27d6cce
1 changed files with 14 additions and 1 deletions
|
@ -41,7 +41,7 @@ public class TransportStopRouteAdapter extends ArrayAdapter<TransportStopRoute>
|
|||
TransportStopRoute transportStopRoute = getItem(position);
|
||||
if (transportStopRoute != null) {
|
||||
TextView transportStopRouteTextView = (TextView) convertView.findViewById(R.id.transport_stop_route_text);
|
||||
transportStopRouteTextView.setText(transportStopRoute.route.getRef());
|
||||
transportStopRouteTextView.setText(getAdjustedRouteRef(transportStopRoute.route.getRef()));
|
||||
GradientDrawable gradientDrawableBg = (GradientDrawable) transportStopRouteTextView.getBackground();
|
||||
gradientDrawableBg.setColor(transportStopRoute.getColor(app, nightMode));
|
||||
}
|
||||
|
@ -58,6 +58,19 @@ public class TransportStopRouteAdapter extends ArrayAdapter<TransportStopRoute>
|
|||
return convertView;
|
||||
}
|
||||
|
||||
private String getAdjustedRouteRef(String ref) {
|
||||
if (ref != null) {
|
||||
int charPos = ref.lastIndexOf(':');
|
||||
if (charPos != -1) {
|
||||
ref = ref.substring(0, charPos);
|
||||
}
|
||||
if (ref.length() > 4) {
|
||||
ref = ref.substring(0, 4);
|
||||
}
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
public interface OnClickListener {
|
||||
void onClick(int position);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue