Proyectos de Subversion Android Microlearning - Nuevo Interface

Rev

Rev 12 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 12 Rev 13
Línea 6... Línea 6...
6
import androidx.fragment.app.Fragment;
6
import androidx.fragment.app.Fragment;
7
import androidx.lifecycle.LifecycleOwner;
7
import androidx.lifecycle.LifecycleOwner;
8
import androidx.recyclerview.widget.GridLayoutManager;
8
import androidx.recyclerview.widget.GridLayoutManager;
9
import androidx.recyclerview.widget.RecyclerView;
9
import androidx.recyclerview.widget.RecyclerView;
Línea -... Línea 10...
-
 
10
 
-
 
11
import android.text.Editable;
10
 
12
import android.text.TextWatcher;
11
import android.util.Log;
13
import android.util.Log;
12
import android.view.LayoutInflater;
14
import android.view.LayoutInflater;
13
import android.view.MotionEvent;
15
import android.view.MotionEvent;
14
import android.view.View;
16
import android.view.View;
Línea 58... Línea 60...
58
    ArrayList<HashMap<String, String>> capsuleList;
60
    ArrayList<HashMap<String, String>> capsuleList;
59
    ImageView imagetarjeta;
61
    ImageView imagetarjeta;
60
    TabsCapsulesAdapter adapter2;
62
    TabsCapsulesAdapter adapter2;
61
    RecyclerView categorizados;
63
    RecyclerView categorizados;
62
    EditText busqueda; TextView textowelcome; Button continuar;
64
    EditText busqueda; TextView textowelcome; Button continuar;
63
    TabLayout tabs;
65
    TabLayout tabs; String tabactual="pendientes";
Línea 64... Línea 66...
64
 
66
 
65
    public WelcomeFragment() {
67
    public WelcomeFragment() {
66
        // Required empty public constructor
68
        // Required empty public constructor
Línea 107... Línea 109...
107
                capsuleList.clear();
109
                capsuleList.clear();
108
                adapter2.notifyDataSetChanged();
110
                adapter2.notifyDataSetChanged();
Línea 109... Línea 111...
109
 
111
 
110
                if(position==0)
112
                if(position==0)
111
                {
113
                {
-
 
114
                    tabactual="pendientes";
112
                    loadData("pendientes");
115
                    loadData(tabactual,"");
113
                    adapter2.notifyDataSetChanged();
116
                    adapter2.notifyDataSetChanged();
114
                }
117
                }
115
                else if(position==1)
118
                else if(position==1)
-
 
119
                {
116
                {
120
                    tabactual="cursando";
117
                    loadData("cursando");
121
                    loadData("cursando","");
118
                    adapter2.notifyDataSetChanged();
122
                    adapter2.notifyDataSetChanged();
119
                }
123
                }
120
                else if(position==2)
124
                else if(position==2)
-
 
125
                {
121
                {
126
                    tabactual="finalizados";
122
                    loadData("finalizados");
127
                    loadData("finalizados","");
123
                    adapter2.notifyDataSetChanged();
128
                    adapter2.notifyDataSetChanged();
124
                }
129
                }
Línea 125... Línea 130...
125
            }
130
            }
Línea 133... Línea 138...
133
            public void onTabReselected(TabLayout.Tab tab) {
138
            public void onTabReselected(TabLayout.Tab tab) {
Línea 134... Línea 139...
134
 
139
 
135
            }
140
            }
Línea 136... Línea 141...
136
        });
141
        });
Línea 137... Línea 142...
137
 
142
 
138
        loadData("pendientes");
143
        loadData("pendientes","");
139
 
144
 
140
        busqueda.setOnFocusChangeListener(new View.OnFocusChangeListener() {
145
        busqueda.setOnFocusChangeListener(new View.OnFocusChangeListener() {
Línea 148... Línea 153...
148
                }
153
                }
Línea 149... Línea 154...
149
 
154
 
150
            }
155
            }
Línea -... Línea 156...
-
 
156
        });
-
 
157
 
-
 
158
        busqueda.addTextChangedListener(new TextWatcher() {
-
 
159
            @Override
-
 
160
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-
 
161
 
-
 
162
            }
-
 
163
 
-
 
164
            @Override
-
 
165
            public void onTextChanged(CharSequence s, int start, int before, int count) {
-
 
166
                Log.e("El texto","buscado: "+s);
-
 
167
                capsuleList.clear();
-
 
168
                adapter2.notifyDataSetChanged();
-
 
169
                loadData(tabactual, s.toString());
-
 
170
            }
-
 
171
 
-
 
172
            @Override
-
 
173
            public void afterTextChanged(Editable s) {
-
 
174
 
-
 
175
 
-
 
176
 
-
 
177
            }
Línea 151... Línea 178...
151
        });
178
        });
Línea 423... Línea 450...
423
 
450
 
Línea 424... Línea 451...
424
        //Fin de primer tarjeta
451
        //Fin de primer tarjeta
Línea 425... Línea 452...
425
 
452
 
426
    }
453
    }
Línea 427... Línea 454...
427
 
454
 
Línea 428... Línea 455...
428
    private void loadData(String tabposition)
455
    private void loadData(String tabposition, String buscar)
429
    {
456
    {
Línea 430... Línea 457...
430
 
457
 
Línea 486... Línea 513...
486
                m_li.put("imagen",capsule.getImage());
513
                m_li.put("imagen",capsule.getImage());
487
                m_li.put("nombre",capsule.getName());
514
                m_li.put("nombre",capsule.getName());
488
                m_li.put("uuid",capsule.getUuid());
515
                m_li.put("uuid",capsule.getUuid());
489
                m_li.put("description",capsule.getDescription());
516
                m_li.put("description",capsule.getDescription());
Línea -... Línea 517...
-
 
517
 
-
 
518
                //Lleno la lista segun el requerimiento de filtro accionado por el usuario
490
 
519
 
Línea -... Línea 520...
-
 
520
                if(tabposition.equals("pendientes") && progress==null){
-
 
521
 
491
                if(tabposition.equals("pendientes") && progress==null){
522
                    if(buscar.equals(""))
-
 
523
                    {
-
 
524
                        capsuleList.add(m_li);
-
 
525
 
-
 
526
                    }
-
 
527
                    else
-
 
528
                    {
-
 
529
                        if (capsule.getName().matches("(?i).*"+buscar+".*")){
-
 
530
                            capsuleList.add(m_li);
-
 
531
                    }
Línea 492... Línea 532...
492
 
532
 
493
                    capsuleList.add(m_li);
533
                    }
Línea -... Línea 534...
-
 
534
 
-
 
535
                }
494
 
536
                else if (tabposition.equals("cursando") && progress != null && progress.getProgress()<100){
-
 
537
 
-
 
538
                    if(buscar.equals(""))
-
 
539
                    {
-
 
540
                        capsuleList.add(m_li);
-
 
541
 
-
 
542
                    }
-
 
543
                    else
-
 
544
                    {
-
 
545
                        if (capsule.getName().matches("(?i).*"+buscar+".*")){
Línea 495... Línea 546...
495
                }
546
                            capsuleList.add(m_li);
496
                else if (tabposition.equals("cursando") && progress != null && progress.getProgress()<100){
547
                        }
Línea -... Línea 548...
-
 
548
 
-
 
549
                    }
497
 
550
 
-
 
551
            }
-
 
552
                else if (tabposition.equals("finalizados") && progress != null && progress.getProgress()>=100){
-
 
553
 
-
 
554
                    if(buscar.equals(""))
-
 
555
                    {
-
 
556
                        capsuleList.add(m_li);
-
 
557
 
-
 
558
                    }
-
 
559
                    else
Línea 498... Línea 560...
498
                    capsuleList.add(m_li);
560
                    {
Línea 499... Línea 561...
499
 
561
                        if (capsule.getName().matches("(?i).*"+buscar+".*")){