Merge pull request #12591 from nextcloud/bugfix/fix-toolbar-crash

Fix MaterialToolbar Crash
This commit is contained in:
Andy Scherzinger 2024-03-18 17:13:27 +01:00 committed by GitHub
commit 36773eeac0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 64 additions and 23 deletions

View file

@ -35,6 +35,7 @@ import android.graphics.drawable.Drawable
import android.media.MediaMetadataRetriever
import android.net.Uri
import android.os.AsyncTask
import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.os.Looper
@ -143,6 +144,11 @@ class PreviewMediaActivity :
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.O) {
setTheme(R.style.Theme_ownCloud_Toolbar)
}
binding = ActivityPreviewMediaBinding.inflate(layoutInflater)
setContentView(binding.root)

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Nextcloud Android client application
@author Alper Ozturk
Copyright (C) 2024 Alper Ozturk
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<style name="BaseTheme.ownCloud.Toolbar" parent="Theme.Material3.Dark">
<item name="alertDialogTheme">@style/ownCloud.AlertDialog</item>
<item name="android:alertDialogTheme">@style/Theme.ownCloud.Dialog</item>
<item name="android:colorBackground">@color/bg_default</item>
<item name="android:windowBackground">@color/bg_default</item>
<item name="colorAccent">@color/color_accent</item>
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary</item>
<item name="searchViewStyle">@style/ownCloud.SearchView</item>
<item name="windowActionBar">false</item>
<item name="windowActionModeOverlay">true</item>
<item name="windowNoTitle">true</item>
<item name="textInputStyle">@style/Widget.App.TextInputLayout</item>
<item name="popupMenuStyle">@style/Nextcloud.Widget.PopupMenu</item>
<item name="bottomSheetDialogTheme">@style/ThemeOverlay.App.BottomSheetDialog</item>
<item name="actionModeStyle">@style/App.ActionMode</item>
</style>
</resources>

View file

@ -23,10 +23,6 @@
<item name="android:windowLightNavigationBar">true</item>
</style>
<style name="Theme.ownCloud.Toolbar" parent="Theme.ownCloud.ToolbarBase">
<item name="android:windowLightNavigationBar">true</item>
</style>
<style name="Theme.ownCloud" parent="BaseTheme.ownCloud">
<item name="android:windowLightNavigationBar">true</item>
</style>

View file

@ -106,25 +106,6 @@
<item name="android:textColor">@color/text_color</item>
</style>
<!-- separate action bar style for activities without an action bar -->
<style name="BaseTheme.ownCloud.Toolbar" parent="Theme.Material3.DayNight.NoActionBar">
<item name="alertDialogTheme">@style/ownCloud.AlertDialog</item>
<item name="android:alertDialogTheme">@style/Theme.ownCloud.Dialog</item>
<item name="android:colorBackground">@color/bg_default</item>
<item name="android:windowBackground">@color/bg_default</item>
<item name="colorAccent">@color/color_accent</item>
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary</item>
<item name="searchViewStyle">@style/ownCloud.SearchView</item>
<item name="windowActionBar">false</item>
<item name="windowActionModeOverlay">true</item>
<item name="windowNoTitle">true</item>
<item name="textInputStyle">@style/Widget.App.TextInputLayout</item>
<item name="popupMenuStyle">@style/Nextcloud.Widget.PopupMenu</item>
<item name="bottomSheetDialogTheme">@style/ThemeOverlay.App.BottomSheetDialog</item>
<item name="actionModeStyle">@style/App.ActionMode</item>
</style>
<style name="Theme.ownCloud.ToolbarBase" parent="BaseTheme.ownCloud.Toolbar">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:navigationBarColor">@color/bg_default</item>

View file

@ -22,6 +22,24 @@
<resources>
<style name="BaseTheme.ownCloud.Toolbar" parent="Theme.Material3.Light">
<item name="alertDialogTheme">@style/ownCloud.AlertDialog</item>
<item name="android:alertDialogTheme">@style/Theme.ownCloud.Dialog</item>
<item name="android:colorBackground">@color/bg_default</item>
<item name="android:windowBackground">@color/bg_default</item>
<item name="colorAccent">@color/color_accent</item>
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary</item>
<item name="searchViewStyle">@style/ownCloud.SearchView</item>
<item name="windowActionBar">false</item>
<item name="windowActionModeOverlay">true</item>
<item name="windowNoTitle">true</item>
<item name="textInputStyle">@style/Widget.App.TextInputLayout</item>
<item name="popupMenuStyle">@style/Nextcloud.Widget.PopupMenu</item>
<item name="bottomSheetDialogTheme">@style/ThemeOverlay.App.BottomSheetDialog</item>
<item name="actionModeStyle">@style/App.ActionMode</item>
</style>
<style name="Theme.ownCloud.Toolbar.AppWidgetContainerParent" parent="@android:style/Theme.DeviceDefault">
<!-- Radius of the outer bound of widgets to make the rounded corners -->
<item name="appWidgetRadius">16dp</item>