You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
View.draw(): draw background, content, children in same order as AOSP
This commit is contained in:
@@ -900,13 +900,16 @@ public class View implements Drawable.Callback {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected native void native_onDraw(long widget, long snapshot);
|
||||
public void onDraw(Canvas canvas) {
|
||||
if (canvas instanceof GskCanvas)
|
||||
native_onDraw(widget, ((GskCanvas)canvas).snapshot);
|
||||
native_drawContent(widget, ((GskCanvas)canvas).snapshot);
|
||||
}
|
||||
public void draw(Canvas canvas) {
|
||||
if (canvas instanceof GskCanvas)
|
||||
native_drawBackground(widget, ((GskCanvas)canvas).snapshot);
|
||||
onDraw(canvas);
|
||||
if (canvas instanceof GskCanvas)
|
||||
native_drawChildren(widget, ((GskCanvas)canvas).snapshot);
|
||||
}
|
||||
|
||||
public View(Context context) {
|
||||
@@ -982,6 +985,10 @@ public class View implements Drawable.Callback {
|
||||
protected native void native_setBackgroundDrawable(long widget, long paintable);
|
||||
protected native void native_queueAllocate(long widget);
|
||||
|
||||
protected native void native_drawBackground(long widget, long snapshot);
|
||||
protected native void native_drawContent(long widget, long snapshot);
|
||||
protected void native_drawChildren(long widget, long snapshot) {} // override in ViewGroup
|
||||
|
||||
// --- stubs
|
||||
|
||||
public void setContentDescription(CharSequence contentDescription) {}
|
||||
|
||||
@@ -133,6 +133,10 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
|
||||
protected native void native_addView(long widget, long child, int index, LayoutParams params);
|
||||
protected native void native_removeView(long widget, long child);
|
||||
@Override
|
||||
protected native void native_drawChildren(long widget, long snapshot);
|
||||
@Override
|
||||
protected void native_drawContent(long widget, long snapshot) {}
|
||||
|
||||
public View getChildAt(int index) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user