Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java |
| index 1b843659fd4ee2fb96ec8e786f5a1cf952eed62c..485ef07c406d04a48ea2cd91b81816c7a07226ab 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java |
| @@ -649,10 +649,10 @@ public class DownloadUtils { |
| /** |
| * Abbreviate a file name into a given number of characters with ellipses. |
| - * e.g. thisisaverylongfilename.txt => thisisave....txt |
| - * @param fileName File name to abbreviate |
| - * @param limit Character limit |
| - * @return Abbreviated file name |
| + * e.g. thisisaverylongfilename.txt => thisisave....txt. |
|
gone
2017/02/28 18:46:25
I'd remove this period; it makes the example ambig
vitaliii
2017/03/01 09:08:30
Done.
"thisisaverylongfilename.txt" => "thisisave
|
| + * @param fileName File name to abbreviate. |
| + * @param limit Character limit. |
| + * @return Abbreviated file name. |
| */ |
| public static String getAbbreviatedFileName(String fileName, int limit) { |
| assert limit >= 1; // Abbreviated file name should at least be 1 characters (a...) |
| @@ -675,30 +675,38 @@ public class DownloadUtils { |
| /** |
| * Return an icon for a given file type. |
| - * @param fileType Type of the file as returned by DownloadFilter |
| - * @return Resource ID of the corresponding icon |
| + * @param fileType Type of the file as returned by DownloadFilter. |
| + * @param sizeDp Size in device pixels of the returned icon. |
| + * @return Resource ID of the corresponding icon. |
| */ |
| - public static int getIconResId(int fileType) { |
| + public static int getIconResId(int fileType, int sizeDp) { |
| + assert sizeDp == 24 || sizeDp == 36; |
|
dgn
2017/02/28 18:30:16
nit: use 2 @IntDef constants to make clear through
vitaliii
2017/03/01 09:08:30
Done.
|
| switch (fileType) { |
| case DownloadFilter.FILTER_PAGE: |
| - return R.drawable.ic_drive_site_white_24dp; |
| + return sizeDp == 24 ? R.drawable.ic_drive_site_white_24dp |
| + : R.drawable.ic_drive_site_white_36dp; |
| case DownloadFilter.FILTER_VIDEO: |
| - return R.drawable.ic_play_arrow_white_24dp; |
| + return sizeDp == 24 ? R.drawable.ic_play_arrow_white_24dp |
| + : R.drawable.ic_play_arrow_white_36dp; |
| case DownloadFilter.FILTER_AUDIO: |
| - return R.drawable.ic_music_note_white_24dp; |
| + return sizeDp == 24 ? R.drawable.ic_music_note_white_24dp |
| + : R.drawable.ic_music_note_white_36dp; |
| case DownloadFilter.FILTER_IMAGE: |
| - return R.drawable.ic_image_white_24dp; |
| + return sizeDp == 24 ? R.drawable.ic_image_white_24dp |
| + : R.drawable.ic_image_white_36dp; |
| case DownloadFilter.FILTER_DOCUMENT: |
| - return R.drawable.ic_drive_text_white_24dp; |
| + return sizeDp == 24 ? R.drawable.ic_drive_text_white_24dp |
| + : R.drawable.ic_drive_text_white_36dp; |
| default: |
| - return R.drawable.ic_drive_file_white_24dp; |
| + return sizeDp == 24 ? R.drawable.ic_drive_file_white_24dp |
| + : R.drawable.ic_drive_text_white_36dp; |
| } |
| } |
| /** |
| * Return a background color for the file type icon. |
| - * @param context Context from which to extract the resources |
| - * @return Background color |
| + * @param context Context from which to extract the resources. |
| + * @return Background color. |
| */ |
| public static int getIconBackgroundColor(Context context) { |
| return ApiCompatibilityUtils.getColor(context.getResources(), R.color.light_active_color); |
| @@ -706,8 +714,8 @@ public class DownloadUtils { |
| /** |
| * Return a foreground color list for the file type icon. |
| - * @param context Context from which to extract the resources |
| - * @return a foreground color list |
| + * @param context Context from which to extract the resources. |
| + * @return a foreground color list. |
| */ |
| public static ColorStateList getIconForegroundColorList(Context context) { |
| return ApiCompatibilityUtils.getColorStateList( |