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

Unified Diff: customtabs/src/android/support/customtabs/CustomTabsSession.java

Issue 1559043005: Update support lib to last released state (Closed) Base URL: https://chromium.googlesource.com/external/github.com/GoogleChrome/custom-tabs-client.git@master
Patch Set: Added aidl changes Created 4 years, 12 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: customtabs/src/android/support/customtabs/CustomTabsSession.java
diff --git a/customtabs/src/android/support/customtabs/CustomTabsSession.java b/customtabs/src/android/support/customtabs/CustomTabsSession.java
index ee45b7c7ce83f4690dd5085edcfc37d3e033480e..a51cf0ea1eca8e2a59a5bf32e74f3de554cd341b 100644
--- a/customtabs/src/android/support/customtabs/CustomTabsSession.java
+++ b/customtabs/src/android/support/customtabs/CustomTabsSession.java
@@ -17,10 +17,12 @@
package android.support.customtabs;
import android.content.ComponentName;
+import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
+import android.support.annotation.NonNull;
import java.util.List;
@@ -65,6 +67,27 @@ public final class CustomTabsSession {
}
}
+ /**
+ * Update the visuals for the button on a custom tab. Will only succeed if the given
+ * session is the active one in browser.
+ * @param icon The new icon of the action button.
+ * @param description Content description of the action button.
+ * @return Whether the update succeeded.
+ */
+ public boolean setActionButton(@NonNull Bitmap icon, @NonNull String description) {
+ Bundle bundle = new Bundle();
+ bundle.putParcelable(CustomTabsIntent.KEY_ICON, icon);
+ bundle.putString(CustomTabsIntent.KEY_DESCRIPTION, description);
+
+ Bundle metaBundle = new Bundle();
+ metaBundle.putBundle(CustomTabsIntent.EXTRA_ACTION_BUTTON_BUNDLE, bundle);
+ try {
+ return mService.updateVisuals(mCallback, metaBundle);
+ } catch (RemoteException e) {
+ return false;
+ }
+ }
+
/* package */ IBinder getBinder() {
return mCallback.asBinder();
}
@@ -72,4 +95,4 @@ public final class CustomTabsSession {
/* package */ ComponentName getComponentName() {
return mComponentName;
}
-}
+}

Powered by Google App Engine
This is Rietveld 408576698