Commit 270fb773 authored by Shakti Sahu's avatar Shakti Sahu Committed by Commit Bot

Download later : Added icon and date format to the infobar

This CL adds
1 - Vector icon for download later on the infobar
(modified for dark mode as well)
2 - Correct formating for download later text which should say
Download scheduled on Jun 25, 2020 or 3:30 PM (if same day)
3 - A color bug in download home which wasn't showing the progress
circle for in-progress downloads. (It was making it same
color as inner solid background)

Bug: 1066379
Change-Id: Ibeb3cdb9102e7c5270d792637f4fb9b78747a885
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2276800Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Reviewed-by: default avatarXing Liu <xingliu@chromium.org>
Commit-Queue: Shakti Sahu <shaktisahu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#784343}
parent 2a9f790b
......@@ -703,6 +703,7 @@ chrome_java_resources = [
"java/res/drawable/ic_event_round.xml",
"java/res/drawable/ic_file_download_24dp.xml",
"java/res/drawable/ic_file_download_36dp.xml",
"java/res/drawable/ic_file_download_scheduled_24dp.xml",
"java/res/drawable/ic_fingerprint_grey500_36dp.xml",
"java/res/drawable/ic_full_screen_exit_white_24dp.xml",
"java/res/drawable/ic_full_screen_white_24dp.xml",
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M19,10H15V4H9V10H5L12,17L19,10V10ZM5,19V21H19V19H5V19Z"
android:fillType="evenOdd"/>
<path
android:pathData="M0,0h24v24h-24z"
android:fillColor="@color/modern_blue_600"/>
</group>
<group>
<clip-path
android:pathData="M10,8h14v14h-14z"/>
<path
android:pathData="M17.5,15.5m-7.5,0a7.5,7.5 0,1 1,15 0a7.5,7.5 0,1 1,-15 0"
android:fillColor="@color/infobar_background_color"/>
<path
android:pathData="M17.4945,10.0834C14.5045,10.0834 12.0833,12.51 12.0833,15.5C12.0833,18.49 14.5045,20.9167 17.4945,20.9167C20.4899,20.9167 22.9166,18.49 22.9166,15.5C22.9166,12.51 20.4899,10.0834 17.4945,10.0834ZM17.4999,19.8334C15.1058,19.8334 13.1666,17.8942 13.1666,15.5C13.1666,13.1059 15.1058,11.1667 17.4999,11.1667C19.8941,11.1667 21.8333,13.1059 21.8333,15.5C21.8333,17.8942 19.8941,19.8334 17.4999,19.8334ZM20.3328,17.0925L19.6503,17.9321L16.9583,16.0417V12.25H18.0416V15.5L20.3328,17.0925Z"
android:fillColor="@color/modern_blue_600"/>
</group>
</vector>
......@@ -8,6 +8,7 @@ import android.app.Activity;
import android.content.Context;
import android.os.Handler;
import android.text.TextUtils;
import android.text.format.DateUtils;
import androidx.annotation.IntDef;
import androidx.annotation.Nullable;
......@@ -41,6 +42,7 @@ import org.chromium.components.offline_items_collection.UpdateDelta;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
......@@ -620,8 +622,7 @@ public class DownloadInfoBarController implements OfflineContentProvider.Observe
info.icon = R.drawable.ic_error_outline_googblue_24dp;
} else if (resultState == ResultState.SCHEDULED) {
stringRes = R.plurals.multiple_download_scheduled;
// TODO(shaktisahu, xingliu): Provide icon.
info.icon = R.drawable.ic_phone_googblue_36dp;
info.icon = R.drawable.ic_file_download_scheduled_24dp;
} else {
assert false : "Unexpected resultState " + resultState + " and infoBarState "
+ infoBarState;
......@@ -738,10 +739,12 @@ public class DownloadInfoBarController implements OfflineContentProvider.Observe
if (offlineItem.schedule.onlyOnWifi) {
return getContext().getString(R.string.download_scheduled_on_wifi);
} else {
// TODO(shaktisahu, xinigliu) : Get exact date and time format.
Date scheduledDate = new Date(offlineItem.schedule.startTimeMs);
return getContext().getString(
R.string.download_scheduled_on_date, scheduledDate.toString());
String dateTimeString =
DateUtils
.formatSameDayTime(offlineItem.schedule.startTimeMs,
new Date().getTime(), DateFormat.MEDIUM, DateFormat.SHORT)
.toString();
return getContext().getString(R.string.download_scheduled_on_date, dateTimeString);
}
}
......
......@@ -97,7 +97,7 @@
<color name="circular_progress_inner_background_color_small_dark">@color/modern_blue_300</color>
<color name="circular_progress_outer_circle_background_color_small_light">@color/modern_grey_300</color>
<color name="circular_progress_outer_circle_background_color_small_dark">@color/modern_grey_800</color>
<color name="circular_progress_outer_circle_progress_color_small_light">@color/modern_grey_300</color>
<color name="circular_progress_outer_circle_progress_color_small_light">@color/modern_grey_800</color>
<color name="circular_progress_outer_circle_progress_color_small_dark">@color/modern_blue_300</color>
<color name="circular_progress_icon_color_small_large_light">@color/modern_grey_800</color>
<color name="circular_progress_icon_color_small_large_dark">@color/modern_grey_800</color>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment