Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 168be882 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add time to the 'last modified' string"

parents 839cc347 3ae1d386
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ import com.android.documentsui.base.DocumentInfo;
import com.android.documentsui.base.Lookup;
import com.android.documentsui.inspector.InspectorController.DetailsDisplay;

import java.util.Locale;

/**
 * Displays the basic details about a file.
 */
@@ -58,8 +60,7 @@ public class DetailsView extends TableView implements DetailsDisplay {
        }

        if (info.lastModified > 0) {
            put(R.string.sort_dimension_date,
                    DateFormat.getDateFormat(getContext()).format(info.lastModified));
            put(R.string.sort_dimension_date, formatDate(info.lastModified));
        }

        if (info.summary != null) {
@@ -71,4 +72,16 @@ public class DetailsView extends TableView implements DetailsDisplay {
    public void setChildrenCount(int count) {
        put(R.string.directory_items, String.valueOf(count));
    }

    /**
     * This small helper method combines two different DateFormat subclasses in order to format
     * both the date and the time based on user locale.
     * @param date Unix timestamp
     * @return formatted String of date
     */
    private static String formatDate(long date) {
        String format = DateFormat.getBestDateTimePattern(Locale.getDefault(),
                "MMM dd, yyyy, hh:mm");
        return DateFormat.format(format, date).toString();
    }
}
 No newline at end of file