Change text in parking menu controller
This commit is contained in:
parent
a1a60dff48
commit
bd2f898a40
9 changed files with 78 additions and 52 deletions
|
@ -9,6 +9,8 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="parked_at">parked at</string>
|
||||
<string name="pick_up_till">Pick up till</string>
|
||||
<string name="without_time_limit">Without time limit</string>
|
||||
<string name="context_menu_read_full_article">Read full article</string>
|
||||
<string name="context_menu_read_article">Read article</string>
|
||||
|
|
|
@ -1127,6 +1127,17 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
return menuController != null && menuController.displayDistanceDirection();
|
||||
}
|
||||
|
||||
public boolean displayAdditionalTypeStrInHours() {
|
||||
return menuController != null && menuController.displayAdditionalTypeStrInHours();
|
||||
}
|
||||
|
||||
public int getTimeStrColor() {
|
||||
if (menuController != null) {
|
||||
return menuController.getTimeStrColor();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean isMapDownloaded() {
|
||||
return menuController != null && menuController.isMapDownloaded();
|
||||
}
|
||||
|
@ -1137,17 +1148,6 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
}
|
||||
}
|
||||
|
||||
public String getLimitedTimeInfo() {
|
||||
if (menuController != null) {
|
||||
return menuController.getLimitedTimeInfo();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public boolean isLimitedTime() {
|
||||
return menuController != null && menuController.isLimitedTime();
|
||||
}
|
||||
|
||||
public boolean hasCustomAddressLine() {
|
||||
return menuController != null && menuController.hasCustomAddressLine();
|
||||
}
|
||||
|
|
|
@ -1120,7 +1120,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
|
||||
TextView line3 = (TextView) view.findViewById(R.id.context_menu_line3);
|
||||
String additionalTypeStr = menu.getAdditionalTypeStr();
|
||||
if (TextUtils.isEmpty(additionalTypeStr)) {
|
||||
boolean displayAdditionalTypeStrInHours = menu.displayAdditionalTypeStrInHours();
|
||||
boolean emptyAdditionalTypeStr = TextUtils.isEmpty(additionalTypeStr);
|
||||
if (emptyAdditionalTypeStr || displayAdditionalTypeStrInHours) {
|
||||
line3.setVisibility(View.GONE);
|
||||
} else {
|
||||
line3.setVisibility(View.VISIBLE);
|
||||
|
@ -1132,17 +1134,14 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
|
||||
TextView openingHoursTextView = (TextView) view.findViewById(R.id.opening_hours_text_view);
|
||||
OpeningHoursInfo openingHoursInfo = menu.getOpeningHoursInfo();
|
||||
String limitedTimeInfo = menu.getLimitedTimeInfo();
|
||||
boolean containsOpeningHours = openingHoursInfo != null && openingHoursInfo.containsInfo();
|
||||
boolean containsLimitedHoursInfo = !TextUtils.isEmpty(limitedTimeInfo);
|
||||
if (containsOpeningHours || containsLimitedHoursInfo) {
|
||||
if (containsOpeningHours || (displayAdditionalTypeStrInHours && !emptyAdditionalTypeStr)) {
|
||||
int colorId;
|
||||
if (containsOpeningHours) {
|
||||
colorId = openingHoursInfo.isOpened() ? R.color.ctx_menu_amenity_opened_text_color : R.color.ctx_menu_amenity_closed_text_color;
|
||||
} else {
|
||||
colorId = menu.isLimitedTime() ? R.color.ctx_menu_amenity_closed_text_color : !nightMode ? R.color.icon_color : R.color.dash_search_icon_dark;
|
||||
colorId = menu.getTimeStrColor();
|
||||
}
|
||||
openingHoursTextView.setTextColor(ContextCompat.getColor(getContext(), colorId));
|
||||
String timeInfo = "";
|
||||
if (containsOpeningHours) {
|
||||
if (openingHoursInfo.isOpened24_7()) {
|
||||
|
@ -1159,11 +1158,14 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
timeInfo = getString(R.string.will_be_opened_on) + " " + openingHoursInfo.getOpeningDay() + ".";
|
||||
}
|
||||
} else {
|
||||
timeInfo = limitedTimeInfo;
|
||||
timeInfo = additionalTypeStr;
|
||||
}
|
||||
if (colorId != 0) {
|
||||
openingHoursTextView.setTextColor(ContextCompat.getColor(getContext(), colorId));
|
||||
Drawable drawable = getIcon(R.drawable.ic_action_opening_hour_16, colorId);
|
||||
openingHoursTextView.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
|
||||
openingHoursTextView.setCompoundDrawablePadding(dpToPx(8));
|
||||
}
|
||||
Drawable drawable = getIcon(R.drawable.ic_action_opening_hour_16, colorId);
|
||||
openingHoursTextView.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
|
||||
openingHoursTextView.setCompoundDrawablePadding(dpToPx(8));
|
||||
openingHoursTextView.setText(timeInfo);
|
||||
openingHoursTextView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
|
|
|
@ -378,10 +378,6 @@ public abstract class MenuController extends BaseMenuController {
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean needAdditionalTypeStr() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean displayStreetNameInTitle() {
|
||||
return false;
|
||||
}
|
||||
|
@ -390,6 +386,10 @@ public abstract class MenuController extends BaseMenuController {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean displayAdditionalTypeStrInHours() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getLeftIconId() {
|
||||
return 0;
|
||||
}
|
||||
|
@ -436,6 +436,10 @@ public abstract class MenuController extends BaseMenuController {
|
|||
return "";
|
||||
}
|
||||
|
||||
public int getTimeStrColor() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public OpeningHoursInfo getOpeningHoursInfo() {
|
||||
return null;
|
||||
}
|
||||
|
@ -444,14 +448,6 @@ public abstract class MenuController extends BaseMenuController {
|
|||
return "";
|
||||
}
|
||||
|
||||
public String getLimitedTimeInfo() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public boolean isLimitedTime() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getNameStr() {
|
||||
return pointDescription.getName();
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public abstract class MenuTitleController {
|
|||
|
||||
public String getAdditionalTypeStr() {
|
||||
MenuController menuController = getMenuController();
|
||||
if (menuController != null && menuController.needAdditionalTypeStr()) {
|
||||
if (menuController != null) {
|
||||
return additionalTypeStr;
|
||||
} else {
|
||||
return "";
|
||||
|
|
|
@ -42,7 +42,7 @@ public class AmenityMenuController extends MenuController {
|
|||
|
||||
private MapMarker marker;
|
||||
|
||||
public AmenityMenuController(MapActivity mapActivity, PointDescription pointDescription, Amenity amenity) {
|
||||
public AmenityMenuController(final MapActivity mapActivity, PointDescription pointDescription, final Amenity amenity) {
|
||||
super(new AmenityMenuBuilder(mapActivity, amenity), pointDescription, mapActivity);
|
||||
this.amenity = amenity;
|
||||
if (amenity.getType().getKeyName().equals("transportation")) {
|
||||
|
@ -66,7 +66,7 @@ public class AmenityMenuController extends MenuController {
|
|||
MapMarkerMenuController markerMenuController =
|
||||
new MapMarkerMenuController(mapActivity, marker.getPointDescription(mapActivity), marker);
|
||||
leftTitleButtonController = markerMenuController.getLeftTitleButtonController();
|
||||
leftSubtitleButtonController = markerMenuController.getLeftSubtitleButtonController();
|
||||
rightTitleButtonController = markerMenuController.getRightTitleButtonController();
|
||||
} else {
|
||||
if (amenity.getType().isWiki()) {
|
||||
leftTitleButtonController = new TitleButtonController() {
|
||||
|
|
|
@ -95,11 +95,6 @@ public class WptPtMenuController extends MenuController {
|
|||
return mapMarker == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needAdditionalTypeStr() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeStr() {
|
||||
GpxSelectionHelper helper = getMapActivity().getMyApplication().getSelectedGpxHelper();
|
||||
|
|
|
@ -15,6 +15,7 @@ public class ParkingPositionMenuController extends MenuController {
|
|||
private ParkingPositionPlugin plugin;
|
||||
private String parkingStartDescription = "";
|
||||
private String parkingLeftDescription = "";
|
||||
private String parkingTitle = "";
|
||||
|
||||
public ParkingPositionMenuController(MapActivity mapActivity, PointDescription pointDescription) {
|
||||
super(new MenuBuilder(mapActivity), pointDescription, mapActivity);
|
||||
|
@ -37,6 +38,7 @@ public class ParkingPositionMenuController extends MenuController {
|
|||
private void buildParkingDescription(MapActivity mapActivity) {
|
||||
parkingStartDescription = plugin.getParkingStartDesc(mapActivity);
|
||||
parkingLeftDescription = plugin.getParkingLeftDesc(mapActivity);
|
||||
parkingTitle = plugin.getParkingTitle(mapActivity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,17 +64,23 @@ public class ParkingPositionMenuController extends MenuController {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getLimitedTimeInfo() {
|
||||
boolean unlimited = TextUtils.isEmpty(parkingLeftDescription);
|
||||
if (unlimited) {
|
||||
return getMapActivity().getString(R.string.without_time_limit);
|
||||
}
|
||||
public String getAdditionalTypeStr() {
|
||||
return parkingLeftDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLimitedTime() {
|
||||
return !TextUtils.isEmpty(parkingLeftDescription);
|
||||
public boolean displayAdditionalTypeStrInHours() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeStrColor() {
|
||||
return plugin.getParkingType() ? R.color.ctx_menu_amenity_closed_text_color : isLight() ? R.color.icon_color : R.color.dash_search_icon_dark;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNameStr() {
|
||||
return parkingTitle;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,6 @@ package net.osmand.plus.parkingpoint;
|
|||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
|
@ -11,7 +10,6 @@ import android.text.format.Time;
|
|||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TimePicker;
|
||||
|
||||
|
@ -582,9 +580,32 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
|||
return timeStringBuilder.toString();
|
||||
}
|
||||
|
||||
public String getParkingTitle(Activity ctx) {
|
||||
StringBuilder title = new StringBuilder();
|
||||
if (getParkingType()) {
|
||||
title.append(ctx.getString(R.string.pick_up_till)).append(" ");
|
||||
long endTime = getParkingTime();
|
||||
title.append(getFormattedTime(endTime, ctx));
|
||||
} else {
|
||||
title.append(ctx.getString(R.string.osmand_parking_position_name));
|
||||
}
|
||||
return title.toString();
|
||||
}
|
||||
|
||||
public String getParkingStartDesc(Activity ctx) {
|
||||
return ctx.getString(R.string.osmand_parking_position_description_add_time)
|
||||
+ " " + getFormattedTime(getStartParkingTime(), ctx);
|
||||
StringBuilder parkingStartDesc = new StringBuilder();
|
||||
String startTime = getFormattedTime(getStartParkingTime(), ctx);
|
||||
if (getParkingType()) {
|
||||
parkingStartDesc.append(ctx.getString(R.string.osmand_parking_position_name));
|
||||
parkingStartDesc.append(", ");
|
||||
parkingStartDesc.append(ctx.getString(R.string.parked_at));
|
||||
parkingStartDesc.append(" ").append(startTime);
|
||||
} else {
|
||||
parkingStartDesc.append(ctx.getString(R.string.osmand_parking_position_description_add_time));
|
||||
parkingStartDesc.append(" ");
|
||||
parkingStartDesc.append(startTime);
|
||||
}
|
||||
return parkingStartDesc.toString();
|
||||
}
|
||||
|
||||
public String getParkingLeftDesc(Activity ctx) {
|
||||
|
@ -599,6 +620,8 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
|||
} else {
|
||||
descr.append(ctx.getString(R.string.osmand_parking_time_left));
|
||||
}
|
||||
} else {
|
||||
descr.append(ctx.getString(R.string.without_time_limit));
|
||||
}
|
||||
return descr.toString();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue