|
@@ -5,6 +5,7 @@ import android.graphics.drawable.Drawable;
|
5
|
5
|
import android.os.AsyncTask;
|
6
|
6
|
import android.os.Bundle;
|
7
|
7
|
import android.view.Menu;
|
|
8
|
+import android.view.View;
|
8
|
9
|
import android.widget.FrameLayout;
|
9
|
10
|
|
10
|
11
|
import com.aurelhubert.ahbottomnavigation.AHBottomNavigation;
|
|
@@ -102,13 +103,6 @@ public class BottomTabActivity extends BaseReactActivity implements AHBottomNavi
|
102
|
103
|
}
|
103
|
104
|
}
|
104
|
105
|
|
105
|
|
- @Override
|
106
|
|
- public boolean onCreateOptionsMenu(Menu menu) {
|
107
|
|
- boolean ret = super.onCreateOptionsMenu(menu);
|
108
|
|
- mToolbar.handleOnCreateOptionsMenuAsync();
|
109
|
|
- return ret;
|
110
|
|
- }
|
111
|
|
-
|
112
|
106
|
@Override
|
113
|
107
|
public void push(Screen screen) {
|
114
|
108
|
super.push(screen);
|
|
@@ -118,6 +112,10 @@ public class BottomTabActivity extends BaseReactActivity implements AHBottomNavi
|
118
|
112
|
}
|
119
|
113
|
}
|
120
|
114
|
StyleHelper.updateStyles(mToolbar, getCurrentScreen());
|
|
115
|
+
|
|
116
|
+ if (shouldToggleTabs(screen)) {
|
|
117
|
+ toggleTabs(screen.bottomTabsHidden, false);
|
|
118
|
+ }
|
121
|
119
|
}
|
122
|
120
|
|
123
|
121
|
@Override
|
|
@@ -126,7 +124,13 @@ public class BottomTabActivity extends BaseReactActivity implements AHBottomNavi
|
126
|
124
|
for (ScreenStack stack : mScreenStacks) {
|
127
|
125
|
if (stack.peek().navigatorId.equals(navigatorId)) {
|
128
|
126
|
Screen popped = stack.pop();
|
129
|
|
- StyleHelper.updateStyles(mToolbar, getCurrentScreen());
|
|
127
|
+ Screen currentScreen = getCurrentScreen();
|
|
128
|
+ StyleHelper.updateStyles(mToolbar, currentScreen);
|
|
129
|
+
|
|
130
|
+ if (shouldToggleTabs(currentScreen)) {
|
|
131
|
+ toggleTabs(currentScreen.bottomTabsHidden, false);
|
|
132
|
+ }
|
|
133
|
+
|
130
|
134
|
return popped;
|
131
|
135
|
}
|
132
|
136
|
}
|
|
@@ -139,7 +143,13 @@ public class BottomTabActivity extends BaseReactActivity implements AHBottomNavi
|
139
|
143
|
for (ScreenStack stack : mScreenStacks) {
|
140
|
144
|
if (stack.peek().navigatorId.equals(navigatorId)) {
|
141
|
145
|
Screen popped = stack.popToRoot();
|
142
|
|
- StyleHelper.updateStyles(mToolbar, getCurrentScreen());
|
|
146
|
+ Screen currentScreen = getCurrentScreen();
|
|
147
|
+ StyleHelper.updateStyles(mToolbar, currentScreen);
|
|
148
|
+
|
|
149
|
+ if (shouldToggleTabs(currentScreen)) {
|
|
150
|
+ toggleTabs(currentScreen.bottomTabsHidden, false);
|
|
151
|
+ }
|
|
152
|
+
|
143
|
153
|
return popped;
|
144
|
154
|
}
|
145
|
155
|
}
|
|
@@ -225,13 +235,24 @@ public class BottomTabActivity extends BaseReactActivity implements AHBottomNavi
|
225
|
235
|
public void toggleTabs(ReadableMap params) {
|
226
|
236
|
boolean hide = params.getBoolean(KEY_HIDDEN);
|
227
|
237
|
boolean animated = params.getBoolean(KEY_ANIMATED);
|
|
238
|
+ toggleTabs(hide, animated);
|
|
239
|
+ }
|
|
240
|
+
|
|
241
|
+ // TODO: support animated = false -guyca
|
|
242
|
+ private void toggleTabs(boolean hide, boolean animated) {
|
228
|
243
|
if (hide) {
|
229
|
|
- mBottomNavigation.hideBottomNavigation(animated);
|
|
244
|
+// mBottomNavigation.hideBottomNavigation(animated);
|
|
245
|
+ mBottomNavigation.setVisibility(View.GONE);
|
230
|
246
|
} else {
|
231
|
|
- mBottomNavigation.restoreBottomNavigation(animated);
|
|
247
|
+ mBottomNavigation.setVisibility(View.VISIBLE);
|
|
248
|
+// mBottomNavigation.restoreBottomNavigation(animated);
|
232
|
249
|
}
|
233
|
250
|
}
|
234
|
251
|
|
|
252
|
+ private boolean shouldToggleTabs(Screen newScreen) {
|
|
253
|
+ return mBottomNavigation.isShown() == newScreen.bottomTabsHidden;
|
|
254
|
+ }
|
|
255
|
+
|
235
|
256
|
private static class SetupTabsTask extends AsyncTask<Void, Void, Map<Screen, Drawable>> {
|
236
|
257
|
private BottomTabActivity mActivity;
|
237
|
258
|
private RnnToolBar mToolBar;
|