Quote:
Originally Posted by rupor
It looks rather simple, actually - unless I am mistaken.
Standard Android SDK has been modified and new interface introduced: ViewParentEink. It has following methods (which track standard View methods with an extra parameter at the end - updateMode):
.method public final invalidateChild(Landroid/view/View;Landroid/graphics/Rect;I)V
.registers 20
.parameter "child"
.parameter "dirty"
.parameter "updateMode"
.method public invalidateChildInParent([ILandroid/graphics/Rect;I)Landroid/view/ViewParentEink;
.registers 11
.parameter "location"
.parameter "dirty"
.parameter "updateMode"
Interface has been implemented in ViewGroup - so any view which implements AbsoluteLayout has access to those methods.
Sony's browser WebView keeps current updateMode in a class variable and updates it when necessary (touch, zoom with eInk mode constants). All calls to invalidate are using this "new" framework functions - the rest happens automatically.
Something like that...
|
Just checking in to confirm this. My experiments show that update mode 4 is flashy, 5 is b/w and fast (and I guess not as easy to get out of as the other ones?) and 2 or 3 may be suitable for "normal" use.
I made an "EinkListView" class when experimenting, which is just a ListView that overrides all the methods that have updateMode overloads in Sony's android.view.View to use the updateMode ones:
Code:
public class EinkListView extends ListView {
public int mUpdateMode = 0;
public EinkListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public EinkListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public EinkListView(Context context) {
super(context);
}
@Override
public void invalidate() {
super.invalidate(mUpdateMode);
}
@Override
public void invalidate(int l, int t, int r, int b) {
super.invalidate(l, t, r, b, mUpdateMode);
}
@Override
public void invalidate(Rect dirty) {
super.invalidate(dirty, mUpdateMode);
}
@Override
public void invalidateDrawable(Drawable drawable) {
super.invalidateDrawable(drawable, mUpdateMode);
}
@Override
public void postInvalidate() {
super.postInvalidate(mUpdateMode);
}
@Override
public void postInvalidate(int left, int top, int right, int bottom) {
super.postInvalidate(left, top, right, bottom, mUpdateMode);
}
@Override
public void postInvalidateDelayed(long delayMilliseconds, int left,
int top, int right, int bottom) {
super.postInvalidateDelayed(delayMilliseconds, left, top, right, bottom, mUpdateMode);
}
@Override
public void postInvalidateDelayed(long delayMilliseconds) {
super.postInvalidateDelayed(delayMilliseconds, mUpdateMode);
}
@Override
public void scrollBy(int x, int y) {
super.scrollBy(x, y, mUpdateMode);
}
@Override
public void scrollTo(int x, int y) {
super.scrollTo(x, y, mUpdateMode);
}
}
N.B.: I had to insert Sony's android.view.View into the android.jar in my android-sdk/platforms/android-8 dir to get the IDE to accept the calls to methods that don't usually exist.