Update changelog
This commit is contained in:
parent
b48b0889da
commit
0ae3a3d66e
@ -5,10 +5,12 @@
|
|||||||
* module `images`: `GifSupport` and `SvgSupport` use `Class.forName` instead access to full qualified class name
|
* module `images`: `GifSupport` and `SvgSupport` use `Class.forName` instead access to full qualified class name
|
||||||
* `ext-table`: fix links in tables ([#224])
|
* `ext-table`: fix links in tables ([#224])
|
||||||
* `ext-table`: proper borders (equal for all sides)
|
* `ext-table`: proper borders (equal for all sides)
|
||||||
|
* module `core`: Add `PrecomputedFutureTextSetterCompat`<br>Thanks [@KirkBushman]
|
||||||
|
|
||||||
[#216]: https://github.com/noties/Markwon/pull/216
|
[#216]: https://github.com/noties/Markwon/pull/216
|
||||||
[#224]: https://github.com/noties/Markwon/issues/224
|
[#224]: https://github.com/noties/Markwon/issues/224
|
||||||
[@francescocervone]: https://github.com/francescocervone
|
[@francescocervone]: https://github.com/francescocervone
|
||||||
|
[@KirkBushman]: https://github.com/KirkBushman
|
||||||
|
|
||||||
|
|
||||||
# 4.3.0
|
# 4.3.0
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package io.noties.markwon;
|
package io.noties.markwon;
|
||||||
|
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.util.Log;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -10,12 +9,14 @@ import androidx.appcompat.widget.AppCompatTextView;
|
|||||||
import androidx.core.text.PrecomputedTextCompat;
|
import androidx.core.text.PrecomputedTextCompat;
|
||||||
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Please note this class requires `androidx.core:core` artifact being explicitly added to your dependencies.
|
* Please note this class requires `androidx.core:core` artifact being explicitly added to your dependencies.
|
||||||
* This is intended to be used in a RecyclerView.
|
* This is intended to be used in a RecyclerView.
|
||||||
*
|
*
|
||||||
* @see io.noties.markwon.Markwon.TextSetter
|
* @see io.noties.markwon.Markwon.TextSetter
|
||||||
|
* @since $nap;
|
||||||
*/
|
*/
|
||||||
public class PrecomputedFutureTextSetterCompat implements Markwon.TextSetter {
|
public class PrecomputedFutureTextSetterCompat implements Markwon.TextSetter {
|
||||||
|
|
||||||
@ -47,16 +48,18 @@ public class PrecomputedFutureTextSetterCompat implements Markwon.TextSetter {
|
|||||||
@NonNull Spanned markdown,
|
@NonNull Spanned markdown,
|
||||||
@NonNull TextView.BufferType bufferType,
|
@NonNull TextView.BufferType bufferType,
|
||||||
@NonNull Runnable onComplete) {
|
@NonNull Runnable onComplete) {
|
||||||
|
|
||||||
if (textView instanceof AppCompatTextView) {
|
if (textView instanceof AppCompatTextView) {
|
||||||
((AppCompatTextView) textView).setTextFuture(PrecomputedTextCompat.getTextFuture(
|
final AppCompatTextView appCompatTextView = (AppCompatTextView) textView;
|
||||||
markdown, ((AppCompatTextView) textView).getTextMetricsParamsCompat(), executor
|
final Future<PrecomputedTextCompat> future = PrecomputedTextCompat.getTextFuture(
|
||||||
));
|
markdown,
|
||||||
|
appCompatTextView.getTextMetricsParamsCompat(),
|
||||||
|
executor);
|
||||||
|
appCompatTextView.setTextFuture(future);
|
||||||
|
// `setTextFuture` is actually a synchronous call, so we should call onComplete now
|
||||||
onComplete.run();
|
onComplete.run();
|
||||||
} else {
|
} else {
|
||||||
|
throw new IllegalStateException("TextView provided is not an instance of AppCompatTextView, " +
|
||||||
throw new IllegalStateException("TextView provided is not a child of AppCompatTextView, cannot call setTextFuture().");
|
"cannot call setTextFuture(), textView: " + textView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user