-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathBottomTabsAttacher.java
More file actions
42 lines (32 loc) · 1.33 KB
/
BottomTabsAttacher.java
File metadata and controls
42 lines (32 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.reactnativenavigation.viewcontrollers.bottomtabs.attacher;
import android.view.ViewGroup;
import com.reactnativenavigation.options.Options;
import com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsPresenter;
import com.reactnativenavigation.viewcontrollers.bottomtabs.attacher.modes.AttachMode;
import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController;
import java.util.List;
import androidx.annotation.VisibleForTesting;
public class BottomTabsAttacher {
private final List<ViewController<?>> tabs;
private final BottomTabsPresenter presenter;
private final Options defaultOptions;
@VisibleForTesting
public AttachMode attachStrategy;
public BottomTabsAttacher(List<ViewController<?>> tabs, BottomTabsPresenter presenter, Options defaultOptions) {
this.tabs = tabs;
this.presenter = presenter;
this.defaultOptions = defaultOptions;
}
public void init(ViewGroup parent, Options resolved) {
attachStrategy = AttachMode.get(parent, tabs, presenter, resolved.withDefaultOptions(defaultOptions));
}
public void attach() {
attachStrategy.attach();
}
public void destroy() {
attachStrategy.destroy();
}
public void onTabSelected(ViewController<?> tab) {
attachStrategy.onTabSelected(tab);
}
}