private var domainsDatabaseHelper: DomainsDatabaseHelper? = null
private var downloadWithExternalApp = false
private var fullScreenBrowsingModeEnabled = false
- private var hideAppBar = false
+ private var hideAppBar = true
private var inFullScreenBrowsingMode = false
private var incognitoModeEnabled = false
private var loadingNewIntent = false
val allowScreenshots = sharedPreferences.getBoolean(getString(R.string.allow_screenshots_key), false)
bottomAppBar = sharedPreferences.getBoolean(getString(R.string.bottom_app_bar_key), false)
displayAdditionalAppBarIcons = sharedPreferences.getBoolean(getString(R.string.display_additional_app_bar_icons_key), false)
+ val displayUnderCutouts = sharedPreferences.getBoolean(getString(R.string.display_under_cutouts_key), false)
+
+ // Display under cutouts if specified. This must be done here as it doesn't appear to work correctly if handled after the app is fully initialized.
+ if (displayUnderCutouts) {
+ if (Build.VERSION.SDK_INT >= 30)
+ window.attributes.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
+ else if (Build.VERSION.SDK_INT >= 28)
+ window.attributes.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
+ }
// Get the theme entry values string array.
val appThemeEntryValuesStringArray = resources.getStringArray(R.array.app_theme_entry_values)
// Scroll to the new tab position if moving to the new tab.
if (moveToTab)
- tabLayout.post { tabLayout.setScrollPosition(newTabPosition, 0F, false, false) }
+ tabLayout.post {
+ tabLayout.setScrollPosition(newTabPosition, 0F, false, false)
+ }
// Show the app bar if it is at the bottom of the screen and the new tab is taking focus.
if (bottomAppBar && moveToTab && appBarLayout.translationY != 0f) {
val databaseId = bookmarksListView.getItemIdAtPosition(i).toInt()
// Move the bookmark down one slot.
- bookmarksDatabaseHelper!!.updateDisplayOrder(databaseId, i + 1)
+ bookmarksDatabaseHelper!!.updateDisplayOrder(databaseId, displayOrder = i + 1)
}
// Create the folder, which will be placed at the top of the list view.
- bookmarksDatabaseHelper!!.createFolder(folderNameString, currentBookmarksFolderId, folderIconByteArray)
+ bookmarksDatabaseHelper!!.createFolder(folderNameString, currentBookmarksFolderId, displayOrder = 0, folderIconByteArray)
// Update the bookmarks cursor with the current contents of this folder.
bookmarksCursor = bookmarksDatabaseHelper!!.getBookmarksByDisplayOrder(currentBookmarksFolderId)
// The deprecated command can be switched to `WindowInsetsController` once the minimum API >= 30.
@Suppress("DEPRECATION")
- rootFrameLayout.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or
- View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
+ rootFrameLayout.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
} else { // Switch to normal viewing mode.
// Show the app bar if it was hidden.
if (hideAppBar) {
// Request focus for the URL text box.
urlEditText.requestFocus()
- // Create a display keyboard handler.
- val displayKeyboardHandler = Handler(Looper.getMainLooper())
-
- // Create a display keyboard runnable.
- val displayKeyboardRunnable = Runnable {
- // Display the keyboard.
+ // Display the keyboard once the tab layout has settled.
+ tabLayout.post {
inputMethodManager.showSoftInput(urlEditText, 0)
}
-
- // Display the keyboard after 100 milliseconds, which leaves enough time for the tab to transition.
- displayKeyboardHandler.postDelayed(displayKeyboardRunnable, 100)
}
}
}
urlRelativeLayout.background = AppCompatResources.getDrawable(this, R.color.transparent)
}
} catch (exception: Exception) {
- // Try again in 100 milliseconds if the WebView has not yet been populated.
+ // Try again in 50 milliseconds if the WebView has not yet been populated.
// Create a handler to set the current WebView.
val setCurrentWebViewHandler = Handler(Looper.getMainLooper())