Fix station detail card (modal) collapsing to a narrow column in WebView
This commit is contained in:
@@ -43,6 +43,7 @@ class MainActivity : Activity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
WebView.setWebContentsDebuggingEnabled(true)
|
||||
|
||||
val root = FrameLayout(this).apply {
|
||||
setBackgroundColor(Color.rgb(6, 11, 20))
|
||||
@@ -74,6 +75,15 @@ class MainActivity : Activity() {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onPageFinished(view: WebView, url: String?) {
|
||||
super.onPageFinished(view, url)
|
||||
view.evaluateJavascript(
|
||||
"document.head.insertAdjacentHTML('beforeend','<style id=\"aprs-fix\">' + " +
|
||||
org.json.JSONObject.quote(FIX_CSS) + " + '</style>')",
|
||||
null
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
webChromeClient = object : WebChromeClient() {
|
||||
@@ -254,5 +264,35 @@ class MainActivity : Activity() {
|
||||
companion object {
|
||||
private const val TAG = "APRSmap"
|
||||
private const val REQ_NOTIFICATIONS = 100
|
||||
|
||||
private val FIX_CSS = """
|
||||
.leaflet-popup-content-wrapper {
|
||||
max-width: 88vw !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.leaflet-infowindow-content .leaflet-popup-content-wrapper {
|
||||
width: min(88vw, 440px) !important;
|
||||
}
|
||||
.leaflet-infowindow-content .leaflet-popup-content {
|
||||
width: 100% !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.leaflet-popup-content p {
|
||||
margin: 8px 0;
|
||||
}
|
||||
.leaflet-popup-content img {
|
||||
max-width: 100% !important;
|
||||
height: auto !important;
|
||||
}
|
||||
.modal-content-body, .td-modal-content, .modal-inner-content {
|
||||
width: 100% !important;
|
||||
min-width: 0 !important;
|
||||
box-sizing: border-box !important;
|
||||
}
|
||||
.overview-content-summary, .overview-content-station-list {
|
||||
max-width: 100% !important;
|
||||
box-sizing: border-box !important;
|
||||
}
|
||||
""".trimIndent()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user