mirror of
https://github.com/element-hq/element-android
synced 2024-09-06 08:55:23 +00:00
[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:
parent
a6f7302350
commit
39d9591b26
1
changelog.d/8171.bugfix
Normal file
1
changelog.d/8171.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
[Rich text editor] Fix code appearance
|
22
vector/src/main/res/drawable/bg_code_block.xml
Normal file
22
vector/src/main/res/drawable/bg_code_block.xml
Normal 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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
22
vector/src/main/res/drawable/bg_inline_code_single_line.xml
Normal file
22
vector/src/main/res/drawable/bg_inline_code_single_line.xml
Normal 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>
|
|
@ -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
|
||||
|
|
|
@ -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" />
|
||||
|
|
Loading…
Reference in a new issue