webview fix
This commit is contained in:
@@ -85,9 +85,38 @@ public class StoreInfoFragment extends BaseFragment {
|
|||||||
private void initWebView(StoreInfoModel storeInfoModel) {
|
private void initWebView(StoreInfoModel storeInfoModel) {
|
||||||
storeInfoModel.checkNull();
|
storeInfoModel.checkNull();
|
||||||
setPizzalinkToolbarFields(false, storeInfoModel.getTitle());
|
setPizzalinkToolbarFields(false, storeInfoModel.getTitle());
|
||||||
|
storeInfoWebView.setVerticalScrollBarEnabled(false);
|
||||||
storeInfoWebView.getSettings().setJavaScriptEnabled(true);
|
storeInfoWebView.getSettings().setJavaScriptEnabled(true);
|
||||||
storeInfoWebView.loadDataWithBaseURL("", storeInfoModel.getContent(), "text/html", "UTF-8", "");
|
storeInfoWebView.loadDataWithBaseURL("", createFixedHTML(storeInfoModel.getContent()), "text/html", "UTF-8", "");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String createFixedHTML(String html){
|
||||||
|
|
||||||
|
String header = "<head><style>img{display: inline; height: auto; max-width: 100%;} html, body { width:100%; height: 100%; margin: 0px; padding: 0px;" + " }</style></head>";
|
||||||
|
|
||||||
|
//html = removeHs(html);
|
||||||
|
|
||||||
|
/*
|
||||||
|
String header = "<head>" +
|
||||||
|
" <meta http-equiv='content-type' content='text/html;'" +
|
||||||
|
" charset='UTF-8'>" +
|
||||||
|
" <style type='text/css'>" +
|
||||||
|
" " +
|
||||||
|
" @font-face {" +
|
||||||
|
" font-family: 'myfont';" +
|
||||||
|
" src: url('file:///android_asset/Resources/fonts/dosismedium.ttf');format('truetype'); " +
|
||||||
|
" }" +
|
||||||
|
" body { font-family:'myfont'; font-size: medium;}" +
|
||||||
|
" " +
|
||||||
|
" img{display: inline; height: auto; max-width: 100%;}" +
|
||||||
|
" </style>" +
|
||||||
|
" </head>";
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return "<html>" + header + "<body>" + html + "</body></html>";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,17 @@
|
|||||||
app:cardCornerRadius="4dp"
|
app:cardCornerRadius="4dp"
|
||||||
android:layout_margin="12dp">
|
android:layout_margin="12dp">
|
||||||
|
|
||||||
<WebView
|
<RelativeLayout
|
||||||
android:id="@+id/storeInfoWebView"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="12dp"/>
|
android:padding="8dp">
|
||||||
|
|
||||||
|
<WebView
|
||||||
|
android:id="@+id/storeInfoWebView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
</android.support.v7.widget.CardView>
|
</android.support.v7.widget.CardView>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user