Proyectos de Subversion Android Microlearning - Nuevo Interface

Rev

Rev 47 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 gabriel 1
package com.cesams.twogetskills.fragment;
2
 
21 gabriel 3
import android.content.Intent;
45 gabriel 4
import android.graphics.drawable.AnimationDrawable;
21 gabriel 5
import android.net.Uri;
1 gabriel 6
import android.os.Bundle;
7
 
8
import androidx.annotation.NonNull;
9
import androidx.annotation.Nullable;
10
import androidx.fragment.app.Fragment;
11
 
45 gabriel 12
import android.os.Handler;
13
import android.os.Looper;
1 gabriel 14
import android.util.Log;
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;
45 gabriel 21
import android.widget.ImageView;
1 gabriel 22
import android.widget.TextView;
54 gabriel 23
import android.widget.Toast;
1 gabriel 24
 
25
import com.airbnb.lottie.LottieAnimationView;
26
import com.cesams.twogetskills.Constants;
27
import com.cesams.twogetskills.R;
28
import com.cesams.twogetskills.skeleton.ITwoGetSkills;
29
 
45 gabriel 30
import java.util.Timer;
31
import java.util.TimerTask;
1 gabriel 32
 
45 gabriel 33
 
1 gabriel 34
public class IntroFragment extends Fragment {
35
 
36
    private Button buttonGetStarted;
37
    private ITwoGetSkills iTwoGetSkills;
38
    LottieAnimationView figura;
45 gabriel 39
    private TextView register,introtext,signin,derechos;
40
    AnimationDrawable rocketAnimation;
41
    ImageView rocketImage, cesa;
1 gabriel 42
 
43
    public IntroFragment() {
44
        // Required empty public constructor
45
    }
46
 
47
 
48
 
49
    @Override
50
    public void onCreate(@Nullable Bundle savedInstanceState) {
51
        super.onCreate(savedInstanceState);
52
        setHasOptionsMenu(true);
53
    }
54
 
55
    @Override
56
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
57
        super.onCreateOptionsMenu(menu, inflater);
58
        menu.clear();
59
    }
60
 
61
    @Override
62
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
63
                             Bundle savedInstanceState) {
64
        // Inflate the layout for this fragment
65
        return inflater.inflate(R.layout.fragment_intro, container, false);
66
    }
67
 
68
    @Override
69
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
70
        super.onViewCreated(view, savedInstanceState);
71
 
45 gabriel 72
        rocketImage = view.findViewById(R.id.imageView4);
73
        rocketImage.setBackgroundResource(R.drawable.animationsplash);
74
        rocketAnimation = (AnimationDrawable) rocketImage.getBackground();
75
        rocketAnimation.start();
76
 
47 gabriel 77
        buttonGetStarted = getView().findViewById(R.id.intro_button_get_started);
78
        figura = getView().findViewById(R.id.animationView3); cesa=getView().findViewById(R.id.imageView2);
79
        register= getView().findViewById(R.id.knowmore); introtext = getView().findViewById(R.id.intro_textview_title);
80
        signin = getView().findViewById(R.id.signin_textview_communique_easily); derechos = getView().findViewById(R.id.textView19);
81
 
82
 
83
 
45 gabriel 84
        new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
85
            @Override
86
            public void run() {
87
                rocketAnimation.stop();
88
                rocketImage.setVisibility(View.GONE);
89
 
90
                figura.setVisibility(View.VISIBLE); derechos.setVisibility(View.VISIBLE);
91
                register.setVisibility(View.VISIBLE); introtext.setVisibility(View.VISIBLE);
92
                buttonGetStarted.setVisibility(View.VISIBLE); cesa.setVisibility(View.VISIBLE);
93
 
94
                signin.setVisibility(View.VISIBLE);
95
            }
96
        }, 3500);
97
 
1 gabriel 98
        try {
99
            iTwoGetSkills = (ITwoGetSkills) getActivity();
8 gabriel 100
            iTwoGetSkills.hideNavigationAndtoolbar();
45 gabriel 101
 
1 gabriel 102
        } catch(ClassCastException e) {
103
            new Exception("La Actividad no implementa Sign");
104
        }
105
 
106
 
107
        register.setOnClickListener(new View.OnClickListener() {
108
            @Override
21 gabriel 109
            public void onClick(View view) {
110
                Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://cesams.com"));
54 gabriel 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
               }
1 gabriel 117
            }
118
        });
119
 
120
        buttonGetStarted.setOnClickListener(new View.OnClickListener() {
121
            @Override
122
            public void onClick(View view) {
123
 
124
                iTwoGetSkills.invokeFragment(Constants.IDX_FRAGMENT_SIGNIN);
125
            }
126
        });
127
    }
45 gabriel 128
 
1 gabriel 129
}