|
@@ -7,6 +7,7 @@ import android.os.Bundle;
|
7
|
7
|
import android.os.Handler;
|
8
|
8
|
import android.provider.Settings;
|
9
|
9
|
import android.support.annotation.CallSuper;
|
|
10
|
+import android.support.v4.widget.DrawerLayout;
|
10
|
11
|
import android.support.v7.app.ActionBarDrawerToggle;
|
11
|
12
|
import android.support.v7.app.AppCompatActivity;
|
12
|
13
|
import android.util.Log;
|
|
@@ -14,6 +15,7 @@ import android.view.KeyEvent;
|
14
|
15
|
import android.view.Menu;
|
15
|
16
|
import android.view.MenuItem;
|
16
|
17
|
import android.widget.EditText;
|
|
18
|
+import android.widget.FrameLayout;
|
17
|
19
|
import android.widget.Toast;
|
18
|
20
|
|
19
|
21
|
import com.facebook.common.logging.FLog;
|
|
@@ -30,12 +32,14 @@ import com.reactnativenavigation.BuildConfig;
|
30
|
32
|
import com.reactnativenavigation.controllers.ModalController;
|
31
|
33
|
import com.reactnativenavigation.core.RctManager;
|
32
|
34
|
import com.reactnativenavigation.core.objects.Button;
|
|
35
|
+import com.reactnativenavigation.core.objects.Drawer;
|
33
|
36
|
import com.reactnativenavigation.core.objects.Screen;
|
34
|
37
|
import com.reactnativenavigation.modal.RnnModal;
|
35
|
38
|
import com.reactnativenavigation.packages.RnnPackage;
|
36
|
39
|
import com.reactnativenavigation.utils.ContextProvider;
|
37
|
40
|
import com.reactnativenavigation.utils.StyleHelper;
|
38
|
41
|
import com.reactnativenavigation.views.RnnToolBar;
|
|
42
|
+import com.reactnativenavigation.views.ScreenStack;
|
39
|
43
|
|
40
|
44
|
import java.util.Arrays;
|
41
|
45
|
import java.util.List;
|
|
@@ -64,6 +68,8 @@ public abstract class BaseReactActivity extends AppCompatActivity implements Def
|
64
|
68
|
private Menu mMenu;
|
65
|
69
|
protected RnnToolBar mToolbar;
|
66
|
70
|
protected ActionBarDrawerToggle mDrawerToggle;
|
|
71
|
+ protected DrawerLayout mDrawerLayout;
|
|
72
|
+ protected ScreenStack mDrawerStack;
|
67
|
73
|
|
68
|
74
|
/**
|
69
|
75
|
* Returns the name of the bundle in assets. If this is null, and no file path is specified for
|
|
@@ -383,6 +389,20 @@ public abstract class BaseReactActivity extends AppCompatActivity implements Def
|
383
|
389
|
super.onBackPressed();
|
384
|
390
|
}
|
385
|
391
|
|
|
392
|
+ protected void setupDrawer(Screen screen, Drawer drawer, int drawerFrameId, int drawerLayoutId) {
|
|
393
|
+ if (drawer == null || drawer.left == null) {
|
|
394
|
+ return;
|
|
395
|
+ }
|
|
396
|
+
|
|
397
|
+ mDrawerStack = new ScreenStack(this);
|
|
398
|
+ FrameLayout drawerFrame = (FrameLayout) findViewById(drawerFrameId);
|
|
399
|
+ drawerFrame.addView(mDrawerStack);
|
|
400
|
+ mDrawerStack.push(drawer.left);
|
|
401
|
+
|
|
402
|
+ mDrawerLayout = (DrawerLayout) findViewById(drawerLayoutId);
|
|
403
|
+ mDrawerToggle = mToolbar.setupDrawer(mDrawerLayout, drawer.left, screen);
|
|
404
|
+ }
|
|
405
|
+
|
386
|
406
|
public void setNavigationButtons(ReadableMap buttons){
|
387
|
407
|
if (mToolbar == null) {
|
388
|
408
|
return;
|