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

Unified Diff: demos/src/main/java/org/chromium/customtabsdemos/CustomTabActivityHelper.java

Issue 1603383003: color, package and action bar configuration. (Closed) Base URL: https://github.com/GoogleChrome/custom-tabs-client.git@master
Patch Set: fixes Created 4 years, 9 months 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: demos/src/main/java/org/chromium/customtabsdemos/CustomTabActivityHelper.java
diff --git a/demos/src/main/java/org/chromium/customtabsdemos/CustomTabActivityHelper.java b/demos/src/main/java/org/chromium/customtabsdemos/CustomTabActivityHelper.java
index 3a6175dfcb855a0e4a230a7c3564ee42ced73e19..9cf090d12c48dbeb9cace53f5b35426528beee22 100644
--- a/demos/src/main/java/org/chromium/customtabsdemos/CustomTabActivityHelper.java
+++ b/demos/src/main/java/org/chromium/customtabsdemos/CustomTabActivityHelper.java
@@ -52,13 +52,26 @@ public class CustomTabActivityHelper implements ServiceConnectionCallback {
CustomTabsIntent customTabsIntent,
Uri uri,
CustomTabFallback fallback) {
- String packageName = CustomTabsHelper.getPackageNameToUse(activity);
+ openCustomTab(activity, customTabsIntent, uri, fallback, null);
+ }
- //If we cant find a package name, it means theres no browser that supports
- //Chrome Custom Tabs installed. So, we fallback to the webview
+ /**
+ * @see #openCustomTab(Activity, CustomTabsIntent, Uri, CustomTabFallback)
+ * Same as the previous method, but is able to specify which package the user wants to use.
+ */
+ public static void openCustomTab(Activity activity,
+ CustomTabsIntent customTabsIntent,
+ Uri uri,
+ CustomTabFallback fallback,
+ String packageName) {
if (packageName == null) {
- if (fallback != null) {
- fallback.openUri(activity, uri);
+ packageName = CustomTabsHelper.getPackageNameToUse(activity);
+ //If we cant find a package name, it means theres no browser that supports
+ //Chrome Custom Tabs installed. So, we fallback to the webview
+ if (packageName == null) {
+ if (fallback != null) {
+ fallback.openUri(activity, uri);
+ }
}
} else {
customTabsIntent.intent.setPackage(packageName);

Powered by Google App Engine
This is Rietveld 408576698