/*
* 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
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)
- }
// Run the default commands.
super.onCreate(savedInstanceState)
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)
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
logcatWebView.resumeTimers()
// Consume the event.
- true
+ return true
}
R.id.copy -> { // Copy was selected.
Snackbar.make(logcatWebView, R.string.logcat_copied, Snackbar.LENGTH_SHORT).show()
// Consume the event.
- true
+ return true
}
R.id.save -> { // Save was selected.
saveLogcatActivityResultLauncher.launch(getString(R.string.privacy_browser_logcat_txt, BuildConfig.VERSION_NAME))
// Consume the event.
- true
+ return true
}
R.id.clear -> { // Clear was selected.
}
// 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.
- super.onOptionsItemSelected(menuItem)
+ return super.onOptionsItemSelected(menuItem)
}
}
}
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
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)
- }
// Run the default commands.
super.onCreate(savedInstanceState)
val userAgent = intent.getStringExtra(USER_AGENT)!!
// Set the content view.
- if (bottomAppBar) {
+ if (bottomAppBar)
setContentView(R.layout.view_headers_bottom_appbar)
- } else {
+ else
setContentView(R.layout.view_headers_top_appbar)
- }
// Get a handle for the toolbar.
val toolbar = findViewById<Toolbar>(R.id.toolbar)
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)
}
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.
}
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)
}
}
}
- // 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()
<?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
<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>
<?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
<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>
<?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
<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>
<?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
<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>
<?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/>.
<?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
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:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/url_edittext"
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" />
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
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>
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
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>
}
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