Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2834)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java

Issue 2484053002: [Download Home] Custom tab backgrounds (Closed)
Patch Set: Rebasing Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 d4521adef594ee3e0113832f7470baf70bbf0967..0a1b2f7f9b6439d33fe8a3588e5dbd2578d09882 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
@@ -20,6 +20,7 @@ import android.support.annotation.Nullable;
import android.support.customtabs.CustomTabsIntent;
import android.text.TextUtils;
+import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.ApplicationStatus;
import org.chromium.base.ContentUriUtils;
import org.chromium.base.ContextUtils;
@@ -385,11 +386,24 @@ public class DownloadUtils {
builder.setActionButton(
shareIcon, context.getString(R.string.share), pendingShareIntent, true);
+ // The color of the media viewer is dependent on the file type.
+ int backgroundRes;
+ if (DownloadFilter.fromMimeType(mimeType) == DownloadFilter.FILTER_IMAGE) {
+ backgroundRes = R.color.image_viewer_bg;
+ } else {
+ backgroundRes = R.color.media_viewer_bg;
+ }
+ int mediaColor = ApiCompatibilityUtils.getColor(context.getResources(), backgroundRes);
+
// Build up the Intent further.
Intent intent = builder.build().intent;
intent.setPackage(context.getPackageName());
intent.setData(fileUri);
intent.putExtra(CustomTabIntentDataProvider.EXTRA_IS_MEDIA_VIEWER, true);
+ intent.putExtra(
+ CustomTabIntentDataProvider.EXTRA_INITIAL_BACKGROUND_COLOR, mediaColor);
+ intent.putExtra(
+ CustomTabsIntent.EXTRA_TOOLBAR_COLOR, mediaColor);
intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName());
IntentHandler.addTrustedIntentExtras(intent, context);

Powered by Google App Engine
This is Rietveld 408576698