Dashboard URL and label configured in dashboards.yaml; each entry becomes a product flavor with BuildConfig.DASHBOARD_URL injected at build time. APKs output as <flavor>-release.apk.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
android:allowBackup="false"
|
||||
android:banner="@drawable/banner"
|
||||
android:icon="@drawable/icon"
|
||||
android:label="Grafana Kiosk"
|
||||
android:label="@string/app_name"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
|
||||
|
||||
@@ -15,11 +15,6 @@ import android.webkit.WebViewClient
|
||||
|
||||
class MainActivity : Activity() {
|
||||
|
||||
companion object {
|
||||
const val DASHBOARD_URL =
|
||||
"https://grafana.c3c.cz/public-dashboards/381fe3e71e164eb99dd0b10e246a36e2"
|
||||
}
|
||||
|
||||
private lateinit var webView: WebView
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private val backoff = BackoffPolicy(initialDelayMs = 2_000, maxDelayMs = 60_000)
|
||||
@@ -55,7 +50,7 @@ class MainActivity : Activity() {
|
||||
if (!request.isForMainFrame) return
|
||||
lastLoadFailed = true
|
||||
handler.postDelayed(
|
||||
{ view.loadUrl(DASHBOARD_URL) },
|
||||
{ view.loadUrl(BuildConfig.DASHBOARD_URL) },
|
||||
backoff.nextDelayMs(),
|
||||
)
|
||||
}
|
||||
@@ -63,7 +58,7 @@ class MainActivity : Activity() {
|
||||
|
||||
setContentView(webView)
|
||||
hideSystemUi()
|
||||
webView.loadUrl(DASHBOARD_URL)
|
||||
webView.loadUrl(BuildConfig.DASHBOARD_URL)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
||||
Reference in New Issue
Block a user