Skip to content

Commit 6c8e3ee

Browse files
authored
Merge branch 'develop' into issue/181-update-placeholder-images
2 parents 6bc6290 + 7e3790f commit 6c8e3ee

File tree

8 files changed

+22
-52
lines changed

8 files changed

+22
-52
lines changed

app/src/main/res/layout/activity_main.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
android:paddingTop="16dp"
3737
android:scrollbars="vertical"
3838
android:imeOptions="flagNoExtractUi"
39+
android:fontFamily="serif"
3940
aztec:historyEnable="true"
4041
aztec:historySize="10"/>
4142

@@ -55,6 +56,7 @@
5556
android:textSize="14sp"
5657
android:visibility="gone"
5758
android:imeOptions="flagNoExtractUi"
59+
android:fontFamily="monospace"
5860
aztec:codeBackgroundColor="@android:color/transparent"
5961
aztec:codeTextColor="@android:color/white"/>
6062

-333 KB
Binary file not shown.
-45.5 KB
Binary file not shown.

aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ import org.wordpress.aztec.source.Format
4848
import org.wordpress.aztec.source.SourceViewEditText
4949
import org.wordpress.aztec.spans.*
5050
import org.wordpress.aztec.toolbar.AztecToolbar
51-
import org.wordpress.aztec.util.TypefaceCache
5251
import org.xml.sax.Attributes
5352
import java.util.*
5453

@@ -140,7 +139,6 @@ class AztecText : EditText, TextWatcher, UnknownHtmlSpan.OnUnknownHtmlClickListe
140139

141140
private fun init(attrs: AttributeSet?) {
142141
TypefaceCache.setCustomTypeface(context, this, TypefaceCache.TYPEFACE_MERRIWEATHER_REGULAR)
143-
144142
val styles = context.obtainStyledAttributes(attrs, R.styleable.AztecText, 0, R.style.AztecTextStyle)
145143
setLineSpacing(
146144
styles.getDimension(

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import org.wordpress.aztec.AztecText
1717
import org.wordpress.aztec.History
1818
import org.wordpress.aztec.R
1919
import org.wordpress.aztec.spans.AztecCursorSpan
20-
import org.wordpress.aztec.util.TypefaceCache
2120

2221
class SourceViewEditText : EditText, TextWatcher {
2322

@@ -47,9 +46,6 @@ class SourceViewEditText : EditText, TextWatcher {
4746
}
4847

4948
private fun init(attrs: AttributeSet?) {
50-
51-
TypefaceCache.setCustomTypeface(context, this, TypefaceCache.TYPEFACE_DEJAVU_SANS_MONO)
52-
5349
val values = context.obtainStyledAttributes(attrs, R.styleable.SourceViewEditText)
5450
if (values.hasValue(R.styleable.SourceViewEditText_codeBackgroundColor)) {
5551
setBackgroundColor(values.getColor(R.styleable.SourceViewEditText_codeBackgroundColor, ContextCompat.getColor(context, R.color.background)))
@@ -263,4 +259,4 @@ class SourceViewEditText : EditText, TextWatcher {
263259
}
264260
return super.onKeyPreIme(keyCode, event)
265261
}
266-
}
262+
}

aztec/src/main/kotlin/org/wordpress/aztec/toolbar/AztecToolbar.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class AztecToolbar : FrameLayout, OnMenuItemClickListener {
2626
private var headingMenu: PopupMenu? = null
2727
private var sourceEditor: SourceViewEditText? = null
2828
private var dialogShortcuts: AlertDialog? = null
29+
private var isMediaModeEnabled: Boolean = false;
2930

3031
constructor(context: Context) : super(context) {
3132
initView()
@@ -228,13 +229,15 @@ class AztecToolbar : FrameLayout, OnMenuItemClickListener {
228229
super.onRestoreInstanceState(savedState.superState)
229230
val restoredState = savedState.state
230231
toggleHtmlMode(restoredState.getBoolean("isSourceVisible"))
232+
enableMediaMode(restoredState.getBoolean("isMediaMode"))
231233
}
232234

233235
override fun onSaveInstanceState(): Parcelable {
234236
val superState = super.onSaveInstanceState()
235237
val savedState = SourceViewEditText.SavedState(superState)
236238
val bundle = Bundle()
237239
bundle.putBoolean("isSourceVisible", sourceEditor?.visibility == View.VISIBLE)
240+
bundle.putBoolean("isMediaMode", isMediaModeEnabled)
238241
savedState.state = bundle
239242
return savedState
240243
}
@@ -408,6 +411,21 @@ class AztecToolbar : FrameLayout, OnMenuItemClickListener {
408411
}
409412
}
410413

414+
fun isMediaModeEnabled(): Boolean {
415+
return isMediaModeEnabled;
416+
}
417+
418+
fun enableMediaMode(isEnabled: Boolean) {
419+
isMediaModeEnabled = isEnabled;
420+
ToolbarAction.values().forEach { action ->
421+
if (action == ToolbarAction.ADD_MEDIA) {
422+
toggleButton(findViewById(action.buttonId), isEnabled)
423+
} else {
424+
toggleButtonState(findViewById(action.buttonId), !isEnabled)
425+
}
426+
}
427+
}
428+
411429
private fun showDialogShortcuts() {
412430
val layout = LayoutInflater.from(context).inflate(R.layout.dialog_shortcuts, null)
413431
val builder = AlertDialog.Builder(context)

aztec/src/main/kotlin/org/wordpress/aztec/util/TypefaceCache.kt

Lines changed: 0 additions & 45 deletions
This file was deleted.

aztec/src/main/res/drawable/format_bar_button_media_selector.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
xmlns:android="http://schemas.android.com/apk/res/android" >
55

66
<item android:drawable="@drawable/format_bar_button_media_disabled" android:state_enabled="false" />
7+
<item android:drawable="@drawable/format_bar_button_media_highlighted" android:state_checked="true" />
78
<item android:drawable="@drawable/format_bar_button_media_highlighted" android:state_pressed="true" />
89
<item android:drawable="@drawable/format_bar_button_media_highlighted" android:state_focused="true" />
910
<item android:drawable="@drawable/format_bar_button_media" />

0 commit comments

Comments
 (0)