Merge pull request #9518 from osmandapp/fix_5374_show_date_parked

issue 5374 show the date parked fix
This commit is contained in:
vshcherb 2020-07-27 14:22:04 +02:00 committed by GitHub
commit 4960d9159e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,30 +21,33 @@ import net.osmand.data.FavouritePoint;
import net.osmand.data.FavouritePoint.SpecialPointType;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuAdapter.ItemClickListener;
import net.osmand.plus.ContextMenuItem;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.backend.OsmandSettings.CommonPreference;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.tools.DashFragmentData;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.quickaction.QuickActionType;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.settings.backend.OsmandSettings.CommonPreference;
import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.MapInfoLayer;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MARK_AS_PARKING_LOC;
@ -523,18 +526,13 @@ public class ParkingPositionPlugin extends OsmandPlugin {
}
String getFormattedTime(long timeInMillis) {
StringBuilder timeStringBuilder = new StringBuilder();
Time time = new Time();
time.set(timeInMillis);
timeStringBuilder.append(time.hour);
timeStringBuilder.append(":");
int minute = time.minute;
timeStringBuilder.append(minute < 10 ? "0" + minute : minute);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm dd.MM.yyyy", Locale.getDefault());
if (!DateFormat.is24HourFormat(app)) {
timeStringBuilder.append(time.hour >= 12 ? app.getString(R.string.osmand_parking_pm) : app
.getString(R.string.osmand_parking_am));
sdf = new SimpleDateFormat("hh:mm a dd.MM.yyyy", Locale.getDefault());
}
return timeStringBuilder.toString();
return sdf.format(new Date(time.toMillis(false)));
}
String getFormattedTimeInterval(long timeInMillis, Activity ctx) {