41 lines
1.2 KiB
Java
41 lines
1.2 KiB
Java
package app.fedilab.fedilabtube.webview;
|
|
|
|
|
|
import android.annotation.TargetApi;
|
|
import android.content.Context;
|
|
import android.content.res.Configuration;
|
|
import android.os.Build;
|
|
import android.util.AttributeSet;
|
|
import android.webkit.WebView;
|
|
|
|
|
|
public class CustomWebview extends WebView {
|
|
|
|
|
|
public CustomWebview(Context context) {
|
|
super(getFixedContext(context));
|
|
}
|
|
|
|
public CustomWebview(Context context, AttributeSet attrs) {
|
|
super(getFixedContext(context), attrs);
|
|
}
|
|
|
|
public CustomWebview(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
super(getFixedContext(context), attrs, defStyleAttr);
|
|
}
|
|
|
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
public CustomWebview(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
|
super(getFixedContext(context), attrs, defStyleAttr, defStyleRes);
|
|
}
|
|
|
|
@SuppressWarnings("deprecation")
|
|
public CustomWebview(Context context, AttributeSet attrs, int defStyleAttr, boolean privateBrowsing) {
|
|
super(getFixedContext(context), attrs, defStyleAttr, privateBrowsing);
|
|
}
|
|
|
|
public static Context getFixedContext(Context context) {
|
|
return context.createConfigurationContext(new Configuration());
|
|
}
|
|
}
|