react-native-navigation 7.25.4 → 7.26.0-alpha.1
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/NavigationActivity.java +9 -7
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/BottomTabOptions.java +0 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/OverlayOptions.java +2 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/parsers/JSONParser.java +2 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabPresenter.java +1 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java +4 -31
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/child/ChildController.java +13 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/component/ComponentViewController.java +46 -62
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/ModalStack.java +0 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/navigator/Navigator.java +6 -20
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/overlay/OverlayManager.kt +33 -104
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/parent/ParentController.java +9 -86
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuController.java +0 -12
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java +2 -19
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenter.java +244 -212
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/TopBarController.kt +22 -185
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonController.kt +5 -32
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonPresenter.kt +1 -9
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/RootPresenter.java +1 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/ViewController.java +0 -12
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabs.java +1 -29
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabsContainer.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabsLayout.java +1 -10
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/component/ComponentLayout.java +2 -10
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/sidemenu/SideMenuRoot.java +1 -9
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/StackLayout.java +4 -14
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/TopBar.java +1 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/titlebar/ButtonBar.kt +12 -7
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleAndButtonsContainer.kt +2 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleSubTitleLayout.kt +7 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/toptabs/TopTabsStyleHelper.java +1 -0
- package/lib/dist/src/interfaces/Options.d.ts +0 -24
- package/lib/src/interfaces/Options.ts +0 -26
- package/package.json +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/OverlayOptions.kt +0 -31
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/overlay/AttachedOverlayContainer.kt +0 -69
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/overlay/ViewTooltip.java +0 -921
|
@@ -2,16 +2,13 @@ package com.reactnativenavigation.viewcontrollers.stack.topbar
|
|
|
2
2
|
|
|
3
3
|
import android.animation.Animator
|
|
4
4
|
import android.content.Context
|
|
5
|
-
import android.graphics.Color
|
|
6
5
|
import android.view.MenuItem
|
|
7
6
|
import android.view.View
|
|
8
|
-
import androidx.transition.AutoTransition
|
|
9
|
-
import androidx.transition.TransitionManager
|
|
10
7
|
import androidx.viewpager.widget.ViewPager
|
|
11
8
|
import com.reactnativenavigation.options.Alignment
|
|
12
9
|
import com.reactnativenavigation.options.AnimationOptions
|
|
13
|
-
import com.reactnativenavigation.options.ButtonOptions
|
|
14
10
|
import com.reactnativenavigation.options.Options
|
|
11
|
+
import com.reactnativenavigation.utils.CollectionUtils.forEachIndexed
|
|
15
12
|
import com.reactnativenavigation.utils.ViewUtils
|
|
16
13
|
import com.reactnativenavigation.utils.resetViewProperties
|
|
17
14
|
import com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonController
|
|
@@ -20,13 +17,12 @@ import com.reactnativenavigation.views.stack.StackLayout
|
|
|
20
17
|
import com.reactnativenavigation.views.stack.topbar.TopBar
|
|
21
18
|
import com.reactnativenavigation.views.stack.topbar.titlebar.ButtonBar
|
|
22
19
|
|
|
23
|
-
const val DEFAULT_BORDER_COLOR = Color.BLACK
|
|
24
20
|
|
|
25
21
|
open class TopBarController(private val animator: TopBarAnimator = TopBarAnimator()) {
|
|
26
22
|
lateinit var view: TopBar
|
|
27
23
|
private lateinit var leftButtonBar: ButtonBar
|
|
28
24
|
private lateinit var rightButtonBar: ButtonBar
|
|
29
|
-
|
|
25
|
+
|
|
30
26
|
|
|
31
27
|
val height: Int
|
|
32
28
|
get() = view.height
|
|
@@ -58,26 +54,26 @@ open class TopBarController(private val animator: TopBarAnimator = TopBarAnimato
|
|
|
58
54
|
fun getPushAnimation(appearingOptions: Options, additionalDy: Float = 0f): Animator? {
|
|
59
55
|
if (appearingOptions.topBar.animate.isFalse) return null
|
|
60
56
|
return animator.getPushAnimation(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
appearingOptions.animations.push.topBar,
|
|
58
|
+
appearingOptions.topBar.visible,
|
|
59
|
+
additionalDy
|
|
64
60
|
)
|
|
65
61
|
}
|
|
66
62
|
|
|
67
63
|
fun getPopAnimation(appearingOptions: Options, disappearingOptions: Options): Animator? {
|
|
68
64
|
if (appearingOptions.topBar.animate.isFalse) return null
|
|
69
65
|
return animator.getPopAnimation(
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
disappearingOptions.animations.pop.topBar,
|
|
67
|
+
appearingOptions.topBar.visible
|
|
72
68
|
)
|
|
73
69
|
}
|
|
74
70
|
|
|
75
71
|
fun getSetStackRootAnimation(appearingOptions: Options, additionalDy: Float = 0f): Animator? {
|
|
76
72
|
if (appearingOptions.topBar.animate.isFalse) return null
|
|
77
73
|
return animator.getSetStackRootAnimation(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
appearingOptions.animations.setStackRoot.topBar,
|
|
75
|
+
appearingOptions.topBar.visible,
|
|
76
|
+
additionalDy
|
|
81
77
|
)
|
|
82
78
|
}
|
|
83
79
|
|
|
@@ -109,184 +105,25 @@ open class TopBarController(private val animator: TopBarAnimator = TopBarAnimato
|
|
|
109
105
|
view.alignTitleComponent(alignment)
|
|
110
106
|
}
|
|
111
107
|
|
|
112
|
-
fun
|
|
108
|
+
fun applyRightButtons(toAdd: List<ButtonController>) {
|
|
113
109
|
view.clearRightButtons()
|
|
110
|
+
toAdd.reversed().forEachIndexed { i, b -> b.addToMenu(rightButtonBar, i * 10) }
|
|
114
111
|
}
|
|
115
112
|
|
|
116
|
-
fun
|
|
117
|
-
view.
|
|
113
|
+
fun mergeRightButtons(toAdd: List<ButtonController>, toRemove: List<ButtonController>) {
|
|
114
|
+
toRemove.forEach { view.removeRightButton(it) }
|
|
115
|
+
toAdd.reversed().forEachIndexed { i, b -> b.addToMenu(rightButtonBar, i * 10) }
|
|
118
116
|
}
|
|
119
117
|
|
|
120
|
-
fun
|
|
118
|
+
open fun applyLeftButtons(toAdd: List<ButtonController>) {
|
|
121
119
|
view.clearBackButton()
|
|
120
|
+
view.clearLeftButtons()
|
|
121
|
+
forEachIndexed(toAdd) { b: ButtonController, i: Int -> b.addToMenu(leftButtonBar, i * 10) }
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
fun
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
fun animateRightButtons(shouldAnimate: Boolean) {
|
|
129
|
-
view.animateRightButtons(shouldAnimate)
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
fun animateLeftButtons(shouldAnimate: Boolean) {
|
|
133
|
-
view.animateLeftButtons(shouldAnimate)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
fun mergeRightButtonsOptions(
|
|
137
|
-
btnControllers: MutableMap<String, ButtonController>,
|
|
138
|
-
rightButtons: List<ButtonOptions>,
|
|
139
|
-
controllerCreator: (ButtonOptions) -> ButtonController
|
|
140
|
-
) {
|
|
141
|
-
mergeButtonOptions(btnControllers, rightButtons.reversed(), controllerCreator, rightButtonBar)
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
fun mergeLeftButtonsOptions(
|
|
145
|
-
btnControllers: MutableMap<String, ButtonController>,
|
|
146
|
-
leftButtons: List<ButtonOptions>,
|
|
147
|
-
controllerCreator: (ButtonOptions) -> ButtonController
|
|
148
|
-
) {
|
|
149
|
-
clearBackButton()
|
|
150
|
-
mergeButtonOptions(btnControllers, leftButtons, controllerCreator, leftButtonBar)
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
fun applyRightButtonsOptions(
|
|
154
|
-
btnControllers: MutableMap<String, ButtonController>,
|
|
155
|
-
rightButtons: List<ButtonOptions>,
|
|
156
|
-
controllerCreator: (ButtonOptions) -> ButtonController
|
|
157
|
-
) {
|
|
158
|
-
applyButtonsOptions(
|
|
159
|
-
btnControllers,
|
|
160
|
-
rightButtons.reversed(),
|
|
161
|
-
controllerCreator,
|
|
162
|
-
rightButtonBar
|
|
163
|
-
)
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
fun applyLeftButtonsOptions(
|
|
167
|
-
btnControllers: MutableMap<String, ButtonController>,
|
|
168
|
-
leftButtons: List<ButtonOptions>,
|
|
169
|
-
controllerCreator: (ButtonOptions) -> ButtonController
|
|
170
|
-
) {
|
|
171
|
-
applyButtonsOptions(btnControllers, leftButtons, controllerCreator, leftButtonBar)
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
private fun applyButtonsOptions(
|
|
175
|
-
btnControllers: MutableMap<String, ButtonController>,
|
|
176
|
-
buttons: List<ButtonOptions>,
|
|
177
|
-
controllerCreator: (ButtonOptions) -> ButtonController,
|
|
178
|
-
buttonBar: ButtonBar
|
|
179
|
-
) {
|
|
180
|
-
buttonBar.clearButtons()
|
|
181
|
-
if (buttonBar.shouldAnimate)
|
|
182
|
-
TransitionManager.beginDelayedTransition(buttonBar, buttonsTransition)
|
|
183
|
-
|
|
184
|
-
buttons.forEachIndexed { index, it ->
|
|
185
|
-
val order = index * 10
|
|
186
|
-
val newController = if (btnControllers.containsKey(it.id)) {
|
|
187
|
-
btnControllers.remove(it.id)?.apply {
|
|
188
|
-
this.mergeButtonOptions(it,buttonBar)
|
|
189
|
-
}
|
|
190
|
-
} else {
|
|
191
|
-
controllerCreator(it)
|
|
192
|
-
}!!
|
|
193
|
-
|
|
194
|
-
newController.addToMenu(buttonBar, order)
|
|
195
|
-
btnControllers[it.id] = newController
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
private fun mergeButtonOptions(
|
|
201
|
-
btnControllers: MutableMap<String, ButtonController>,
|
|
202
|
-
buttons: List<ButtonOptions>,
|
|
203
|
-
controllerCreator: (ButtonOptions) -> ButtonController,
|
|
204
|
-
buttonBar: ButtonBar
|
|
205
|
-
) {
|
|
206
|
-
fun hasChangedOrder(): Boolean {
|
|
207
|
-
val values = btnControllers.values
|
|
208
|
-
return buttons.filterIndexed { index, buttonOptions ->
|
|
209
|
-
val buttonController = btnControllers[buttonOptions.id]
|
|
210
|
-
values.indexOf(buttonController) == index
|
|
211
|
-
}.size != buttons.size
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
fun sameIdDifferentCompId(
|
|
215
|
-
toUpdate: MutableMap<String, Int>,
|
|
216
|
-
ctrl: Map.Entry<String, ButtonController>,
|
|
217
|
-
buttons: List<ButtonOptions>
|
|
218
|
-
) = if (toUpdate.containsKey(ctrl.key)
|
|
219
|
-
&& ctrl.value.button.hasComponent()
|
|
220
|
-
&& buttons[toUpdate[ctrl.key]!!].component.componentId != ctrl.value.button.component.componentId
|
|
221
|
-
) {
|
|
222
|
-
toUpdate.remove(ctrl.key)
|
|
223
|
-
true
|
|
224
|
-
} else false
|
|
225
|
-
|
|
226
|
-
val requestedButtons = buttons.mapIndexed { index, buttonOptions -> buttonOptions.id to index }.toMap()
|
|
227
|
-
var toUpdate = requestedButtons.filter {
|
|
228
|
-
btnControllers[it.key]?.areButtonOptionsChanged(buttons[it.value]) ?: false
|
|
229
|
-
}.toMutableMap()
|
|
230
|
-
var toAdd = requestedButtons.filter { !btnControllers.containsKey(it.key) }
|
|
231
|
-
var toRemove = btnControllers.filter { ctrl -> !requestedButtons.containsKey(ctrl.key) }
|
|
232
|
-
val toDestroy = btnControllers.filter { ctrl -> sameIdDifferentCompId(toUpdate, ctrl, buttons) }
|
|
233
|
-
.toMutableMap().apply { this.putAll(toRemove) }
|
|
234
|
-
|
|
235
|
-
fun needsRebuild(): Boolean {
|
|
236
|
-
return if (toUpdate.size == buttons.size) {
|
|
237
|
-
hasChangedOrder()
|
|
238
|
-
} else toAdd.isNotEmpty() || toRemove.isNotEmpty()
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
if (needsRebuild()) {
|
|
242
|
-
toUpdate = mutableMapOf()
|
|
243
|
-
toAdd = requestedButtons
|
|
244
|
-
toRemove = btnControllers.toMap()
|
|
245
|
-
if (buttonBar.shouldAnimate)
|
|
246
|
-
TransitionManager.beginDelayedTransition(buttonBar, buttonsTransition)
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
toUpdate.forEach {
|
|
250
|
-
val button = buttons[it.value]
|
|
251
|
-
btnControllers[button.id]?.mergeButtonOptions(button, buttonBar)
|
|
252
|
-
}
|
|
253
|
-
toRemove.forEach {
|
|
254
|
-
buttonBar.removeButton(it.value.buttonIntId)
|
|
255
|
-
}
|
|
256
|
-
toDestroy.values.forEach {
|
|
257
|
-
btnControllers.remove(it.id)
|
|
258
|
-
it.destroy()
|
|
259
|
-
}
|
|
260
|
-
toAdd.forEach {
|
|
261
|
-
val button = buttons[it.value]
|
|
262
|
-
val order = it.value * 10
|
|
263
|
-
val newController = btnControllers[button.id] ?: controllerCreator(button)
|
|
264
|
-
newController.addToMenu(buttonBar, order)
|
|
265
|
-
btnControllers[button.id] = newController
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
fun onConfigurationChanged(
|
|
271
|
-
options: Options,
|
|
272
|
-
leftBtnControllers: MutableMap<String, ButtonController>?,
|
|
273
|
-
rightBtnControllers: MutableMap<String, ButtonController>?
|
|
274
|
-
) {
|
|
275
|
-
leftBtnControllers?.values?.forEach {
|
|
276
|
-
it.onConfigurationChanged(leftButtonBar)
|
|
277
|
-
}
|
|
278
|
-
rightBtnControllers?.values?.forEach {
|
|
279
|
-
it.onConfigurationChanged(rightButtonBar)
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
view.setOverflowButtonColor(options.topBar.rightButtonColor.get(Color.BLACK)!!)
|
|
283
|
-
view.applyTopTabsColors(
|
|
284
|
-
options.topTabs.selectedTabColor,
|
|
285
|
-
options.topTabs.unselectedTabColor
|
|
286
|
-
)
|
|
287
|
-
view.setBorderColor(options.topBar.borderColor.get(DEFAULT_BORDER_COLOR)!!)
|
|
288
|
-
view.setBackgroundColor(options.topBar.background.color.get(Color.WHITE)!!)
|
|
289
|
-
view.setTitleTextColor(options.topBar.title.color.get(TopBar.DEFAULT_TITLE_COLOR)!!)
|
|
290
|
-
view.setSubtitleColor(options.topBar.subtitle.color.get(TopBar.DEFAULT_TITLE_COLOR)!!)
|
|
124
|
+
open fun mergeLeftButtons(toAdd: List<ButtonController>, toRemove: List<ButtonController>) {
|
|
125
|
+
view.clearBackButton()
|
|
126
|
+
toRemove.forEach { view.removeLeftButton(it) }
|
|
127
|
+
forEachIndexed(toAdd) { b: ButtonController, i: Int -> b.addToMenu(leftButtonBar, i * 10) }
|
|
291
128
|
}
|
|
292
129
|
}
|
|
@@ -4,7 +4,6 @@ import android.annotation.SuppressLint
|
|
|
4
4
|
import android.app.Activity
|
|
5
5
|
import android.view.Menu
|
|
6
6
|
import android.view.MenuItem
|
|
7
|
-
import android.view.View
|
|
8
7
|
import androidx.appcompat.widget.Toolbar
|
|
9
8
|
import com.reactnativenavigation.options.ButtonOptions
|
|
10
9
|
import com.reactnativenavigation.options.Options
|
|
@@ -23,8 +22,7 @@ open class ButtonController(activity: Activity,
|
|
|
23
22
|
private val viewCreator: TitleBarButtonCreator,
|
|
24
23
|
private val onPressListener: OnClickListener) : ViewController<TitleBarReactButtonView>(activity, button.id, YellowBoxDelegate(activity), Options(), ViewControllerOverlay(activity)), MenuItem.OnMenuItemClickListener {
|
|
25
24
|
|
|
26
|
-
var menuItem: MenuItem? = null
|
|
27
|
-
private set
|
|
25
|
+
private var menuItem: MenuItem? = null
|
|
28
26
|
|
|
29
27
|
interface OnClickListener {
|
|
30
28
|
fun onPress(button: ButtonOptions)
|
|
@@ -73,10 +71,6 @@ open class ButtonController(activity: Activity,
|
|
|
73
71
|
return if (other.id != id) false else button.equals(other.button)
|
|
74
72
|
}
|
|
75
73
|
|
|
76
|
-
fun areButtonOptionsChanged(otherOptions:ButtonOptions):Boolean{
|
|
77
|
-
return otherOptions.id == id && !button.equals(otherOptions)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
74
|
fun applyNavigationIcon(toolbar: Toolbar) {
|
|
81
75
|
presenter.applyNavigationIcon(toolbar) {
|
|
82
76
|
onPressListener.onPress(it)
|
|
@@ -89,34 +83,13 @@ open class ButtonController(activity: Activity,
|
|
|
89
83
|
|
|
90
84
|
fun addToMenu(buttonBar: ButtonBar, order: Int) {
|
|
91
85
|
if (button.component.hasValue() && buttonBar.containsButton(menuItem, order)) return
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
buttonBar.menu.removeItem(button.intId)
|
|
87
|
+
menuItem = buttonBar.addButton(Menu.NONE,
|
|
94
88
|
button.intId,
|
|
95
89
|
order,
|
|
96
90
|
presenter.styledText)?.also { menuItem ->
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
fun mergeButtonOptions(optionsToMerge: ButtonOptions,buttonBar: ButtonBar) {
|
|
103
|
-
button.mergeWith(optionsToMerge)
|
|
104
|
-
presenter.button = this.button
|
|
105
|
-
buttonBar.getButtonById(button.intId)?.let {
|
|
106
|
-
menuItem->
|
|
107
|
-
presenter.applyOptions(buttonBar,menuItem,this::getView)
|
|
91
|
+
menuItem.setOnMenuItemClickListener(this@ButtonController)
|
|
92
|
+
presenter.applyOptions(buttonBar, menuItem, this@ButtonController::getView)
|
|
108
93
|
}
|
|
109
94
|
}
|
|
110
|
-
|
|
111
|
-
fun onConfigurationChanged(buttonBar: ButtonBar) {
|
|
112
|
-
buttonBar.getButtonById(button.intId)?.let {
|
|
113
|
-
menuItem->
|
|
114
|
-
presenter.applyOptions(buttonBar,menuItem,this::getView)
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
fun getNullableView(): View?{
|
|
119
|
-
return view
|
|
120
|
-
}
|
|
121
|
-
|
|
122
95
|
}
|
|
@@ -25,8 +25,7 @@ import com.reactnativenavigation.utils.ViewUtils
|
|
|
25
25
|
import com.reactnativenavigation.views.stack.topbar.titlebar.IconBackgroundDrawable
|
|
26
26
|
import kotlin.math.max
|
|
27
27
|
|
|
28
|
-
open class ButtonPresenter(private val context: Context,
|
|
29
|
-
IconResolver) {
|
|
28
|
+
open class ButtonPresenter(private val context: Context, private val button: ButtonOptions, private val iconResolver: IconResolver) {
|
|
30
29
|
companion object {
|
|
31
30
|
const val DISABLED_COLOR = Color.LTGRAY
|
|
32
31
|
}
|
|
@@ -48,8 +47,6 @@ IconResolver) {
|
|
|
48
47
|
applyComponent(menuItem, viewCreator)
|
|
49
48
|
applyAccessibilityLabel(menuItem)
|
|
50
49
|
applyIcon(menuItem)
|
|
51
|
-
applyText(menuItem)
|
|
52
|
-
|
|
53
50
|
|
|
54
51
|
applyOptionsDirectlyOnView(toolbar, menuItem) {
|
|
55
52
|
applyTestId(it)
|
|
@@ -58,11 +55,6 @@ IconResolver) {
|
|
|
58
55
|
}
|
|
59
56
|
}
|
|
60
57
|
|
|
61
|
-
private fun applyText(menuItem: MenuItem) {
|
|
62
|
-
if (button.text.hasValue())
|
|
63
|
-
menuItem.title = styledText
|
|
64
|
-
}
|
|
65
|
-
|
|
66
58
|
fun applyColor(toolbar: Toolbar, menuItem: MenuItem, color: ThemeColour) {
|
|
67
59
|
button.color = color
|
|
68
60
|
applyIcon(menuItem)
|
|
@@ -11,6 +11,7 @@ import androidx.annotation.VisibleForTesting;
|
|
|
11
11
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
12
12
|
|
|
13
13
|
import kotlin.Unit;
|
|
14
|
+
import kotlin.jvm.functions.Function0;
|
|
14
15
|
|
|
15
16
|
import static com.reactnativenavigation.utils.CoordinatorLayoutUtils.matchParentWithBehaviour;
|
|
16
17
|
|
|
@@ -12,13 +12,11 @@ import android.view.ViewTreeObserver;
|
|
|
12
12
|
|
|
13
13
|
import androidx.annotation.CallSuper;
|
|
14
14
|
import androidx.annotation.CheckResult;
|
|
15
|
-
import androidx.annotation.NonNull;
|
|
16
15
|
import androidx.annotation.Nullable;
|
|
17
16
|
import androidx.annotation.VisibleForTesting;
|
|
18
17
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
19
18
|
|
|
20
19
|
import com.reactnativenavigation.options.Options;
|
|
21
|
-
import com.reactnativenavigation.options.OverlayAttachOptions;
|
|
22
20
|
import com.reactnativenavigation.options.params.Bool;
|
|
23
21
|
import com.reactnativenavigation.options.params.NullBool;
|
|
24
22
|
import com.reactnativenavigation.react.CommandListener;
|
|
@@ -30,7 +28,6 @@ import com.reactnativenavigation.viewcontrollers.parent.ParentController;
|
|
|
30
28
|
import com.reactnativenavigation.viewcontrollers.stack.StackController;
|
|
31
29
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.overlay.ViewControllerOverlay;
|
|
32
30
|
import com.reactnativenavigation.views.BehaviourAdapter;
|
|
33
|
-
import com.reactnativenavigation.views.overlay.ViewTooltip;
|
|
34
31
|
import com.reactnativenavigation.views.component.Component;
|
|
35
32
|
import com.reactnativenavigation.views.component.Renderable;
|
|
36
33
|
|
|
@@ -395,15 +392,6 @@ public abstract class ViewController<T extends ViewGroup> implements ViewTreeObs
|
|
|
395
392
|
|
|
396
393
|
}
|
|
397
394
|
|
|
398
|
-
protected View findTooltipAnchorView(OverlayAttachOptions options) {
|
|
399
|
-
return null;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
public ViewTooltip.TooltipView showAnchoredOverlay(@NonNull View anchorView,
|
|
403
|
-
@NonNull OverlayAttachOptions overlayAttachOptions,
|
|
404
|
-
@NonNull ViewController<?> overlayViewController) {
|
|
405
|
-
return null;
|
|
406
|
-
}
|
|
407
395
|
public int getBottomInset() {
|
|
408
396
|
return perform(parentController, 0, p -> p.getBottomInset(this));
|
|
409
397
|
}
|
package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabs.java
CHANGED
|
@@ -12,9 +12,7 @@ import com.reactnativenavigation.R;
|
|
|
12
12
|
import com.reactnativenavigation.options.LayoutDirection;
|
|
13
13
|
|
|
14
14
|
import java.util.ArrayList;
|
|
15
|
-
import java.util.HashMap;
|
|
16
15
|
import java.util.List;
|
|
17
|
-
import java.util.Map;
|
|
18
16
|
|
|
19
17
|
import androidx.annotation.IntRange;
|
|
20
18
|
|
|
@@ -23,11 +21,10 @@ import static com.reactnativenavigation.utils.ViewUtils.findChildByClass;
|
|
|
23
21
|
|
|
24
22
|
@SuppressLint("ViewConstructor")
|
|
25
23
|
public class BottomTabs extends AHBottomNavigation {
|
|
26
|
-
public final static int TAB_NOT_FOUND = -1;
|
|
27
24
|
private boolean itemsCreationEnabled = true;
|
|
28
25
|
private boolean shouldCreateItems = true;
|
|
29
26
|
private List<Runnable> onItemCreationEnabled = new ArrayList<>();
|
|
30
|
-
|
|
27
|
+
|
|
31
28
|
public BottomTabs(Context context) {
|
|
32
29
|
super(context);
|
|
33
30
|
setId(R.id.bottomTabs);
|
|
@@ -135,29 +132,4 @@ public class BottomTabs extends AHBottomNavigation {
|
|
|
135
132
|
private boolean hasItemsAndIsMeasured(int w, int h, int oldw, int oldh) {
|
|
136
133
|
return w != 0 && h != 0 && (w != oldw || h != oldh) && getItemsCount() > 0;
|
|
137
134
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
public void setTagForTabIndex(int index, String tag) {
|
|
141
|
-
if(tag==null){
|
|
142
|
-
String oldTag = null;
|
|
143
|
-
for(Map.Entry<String,Integer> e: idPositionMapping.entrySet()){
|
|
144
|
-
if(e.getValue() == index){
|
|
145
|
-
oldTag = e.getKey();
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if(oldTag!=null){
|
|
150
|
-
idPositionMapping.remove(oldTag);
|
|
151
|
-
}
|
|
152
|
-
}else{
|
|
153
|
-
idPositionMapping.put(tag,index);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
public int getTabIndexByTag(String tag) {
|
|
158
|
-
if(tag!=null && idPositionMapping.containsKey(tag)){
|
|
159
|
-
return idPositionMapping.get(tag);
|
|
160
|
-
}
|
|
161
|
-
return TAB_NOT_FOUND;
|
|
162
|
-
}
|
|
163
135
|
}
|
|
@@ -10,21 +10,12 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
|
10
10
|
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
|
11
11
|
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
|
|
12
12
|
|
|
13
|
-
import com.reactnativenavigation.views.overlay.AttachedOverlayContainer;
|
|
14
|
-
|
|
15
13
|
public class BottomTabsLayout extends CoordinatorLayout {
|
|
16
14
|
|
|
17
15
|
private BottomTabsContainer bottomTabsContainer;
|
|
18
|
-
final private AttachedOverlayContainer attachedOverlayContainer ;
|
|
19
16
|
|
|
20
17
|
public BottomTabsLayout(Context context) {
|
|
21
18
|
super(context);
|
|
22
|
-
attachedOverlayContainer=new AttachedOverlayContainer(context);
|
|
23
|
-
this.addView(attachedOverlayContainer, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public AttachedOverlayContainer getAttachedOverlayContainer() {
|
|
27
|
-
return attachedOverlayContainer;
|
|
28
19
|
}
|
|
29
20
|
|
|
30
21
|
@Override
|
|
@@ -42,4 +33,4 @@ public class BottomTabsLayout extends CoordinatorLayout {
|
|
|
42
33
|
addView(bottomTabsContainer, lp);
|
|
43
34
|
this.bottomTabsContainer = bottomTabsContainer;
|
|
44
35
|
}
|
|
45
|
-
}
|
|
36
|
+
}
|
package/lib/android/app/src/main/java/com/reactnativenavigation/views/component/ComponentLayout.java
CHANGED
|
@@ -4,16 +4,15 @@ import android.annotation.SuppressLint;
|
|
|
4
4
|
import android.content.Context;
|
|
5
5
|
import android.view.MotionEvent;
|
|
6
6
|
import android.view.ViewGroup;
|
|
7
|
+
import android.view.WindowInsets;
|
|
7
8
|
|
|
8
9
|
import com.reactnativenavigation.options.ButtonOptions;
|
|
9
|
-
import com.reactnativenavigation.utils.CoordinatorLayoutUtils;
|
|
10
10
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.ScrollEventListener;
|
|
11
11
|
import com.reactnativenavigation.options.Options;
|
|
12
12
|
import com.reactnativenavigation.options.params.Bool;
|
|
13
13
|
import com.reactnativenavigation.react.ReactView;
|
|
14
14
|
import com.reactnativenavigation.react.events.ComponentType;
|
|
15
15
|
import com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonController;
|
|
16
|
-
import com.reactnativenavigation.views.overlay.AttachedOverlayContainer;
|
|
17
16
|
import com.reactnativenavigation.views.touch.OverlayTouchDelegate;
|
|
18
17
|
|
|
19
18
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
@@ -26,21 +25,14 @@ public class ComponentLayout extends CoordinatorLayout implements ReactComponent
|
|
|
26
25
|
private boolean willAppearSent = false;
|
|
27
26
|
private ReactView reactView;
|
|
28
27
|
private final OverlayTouchDelegate touchDelegate;
|
|
29
|
-
final private AttachedOverlayContainer attachedOverlayContainer ;
|
|
30
28
|
|
|
31
29
|
public ComponentLayout(Context context, ReactView reactView) {
|
|
32
30
|
super(context);
|
|
33
31
|
this.reactView = reactView;
|
|
34
|
-
attachedOverlayContainer = new AttachedOverlayContainer(context);
|
|
35
32
|
addView(reactView.asView(), matchParentLP());
|
|
36
|
-
addView(attachedOverlayContainer, CoordinatorLayoutUtils.matchParentLP());
|
|
37
33
|
touchDelegate = new OverlayTouchDelegate(this, reactView);
|
|
38
34
|
}
|
|
39
35
|
|
|
40
|
-
public AttachedOverlayContainer getAttachedOverlayContainer() {
|
|
41
|
-
return attachedOverlayContainer;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
36
|
@Override
|
|
45
37
|
public boolean isReady() {
|
|
46
38
|
return reactView.isReady();
|
|
@@ -117,4 +109,4 @@ public class ComponentLayout extends CoordinatorLayout implements ReactComponent
|
|
|
117
109
|
public boolean superOnInterceptTouchEvent(MotionEvent event) {
|
|
118
110
|
return super.onInterceptTouchEvent(event);
|
|
119
111
|
}
|
|
120
|
-
}
|
|
112
|
+
}
|
package/lib/android/app/src/main/java/com/reactnativenavigation/views/sidemenu/SideMenuRoot.java
CHANGED
|
@@ -12,7 +12,6 @@ import com.reactnativenavigation.options.SideMenuOptions;
|
|
|
12
12
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController;
|
|
13
13
|
import com.reactnativenavigation.views.BehaviourAdapter;
|
|
14
14
|
import com.reactnativenavigation.views.BehaviourDelegate;
|
|
15
|
-
import com.reactnativenavigation.views.overlay.AttachedOverlayContainer;
|
|
16
15
|
|
|
17
16
|
import androidx.annotation.RestrictTo;
|
|
18
17
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
@@ -24,16 +23,9 @@ import static com.reactnativenavigation.utils.CoordinatorLayoutUtils.matchParent
|
|
|
24
23
|
|
|
25
24
|
public class SideMenuRoot extends CoordinatorLayout {
|
|
26
25
|
private SideMenu sideMenu;
|
|
27
|
-
final private AttachedOverlayContainer attachedOverlayContainer ;
|
|
28
26
|
|
|
29
27
|
public SideMenuRoot(Context context) {
|
|
30
28
|
super(context);
|
|
31
|
-
attachedOverlayContainer = new AttachedOverlayContainer(context);
|
|
32
|
-
addView(attachedOverlayContainer,LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public AttachedOverlayContainer getAttachedOverlayContainer() {
|
|
36
|
-
return attachedOverlayContainer;
|
|
37
29
|
}
|
|
38
30
|
|
|
39
31
|
public void addSideMenu(SideMenu sideMenu, BehaviourAdapter behaviourAdapter) {
|
|
@@ -97,4 +89,4 @@ public class SideMenuRoot extends CoordinatorLayout {
|
|
|
97
89
|
public SideMenu getSideMenu() {
|
|
98
90
|
return sideMenu;
|
|
99
91
|
}
|
|
100
|
-
}
|
|
92
|
+
}
|
package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/StackLayout.java
CHANGED
|
@@ -9,7 +9,6 @@ import com.reactnativenavigation.viewcontrollers.stack.topbar.TopBarController;
|
|
|
9
9
|
import com.reactnativenavigation.views.component.Component;
|
|
10
10
|
import com.reactnativenavigation.views.component.Renderable;
|
|
11
11
|
import com.reactnativenavigation.views.stack.topbar.ScrollDIsabledBehavior;
|
|
12
|
-
import com.reactnativenavigation.views.overlay.AttachedOverlayContainer;
|
|
13
12
|
|
|
14
13
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
15
14
|
|
|
@@ -18,27 +17,18 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
|
|
18
17
|
@SuppressLint("ViewConstructor")
|
|
19
18
|
public class StackLayout extends CoordinatorLayout implements Component {
|
|
20
19
|
private String stackId;
|
|
21
|
-
final private AttachedOverlayContainer attachedOverlayContainer ;
|
|
22
20
|
|
|
23
21
|
public StackLayout(Context context, TopBarController topBarController, String stackId) {
|
|
24
22
|
super(context);
|
|
25
23
|
this.stackId = stackId;
|
|
26
|
-
attachedOverlayContainer = new AttachedOverlayContainer(getContext());
|
|
27
24
|
createLayout(topBarController);
|
|
28
25
|
}
|
|
29
26
|
|
|
30
|
-
public AttachedOverlayContainer getAttachedOverlayContainer() {
|
|
31
|
-
return attachedOverlayContainer;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
27
|
private void createLayout(TopBarController topBarController) {
|
|
35
28
|
View topBar = topBarController.createView(getContext(), this);
|
|
36
|
-
|
|
37
29
|
CoordinatorLayout.LayoutParams lp = new LayoutParams(MATCH_PARENT, UiUtils.getTopBarHeight(getContext()));
|
|
38
30
|
lp.setBehavior(new ScrollDIsabledBehavior());
|
|
39
31
|
addView(topBar, lp);
|
|
40
|
-
addView(attachedOverlayContainer,LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
|
|
41
|
-
|
|
42
32
|
}
|
|
43
33
|
|
|
44
34
|
public String getStackId() {
|
|
@@ -47,8 +37,8 @@ public class StackLayout extends CoordinatorLayout implements Component {
|
|
|
47
37
|
|
|
48
38
|
@Override
|
|
49
39
|
public boolean isRendered() {
|
|
50
|
-
return getChildCount() >=
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
return getChildCount() >= 2 &&
|
|
41
|
+
getChildAt(1) instanceof Renderable &&
|
|
42
|
+
((Renderable) getChildAt(1)).isRendered();
|
|
53
43
|
}
|
|
54
|
-
}
|
|
44
|
+
}
|
package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/TopBar.java
CHANGED
|
@@ -31,6 +31,7 @@ import com.reactnativenavigation.options.params.Number;
|
|
|
31
31
|
import com.reactnativenavigation.options.params.ThemeColour;
|
|
32
32
|
import com.reactnativenavigation.options.parsers.TypefaceLoader;
|
|
33
33
|
import com.reactnativenavigation.utils.CompatUtils;
|
|
34
|
+
import com.reactnativenavigation.utils.ContextKt;
|
|
34
35
|
import com.reactnativenavigation.utils.UiUtils;
|
|
35
36
|
import com.reactnativenavigation.viewcontrollers.stack.topbar.TopBarCollapseBehavior;
|
|
36
37
|
import com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonController;
|