]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
First wrong button text in View Headers in night theme. https://redmine.stoutner... master
authorSoren Stoutner <soren@stoutner.com>
Fri, 12 Apr 2024 21:30:17 +0000 (14:30 -0700)
committerSoren Stoutner <soren@stoutner.com>
Fri, 12 Apr 2024 21:30:17 +0000 (14:30 -0700)
12 files changed:
app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksDatabaseViewActivity.kt
app/src/main/java/com/stoutner/privacybrowser/activities/LogcatActivity.kt
app/src/main/java/com/stoutner/privacybrowser/activities/ViewHeadersActivity.kt
app/src/main/res/color/button_background_selector.xml
app/src/main/res/color/button_text_selector.xml
app/src/main/res/color/checked_text_selector.xml
app/src/main/res/color/yellow_icon_selector.xml
app/src/main/res/layout/url_app_bar.xml
app/src/main/res/layout/view_headers_appbar_custom_view.xml
app/src/main/res/layout/view_headers_bottom_appbar.xml
app/src/main/res/layout/view_headers_top_appbar.xml
build.gradle

index b9f161e8c154fd8a07c4df292df35348f7d21efd..9804e5f59709eb408267a6221da1c70567dc4807 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2016-2024 Soren Stoutner <soren@stoutner.com>.
  *
 /*
  * Copyright 2016-2024 Soren Stoutner <soren@stoutner.com>.
  *
- * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
+ * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
  *
  * Privacy Browser Android is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * Privacy Browser Android is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -104,9 +104,8 @@ class BookmarksDatabaseViewActivity : AppCompatActivity(), EditBookmarkDatabaseV
         val bottomAppBar = sharedPreferences.getBoolean(getString(R.string.bottom_app_bar_key), false)
 
         // Disable screenshots if not allowed.
         val bottomAppBar = sharedPreferences.getBoolean(getString(R.string.bottom_app_bar_key), false)
 
         // Disable screenshots if not allowed.
-        if (!allowScreenshots) {
+        if (!allowScreenshots)
             window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
             window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
-        }
 
         // Run the default commands.
         super.onCreate(savedInstanceState)
 
         // Run the default commands.
         super.onCreate(savedInstanceState)
@@ -129,7 +128,7 @@ class BookmarksDatabaseViewActivity : AppCompatActivity(), EditBookmarkDatabaseV
             setContentView(R.layout.bookmarks_databaseview_top_appbar)
         }
 
             setContentView(R.layout.bookmarks_databaseview_top_appbar)
         }
 
-        // Get a handle for the toolbar.
+        // Get handles for the views.
         val toolbar = findViewById<Toolbar>(R.id.bookmarks_databaseview_toolbar)
         bookmarksListView = findViewById(R.id.bookmarks_databaseview_listview)
 
         val toolbar = findViewById<Toolbar>(R.id.bookmarks_databaseview_toolbar)
         bookmarksListView = findViewById(R.id.bookmarks_databaseview_listview)
 
index 214ebf2149aaa6d9bf931ce3d6bec7f1b256b181..a0e5ad8ab831acbc7785089bf336b9eaf57cad6d 100644 (file)
@@ -246,7 +246,7 @@ class LogcatActivity : AppCompatActivity() {
 
     override fun onOptionsItemSelected(menuItem: MenuItem): Boolean {
         // Run the commands that correlate to the selected menu item.
 
     override fun onOptionsItemSelected(menuItem: MenuItem): Boolean {
         // Run the commands that correlate to the selected menu item.
-        return when (menuItem.itemId) {
+        when (menuItem.itemId) {
             R.id.search -> {  // Search was selected.
                 // Set the minimum height of the search linear layout to match the toolbar.
                 searchLinearLayout.minimumHeight = toolbar.height
             R.id.search -> {  // Search was selected.
                 // Set the minimum height of the search linear layout to match the toolbar.
                 searchLinearLayout.minimumHeight = toolbar.height
@@ -273,7 +273,7 @@ class LogcatActivity : AppCompatActivity() {
                 logcatWebView.resumeTimers()
 
                 // Consume the event.
                 logcatWebView.resumeTimers()
 
                 // Consume the event.
-                true
+                return true
             }
 
             R.id.copy -> {  // Copy was selected.
             }
 
             R.id.copy -> {  // Copy was selected.
@@ -291,7 +291,7 @@ class LogcatActivity : AppCompatActivity() {
                     Snackbar.make(logcatWebView, R.string.logcat_copied, Snackbar.LENGTH_SHORT).show()
 
                 // Consume the event.
                     Snackbar.make(logcatWebView, R.string.logcat_copied, Snackbar.LENGTH_SHORT).show()
 
                 // Consume the event.
-                true
+                return true
             }
 
             R.id.save -> {  // Save was selected.
             }
 
             R.id.save -> {  // Save was selected.
@@ -299,7 +299,7 @@ class LogcatActivity : AppCompatActivity() {
                 saveLogcatActivityResultLauncher.launch(getString(R.string.privacy_browser_logcat_txt, BuildConfig.VERSION_NAME))
 
                 // Consume the event.
                 saveLogcatActivityResultLauncher.launch(getString(R.string.privacy_browser_logcat_txt, BuildConfig.VERSION_NAME))
 
                 // Consume the event.
-                true
+                return true
             }
 
             R.id.clear -> {  // Clear was selected.
             }
 
             R.id.clear -> {  // Clear was selected.
@@ -317,12 +317,12 @@ class LogcatActivity : AppCompatActivity() {
                 }
 
                 // Consume the event.
                 }
 
                 // Consume the event.
-                true
+                return true
             }
 
             }
 
-            else -> {  // The home button was pushed.
+            else -> {  // The home button was selected.
                 // Do not consume the event.  The system will process the home command.
                 // Do not consume the event.  The system will process the home command.
-                super.onOptionsItemSelected(menuItem)
+                return super.onOptionsItemSelected(menuItem)
             }
         }
     }
             }
         }
     }
index 8a0cc6531789b831f9a44cd7175bf70fbd3dd1fb..8e72b596b9cea383b7d6a0b509b71e03030e4060 100644 (file)
@@ -46,7 +46,6 @@ import androidx.appcompat.app.ActionBar
 import androidx.appcompat.app.AppCompatActivity
 import androidx.appcompat.widget.Toolbar
 import androidx.constraintlayout.widget.ConstraintLayout
 import androidx.appcompat.app.AppCompatActivity
 import androidx.appcompat.widget.Toolbar
 import androidx.constraintlayout.widget.ConstraintLayout
-import androidx.core.app.NavUtils
 import androidx.lifecycle.ViewModelProvider
 import androidx.preference.PreferenceManager
 import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
 import androidx.lifecycle.ViewModelProvider
 import androidx.preference.PreferenceManager
 import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
@@ -152,9 +151,8 @@ class ViewHeadersActivity: AppCompatActivity(), UntrustedSslCertificateListener
         val bottomAppBar = sharedPreferences.getBoolean(getString(R.string.bottom_app_bar_key), false)
 
         // Disable screenshots if not allowed.
         val bottomAppBar = sharedPreferences.getBoolean(getString(R.string.bottom_app_bar_key), false)
 
         // Disable screenshots if not allowed.
-        if (!allowScreenshots) {
+        if (!allowScreenshots)
             window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
             window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
-        }
 
         // Run the default commands.
         super.onCreate(savedInstanceState)
 
         // Run the default commands.
         super.onCreate(savedInstanceState)
@@ -167,11 +165,10 @@ class ViewHeadersActivity: AppCompatActivity(), UntrustedSslCertificateListener
         val userAgent = intent.getStringExtra(USER_AGENT)!!
 
         // Set the content view.
         val userAgent = intent.getStringExtra(USER_AGENT)!!
 
         // Set the content view.
-        if (bottomAppBar) {
+        if (bottomAppBar)
             setContentView(R.layout.view_headers_bottom_appbar)
             setContentView(R.layout.view_headers_bottom_appbar)
-        } else {
+        else
             setContentView(R.layout.view_headers_top_appbar)
             setContentView(R.layout.view_headers_top_appbar)
-        }
 
         // Get a handle for the toolbar.
         val toolbar = findViewById<Toolbar>(R.id.toolbar)
 
         // Get a handle for the toolbar.
         val toolbar = findViewById<Toolbar>(R.id.toolbar)
@@ -186,7 +183,7 @@ class ViewHeadersActivity: AppCompatActivity(), UntrustedSslCertificateListener
         actionBar.setCustomView(R.layout.view_headers_appbar_custom_view)
 
         // Instruct the action bar to display a custom layout.
         actionBar.setCustomView(R.layout.view_headers_appbar_custom_view)
 
         // Instruct the action bar to display a custom layout.
-        actionBar.displayOptions = ActionBar.DISPLAY_SHOW_CUSTOM
+        actionBar.displayOptions = ActionBar.DISPLAY_SHOW_CUSTOM or ActionBar.DISPLAY_HOME_AS_UP
 
         // Get handles for the views.
         urlEditText = findViewById(R.id.url_edittext)
 
         // Get handles for the views.
         urlEditText = findViewById(R.id.url_edittext)
@@ -427,7 +424,7 @@ class ViewHeadersActivity: AppCompatActivity(), UntrustedSslCertificateListener
     }
 
     override fun onOptionsItemSelected(menuItem: MenuItem): Boolean {
     }
 
     override fun onOptionsItemSelected(menuItem: MenuItem): Boolean {
-        // Run the appropriate commands.
+        // Run the commands that correlate to the selected menu item.
         when (menuItem.itemId) {
             R.id.copy_headers -> {  // Copy the headers.
                 // Get the headers string.
         when (menuItem.itemId) {
             R.id.copy_headers -> {  // Copy the headers.
                 // Get the headers string.
@@ -502,18 +499,12 @@ class ViewHeadersActivity: AppCompatActivity(), UntrustedSslCertificateListener
             }
 
             else -> {  // The home button was selected.
             }
 
             else -> {  // The home button was selected.
-                // Run the parents class on return.
+                // Do not consume the event.  The system will process the home command.
                 return super.onOptionsItemSelected(menuItem)
             }
         }
     }
 
                 return super.onOptionsItemSelected(menuItem)
             }
         }
     }
 
-    // This method must be named `goBack()` and must have a View argument to match the default back arrow in the app bar or a crash occurs.
-    fun goBack(@Suppress("UNUSED_PARAMETER") view: View) {
-        // Go home.
-        NavUtils.navigateUpFromSameTask(this)
-    }
-
     private fun getHeadersString(): String {
         // Initialize a headers string builder.
         val headersStringBuilder = StringBuilder()
     private fun getHeadersString(): String {
         // Initialize a headers string builder.
         val headersStringBuilder = StringBuilder()
index a21d2724dac1c1a52f8389907eeae445f3c7282c..dbb36f95083102c8fa7bff34e30d1cc7f8984903 100644 (file)
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 
 <!--
 <?xml version="1.0" encoding="utf-8"?>
 
 <!--
-  Copyright © 2017-2018,2020,2022 Soren Stoutner <soren@stoutner.com>.
+  Copyright 2017-2018, 2020, 2022 Soren Stoutner <soren@stoutner.com>.
 
 
-  This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
+  This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
 
   Privacy Browser Android is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
 
   Privacy Browser Android is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -22,4 +22,4 @@
 <selector xmlns:android="http://schemas.android.com/apk/res/android" >
     <item android:state_enabled="true" android:color="@color/blue_button" />
     <item android:state_enabled="false" android:color="@color/disabled_button" />
 <selector xmlns:android="http://schemas.android.com/apk/res/android" >
     <item android:state_enabled="true" android:color="@color/blue_button" />
     <item android:state_enabled="false" android:color="@color/disabled_button" />
-</selector>
\ No newline at end of file
+</selector>
index ed2ecaccaebb05df48c2a58def622d224ccd9634..956c28a511ba44fc3f327dfc587d0afbd046ce97 100644 (file)
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 
 <!--
 <?xml version="1.0" encoding="utf-8"?>
 
 <!--
-  Copyright © 2017-2018,2020,2022 Soren Stoutner <soren@stoutner.com>.
+  Copyright 2017-2018, 2020, 2022 Soren Stoutner <soren@stoutner.com>.
 
 
-  This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
+  This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
 
   Privacy Browser Android is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
 
   Privacy Browser Android is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -22,4 +22,4 @@
 <selector xmlns:android="http://schemas.android.com/apk/res/android" >
     <item android:state_enabled="true" android:color="@color/button_text" />
     <item android:state_enabled="false" android:color="@color/disabled_button_text" />
 <selector xmlns:android="http://schemas.android.com/apk/res/android" >
     <item android:state_enabled="true" android:color="@color/button_text" />
     <item android:state_enabled="false" android:color="@color/disabled_button_text" />
-</selector>
\ No newline at end of file
+</selector>
index c76e72399e157df311af2c7b10df94ddc8c6b4c6..bfd3a5805ef847be79ac2b4e99bf275a14a9c8f9 100644 (file)
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 
 <!--
 <?xml version="1.0" encoding="utf-8"?>
 
 <!--
-  Copyright © 2017-2018,2020,2022 Soren Stoutner <soren@stoutner.com>.
+  Copyright 2017-2018, 2020, 2022 Soren Stoutner <soren@stoutner.com>.
 
 
-  This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
+  This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
 
   Privacy Browser Android is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
 
   Privacy Browser Android is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -22,4 +22,4 @@
 <selector xmlns:android="http://schemas.android.com/apk/res/android" >
     <item android:state_checked="true" android:color="?android:attr/textColorPrimary" />
     <item android:state_checked="false" android:color="@color/gray_500" />
 <selector xmlns:android="http://schemas.android.com/apk/res/android" >
     <item android:state_checked="true" android:color="?android:attr/textColorPrimary" />
     <item android:state_checked="false" android:color="@color/gray_500" />
-</selector>
\ No newline at end of file
+</selector>
index 4b8a91d8bfaaef8aa8a43ae20da5d0560dc96018..8fb37f6ed828f17549fb6dbf0a5cb565e523c846 100644 (file)
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 
 <!--
 <?xml version="1.0" encoding="utf-8"?>
 
 <!--
-  Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
+  Copyright 2022 Soren Stoutner <soren@stoutner.com>.
 
 
-  This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
+  This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
 
   Privacy Browser Android is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
 
   Privacy Browser Android is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -23,4 +23,4 @@
     <item android:state_enabled="false" android:color="@color/ghosted_icon" />
     <item android:state_selected="true" android:color="@color/yellow_900" />
     <item android:state_selected="false" android:color="@color/disabled_icon" />
     <item android:state_enabled="false" android:color="@color/ghosted_icon" />
     <item android:state_selected="true" android:color="@color/yellow_900" />
     <item android:state_selected="false" android:color="@color/disabled_icon" />
-</selector>
\ No newline at end of file
+</selector>
index 4be8f6a26b37432a44878dd47d363cfedee3202d..4d1883da9b721824499fe17499dc1cd808929b83 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 
 <!--
 <?xml version="1.0" encoding="utf-8"?>
 
 <!--
-  Copyright 2015-2019,2022-2024 Soren Stoutner <soren@stoutner.com>.
+  Copyright 2015-2019, 2022-2024 Soren Stoutner <soren@stoutner.com>.
 
   This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
 
 
   This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
 
index 17982c08584ecb596c07e414680eaefb08e9dd4c..0dc83f6fafffb4ae0c05eab3e27546c7fb212d36 100644 (file)
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 
 <!--
 <?xml version="1.0" encoding="utf-8"?>
 
 <!--
-  Copyright 2015-2020,2022-2023 Soren Stoutner <soren@stoutner.com>.
+  Copyright 2015-2020, 2022-2024 Soren Stoutner <soren@stoutner.com>.
 
 
-  This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
+  This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
 
   Privacy Browser Android is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
 
   Privacy Browser Android is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   You should have received a copy of the GNU General Public License
   along with Privacy Browser Android.  If not, see <http://www.gnu.org/licenses/>. -->
 
   You should have received a copy of the GNU General Public License
   along with Privacy Browser Android.  If not, see <http://www.gnu.org/licenses/>. -->
 
-<!-- Relative layout is used instead of a linear layout because `supportAppBar` does not let `android:layout_weight="1"` cause the URL text box to fill all the available space. -->
-<RelativeLayout
+<!-- `android:imeOptions="actionGo"` sets the keyboard to have a `go` key instead of a `new line` key. `android:inputType="textUri"` disables spell check in the `EditText`. -->
+<EditText
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/url_edittext"
     android:layout_height="wrap_content"
     android:layout_height="wrap_content"
-    android:layout_width="match_parent" >
-
-    <ImageView
-        android:id="@+id/back_arrow"
-        android:src="@drawable/back"
-        app:tint="?attr/colorControlNormal"
-        android:layout_height="wrap_content"
-        android:layout_width="wrap_content"
-        android:layout_centerVertical="true"
-        android:layout_marginEnd="14dp"
-        android:contentDescription="@string/back"
-        android:onClick="goBack" />
-
-    <!-- `android:imeOptions="actionGo"` sets the keyboard to have a `go` key instead of a `new line` key.
-        `android:inputType="textUri"` disables spell check in the `EditText`. -->
-    <EditText
-        android:id="@+id/url_edittext"
-        android:layout_height="wrap_content"
-        android:layout_width="match_parent"
-        android:layout_toEndOf="@id/back_arrow"
-        android:hint="@string/url"
-        android:imeOptions="actionGo"
-        android:inputType="textUri"
-        android:selectAllOnFocus="true"
-        tools:ignore="Autofill" />
-</RelativeLayout>
+    android:layout_width="match_parent"
+    android:hint="@string/url"
+    android:imeOptions="actionGo"
+    android:inputType="textUri"
+    android:selectAllOnFocus="true"
+    tools:ignore="Autofill" />
index 0219c09a1c2f667a348683c45fbab8d671600354..7dbab777110dba15b8072f2b9462b2dcd161c519 100644 (file)
                                 android:text="@string/ciphers"
                                 android:onClick="showCiphers"
                                 app:backgroundTint="@color/button_background_selector"
                                 android:text="@string/ciphers"
                                 android:onClick="showCiphers"
                                 app:backgroundTint="@color/button_background_selector"
-                                android:textColor="@color/button_text_selector"
+                                android:textColor="@color/white"
                                 tools:ignore="ButtonStyle" />
 
                             <androidx.appcompat.widget.AppCompatButton
                                 tools:ignore="ButtonStyle" />
 
                             <androidx.appcompat.widget.AppCompatButton
                                 android:text="@string/certificate"
                                 android:onClick="showCertificate"
                                 app:backgroundTint="@color/button_background_selector"
                                 android:text="@string/certificate"
                                 android:onClick="showCertificate"
                                 app:backgroundTint="@color/button_background_selector"
-                                android:textColor="@color/button_text_selector"
+                                android:textColor="@color/white"
                                 tools:ignore="ButtonStyle" />
                         </androidx.constraintlayout.widget.ConstraintLayout>
 
                                 tools:ignore="ButtonStyle" />
                         </androidx.constraintlayout.widget.ConstraintLayout>
 
index 588ff6b74c4f6b1708a6dc53fdc9f23aeeeb0e8e..34207a5b629cb13031a2e85d393650cd7d8b0256 100644 (file)
                                 android:text="@string/ciphers"
                                 android:onClick="showCiphers"
                                 app:backgroundTint="@color/button_background_selector"
                                 android:text="@string/ciphers"
                                 android:onClick="showCiphers"
                                 app:backgroundTint="@color/button_background_selector"
-                                android:textColor="@color/button_text_selector"
+                                android:textColor="@color/white"
                                 tools:ignore="ButtonStyle" />
 
                             <androidx.appcompat.widget.AppCompatButton
                                 tools:ignore="ButtonStyle" />
 
                             <androidx.appcompat.widget.AppCompatButton
                                 android:text="@string/certificate"
                                 android:onClick="showCertificate"
                                 app:backgroundTint="@color/button_background_selector"
                                 android:text="@string/certificate"
                                 android:onClick="showCertificate"
                                 app:backgroundTint="@color/button_background_selector"
-                                android:textColor="@color/button_text_selector"
+                                android:textColor="@color/white"
                                 tools:ignore="ButtonStyle" />
                         </androidx.constraintlayout.widget.ConstraintLayout>
 
                                 tools:ignore="ButtonStyle" />
                         </androidx.constraintlayout.widget.ConstraintLayout>
 
index c390d1f04c642472463442625862ed71ce4c2fea..8573ba5c6ae06bbf3f2e48f2c1514f454b2f34e7 100644 (file)
@@ -26,7 +26,7 @@ buildscript {
     }
 
     dependencies {
     }
 
     dependencies {
-        classpath 'com.android.tools.build:gradle:8.3.1'
+        classpath 'com.android.tools.build:gradle:8.3.2'
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20"
 
         // NOTE: Do not place your application dependencies here; they belong
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20"
 
         // NOTE: Do not place your application dependencies here; they belong