[Rich text editor] Fix code appearance (#8171)

Code does not use the correct theme colour when the theme is manually
selected in the app settings.

https://github.com/vector-im/verticals-internal/issues/23
This commit is contained in:
jonnyandrew 2023-02-27 09:24:56 +00:00 committed by GitHub
parent a6f7302350
commit 39d9591b26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 123 additions and 0 deletions

1
changelog.d/8171.bugfix Normal file
View file

@ -0,0 +1 @@
[Rich text editor] Fix code appearance

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2018 The Android Open Source Project
~ Modifications Copyright 2022 New Vector Ltd
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?vctr_system"/>
<stroke android:width="@dimen/code_block_border_width" android:color="?vctr_content_quinary"/>
<corners android:radius="@dimen/code_block_border_radius"/>
</shape>

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2018 The Android Open Source Project
~ Modifications Copyright 2022 New Vector Ltd
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?vctr_system"/>
<stroke android:width="@dimen/inline_code_border_width" android:color="?vctr_content_quinary"/>
<corners android:topLeftRadius="@dimen/inline_code_border_radius"
android:bottomLeftRadius="@dimen/inline_code_border_radius"/>
</shape>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2018 The Android Open Source Project
~ Modifications Copyright 2022 New Vector Ltd
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?vctr_system"/>
<stroke android:width="@dimen/inline_code_border_width" android:color="?vctr_content_quinary"/>
</shape>

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2018 The Android Open Source Project
~ Modifications Copyright 2022 New Vector Ltd
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?vctr_system"/>
<stroke android:width="@dimen/inline_code_border_width" android:color="?vctr_content_quinary"/>
<corners android:topRightRadius="@dimen/inline_code_border_radius"
android:bottomRightRadius="@dimen/inline_code_border_radius"/>
</shape>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2018 The Android Open Source Project
~ Modifications Copyright 2022 New Vector Ltd
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?vctr_system"/>
<stroke android:width="@dimen/inline_code_border_width" android:color="?vctr_content_quinary"/>
<corners android:radius="@dimen/inline_code_border_radius"/>
</shape>

View file

@ -126,6 +126,11 @@
app:layout_constraintTop_toBottomOf="@id/composerModeBarrier"
app:bulletRadius="4sp"
app:bulletGap="8sp"
app:codeBlockBackgroundDrawable="@drawable/bg_code_block"
app:inlineCodeSingleLineBg="@drawable/bg_inline_code_single_line"
app:inlineCodeMultiLineBgLeft="@drawable/bg_inline_code_multi_line_left"
app:inlineCodeMultiLineBgMid="@drawable/bg_inline_code_multi_line_mid"
app:inlineCodeMultiLineBgRight="@drawable/bg_inline_code_multi_line_right"
tools:text="@tools:sample/lorem/random" />
<com.google.android.material.textfield.TextInputEditText

View file

@ -8,4 +8,10 @@
android:layout_height="wrap_content"
android:textAlignment="viewStart"
android:textColor="?vctr_content_primary"
app:codeBlockBackgroundDrawable="@drawable/bg_code_block"
app:inlineCodeSingleLineBg="@drawable/bg_inline_code_single_line"
app:inlineCodeMultiLineBgLeft="@drawable/bg_inline_code_multi_line_left"
app:inlineCodeMultiLineBgMid="@drawable/bg_inline_code_multi_line_mid"
app:inlineCodeMultiLineBgRight="@drawable/bg_inline_code_multi_line_right"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:text="@sample/messages.json/data/message" />