dependencies {
// Include the following AndroidX libraries.
- implementation "androidx.activity:activity-ktx:1.8.2"
+ implementation "androidx.activity:activity-ktx:1.9.0"
implementation 'androidx.arch.core:core-common:2.2.0'
implementation 'androidx.arch.core:core-runtime:2.2.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
- implementation 'androidx.core:core-ktx:1.12.0'
+ implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.drawerlayout:drawerlayout:1.2.0'
- implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0'
+ implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.0'
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'androidx.viewpager:viewpager:1.0.0'
- implementation 'androidx.webkit:webkit:1.10.0'
+ implementation 'androidx.webkit:webkit:1.11.0'
// Include the Kotlin standard library. This should be the same version number listed in project build.gradle.
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.9.20'
// Include the Google material library.
- implementation 'com.google.android.material:material:1.11.0'
+ implementation 'com.google.android.material:material:1.12.0'
}
/*
* 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
}
}
- public override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ public override fun onSaveInstanceState(outState: Bundle) {
// Run the default commands.
- super.onSaveInstanceState(savedInstanceState)
+ super.onSaveInstanceState(outState)
// Get the sparse boolean array of the checked items.
val checkedBookmarksSparseBooleanArray = bookmarksListView.checkedItemPositions
}
}
- // Store the variables in the saved instance state.
- savedInstanceState.putLong(CURRENT_FOLDER_ID, currentFolderId)
- savedInstanceState.putIntegerArrayList(CHECKED_BOOKMARKS_ARRAY_LIST, checkedBookmarksArrayList)
+ // Store the variables in the out state.
+ outState.putLong(CURRENT_FOLDER_ID, currentFolderId)
+ outState.putIntegerArrayList(CHECKED_BOOKMARKS_ARRAY_LIST, checkedBookmarksArrayList)
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
return true
}
- public override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ public override fun onSaveInstanceState(outState: Bundle) {
// Run the default commands.
- super.onSaveInstanceState(savedInstanceState)
+ super.onSaveInstanceState(outState)
// Store the class variables in the bundle.
- savedInstanceState.putInt(CURRENT_FOLDER_DATABASE_ID, currentFolderDatabaseId)
- savedInstanceState.putBoolean(SORT_BY_DISPLAY_ORDER, sortByDisplayOrder)
+ outState.putInt(CURRENT_FOLDER_DATABASE_ID, currentFolderDatabaseId)
+ outState.putBoolean(SORT_BY_DISPLAY_ORDER, sortByDisplayOrder)
}
override fun saveBookmark(dialogFragment: DialogFragment, selectedBookmarkDatabaseId: Int) {
/*
* Copyright 2017-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
return true
}
- override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ override fun onSaveInstanceState(outState: Bundle) {
// Run the default commands.
- super.onSaveInstanceState(savedInstanceState)
+ super.onSaveInstanceState(outState)
// Get a handle for the domain settings scrollview.
val domainSettingsScrollView = findViewById<ScrollView>(R.id.domain_settings_scrollview)
// Check to see if the domain settings scrollview exists.
if (domainSettingsScrollView == null) { // The domain settings are not displayed.
// Store the domain settings status in the bundle.
- savedInstanceState.putBoolean(DOMAIN_SETTINGS_DISPLAYED, false)
- savedInstanceState.putInt(DOMAIN_SETTINGS_DATABASE_ID, -1)
- savedInstanceState.putInt(DOMAIN_SETTINGS_SCROLL_Y, 0)
+ outState.putBoolean(DOMAIN_SETTINGS_DISPLAYED, false)
+ outState.putInt(DOMAIN_SETTINGS_DATABASE_ID, -1)
+ outState.putInt(DOMAIN_SETTINGS_SCROLL_Y, 0)
} else { // The domain settings are displayed.
// Save any changes that have been made to the domain settings.
saveDomainSettings(coordinatorLayout)
val domainSettingsScrollY = domainSettingsScrollView.scrollY
// Store the domain settings status in the bundle.
- savedInstanceState.putBoolean(DOMAIN_SETTINGS_DISPLAYED, true)
- savedInstanceState.putInt(DOMAIN_SETTINGS_DATABASE_ID, DomainSettingsFragment.databaseId)
- savedInstanceState.putInt(DOMAIN_SETTINGS_SCROLL_Y, domainSettingsScrollY)
+ outState.putBoolean(DOMAIN_SETTINGS_DISPLAYED, true)
+ outState.putInt(DOMAIN_SETTINGS_DATABASE_ID, DomainSettingsFragment.databaseId)
+ outState.putInt(DOMAIN_SETTINGS_SCROLL_Y, domainSettingsScrollY)
}
// Check to see if the domains listview exists.
val domainsListViewPosition = domainsListView!!.firstVisiblePosition
// Store the listview position in the bundle.
- savedInstanceState.putInt(LISTVIEW_POSITION, domainsListViewPosition)
+ outState.putInt(LISTVIEW_POSITION, domainsListViewPosition)
}
}
/*
- * Copyright 2018-2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2018-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
}
}
- public override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ public override fun onSaveInstanceState(outState: Bundle) {
// Run the default commands.
- super.onSaveInstanceState(savedInstanceState)
+ super.onSaveInstanceState(outState)
// Save the visibility of the views.
- savedInstanceState.putInt(ENCRYPTION_PASSWORD_TEXTINPUTLAYOUT_VISIBILITY, encryptionPasswordTextInputLayout.visibility)
- savedInstanceState.putInt(OPEN_KEYCHAIN_REQUIRED_TEXTVIEW_VISIBILITY, openKeychainRequiredTextView.visibility)
- savedInstanceState.putInt(SETTINGS_FILE_LOCATION_CARDVIEW_VISIBILITY, settingsFileLocationCardView.visibility)
- savedInstanceState.putInt(SETTINGS_FILE_NAME_LINEARLAYOUT_VISIBILITY, settingsFileNameLinearLayout.visibility)
- savedInstanceState.putInt(OPEN_KEYCHAIN_IMPORT_INSTRUCTIONS_TEXTVIEW_VISIBILITY, openKeychainImportInstructionsTextView.visibility)
- savedInstanceState.putInt(SETTINGS_IMPORT_EXPORT_BUTTON_VISIBILITY, settingsImportExportButton.visibility)
- savedInstanceState.putInt(BOOKMARKS_FILE_NAME_LINEARLAYOUT_VISIBILITY, bookmarksFileNameLinearLayout.visibility)
- savedInstanceState.putInt(BOOKMARKS_IMPORT_EXPORT_BUTTON_VISIBILITY, bookmarksImportExportButton.visibility)
+ outState.putInt(ENCRYPTION_PASSWORD_TEXTINPUTLAYOUT_VISIBILITY, encryptionPasswordTextInputLayout.visibility)
+ outState.putInt(OPEN_KEYCHAIN_REQUIRED_TEXTVIEW_VISIBILITY, openKeychainRequiredTextView.visibility)
+ outState.putInt(SETTINGS_FILE_LOCATION_CARDVIEW_VISIBILITY, settingsFileLocationCardView.visibility)
+ outState.putInt(SETTINGS_FILE_NAME_LINEARLAYOUT_VISIBILITY, settingsFileNameLinearLayout.visibility)
+ outState.putInt(OPEN_KEYCHAIN_IMPORT_INSTRUCTIONS_TEXTVIEW_VISIBILITY, openKeychainImportInstructionsTextView.visibility)
+ outState.putInt(SETTINGS_IMPORT_EXPORT_BUTTON_VISIBILITY, settingsImportExportButton.visibility)
+ outState.putInt(BOOKMARKS_FILE_NAME_LINEARLAYOUT_VISIBILITY, bookmarksFileNameLinearLayout.visibility)
+ outState.putInt(BOOKMARKS_IMPORT_EXPORT_BUTTON_VISIBILITY, bookmarksImportExportButton.visibility)
// Save the text.
- savedInstanceState.putString(SETTINGS_FILE_NAME_TEXT, settingsFileNameEditText.text.toString())
- savedInstanceState.putString(SETTINGS_IMPORT_EXPORT_BUTTON_TEXT, settingsImportExportButton.text.toString())
- savedInstanceState.putString(BOOKMARKS_FILE_NAME_TEXT, bookmarksFileNameEditText.text.toString())
- savedInstanceState.putString(BOOKMARKS_IMPORT_EXPORT_BUTTON_VISIBILITY, bookmarksImportExportButton.text.toString())
+ outState.putString(SETTINGS_FILE_NAME_TEXT, settingsFileNameEditText.text.toString())
+ outState.putString(SETTINGS_IMPORT_EXPORT_BUTTON_TEXT, settingsImportExportButton.text.toString())
+ outState.putString(BOOKMARKS_FILE_NAME_TEXT, bookmarksFileNameEditText.text.toString())
+ outState.putString(BOOKMARKS_IMPORT_EXPORT_BUTTON_VISIBILITY, bookmarksImportExportButton.text.toString())
}
fun onClickBookmarksRadioButton(view: View) {
}
}
- public override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ public override fun onSaveInstanceState(outState: Bundle) {
// Run the default commands.
- super.onSaveInstanceState(savedInstanceState)
+ super.onSaveInstanceState(outState)
// Store the scroll Y position in the bundle.
- savedInstanceState.putInt(SCROLL_Y, logcatWebView.scrollY)
+ outState.putInt(SCROLL_Y, logcatWebView.scrollY)
}
// The view parameter cannot be removed because it is called from the layout onClick.
private var ultraPrivacy: ArrayList<List<Array<String>>>? = null
private var waitingForProxy = false
- // Define the save webpage image activity result launcher. It must be defined before `onCreate()` is run or the app will crash.
+ // Define the browse file upload activity result launcher. It must be defined before `onCreate()` is run or the app will crash.
private val browseFileUploadActivityResultLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { activityResult ->
// Pass the file to the WebView.
fileChooserCallback.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(activityResult.resultCode, activityResult.data))
}
// Define the save URL activity result launcher. It must be defined before `onCreate()` is run or the app will crash.
- private val saveUrlActivityResultLauncher = registerForActivityResult<String, Uri>(ActivityResultContracts.CreateDocument("*/*")) { fileUri ->
+ private val saveUrlActivityResultLauncher = registerForActivityResult(ActivityResultContracts.CreateDocument("*/*")) { fileUri ->
// Only save the URL if the file URI is not null, which happens if the user exited the file picker by pressing back.
if (fileUri != null) {
// Instantiate the save URL coroutine.
}
// Define the save webpage archive activity result launcher. It must be defined before `onCreate()` is run or the app will crash.
- private val saveWebpageArchiveActivityResultLauncher = registerForActivityResult<String, Uri>(ActivityResultContracts.CreateDocument("multipart/related")) { fileUri ->
+ private val saveWebpageArchiveActivityResultLauncher = registerForActivityResult(ActivityResultContracts.CreateDocument("multipart/related")) { fileUri ->
// Only save the webpage archive if the file URI is not null, which happens if the user exited the file picker by pressing back.
if (fileUri != null) {
// Get a cursor from the content resolver.
}
// Define the save webpage image activity result launcher. It must be defined before `onCreate()` is run or the app will crash.
- private val saveWebpageImageActivityResultLauncher = registerForActivityResult<String, Uri>(ActivityResultContracts.CreateDocument("image/png")) { fileUri ->
+ private val saveWebpageImageActivityResultLauncher = registerForActivityResult(ActivityResultContracts.CreateDocument("image/png")) { fileUri ->
// Only save the webpage image if the file URI is not null, which happens if the user exited the file picker by pressing back.
if (fileUri != null) {
// Instantiate the save webpage image coroutine.
pendingDialogsArrayList.clear()
}
- public override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ public override fun onSaveInstanceState(outState: Bundle) {
// Run the default commands.
- super.onSaveInstanceState(savedInstanceState)
+ super.onSaveInstanceState(outState)
// Only save the instance state if the WebView state adapter is not null, which will be the case if the app is restarting to change the initial app theme.
if (webViewStateAdapter != null) {
val currentTabPosition = tabLayout.selectedTabPosition
// Store the saved states in the bundle.
- savedInstanceState.putBoolean(BOOKMARKS_DRAWER_PINNED, bookmarksDrawerPinned)
- savedInstanceState.putString(PROXY_MODE, proxyMode)
- savedInstanceState.putParcelableArrayList(SAVED_NESTED_SCROLL_WEBVIEW_STATE_ARRAY_LIST, savedNestedScrollWebViewStateArrayList)
- savedInstanceState.putParcelableArrayList(SAVED_STATE_ARRAY_LIST, savedStateArrayList)
- savedInstanceState.putInt(SAVED_TAB_POSITION, currentTabPosition)
+ outState.putBoolean(BOOKMARKS_DRAWER_PINNED, bookmarksDrawerPinned)
+ outState.putString(PROXY_MODE, proxyMode)
+ outState.putParcelableArrayList(SAVED_NESTED_SCROLL_WEBVIEW_STATE_ARRAY_LIST, savedNestedScrollWebViewStateArrayList)
+ outState.putParcelableArrayList(SAVED_STATE_ARRAY_LIST, savedStateArrayList)
+ outState.putInt(SAVED_TAB_POSITION, currentTabPosition)
}
}
// Store the file path callback.
fileChooserCallback = filePathCallback
- // Create an intent to open a chooser based on the file chooser parameters.
- val fileChooserIntent = fileChooserParams.createIntent()
-
- // Check to see if the file chooser intent resolves to an installed package.
- if (fileChooserIntent.resolveActivity(packageManager) != null) { // The file chooser intent is fine.
- // Launch the file chooser intent.
- browseFileUploadActivityResultLauncher.launch(fileChooserIntent)
- } else { // The file chooser intent will cause a crash.
- // Create a generic intent to open a chooser.
- val genericFileChooserIntent = Intent(Intent.ACTION_GET_CONTENT)
+ // Create a file chooser intent.
+ val fileChooserIntent = Intent(Intent.ACTION_GET_CONTENT)
- // Request an openable file.
- genericFileChooserIntent.addCategory(Intent.CATEGORY_OPENABLE)
+ // Request an openable file.
+ fileChooserIntent.addCategory(Intent.CATEGORY_OPENABLE)
- // Set the file type to everything.
- genericFileChooserIntent.type = "*/*"
+ // Set the file type to everything. The file chooser params cannot be used to create the intent because it only selects the first specified file type. See <https://redmine.stoutner.com/issues/1197>.
+ fileChooserIntent.type = "*/*"
- // Launch the generic file chooser intent.
- browseFileUploadActivityResultLauncher.launch(genericFileChooserIntent)
- }
+ // Launch the file chooser intent.
+ browseFileUploadActivityResultLauncher.launch(fileChooserIntent)
// Handle the event.
return true
/*
- * Copyright 2018-2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2018-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
}
}
- public override fun onSaveInstanceState(savedInstanceState: Bundle) {
+ public override fun onSaveInstanceState(outState: Bundle) {
// Run the default commands.
- super.onSaveInstanceState(savedInstanceState)
+ super.onSaveInstanceState(outState)
// Get the listview position.
val listViewPosition = requestsListView.firstVisiblePosition
// Store the listview position in the bundle.
- savedInstanceState.putInt(LISTVIEW_POSITION, listViewPosition)
+ outState.putInt(LISTVIEW_POSITION, listViewPosition)
}
override fun onPrevious(currentId: Int) {
}
dependencies {
- classpath 'com.android.tools.build:gradle:8.3.2'
+ classpath 'com.android.tools.build:gradle:8.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20"
// NOTE: Do not place your application dependencies here; they belong
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip