]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/activities/ViewSourceActivity.kt
Convert LogcatActivity to Kotlin. https://redmine.stoutner.com/issues/770
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / activities / ViewSourceActivity.kt
index eb8ba87cc0a3147738c6c7276eb1e1fb7d10211f..759b79c0fb00ebbbe91fc20bb21e002392c4bfb7 100644 (file)
@@ -82,8 +82,9 @@ class ViewSourceActivity: AppCompatActivity(), UntrustedSslCertificateListener {
         // Get a handle for the shared preferences.
         val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(applicationContext)
 
-        // Get the screenshot preference.
+        // Get the preferences.
         val allowScreenshots = sharedPreferences.getBoolean(getString(R.string.allow_screenshots_key), false)
+        val bottomAppBar = sharedPreferences.getBoolean(getString(R.string.bottom_app_bar_key), false)
 
         // Disable screenshots if not allowed.
         if (!allowScreenshots) {
@@ -104,7 +105,11 @@ class ViewSourceActivity: AppCompatActivity(), UntrustedSslCertificateListener {
         val userAgent = intent.getStringExtra(USER_AGENT)!!
 
         // Set the content view.
-        setContentView(R.layout.view_source_coordinatorlayout)
+        if (bottomAppBar) {
+            setContentView(R.layout.view_source_bottom_appbar)
+        } else {
+            setContentView(R.layout.view_source_top_appbar)
+        }
 
         // Get a handle for the toolbar.
         val toolbar = findViewById<Toolbar>(R.id.view_source_toolbar)
@@ -181,11 +186,7 @@ class ViewSourceActivity: AppCompatActivity(), UntrustedSslCertificateListener {
         }
 
         // Set the refresh color scheme according to the theme.
-        if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
-            swipeRefreshLayout.setColorSchemeResources(R.color.blue_700)
-        } else {
-            swipeRefreshLayout.setColorSchemeResources(R.color.violet_500)
-        }
+        swipeRefreshLayout.setColorSchemeResources(R.color.blue_text)
 
         // Initialize a color background typed value.
         val colorBackgroundTypedValue = TypedValue()