Skip to content

Commit f850c6b

Browse files
committed
Removing context from spans.
1 parent f80fe81 commit f850c6b

File tree

6 files changed

+10
-14
lines changed

6 files changed

+10
-14
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class AztecTagHandler(val context: Context, val plugins: List<IAztecPlugin> = Ar
120120
return true
121121
}
122122
IMAGE -> {
123-
handleMediaElement(opening, output, AztecImageSpan(context, loadingDrawable, nestingLevel, AztecAttributes(attributes)))
123+
handleMediaElement(opening, output, AztecImageSpan(loadingDrawable, nestingLevel, AztecAttributes(attributes)))
124124
return true
125125
}
126126
VIDEO -> {
@@ -145,7 +145,7 @@ class AztecTagHandler(val context: Context, val plugins: List<IAztecPlugin> = Ar
145145
LINE -> {
146146
if (opening) {
147147
// Add an extra newline above the line to prevent weird typing on the line above
148-
start(output, AztecHorizontalRuleSpan(context, AppCompatResources.getDrawable(context, R.drawable.img_hr)!!,
148+
start(output, AztecHorizontalRuleSpan(AppCompatResources.getDrawable(context, R.drawable.img_hr)!!,
149149
nestingLevel, AztecAttributes(attributes)))
150150
output.append(Constants.MAGIC_CHAR)
151151
} else {

aztec/src/main/kotlin/org/wordpress/aztec/spans/AztecAudioSpan.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class AztecAudioSpan(context: Context, drawable: Drawable?, override var nesting
1212
var onAudioTappedListener: AztecText.OnAudioTappedListener? = null,
1313
onMediaDeletedListener: AztecText.OnMediaDeletedListener? = null,
1414
editor: AztecText? = null) :
15-
AztecMediaSpan(context, drawable, attributes, onMediaDeletedListener, editor), IAztecFullWidthImageSpan, IAztecSpan {
15+
AztecMediaSpan(drawable, attributes, onMediaDeletedListener, editor), IAztecFullWidthImageSpan, IAztecSpan {
1616
override val TAG: String = "audio"
1717

1818
init {

aztec/src/main/kotlin/org/wordpress/aztec/spans/AztecHorizontalRuleSpan.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
package org.wordpress.aztec.spans
22

3-
import android.content.Context
43
import android.graphics.drawable.Drawable
54
import org.wordpress.aztec.AztecAttributes
65
import org.wordpress.aztec.AztecText
76
import java.lang.ref.WeakReference
87

9-
class AztecHorizontalRuleSpan(context: Context, drawable: Drawable, override var nestingLevel: Int,
8+
class AztecHorizontalRuleSpan(drawable: Drawable, override var nestingLevel: Int,
109
override var attributes: AztecAttributes = AztecAttributes(), editor: AztecText? = null) :
11-
AztecDynamicImageSpan(context, drawable), IAztecFullWidthImageSpan, IAztecSpan {
10+
AztecDynamicImageSpan(drawable), IAztecFullWidthImageSpan, IAztecSpan {
1211
init {
1312
textView = WeakReference(editor)
1413
}

aztec/src/main/kotlin/org/wordpress/aztec/spans/AztecImageSpan.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
package org.wordpress.aztec.spans
22

3-
import android.content.Context
43
import android.graphics.drawable.Drawable
54
import org.wordpress.aztec.AztecAttributes
65
import org.wordpress.aztec.AztecText
76

8-
class AztecImageSpan(context: Context, drawable: Drawable?,
7+
class AztecImageSpan(drawable: Drawable?,
98
override var nestingLevel: Int,
109
attributes: AztecAttributes = AztecAttributes(),
1110
var onImageTappedListener: AztecText.OnImageTappedListener? = null,
1211
onMediaDeletedListener: AztecText.OnMediaDeletedListener? = null,
1312
editor: AztecText? = null) : IAztecFullWidthImageSpan,
14-
AztecMediaSpan(context, drawable, attributes, onMediaDeletedListener, editor) {
13+
AztecMediaSpan(drawable, attributes, onMediaDeletedListener, editor) {
1514
override val TAG: String = "img"
1615

1716
override fun onClick() {

aztec/src/main/kotlin/org/wordpress/aztec/spans/AztecMediaSpan.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.wordpress.aztec.spans
22

3-
import android.content.Context
43
import android.graphics.Canvas
54
import android.graphics.Paint
65
import android.graphics.Rect
@@ -11,9 +10,9 @@ import org.wordpress.aztec.AztecText
1110
import java.lang.ref.WeakReference
1211
import java.util.ArrayList
1312

14-
abstract class AztecMediaSpan(context: Context, drawable: Drawable?, override var attributes: AztecAttributes = AztecAttributes(),
13+
abstract class AztecMediaSpan(drawable: Drawable?, override var attributes: AztecAttributes = AztecAttributes(),
1514
var onMediaDeletedListener: AztecText.OnMediaDeletedListener? = null,
16-
editor: AztecText? = null) : AztecDynamicImageSpan(context, drawable), IAztecAttributedSpan {
15+
editor: AztecText? = null) : AztecDynamicImageSpan(drawable), IAztecAttributedSpan {
1716
abstract val TAG: String
1817

1918
private val overlays: ArrayList<Pair<Drawable?, Int>> = ArrayList()

media-placeholders/src/main/java/org/wordpress/aztec/placeholders/AztecPlaceholderSpan.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ import org.wordpress.aztec.spans.IAztecSpan
1111
import java.lang.ref.WeakReference
1212

1313
class AztecPlaceholderSpan(
14-
context: Context,
1514
drawable: Drawable?,
1615
override var nestingLevel: Int,
1716
attributes: AztecAttributes = AztecAttributes(),
1817
onMediaDeletedListener: AztecText.OnMediaDeletedListener? = null,
1918
editor: AztecText? = null,
2019
private val adapter: WeakReference<PlaceholderManager.PlaceholderAdapter>,
2120
override val TAG: String) :
22-
AztecMediaSpan(context, drawable, attributes, onMediaDeletedListener, editor), IAztecFullWidthImageSpan, IAztecSpan {
21+
AztecMediaSpan(drawable, attributes, onMediaDeletedListener, editor), IAztecFullWidthImageSpan, IAztecSpan {
2322
override fun onClick() {
2423

2524
}

0 commit comments

Comments
 (0)