@@ -24,7 +24,7 @@ public class OnboardingActivity extends AppCompatActivity {
24
24
private @ ColorRes int backgroundColorResId ;
25
25
26
26
private final static String ONBOARDING_FRAGMENT_LIST = "ONBOARDING_FRAGMENT_LIST" ;
27
- private List <OnboardingFragment > onboardingFragmentList ; //TODO make this an array instead?
27
+ private List <OnboardingPage > onboardingPages ;
28
28
29
29
public final static String SWIPING_ENABLED = "SWIPING_ENABLED" ;
30
30
@@ -36,43 +36,43 @@ public class OnboardingActivity extends AppCompatActivity {
36
36
private boolean hideDotPagination ;
37
37
38
38
//region Static Factory Methods
39
- public static Bundle newBundleImageBackground (@ DrawableRes int backgroundImageResId , @ NonNull List <OnboardingFragment > onboardingFragmentList ) {
39
+ public static Bundle newBundleImageBackground (@ DrawableRes int backgroundImageResId , @ NonNull List <OnboardingPage > onboardingPages ) {
40
40
Bundle bundle = new Bundle ();
41
41
bundle .putInt (BACKGROUND_IMAGE_RES_ID , backgroundImageResId );
42
42
43
43
//Lists are serializable in Java
44
- bundle .putSerializable (ONBOARDING_FRAGMENT_LIST , (Serializable ) onboardingFragmentList );
44
+ bundle .putSerializable (ONBOARDING_FRAGMENT_LIST , (Serializable ) onboardingPages );
45
45
return bundle ;
46
46
}
47
47
48
- public static Bundle newBundleColorBackground (@ ColorRes int backgroundColorResId , @ NonNull List <OnboardingFragment > onboardingFragmentList ) {
48
+ public static Bundle newBundleColorBackground (@ ColorRes int backgroundColorResId , @ NonNull List <OnboardingPage > onboardingPages ) {
49
49
Bundle bundle = new Bundle ();
50
50
bundle .putInt (BACKGROUND_COLOR_RES_ID , backgroundColorResId );
51
51
52
52
//Lists are serializable in Java
53
- bundle .putSerializable (ONBOARDING_FRAGMENT_LIST , (Serializable ) onboardingFragmentList );
53
+ bundle .putSerializable (ONBOARDING_FRAGMENT_LIST , (Serializable ) onboardingPages );
54
54
return bundle ;
55
55
}
56
56
57
- public static Bundle newBundleImageBackground (@ DrawableRes int backgroundImageResId , boolean swipingEnabled , boolean hideDotPagination , @ NonNull List <OnboardingFragment > onboardingFragmentList ) {
57
+ public static Bundle newBundleImageBackground (@ DrawableRes int backgroundImageResId , boolean swipingEnabled , boolean hideDotPagination , @ NonNull List <OnboardingPage > onboardingPages ) {
58
58
Bundle bundle = new Bundle ();
59
59
bundle .putInt (BACKGROUND_IMAGE_RES_ID , backgroundImageResId );
60
60
bundle .putBoolean (SWIPING_ENABLED , swipingEnabled );
61
61
bundle .putBoolean (HIDE_DOT_PAGINATION , hideDotPagination );
62
62
63
63
//Lists are serializable in Java
64
- bundle .putSerializable (ONBOARDING_FRAGMENT_LIST , (Serializable ) onboardingFragmentList );
64
+ bundle .putSerializable (ONBOARDING_FRAGMENT_LIST , (Serializable ) onboardingPages );
65
65
return bundle ;
66
66
}
67
67
68
- public static Bundle newBundleColorBackground (@ ColorRes int backgroundColorResId , boolean swipingEnabled , boolean hideDotPagination , @ NonNull List <OnboardingFragment > onboardingFragmentList ) {
68
+ public static Bundle newBundleColorBackground (@ ColorRes int backgroundColorResId , boolean swipingEnabled , boolean hideDotPagination , @ NonNull List <OnboardingPage > onboardingPages ) {
69
69
Bundle bundle = new Bundle ();
70
70
bundle .putInt (BACKGROUND_COLOR_RES_ID , backgroundColorResId );
71
71
bundle .putBoolean (SWIPING_ENABLED , swipingEnabled );
72
72
bundle .putBoolean (HIDE_DOT_PAGINATION , hideDotPagination );
73
73
74
74
//Lists are serializable in Java
75
- bundle .putSerializable (ONBOARDING_FRAGMENT_LIST , (Serializable ) onboardingFragmentList );
75
+ bundle .putSerializable (ONBOARDING_FRAGMENT_LIST , (Serializable ) onboardingPages );
76
76
return bundle ;
77
77
}
78
78
//endregion
@@ -86,11 +86,11 @@ protected void onCreate(Bundle savedInstanceState) {
86
86
Bundle bundle = getIntent ().getExtras ();
87
87
88
88
//Todo need to implement a non-swiping version
89
- swipingEnabled = bundle .getBoolean (SWIPING_ENABLED ,true );
89
+ swipingEnabled = bundle .getBoolean (SWIPING_ENABLED , true );
90
90
hideDotPagination = bundle .getBoolean (HIDE_DOT_PAGINATION , false );
91
91
backgroundImageResId = bundle .getInt (BACKGROUND_IMAGE_RES_ID , -1 ); //-1 means that no image was passed
92
92
backgroundColorResId = bundle .getInt (BACKGROUND_COLOR_RES_ID ,-1 );
93
- onboardingFragmentList = (List <OnboardingFragment >) bundle .getSerializable (ONBOARDING_FRAGMENT_LIST );
93
+ onboardingPages = (List <OnboardingPage >) bundle .getSerializable (ONBOARDING_FRAGMENT_LIST );
94
94
95
95
//Set the view pager
96
96
//TODO Implement a non-swiping version
@@ -123,12 +123,13 @@ public OnboardingFragmentPagerAdapter(FragmentManager fragmentManager) {
123
123
124
124
@ Override
125
125
public Fragment getItem (int position ) {
126
- return onboardingFragmentList .get (position );
126
+ //Build a new fragment from an Onboarding Page (Since Fragment bundles don't seem to be serializable
127
+ return OnboardingFragment .newInstance (onboardingPages .get (position ));
127
128
}
128
129
129
130
@ Override
130
131
public int getCount () {
131
- return onboardingFragmentList .size ();
132
+ return onboardingPages .size ();
132
133
}
133
134
}
134
135
}
0 commit comments