Kelt 7 years ago
parent
commit
c333451d2f

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/utils/ViewUtils.java View File

185
     }
185
     }
186
 
186
 
187
     public static ForegroundColorSpan[] getForegroundColorSpans(TextView view) {
187
     public static ForegroundColorSpan[] getForegroundColorSpans(TextView view) {
188
-        SpannedString text = (SpannedString) view.getText();
188
+        SpannedString text = new SpannedString(view.getText());
189
         return text.getSpans(0, text.length(), ForegroundColorSpan.class);
189
         return text.getSpans(0, text.length(), ForegroundColorSpan.class);
190
     }
190
     }
191
 
191
 

+ 10
- 2
android/app/src/main/java/com/reactnativenavigation/views/sharedElementTransition/AnimatorValuesResolver.java View File

1
 package com.reactnativenavigation.views.sharedElementTransition;
1
 package com.reactnativenavigation.views.sharedElementTransition;
2
 
2
 
3
 import android.graphics.Rect;
3
 import android.graphics.Rect;
4
+import android.text.style.ForegroundColorSpan;
4
 import android.widget.TextView;
5
 import android.widget.TextView;
5
 
6
 
6
 import com.facebook.drawee.drawable.ScalingUtils;
7
 import com.facebook.drawee.drawable.ScalingUtils;
119
 
120
 
120
     private void calculateColor(SharedElementTransition from, SharedElementTransition to) {
121
     private void calculateColor(SharedElementTransition from, SharedElementTransition to) {
121
         if (from.getSharedView() instanceof TextView && to.getSharedView() instanceof TextView) {
122
         if (from.getSharedView() instanceof TextView && to.getSharedView() instanceof TextView) {
122
-            startColor = ViewUtils.getForegroundColorSpans((TextView) from.getSharedView())[0].getForegroundColor();
123
-            endColor = ViewUtils.getForegroundColorSpans((TextView) to.getSharedView())[0].getForegroundColor();
123
+            ForegroundColorSpan[] startColorForegroundColorSpans = ViewUtils.getForegroundColorSpans((TextView) from.getSharedView());
124
+            if (startColorForegroundColorSpans.length > 0) {
125
+                startColor = startColorForegroundColorSpans[0].getForegroundColor();
126
+            }
127
+            ForegroundColorSpan[] endColorForegroundColorSpans = ViewUtils.getForegroundColorSpans((TextView) to.getSharedView());
128
+            if (endColorForegroundColorSpans.length > 0) {
129
+                endColor = endColorForegroundColorSpans[0].getForegroundColor();
130
+            }
124
         }
131
         }
125
     }
132
     }
133
+
126
     private void calculateDrawingReacts(SharedElementTransition from, SharedElementTransition to) {
134
     private void calculateDrawingReacts(SharedElementTransition from, SharedElementTransition to) {
127
         from.getDrawingRect(startDrawingRect);
135
         from.getDrawingRect(startDrawingRect);
128
         to.getDrawingRect(endDrawingRect);
136
         to.getDrawingRect(endDrawingRect);

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/views/sharedElementTransition/SharedElementTransition.java View File

80
             @Override
80
             @Override
81
             public void run() {
81
             public void run() {
82
                 if (spannableText == null) {
82
                 if (spannableText == null) {
83
-                    spannedText = (SpannedString) view.getText();
83
+                    spannedText = new SpannedString(view.getText());
84
                 }
84
                 }
85
                 if (spannableText == null) {
85
                 if (spannableText == null) {
86
                     spannableText = new SpannableString(spannedText);
86
                     spannableText = new SpannableString(spannedText);