Proyectos de Subversion Android Microlearning - Nuevo Interface

Rev

Ir a la última revisión | | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
2 gabriel 1
package com.cesams.twogetskills.fragment;
2
 
3
import android.os.Bundle;
4
 
11 gabriel 5
import androidx.annotation.NonNull;
2 gabriel 6
import androidx.fragment.app.Fragment;
7
import androidx.lifecycle.LifecycleOwner;
8
import androidx.recyclerview.widget.GridLayoutManager;
9
import androidx.recyclerview.widget.RecyclerView;
10
 
13 gabriel 11
import android.text.Editable;
12
import android.text.TextWatcher;
2 gabriel 13
import android.util.Log;
14
import android.view.LayoutInflater;
11 gabriel 15
import android.view.MotionEvent;
2 gabriel 16
import android.view.View;
17
import android.view.ViewGroup;
11 gabriel 18
import android.widget.AdapterView;
9 gabriel 19
import android.widget.Button;
8 gabriel 20
import android.widget.EditText;
9 gabriel 21
import android.widget.ImageView;
22
import android.widget.ProgressBar;
2 gabriel 23
import android.widget.TextView;
24
 
9 gabriel 25
import com.bumptech.glide.Glide;
26
import com.bumptech.glide.load.engine.DiskCacheStrategy;
27
import com.bumptech.glide.load.model.GlideUrl;
28
import com.bumptech.glide.load.model.LazyHeaders;
29
import com.bumptech.glide.request.RequestOptions;
30
import com.cesams.twogetskills.Constants;
2 gabriel 31
import com.cesams.twogetskills.R;
32
import com.cesams.twogetskills.adapter.CapsuleListViewAdapter;
4 gabriel 33
import com.cesams.twogetskills.adapter.TabsCapsulesAdapter;
2 gabriel 34
import com.cesams.twogetskills.dao.CapsuleDao;
35
import com.cesams.twogetskills.dao.ProgressDao;
16 gabriel 36
import com.cesams.twogetskills.dao.SlideDao;
2 gabriel 37
import com.cesams.twogetskills.dao.TopicDao;
38
import com.cesams.twogetskills.entity.Capsule;
39
import com.cesams.twogetskills.entity.Progress;
16 gabriel 40
import com.cesams.twogetskills.entity.Slide;
2 gabriel 41
import com.cesams.twogetskills.entity.Topic;
9 gabriel 42
import com.cesams.twogetskills.library.MD5;
2 gabriel 43
import com.cesams.twogetskills.skeleton.ITwoGetSkills;
12 gabriel 44
import com.google.android.material.tabs.TabLayout;
2 gabriel 45
 
46
import java.util.ArrayList;
9 gabriel 47
import java.util.Calendar;
2 gabriel 48
import java.util.HashMap;
49
import java.util.List;
9 gabriel 50
import java.util.Random;
51
import java.util.TimeZone;
2 gabriel 52
 
53
/**
54
 * A simple {@link Fragment} subclass.
55
 * Use the {@link WelcomeFragment#newInstance} factory method to
56
 * create an instance of this fragment.
57
 */
11 gabriel 58
public class WelcomeFragment extends Fragment implements LifecycleOwner {
2 gabriel 59
 
10 gabriel 60
    TextView username, titulotarjeta, progresoporcentaje, empezar; ProgressBar progresotarjeta;
9 gabriel 61
    private ITwoGetSkills iTwoGetSkills; View card;
2 gabriel 62
    ArrayList<HashMap<String, String>> capsuleList;
11 gabriel 63
    ImageView imagetarjeta;
64
    TabsCapsulesAdapter adapter2;
65
    RecyclerView categorizados;
9 gabriel 66
    EditText busqueda; TextView textowelcome; Button continuar;
13 gabriel 67
    TabLayout tabs; String tabactual="pendientes";
2 gabriel 68
 
69
    public WelcomeFragment() {
70
        // Required empty public constructor
71
    }
72
 
73
    public static WelcomeFragment newInstance() {
74
        WelcomeFragment fragment = new WelcomeFragment();
75
        return fragment;
76
    }
77
 
78
    @Override
79
    public void onCreate(Bundle savedInstanceState) {
80
        super.onCreate(savedInstanceState);
81
          }
82
 
83
    @Override
84
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
85
                             Bundle savedInstanceState) {
86
 
8 gabriel 87
 
2 gabriel 88
        iTwoGetSkills = (ITwoGetSkills) getActivity();
8 gabriel 89
        iTwoGetSkills.showNavigationAndToolbar();
2 gabriel 90
 
91
        View view= inflater.inflate(R.layout.fragment_welcome, container, false);
92
 
93
        username=view.findViewById(R.id.textView14);
8 gabriel 94
        textowelcome= view.findViewById(R.id.textView15);
95
        busqueda=view.findViewById(R.id.busqueda);
12 gabriel 96
        card= view.findViewById(R.id.include); empezar= view.findViewById(R.id.titlenotifi); tabs=view.findViewById(R.id.tabLayout);
8 gabriel 97
        capsuleList = new ArrayList<>();
2 gabriel 98
 
9 gabriel 99
        //Tarjeta Principal
11 gabriel 100
        titulotarjeta = view.findViewById(R.id.description); progresotarjeta= view.findViewById(R.id.progressBar2); imagetarjeta= view.findViewById(R.id.imagelist);
9 gabriel 101
        continuar = view.findViewById(R.id.button); progresoporcentaje = view.findViewById(R.id.textView16);
102
 
103
 
2 gabriel 104
        username.setText("¡Hola, "+(iTwoGetSkills.getPreference().getFirstName() +"!"));
105
 
12 gabriel 106
        tabs.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
107
            @Override
108
            public void onTabSelected(TabLayout.Tab tab) {
109
                int position=tab.getPosition();
2 gabriel 110
 
12 gabriel 111
                capsuleList.clear();
112
                adapter2.notifyDataSetChanged();
2 gabriel 113
 
12 gabriel 114
                if(position==0)
115
                {
13 gabriel 116
                    tabactual="pendientes";
117
                    loadData(tabactual,"");
12 gabriel 118
                    adapter2.notifyDataSetChanged();
119
                }
120
                else if(position==1)
121
                {
13 gabriel 122
                    tabactual="cursando";
123
                    loadData("cursando","");
12 gabriel 124
                    adapter2.notifyDataSetChanged();
125
                }
126
                else if(position==2)
127
                {
13 gabriel 128
                    tabactual="finalizados";
129
                    loadData("finalizados","");
12 gabriel 130
                    adapter2.notifyDataSetChanged();
131
                }
132
            }
133
 
134
            @Override
135
            public void onTabUnselected(TabLayout.Tab tab) {
136
 
137
            }
138
 
139
            @Override
140
            public void onTabReselected(TabLayout.Tab tab) {
141
 
142
            }
143
        });
144
 
13 gabriel 145
        loadData("pendientes","");
12 gabriel 146
 
8 gabriel 147
        busqueda.setOnFocusChangeListener(new View.OnFocusChangeListener() {
148
            @Override
149
            public void onFocusChange(View v, boolean hasFocus) {
150
                if(hasFocus)
151
                {
9 gabriel 152
                        card.setVisibility(View.GONE);
8 gabriel 153
                        username.setVisibility(View.GONE);
154
                        textowelcome.setVisibility(View.GONE);
155
                }
156
 
157
            }
158
        });
159
 
13 gabriel 160
        busqueda.addTextChangedListener(new TextWatcher() {
161
            @Override
162
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
8 gabriel 163
 
13 gabriel 164
            }
165
 
166
            @Override
167
            public void onTextChanged(CharSequence s, int start, int before, int count) {
168
                Log.e("El texto","buscado: "+s);
169
                capsuleList.clear();
170
                adapter2.notifyDataSetChanged();
171
                loadData(tabactual, s.toString());
172
            }
173
 
174
            @Override
175
            public void afterTextChanged(Editable s) {
176
 
177
 
178
 
179
            }
180
        });
181
 
182
 
4 gabriel 183
        adapter2 = new TabsCapsulesAdapter(getContext(),capsuleList);
2 gabriel 184
 
185
 
186
 
4 gabriel 187
        categorizados = view.findViewById(R.id.categorizados);
188
        GridLayoutManager layoutcategoria = new GridLayoutManager(getContext(),1,GridLayoutManager.VERTICAL, false);
189
        categorizados.setLayoutManager(layoutcategoria);
190
        categorizados.setAdapter(adapter2);
191
 
11 gabriel 192
 
193
 
194
 
8 gabriel 195
        categorizados.setOnFlingListener(new RecyclerView.OnFlingListener() {
196
            @Override
197
            public boolean onFling(int velocityX, int velocityY) {
198
 
199
                if (categorizados.canScrollVertically(-1) ) {
200
 
201
                    Log.e("Se activa", "On fling");
9 gabriel 202
                    card.setVisibility(View.GONE);
8 gabriel 203
                    username.setVisibility(View.GONE);
204
                    textowelcome.setVisibility(View.GONE);
205
                }else
206
                {
9 gabriel 207
                    card.setVisibility(View.VISIBLE);
8 gabriel 208
                    username.setVisibility(View.VISIBLE);
209
                    textowelcome.setVisibility(View.VISIBLE);
210
                }
211
 
212
                return false;
213
            }
214
        });
215
 
11 gabriel 216
 
8 gabriel 217
     /*   categorizados.setOnScrollChangeListener(new View.OnScrollChangeListener() {
218
            @Override
219
            public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
220
 
221
                if (!categorizados.canScrollVertically(-1)) {
222
                 //   Toast.makeText(getActivity(), "Last", Toast.LENGTH_LONG).show();
223
                    capsulas.setVisibility(View.VISIBLE);
224
                    username.setVisibility(View.VISIBLE);
225
                    textowelcome.setVisibility(View.VISIBLE);
226
                    Log.e("On scroll"," se activa");
227
                }
228
 
229
            }
230
        });
231
*/
2 gabriel 232
        return view;
233
    }
234
 
9 gabriel 235
    @Override
236
    public void onResume() {
237
        super.onResume();
238
        loadContinuecard();
239
    }
2 gabriel 240
 
11 gabriel 241
 
242
 
9 gabriel 243
    @Override
244
    public void onHiddenChanged(boolean hidden) {
245
        super.onHiddenChanged(hidden);
246
 
247
        Log.e("TAG", "onHiddenChanged : " + (hidden ? "true" : "false"));
248
 
249
        if(!hidden) {
16 gabriel 250
            Log.e("Esta oculto", "el fragmento");
251
 
252
            getActivity().runOnUiThread(() -> {
253
 
254
                capsuleList.clear();
255
 
256
                loadContinuecard();
257
                loadData("pendientes","");
258
 
259
                adapter2.notifyDataSetChanged();
260
 
261
                tabs.getTabAt(0).select();
262
 
263
            });
264
 
265
 
9 gabriel 266
        }
267
    }
268
 
269
    private void loadContinuecard(){
270
 
271
        Log.e("Cargo datos"," en tarjeta principal");
272
 
273
        //Capsula de primera tarjeta
274
        CapsuleDao capsuleDao = iTwoGetSkills.getDatabase().getCapsuleDao();
275
 
276
        Progress progress;
277
        ProgressDao progressDao = iTwoGetSkills.getDatabase().getProgressDao();
278
 
279
        List<Capsule> dbCapsules= capsuleDao.selectAll();
280
        for(Capsule dbCapsule : dbCapsules)
281
        {
282
            progress = progressDao.selectByCapsuleUuid(dbCapsule.getUuid());
283
 
284
            if (progress != null) {
285
 
10 gabriel 286
                    if (progress.getProgress() < 100) {
287
                        Log.e("Es menor"," a 100");
9 gabriel 288
 
289
                        titulotarjeta.setText(dbCapsule.getName());
10 gabriel 290
                        progresotarjeta.setVisibility(View.VISIBLE);
291
                        progresoporcentaje.setVisibility(View.VISIBLE);
9 gabriel 292
                        progresotarjeta.setProgress((int) progress.getProgress());
293
                        progresoporcentaje.setText("" + progress.getProgress() + " %");
10 gabriel 294
                        empezar.setText("En curso");
9 gabriel 295
 
296
                        iTwoGetSkills.getPreference().setCapsuleUuidActive(dbCapsule.getUuid());
297
                        iTwoGetSkills.getPreference().setTopicUuidActive(dbCapsule.getTopicUuid());
298
 
299
                        if (dbCapsule.getImage() != null && !dbCapsule.getImage().equals("")) {
300
 
301
                            TimeZone timeZone = TimeZone.getTimeZone("UTC");
302
                            Calendar calendar = Calendar.getInstance(timeZone);
303
                            TimeZone tz = calendar.getTimeZone();
304
                            int created = (int) (calendar.getTimeInMillis() / 1000);
305
 
306
                            Random random = new Random(created);
307
                            int rand = 1000 + random.nextInt(8999);
308
 
309
 
310
                            String deviceUuid = iTwoGetSkills.getPreference().getDeviceUuid();
311
                            String password = iTwoGetSkills.getPreference().getPassword();
312
 
313
 
314
                            String secret = MD5.generar(password + ':' + created + ':' + rand);
315
                            GlideUrl url = new GlideUrl(dbCapsule.getImage(), new LazyHeaders.Builder()
316
                                    .addHeader(Constants.HTTP_HEADER_ACCEPT, Constants.HTTP_HEADER_ACCEPT_VALUE)
317
                                    .addHeader(Constants.HTTP_HEADER_SECURITY_TOKEN, deviceUuid)
318
                                    .addHeader(Constants.HTTP_HEADER_SECURITY_SECRET, secret)
319
                                    .addHeader(Constants.HTTP_HEADER_SECURITY_CREATED, String.valueOf(created))
320
                                    .addHeader(Constants.HTTP_HEADER_SECURITY_RAND, String.valueOf(rand))
321
                                    .build());
322
 
323
                            RequestOptions options = new RequestOptions()
324
                                    .diskCacheStrategy(DiskCacheStrategy.ALL);
325
 
326
                            Glide.with(getContext()).load(url)
327
                                    .thumbnail()
328
                                    .apply(options)
329
                                    .into(imagetarjeta);
330
                        }
331
                    }
332
 
10 gabriel 333
            }
334
 
335
 
336
        }
337
 
338
        if(titulotarjeta.getText().equals(""))
339
        {
340
            Log.e("Nombre","vacio");
341
 
342
            //Despues del recorrido no se encontro progreso en ninguna capsula, por lo cual la tarjeta queda vacia
343
            // vamos a llenarla con la ultima capsula, que debe ser nueva al no tener progreso
344
 
345
            for(Capsule dbCapsule : dbCapsules)
346
            {
347
 
348
                progress = progressDao.selectByCapsuleUuid(dbCapsule.getUuid());
349
 
350
                if (progress == null) {
351
 
352
                        Log.e("Es nueva","");
353
 
354
                        titulotarjeta.setText(dbCapsule.getName());
355
                        progresotarjeta.setVisibility(View.INVISIBLE);
356
                        progresoporcentaje.setVisibility(View.INVISIBLE);
357
                        empezar.setText("Nueva");
358
                        continuar.setText("Ver cápsula");
359
 
360
                        iTwoGetSkills.getPreference().setCapsuleUuidActive(dbCapsule.getUuid());
361
                        iTwoGetSkills.getPreference().setTopicUuidActive(dbCapsule.getTopicUuid());
362
 
363
                        if (dbCapsule.getImage() != null && !dbCapsule.getImage().equals("")) {
364
 
365
                            TimeZone timeZone = TimeZone.getTimeZone("UTC");
366
                            Calendar calendar = Calendar.getInstance(timeZone);
367
                            TimeZone tz = calendar.getTimeZone();
368
                            int created = (int) (calendar.getTimeInMillis() / 1000);
369
 
370
                            Random random = new Random(created);
371
                            int rand = 1000 + random.nextInt(8999);
372
 
373
 
374
                            String deviceUuid = iTwoGetSkills.getPreference().getDeviceUuid();
375
                            String password = iTwoGetSkills.getPreference().getPassword();
376
 
377
 
378
                            String secret = MD5.generar(password + ':' + created + ':' + rand);
379
                            GlideUrl url = new GlideUrl(dbCapsule.getImage(), new LazyHeaders.Builder()
380
                                    .addHeader(Constants.HTTP_HEADER_ACCEPT, Constants.HTTP_HEADER_ACCEPT_VALUE)
381
                                    .addHeader(Constants.HTTP_HEADER_SECURITY_TOKEN, deviceUuid)
382
                                    .addHeader(Constants.HTTP_HEADER_SECURITY_SECRET, secret)
383
                                    .addHeader(Constants.HTTP_HEADER_SECURITY_CREATED, String.valueOf(created))
384
                                    .addHeader(Constants.HTTP_HEADER_SECURITY_RAND, String.valueOf(rand))
385
                                    .build());
386
 
387
                            RequestOptions options = new RequestOptions()
388
                                    .diskCacheStrategy(DiskCacheStrategy.ALL);
389
 
390
                            Glide.with(getContext()).load(url)
391
                                    .thumbnail()
392
                                    .apply(options)
393
                                    .into(imagetarjeta);
394
                        }
395
 
396
                    }
397
 
398
                /*
399
                if (progress != null) {
400
 
401
                    double progre = progress.getProgress();
402
 
403
                    if (progre >= 100) {
404
                        Log.e("Es mayor"," a 100");
405
 
406
                    } else {
407
 
408
                        Log.e("Es nueva","");
409
 
410
                        titulotarjeta.setText(dbCapsule.getName());
411
                        progresotarjeta.setVisibility(View.INVISIBLE);
412
                        progresoporcentaje.setVisibility(View.INVISIBLE);
413
                        empezar.setText("Nueva");
414
                        continuar.setText("Ver cápsula");
415
 
416
                        iTwoGetSkills.getPreference().setCapsuleUuidActive(dbCapsule.getUuid());
417
                        iTwoGetSkills.getPreference().setTopicUuidActive(dbCapsule.getTopicUuid());
418
 
419
                        if (dbCapsule.getImage() != null && !dbCapsule.getImage().equals("")) {
420
 
421
                            TimeZone timeZone = TimeZone.getTimeZone("UTC");
422
                            Calendar calendar = Calendar.getInstance(timeZone);
423
                            TimeZone tz = calendar.getTimeZone();
424
                            int created = (int) (calendar.getTimeInMillis() / 1000);
425
 
426
                            Random random = new Random(created);
427
                            int rand = 1000 + random.nextInt(8999);
428
 
429
 
430
                            String deviceUuid = iTwoGetSkills.getPreference().getDeviceUuid();
431
                            String password = iTwoGetSkills.getPreference().getPassword();
432
 
433
 
434
                            String secret = MD5.generar(password + ':' + created + ':' + rand);
435
                            GlideUrl url = new GlideUrl(dbCapsule.getImage(), new LazyHeaders.Builder()
436
                                    .addHeader(Constants.HTTP_HEADER_ACCEPT, Constants.HTTP_HEADER_ACCEPT_VALUE)
437
                                    .addHeader(Constants.HTTP_HEADER_SECURITY_TOKEN, deviceUuid)
438
                                    .addHeader(Constants.HTTP_HEADER_SECURITY_SECRET, secret)
439
                                    .addHeader(Constants.HTTP_HEADER_SECURITY_CREATED, String.valueOf(created))
440
                                    .addHeader(Constants.HTTP_HEADER_SECURITY_RAND, String.valueOf(rand))
441
                                    .build());
442
 
443
                            RequestOptions options = new RequestOptions()
444
                                    .diskCacheStrategy(DiskCacheStrategy.ALL);
445
 
446
                            Glide.with(getContext()).load(url)
447
                                    .thumbnail()
448
                                    .apply(options)
449
                                    .into(imagetarjeta);
450
                        }
451
 
452
                    }
9 gabriel 453
                }
10 gabriel 454
*/
455
            }
9 gabriel 456
 
10 gabriel 457
 
458
 
9 gabriel 459
        }
460
 
10 gabriel 461
 
462
 
9 gabriel 463
        continuar.setOnClickListener(v -> {
464
 
465
            iTwoGetSkills.invokeFragment(Constants.IDX_FRAGMENT_SLIDES);
466
        });
467
 
468
        //Fin de primer tarjeta
469
 
470
    }
471
 
13 gabriel 472
    private void loadData(String tabposition, String buscar)
2 gabriel 473
    {
474
 
13 gabriel 475
      //  Log.e("Las tabs", "position"+tabposition);
12 gabriel 476
 
2 gabriel 477
        TopicDao topicDao = iTwoGetSkills.getDatabase().getTopicDao();
478
        ArrayList<Topic> dbTopics = (ArrayList<Topic>) topicDao.selectAll();
479
 
480
        List<Capsule> dbCapsules;
481
        CapsuleDao capsuleDao = iTwoGetSkills.getDatabase().getCapsuleDao();
482
 
9 gabriel 483
 
484
 
485
 
2 gabriel 486
        for (Topic dbTopic : dbTopics) {
487
 
488
            dbCapsules = capsuleDao.selectAllByTopicUuid(dbTopic.getUuid());
489
 
9 gabriel 490
 
2 gabriel 491
            Capsule capsule;
492
            Progress progress;
493
            ProgressDao progressDao = iTwoGetSkills.getDatabase().getProgressDao();
16 gabriel 494
            SlideDao slideDao = iTwoGetSkills.getDatabase().getSlideDao();
2 gabriel 495
 
496
            HashMap<String, String> m_li;
497
 
9 gabriel 498
 
499
 
16 gabriel 500
            for(Capsule dbCapsule : dbCapsules) {
2 gabriel 501
                capsule = new Capsule();
502
                capsule.setTopicUuid(dbCapsule.getTopicUuid());
503
                capsule.setUuid(dbCapsule.getUuid());
504
                capsule.setName(dbCapsule.getName());
505
                capsule.setDescription(dbCapsule.getDescription());
506
                capsule.setImage(dbCapsule.getImage());
507
                capsule.setPosition(dbCapsule.getPosition());
508
 
509
 
510
                m_li = new HashMap<>();
511
 
512
 
513
                //m_li.put("copyright",copy);
514
 
515
 
516
                progress = progressDao.selectByCapsuleUuid(capsule.getUuid());
16 gabriel 517
                if (progress != null) {
518
                    capsule.setCompleted(progress.getCompleted());
2 gabriel 519
                    capsule.setViewSlides(progress.getViewSlides());
520
 
16 gabriel 521
                    capsule.setTotalSlides(progress.getTotalSlides());
2 gabriel 522
                    capsule.setProgress(progress.getProgress());
523
 
524
                    m_li.put("view", String.valueOf(progress.getViewSlides()));
525
                    m_li.put("total", String.valueOf(progress.getTotalSlides()));
526
                    m_li.put("progress", String.valueOf(progress.getProgress()));
16 gabriel 527
 
2 gabriel 528
                }
529
 
16 gabriel 530
                m_li.put("imagen", capsule.getImage());
531
                m_li.put("nombre", capsule.getName());
532
                m_li.put("uuid", capsule.getUuid());
533
                m_li.put("topicuuid", capsule.getTopicUuid());
534
                m_li.put("description", capsule.getDescription());
2 gabriel 535
 
536
 
13 gabriel 537
                //Lleno la lista segun el requerimiento de filtro accionado por el usuario
538
 
16 gabriel 539
                List<Slide> slides = slideDao.selectAllByCapsuleUuid(capsule.getUuid());
2 gabriel 540
 
16 gabriel 541
                if (slides.isEmpty()) {
12 gabriel 542
 
16 gabriel 543
                    Log.e("Capsula","Es omitida, no tiene slides");
544
                } else {
545
                    if (tabposition.equals("pendientes") && progress == null) {
546
 
547
                        if (buscar.equals("")) {
13 gabriel 548
                            capsuleList.add(m_li);
549
 
16 gabriel 550
                        } else {
551
                            if (capsule.getName().matches("(?i).*" + buscar + ".*")) {
552
                                capsuleList.add(m_li);
553
                            }
13 gabriel 554
 
16 gabriel 555
                        }
12 gabriel 556
 
16 gabriel 557
                    } else if (tabposition.equals("cursando") && progress != null && progress.getProgress() < 100) {
12 gabriel 558
 
16 gabriel 559
                        if (buscar.equals("")) {
13 gabriel 560
                            capsuleList.add(m_li);
16 gabriel 561
 
562
                        } else {
563
                            if (capsule.getName().matches("(?i).*" + buscar + ".*")) {
564
                                capsuleList.add(m_li);
565
                            }
566
 
13 gabriel 567
                        }
568
 
16 gabriel 569
                    } else if (tabposition.equals("finalizados") && progress != null && progress.getProgress() >= 100) {
13 gabriel 570
 
16 gabriel 571
                        if (buscar.equals("")) {
572
                            capsuleList.add(m_li);
2 gabriel 573
 
16 gabriel 574
                        } else {
575
                            if (capsule.getName().matches("(?i).*" + buscar + ".*")) {
576
                                capsuleList.add(m_li);
577
                            }
2 gabriel 578
 
13 gabriel 579
                        }
580
 
581
                    }
582
 
12 gabriel 583
                }
2 gabriel 584
 
12 gabriel 585
            }
2 gabriel 586
 
12 gabriel 587
 
2 gabriel 588
        }
589
 
590
    }
591
 
592
 
593
}