Format date

This commit is contained in:
PavelRatushnyi 2017-09-09 19:08:24 +03:00
parent 2bb38e3122
commit 276a03735c
3 changed files with 10 additions and 3 deletions

View file

@ -19,6 +19,10 @@ import net.osmand.plus.R;
import net.osmand.plus.base.BottomSheetDialogFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class HistoryMarkerMenuBottomSheetDialogFragment extends BottomSheetDialogFragment {
public final static String TAG = "HistoryMarkerMenuBottomSheetDialogFragment";
@ -55,7 +59,7 @@ public class HistoryMarkerMenuBottomSheetDialogFragment extends BottomSheetDialo
long markerVisitedDate = arguments.getLong(MARKER_VISITED_DATE);
((TextView) mainView.findViewById(R.id.map_marker_title)).setText(markerName);
((ImageView) mainView.findViewById(R.id.map_marker_icon)).setImageDrawable(getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(markerColorIndex)));
((TextView) mainView.findViewById(R.id.map_marker_passed_info)).setText(String.valueOf(markerVisitedDate));
((TextView) mainView.findViewById(R.id.map_marker_passed_info)).setText(getString(R.string.passed, new SimpleDateFormat("MMM dd", Locale.getDefault()).format(new Date(markerVisitedDate))));
mainView.findViewById(R.id.make_active_row).setOnClickListener(new View.OnClickListener() {
@Override

View file

@ -15,8 +15,11 @@ import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dashboard.DashLocationFragment;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Locale;
public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemViewHolder>
implements MapMarkersItemTouchHelperCallback.ItemTouchHelperAdapter {
@ -96,7 +99,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
descr = mapActivity.getString(R.string.shared_string_favorites);
}
} else {
descr = marker.creationDate + "";
descr = new SimpleDateFormat("MMM dd", Locale.getDefault()).format(new Date(marker.creationDate));
}
holder.description.setText(descr);

View file

@ -151,7 +151,7 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
itemViewHolder.title.setText(marker.getName(app));
itemViewHolder.description.setText(marker.visitedDate + "");
itemViewHolder.description.setText(app.getString(R.string.passed, new SimpleDateFormat("MMM dd", Locale.getDefault()).format(new Date(marker.visitedDate))));
itemViewHolder.optionsBtn.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_reset_to_default_dark));
itemViewHolder.optionsBtn.setOnClickListener(new View.OnClickListener() {