Fix NPE on Android 4 in DirectionDragButton

This commit is contained in:
serso 2017-07-06 09:15:42 +02:00
parent 14f5230641
commit b0c5cd0069

View File

@ -55,14 +55,20 @@ public class DirectionDragButton extends DragButton implements DirectionDragView
@Override @Override
public void setTypeface(Typeface tf, int style) { public void setTypeface(Typeface tf, int style) {
super.setTypeface(tf, style); super.setTypeface(tf, style);
// might be called from constructor
if (textView != null) {
textView.setTypeface(getPaint().getTypeface()); textView.setTypeface(getPaint().getTypeface());
} }
}
@Override @Override
public void setTextSize(int unit, float size) { public void setTextSize(int unit, float size) {
super.setTextSize(unit, size); super.setTextSize(unit, size);
// might be called from constructor
if (textView != null) {
textView.setTextSize(getPaint().getTextSize()); textView.setTextSize(getPaint().getTextSize());
} }
}
@Override @Override
@NonNull @NonNull