|
30 | 30 | import android.os.Bundle;
|
31 | 31 | import android.text.TextUtils;
|
32 | 32 | import android.text.TextWatcher;
|
| 33 | +import android.text.method.MovementMethod; |
33 | 34 | import android.view.Menu;
|
34 | 35 | import android.view.View;
|
35 | 36 | import android.view.Window;
|
@@ -1634,7 +1635,9 @@ public static <T> void setShowDividersNoInspection(@Nullable T view, int showDiv
|
1634 | 1635 | ((LinearLayoutCompat) view).setShowDividers(showDividers);
|
1635 | 1636 | }
|
1636 | 1637 | } else if (view instanceof Menu) {
|
| 1638 | + if (DynamicSdkUtils.is28()) { |
1637 | 1639 | ((Menu) view).setGroupDividerEnabled(true);
|
| 1640 | + } |
1638 | 1641 | }
|
1639 | 1642 | }
|
1640 | 1643 |
|
@@ -2035,21 +2038,38 @@ public static void set(@Nullable RatingBar ratingBar, float rating) {
|
2035 | 2038 | *
|
2036 | 2039 | * @param textView The text view to set the text.
|
2037 | 2040 | * @param text The text to be set.
|
| 2041 | + * @param movement The optional movement method to be set. |
2038 | 2042 | */
|
2039 |
| - public static void setHtml(@Nullable TextView textView, @Nullable CharSequence text) { |
| 2043 | + public static void setHtml(@Nullable TextView textView, |
| 2044 | + @Nullable CharSequence text, @Nullable MovementMethod movement) { |
2040 | 2045 | if (textView == null) {
|
2041 | 2046 | return;
|
2042 | 2047 | }
|
2043 | 2048 |
|
2044 | 2049 | if (text != null && !TextUtils.isEmpty(text)) {
|
2045 | 2050 | textView.setText(HtmlCompat.fromHtml(text.toString(),
|
2046 | 2051 | HtmlCompat.FROM_HTML_MODE_COMPACT));
|
| 2052 | + if (movement != null) { |
| 2053 | + textView.setMovementMethod(movement); |
| 2054 | + } |
2047 | 2055 | textView.setVisibility(View.VISIBLE);
|
2048 | 2056 | } else {
|
2049 | 2057 | textView.setVisibility(View.GONE);
|
2050 | 2058 | }
|
2051 | 2059 | }
|
2052 | 2060 |
|
| 2061 | + /** |
| 2062 | + * Set {@code HTML} text for the text view and manage its visibility according to the data. |
| 2063 | + * |
| 2064 | + * @param textView The text view to set the text. |
| 2065 | + * @param text The text to be set. |
| 2066 | + * |
| 2067 | + * @see #setHtml(TextView, CharSequence, MovementMethod) |
| 2068 | + */ |
| 2069 | + public static void setHtml(@Nullable TextView textView, @Nullable CharSequence text) { |
| 2070 | + setHtml(textView, text, null); |
| 2071 | + } |
| 2072 | + |
2053 | 2073 | /**
|
2054 | 2074 | * Set drawable for the image view and manage its visibility according to the data.
|
2055 | 2075 | *
|
|
0 commit comments