Skip to content

Commit 000b9a2

Browse files
committed
Fix rich text editor code appearance
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
1 parent a6f7302 commit 000b9a2

8 files changed

+123
-0
lines changed

changelog.d/8171.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[Rich text editor] Fix code appearance
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ Copyright 2018 The Android Open Source Project
4+
~ Modifications Copyright 2022 New Vector Ltd
5+
~
6+
~ Licensed under the Apache License, Version 2.0 (the "License");
7+
~ you may not use this file except in compliance with the License.
8+
~ You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
<shape xmlns:android="http://schemas.android.com/apk/res/android">
19+
<solid android:color="?vctr_system"/>
20+
<stroke android:width="@dimen/code_block_border_width" android:color="?vctr_content_quinary"/>
21+
<corners android:radius="@dimen/code_block_border_radius"/>
22+
</shape>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ Copyright 2018 The Android Open Source Project
4+
~ Modifications Copyright 2022 New Vector Ltd
5+
~
6+
~ Licensed under the Apache License, Version 2.0 (the "License");
7+
~ you may not use this file except in compliance with the License.
8+
~ You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
<shape xmlns:android="http://schemas.android.com/apk/res/android">
19+
<solid android:color="?vctr_system"/>
20+
<stroke android:width="@dimen/inline_code_border_width" android:color="?vctr_content_quinary"/>
21+
<corners android:topLeftRadius="@dimen/inline_code_border_radius"
22+
android:bottomLeftRadius="@dimen/inline_code_border_radius"/>
23+
</shape>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ Copyright 2018 The Android Open Source Project
4+
~ Modifications Copyright 2022 New Vector Ltd
5+
~
6+
~ Licensed under the Apache License, Version 2.0 (the "License");
7+
~ you may not use this file except in compliance with the License.
8+
~ You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
<shape xmlns:android="http://schemas.android.com/apk/res/android">
19+
<solid android:color="?vctr_system"/>
20+
<stroke android:width="@dimen/inline_code_border_width" android:color="?vctr_content_quinary"/>
21+
</shape>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ Copyright 2018 The Android Open Source Project
4+
~ Modifications Copyright 2022 New Vector Ltd
5+
~
6+
~ Licensed under the Apache License, Version 2.0 (the "License");
7+
~ you may not use this file except in compliance with the License.
8+
~ You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
<shape xmlns:android="http://schemas.android.com/apk/res/android">
19+
<solid android:color="?vctr_system"/>
20+
<stroke android:width="@dimen/inline_code_border_width" android:color="?vctr_content_quinary"/>
21+
<corners android:topRightRadius="@dimen/inline_code_border_radius"
22+
android:bottomRightRadius="@dimen/inline_code_border_radius"/>
23+
</shape>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ Copyright 2018 The Android Open Source Project
4+
~ Modifications Copyright 2022 New Vector Ltd
5+
~
6+
~ Licensed under the Apache License, Version 2.0 (the "License");
7+
~ you may not use this file except in compliance with the License.
8+
~ You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
<shape xmlns:android="http://schemas.android.com/apk/res/android">
19+
<solid android:color="?vctr_system"/>
20+
<stroke android:width="@dimen/inline_code_border_width" android:color="?vctr_content_quinary"/>
21+
<corners android:radius="@dimen/inline_code_border_radius"/>
22+
</shape>

vector/src/main/res/layout/composer_rich_text_layout.xml

+5
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@
126126
app:layout_constraintTop_toBottomOf="@id/composerModeBarrier"
127127
app:bulletRadius="4sp"
128128
app:bulletGap="8sp"
129+
app:codeBlockBackgroundDrawable="@drawable/bg_code_block"
130+
app:inlineCodeSingleLineBg="@drawable/bg_inline_code_single_line"
131+
app:inlineCodeMultiLineBgLeft="@drawable/bg_inline_code_multi_line_left"
132+
app:inlineCodeMultiLineBgMid="@drawable/bg_inline_code_multi_line_mid"
133+
app:inlineCodeMultiLineBgRight="@drawable/bg_inline_code_multi_line_right"
129134
tools:text="@tools:sample/lorem/random" />
130135

131136
<com.google.android.material.textfield.TextInputEditText

vector/src/main/res/layout/item_timeline_event_text_message_rich_stub.xml

+6
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,10 @@
88
android:layout_height="wrap_content"
99
android:textAlignment="viewStart"
1010
android:textColor="?vctr_content_primary"
11+
app:codeBlockBackgroundDrawable="@drawable/bg_code_block"
12+
app:inlineCodeSingleLineBg="@drawable/bg_inline_code_single_line"
13+
app:inlineCodeMultiLineBgLeft="@drawable/bg_inline_code_multi_line_left"
14+
app:inlineCodeMultiLineBgMid="@drawable/bg_inline_code_multi_line_mid"
15+
app:inlineCodeMultiLineBgRight="@drawable/bg_inline_code_multi_line_right"
16+
xmlns:app="http://schemas.android.com/apk/res-auto"
1117
tools:text="@sample/messages.json/data/message" />

0 commit comments

Comments
 (0)