|
@@ -5,36 +5,28 @@ import android.app.Activity;
|
5
|
5
|
import android.content.Context;
|
6
|
6
|
import android.graphics.Color;
|
7
|
7
|
import android.os.Build;
|
8
|
|
-import android.os.Bundle;
|
9
|
8
|
import android.support.annotation.ColorInt;
|
10
|
9
|
import android.view.Window;
|
11
|
10
|
import android.widget.LinearLayout;
|
12
|
11
|
|
13
|
12
|
import com.reactnativenavigation.params.ScreenParams;
|
14
|
13
|
import com.reactnativenavigation.params.ScreenStyleParams;
|
15
|
|
-import com.reactnativenavigation.params.TitleBarButtonParams;
|
16
|
14
|
import com.reactnativenavigation.utils.SdkSupports;
|
17
|
15
|
import com.reactnativenavigation.views.ContentView;
|
18
|
16
|
import com.reactnativenavigation.views.ScrollDirectionListener;
|
19
|
17
|
|
20
|
|
-import java.util.List;
|
21
|
|
-
|
22
|
18
|
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
23
|
19
|
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
|
24
|
20
|
|
25
|
21
|
public class ScreenLayout extends LinearLayout implements ScrollDirectionListener.OnScrollChanged {
|
26
|
22
|
|
27
|
|
- private final String screenId;
|
28
|
|
- private final Bundle passProps;
|
29
|
|
- private final List<TitleBarButtonParams> buttons;
|
|
23
|
+ private final ScreenParams screenParams;
|
30
|
24
|
private ContentView contentView;
|
31
|
25
|
private TopBar topBar;
|
32
|
26
|
|
33
|
27
|
public ScreenLayout(Context context, ScreenParams screenParams) {
|
34
|
28
|
super(context);
|
35
|
|
- screenId = screenParams.screenId;
|
36
|
|
- passProps = screenParams.passProps;
|
37
|
|
- buttons = screenParams.buttons;
|
|
29
|
+ this.screenParams = screenParams;
|
38
|
30
|
setOrientation(VERTICAL);
|
39
|
31
|
|
40
|
32
|
createViews();
|
|
@@ -43,7 +35,8 @@ public class ScreenLayout extends LinearLayout implements ScrollDirectionListene
|
43
|
35
|
|
44
|
36
|
private void createViews() {
|
45
|
37
|
addTopBar();
|
46
|
|
- topBar.addTitleBarAndSetButtons(buttons);
|
|
38
|
+ topBar.addTitleBarAndSetButtons(screenParams.buttons);
|
|
39
|
+ topBar.setTitle(screenParams.title);
|
47
|
40
|
addContentView();
|
48
|
41
|
}
|
49
|
42
|
|
|
@@ -53,7 +46,7 @@ public class ScreenLayout extends LinearLayout implements ScrollDirectionListene
|
53
|
46
|
}
|
54
|
47
|
|
55
|
48
|
private void addContentView() {
|
56
|
|
- contentView = new ContentView(getContext(), screenId, passProps, this);
|
|
49
|
+ contentView = new ContentView(getContext(), screenParams.screenId, screenParams.passProps, this);
|
57
|
50
|
addView(contentView, new LayoutParams(MATCH_PARENT, MATCH_PARENT));
|
58
|
51
|
contentView.init();
|
59
|
52
|
}
|