Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions MathView/src/main/java/io/github/kexanie/library/MathView.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ public class MathView extends WebView {

public MathView(Context context, AttributeSet attrs) {
super(context, attrs);

if (!isInEditMode()) { // by-pass initializations in preview mode
init(context, attrs);
}

}

private void init(Context context, AttributeSet attrs){
getSettings().setJavaScriptEnabled(true);
getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
setBackgroundColor(Color.TRANSPARENT);
Expand All @@ -38,7 +46,7 @@ public MathView(Context context, AttributeSet attrs) {
mTypeArray.recycle();
}
}

// disable touch event on MathView
@Override
public boolean onTouchEvent(MotionEvent event) {
Expand Down Expand Up @@ -117,4 +125,4 @@ public static class Engine {
final public static int KATEX = 0;
final public static int MATHJAX = 1;
}
}
}