Browse Source

Rename NavigationIconResolver to IconResolver

New class name is 54% shorter, thus better.
Guy Carmeli 4 years ago
parent
commit
18be994e3f

+ 2
- 2
lib/android/app/src/main/java/com/reactnativenavigation/parse/LayoutFactory.java View File

20
 import com.reactnativenavigation.viewcontrollers.ViewController;
20
 import com.reactnativenavigation.viewcontrollers.ViewController;
21
 import com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsAttacher;
21
 import com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsAttacher;
22
 import com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController;
22
 import com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController;
23
-import com.reactnativenavigation.viewcontrollers.button.NavigationIconResolver;
23
+import com.reactnativenavigation.viewcontrollers.button.IconResolver;
24
 import com.reactnativenavigation.viewcontrollers.externalcomponent.ExternalComponentCreator;
24
 import com.reactnativenavigation.viewcontrollers.externalcomponent.ExternalComponentCreator;
25
 import com.reactnativenavigation.viewcontrollers.externalcomponent.ExternalComponentViewController;
25
 import com.reactnativenavigation.viewcontrollers.externalcomponent.ExternalComponentViewController;
26
 import com.reactnativenavigation.viewcontrollers.sidemenu.SideMenuController;
26
 import com.reactnativenavigation.viewcontrollers.sidemenu.SideMenuController;
187
                         new TitleBarReactViewCreator(reactInstanceManager),
187
                         new TitleBarReactViewCreator(reactInstanceManager),
188
                         new TopBarBackgroundViewCreator(reactInstanceManager),
188
                         new TopBarBackgroundViewCreator(reactInstanceManager),
189
                         new TitleBarButtonCreator(reactInstanceManager),
189
                         new TitleBarButtonCreator(reactInstanceManager),
190
-                        new NavigationIconResolver(activity, new ImageLoader()),
190
+                        new IconResolver(activity, new ImageLoader()),
191
                         new RenderChecker(),
191
                         new RenderChecker(),
192
                         defaultOptions
192
                         defaultOptions
193
                 ))
193
                 ))

+ 3
- 3
lib/android/app/src/main/java/com/reactnativenavigation/presentation/StackPresenter.java View File

29
 import com.reactnativenavigation.viewcontrollers.TitleBarButtonController;
29
 import com.reactnativenavigation.viewcontrollers.TitleBarButtonController;
30
 import com.reactnativenavigation.viewcontrollers.TitleBarReactViewController;
30
 import com.reactnativenavigation.viewcontrollers.TitleBarReactViewController;
31
 import com.reactnativenavigation.viewcontrollers.ViewController;
31
 import com.reactnativenavigation.viewcontrollers.ViewController;
32
-import com.reactnativenavigation.viewcontrollers.button.NavigationIconResolver;
32
+import com.reactnativenavigation.viewcontrollers.button.IconResolver;
33
 import com.reactnativenavigation.viewcontrollers.stack.StackController;
33
 import com.reactnativenavigation.viewcontrollers.stack.StackController;
34
 import com.reactnativenavigation.viewcontrollers.topbar.TopBarBackgroundViewController;
34
 import com.reactnativenavigation.viewcontrollers.topbar.TopBarBackgroundViewController;
35
 import com.reactnativenavigation.viewcontrollers.topbar.TopBarController;
35
 import com.reactnativenavigation.viewcontrollers.topbar.TopBarController;
74
     private Map<View, TopBarBackgroundViewController> backgroundControllers = new HashMap();
74
     private Map<View, TopBarBackgroundViewController> backgroundControllers = new HashMap();
75
     private Map<View, Map<String, TitleBarButtonController>> componentRightButtons = new HashMap();
75
     private Map<View, Map<String, TitleBarButtonController>> componentRightButtons = new HashMap();
76
     private Map<View, Map<String, TitleBarButtonController>> componentLeftButtons = new HashMap();
76
     private Map<View, Map<String, TitleBarButtonController>> componentLeftButtons = new HashMap();
77
-    private NavigationIconResolver iconResolver;
77
+    private IconResolver iconResolver;
78
 
78
 
79
     public StackPresenter(Activity activity,
79
     public StackPresenter(Activity activity,
80
                           TitleBarReactViewCreator titleViewCreator,
80
                           TitleBarReactViewCreator titleViewCreator,
81
                           TopBarBackgroundViewCreator topBarBackgroundViewCreator,
81
                           TopBarBackgroundViewCreator topBarBackgroundViewCreator,
82
                           ReactViewCreator buttonCreator,
82
                           ReactViewCreator buttonCreator,
83
-                          NavigationIconResolver iconResolver,
83
+                          IconResolver iconResolver,
84
                           RenderChecker renderChecker,
84
                           RenderChecker renderChecker,
85
                           Options defaultOptions) {
85
                           Options defaultOptions) {
86
         this.activity = activity;
86
         this.activity = activity;

+ 3
- 3
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/TitleBarButtonController.java View File

19
 import com.reactnativenavigation.utils.ImageLoadingListenerAdapter;
19
 import com.reactnativenavigation.utils.ImageLoadingListenerAdapter;
20
 import com.reactnativenavigation.utils.UiUtils;
20
 import com.reactnativenavigation.utils.UiUtils;
21
 import com.reactnativenavigation.utils.ViewUtils;
21
 import com.reactnativenavigation.utils.ViewUtils;
22
-import com.reactnativenavigation.viewcontrollers.button.NavigationIconResolver;
22
+import com.reactnativenavigation.viewcontrollers.button.IconResolver;
23
 import com.reactnativenavigation.views.titlebar.TitleBarReactButtonView;
23
 import com.reactnativenavigation.views.titlebar.TitleBarReactButtonView;
24
 
24
 
25
 import java.util.List;
25
 import java.util.List;
34
         void onPress(String buttonId);
34
         void onPress(String buttonId);
35
     }
35
     }
36
 
36
 
37
-    private final NavigationIconResolver navigationIconResolver;
37
+    private final IconResolver navigationIconResolver;
38
     private ButtonPresenter optionsPresenter;
38
     private ButtonPresenter optionsPresenter;
39
     private final Button button;
39
     private final Button button;
40
     private final ReactViewCreator viewCreator;
40
     private final ReactViewCreator viewCreator;
51
     }
51
     }
52
 
52
 
53
     public TitleBarButtonController(Activity activity,
53
     public TitleBarButtonController(Activity activity,
54
-                                    NavigationIconResolver navigationIconResolver,
54
+                                    IconResolver navigationIconResolver,
55
                                     ButtonPresenter optionsPresenter,
55
                                     ButtonPresenter optionsPresenter,
56
                                     Button button,
56
                                     Button button,
57
                                     ReactViewCreator viewCreator,
57
                                     ReactViewCreator viewCreator,

lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/button/NavigationIconResolver.java → lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/button/IconResolver.java View File

12
 
12
 
13
 import androidx.annotation.NonNull;
13
 import androidx.annotation.NonNull;
14
 
14
 
15
-public class NavigationIconResolver {
15
+public class IconResolver {
16
 
16
 
17
     private Activity context;
17
     private Activity context;
18
     private ImageLoader imageLoader;
18
     private ImageLoader imageLoader;
19
 
19
 
20
-    public NavigationIconResolver(Activity context, ImageLoader imageLoader) {
20
+    public IconResolver(Activity context, ImageLoader imageLoader) {
21
         this.context = context;
21
         this.context = context;
22
         this.imageLoader = imageLoader;
22
         this.imageLoader = imageLoader;
23
     }
23
     }

+ 2
- 2
lib/android/app/src/test/java/com/reactnativenavigation/TestUtils.java View File

17
 import com.reactnativenavigation.utils.UiUtils;
17
 import com.reactnativenavigation.utils.UiUtils;
18
 import com.reactnativenavigation.viewcontrollers.ChildControllersRegistry;
18
 import com.reactnativenavigation.viewcontrollers.ChildControllersRegistry;
19
 import com.reactnativenavigation.viewcontrollers.ViewController;
19
 import com.reactnativenavigation.viewcontrollers.ViewController;
20
-import com.reactnativenavigation.viewcontrollers.button.NavigationIconResolver;
20
+import com.reactnativenavigation.viewcontrollers.button.IconResolver;
21
 import com.reactnativenavigation.viewcontrollers.stack.StackControllerBuilder;
21
 import com.reactnativenavigation.viewcontrollers.stack.StackControllerBuilder;
22
 import com.reactnativenavigation.viewcontrollers.topbar.TopBarController;
22
 import com.reactnativenavigation.viewcontrollers.topbar.TopBarController;
23
 import com.reactnativenavigation.views.StackLayout;
23
 import com.reactnativenavigation.views.StackLayout;
39
                 .setId("stack")
39
                 .setId("stack")
40
                 .setChildRegistry(new ChildControllersRegistry())
40
                 .setChildRegistry(new ChildControllersRegistry())
41
                 .setTopBarController(topBarController)
41
                 .setTopBarController(topBarController)
42
-                .setStackPresenter(new StackPresenter(activity, new TitleBarReactViewCreatorMock(), new TopBarBackgroundViewCreatorMock(), new TopBarButtonCreatorMock(), new NavigationIconResolver(activity, new ImageLoader()), new RenderChecker(), new Options()))
42
+                .setStackPresenter(new StackPresenter(activity, new TitleBarReactViewCreatorMock(), new TopBarBackgroundViewCreatorMock(), new TopBarButtonCreatorMock(), new IconResolver(activity, new ImageLoader()), new RenderChecker(), new Options()))
43
                 .setInitialOptions(new Options());
43
                 .setInitialOptions(new Options());
44
     }
44
     }
45
 
45
 

+ 2
- 2
lib/android/app/src/test/java/com/reactnativenavigation/utils/TitleBarHelper.java View File

8
 import com.reactnativenavigation.parse.params.Button;
8
 import com.reactnativenavigation.parse.params.Button;
9
 import com.reactnativenavigation.parse.params.Text;
9
 import com.reactnativenavigation.parse.params.Text;
10
 import com.reactnativenavigation.viewcontrollers.TitleBarButtonController;
10
 import com.reactnativenavigation.viewcontrollers.TitleBarButtonController;
11
-import com.reactnativenavigation.viewcontrollers.button.NavigationIconResolver;
11
+import com.reactnativenavigation.viewcontrollers.button.IconResolver;
12
 import com.reactnativenavigation.views.titlebar.TitleBar;
12
 import com.reactnativenavigation.views.titlebar.TitleBar;
13
 
13
 
14
 import androidx.appcompat.view.menu.ActionMenuItemView;
14
 import androidx.appcompat.view.menu.ActionMenuItemView;
45
 
45
 
46
     public static TitleBarButtonController createButtonController(Activity activity, TitleBar titleBar, Button button) {
46
     public static TitleBarButtonController createButtonController(Activity activity, TitleBar titleBar, Button button) {
47
         return new TitleBarButtonController(activity,
47
         return new TitleBarButtonController(activity,
48
-                new NavigationIconResolver(activity, ImageLoaderMock.mock()),
48
+                new IconResolver(activity, ImageLoaderMock.mock()),
49
                 new ButtonPresenter(titleBar, button),
49
                 new ButtonPresenter(titleBar, button),
50
                 button,
50
                 button,
51
                 new TopBarButtonCreatorMock(),
51
                 new TopBarButtonCreatorMock(),

+ 3
- 3
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/StackPresenterTest.java View File

32
 import com.reactnativenavigation.utils.CommandListenerAdapter;
32
 import com.reactnativenavigation.utils.CommandListenerAdapter;
33
 import com.reactnativenavigation.utils.TitleBarHelper;
33
 import com.reactnativenavigation.utils.TitleBarHelper;
34
 import com.reactnativenavigation.utils.UiUtils;
34
 import com.reactnativenavigation.utils.UiUtils;
35
-import com.reactnativenavigation.viewcontrollers.button.NavigationIconResolver;
35
+import com.reactnativenavigation.viewcontrollers.button.IconResolver;
36
 import com.reactnativenavigation.viewcontrollers.stack.StackController;
36
 import com.reactnativenavigation.viewcontrollers.stack.StackController;
37
 import com.reactnativenavigation.viewcontrollers.topbar.TopBarController;
37
 import com.reactnativenavigation.viewcontrollers.topbar.TopBarController;
38
 import com.reactnativenavigation.views.StackLayout;
38
 import com.reactnativenavigation.views.StackLayout;
86
     private Button componentBtn2 = TitleBarHelper.reactViewButton("btn2_");
86
     private Button componentBtn2 = TitleBarHelper.reactViewButton("btn2_");
87
     private TopBarController topBarController;
87
     private TopBarController topBarController;
88
     private ChildControllersRegistry childRegistry;
88
     private ChildControllersRegistry childRegistry;
89
-    private NavigationIconResolver iconResolver;
89
+    private IconResolver iconResolver;
90
 
90
 
91
     @Override
91
     @Override
92
     public void beforeEach() {
92
     public void beforeEach() {
98
             }
98
             }
99
         };
99
         };
100
         renderChecker = spy(new RenderChecker());
100
         renderChecker = spy(new RenderChecker());
101
-        iconResolver = new NavigationIconResolver(activity, ImageLoaderMock.mock());
101
+        iconResolver = new IconResolver(activity, ImageLoaderMock.mock());
102
         uut = spy(new StackPresenter(activity, titleViewCreator, new TopBarBackgroundViewCreatorMock(), new TopBarButtonCreatorMock(), iconResolver, renderChecker, new Options()));
102
         uut = spy(new StackPresenter(activity, titleViewCreator, new TopBarBackgroundViewCreatorMock(), new TopBarButtonCreatorMock(), iconResolver, renderChecker, new Options()));
103
         createTopBarController();
103
         createTopBarController();
104
 
104
 

+ 2
- 2
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopBarButtonControllerTest.java View File

16
 import com.reactnativenavigation.parse.params.Number;
16
 import com.reactnativenavigation.parse.params.Number;
17
 import com.reactnativenavigation.parse.params.Text;
17
 import com.reactnativenavigation.parse.params.Text;
18
 import com.reactnativenavigation.utils.ButtonPresenter;
18
 import com.reactnativenavigation.utils.ButtonPresenter;
19
-import com.reactnativenavigation.viewcontrollers.button.NavigationIconResolver;
19
+import com.reactnativenavigation.viewcontrollers.button.IconResolver;
20
 import com.reactnativenavigation.viewcontrollers.stack.StackController;
20
 import com.reactnativenavigation.viewcontrollers.stack.StackController;
21
 
21
 
22
 import org.junit.Test;
22
 import org.junit.Test;
51
         getTitleBar().layout(0, 0, 1080, 200);
51
         getTitleBar().layout(0, 0, 1080, 200);
52
 
52
 
53
         optionsPresenter = spy(new ButtonPresenter(getTitleBar(), button));
53
         optionsPresenter = spy(new ButtonPresenter(getTitleBar(), button));
54
-        uut = new TitleBarButtonController(activity, new NavigationIconResolver(activity, ImageLoaderMock.mock()), optionsPresenter, button, buttonCreatorMock, (buttonId) -> {});
54
+        uut = new TitleBarButtonController(activity, new IconResolver(activity, ImageLoaderMock.mock()), optionsPresenter, button, buttonCreatorMock, (buttonId) -> {});
55
 
55
 
56
         stackController.ensureViewIsCreated();
56
         stackController.ensureViewIsCreated();
57
     }
57
     }

+ 2
- 2
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/button/NavigationIconResolverTest.java View File

23
 
23
 
24
 public class NavigationIconResolverTest extends BaseTest {
24
 public class NavigationIconResolverTest extends BaseTest {
25
     private static final String ICON_URI = "someIconUri";
25
     private static final String ICON_URI = "someIconUri";
26
-    private NavigationIconResolver uut;
26
+    private IconResolver uut;
27
     private ImageLoader imageLoader;
27
     private ImageLoader imageLoader;
28
     private Activity context;
28
     private Activity context;
29
 
29
 
31
     public void beforeEach() {
31
     public void beforeEach() {
32
         imageLoader = ImageLoaderMock.mock();
32
         imageLoader = ImageLoaderMock.mock();
33
         context = newActivity();
33
         context = newActivity();
34
-        uut = new NavigationIconResolver(context, imageLoader);
34
+        uut = new IconResolver(context, imageLoader);
35
     }
35
     }
36
 
36
 
37
     @Test
37
     @Test

+ 2
- 2
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerTest.java View File

32
 import com.reactnativenavigation.viewcontrollers.ChildControllersRegistry;
32
 import com.reactnativenavigation.viewcontrollers.ChildControllersRegistry;
33
 import com.reactnativenavigation.viewcontrollers.ParentController;
33
 import com.reactnativenavigation.viewcontrollers.ParentController;
34
 import com.reactnativenavigation.viewcontrollers.ViewController;
34
 import com.reactnativenavigation.viewcontrollers.ViewController;
35
-import com.reactnativenavigation.viewcontrollers.button.NavigationIconResolver;
35
+import com.reactnativenavigation.viewcontrollers.button.IconResolver;
36
 import com.reactnativenavigation.viewcontrollers.topbar.TopBarController;
36
 import com.reactnativenavigation.viewcontrollers.topbar.TopBarController;
37
 import com.reactnativenavigation.views.StackLayout;
37
 import com.reactnativenavigation.views.StackLayout;
38
 import com.reactnativenavigation.views.element.ElementTransitionManager;
38
 import com.reactnativenavigation.views.element.ElementTransitionManager;
96
         StatusBarUtils.saveStatusBarHeight(63);
96
         StatusBarUtils.saveStatusBarHeight(63);
97
         animator = spy(new NavigationAnimator(activity, Mockito.mock(ElementTransitionManager.class)));
97
         animator = spy(new NavigationAnimator(activity, Mockito.mock(ElementTransitionManager.class)));
98
         childRegistry = new ChildControllersRegistry();
98
         childRegistry = new ChildControllersRegistry();
99
-        presenter = spy(new StackPresenter(activity, new TitleBarReactViewCreatorMock(), new TopBarBackgroundViewCreatorMock(), new TopBarButtonCreatorMock(), new NavigationIconResolver(activity, ImageLoaderMock.mock()), new RenderChecker(), new Options()));
99
+        presenter = spy(new StackPresenter(activity, new TitleBarReactViewCreatorMock(), new TopBarBackgroundViewCreatorMock(), new TopBarButtonCreatorMock(), new IconResolver(activity, ImageLoaderMock.mock()), new RenderChecker(), new Options()));
100
         child1 = spy(new SimpleViewController(activity, childRegistry, "child1", new Options()));
100
         child1 = spy(new SimpleViewController(activity, childRegistry, "child1", new Options()));
101
         child1a = spy(new SimpleViewController(activity, childRegistry, "child1", new Options()));
101
         child1a = spy(new SimpleViewController(activity, childRegistry, "child1", new Options()));
102
         child2 = spy(new SimpleViewController(activity, childRegistry, "child2", new Options()));
102
         child2 = spy(new SimpleViewController(activity, childRegistry, "child2", new Options()));