1 |
gabriel |
1 |
package com.cesams.twogetskills.inconcert.fragment;
|
|
|
2 |
|
|
|
3 |
import android.content.Intent;
|
|
|
4 |
import android.graphics.drawable.AnimationDrawable;
|
|
|
5 |
import android.net.Uri;
|
|
|
6 |
import android.os.Bundle;
|
|
|
7 |
|
|
|
8 |
import androidx.annotation.NonNull;
|
|
|
9 |
import androidx.annotation.Nullable;
|
|
|
10 |
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
|
11 |
import androidx.fragment.app.Fragment;
|
|
|
12 |
|
|
|
13 |
import android.os.Handler;
|
|
|
14 |
import android.os.Looper;
|
|
|
15 |
import android.view.LayoutInflater;
|
|
|
16 |
import android.view.Menu;
|
|
|
17 |
import android.view.MenuInflater;
|
|
|
18 |
import android.view.View;
|
|
|
19 |
import android.view.ViewGroup;
|
|
|
20 |
import android.widget.Button;
|
|
|
21 |
import android.widget.ImageView;
|
|
|
22 |
import android.widget.TextView;
|
|
|
23 |
import android.widget.Toast;
|
|
|
24 |
|
|
|
25 |
import com.airbnb.lottie.LottieAnimationView;
|
|
|
26 |
import com.cesams.twogetskills.inconcert.Constants;
|
|
|
27 |
import com.cesams.twogetskills.inconcert.R;
|
|
|
28 |
import com.cesams.twogetskills.inconcert.skeleton.ITwoGetSkills;
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
public class IntroFragment extends Fragment {
|
|
|
32 |
|
|
|
33 |
private Button buttonGetStarted;
|
|
|
34 |
private ITwoGetSkills iTwoGetSkills;
|
2 |
gabriel |
35 |
LottieAnimationView figura; int stepper=0;
|
1 |
gabriel |
36 |
private TextView appname,introtext,signin,derechos;
|
|
|
37 |
AnimationDrawable rocketAnimation;
|
10 |
gabriel |
38 |
ImageView minisplash, lamp,buho;
|
1 |
gabriel |
39 |
ConstraintLayout fondosplash;
|
|
|
40 |
|
|
|
41 |
public IntroFragment() {
|
|
|
42 |
// Required empty public constructor
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
@Override
|
|
|
48 |
public void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
49 |
super.onCreate(savedInstanceState);
|
|
|
50 |
setHasOptionsMenu(true);
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
@Override
|
|
|
54 |
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
|
|
55 |
super.onCreateOptionsMenu(menu, inflater);
|
|
|
56 |
menu.clear();
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
@Override
|
|
|
60 |
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
|
61 |
Bundle savedInstanceState) {
|
|
|
62 |
// Inflate the layout for this fragment
|
|
|
63 |
return inflater.inflate(R.layout.fragment_intro, container, false);
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
@Override
|
|
|
67 |
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
|
|
68 |
super.onViewCreated(view, savedInstanceState);
|
|
|
69 |
|
|
|
70 |
fondosplash=view.findViewById(R.id.fondosplash);
|
10 |
gabriel |
71 |
fondosplash.setBackgroundResource(R.drawable.ic_splash);
|
|
|
72 |
minisplash=view.findViewById(R.id.minisplash);
|
|
|
73 |
minisplash.setVisibility(View.VISIBLE);
|
1 |
gabriel |
74 |
lamp=view.findViewById(R.id.imageView5);
|
|
|
75 |
buho=view.findViewById(R.id.imageView6);
|
|
|
76 |
appname=view.findViewById(R.id.textView20);
|
|
|
77 |
buttonGetStarted = getView().findViewById(R.id.intro_button_get_started);
|
|
|
78 |
introtext = getView().findViewById(R.id.intro_textview_title);
|
7 |
gabriel |
79 |
signin = getView().findViewById(R.id.signin_textview_communique_easily);
|
1 |
gabriel |
80 |
|
10 |
gabriel |
81 |
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
|
|
|
82 |
@Override
|
|
|
83 |
public void run() {
|
1 |
gabriel |
84 |
|
10 |
gabriel |
85 |
fondosplash.setBackgroundResource(R.drawable.ic_winbackground);
|
|
|
86 |
minisplash.setVisibility(View.GONE);
|
|
|
87 |
lamp.setVisibility(View.VISIBLE);
|
|
|
88 |
buho.setVisibility(View.VISIBLE);
|
|
|
89 |
appname.setVisibility(View.VISIBLE);
|
|
|
90 |
introtext.setVisibility(View.VISIBLE);
|
|
|
91 |
buttonGetStarted.setVisibility(View.VISIBLE); //cesa.setVisibility(View.VISIBLE);
|
|
|
92 |
signin.setVisibility(View.VISIBLE);
|
|
|
93 |
}
|
|
|
94 |
}, 4000);
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
|
1 |
gabriel |
98 |
try {
|
|
|
99 |
iTwoGetSkills = (ITwoGetSkills) getActivity();
|
|
|
100 |
iTwoGetSkills.hideNavigationAndtoolbar();
|
|
|
101 |
|
|
|
102 |
} catch(ClassCastException e) {
|
|
|
103 |
new Exception("La Actividad no implementa Sign");
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
/*
|
|
|
107 |
register.setOnClickListener(new View.OnClickListener() {
|
|
|
108 |
@Override
|
|
|
109 |
public void onClick(View view) {
|
|
|
110 |
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://cesams.com"));
|
|
|
111 |
try{
|
|
|
112 |
startActivity(browserIntent);
|
|
|
113 |
}catch (Exception e)
|
|
|
114 |
{
|
|
|
115 |
Toast.makeText(getContext(), "Necesitas un navegador para ver esta web", Toast.LENGTH_SHORT).show();
|
|
|
116 |
}
|
|
|
117 |
}
|
|
|
118 |
});
|
|
|
119 |
*/
|
|
|
120 |
buttonGetStarted.setOnClickListener(new View.OnClickListener() {
|
|
|
121 |
@Override
|
|
|
122 |
public void onClick(View view) {
|
|
|
123 |
|
2 |
gabriel |
124 |
stepper=stepper+1;
|
|
|
125 |
if(stepper==1){
|
|
|
126 |
introtext.setText(R.string.intro_unlimite_time_to_learn);
|
|
|
127 |
signin.setText(R.string.intro_time_rithm);
|
|
|
128 |
lamp.setImageResource(R.drawable.infinitepreview);
|
|
|
129 |
}
|
|
|
130 |
if(stepper==2)
|
|
|
131 |
{
|
|
|
132 |
introtext.setText(R.string.start_aventure);
|
|
|
133 |
signin.setText(R.string.intro_signin_session);
|
|
|
134 |
lamp.setImageResource(R.drawable.userpreview);
|
|
|
135 |
}
|
|
|
136 |
if(stepper==3 || stepper>3)
|
|
|
137 |
{
|
|
|
138 |
|
8 |
gabriel |
139 |
iTwoGetSkills.invokeFragment(Constants.IDX_FRAGMENT_SIGNIN);
|
|
|
140 |
|
2 |
gabriel |
141 |
}
|
|
|
142 |
|
1 |
gabriel |
143 |
}
|
|
|
144 |
});
|
|
|
145 |
}
|
|
|
146 |
|
|
|
147 |
}
|