Skip to content

Commit 24a53f0

Browse files
committed
Add code dialog attribute to use app style
1 parent 7e3790f commit 24a53f0

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/source/SourceViewEditText.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@ class SourceViewEditText : EditText, TextWatcher {
4747

4848
private fun init(attrs: AttributeSet?) {
4949
val values = context.obtainStyledAttributes(attrs, R.styleable.SourceViewEditText)
50-
if (values.hasValue(R.styleable.SourceViewEditText_codeBackgroundColor)) {
51-
setBackgroundColor(values.getColor(R.styleable.SourceViewEditText_codeBackgroundColor, ContextCompat.getColor(context, R.color.background)))
50+
51+
setBackgroundColor(values.getColor(R.styleable.SourceViewEditText_codeBackgroundColor, ContextCompat.getColor(context, android.R.color.transparent)))
52+
53+
if (!values.hasValue(R.styleable.SourceViewEditText_codeDialog)) {
54+
setTextColor(values.getColor(R.styleable.SourceViewEditText_codeTextColor, android.R.attr.textColorPrimary))
5255
}
53-
setTextColor(values.getColor(R.styleable.SourceViewEditText_codeTextColor, ContextCompat.getColor(context, R.color.text)))
5456

5557
tagColor = values.getColor(R.styleable.SourceViewEditText_tagColor, tagColor)
5658
attributeColor = values.getColor(R.styleable.SourceViewEditText_attributeColor, attributeColor)

aztec/src/main/res/layout/dialog_block_editor.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
android:layout_marginTop="24dp"
2222
android:padding="16dp"
2323
android:scrollbars="vertical"
24-
android:background="@drawable/background_block_editor"
2524
android:scrollbarStyle="outsideOverlay"
2625
android:textSize="14sp"
2726
android:imeOptions="flagNoExtractUi"
28-
aztec:codeTextColor="@android:color/white"/>
27+
aztec:codeDialog="true" >
28+
</org.wordpress.aztec.source.SourceViewEditText>
2929

3030
<!--</ScrollView>-->

aztec/src/main/res/values/attrs.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<declare-styleable name="SourceViewEditText">
3232
<attr name="attributeColor" format="reference|color" />
3333
<attr name="codeBackgroundColor" format="reference|color" />
34+
<attr name="codeDialog" format="reference|boolean" />
3435
<attr name="codeTextColor" format="reference|color" />
3536
<attr name="tagColor" format="reference|color" />
3637
</declare-styleable>

0 commit comments

Comments
 (0)