ソースを参照

Minor code cleanup

Mostly leftover code related to shared element transition
Guy Carmeli 6 年 前
コミット
f9bdc786a8

+ 6
- 12
lib/android/app/src/main/java/com/reactnativenavigation/parse/ValueAnimationOptions.java ファイルの表示

@@ -41,14 +41,11 @@ public class ValueAnimationOptions {
41 41
     private Interpolation interpolation = Interpolation.NO_VALUE;
42 42
 
43 43
     Animator getAnimation(View view) {
44
-        if (!this.from.hasValue() || !this.to.hasValue())
45
-            throw new IllegalArgumentException("Params 'from' and 'to' are mandatory");
46
-        ObjectAnimator animator = ObjectAnimator.ofFloat(view, animProp, this.from.get(), this.to.get());
47
-        animator.setInterpolator(this.interpolation.getInterpolator());
48
-        if (this.duration.hasValue())
49
-            animator.setDuration(this.duration.get());
50
-        if (this.startDelay.hasValue())
51
-            animator.setStartDelay(this.startDelay.get());
44
+        if (!from.hasValue() || !to.hasValue()) throw new IllegalArgumentException("Params 'from' and 'to' are mandatory");
45
+        ObjectAnimator animator = ObjectAnimator.ofFloat(view, animProp, from.get(), to.get());
46
+        animator.setInterpolator(interpolation.getInterpolator());
47
+        if (duration.hasValue()) animator.setDuration(duration.get());
48
+        if (startDelay.hasValue()) animator.setStartDelay(startDelay.get());
52 49
         return animator;
53 50
     }
54 51
 
@@ -56,10 +53,7 @@ public class ValueAnimationOptions {
56 53
     public boolean equals(Object o) {
57 54
         if (this == o) return true;
58 55
         if (o == null || getClass() != o.getClass()) return false;
59
-
60
-        ValueAnimationOptions options = (ValueAnimationOptions) o;
61
-
62
-        return animProp.equals(options.animProp);
56
+        return animProp.equals(((ValueAnimationOptions) o).animProp);
63 57
     }
64 58
 
65 59
     @Override

+ 0
- 12
lib/android/app/src/main/java/com/reactnativenavigation/utils/TextViewUtils.java ファイルの表示

@@ -7,11 +7,8 @@ import android.text.Spanned;
7 7
 import android.text.SpannedString;
8 8
 import android.text.style.AbsoluteSizeSpan;
9 9
 import android.text.style.ForegroundColorSpan;
10
-import android.util.Log;
11 10
 import android.widget.TextView;
12 11
 
13
-import com.reactnativenavigation.views.element.animators.AntiRelativeSizeSpan;
14
-
15 12
 public class TextViewUtils {
16 13
     @ColorInt
17 14
     public static int getTextColor(TextView view) {
@@ -29,13 +26,4 @@ public class TextViewUtils {
29 26
     public static void setColor(SpannableString span, int color) {
30 27
         span.setSpan(new ForegroundColorSpan(color), 0, span.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
31 28
     }
32
-
33
-    public static void setRelativeTextSize(SpannableString span, float scale) {
34
-        Log.i("TextViewUtils", "setRelativeTextSize: " + scale + " - " + span);
35
-        span.setSpan(new AntiRelativeSizeSpan(scale), 0, span.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
36
-    }
37
-
38
-    public static void setAbsoluteTextSize(SpannableString span, float size) {
39
-        span.setSpan(new AbsoluteSizeSpan((int) size), 0, span.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
40
-    }
41 29
 }

+ 0
- 15
lib/android/app/src/main/java/com/reactnativenavigation/views/element/Element.java ファイルの表示

@@ -7,7 +7,6 @@ import android.support.annotation.NonNull;
7 7
 import android.support.annotation.Nullable;
8 8
 import android.text.SpannableString;
9 9
 import android.text.SpannedString;
10
-import android.util.Log;
11 10
 import android.view.View;
12 11
 import android.widget.FrameLayout;
13 12
 import android.widget.TextView;
@@ -83,18 +82,4 @@ public class Element extends FrameLayout {
83 82
             ((TextView) getChild()).setText(spannableText);
84 83
         }
85 84
     }
86
-
87
-    @Keep
88
-    public void setTextSize(float size) {
89
-        if (spannableText != null) {
90
-            Log.d("Element", "setTextSize: " + size);
91
-//            ((ReactTextView) getChild()).setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
92
-
93
-//            ((ReactTextView) getChild()).updateView();
94
-//            TextViewUtils.setAbsoluteTextSize(spannableText, size);
95
-            TextViewUtils.setRelativeTextSize(spannableText, size);
96
-            ((TextView) getChild()).setText(spannableText);
97
-//            getChild().invalidate();
98
-        }
99
-    }
100 85
 }

+ 0
- 29
lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/AntiRelativeSizeSpan.java ファイルの表示

@@ -1,29 +0,0 @@
1
-package com.reactnativenavigation.views.element.animators;
2
-
3
-import android.text.TextPaint;
4
-import android.text.style.MetricAffectingSpan;
5
-import android.util.Log;
6
-
7
-public class AntiRelativeSizeSpan extends MetricAffectingSpan {
8
-    private final float size;
9
-
10
-    public AntiRelativeSizeSpan(float size) {
11
-        this.size = size;
12
-    }
13
-
14
-    @Override
15
-    public void updateDrawState(TextPaint ds) {
16
-        updateAnyState(ds);
17
-    }
18
-
19
-    @Override
20
-    public void updateMeasureState(TextPaint ds) {
21
-        updateAnyState(ds);
22
-    }
23
-
24
-    private void updateAnyState(TextPaint ds) {
25
-        Log.i("AntiRelativeSizeSpan", "updateAnyState: " + size + "|" + ds.density);
26
-        ds.setTextSize(size);
27
-    }
28
-}
29
-