Skip to content

Commit b2af281

Browse files
authored
Merge pull request #282 from wordpress-mobile/issue/source-dialog-style
Issue/source dialog style
2 parents dc5f7ec + d43c9b9 commit b2af281

File tree

4 files changed

+21
-23
lines changed

4 files changed

+21
-23
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) && values.getBoolean(R.styleable.SourceViewEditText_codeDialog, false)) {
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)
Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<!--<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"-->
3-
<!--xmlns:aztec="http://schemas.android.com/apk/res-auto"-->
4-
<!--android:orientation="vertical"-->
5-
<!--android:layout_width="match_parent"-->
6-
<!--android:layout_height="match_parent"-->
7-
<!--android:fillViewport="true">-->
2+
3+
<ScrollView
4+
xmlns:android="http://schemas.android.com/apk/res/android"
5+
android:layout_height="match_parent"
6+
android:layout_width="match_parent" >
87

98
<org.wordpress.aztec.source.SourceViewEditText
10-
xmlns:android="http://schemas.android.com/apk/res/android"
119
xmlns:aztec="http://schemas.android.com/apk/res-auto"
1210
android:id="@+id/source"
13-
android:layout_width="match_parent"
14-
android:layout_height="wrap_content"
1511
android:gravity="top|start"
12+
android:imeOptions="flagNoExtractUi"
1613
android:inputType="textNoSuggestions|textMultiLine"
17-
android:layout_marginLeft="24dp"
18-
android:layout_marginRight="24dp"
19-
android:layout_marginStart="24dp"
20-
android:layout_marginEnd="24dp"
21-
android:layout_marginTop="24dp"
22-
android:padding="16dp"
14+
android:layout_height="wrap_content"
15+
android:layout_width="match_parent"
16+
android:padding="@dimen/margin_large"
2317
android:scrollbars="vertical"
24-
android:background="@drawable/background_block_editor"
2518
android:scrollbarStyle="outsideOverlay"
26-
android:textSize="14sp"
27-
android:imeOptions="flagNoExtractUi"
28-
aztec:codeTextColor="@android:color/white"/>
19+
android:textSize="@dimen/text_dialog"
20+
aztec:codeDialog="true" >
21+
</org.wordpress.aztec.source.SourceViewEditText>
2922

30-
<!--</ScrollView>-->
23+
</ScrollView>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<declare-styleable name="SourceViewEditText">
3434
<attr name="attributeColor" format="reference|color" />
3535
<attr name="codeBackgroundColor" format="reference|color" />
36+
<attr name="codeDialog" format="reference|boolean" />
3637
<attr name="codeTextColor" format="reference|color" />
3738
<attr name="tagColor" format="reference|color" />
3839
</declare-styleable>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,6 @@
4646
<dimen name="margin_large">12dp</dimen>
4747
<dimen name="margin_extra_large">16dp</dimen>
4848

49+
<dimen name="text_dialog">14sp</dimen>
50+
4951
</resources>

0 commit comments

Comments
 (0)