From f8a84a763b722962a832fe888bc4b679f40e8d49 Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Mon, 8 Oct 2018 16:04:02 +0200 Subject: [PATCH] ServoView: Add default constructor. Android's `View` has multiple constructors. Currently only `ServoView(Context, AttributeSet)` is available. This constructor is usually used by Android when inflating a View from a layout XML file. However when creating the `View` in code no `AttributeSet` is available. --- .../src/main/java/org/mozilla/servoview/ServoView.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/support/android/apk/servoview/src/main/java/org/mozilla/servoview/ServoView.java b/support/android/apk/servoview/src/main/java/org/mozilla/servoview/ServoView.java index 4bb05cfa2cb..fcf3f9f4c93 100644 --- a/support/android/apk/servoview/src/main/java/org/mozilla/servoview/ServoView.java +++ b/support/android/apk/servoview/src/main/java/org/mozilla/servoview/ServoView.java @@ -60,8 +60,17 @@ public class ServoView extends GLSurfaceView private boolean mRedrawing; + public ServoView(Context context) { + super(context); + init(context); + } + public ServoView(Context context, AttributeSet attrs) { super(context, attrs); + init(context); + } + + private void init(Context context) { mActivity = (Activity) context; setFocusable(true); setFocusableInTouchMode(true);