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
prevent reference cycles between Java and native objects
This commit is contained in:
@@ -169,12 +169,22 @@ public class TextView extends View {
|
||||
|
||||
protected native void native_setCompoundDrawables(long widget, long left, long top, long right, long bottom);
|
||||
|
||||
// just to prevent garbage collection while native side uses it
|
||||
private Drawable drawableLeft = null;
|
||||
private Drawable drawableTop = null;
|
||||
private Drawable drawableRight = null;
|
||||
private Drawable drawableBottom = null;
|
||||
|
||||
public void setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom) {
|
||||
native_setCompoundDrawables(widget,
|
||||
left != null ? left.paintable : 0,
|
||||
top != null ? top.paintable : 0,
|
||||
right != null ? right.paintable : 0,
|
||||
bottom != null ? bottom.paintable : 0);
|
||||
drawableLeft = left;
|
||||
drawableTop = top;
|
||||
drawableRight = right;
|
||||
drawableBottom = bottom;
|
||||
}
|
||||
|
||||
public void setAllCaps(boolean allCaps) {}
|
||||
|
||||
Reference in New Issue
Block a user