1
+ package id .indosw .liquidswipesample .fragment ;
2
+
3
+ import android .graphics .Color ;
4
+ import android .os .Bundle ;
5
+ import android .view .LayoutInflater ;
6
+ import android .view .View ;
7
+ import android .view .ViewGroup ;
8
+
9
+ import androidx .fragment .app .Fragment ;
10
+
11
+ import org .jetbrains .annotations .NotNull ;
12
+ import org .jetbrains .annotations .Nullable ;
13
+
14
+ import id .indosw .liquidswipesample .R ;
15
+ import kotlin .jvm .internal .Intrinsics ;
16
+
17
+ public final class PageFragmentJava extends Fragment {
18
+ private int position = -1 ;
19
+
20
+ @ SuppressWarnings ("ConstantConditions" )
21
+ public void onCreate (@ Nullable Bundle savedInstanceState ) {
22
+ super .onCreate (savedInstanceState );
23
+ Bundle varBundle = this .getArguments ();
24
+ Integer intPos = varBundle != null ? varBundle .getInt ("POSITION" ) : null ;
25
+ Intrinsics .checkNotNull (intPos );
26
+ this .position = intPos ;
27
+ }
28
+
29
+ @ Nullable
30
+ public View onCreateView (@ NotNull LayoutInflater inflater , @ Nullable ViewGroup container , @ Nullable Bundle savedInstanceState ) {
31
+ Intrinsics .checkNotNullParameter (inflater , "inflater" );
32
+ int viewPos ;
33
+ if (this .position == 1 ) {
34
+ viewPos = R .layout .first_page ;
35
+ } else if (this .position == 2 ) {
36
+ viewPos = R .layout .second_page ;
37
+ } else {
38
+ viewPos = R .layout .fragment_page_number ;
39
+ }
40
+
41
+ int layoutId = viewPos ;
42
+ return this .getLayoutInflater ().inflate (layoutId , container , false );
43
+ }
44
+
45
+ @ SuppressWarnings ("UnnecessaryReturnStatement" )
46
+ public void onViewCreated (@ NotNull View view , @ Nullable Bundle savedInstanceState ) {
47
+ Intrinsics .checkNotNullParameter (view , "view" );
48
+ super .onViewCreated (view , savedInstanceState );
49
+ if (this .position == 1 ) {
50
+ return ;
51
+ } else if (this .position == 2 ) {
52
+ return ;
53
+ } else if (this .position == 3 ) {
54
+ view .setBackgroundColor (
55
+ Color .rgb (
56
+ (int ) 93.000002052D ,
57
+ (int ) 17.0000008857D ,
58
+ (int ) 247.0000004895D )
59
+ );
60
+ } else if (this .position == 4 ) {
61
+ view .setBackgroundColor (
62
+ Color .rgb (255 ,
63
+ (int ) 89.99848992300001D ,
64
+ (int ) 59.648553276D )
65
+ );
66
+ } else if (this .position == 5 ) {
67
+ view .setBackgroundColor (
68
+ Color .rgb (
69
+ (int ) 31.0000000635D ,
70
+ (int ) 3.00000005805D ,
71
+ (int ) 108.0000011565D )
72
+ );
73
+ } else if (this .position == 6 ) {
74
+ view .setBackgroundColor (
75
+ Color .rgb (
76
+ (int ) 87.0000024255D ,
77
+ (int ) 159.00000572099998D ,
78
+ (int ) 43.000001229D )
79
+ );
80
+ } else {
81
+ view .setBackgroundColor (
82
+ Color .rgb (
83
+ (int ) (Math .random () * (double ) 255 ),
84
+ (int ) (Math .random () * (double ) 255 ),
85
+ (int ) (Math .random () * (double ) 255 ))
86
+ );
87
+ }
88
+
89
+ }
90
+ }
0 commit comments