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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java

Issue 14268004: Add overscroll edge effect animations for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 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: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index 6d44e042af538f17c108e45c3c0b3dc3706ee2b3..75eb6e8f9cd1c497376c08c0a4cd0396b71eadc8 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -10,6 +10,7 @@ import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Rect;
@@ -554,6 +555,9 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient {
initPopupZoomer(mContext);
mImeAdapter = createImeAdapter(mContext);
+
+ initOverscrollResources(mContext);
+
TraceEvent.end();
}
@@ -614,6 +618,14 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient {
mPopupZoomer.setOnTapListener(listener);
}
+ private void initOverscrollResources(Context context) {
mkosiba (inactive) 2013/04/18 11:11:28 make this resilient to the resources not existing.
jdduke (slow) 2013/04/18 15:18:35 This is all going away =/ Resource acquisition wil
+ Bitmap edge = BitmapFactory.decodeResource(mContext.getResources(),
+ R.drawable.overscroll_edge);
+ Bitmap glow = BitmapFactory.decodeResource(mContext.getResources(),
+ R.drawable.overscroll_glow);
+ setOverscrollResources(edge, glow);
+ }
+
/**
* @return Whether the configured personality of this ContentView is {@link #PERSONALITY_VIEW}.
*/
@@ -710,6 +722,12 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient {
}
}
+ public void setOverscrollResources(Bitmap edge, Bitmap glow) {
+ if (mNativeContentViewCore != 0 && edge != null && glow != null) {
+ nativeSetOverscrollResources(mNativeContentViewCore, edge, glow);
+ }
+ }
+
@CalledByNative
private void onBackgroundColorChanged(int color) {
getContentViewClient().onBackgroundColorChanged(color);
@@ -2772,6 +2790,9 @@ public class ContentViewCore implements MotionEventDelegate, NavigationClient {
private native void nativeSetBackgroundColor(int nativeContentViewCoreImpl, int color);
+ private native void nativeSetOverscrollResources(int nativeContentViewCoreImpl,
+ Bitmap edge, Bitmap glow);
+
private native void nativeOnShow(int nativeContentViewCoreImpl);
private native void nativeOnHide(int nativeContentViewCoreImpl);

Powered by Google App Engine
This is Rietveld 408576698