react-native-navigation 7.22.0 → 7.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/ElementTransitionOptions.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/HardwareBackButtonOptions.kt +2 -5
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/LayoutFactory.java +120 -120
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/ValueAnimationOptions.kt +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/interpolators/SpringInterpolator.kt +16 -16
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/parsers/TypefaceLoader.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/CommandListenerAdapter.java +0 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java +7 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationPackage.kt +1 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +5 -5
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalLayoutController.kt +7 -7
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalViewManager.kt +25 -9
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/CoordinatorLayoutUtils.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/OutlineProvider.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReflectionUtils.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/RenderChecker.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/StatusBarUtils.java +0 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/UiUtils.java +5 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ViewParent.kt +0 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ViewUtils.java +4 -5
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabPresenter.java +6 -8
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsAnimator.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/attacher/BottomTabsAttacher.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/attacher/modes/AttachMode.java +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/attacher/modes/OnSwitchToTab.java +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/child/ChildController.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/child/ChildControllersRegistry.java +5 -5
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/component/ComponentPresenterBase.java +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/component/ComponentViewController.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenter.java +6 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/ModalStack.java +18 -18
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/navigator/Navigator.java +12 -12
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/parent/ParentController.java +22 -22
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuController.java +16 -16
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuPresenter.java +4 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/FabPresenter.java +8 -8
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/IdStack.java +14 -14
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java +29 -29
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerBuilder.java +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenter.java +29 -28
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/TopBarAnimator.kt +1 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/TopBarBackgroundViewController.java +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/TopBarController.kt +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/BackButtonHelper.java +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonPresenter.kt +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonSpan.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/IconResolver.java +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsAdapter.java +5 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsController.java +8 -8
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabsContainer.kt +1 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabsLayout.java +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/PropertyAnimatorCreator.kt +2 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/ReactImageBoundsAnimator.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/ReactImageMatrixAnimator.kt +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/ReactViewRotationAnimator.kt +0 -5
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +1 -22
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/toptabs/TopTabsLayoutCreator.java +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/toptabs/TopTabsViewPager.java +6 -6
- package/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/NavigationReactNativeHost.java +0 -1
- package/lib/android/app/src/test/java/com/reactnativenavigation/BaseTest.java +23 -28
- package/lib/android/app/src/test/java/com/reactnativenavigation/TestUtils.java +4 -2
- package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestComponentLayout.java +3 -1
- package/lib/android/app/src/test/java/com/reactnativenavigation/options/parsers/ColorParseTest.java +0 -3
- package/lib/android/app/src/test/java/com/reactnativenavigation/presentation/RenderCheckerTest.java +6 -6
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabPresenterTest.java +3 -4
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsAttacherTest.java +1 -1
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsControllerTest.java +13 -15
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/attacher/modes/AttachModeTest.java +5 -5
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/child/ChildControllerTest.java +2 -2
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/child/ChildControllersRegistryTest.java +2 -2
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenterTest.java +4 -4
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalStackTest.java +10 -10
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/navigator/NavigatorTest.java +25 -26
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/navigator/RootPresenterTest.kt +2 -2
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/parent/ParentControllerTest.java +15 -15
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuControllerTest.java +11 -11
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/BackButtonHelperTest.java +2 -2
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackAnimatorTest.kt +0 -4
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerTest.kt +15 -15
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenterTest.kt +17 -17
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TopBarControllerTest.kt +3 -3
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsViewControllerTest.java +9 -9
- package/lib/dist/components/Modal.js +1 -2
- package/lib/src/components/Modal.tsx +1 -2
- package/package.json +1 -1
|
@@ -11,7 +11,6 @@ import android.view.WindowManager;
|
|
|
11
11
|
|
|
12
12
|
import androidx.annotation.NonNull;
|
|
13
13
|
import androidx.annotation.Nullable;
|
|
14
|
-
import androidx.annotation.VisibleForTesting;
|
|
15
14
|
|
|
16
15
|
public class UiUtils {
|
|
17
16
|
private static final int DEFAULT_TOOLBAR_HEIGHT = 56;
|
|
@@ -81,13 +80,13 @@ public class UiUtils {
|
|
|
81
80
|
});
|
|
82
81
|
}
|
|
83
82
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
public static void runOnMainThread(Runnable runnable) {
|
|
84
|
+
new Handler(Looper.getMainLooper()).post(runnable);
|
|
85
|
+
}
|
|
87
86
|
|
|
88
|
-
|
|
87
|
+
public static float getWindowHeight(Context context) {
|
|
89
88
|
return getDisplayMetrics(context).heightPixels;
|
|
90
|
-
|
|
89
|
+
}
|
|
91
90
|
|
|
92
91
|
public static float getWindowWidth(Context context) {
|
|
93
92
|
return getDisplayMetrics(context).widthPixels;
|
|
@@ -2,9 +2,6 @@ package com.reactnativenavigation.utils
|
|
|
2
2
|
|
|
3
3
|
import android.view.View
|
|
4
4
|
import android.view.ViewParent
|
|
5
|
-
import androidx.core.view.doOnLayout
|
|
6
|
-
import kotlin.coroutines.resume
|
|
7
|
-
import kotlin.coroutines.suspendCoroutine
|
|
8
5
|
|
|
9
6
|
val ViewParent.scaleX: Float
|
|
10
7
|
get() = (this as View).scaleX
|
|
@@ -3,7 +3,6 @@ package com.reactnativenavigation.utils;
|
|
|
3
3
|
import android.graphics.Point;
|
|
4
4
|
import android.view.View;
|
|
5
5
|
import android.view.ViewGroup;
|
|
6
|
-
import android.view.ViewManager;
|
|
7
6
|
import android.view.ViewParent;
|
|
8
7
|
|
|
9
8
|
import com.facebook.react.views.view.ReactViewBackgroundDrawable;
|
|
@@ -34,11 +33,11 @@ public class ViewUtils {
|
|
|
34
33
|
return null;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
public static <T> List<T> findChildrenByClassRecursive(ViewGroup root, Class clazz) {
|
|
36
|
+
public static <T> List<T> findChildrenByClassRecursive(ViewGroup root, Class<?> clazz) {
|
|
38
37
|
return findChildrenByClassRecursive(root, clazz, child -> true);
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
public static <T> List<T> findChildrenByClassRecursive(ViewGroup root, Class clazz, Matcher<T> matcher) {
|
|
40
|
+
public static <T> List<T> findChildrenByClassRecursive(ViewGroup root, Class<?> clazz, Matcher<T> matcher) {
|
|
42
41
|
ArrayList<T> ret = new ArrayList<>();
|
|
43
42
|
for (int i = 0; i < root.getChildCount(); i++) {
|
|
44
43
|
View view = root.getChildAt(i);
|
|
@@ -56,7 +55,7 @@ public class ViewUtils {
|
|
|
56
55
|
return findChildrenByClass(root, clazz, child -> true);
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
public static <T> List<T> findChildrenByClass(ViewGroup root, Class clazz, Matcher<T> matcher) {
|
|
58
|
+
public static <T> List<T> findChildrenByClass(ViewGroup root, Class<?> clazz, Matcher<T> matcher) {
|
|
60
59
|
List<T> ret = new ArrayList<>();
|
|
61
60
|
for (int i = 0; i < root.getChildCount(); i++) {
|
|
62
61
|
View child = root.getChildAt(i);
|
|
@@ -114,7 +113,7 @@ public class ViewUtils {
|
|
|
114
113
|
}
|
|
115
114
|
throw new RuntimeException(view.getBackground().getClass().getSimpleName() + " is not ReactViewBackgroundDrawable");
|
|
116
115
|
}
|
|
117
|
-
|
|
116
|
+
|
|
118
117
|
|
|
119
118
|
public static boolean isVisible(View view) {
|
|
120
119
|
return perform(view, false, v -> v.getVisibility() == View.VISIBLE);
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
package com.reactnativenavigation.viewcontrollers.bottomtabs;
|
|
2
2
|
|
|
3
|
+
import static com.reactnativenavigation.utils.CollectionUtils.forEach;
|
|
4
|
+
import static com.reactnativenavigation.utils.UiUtils.dpToPx;
|
|
5
|
+
|
|
3
6
|
import android.content.Context;
|
|
4
7
|
import android.graphics.Typeface;
|
|
5
8
|
import android.graphics.drawable.Drawable;
|
|
6
9
|
|
|
10
|
+
import androidx.annotation.NonNull;
|
|
11
|
+
|
|
7
12
|
import com.aurelhubert.ahbottomnavigation.notification.AHNotification;
|
|
8
13
|
import com.reactnativenavigation.options.BottomTabOptions;
|
|
9
14
|
import com.reactnativenavigation.options.DotIndicatorOptions;
|
|
10
15
|
import com.reactnativenavigation.options.Options;
|
|
11
|
-
import com.reactnativenavigation.options.params.Param;
|
|
12
16
|
import com.reactnativenavigation.options.params.ThemeColour;
|
|
13
17
|
import com.reactnativenavigation.options.parsers.TypefaceLoader;
|
|
14
|
-
import com.reactnativenavigation.utils.ContextKt;
|
|
15
18
|
import com.reactnativenavigation.utils.ImageLoader;
|
|
16
19
|
import com.reactnativenavigation.utils.ImageLoadingListenerAdapter;
|
|
17
20
|
import com.reactnativenavigation.utils.LateInit;
|
|
@@ -20,11 +23,6 @@ import com.reactnativenavigation.views.bottomtabs.BottomTabs;
|
|
|
20
23
|
|
|
21
24
|
import java.util.List;
|
|
22
25
|
|
|
23
|
-
import androidx.annotation.NonNull;
|
|
24
|
-
|
|
25
|
-
import static com.reactnativenavigation.utils.CollectionUtils.*;
|
|
26
|
-
import static com.reactnativenavigation.utils.UiUtils.dpToPx;
|
|
27
|
-
|
|
28
26
|
public class BottomTabPresenter {
|
|
29
27
|
private final Context context;
|
|
30
28
|
private final ImageLoader imageLoader;
|
|
@@ -81,7 +79,7 @@ public class BottomTabPresenter {
|
|
|
81
79
|
});
|
|
82
80
|
}
|
|
83
81
|
|
|
84
|
-
public void mergeChildOptions(Options options, ViewController child) {
|
|
82
|
+
public void mergeChildOptions(Options options, ViewController<?> child) {
|
|
85
83
|
bottomTabs.perform(bottomTabs -> {
|
|
86
84
|
int index = bottomTabFinder.findByControllerId(child.getId());
|
|
87
85
|
if (index >= 0) {
|
|
@@ -2,7 +2,6 @@ package com.reactnativenavigation.viewcontrollers.bottomtabs
|
|
|
2
2
|
|
|
3
3
|
import com.reactnativenavigation.views.animations.BaseViewAnimator
|
|
4
4
|
import com.reactnativenavigation.views.bottomtabs.BottomTabs
|
|
5
|
-
import com.reactnativenavigation.views.stack.topbar.TopBar
|
|
6
5
|
|
|
7
6
|
class BottomTabsAnimator(view: BottomTabs? = null) : BaseViewAnimator<BottomTabs>(HideDirection.Down, view) {
|
|
8
7
|
override fun onShowAnimationEnd() {
|
|
@@ -134,7 +134,7 @@ public class BottomTabsController extends ParentController<BottomTabsLayout> imp
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
@Override
|
|
137
|
-
public void applyChildOptions(Options options, ViewController child) {
|
|
137
|
+
public void applyChildOptions(Options options, ViewController<?> child) {
|
|
138
138
|
super.applyChildOptions(options, child);
|
|
139
139
|
presenter.applyChildOptions(resolveCurrentOptions(), child);
|
|
140
140
|
performOnParentController(parent -> parent.applyChildOptions(
|
|
@@ -147,7 +147,7 @@ public class BottomTabsController extends ParentController<BottomTabsLayout> imp
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
@Override
|
|
150
|
-
public void mergeChildOptions(Options options, ViewController child) {
|
|
150
|
+
public void mergeChildOptions(Options options, ViewController<?> child) {
|
|
151
151
|
super.mergeChildOptions(options, child);
|
|
152
152
|
presenter.mergeChildOptions(options, child);
|
|
153
153
|
tabPresenter.mergeChildOptions(options, child);
|
|
@@ -214,7 +214,7 @@ public class BottomTabsController extends ParentController<BottomTabsLayout> imp
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
@Override
|
|
217
|
-
public int getBottomInset(ViewController child) {
|
|
217
|
+
public int getBottomInset(ViewController<?> child) {
|
|
218
218
|
return presenter.getBottomInset(resolveChildOptions(child)) + perform(getParentController(), 0, p -> p.getBottomInset(this));
|
|
219
219
|
}
|
|
220
220
|
|
|
@@ -20,7 +20,7 @@ public abstract class AttachMode {
|
|
|
20
20
|
protected final BottomTabsPresenter presenter;
|
|
21
21
|
protected final BottomTabFinder bottomTabFinder;
|
|
22
22
|
protected final List<ViewController<?>> tabs;
|
|
23
|
-
final ViewController initialTab;
|
|
23
|
+
final ViewController<?> initialTab;
|
|
24
24
|
|
|
25
25
|
public static AttachMode get(ViewGroup parent, List<ViewController<?>> tabs, BottomTabsPresenter presenter, Options resolved) {
|
|
26
26
|
switch (resolved.bottomTabsOptions.tabsAttachMode) {
|
|
@@ -57,12 +57,12 @@ public abstract class AttachMode {
|
|
|
57
57
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
public void onTabSelected(ViewController tab) {
|
|
60
|
+
public void onTabSelected(ViewController<?> tab) {
|
|
61
61
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
|
|
65
|
-
public void attach(ViewController tab) {
|
|
65
|
+
public void attach(ViewController<?> tab) {
|
|
66
66
|
ViewGroup view = tab.getView();
|
|
67
67
|
view.setVisibility(tab == initialTab ? View.VISIBLE : View.INVISIBLE);
|
|
68
68
|
parent.addView(view, matchParentWithBehaviour(new BottomTabsBehaviour(tab.getParentController())));
|
|
@@ -20,13 +20,13 @@ public class OnSwitchToTab extends AttachMode {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
@Override
|
|
23
|
-
public void onTabSelected(ViewController tab) {
|
|
23
|
+
public void onTabSelected(ViewController<?> tab) {
|
|
24
24
|
if (tab != initialTab && isNotAttached(tab)) {
|
|
25
25
|
attach(tab);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
private boolean isNotAttached(ViewController tab) {
|
|
29
|
+
private boolean isNotAttached(ViewController<?> tab) {
|
|
30
30
|
return tab.getView().getParent() == null;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -98,7 +98,7 @@ public abstract class ChildController<T extends ViewGroup> extends ViewControlle
|
|
|
98
98
|
return applyWindowInsets(findController(view), insets);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
protected WindowInsetsCompat applyWindowInsets(ViewController view, WindowInsetsCompat insets) {
|
|
101
|
+
protected WindowInsetsCompat applyWindowInsets(ViewController<?> view, WindowInsetsCompat insets) {
|
|
102
102
|
return insets.replaceSystemWindowInsets(
|
|
103
103
|
insets.getSystemWindowInsetLeft(),
|
|
104
104
|
0,
|
|
@@ -5,13 +5,13 @@ import java.util.ArrayDeque;
|
|
|
5
5
|
import static com.reactnativenavigation.utils.ObjectUtils.perform;
|
|
6
6
|
|
|
7
7
|
public class ChildControllersRegistry {
|
|
8
|
-
private ArrayDeque<ChildController
|
|
8
|
+
private ArrayDeque<ChildController<?>> children = new ArrayDeque<>();
|
|
9
9
|
|
|
10
|
-
public void onViewAppeared(ChildController child) {
|
|
10
|
+
public void onViewAppeared(ChildController<?> child) {
|
|
11
11
|
children.push(child);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
public void onViewDisappear(ChildController child) {
|
|
14
|
+
public void onViewDisappear(ChildController<?> child) {
|
|
15
15
|
if (isTopChild(child)) {
|
|
16
16
|
children.pop();
|
|
17
17
|
if (!children.isEmpty()) children.peek().onViewBroughtToFront();
|
|
@@ -20,7 +20,7 @@ public class ChildControllersRegistry {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
private boolean isTopChild(ChildController child) {
|
|
23
|
+
private boolean isTopChild(ChildController<?> child) {
|
|
24
24
|
return perform(children.peek(), false, c -> c.equals(child));
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@ public class ChildControllersRegistry {
|
|
|
28
28
|
return children.size();
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
public void onChildDestroyed(ChildController child) {
|
|
31
|
+
public void onChildDestroyed(ChildController<?> child) {
|
|
32
32
|
children.remove(child);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -136,7 +136,7 @@ public class ComponentViewController extends ChildController<ComponentLayout> {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
@Override
|
|
139
|
-
protected WindowInsetsCompat applyWindowInsets(ViewController view, WindowInsetsCompat insets) {
|
|
139
|
+
protected WindowInsetsCompat applyWindowInsets(ViewController<?> view, WindowInsetsCompat insets) {
|
|
140
140
|
ViewCompat.onApplyWindowInsets(view.getView(), insets.replaceSystemWindowInsets(
|
|
141
141
|
insets.getSystemWindowInsetLeft(),
|
|
142
142
|
insets.getSystemWindowInsetTop(),
|
|
@@ -70,7 +70,7 @@ public class ModalPresenter {
|
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
@NotNull
|
|
73
|
-
private ScreenAnimationListener createListener(ViewController toAdd, ViewController toRemove, CommandListener listener) {
|
|
73
|
+
private ScreenAnimationListener createListener(ViewController<?> toAdd, ViewController<?> toRemove, CommandListener listener) {
|
|
74
74
|
return new ScreenAnimationListener() {
|
|
75
75
|
@Override
|
|
76
76
|
public void onStart() {
|
|
@@ -89,7 +89,7 @@ public class ModalPresenter {
|
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
private void onShowModalEnd(ViewController toAdd, @Nullable ViewController toRemove, CommandListener listener) {
|
|
92
|
+
private void onShowModalEnd(ViewController<?> toAdd, @Nullable ViewController<?> toRemove, CommandListener listener) {
|
|
93
93
|
toAdd.onViewDidAppear();
|
|
94
94
|
if (toRemove != null && toAdd.resolveCurrentOptions(defaultOptions).modal.presentationStyle != ModalPresentationStyle.OverCurrentContext) {
|
|
95
95
|
toRemove.detachView();
|
|
@@ -97,7 +97,7 @@ public class ModalPresenter {
|
|
|
97
97
|
listener.onSuccess(toAdd.getId());
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
void dismissModal(ViewController toDismiss, @Nullable ViewController toAdd, ViewController root, CommandListener listener) {
|
|
100
|
+
void dismissModal(ViewController<?> toDismiss, @Nullable ViewController<?> toAdd, ViewController<?> root, CommandListener listener) {
|
|
101
101
|
if (modalsLayout == null) {
|
|
102
102
|
listener.onError("Can not dismiss modal before activity is created");
|
|
103
103
|
return;
|
|
@@ -119,14 +119,14 @@ public class ModalPresenter {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
boolean shouldDismissModal(ViewController toDismiss) {
|
|
122
|
+
boolean shouldDismissModal(ViewController<?> toDismiss) {
|
|
123
123
|
return toDismiss.resolveCurrentOptions(defaultOptions).hardwareBack.dismissModalOnPress.get(true);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
public Options resolveOptions(ViewController modalController){
|
|
126
|
+
public Options resolveOptions(ViewController<?> modalController){
|
|
127
127
|
return modalController.resolveCurrentOptions(defaultOptions);
|
|
128
128
|
}
|
|
129
|
-
private void onDismissEnd(ViewController toDismiss, CommandListener listener) {
|
|
129
|
+
private void onDismissEnd(ViewController<?> toDismiss, CommandListener listener) {
|
|
130
130
|
listener.onSuccess(toDismiss.getId());
|
|
131
131
|
toDismiss.destroy();
|
|
132
132
|
if (isEmpty()) modalsLayout.setVisibility(View.GONE);
|
|
@@ -24,7 +24,7 @@ import static com.reactnativenavigation.react.Constants.HARDWARE_BACK_BUTTON_ID;
|
|
|
24
24
|
import static com.reactnativenavigation.utils.ObjectUtils.perform;
|
|
25
25
|
|
|
26
26
|
public class ModalStack {
|
|
27
|
-
private final List<ViewController
|
|
27
|
+
private final List<ViewController<?>> modals = new ArrayList<>();
|
|
28
28
|
private final ModalPresenter presenter;
|
|
29
29
|
private final ModalOverlay overlay;
|
|
30
30
|
private EventEmitter eventEmitter;
|
|
@@ -57,19 +57,19 @@ public class ModalStack {
|
|
|
57
57
|
presenter.setDefaultOptions(defaultOptions);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
public void showModal(ViewController viewController, ViewController root, CommandListener listener) {
|
|
61
|
-
ViewController toRemove = isEmpty() ? root : peek();
|
|
60
|
+
public void showModal(ViewController<?> viewController, ViewController<?> root, CommandListener listener) {
|
|
61
|
+
ViewController<?> toRemove = isEmpty() ? root : peek();
|
|
62
62
|
modals.add(viewController);
|
|
63
63
|
viewController.setOverlay(overlay);
|
|
64
64
|
presenter.showModal(viewController, toRemove, listener);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
public boolean dismissModal(String componentId, @Nullable ViewController root, CommandListener listener) {
|
|
68
|
-
ViewController toDismiss = findModalByComponentId(componentId);
|
|
67
|
+
public boolean dismissModal(String componentId, @Nullable ViewController<?> root, CommandListener listener) {
|
|
68
|
+
ViewController<?> toDismiss = findModalByComponentId(componentId);
|
|
69
69
|
if (toDismiss != null) {
|
|
70
70
|
boolean isDismissingTopModal = isTop(toDismiss);
|
|
71
71
|
modals.remove(toDismiss);
|
|
72
|
-
@Nullable ViewController toAdd = isEmpty() ? root : isDismissingTopModal ? get(size() - 1) : null;
|
|
72
|
+
@Nullable ViewController<?> toAdd = isEmpty() ? root : isDismissingTopModal ? get(size() - 1) : null;
|
|
73
73
|
if (isDismissingTopModal) {
|
|
74
74
|
if (toAdd == null) {
|
|
75
75
|
listener.onError("Could not dismiss modal");
|
|
@@ -90,7 +90,7 @@ public class ModalStack {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
public void dismissAllModals(@Nullable ViewController root, Options mergeOptions, CommandListener listener) {
|
|
93
|
+
public void dismissAllModals(@Nullable ViewController<?> root, Options mergeOptions, CommandListener listener) {
|
|
94
94
|
if (modals.isEmpty()) {
|
|
95
95
|
listener.onSuccess(perform(root, "", ViewController::getId));
|
|
96
96
|
return;
|
|
@@ -117,7 +117,7 @@ public class ModalStack {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
public boolean handleBack(CommandListener listener, ViewController root) {
|
|
120
|
+
public boolean handleBack(CommandListener listener, ViewController<?> root) {
|
|
121
121
|
if (isEmpty()) return false;
|
|
122
122
|
if (peek().handleBack(listener)) {
|
|
123
123
|
return true;
|
|
@@ -130,12 +130,12 @@ public class ModalStack {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
ViewController peek() {
|
|
133
|
+
ViewController<?> peek() {
|
|
134
134
|
if (modals.isEmpty()) throw new EmptyStackException();
|
|
135
135
|
return modals.get(modals.size() - 1);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
public ViewController get(int index) {
|
|
138
|
+
public ViewController<?> get(int index) {
|
|
139
139
|
return modals.get(index);
|
|
140
140
|
}
|
|
141
141
|
|
|
@@ -147,13 +147,13 @@ public class ModalStack {
|
|
|
147
147
|
return modals.size();
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
private boolean isTop(ViewController modal) {
|
|
150
|
+
private boolean isTop(ViewController<?> modal) {
|
|
151
151
|
return !isEmpty() && peek().equals(modal);
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
@Nullable
|
|
155
|
-
private ViewController findModalByComponentId(String componentId) {
|
|
156
|
-
for (ViewController modal : modals) {
|
|
155
|
+
private ViewController<?> findModalByComponentId(String componentId) {
|
|
156
|
+
for (ViewController<?> modal : modals) {
|
|
157
157
|
if (modal.findController(componentId) != null) {
|
|
158
158
|
return modal;
|
|
159
159
|
}
|
|
@@ -163,9 +163,9 @@ public class ModalStack {
|
|
|
163
163
|
|
|
164
164
|
|
|
165
165
|
@Nullable
|
|
166
|
-
public ViewController findControllerById(String componentId) {
|
|
167
|
-
for (ViewController modal : modals) {
|
|
168
|
-
ViewController controllerById = modal.findController(componentId);
|
|
166
|
+
public ViewController<?> findControllerById(String componentId) {
|
|
167
|
+
for (ViewController<?> modal : modals) {
|
|
168
|
+
ViewController<?> controllerById = modal.findController(componentId);
|
|
169
169
|
if (controllerById != null) {
|
|
170
170
|
return controllerById;
|
|
171
171
|
}
|
|
@@ -174,14 +174,14 @@ public class ModalStack {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
public void destroy() {
|
|
177
|
-
for (ViewController modal : modals) {
|
|
177
|
+
for (ViewController<?> modal : modals) {
|
|
178
178
|
modal.destroy();
|
|
179
179
|
}
|
|
180
180
|
modals.clear();
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
public void onConfigurationChanged(Configuration newConfig) {
|
|
184
|
-
for (ViewController controller : modals) {
|
|
184
|
+
for (ViewController<?> controller : modals) {
|
|
185
185
|
controller.onConfigurationChanged(newConfig);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
@@ -31,13 +31,13 @@ import java.util.Collection;
|
|
|
31
31
|
import java.util.Collections;
|
|
32
32
|
import java.util.List;
|
|
33
33
|
|
|
34
|
-
public class Navigator extends ParentController {
|
|
34
|
+
public class Navigator extends ParentController<ViewGroup> {
|
|
35
35
|
|
|
36
36
|
private final ModalStack modalStack;
|
|
37
37
|
private final OverlayManager overlayManager;
|
|
38
38
|
private final RootPresenter rootPresenter;
|
|
39
|
-
private ViewController root;
|
|
40
|
-
private ViewController previousRoot;
|
|
39
|
+
private ViewController<?> root;
|
|
40
|
+
private ViewController<?> previousRoot;
|
|
41
41
|
private final CoordinatorLayout rootLayout;
|
|
42
42
|
private final CoordinatorLayout modalsLayout;
|
|
43
43
|
private final CoordinatorLayout overlaysLayout;
|
|
@@ -96,7 +96,7 @@ public class Navigator extends ParentController {
|
|
|
96
96
|
|
|
97
97
|
@NonNull
|
|
98
98
|
@Override
|
|
99
|
-
public Collection<ViewController
|
|
99
|
+
public Collection<ViewController<?>> getChildControllers() {
|
|
100
100
|
return root == null ? Collections.emptyList() : Collections.singletonList(root);
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -108,7 +108,7 @@ public class Navigator extends ParentController {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
@Override
|
|
111
|
-
public ViewController getCurrentChild() {
|
|
111
|
+
public ViewController<?> getCurrentChild() {
|
|
112
112
|
return root;
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -159,17 +159,17 @@ public class Navigator extends ParentController {
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
public void mergeOptions(final String componentId, Options options) {
|
|
162
|
-
ViewController target = findController(componentId);
|
|
162
|
+
ViewController<?> target = findController(componentId);
|
|
163
163
|
if (target != null) {
|
|
164
164
|
target.mergeOptions(options);
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
public void push(final String id, final ViewController viewController, CommandListener listener) {
|
|
168
|
+
public void push(final String id, final ViewController<?> viewController, CommandListener listener) {
|
|
169
169
|
applyOnStack(id, listener, stack -> stack.push(viewController, listener));
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
public void setStackRoot(String id, List<ViewController
|
|
172
|
+
public void setStackRoot(String id, List<ViewController<?>> children, CommandListener listener) {
|
|
173
173
|
applyOnStack(id, listener, stack -> stack.setRoot(children, listener));
|
|
174
174
|
}
|
|
175
175
|
|
|
@@ -190,7 +190,7 @@ public class Navigator extends ParentController {
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
public void showModal(final ViewController viewController, CommandListener listener) {
|
|
193
|
+
public void showModal(final ViewController<?> viewController, CommandListener listener) {
|
|
194
194
|
modalStack.showModal(viewController, root, listener);
|
|
195
195
|
}
|
|
196
196
|
|
|
@@ -206,7 +206,7 @@ public class Navigator extends ParentController {
|
|
|
206
206
|
modalStack.dismissAllModals(root, mergeOptions, listener);
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
public void showOverlay(ViewController overlay, CommandListener listener) {
|
|
209
|
+
public void showOverlay(ViewController<?> overlay, CommandListener listener) {
|
|
210
210
|
overlayManager.show(overlaysLayout, overlay, listener);
|
|
211
211
|
}
|
|
212
212
|
|
|
@@ -220,8 +220,8 @@ public class Navigator extends ParentController {
|
|
|
220
220
|
|
|
221
221
|
@Nullable
|
|
222
222
|
@Override
|
|
223
|
-
public ViewController findController(String id) {
|
|
224
|
-
ViewController controllerById = super.findController(id);
|
|
223
|
+
public ViewController<?> findController(String id) {
|
|
224
|
+
ViewController<?> controllerById = super.findController(id);
|
|
225
225
|
if (controllerById == null) {
|
|
226
226
|
controllerById = modalStack.findControllerById(id);
|
|
227
227
|
}
|
|
@@ -47,14 +47,14 @@ public abstract class ParentController<T extends ViewGroup> extends ChildControl
|
|
|
47
47
|
@Override
|
|
48
48
|
public void onViewDidAppear() {
|
|
49
49
|
super.onViewDidAppear();
|
|
50
|
-
ViewController currentChild = getCurrentChild();
|
|
50
|
+
ViewController<?> currentChild = getCurrentChild();
|
|
51
51
|
if (currentChild != null) currentChild.onViewDidAppear();
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
@Override
|
|
55
55
|
public void onViewDisappear() {
|
|
56
56
|
super.onViewDisappear();
|
|
57
|
-
ViewController currentChild = getCurrentChild();
|
|
57
|
+
ViewController<?> currentChild = getCurrentChild();
|
|
58
58
|
if (currentChild != null) currentChild.onViewDisappear();
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -68,7 +68,7 @@ public abstract class ParentController<T extends ViewGroup> extends ChildControl
|
|
|
68
68
|
.withDefaultOptions(initialOptions);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
public Options resolveChildOptions(ViewController child) {
|
|
71
|
+
public Options resolveChildOptions(ViewController<?> child) {
|
|
72
72
|
if (child == this) return resolveCurrentOptions();
|
|
73
73
|
return child
|
|
74
74
|
.resolveCurrentOptions()
|
|
@@ -82,18 +82,18 @@ public abstract class ParentController<T extends ViewGroup> extends ChildControl
|
|
|
82
82
|
return resolveCurrentOptions().withDefaultOptions(defaultOptions);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
public boolean isCurrentChild(ViewController child) {
|
|
85
|
+
public boolean isCurrentChild(ViewController<?> child) {
|
|
86
86
|
return getCurrentChild() == child;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
public abstract ViewController getCurrentChild();
|
|
89
|
+
public abstract ViewController<?> getCurrentChild();
|
|
90
90
|
|
|
91
91
|
@NonNull
|
|
92
92
|
@Override
|
|
93
93
|
public abstract T createView();
|
|
94
94
|
|
|
95
95
|
@NonNull
|
|
96
|
-
public abstract Collection<? extends ViewController
|
|
96
|
+
public abstract Collection<? extends ViewController<?>> getChildControllers();
|
|
97
97
|
|
|
98
98
|
@Nullable
|
|
99
99
|
protected BottomTabsController getBottomTabsController() {
|
|
@@ -105,12 +105,12 @@ public abstract class ParentController<T extends ViewGroup> extends ChildControl
|
|
|
105
105
|
|
|
106
106
|
@Nullable
|
|
107
107
|
@Override
|
|
108
|
-
public ViewController findController(final String id) {
|
|
109
|
-
ViewController fromSuper = super.findController(id);
|
|
108
|
+
public ViewController<?> findController(final String id) {
|
|
109
|
+
ViewController<?> fromSuper = super.findController(id);
|
|
110
110
|
if (fromSuper != null) return fromSuper;
|
|
111
111
|
|
|
112
|
-
for (ViewController child : getChildControllers()) {
|
|
113
|
-
ViewController fromChild = child.findController(id);
|
|
112
|
+
for (ViewController<?> child : getChildControllers()) {
|
|
113
|
+
ViewController<?> fromChild = child.findController(id);
|
|
114
114
|
if (fromChild != null) return fromChild;
|
|
115
115
|
}
|
|
116
116
|
|
|
@@ -119,12 +119,12 @@ public abstract class ParentController<T extends ViewGroup> extends ChildControl
|
|
|
119
119
|
|
|
120
120
|
@Nullable
|
|
121
121
|
@Override
|
|
122
|
-
public ViewController findController(View child) {
|
|
123
|
-
ViewController fromSuper = super.findController(child);
|
|
122
|
+
public ViewController<?> findController(View child) {
|
|
123
|
+
ViewController<?> fromSuper = super.findController(child);
|
|
124
124
|
if (fromSuper != null) return fromSuper;
|
|
125
125
|
|
|
126
|
-
for (ViewController childController : getChildControllers()) {
|
|
127
|
-
ViewController fromChild = childController.findController(child);
|
|
126
|
+
for (ViewController<?> childController : getChildControllers()) {
|
|
127
|
+
ViewController<?> fromChild = childController.findController(child);
|
|
128
128
|
if (fromChild != null) return fromChild;
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -136,19 +136,19 @@ public abstract class ParentController<T extends ViewGroup> extends ChildControl
|
|
|
136
136
|
if (super.containsComponent(component)) {
|
|
137
137
|
return true;
|
|
138
138
|
}
|
|
139
|
-
for (ViewController child : getChildControllers()) {
|
|
139
|
+
for (ViewController<?> child : getChildControllers()) {
|
|
140
140
|
if (child.containsComponent(component)) return true;
|
|
141
141
|
}
|
|
142
142
|
return false;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
@CallSuper
|
|
146
|
-
public void applyChildOptions(Options options, ViewController child) {
|
|
146
|
+
public void applyChildOptions(Options options, ViewController<?> child) {
|
|
147
147
|
this.options = initialOptions.mergeWith(options);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
@CallSuper
|
|
151
|
-
public void mergeChildOptions(Options options, ViewController child) {
|
|
151
|
+
public void mergeChildOptions(Options options, ViewController<?> child) {
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
@Override
|
|
@@ -177,7 +177,7 @@ public abstract class ParentController<T extends ViewGroup> extends ChildControl
|
|
|
177
177
|
return getCurrentChild() != null && getCurrentChild().isRendered();
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
public void onChildDestroyed(ViewController child) {
|
|
180
|
+
public void onChildDestroyed(ViewController<?> child) {
|
|
181
181
|
|
|
182
182
|
}
|
|
183
183
|
|
|
@@ -186,7 +186,7 @@ public abstract class ParentController<T extends ViewGroup> extends ChildControl
|
|
|
186
186
|
forEach(getChildControllers(), ViewController::applyTopInset);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
public int getTopInset(ViewController child) {
|
|
189
|
+
public int getTopInset(ViewController<?> child) {
|
|
190
190
|
return perform(getParentController(), 0, p -> p.getTopInset(child));
|
|
191
191
|
}
|
|
192
192
|
|
|
@@ -195,7 +195,7 @@ public abstract class ParentController<T extends ViewGroup> extends ChildControl
|
|
|
195
195
|
forEach(getChildControllers(), ViewController::applyBottomInset);
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
public int getBottomInset(ViewController child) {
|
|
198
|
+
public int getBottomInset(ViewController<?> child) {
|
|
199
199
|
return perform(getParentController(), 0, p -> p.getBottomInset(child));
|
|
200
200
|
}
|
|
201
201
|
|
|
@@ -206,8 +206,8 @@ public abstract class ParentController<T extends ViewGroup> extends ChildControl
|
|
|
206
206
|
|
|
207
207
|
public void onConfigurationChanged(Configuration newConfig) {
|
|
208
208
|
super.onConfigurationChanged(newConfig);
|
|
209
|
-
Collection<? extends ViewController
|
|
210
|
-
for(ViewController controller: childControllers){
|
|
209
|
+
Collection<? extends ViewController<?>> childControllers = getChildControllers();
|
|
210
|
+
for(ViewController<?> controller: childControllers){
|
|
211
211
|
controller.onConfigurationChanged(newConfig);
|
|
212
212
|
}
|
|
213
213
|
}
|