|
@@ -12,63 +12,63 @@ import com.reactnativenavigation.utils.CommandListenerAdapter;
|
12
|
12
|
import com.reactnativenavigation.viewcontrollers.Navigator;
|
13
|
13
|
|
14
|
14
|
public class NavigationActivity extends AppCompatActivity implements DefaultHardwareBackBtnHandler {
|
15
|
|
- protected Navigator navigator;
|
|
15
|
+ protected Navigator navigator;
|
16
|
16
|
|
17
|
|
- @Override
|
18
|
|
- protected void onCreate(@Nullable Bundle savedInstanceState) {
|
19
|
|
- super.onCreate(savedInstanceState);
|
20
|
|
- navigator = new Navigator(this, new OverlayManager());
|
21
|
|
- getReactGateway().onActivityCreated(this);
|
22
|
|
- getReactGateway().addReloadListener(navigator);
|
23
|
|
- setContentView(navigator.getView());
|
24
|
|
- }
|
|
17
|
+ @Override
|
|
18
|
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
19
|
+ super.onCreate(savedInstanceState);
|
|
20
|
+ navigator = new Navigator(this, new OverlayManager());
|
|
21
|
+ getReactGateway().onActivityCreated(this);
|
|
22
|
+ getReactGateway().addReloadListener(navigator);
|
|
23
|
+ setContentView(navigator.getView());
|
|
24
|
+ }
|
25
|
25
|
|
26
|
26
|
@Override
|
27
|
|
- protected void onResume() {
|
28
|
|
- super.onResume();
|
29
|
|
- getReactGateway().onActivityResumed(this);
|
30
|
|
- }
|
|
27
|
+ protected void onResume() {
|
|
28
|
+ super.onResume();
|
|
29
|
+ getReactGateway().onActivityResumed(this);
|
|
30
|
+ }
|
31
|
31
|
|
32
|
|
- @Override
|
33
|
|
- protected void onPause() {
|
34
|
|
- super.onPause();
|
35
|
|
- getReactGateway().onActivityPaused(this);
|
36
|
|
- }
|
|
32
|
+ @Override
|
|
33
|
+ protected void onPause() {
|
|
34
|
+ super.onPause();
|
|
35
|
+ getReactGateway().onActivityPaused(this);
|
|
36
|
+ }
|
37
|
37
|
|
38
|
|
- @Override
|
39
|
|
- protected void onDestroy() {
|
40
|
|
- super.onDestroy();
|
41
|
|
- navigator.destroy();
|
42
|
|
- getReactGateway().removeReloadListener(navigator);
|
43
|
|
- getReactGateway().onActivityDestroyed(this);
|
44
|
|
- }
|
|
38
|
+ @Override
|
|
39
|
+ protected void onDestroy() {
|
|
40
|
+ super.onDestroy();
|
|
41
|
+ navigator.destroy();
|
|
42
|
+ getReactGateway().removeReloadListener(navigator);
|
|
43
|
+ getReactGateway().onActivityDestroyed(this);
|
|
44
|
+ }
|
45
|
45
|
|
46
|
|
- @Override
|
47
|
|
- public void invokeDefaultOnBackPressed() {
|
48
|
|
- if (!navigator.handleBack(new CommandListenerAdapter())) {
|
49
|
|
- super.onBackPressed();
|
50
|
|
- }
|
51
|
|
- }
|
|
46
|
+ @Override
|
|
47
|
+ public void invokeDefaultOnBackPressed() {
|
|
48
|
+ if (!navigator.handleBack(new CommandListenerAdapter())) {
|
|
49
|
+ super.onBackPressed();
|
|
50
|
+ }
|
|
51
|
+ }
|
52
|
52
|
|
53
|
|
- @Override
|
54
|
|
- public void onBackPressed() {
|
55
|
|
- getReactGateway().onBackPressed();
|
56
|
|
- }
|
|
53
|
+ @Override
|
|
54
|
+ public void onBackPressed() {
|
|
55
|
+ getReactGateway().onBackPressed();
|
|
56
|
+ }
|
57
|
57
|
|
58
|
|
- @Override
|
59
|
|
- public boolean onKeyUp(final int keyCode, final KeyEvent event) {
|
60
|
|
- return getReactGateway().onKeyUp(keyCode) || super.onKeyUp(keyCode, event);
|
61
|
|
- }
|
|
58
|
+ @Override
|
|
59
|
+ public boolean onKeyUp(final int keyCode, final KeyEvent event) {
|
|
60
|
+ return getReactGateway().onKeyUp(keyCode) || super.onKeyUp(keyCode, event);
|
|
61
|
+ }
|
62
|
62
|
|
63
|
63
|
public ReactGateway getReactGateway() {
|
64
|
64
|
return app().getReactGateway();
|
65
|
65
|
}
|
66
|
66
|
|
67
|
|
- private NavigationApplication app() {
|
68
|
|
- return (NavigationApplication) getApplication();
|
69
|
|
- }
|
|
67
|
+ private NavigationApplication app() {
|
|
68
|
+ return (NavigationApplication) getApplication();
|
|
69
|
+ }
|
70
|
70
|
|
71
|
71
|
public Navigator getNavigator() {
|
72
|
|
- return navigator;
|
73
|
|
- }
|
|
72
|
+ return navigator;
|
|
73
|
+ }
|
74
|
74
|
}
|