Add explanation dialogs for the network types. https://redmine.stoutner.com/issues/756
[PrivacyCell.git] / app / src / main / java / com / stoutner / privacycell / dialogs / WebViewDialog.kt
index 8fd2edb15bd7f302120620e95f87a21cf18d8a57..3b448bd666f0e75b6fd84902884e4abe3aa5f0a1 100644 (file)
@@ -48,6 +48,32 @@ class WebViewDialog : DialogFragment() {
         const val CHANGELOG = 2
         const val LICENSES = 3
         const val CONTRIBUTORS = 4
+        const val STINGRAY = 5
+        const val NETWORK_UNKNOWN = 6
+        const val NETWORK_GPRS = 7
+        const val NETWORK_EDGE = 8
+        const val NETWORK_UMTS = 9
+        const val NETWORK_CDMA = 10
+        const val NETWORK_EVDO_0 = 11
+        const val NETWORK_EVDO_A = 12
+        const val NETWORK_1xRTT = 13
+        const val NETWORK_HSDPA = 14
+        const val NETWORK_HSUPA = 15
+        const val NETWORK_HSPA = 16
+        const val NETWORK_IDEN = 17
+        const val NETWORK_EVDO_B = 18
+        const val NETWORK_LTE = 19
+        const val NETWORK_EHRPD = 20
+        const val NETWORK_HSPAP = 21
+        const val NETWORK_GSM = 22
+        const val NETWORK_TD_SCDMA = 23
+        const val NETWORK_IWLAN = 24
+        const val NETWORK_NR = 25
+        const val OVERRIDE_NETWORK_NONE = 26
+        const val OVERRIDE_NETWORK_LTE_CA = 27
+        const val OVERRIDE_NETWORK_LTE_ADVANCED_PRO = 28
+        const val OVERRIDE_NETWORK_NR_NSA = 29
+        const val OVERRIDE_NETWORK_NR_NSA_MMWAVE = 30
     }
 
     // Define the class views.
@@ -119,6 +145,214 @@ class WebViewDialog : DialogFragment() {
                 // Set the tile.
                 dialogBuilder.setTitle(R.string.contributors)
             }
+
+            STINGRAY -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.secure_5g_nr_sa)
+
+                // Set the tile.
+                dialogBuilder.setTitle(R.string.stingrays)
+            }
+
+            NETWORK_UNKNOWN -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.unknown)
+            }
+
+            NETWORK_GPRS -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.gprs)
+            }
+
+            NETWORK_EDGE -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.edge)
+            }
+
+            NETWORK_UMTS -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.umts)
+            }
+
+            NETWORK_CDMA -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.cdma)
+            }
+
+            NETWORK_EVDO_0 -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.evdo_0)
+            }
+
+            NETWORK_EVDO_A -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.evdo_a)
+            }
+
+            NETWORK_1xRTT -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.rtt)
+            }
+
+            NETWORK_HSDPA -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.hsdpa)
+            }
+
+            NETWORK_HSUPA -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.hsupa)
+            }
+
+            NETWORK_HSPA -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.hspa)
+            }
+
+            NETWORK_IDEN -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.iden)
+            }
+
+            NETWORK_EVDO_B -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.evdo_b)
+            }
+
+            NETWORK_LTE -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.lte)
+            }
+
+            NETWORK_EHRPD -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.ehrpd)
+            }
+
+            NETWORK_HSPAP -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.hspap)
+            }
+
+            NETWORK_GSM -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.gsm)
+            }
+
+            NETWORK_TD_SCDMA -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.td_scdma)
+            }
+
+            NETWORK_IWLAN -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.iwlan)
+            }
+
+            NETWORK_NR -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.nr)
+            }
+
+            OVERRIDE_NETWORK_NONE -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.none)
+            }
+
+            OVERRIDE_NETWORK_LTE_CA -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.lte_ca)
+            }
+
+            OVERRIDE_NETWORK_LTE_ADVANCED_PRO -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.lte_ca)
+            }
+
+            OVERRIDE_NETWORK_NR_NSA -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.nr_nsa)
+            }
+
+            OVERRIDE_NETWORK_NR_NSA_MMWAVE -> {
+                // Set the icon.
+                dialogBuilder.setIcon(R.drawable.privacy_policy)
+
+                // Set the title.
+                dialogBuilder.setTitle(R.string.nr_nsa_mmwave)
+            }
         }
 
         // Set the view.
@@ -179,6 +413,33 @@ class WebViewDialog : DialogFragment() {
             CHANGELOG -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/changelog.html")
             LICENSES -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/licenses.html")
             CONTRIBUTORS -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/contributors.html")
+            STINGRAY -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/stingrays.html")
+            NETWORK_UNKNOWN -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_unknown.html")
+            NETWORK_GPRS -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_gprs.html")
+            NETWORK_EDGE -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_edge.html")
+            NETWORK_UMTS -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_umts.html")
+            NETWORK_CDMA -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_cdma.html")
+            NETWORK_EVDO_0 -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_evdo_0.html")
+            NETWORK_EVDO_A -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_evdo_a.html")
+            NETWORK_1xRTT -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_1xrtt.html")
+            NETWORK_HSDPA -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_hsdpa.html")
+            NETWORK_HSUPA -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_hsupa.html")
+            NETWORK_HSPA -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_hspa.html")
+            NETWORK_IDEN -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_iden.html")
+            NETWORK_EVDO_B -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_evdo_b.html")
+            NETWORK_LTE -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_lte.html")
+            NETWORK_EHRPD -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_ehrpd.html")
+            NETWORK_HSPAP -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_hspap.html")
+            NETWORK_GSM -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_gsm.html")
+            NETWORK_TD_SCDMA -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_td_scdma.html")
+            NETWORK_IWLAN -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_iwlan.html")
+            NETWORK_NR -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/network_nr.html")
+            OVERRIDE_NETWORK_NONE -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/override_network_none.html")
+            OVERRIDE_NETWORK_LTE_CA -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/override_network_lte_ca.html")
+            OVERRIDE_NETWORK_LTE_ADVANCED_PRO -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) +
+                    "/explanations/override_network_lte_advanced_pro.html")
+            OVERRIDE_NETWORK_NR_NSA -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/override_network_nr_nsa.html")
+            OVERRIDE_NETWORK_NR_NSA_MMWAVE -> webView.loadUrl("https://appassets.androidplatform.net/assets/" + getString(R.string.asset_directory) + "/explanations/override_network_nr_nsa_mmwave.html")
         }
 
         // Scroll the WebView if the saved instance state is not null.