Skip to content

Instantly share code, notes, and snippets.

@kjsolo
kjsolo / DateUtils.java
Created April 17, 2015 08:48
Android,智能格式化中文时间
public class DateUtils {
public static String formatDateTime(Date date) {
String text;
long dateTime = date.getTime();
if (isSameDay(dateTime)) {
Calendar calendar = GregorianCalendar.getInstance();
if (inOneMinute(dateTime, calendar.getTimeInMillis())) {
return "刚刚";
} else if (inOneHour(dateTime, calendar.getTimeInMillis())) {
@gabrielemariotti
gabrielemariotti / Readme.md
Last active March 2, 2024 23:10
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example: